:root {
  --bg: #101216; --panel: #1a1d23; --panel2: #232730; --line: #333945; --text: #eceff4; --muted: #9aa3b2;
  --accent: #76b900; --accent-text: #0b1200; --warn: #f5a623; --bad: #ff5d5d; --ok: #4cd08a; --info: #5aa9ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100dvh; display: flex; flex-direction: column; }
header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--panel); border-bottom: 1px solid var(--line); }
#title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 11px; font-weight: 600; background: var(--panel2); color: var(--muted); padding: 2px 6px; border-radius: 6px; margin-left: 6px; }
main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 12px 12px 160px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 10px 14px; min-height: 44px; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.small { min-height: 34px; padding: 4px 10px; font-size: 14px; border-radius: 8px; }
button.good { border-color: var(--ok); color: var(--ok); }
button.bad { border-color: var(--bad); color: var(--bad); }
button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
button.icon { width: 44px; padding: 0; font-size: 24px; background: transparent; border: none; }
input[type=text], input[type=search], select, textarea { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: 44px; }
textarea { resize: none; }
label.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; }
label.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
h2 { font-size: 18px; margin: 16px 0 8px; }
h3 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 10px 0; }
.card.me { background: var(--panel2); border-color: #3a4150; }
.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.spread { justify-content: space-between; }
.grow { flex: 1; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.high { color: var(--ok); border-color: var(--ok); }
.pill.medium { color: var(--warn); border-color: var(--warn); }
.pill.low { color: var(--muted); }
.pill.ruled_out { color: var(--bad); border-color: var(--bad); }
.pill.confirmed { color: var(--ok); border-color: var(--ok); }
.chip { display: inline-block; font-size: 13px; padding: 3px 9px; margin: 2px 4px 2px 0; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); cursor: pointer; }
.chip.mem { border-color: var(--info); color: var(--info); }
.danger { background: #3a1517; border: 1px solid var(--bad); color: #ffd7d7; border-radius: 12px; padding: 12px; margin: 10px 0; font-weight: 600; }
.notice { background: #2c2713; border: 1px solid var(--warn); color: #ffe7b0; border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-size: 14px; }
.hyp.ruled_out { opacity: .55; }
.hyp .cause { font-weight: 600; font-size: 17px; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: none; }
.passage { white-space: pre-wrap; font-size: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 6px; max-height: 260px; overflow: auto; }
.passage mark { background: #4a5a12; color: inherit; border-radius: 3px; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; }
.thumbs figure { margin: 0; flex: none; width: 150px; cursor: pointer; }
.thumbs img { width: 150px; height: 110px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.thumbs figcaption { font-size: 12px; color: var(--muted); }
#composer { position: fixed; left: 0; right: 0; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); padding: 8px 12px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
#composer .inner { max-width: 760px; margin: 0 auto; }
#composer textarea { min-height: 52px; max-height: 140px; }
.quick { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.quick button { flex: none; }
.status { color: var(--muted); font-size: 14px; padding: 6px 2px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
#viewer { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px; }
#viewer[hidden] { display: none; }
#viewer img { max-width: 100%; max-height: 80dvh; background: #fff; border-radius: 8px; }
#viewer #viewer-close { position: absolute; top: 8px; right: 8px; color: #fff; }
.sheet { position: fixed; inset: auto 0 0 0; z-index: 15; max-height: 80dvh; overflow: auto; background: var(--panel); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; padding: 14px; box-shadow: 0 -8px 30px rgba(0,0,0,.5); }
.err { color: var(--bad); font-size: 14px; margin: 6px 0; }
