:root {
  --brand: #5a161e;
  --brand-soft: #f6eeef;
  --ink: #2b2b2b;
  --muted: #888;
  --line: #e7e2e2;
  --bg: #f7f5f4;
  --ok: #2a7a2a;
  --warn: #b7791f;
  --bad: #c0392b;
  --info: #2c7be5;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.6;
}
[hidden] { display: none !important; }
a { color: var(--brand); }
button, select, textarea { font: inherit; }

.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--brand); color: #fff;
}
.brand { font-weight: 700; letter-spacing: .04em; }
.bar-actions { display: flex; gap: 6px; align-items: center; }
.bar select, .bar .ghost { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; padding: 4px 8px; font-size: 13px; }
.bar select option { color: #000; }

main { max-width: 760px; margin: 0 auto; padding: 14px 12px calc(env(safe-area-inset-bottom) + 40px); }
.center { text-align: center; padding: 80px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); font-size: 13px; }
.note { background: #fff8e6; border: 1px solid #f0dca8; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }

button { cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; min-height: 40px; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
button.danger { color: var(--bad); border-color: #e9c4c0; }
button.ghost { background: transparent; }
button:disabled { opacity: .5; cursor: default; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.card h2, .section-title { font-size: 16px; margin: 0; color: var(--brand); }
.section-title { margin: 22px 4px 10px; }

.summary { margin: 0; padding-left: 20px; }
.summary li { margin: 2px 0; }

.badge { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #eee; color: #555; }
.badge.ok { background: #e6f4e6; color: var(--ok); }
.badge.stale, .badge.error { background: #fbe9e7; color: var(--bad); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.meter { height: 6px; background: #eee; border-radius: 3px; overflow: hidden; margin-top: 3px; max-width: 220px; }
.meter > i { display: block; height: 100%; background: var(--brand); }

.tabs { display: flex; gap: 4px; }
.tab { min-height: 32px; padding: 4px 10px; font-size: 13px; background: #f3f0f0; border-color: transparent; }
.tab.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }

.proposal { border-top: 1px solid var(--line); padding: 12px 0; }
.proposal:first-child { border-top: 0; }
.p-meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.chip { background: #f3f0f0; border-radius: 4px; padding: 0 6px; }
.chip.idea { background: #fff4d6; color: #8a6200; }
.chip.marketing { background: #e8f0fe; color: #1a56b0; }
.chip.patrol { background: #eef6ee; color: #2a6a2a; }
.chip.score { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.p-title { font-size: 15px; margin: 4px 0 6px; }
.p-detail summary { font-size: 13px; color: var(--brand); cursor: pointer; }
.p-actions, .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.p-reject textarea { width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.p-decided { font-size: 13px; margin-top: 6px; }
.p-decided .approved { color: var(--ok); font-weight: 600; }
.p-decided .rejected { color: var(--bad); font-weight: 600; }
.p-decided .hold { color: var(--warn); font-weight: 600; }

.md { font-size: 14px; padding: 6px 0 2px; overflow-wrap: anywhere; }
.md h1, .md h2, .md h3, .md h4 { font-size: 14px; margin: 10px 0 4px; color: var(--ink); }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 4px 0; padding-left: 20px; }
.md code { background: #f3f0f0; border-radius: 3px; padding: 0 4px; font-size: 13px; }
.md pre { background: #f6f4f4; border-radius: 6px; padding: 8px; overflow-x: auto; font-size: 12px; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--line); color: #666; }

.sec { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.sec > summary { list-style: none; cursor: pointer; padding: 12px 16px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after { content: "▾"; color: var(--muted); }
.sec:not([open]) > summary::after { content: "▸"; }
.sec.alert > summary { color: var(--bad); }
.sec iframe { display: block; width: 100%; border: 0; border-top: 1px solid var(--line); min-height: 40px; }
