/* Approval Inbox — styles. Tokens first; light and dark follow the device setting. */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --line: #e2dfd8;
  --text: #1c1b19;
  --muted: #6a665f;
  --accent: #1f5f4f;
  --accent-ink: #ffffff;
  --danger: #a3301f;
  --ok-bg: #e2f1ea;   --ok-ink: #17503f;
  --warn-bg: #fbeed3; --warn-ink: #7a5200;
  --bad-bg: #f8e1dc;  --bad-ink: #8a2616;
  --info-bg: #e3ecf7; --info-ink: #1f477a;
  --idle-bg: #eceae5; --idle-ink: #55524c;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412;
    --surface: #1d1d1a;
    --surface-2: #262622;
    --line: #33332e;
    --text: #edebe6;
    --muted: #a09c93;
    --accent: #5fc0a5;
    --accent-ink: #0d1f1a;
    --danger: #ef8a78;
    --ok-bg: #15382d;   --ok-ink: #8fdcc3;
    --warn-bg: #3d2f0f; --warn-ink: #f1c76a;
    --bad-bg: #40201a;  --bad-ink: #f3a497;
    --info-bg: #1a2c44; --info-ink: #9cc3f2;
    --idle-bg: #2a2a26; --idle-ink: #b3afa6;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.35rem; line-height: 1.3; text-wrap: balance; }
h2 { font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
h3 { font-size: 1rem; line-height: 1.35; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 38vw; }
.brandmark { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); text-decoration: none; white-space: nowrap; }
.brandmark.big { font-size: 1.2rem; margin-bottom: 4px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }
.main { max-width: 860px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right)) 56px max(16px, env(safe-area-inset-left)); }

.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel.narrow { width: 100%; max-width: 380px; display: grid; gap: 10px; }
label { font-size: .85rem; color: var(--muted); }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; }
textarea { resize: vertical; min-height: 84px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-error { color: var(--danger); font-size: .9rem; min-height: 1.2em; }

.btn { font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 10px 16px; min-height: 42px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); padding: 8px 10px; min-height: 36px; }
.btn-block { width: 100%; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.flash { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; font-size: .92rem; }
.flash-ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash-x { background: none; border: 0; color: inherit; font-size: 1.2rem; cursor: pointer; line-height: 1; padding: 4px 8px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin: 0 -16px 12px; padding-left: 16px; padding-right: 16px; scrollbar-width: thin; }
.tab { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; text-decoration: none;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.tab.is-active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.count { font-variant-numeric: tabular-nums; font-size: .78rem; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tab.is-active .count { background: rgba(255,255,255,.22); color: inherit; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters select { width: auto; min-width: 0; flex: 1 1 150px; max-width: 260px; padding: 8px 10px; }

.cards { display: grid; gap: 10px; }
.card { display: grid; gap: 8px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: inherit; min-width: 0; }
.card:hover { border-color: var(--muted); }
.card-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.card-title { overflow-wrap: anywhere; }
.card-preview { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; overflow-wrap: anywhere; }
.card-meta, .rev-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .83rem; }

.chip { font-size: .76rem; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--text); color: var(--bg); }
.chip-plain { background: var(--surface-2); color: var(--muted); font-weight: 600; }
.badge { font-size: .76rem; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--idle-bg); color: var(--idle-ink); margin-left: auto; }
.rev-head .badge { margin-left: 0; }
.badge-published { background: var(--ok-bg); color: var(--ok-ink); }
.badge-approved { background: var(--info-bg); color: var(--info-ink); }
.badge-awaiting-approval, .badge-revision-requested, .badge-scheduled, .badge-publishing { background: var(--warn-bg); color: var(--warn-ink); }
.badge-rejected, .badge-failed, .badge-reconcile-required { background: var(--bad-bg); color: var(--bad-ink); }

.empty { padding: 36px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); display: grid; gap: 12px; justify-items: center; }

.back { display: inline-block; margin-bottom: 12px; text-decoration: none; font-weight: 600; }
.review-head { display: grid; gap: 10px; margin-bottom: 14px; }
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 12px; }
.post { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.6; max-width: 65ch; }
.kvs { margin: 0; display: grid; gap: 10px; }
.kvs-inline { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kv dt { font-size: .76rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.kv dd { margin: 2px 0 0; overflow-wrap: anywhere; text-transform: capitalize; }
.block .kv dd { text-transform: none; }

.actions .btn { flex: 1 1 140px; }
.action-panel { display: grid; gap: 10px; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--idle-bg); color: var(--idle-ink); margin-bottom: 10px; }
.notice:last-child { margin-bottom: 0; }
.notice-ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice-warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice a { color: inherit; font-weight: 650; }

.revs, .audit { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rev { padding: 12px; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 6px; }
.rev.is-current { border-color: var(--accent); }
.rev-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rev-note { font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
.audit li { display: grid; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.audit li:last-child { border-bottom: 0; padding-bottom: 0; }
.audit-when { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.audit-what { text-transform: capitalize; font-weight: 600; font-size: .92rem; }
.audit-note { font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }

@media (max-width: 520px) {
  .who { display: none; }
  .badge { margin-left: 0; }
  .actions .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .card, .tab { transition: border-color .12s ease, background-color .12s ease; }
}
