:root {
  --bg: #f4f6f7; --card: #fff; --ink: #1c2529; --muted: #63727a; --line: #dfe5e8;
  --accent: #53BDC0; --accent-ink: #0d5f62; --top: #1f2a30;
  --red: #c0392b; --red-bg: #fdecea; --amber: #a86400; --amber-bg: #fff4e0; --green: #1e7b4f; --green-bg: #e6f5ec;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent-ink); }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--top); color: #fff; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
.brand { color: #fff; text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: inline-block; }
.who { font-size: 14px; display: flex; gap: 10px; align-items: center; }
.who a, .who button { color: #cfe; background: none; border: 0; font: inherit; padding: 0; cursor: pointer; text-decoration: underline; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 96px; }
.pad { padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1 { font-size: 22px; margin: 8px 0 12px; }
h2 { font-size: 17px; margin: 20px 0 8px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 4px 0 12px; }
.tab { flex: 1 1 auto; text-align: center; padding: 10px 6px; border-radius: 10px; background: var(--card); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap; }
@media (max-width: 400px) { .tab { font-size: 14px; padding: 10px 4px; } .tab .n { margin-left: 2px; padding: 0 5px; } }
@media (max-width: 350px) { .tabs { gap: 3px; } .tab { font-size: 12.5px; padding: 9px 3px; } .tab .n { min-width: 18px; padding: 0 4px; } }
.tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab .n { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 11px; background: rgba(0,0,0,.08); font-size: 13px; margin-left: 4px; }
.tab.on .n { background: rgba(255,255,255,.25); }
.tab .n.alert { background: var(--red); color: #fff; }

.search { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; margin-bottom: 10px; background: var(--card); }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  color: var(--ink); text-decoration: none; }
.item .thumb { width: 64px; height: 64px; border-radius: 8px; background: #e8edef center/cover no-repeat; flex: 0 0 64px; display: grid; place-items: center; color: var(--muted); font-size: 24px; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; margin: 4px 4px 0 0; }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.grey { background: #eef1f2; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; background: var(--card); border: 1px dashed var(--line); border-radius: 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; background: #e8edef; cursor: zoom-in; }
.photos figcaption { font-size: 12px; color: var(--muted); margin-top: 2px; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.timeline li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 48px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.dark { background: var(--top); border-color: var(--top); color: #fff; }
.btn.danger { color: var(--red); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.actions { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1; }
.fab { position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 4; box-shadow: 0 4px 14px rgba(0,0,0,.2); border-radius: 28px; }

label.f { display: block; margin: 10px 0; font-size: 14px; color: var(--muted); }
label.f input, label.f select, label.f textarea { display: block; width: 100%; margin-top: 4px; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; font: inherit; color: var(--ink); background: #fff; }
label.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.err { color: var(--red); font-weight: 600; margin: 8px 0; }

.shot { border: 2px dashed var(--line); border-radius: 12px; min-height: 180px; display: grid; place-items: center; text-align: center; color: var(--muted);
  cursor: pointer; overflow: hidden; background: #fafbfb; }
.shot img { width: 100%; max-height: 360px; object-fit: contain; display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { padding: 6px 10px; border-radius: 16px; border: 1px solid var(--line); background: #fff; font-size: 14px; cursor: pointer; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.person { padding: 18px 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; }
.person.on { border-color: var(--accent); background: #e9f7f7; }

.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 300px; margin: 12px auto; }
.pinpad button { font-size: 24px; padding: 16px 0; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.dots { text-align: center; font-size: 28px; letter-spacing: 8px; min-height: 40px; }

.banner { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.banner.red { background: var(--red-bg); color: var(--red); }
.banner.amber { background: var(--amber-bg); color: var(--amber); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--top); color: #fff; padding: 10px 16px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; max-width: 90vw; }
#toast.show { opacity: 1; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); display: grid; place-items: center; z-index: 30; }
.lightbox img { max-width: 100vw; max-height: 100vh; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t td, table.t th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
code.tok { display: block; padding: 10px; background: #eef1f2; border-radius: 8px; word-break: break-all; }
