/* AIChannel — a dispatch log. Cool slate paper, ink-blue, segmented meters. */
:root {
  --bg: #ecf0f4;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --ink: #15202b;
  --muted: #566474;
  --line: #d3dae2;
  --line-strong: #b7c1cc;
  --accent: #214a7a;
  --accent-ink: #ffffff;
  --accent-soft: #dfe9f5;
  --focus: #1c6fe0;
  --danger: #b3261e;
  --danger-soft: #fbe6e4;
  --note-bg: #fff6d9;
  --note-line: #e3c25a;

  --me: #8f5400;       --me-soft: #fbeccf;
  --claude: #5a3ec2;   --claude-soft: #e9e4fb;
  --gpt: #0a7457;      --gpt-soft: #d9f1e8;

  --st-planned: #566474;
  --st-in_progress: #1d56a8;
  --st-blocked: #b3261e;
  --st-done: #11703f;
  --st-dropped: #7a8591;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 0 rgba(21,32,43,.04), 0 6px 18px -10px rgba(21,32,43,.25);
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root { color-scheme: light dark; --danger-ink: #ffffff; --chip-edge: rgba(0,0,0,.22); }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
    --bg: #0d1217; --surface: #151c24; --surface-2: #1b242e;
    --ink: #e6ebf0; --muted: #9aa8b6; --line: #28333f; --line-strong: #3a4756;
    --accent: #8ab6ea; --accent-ink: #0d1217; --accent-soft: #1b2c42;
    --focus: #7db3ff; --danger: #ff8c82; --danger-soft: #3a1c1a;
    --note-bg: #2a2410; --note-line: #7a6620;
    --me: #efb85a; --me-soft: #35290f;
    --claude: #b9a8ff; --claude-soft: #2a2250;
    --gpt: #62d3ae; --gpt-soft: #12332a;
    --st-planned: #9aa8b6; --st-in_progress: #7db3ff; --st-blocked: #ff8c82; --st-done: #66d49a; --st-dropped: #8693a0;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 20px -12px rgba(0,0,0,.7);
    --danger-ink: #1a0a09; --chip-edge: rgba(255,255,255,.28);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1217; --surface: #151c24; --surface-2: #1b242e;
    --ink: #e6ebf0; --muted: #9aa8b6; --line: #28333f; --line-strong: #3a4756;
    --accent: #8ab6ea; --accent-ink: #0d1217; --accent-soft: #1b2c42;
    --focus: #7db3ff; --danger: #ff8c82; --danger-soft: #3a1c1a;
    --note-bg: #2a2410; --note-line: #7a6620;
    --me: #efb85a; --me-soft: #35290f;
    --claude: #b9a8ff; --claude-soft: #2a2250;
    --gpt: #62d3ae; --gpt-soft: #12332a;
    --st-planned: #9aa8b6; --st-in_progress: #7db3ff; --st-blocked: #ff8c82; --st-done: #66d49a; --st-dropped: #8693a0;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 20px -12px rgba(0,0,0,.7);
    --danger-ink: #1a0a09; --chip-edge: rgba(255,255,255,.28);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.6 var(--font); font-feature-settings: "tnum" 1;
  overflow-wrap: anywhere;
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0; letter-spacing: .01em; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 100; border-radius: 6px; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 0 16px; min-height: 56px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; color: var(--ink); text-decoration: none; padding: 8px 0; }
.brand-mark { display: inline-flex; align-items: flex-end; gap: 2px; width: 22px; height: 22px; }
.brand-mark i { flex: 1; background: var(--accent); border-radius: 1.5px; }
.brand-mark i:nth-child(1) { height: 35%; } .brand-mark i:nth-child(2) { height: 65%; } .brand-mark i:nth-child(3) { height: 100%; }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs .sep { color: var(--line-strong); }
.crumbs .here { color: var(--ink); font-weight: 600; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; gap: 4px; margin-left: auto; }
@media (max-width: 640px) { .crumbs { order: 3; flex-basis: 100%; padding-bottom: 8px; } .topbar-in { gap: 4px 12px; } }

main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; outline: none; }
.busy-bar { position: fixed; top: 0; left: 0; height: 2px; width: 100%; background: var(--accent); transform-origin: left; animation: load 1s ease-in-out infinite; z-index: 50; }
@keyframes load { 0% { transform: scaleX(0); } 70% { transform: scaleX(.9); } 100% { transform: scaleX(1); opacity: 0; } }

/* ---------- buttons & inputs ---------- */
.btn { font: inherit; font-size: 14px; font-weight: 600; min-height: 38px; padding: 6px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.12); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--ink); background: var(--surface-2); border-color: transparent; }
.btn-sm { min-height: 32px; padding: 3px 10px; font-size: 13px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=password], textarea, select {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 8px 10px; width: 100%; min-height: 40px;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
textarea.mono { font-family: var(--mono); font-size: 13.5px; min-height: 280px; }
select { width: auto; max-width: 100%; padding-right: 28px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(100%, 380px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.login-card .brand { font-size: 24px; margin-bottom: 4px; }
.login-card .brand-mark { width: 28px; height: 28px; }
.login-card p { color: var(--muted); margin-bottom: 20px; }
.form-error { color: var(--danger); font-size: 14px; min-height: 22px; margin-bottom: 8px; }

/* ---------- page headings ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.005em; }
.page-head p { color: var(--muted); max-width: 64ch; margin-top: 4px; }
.page-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.section-title { font-size: 16px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.section-title .count { font-weight: 500; color: var(--muted); font-size: 14px; }

/* ---------- layout ---------- */
.overview { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
@media (max-width: 960px) { .overview { grid-template-columns: 1fr; } }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--line-strong); }
a.card:hover .card-title { text-decoration: underline; text-underline-offset: 3px; }
.pcard { padding: 16px; display: grid; gap: 12px; align-content: start; }
.pcard-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-title { font-size: 17px; font-weight: 700; line-height: 1.35; }
.pcard-desc { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.count-cell { background: var(--surface-2); border-radius: var(--radius-sm); padding: 6px 8px; font-size: 12px; color: var(--muted); line-height: 1.3; }
.count-cell b { display: block; font-size: 18px; color: var(--ink); font-weight: 700; }
.count-cell.on b { color: var(--c); }
.pcard-foot { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }

/* segmented meter */
.meter { display: flex; align-items: center; gap: 10px; }
.meter-track { position: relative; flex: 1; height: 10px; background: var(--line); border-radius: 2px; overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; background: var(--fill, var(--accent)); }
.meter-track::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 2px), var(--surface) calc(10% - 2px), var(--surface) 10%); pointer-events: none; }
.meter-val { font-size: 13px; font-weight: 700; min-width: 3.2em; text-align: right; }
.meter.sm .meter-track { height: 6px; }
.meter.sm .meter-val { font-size: 12px; font-weight: 600; color: var(--muted); }

/* badges / chips */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; line-height: 1; padding: 4px 8px 4px 6px; border-radius: 999px; border: 1px solid currentColor; color: var(--c, var(--muted)); white-space: nowrap; background: transparent; }
.badge .g { font-size: 11px; }
.kind { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); }
.kind-decision { border-style: double; border-width: 3px; padding: 0 6px; }
.kind-question { border-style: dashed; }
.kind-note { border-style: solid; background: transparent; }
.kind-progress { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip { display: inline-flex; align-items: center; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--ac, #6b7785); color: #fff; max-width: 100%; border: 1px solid var(--chip-edge); }
.pri { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line-strong); letter-spacing: .02em; }
.pri.p1 { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.pri.p2 { border-color: var(--ink); }

/* ---------- feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.feed-item { position: relative; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-item::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; background: var(--ac); border-radius: 0 3px 3px 0; }
.feed-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.feed-top time { margin-left: auto; color: var(--muted); }
.feed-target { font-size: 13px; margin-top: 6px; color: var(--muted); }
.feed-target a { color: var(--ink); font-weight: 600; text-decoration: none; }
.feed-target a:hover { text-decoration: underline; }
.feed-body { margin-top: 4px; white-space: pre-wrap; }
.feed-card { overflow: hidden; }

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .board { grid-template-columns: 1fr; } }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; gap: 10px; align-content: start; min-height: 120px; }
.col-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--c); padding: 2px 4px; border-bottom: 2px solid var(--c); padding-bottom: 8px; }
.col-head .n { margin-left: auto; font-weight: 600; color: var(--muted); }
.col-empty { font-size: 13px; color: var(--muted); padding: 10px 4px; }
.fcard { padding: 12px; display: grid; gap: 8px; }
.fcard-top { display: flex; gap: 8px; align-items: flex-start; }
.fcard-title { font-weight: 700; line-height: 1.4; flex: 1; }
.fcard-note { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.fcard-foot { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); }
.dropped { margin-top: 18px; }
.dropped summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: 6px 0; }
.dropped .board { margin-top: 10px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; margin-top: 28px; }
@media (max-width: 960px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- feature page ---------- */
.controls { display: flex; gap: 18px 24px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; margin-bottom: 20px; }
.control { display: grid; gap: 4px; }
.control.grow { flex: 1; min-width: 220px; }
.slider-row { display: flex; align-items: center; gap: 12px; }
input[type=range] { flex: 1; min-width: 120px; accent-color: var(--accent); height: 28px; }
.slider-val { font-weight: 800; min-width: 3.4em; text-align: right; }
.latest { background: var(--note-bg); border: 1px solid var(--note-line); border-left-width: 5px; border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 20px; }
.latest .label { color: var(--ink); font-weight: 800; margin-bottom: 2px; display: block; }
.summary { margin-bottom: 20px; max-width: 70ch; }
.section { margin-top: 28px; }
.doc-tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.doc-tab { font: inherit; font-size: 14px; font-weight: 600; padding: 9px 14px; background: transparent; color: var(--muted); border: 1px solid transparent; border-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; cursor: pointer; margin-bottom: -1px; }
.doc-tab[aria-selected=true] { background: var(--surface); color: var(--ink); border-color: var(--line); border-bottom: 1px solid var(--surface); }
.doc-tab-add { margin-left: auto; margin-bottom: 4px; }
.doc-panel { background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 16px 20px 20px; }
.doc-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.doc-meta .spacer { flex: 1; }
.ver { font-weight: 700; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 7px; }
.conflict { background: var(--danger-soft); border: 1px solid var(--danger); color: var(--ink); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.conflict strong { color: var(--danger); }
.editor-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.revs { margin-top: 16px; border-top: 1px dashed var(--line-strong); padding-top: 10px; }
.revs summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.rev { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.rev-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; background: var(--surface-2); font-size: 13px; }
.rev pre { margin: 0; padding: 10px; white-space: pre-wrap; font: 12.5px/1.55 var(--mono); max-height: 240px; overflow: auto; }

/* rendered markdown */
.md { max-width: 74ch; line-height: 1.75; }
.md > :first-child { margin-top: 0; }
.md h1 { font-size: 22px; margin: 1.2em 0 .5em; } .md h2 { font-size: 18px; margin: 1.4em 0 .4em; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.md h3 { font-size: 16px; margin: 1.2em 0 .3em; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md table { margin: 0 0 .9em; }
.md ul, .md ol { padding-left: 1.5em; }
.md code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.md pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; overflow: auto; }
.md pre code { background: none; border: 0; padding: 0; }
.md blockquote { border-left: 4px solid var(--line-strong); padding: 2px 14px; color: var(--muted); }
.md table { border-collapse: collapse; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.md th { background: var(--surface-2); }
.md img { max-width: 100%; height: auto; }

.attach-list, .plain-list { list-style: none; margin: 0; padding: 0; }
.attach { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.attach:last-child { border-bottom: 0; }
.attach-name { font-weight: 600; flex: 1; min-width: 160px; }
.attach-meta { font-size: 13px; color: var(--muted); }

.compose { padding: 14px 16px; margin-bottom: 16px; }
.compose-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.compose-row .grow { flex: 1; }

/* ---------- states ---------- */
.empty { text-align: center; padding: 28px 16px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); background: transparent; }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }
.errbox { padding: 24px; border: 1px solid var(--danger); background: var(--danger-soft); border-radius: var(--radius); display: grid; gap: 10px; justify-items: start; }

/* ---------- dialog & toast ---------- */
dialog { border: 1px solid var(--line-strong); border-radius: 14px; padding: 0; background: var(--surface); color: var(--ink); width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 24px 60px -20px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(10, 16, 24, .55); }
dialog form { padding: 20px; }
dialog h2 { font-size: 18px; margin-bottom: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.toasts { position: fixed; z-index: 90; left: 50%; bottom: 16px; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; border-left: 5px solid var(--danger); }
.toast.ok { border-left-color: var(--st-done); }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0 4px; }

@media (prefers-reduced-motion: reduce) { .busy-bar { animation: none; } * { scroll-behavior: auto !important; } }
@media (max-width: 480px) {
  main { padding-top: 16px; }
  .page-head h1 { font-size: 22px; }
  .doc-panel { padding: 14px; }
  .counts { grid-template-columns: repeat(2, 1fr); }
}
.section > .feed-card { max-width: 820px; }

a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); }
.dlg-msg { margin-bottom: 14px; }
.dlg-body { padding: 20px; }
.colorpick { width: 56px; min-height: 40px; padding: 2px; cursor: pointer; }
.warn { background: var(--danger-soft); border: 1px solid var(--danger); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 14px; }
.warn strong { color: var(--danger); }
.copy-row { display: flex; gap: 8px; }
.mono-field { font-family: var(--mono); font-size: 13px; }
.agent-list { display: grid; gap: 18px; }
.agent-card { padding: 18px 20px; border-left: 6px solid var(--ac); }
.agent-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.agent-head h2 { font-size: 19px; }
.idtag { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.set-block { padding: 14px 0; border-top: 1px solid var(--line); }
.set-block h3 { font-size: 15px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.set-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.set-head h3 { margin: 0; }
.ident-row { display: flex; flex-wrap: wrap; gap: 0 18px; align-items: flex-start; }
.ident-row .field { margin-bottom: 8px; }
.ident-row .field:first-child { flex: 1; min-width: 200px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.tbl th, .tbl td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.tbl thead th { background: var(--surface-2); font-size: 13px; color: var(--muted); }
.tbl tbody tr:last-child > * { border-bottom: 0; }
.sr-th { width: 1%; }
.agent-list { grid-template-columns: minmax(0, 1fr); }
.agent-card { min-width: 0; }
@media (max-width: 480px) { .agent-card { padding: 14px; } .topbar-actions .btn { padding: 6px 8px; } }
.btn { white-space: nowrap; } .copy-row .btn { flex: none; }

.theme-btn { min-width: 6.2em; }
.login { position: relative; }
.login-theme { position: absolute; top: 12px; right: 12px; }
.pw-row { display: flex; gap: 8px; }
.pw-row input { flex: 1; min-width: 0; }
.pw-card { padding: 16px 20px; margin-bottom: 18px; }
.pw-card form { display: grid; gap: 0; max-width: 420px; }
.pw-card h2 { font-size: 17px; margin-bottom: 4px; }
.pw-card .hint { margin-bottom: 12px; }
.pw-card form { position: relative; } .sr { left: 0; top: 0; }

/* ---------- due dates, assignees, avatars ---------- */
.due { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.due.late { color: var(--st-blocked, #c0392b); font-weight: 800; }
.fcard-who { margin-left: auto; }
.fcard-foot { flex-wrap: wrap; align-items: center; }
.chip-av { width: 16px; height: 16px; border-radius: 50%; margin-right: 6px; object-fit: cover; background: #fff; }
.avatar-lg { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line-strong); background: var(--surface-2); flex: none; }
.avatar-lg.ph { display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; color: var(--muted); }
.avatar-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.page-meta input[type=date], .control input[type=date] { font: inherit; padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); }

/* ---------- attachments ---------- */
.dropzone { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px; margin-bottom: 12px; border: 2px dashed var(--line-strong); border-radius: 10px; background: var(--surface-2); }
.dropzone.over { border-color: var(--ink); background: var(--surface); }
.upload-status { list-style: none; margin: 0 0 10px; padding: 0; font-size: 13px; }
.upload-status li.ok { color: var(--st-done, #1a7f4b); }
.upload-status li.bad { color: var(--st-blocked, #c0392b); font-weight: 700; }
.attach-preview { flex-basis: 100%; }
.attach-preview:empty { display: none; }
.attach-img { max-width: 100%; max-height: 220px; border-radius: 6px; border: 1px solid var(--line); display: block; }
.attach-video { max-width: 100%; width: 100%; max-height: 320px; border-radius: 6px; background: #000; }

.notice { display: block; padding: 10px 14px; margin-bottom: 14px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-strong); border-left: 5px solid #e6a028; color: var(--ink); text-decoration: none; font-weight: 600; }
.notice:hover { text-decoration: underline; }
.pinned-tag { font-size: 12px; font-weight: 700; color: var(--muted); }
tr.old { background: rgba(230, 160, 40, .09); }
td.late { color: var(--st-blocked, #c0392b); font-weight: 700; }
