/* タスクボード。色は変数で持ち、ライトとダークの両方（設計 7-5） */
:root {
  --bg: #f6f7f9; --panel: #ffffff; --colbg: #eef0f3; --card: #ffffff; --line: #e3e6eb; --line2: #d5d9e0;
  --ink: #1d2330; --ink2: #475063; --mute: #626b7d; --accent: #2f5bd3; --accent-bg: #e8eefc; --on-accent: #ffffff;
  --red: #c9281d; --red-bg: #fde8e6; --amber: #9a5100; --amber-bg: #fff1dc; --blue-bg: #e7efff;
  --green: #17794b; --green-bg: #e3f4ea; --skel: #e6e9ee; --shadow: 0 1px 2px rgba(20, 28, 45, .06); --shadow2: 0 12px 32px rgba(20, 28, 45, .18);
  --r: 10px; --head: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218; --panel: #151922; --colbg: #1a1f29; --card: #212734; --line: #2a3140; --line2: #364053;
    --ink: #e8ecf3; --ink2: #b7c0cf; --mute: #8f9aad; --accent: #7aa2ff; --accent-bg: #22304f; --on-accent: #0f1218;
    --red: #ff6b5e; --red-bg: #3d1f1d; --amber: #ffb648; --amber-bg: #3b2a12; --blue-bg: #1f2b45;
    --green: #4cc38a; --green-bg: #17331f; --skel: #2a303d; --shadow: none; --shadow2: 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1218; --panel: #151922; --colbg: #1a1f29; --card: #212734; --line: #2a3140; --line2: #364053;
  --ink: #e8ecf3; --ink2: #b7c0cf; --mute: #8f9aad; --accent: #7aa2ff; --accent-bg: #22304f; --on-accent: #0f1218;
  --red: #ff6b5e; --red-bg: #3d1f1d; --amber: #ffb648; --amber-bg: #3b2a12; --blue-bg: #1f2b45;
  --green: #4cc38a; --green-bg: #17331f; --skel: #2a303d; --shadow: none; --shadow2: 0 12px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  display: flex; flex-direction: column; overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
.ic { width: 16px; height: 16px; flex: none; }
.ic.big { width: 40px; height: 40px; color: var(--mute); }
[hidden] { display: none !important; }
kbd { font: 11px ui-monospace, Menlo, monospace; border: 1px solid var(--line2); border-radius: 4px; padding: 1px 5px; color: var(--mute); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 60; background: var(--panel); color: var(--accent); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow2); }
.skip:focus { top: 8px; }
#main:focus { outline: 0; }
/* 主のボタン（決める操作）は青で塗る。文字色はダークでは濃い色（F5-09・K3-14） */
.primary { background: var(--accent) !important; border-color: var(--accent) !important; color: var(--on-accent) !important; font-weight: 600; }
.linkbtn { border: 0; background: none; color: var(--accent); padding: 0; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

/* 上の帯 */
#top { min-height: var(--head); flex: none; display: flex; align-items: center; gap: 24px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; width: 228px; flex: none; min-width: 0; }
.brand h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.searchbox { display: flex; align-items: center; gap: 8px; background: var(--colbg); border-radius: 8px; padding: 0 10px; height: 36px; flex: 0 1 320px; min-width: 120px; color: var(--mute); }
.searchbox input { border: 0; background: transparent; outline: 0; flex: 1; min-width: 0; color: var(--ink); font: inherit; }
.sclear { display: none; }
.chips { display: flex; gap: 8px; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line2); background: var(--panel); font-size: 13px; white-space: nowrap; }
.chip b { font-weight: 500; color: var(--ink2); }
.chip .dot, .col header .dot, .fchip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); flex: none; }
.chip-today .dot, .fchip-today .dot { background: var(--accent); }
.chip.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.tools { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.time { border: 0; background: none; color: var(--mute); font-size: 12px; padding: 6px 8px; border-radius: 6px; white-space: nowrap; }
.time:hover { background: var(--colbg); }
.iconbtn { position: relative; width: 40px; height: 40px; border: 0; background: none; border-radius: 8px; display: grid; place-items: center; color: var(--ink2); flex: none; }
.iconbtn:hover { background: var(--colbg); }
.iconbtn .ic { width: 22px; height: 22px; }
.iconbtn.help { font-weight: 700; font-size: 16px; }
.nb { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10px; display: grid; place-items: center; }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #3b4252; color: #fff; font-weight: 700; margin-left: 4px; display: grid; place-items: center; flex: none; }
.avatar .ic { width: 20px; height: 20px; }
.sp-only { display: none; }
/* ログイン前・権限なしは検索・札・ベル・自分を出さない（K5-12） */
body.signed-out .searchbox, body.signed-out .chips, body.signed-out .tools, body.signed-out #side { display: none !important; }

/* 状態の帯 */
.band { flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 20px; font-size: 13px; background: var(--amber-bg); color: var(--ink); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.band button { border: 1px solid var(--line2); background: var(--panel); border-radius: 8px; padding: 6px 14px; min-height: 36px; }
.band-off { background: var(--red-bg); }
.band-ro { background: var(--colbg); color: var(--ink2); }

/* 全体 */
#wrap { flex: 1; display: flex; min-height: 0; }
#side { width: 248px; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; overflow-y: auto; }
.side-skel .bar { height: 14px; margin: 14px 12px; }
.side-row { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; border-radius: 8px; padding: 9px 12px; text-align: left; color: var(--ink2); }
.side-row:hover { background: var(--colbg); }
.side-row.on { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.side-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-row .n { color: var(--mute); font-size: 12px; }
.side-h { font-size: 11px; color: var(--mute); padding: 14px 12px 4px; letter-spacing: .05em; }
.ub { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; flex: none; }
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0 24px 16px; overflow: hidden; }
.lead { margin: 14px 0 0; font-size: 13px; color: var(--ink2); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.mhead { display: flex; align-items: baseline; gap: 12px; padding: 10px 0 14px; }
.mhead h2 { font-size: 20px; margin: 0; }
.mhead .sum { color: var(--mute); font-size: 13px; }
.mhead .order { margin-left: auto; color: var(--ink2); font-size: 12px; white-space: nowrap; }
.filtered { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--accent); background: var(--accent-bg); border-radius: 8px; padding: 6px 12px; margin: 0 0 10px; }
.roomchips, .tabs { display: none; }
.cols { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.col { background: var(--colbg); border-radius: 12px; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.col header { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; }
.col h3 { font-size: 14px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col .cnt { font-size: 11px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--line); color: var(--ink2); display: inline-grid; place-items: center; padding: 0 6px; }
.col .cnt:empty { display: none; }
.col header small { margin-left: auto; color: var(--mute); font-size: 11px; white-space: nowrap; }
.col-fuji header .dot { background: var(--amber); }
.col-body { flex: 1; overflow-y: auto; padding: 0 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.subh { font-size: 12px; font-weight: 600; color: var(--ink2); padding: 4px 4px 0; display: flex; gap: 6px; }
.subh span { color: var(--mute); font-weight: 400; }
.empty { color: var(--mute); font-size: 13px; text-align: center; margin: 24px 0 8px; }
.empty-hint { justify-content: center; gap: 16px; margin: 0 0 16px; }
.empty-hint .linkbtn { padding: 10px 4px; font-size: 14px; }
.empty-all { text-align: center; color: var(--ink2); padding: 8px 0 14px; }
.empty-all p { margin: 0 0 8px; }
.empty-all button, .fold { border: 1px solid var(--line2); background: var(--panel); border-radius: 8px; padding: 6px 14px; min-height: 40px; }
.fold { display: flex; align-items: center; justify-content: space-between; width: 100%; color: var(--ink2); font-size: 13px; }
.fold[aria-expanded="true"] .chev { transform: rotate(90deg); }
.fatal, .gate { margin: 10vh auto 0; max-width: 460px; padding: 0 20px; text-align: center; color: var(--ink2); }
.fatal h2, .gate h2 { font-size: 19px; color: var(--ink); line-height: 1.5; }
.gate p { margin: 10px 0; }
.gate button.big { border: 0; border-radius: 10px; padding: 14px 28px; font-size: 16px; min-height: 48px; margin: 12px 0; }
.inapp-steps { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-top: 16px; }
.inapp-steps ol { margin: 8px 0; padding-left: 1.4em; display: grid; gap: 10px; }
.inapp-steps ol button { border: 1px solid var(--line2); background: var(--panel); border-radius: 8px; padding: 8px 12px; min-height: 40px; margin-right: 6px; }
.inapp-steps .primary { width: 100%; }

/* カード */
.card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.card:hover { border-color: var(--line2); box-shadow: 0 2px 8px rgba(20, 28, 45, .08); }
.card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card.is-turn { border-left: 3px solid var(--amber); }
.card.flash { animation: flash .6s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.card.locked { cursor: default; }
.c-top { display: flex; align-items: center; gap: 6px; min-height: 20px; flex-wrap: wrap; }
.code { font-size: 12px; color: var(--mute); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--colbg); color: var(--ink2); border: 1px solid var(--line2); white-space: nowrap; }
.tag-fuji { background: var(--amber-bg); color: var(--amber); border-color: transparent; font-weight: 600; }
.tag-sens { background: var(--panel); }
.tag-fresh { background: var(--blue-bg); color: var(--accent); border-color: transparent; font-weight: 600; }
.tag-redo { background: var(--red-bg); color: var(--red); border-color: transparent; font-weight: 600; }
.tag-turn { background: var(--amber-bg); color: var(--amber); border-color: var(--amber); font-weight: 700; }
.lock { width: 13px; height: 13px; color: var(--mute); }
.c-top .ub { margin-left: auto; }
/* カードの未読は点（1件＝1つの未読。数はベル・タブ・部屋で「未読の件の数」に統一・T244） */
.ub.ub-dot { min-width: 10px; width: 10px; height: 10px; padding: 0; border-radius: 50%; }
.c-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; font-weight: 600; font-size: 14.5px; margin: 6px 0 8px; color: inherit; text-decoration: none; -webkit-user-drag: none; }
.c-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--mute); min-width: 0; }
.c-meta .ic { width: 13px; height: 13px; }
.due { display: inline-flex; gap: 4px; align-items: center; background: var(--colbg); color: var(--ink2); padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.due.late { background: var(--red-bg); color: var(--red); font-weight: 600; }
.due.today { background: var(--blue-bg); color: var(--accent); font-weight: 600; }
.due.prov { background: transparent; border: 1px dashed var(--line2); }
.room { display: inline-flex; gap: 3px; align-items: center; max-width: 100%; min-width: 0; }
.room .rn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.c-lock { margin: 6px 0 0; font-size: 12px; color: var(--ink2); }
/* 足元: 最後の動き・作業の人・「移す」を1行に。移すは場所を取り、文字に重ならない（F3-08） */
.c-foot { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; font-size: 12px; color: var(--ink2); display: flex; align-items: center; gap: 8px; min-width: 0; font-feature-settings: "palt"; }
.c-foot .last { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb { color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 50%; }
.mv { flex: none; margin-left: auto; border: 1px solid var(--line2); background: var(--panel); color: var(--ink2); border-radius: 6px; font-size: 12px; padding: 2px 8px; min-height: 26px; opacity: 0; transition: opacity .12s; }
.card:hover .mv, .card.sel .mv, .card:focus-within .mv, .mv:focus { opacity: 1; }
.card.skel { cursor: default; }
.bar { display: block; height: 12px; border-radius: 6px; background: var(--skel); margin: 8px 0; animation: pulse 1.2s infinite ease-in-out; }
.bar.s { width: 40px; margin: 0; } .bar.m { width: 60%; }
@keyframes pulse { 50% { opacity: .5; } }

/* 1件の詳細（PC は右からのパネル） */
#detail { position: fixed; top: var(--head); right: 0; bottom: 0; width: 480px; max-width: 100%; background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow2); display: flex; flex-direction: column; z-index: 20; animation: slide .15s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
/* 広い画面では詳細を開いてもボードが隠れないよう、パネルの分だけ縮める（K3-12） */
@media (min-width: 1280px) { body.detail-open #wrap { margin-right: 480px; } }
/* 戻る｜K番号（小さく上）／題名｜閉じる（F3-19） */
.d-head { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "back code close" "back title close"; align-items: center; column-gap: 8px; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); }
.d-head h2 { grid-area: title; font-size: 17px; margin: 0; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
.d-head .code { grid-area: code; }
.d-back { grid-area: back; display: none; }
.d-close { grid-area: close; align-self: start; }
.d-scroll { flex: 1; overflow-y: auto; padding: 16px 20px; }
/* 何を聞かれているかの帯は、流しても見出しの下に残す（F4-13） */
.fuji-banner { position: sticky; top: -16px; z-index: 1; background: var(--amber-bg); color: var(--ink); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px; white-space: pre-wrap; box-shadow: 0 0 0 4px var(--panel); }
.facts { display: grid; grid-template-columns: 88px 1fr; gap: 8px 12px; margin: 0 0 12px; font-size: 13px; }
.facts dt { color: var(--mute); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts .late { color: var(--red); font-weight: 600; }
.state { display: inline-block; padding: 1px 8px; border-radius: 5px; background: var(--colbg); font-weight: 600; font-size: 12px; }
.state.st-fuji { background: var(--amber-bg); color: var(--amber); }
.state.st-done { background: var(--green-bg); color: var(--green); }
.state.st-doing { background: var(--blue-bg); color: var(--accent); }
.orig .linkbtn { padding: 10px 0; }
.body-text { white-space: pre-wrap; word-break: break-all; font: 13px/1.6 inherit; font-family: inherit; background: var(--colbg); padding: 10px 12px; border-radius: 8px; margin: 8px 0 0; }
.tl-h { font-size: 13px; color: var(--ink2); margin: 20px 0 8px; }
.tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
/* やり取り: 相手（人）＝青い線、自分＝薄い色の地、AI＝点線と「AI」の札（K3-08・K5-17） */
.ln { border-left: 3px solid var(--line2); padding: 4px 8px 4px 12px; border-radius: 0 8px 8px 0; }
.ln.who-owner, .ln.who-member { border-color: var(--accent); }
.ln.mine { background: var(--colbg); border-color: var(--ink2); }
.ln.who-claude, .ln.who-bot { border-left-style: dashed; border-color: var(--mute); }
.ln.who-bot { opacity: .9; }
.ln.who-claude .ln-h b::after, .ln.who-bot .ln-h b::after { content: "AI"; margin-left: 6px; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 4px; background: var(--accent-bg); color: var(--accent); vertical-align: 1px; }
.ln.who-bot .ln-h b::after { content: "AI秘書"; }
.ln-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 12px; color: var(--mute); font-feature-settings: "palt"; }
.ln-h b { color: var(--ink); font-size: 13px; }
.ln-h .kind { color: var(--ink2); }
.via { font-size: 11px; color: var(--mute); }
.st { font-size: 10.5px; border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; color: var(--ink2); }
.st-queued { color: var(--amber); border-color: var(--amber); background: var(--amber-bg); }
.st-failed { color: var(--red); border-color: var(--red); background: var(--red-bg); }
/* 長い発言はやり取りを占領しないよう、欄の中で流す（K4-24） */
.ln p { margin: 4px 0 0; white-space: pre-wrap; word-break: break-all; max-height: 16em; overflow-y: auto; }
.unread-line { font-size: 11px; color: var(--red); display: flex; align-items: center; gap: 8px; }
.unread-line::before, .unread-line::after { content: ""; flex: 1; border-top: 1px solid var(--red); }
.tl-load { color: var(--mute); font-size: 13px; }
.tl-load.err { color: var(--red); }
.d-input { border-top: 1px solid var(--line); padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); }
.d-input p { margin: 0; font-size: 13px; color: var(--mute); }

/* 板（ベル・キー・自分） */
#pop { position: fixed; inset: 0; z-index: 30; background: rgba(10, 14, 22, .18); }
.pop-in { position: absolute; top: calc(var(--head) + 6px); right: 16px; width: 360px; max-width: calc(100% - 24px); max-height: 70vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow2); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.pop-in h3 { margin: 0 0 4px; font-size: 14px; }
.pop-in > button { border: 1px solid var(--line2); background: var(--panel); border-radius: 8px; padding: 10px 12px; min-height: 44px; text-align: left; }
.usage { font-size: 13px; color: var(--ink2); border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 4px; }
.usage p { margin: 0 0 6px; }
.usage ul { margin: 6px 0; padding-left: 1.2em; display: grid; gap: 4px; }
.usage b { color: var(--ink); }
.bell { list-style: none; margin: 0; padding: 0; }
.bell button { width: 100%; display: grid; grid-template-columns: 3.6em minmax(0, 1fr); gap: 2px 8px; text-align: left; border: 0; background: none; border-radius: 8px; padding: 10px 8px; }
.bell button:hover { background: var(--colbg); }
.bell .bt { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell small { grid-column: 2; color: var(--mute); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.keys dd { margin: 0; }
.muted { color: var(--mute); font-size: 12px; margin: 4px 0 0; }
/* 知らせ: 押せない場所には重ねない（入れ物は指を通す） */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 40; pointer-events: none; max-width: min(420px, calc(100% - 32px)); }
.toast { pointer-events: none; background: var(--ink); color: var(--panel); padding: 10px 14px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow2); }
/* 詳細を開いている間は、詳細の左（送るボタンの上に重ねない・F4-16・K4-21） */
body.detail-open #toasts { right: 500px; }
.toast.undo, .toast.act { display: flex; align-items: center; gap: 12px; }
.toast.undo, .toast.act { pointer-events: auto; }
.toast.undo button, .toast.act button { border: 0; background: none; color: var(--accent-bg); font-weight: 700; padding: 8px 4px; margin: -8px 0; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; flex: none; }
.toast kbd { color: inherit; border-color: currentColor; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* 段1b: 移す・ドラッグ・板・入力欄 */
.card.dragging { opacity: .35; }
.ghost { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; box-shadow: var(--shadow2); transform: rotate(2deg); }
.is-dragging, .is-dragging * { cursor: grabbing !important; user-select: none; }
.col.drop-ok { outline: 2px dashed var(--line2); outline-offset: -2px; }
.col.drop-ok.over { outline-color: var(--accent); background: var(--accent-bg); }
.col.drop-no { opacity: .55; position: relative; }
/* 落とせない理由は列の見出しの位置に（カードに重ねない・F5-22） */
.col.drop-no::after { content: attr(data-why); position: absolute; left: 8px; right: 8px; top: 6px; background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--ink2); text-align: center; }
.mv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mv-list button { width: 100%; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line2); background: var(--panel); color: var(--ink); border-radius: 10px; padding: 12px; min-height: 48px; text-align: left; }
.mv-list button:disabled { opacity: .5; }
.mv-list small { margin-left: auto; color: var(--mute); font-size: 12px; }
.sheet textarea, .sheet input, .compose textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--line2); border-radius: 8px; padding: 10px; resize: vertical; }
.sheet .row { display: flex; gap: 8px; justify-content: flex-end; }
.sheet .row button, .sheet .cancel { border: 1px solid var(--line2); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 10px 18px; min-height: 48px; }
/* PC の「移す」板は画面の中ほどに（押したカードから遠い右上に出さない・F3-17・F5-18） */
.pop-in.sheet { top: 18vh; left: 50%; right: auto; transform: translateX(-50%); width: 400px; }
.err { margin: 0; color: var(--red); font-size: 13px; }
.err:empty { display: none; }
.compose { display: flex; flex-direction: column; gap: 8px; }
.kinds { display: flex; gap: 6px; flex-wrap: wrap; }
.kinds button { border: 1px solid var(--line2); background: var(--panel); color: var(--ink2); border-radius: 18px; padding: 6px 14px; min-height: 36px; font-size: 13px; }
.kinds button.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); font-weight: 600; }
/* 届け先の1行は送るボタンの上に、読める濃さで（K3-07） */
.compose .note { order: 1; }
.c-row { order: 2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.c-row .primary { margin-left: auto; border: 0; border-radius: 8px; padding: 8px 18px; min-height: 40px; display: inline-flex; gap: 8px; align-items: center; }
.c-row kbd { font-size: 11px; opacity: .8; color: inherit; border-color: currentColor; }
.c-row select { font: inherit; font-size: 13px; border: 1px solid var(--line2); border-radius: 6px; padding: 4px 6px; min-height: 36px; background: var(--panel); color: var(--ink); }
.opt { font-size: 13px; color: var(--ink2); display: inline-flex; gap: 8px; align-items: center; min-height: 40px; }
.opt input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.d-input .note { font-size: 12.5px; color: var(--ink2); margin: 0; }
.ln.pending { opacity: .6; }

/* ---------------------------------------------------------------- 中くらいの幅（761〜1100px: iPad 縦・画面2分割・150%拡大・F5-08・F3-03・K3-10）
   左の並びは畳んで部屋チップの帯にし、上の帯は折り返さない。ベル・自分は必ず見せる */
@media (max-width: 1100px) {
  #top { gap: 12px; padding: 0 16px; }
  .brand { width: auto; }
  .chips { display: none; }
  #side { display: none; }
  #main { padding: 0 16px 12px; }
  .roomchips { display: flex; }
  .lead { margin-top: 10px; }
  .mhead { padding: 6px 0 10px; }
  .mhead h2 { font-size: 17px; }
  .cols { gap: 8px; }
  .col-body { padding: 0 6px 10px; }
  .card { padding: 10px 12px; }
}
@media (max-width: 900px) {
  .time { display: none; }
}

/* 部屋チップの帯（中くらい・スマホ）。横に流せることが分かるよう端をぼかす */
.roomchips { gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; padding: 10px 16px 6px; margin: 0 -16px; scrollbar-width: none; align-items: center; flex: none; touch-action: pan-x pan-y;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%); }
.roomchips::-webkit-scrollbar { display: none; }
.roomchips::after { content: ""; flex: none; width: 12px; }
.rchip { flex: none; height: 40px; padding: 0 14px; border-radius: 99px; border: 1px solid transparent; background: var(--colbg); color: var(--ink2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.rchip span { color: var(--mute); font-size: 12px; }
.rchip span:empty { display: none; }
.rchip.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.rchip.on span { color: inherit; }
.roomchips .sep { flex: none; width: 1px; height: 24px; background: var(--line2); }

/* ---------------------------------------------------------------- スマホ（設計 7-5: 列はタブ・詳細は全画面・押し所は44以上）
   横向きの電話（高さ500以下で指の端末）もスマホの作りのまま（F2-10・F4-10・K2-21・K5-13） */
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) {
  :root { --head: 56px; }
  #top { gap: 4px; padding: 0 max(12px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); flex-wrap: wrap; }
  .brand { flex: 1 1 0; }
  .searchbox input::-webkit-search-cancel-button { display: none; }
  .brand .logo { display: none; }
  .brand h1 { font-size: 19px; }
  .tools { gap: 2px; }
  /* 検索欄は帯の下の段に入り、チップ帯を押し下げる（覆わない・F2-14・F3-18） */
  .searchbox { display: none; order: 10; flex: 1 0 100%; width: 100%; height: 44px; margin: 0 0 8px; padding-right: 0; }
  body.sp-search .searchbox { display: flex; }
  .sclear { display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: none; color: var(--mute); flex: none; }
  .sclear .ic { width: 18px; height: 18px; }
  .chips, .pc-only, .time { display: none !important; }
  .sp-only { display: grid; }
  .empty-hint.sp-only { display: flex; }
  .iconbtn { width: 44px; height: 44px; }
  .avatar { width: 44px; height: 44px; margin-left: 2px; }
  .band { padding: 8px 16px; }
  #side { display: none; }
  #main { padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); overflow-y: auto; display: block; }
  /* 全体の数字といまの絞り込みを1行で（F1-05） */
  .mhead { padding: 4px 0 2px; gap: 8px; }
  .mhead h2 { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .mhead .sum { font-size: 12px; white-space: nowrap; }
  .mhead .order { display: none; }
  .lead { margin: 10px 0 2px; font-size: 12.5px; }
  .lead .linkbtn { padding: 6px 0; font-size: 12.5px; }
  .roomchips { padding: 10px 16px 8px; }
  .rchip { height: 44px; }
  .filtered { margin: 6px 0; }
  /* 列のタブ: 4つを等分して常に全部見せる（「済み」が切れない・F2-04・F3-12・K2-17・K3-16・K5-19） */
  .tabs { display: flex; border-bottom: 1px solid var(--line); margin: 0 -16px; padding: 0 4px; position: sticky; top: 0; background: var(--bg); z-index: 2; }
  .tab { flex: 1 1 0; min-width: 0; position: relative; border: 0; background: none; height: 52px; padding: 4px 2px 2px; color: var(--ink2); display: flex; flex-wrap: wrap; align-content: center; align-items: center; justify-content: center; gap: 0 4px; border-bottom: 3px solid transparent; line-height: 1.25; }
  .tab .tlab { flex: 0 0 100%; text-align: center; font-size: clamp(12px, 3.6vw, 15px); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab .tn { color: var(--mute); font-size: 12px; font-variant-numeric: tabular-nums; min-height: 15px; }
  .tab .ub { min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  .tab.on { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
  .tab.on .tn { color: var(--ink2); }
  .tab.hot .tn { color: var(--amber); font-weight: 700; }
  .cols { display: block; padding: 12px 0 calc(24px + env(safe-area-inset-bottom)); }
  .col { display: none; background: none; }
  #main[data-tab="todo"] .col-todo, #main[data-tab="doing"] .col-doing, #main[data-tab="fuji"] .col-fuji, #main[data-tab="done"] .col-done { display: flex; }
  .col header { display: none; }
  .col-body { padding: 0; overflow: visible; gap: 8px; }
  .card { padding: 12px 14px 10px; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .c-title { margin: 4px 0 6px; }
  .c-foot { margin-top: 8px; padding-top: 4px; }
  /* 「移す」は足元の行の右端に、44px の押し所で（F2-16・F3-07・K3-18） */
  .mv { opacity: 1; min-height: 44px; min-width: 64px; margin: -4px -8px -6px auto; padding: 0 12px; font-size: 13px; border-color: transparent; background: none; color: var(--accent); font-weight: 600; }
  .col-done .mv { display: none; }
  /* 詳細は全画面 */
  #detail { top: 0; width: 100%; z-index: 25; border: 0; animation: none; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .d-head { padding: max(6px, env(safe-area-inset-top)) 12px 8px 4px; column-gap: 2px; }
  .d-back { display: grid; }
  .d-close { display: none; }
  .d-head h2 { font-size: 16px; }
  .d-scroll { padding: 12px 16px; }
  .d-input { padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); }
  /* 入力欄は2行で始め、書くときに伸ばす（やり取りを残す・F3-06・K2-16・K3-06） */
  .compose { gap: 6px; }
  .compose textarea { height: 64px; min-height: 48px; resize: none; }
  .compose textarea:focus { height: 104px; }
  .kinds button { min-height: 44px; padding: 8px 16px; font-size: 14px; }
  .c-row .primary { min-height: 44px; padding: 8px 22px; font-size: 15px; }
  .c-row select { min-height: 44px; }
  .opt { min-height: 44px; font-size: 14px; }
  .opt input { width: 24px; height: 24px; }
  /* 書いている間は題名を1行にし、届け先も1行に詰める（K5-25） */
  #detail:has(.compose textarea:focus) .d-head h2 { -webkit-line-clamp: 1; }
  #detail:has(.compose textarea:focus) .compose .note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pop-in { left: 12px; right: 12px; width: auto; max-width: none; }
  .pop-in.sheet { top: auto; bottom: 0; left: 0; right: 0; transform: none; width: auto; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 80vh; }
  .sheet .row button, .sheet .cancel { flex: 1; }
  /* スマホの使い方にはキー操作の表を出さない */
  .pop-in h3:has(+ .keys), .pop-in .keys, .pop-in .keys + .muted { display: none; }
  /* 知らせ: 詳細・板が開いている間は上に出す（送る・やめるを隠さない・F2-12・F3-05・K1-13・K2-15） */
  #toasts { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: none; }
  body:has(#pop:not([hidden])) #toasts { right: 16px; top: calc(8px + env(safe-area-inset-top)); bottom: auto; }
  body.detail-open #toasts { right: 16px; top: calc(76px + env(safe-area-inset-top)); bottom: auto; }
  .toast { font-size: 14px; padding: 12px 14px; }
}
/* 横向きの電話: 上の帯・チップ・タブを詰めて、カードと詳細のやり取りを残す（F3-20・K2-22・K3-24・K1-12） */
@media (pointer: coarse) and (max-height: 500px) {
  :root { --head: 48px; }
  .brand h1 { font-size: 17px; }
  .lead, .mhead { display: none; }
  .roomchips { padding: 6px 16px 4px; }
  .rchip { height: 40px; }
  .tab { height: 44px; gap: 6px; }
  .tab .tlab { flex-basis: auto; }
  .d-head h2 { -webkit-line-clamp: 1; }
  .compose textarea { height: 48px; }
  .compose textarea:focus { height: 64px; }
  .kinds button { min-height: 40px; padding: 4px 14px; }
  .compose .note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
/* 指の端末では入力の文字を16px以上に（iPhone が押すたびに拡大しない・F2-11） */
@media (max-width: 760px), (pointer: coarse) {
  .searchbox input, .sheet textarea, .sheet input, .compose textarea, .c-row select { font-size: 16px; }
}

/* T244 第3回: 詳細の見出しの下に状態と期日（やり取りを送っても見える） */
.d-head { grid-template-areas: "back code close" "back title close" "back sum close"; }
.d-sum { grid-area: sum; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12.5px; color: var(--ink2); margin-top: 4px; }
.d-sum .late { color: var(--red); font-weight: 600; }
.fuji-banner { top: -12px; }
/* 指の端末（iPad など4列の幅でも）は「移す」を常に見せる・押し所44px（R-K4・K2-18） */
@media (pointer: coarse) {
  .mv { opacity: 1; min-height: 44px; min-width: 56px; }
  .linkbtn { min-height: 44px; display: inline-flex; align-items: center; }
}
/* スマホ: 入力欄を詰める。種類の行の下に「本文＋送る」を1行で、届け先は1行（押すと全文）（F3-06・F2-10） */
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) {
  .compose { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
  .compose > .kinds { order: 0; flex: 0 0 100%; }
  .compose > .kinds button { padding: 8px 12px; }
  .compose > textarea { order: 1; flex: 1 1 0; min-width: 0; height: 48px; }
  .compose > textarea:focus { height: 96px; }
  .compose > .c-row { order: 2; flex: none; flex-direction: column; align-items: flex-end; gap: 4px; }
  .compose > .c-row .primary { margin-left: 0; padding: 8px 16px; }
  .compose > .c-row kbd { display: none; }
  .compose > .note { order: 3; flex: 0 0 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .compose > .note.open { white-space: normal; }
}
@media (pointer: coarse) and (max-height: 500px) {
  .compose > textarea { height: 44px; }
  .compose > textarea:focus { height: 64px; }
  .compose > .kinds button { min-height: 36px; padding: 4px 12px; }
  .d-sum { margin-top: 0; }
  /* 横向きは幅があるので、種類・本文・送るを1行に */
  .compose > .kinds { flex: none; }
  .compose { align-items: center; }
}
