:root {
  --ink: #12201f; --muted: #5c6b69; --line: #dfe5e3; --bg: #f5f7f6; --card: #fff;
  --brand: #0c3436; --accent: #c5f277; --warn: #a65b48; --ok: #2f7a4f; --info: #2d5f8a;
  --radius: 12px; font-size: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 1.4rem; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.top { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 10px 16px; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 5; }
.brand { color: #fff; text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.brand b { color: var(--accent); }
.brand small { font-weight: 500; opacity: .75; margin-left: 4px; }
.mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--brand); }
#nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
#nav a { color: #e6efee; text-decoration: none; padding: 6px 10px; border-radius: 8px; }
#nav a.on, #nav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.who { font-size: .85rem; display: flex; gap: 10px; align-items: center; }
@media (max-width: 700px) {
  .top { gap: 6px 10px; }
  #nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #nav a { white-space: nowrap; }
  .who { margin-left: auto; }
}
.who button { background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.narrow { max-width: 460px; margin: 24px auto; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: inherit; display: block; }
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; }
.stat.alert b { color: var(--warn); }
.split { display: grid; gap: 14px; grid-template-columns: minmax(260px, 380px) 1fr; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

label { display: block; font-weight: 600; font-size: .9rem; margin: 10px 0 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 9px 10px; border: 1px solid #c9d2cf; border-radius: 9px; background: #fff; color: var(--ink); }
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; margin-right: 6px; }
.check { display: flex; align-items: center; font-weight: 500; margin: 6px 0; }
button, .btn { font: inherit; font-weight: 600; padding: 9px 14px; border-radius: 9px; border: 1px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
button.ghost { background: #fff; color: var(--brand); }
button.danger { background: var(--warn); border-color: var(--warn); }
button:disabled { opacity: .55; cursor: wait; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tabs button { background: #fff; color: var(--brand); padding: 6px 12px; }
.tabs button.on { background: var(--brand); color: #fff; }
.err { color: var(--warn); font-weight: 600; margin-top: 8px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list button.item { all: unset; display: block; width: 100%; padding: 10px 6px; cursor: pointer; box-sizing: border-box; }
.list button.item:hover, .list button.item.on { background: #eef4f2; }
.list button.item:focus-visible { outline: 2px solid var(--brand); }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eceff0; color: var(--muted); margin-right: 4px; white-space: nowrap; }
.pill.verified, .pill.closed { background: #e2f3e8; color: var(--ok); }
.pill.rejected, .pill.suspended, .pill.disputed, .pill.open { background: #f8e6e1; color: var(--warn); }
.pill.pending, .pill.answered { background: #fdf3d8; color: #8a6510; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 10px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.scroll { overflow-x: auto; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.timeline li { padding: 4px 0; border-left: 2px solid var(--line); padding-left: 10px; }
.note { background: #f7faf9; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; margin: 6px 0; white-space: pre-wrap; }
.note.reply { border-color: #b8d9c4; background: #f1faf4; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.msg { padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; max-width: 92%; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; }
.msg.ai { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.msg.ai small { display: block; color: var(--warn); margin-top: 6px; font-weight: 600; }
.qr { display: flex; justify-content: center; margin: 10px 0; }
.qr canvas { width: 210px; height: 210px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 8px; }
.secret { font-family: ui-monospace, monospace; letter-spacing: 1px; word-break: break-all; background: #f1f4f3; padding: 6px 8px; border-radius: 6px; }
.banner { background: #fdf3d8; border: 1px solid #f0dc9e; padding: 10px 12px; border-radius: 9px; margin-bottom: 12px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; max-width: 90vw; z-index: 10; }
.note.user { border-color: #c9d6ea; background: #f3f7fd; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.photos a { text-decoration: none; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); display: block; }
