:root {
  --bg: #F2F4F7; --surface: #FFFFFF; --surface-2: #F7F8FA; --line: #D9DEE5; --ink: #1B2430; --muted: #5B6672;
  --accent: #2455C3; --accent-ink: #FFFFFF; --accent-soft: #E7EDFB;
  --q: #B4304B; --q-soft: #FBE9ED; --c: #B7791F; --c-soft: #FBF1DD; --h: #6B7683; --h-soft: #EDF0F3; --ok: #1F7A4D; --ok-soft: #E3F3EA;
  --slack: #4A154B; --err-soft: #FDE8DC;
  --shadow: 0 1px 2px rgba(27,36,48,.06), 0 8px 24px -16px rgba(27,36,48,.25); color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #12161C; --surface: #1A2028; --surface-2: #202833; --line: #2E3947; --ink: #E6EAF0; --muted: #98A3B1;
    --accent: #6D95F0; --accent-ink: #0E1420; --accent-soft: #1F2B44; --q: #F08AA0; --q-soft: #3A1E27; --c: #E2B45A; --c-soft: #3A2E18;
    --h: #8A96A5; --h-soft: #242C36; --ok: #5FC48C; --ok-soft: #1B3326; --slack: #C9A2CB; --err-soft: #3A2416;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -16px rgba(0,0,0,.7); color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "IBM Plex Sans JP", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  font-size: 14px; line-height: 1.6; padding-block: 0 32px; padding-inline: 16px; font-feature-settings: "palt"; }
.num, .amt, .d { font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bad { color: var(--q); }

/* 1段目：タイトル＋名前・権限（管理者は右にまとめて更新）／2段目：会社タブ／3段目：数字カード */
.top { display: grid; gap: 10px; padding-block: 12px; }
.row1 { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.brand h1 { font-size: 17px; font-weight: 600; margin: 0; }
.who { font-size: 13px; }
.role { font-size: 11px; border: 1px solid var(--line); border-radius: 3px; padding: 0 6px; color: var(--muted); }
.lnk { font-size: 12px; color: var(--muted); }
.row1 form { margin: 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 6px; padding: 6px 14px; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.tab[aria-current="page"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.cnt { font-size: 12px; padding: 0 6px; border-radius: 999px; font-weight: 600; background: var(--q-soft); color: var(--q); }
.cnt.stale { background: var(--q); color: #fff; }
.tab[aria-current="page"] .cnt { background: var(--q); color: #fff; }
.summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.tile .lab { font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.tile .val { font-size: 22px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile small { font-size: 12px; color: var(--muted); }
.tile.q .val { color: var(--q); } .tile.c .val { color: var(--c); } .tile.a .val { color: var(--accent); } .tile.bad .val { color: var(--q); }
.flash { margin: 0 0 10px; padding: 8px 12px; border-radius: 6px; background: var(--ok-soft); color: var(--ok); }

.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 6px; padding: 8px 14px; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-block; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); } .btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 12px; } .btn:disabled { opacity: .5; cursor: default; }

/* 管理者：1段目＝3つのまとまり（数字カードを兼ねる）、2段目＝中のタブ（2026-09-15） */
.groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.group { text-decoration: none; color: var(--muted); border: 1px solid var(--line); border-bottom-width: 3px; border-bottom-color: transparent;
  background: var(--surface-2); border-radius: 8px 8px 0 0; padding: 10px 14px; display: grid; gap: 2px; }
.group .gl { font-weight: 600; } .group .gs { font-size: 12px; color: var(--muted); }
.group .gn { font-size: 20px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.group[aria-current="page"] { background: var(--surface); color: var(--ink); border-bottom-color: var(--ink); }
.g-q .gn { color: var(--q); } .g-w .gn { color: var(--c); } .g-d .gn { color: var(--muted); }
.sheet { background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; padding: 0 14px 14px; margin-bottom: 14px; }
.sheet .kinds { margin-inline: -14px; padding-inline: 8px; }
.sheet > .work, .sheet > .grid2, .sheet > .panel { margin-top: 12px; }
.cards { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-block: 12px 0; }
.cards.pad { margin: 0; padding: 10px 16px 0; }
.cards .chip .n { font-variant-numeric: tabular-nums; margin-left: 4px; opacity: .8; }
@media (max-width: 700px) { .groups { grid-template-columns: 1fr; } .group { border-radius: 8px; } .sheet { border-top: 1px solid var(--line); border-radius: 8px; margin-top: 8px; } }

/* 種類タブ（下線） */
.kinds { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.kind-tab { color: var(--muted); padding: 8px 14px; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; }
.kind-tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.kind-tab .n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.work { display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: 14px; align-items: start; }
.grid2 { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 14px; align-items: start; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.list .empty { margin: 0; padding: 14px; color: var(--muted); font-size: 13px; }
.row { display: grid; grid-template-columns: 6px 1fr auto; gap: 10px; padding: 10px 14px 10px 10px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); } .row[aria-current="true"] { background: var(--accent-soft); }
.row .stripe { border-radius: 3px; background: var(--h); }
.row.q .stripe { background: var(--q); } .row.c .stripe { background: var(--c); } .row.a .stripe { background: var(--accent); }
.row.done .stripe { background: var(--ok); } .row.err .stripe { background: #d9480f; }
.row .t { font-weight: 500; } .row .s { color: var(--muted); font-size: 12px; }
.row .amt { font-weight: 600; text-align: right; white-space: nowrap; display: block; } .row .d { font-size: 12px; color: var(--muted); text-align: right; display: block; }
.row.done .t { color: var(--muted); }
.pill { font-size: 11px; border-radius: 3px; padding: 0 5px; margin-left: 4px; background: var(--h-soft); color: var(--h); font-weight: 500; white-space: nowrap; }
.pill.slack { background: var(--slack); color: #fff; } .pill.bad { background: var(--q); color: #fff; } .pill.ok { background: var(--ok-soft); color: var(--ok); }

.detail { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.dh { padding: 12px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.dh h3 { margin: 0; font-size: 16px; font-weight: 600; text-wrap: balance; }
.kind { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: var(--q-soft); color: var(--q); }
.kind.c { background: var(--c-soft); color: var(--c); } .kind.a { background: var(--accent-soft); color: var(--accent); }
.ask { margin: 0; padding: 12px 18px; background: var(--q-soft); border-bottom: 1px solid var(--line); } .ask b { color: var(--q); }
.ask.err { background: var(--err-soft); } .ask.ok { background: var(--ok-soft); } .ask.ok b { color: var(--ok); }
.body { display: grid; grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); gap: 18px; padding: 18px; }
.doc { margin: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.doc .cap { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.docimg { max-width: 100%; border-radius: 3px; background: #fff; display: block; } .docpdf { width: 100%; height: 520px; border: 0; border-radius: 3px; background: #fff; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; align-content: start; }
.f { display: flex; flex-direction: column; gap: 4px; } .f label, .f .lb { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.f .v, .f select, .f input, textarea, table input, table select { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; background: var(--surface); color: var(--ink); }
.f .v { background: var(--surface-2); } .f select:disabled, .f input:disabled { color: var(--muted); }
.wide { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--muted); } .hint b { color: var(--ink); font-weight: 500; }
.note { margin: 0; padding: 14px 16px; color: var(--muted); font-size: 13px; }
.proposed { position: relative; } .proposed::after { content: "Claude の案"; position: absolute; right: 8px; top: -7px; font-size: 10px; background: var(--accent-soft); color: var(--accent); padding: 0 6px; border-radius: 3px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 5px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; text-decoration: none; }
.chip input { margin: 0; }
.chip:has(input:checked), .chip[aria-current="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip.person { border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.dt { width: 100%; border-collapse: collapse; font-size: 13px; } .dt td { border-bottom: 1px solid var(--line); padding: 4px 6px; } .dt td.r { text-align: right; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* 操作とコメントの境目：空白の帯で分ける（2026-09-15 石井さん） */
.band { height: 16px; background: var(--bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.comments { padding: 16px 18px 18px; display: grid; gap: 12px; }
.comments h4 { margin: 0; font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.thread { display: grid; gap: 10px; }
.msg { display: grid; grid-template-columns: 30px 1fr; gap: 10px; }
.av { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff; background: var(--accent); }
.msg .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.msg .meta b { color: var(--ink); font-weight: 600; }
.msg p { margin: 2px 0 0; overflow-wrap: anywhere; }
.to { font-size: 11px; background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 6px; }
.sys { font-size: 12px; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line); border-radius: 6px; padding: 8px 10px; }
.compose { display: grid; gap: 8px; }
.tos { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.compose textarea { width: 100%; min-height: 64px; resize: vertical; }
.compose .bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .compose .bar .sp { flex: 1; }

/* 同席者メモ */
.att-list { display: flex; gap: 6px; flex-wrap: wrap; min-height: 28px; }
.attendee { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 3px 8px; font-size: 13px; }
.attendee button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 2px; }
.stepper { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; width: fit-content; }
.stepper button { border: 0; background: var(--surface-2); color: var(--ink); width: 32px; cursor: pointer; }
.stepper input { width: 48px; border: 0 !important; text-align: center; border-radius: 0 !important; }
.preview { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 10px; white-space: pre-wrap; margin: 0; }

/* パネル・表（カード明細・設定） */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.panel-h { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-h h3 { margin: 0; font-size: 15px; }
.coname { font-size: 11px; font-weight: 600; letter-spacing: .06em; padding: 1px 8px; border-radius: 3px; background: var(--ink); color: var(--bg); }
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-size: 11px; letter-spacing: .06em; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.grp td { background: var(--surface-2); font-weight: 600; font-size: 12px; }
td form { margin: 0; }
.drop { border: 1px dashed var(--line); border-radius: 6px; padding: 4px 10px; font-size: 12px; color: var(--muted); cursor: pointer; background: transparent; white-space: nowrap; display: inline-block; }
.drop.done { border-style: solid; border-color: var(--ok); color: var(--ok); background: var(--ok-soft); cursor: default; }
.bigdrop { border: 2px dashed var(--line); border-radius: 8px; padding: 14px; text-align: center; color: var(--muted); margin: 12px 16px; display: grid; gap: 4px; }
.bigdrop label { cursor: pointer; } .bigdrop.over { border-color: var(--accent); background: var(--accent-soft); }
.ck { white-space: nowrap; font-size: 12px; }

.set-grid { display: grid; grid-template-columns: 200px minmax(0,1fr); gap: 14px; align-items: start; }
.side { display: grid; gap: 2px; }
.side a { color: var(--ink); text-decoration: none; padding: 8px 10px; border-radius: 6px; }
.side a[aria-current="page"] { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.sec { padding: 14px 16px; display: grid; gap: 12px; }

/* ログイン */
body.lg { display: grid; place-items: start center; padding-top: 12vh; }
.lgbox { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 22px 24px; width: min(420px, 100%); display: grid; gap: 12px; }
.lgbox h1 { font-size: 17px; margin: 0; } .lgbox form { display: grid; gap: 10px; } .lgbox label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.lgbox select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.ok { color: var(--ok); margin: 0; } .ng { color: var(--q); margin: 0; }

@media (max-width: 900px) {
  .work, .grid2, .body, .form, .set-grid { grid-template-columns: 1fr; }
  .summary { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
