:root {
  --brand: #f5a524;
  --bg: #0f1115; --panel: #171a21; --panel2: #1e222b; --line: #2a2f3a;
  --text: #eef1f6; --muted: #9aa3b2; --good: #3ecf8e; --warn: #f5a524; --bad: #ff6b6b;
  --r: 14px; --nav: 68px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; font-size: 16px; line-height: 1.4; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 4px 0 12px; } h2 { font-size: 18px; margin: 18px 0 10px; } h3 { font-size: 16px; margin: 14px 0 8px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stack > * + * { margin-top: 10px; }
.hidden { display: none !important; }

/* shell */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: rgba(15,17,21,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--panel2); display: grid; place-items: center; overflow: hidden;
  font-weight: 800; color: var(--brand); flex: none; }
.logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.topbar .co { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .who { font-size: 12px; color: var(--muted); }
main { padding: 14px 14px calc(var(--nav) + 30px); max-width: 900px; margin: 0 auto; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav); display: flex; justify-content: space-around; align-items: center;
  background: var(--panel); border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
.nav a { color: var(--muted); display: flex; flex-direction: column; align-items: center; font-size: 11px; gap: 2px; min-width: 60px; }
.nav a.on { color: var(--brand); }
.nav svg { width: 24px; height: 24px; }
.nav .snap { width: 58px; height: 58px; border-radius: 50%; background: var(--brand); color: #111; display: grid; place-items: center;
  margin-top: -26px; box-shadow: 0 6px 20px #0008; }
.nav .snap svg { width: 28px; height: 28px; }
.footer-brand { text-align: center; font-size: 12px; color: var(--muted); margin-top: 30px; }

/* pieces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.card + .card { margin-top: 10px; }
.list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-top: 1px solid var(--line); color: var(--text); }
.item:first-child { border-top: 0; }
.item .chev { color: var(--muted); }
.pill { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--panel2); color: var(--muted); }
.pill.brand { background: color-mix(in srgb, var(--brand) 20%, transparent); color: var(--brand); }
.pill.good { background: #3ecf8e22; color: var(--good); } .pill.bad { background: #ff6b6b22; color: var(--bad); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--panel2);
  border-radius: 12px; padding: 11px 16px; font-weight: 600; cursor: pointer; min-height: 44px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #111; }
.btn.danger { color: var(--bad); } .btn.block { width: 100%; } .btn.sm { min-height: 34px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .5; }
.btn svg { width: 18px; height: 18px; }
label.f { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
input.i, select.i, textarea.i { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 16px; }
textarea.i { min-height: 110px; resize: vertical; }
input.i:focus, select.i:focus, textarea.i:focus { outline: 2px solid var(--brand); border-color: transparent; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 6px -14px 14px; padding: 0 14px; scrollbar-width: none; }
.tabs a { padding: 8px 14px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; font-size: 14px; }
.tabs a.on { background: var(--brand); color: #111; border-color: var(--brand); font-weight: 700; }
.banner { border-radius: var(--r); padding: 12px 14px; margin-bottom: 12px; display: flex; gap: 10px; align-items: center;
  background: color-mix(in srgb, var(--brand) 14%, var(--panel)); border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent); }
.banner.bad { background: #ff6b6b18; border-color: #ff6b6b55; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* photos */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.ph { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--panel2); cursor: pointer; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .star { position: absolute; top: 5px; right: 5px; background: #000a; border-radius: 99px; width: 26px; height: 26px; display: grid; place-items: center; color: #ffd34d; font-size: 15px; }
.ph .tag { position: absolute; left: 5px; bottom: 5px; background: #000b; color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 6px; font-weight: 700; }
.ph.sel { outline: 3px solid var(--brand); outline-offset: -3px; }
.ph.sel::after { content: '✓'; position: absolute; top: 5px; left: 5px; background: var(--brand); color: #111; border-radius: 99px; width: 24px; height: 24px; display: grid; place-items: center; font-weight: 800; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair .ph { aspect-ratio: 4/3; }
.afters { display: flex; gap: 6px; overflow-x: auto; }
.afters .ph { width: 100%; }

/* meter */
.meter { height: 12px; background: var(--panel2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.meter > div { height: 100%; background: var(--good); border-radius: 99px; }
.meter.warn > div { background: var(--warn); } .meter.full > div { background: var(--bad); }

/* sheets, toast, viewer */
.sheet-bg { position: fixed; inset: 0; background: #0009; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--panel); border-radius: 20px 20px 0 0; width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); }
.sheet .grab { width: 40px; height: 5px; background: var(--line); border-radius: 9px; margin: -6px auto 12px; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 20px; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav) + 18px); transform: translateX(-50%); background: #fff; color: #111; padding: 11px 16px;
  border-radius: 12px; font-weight: 600; z-index: 80; box-shadow: 0 8px 30px #0008; max-width: 90vw; }
.toast.bad { background: var(--bad); color: #fff; }
.viewer { position: fixed; inset: 0; background: #000; z-index: 60; display: flex; flex-direction: column; }
.viewer img { flex: 1; min-height: 0; object-fit: contain; width: 100%; }
.viewer .bar { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: center; background: #000; flex-wrap: wrap; }

/* camera */
.cam { position: fixed; inset: 0; background: #000; z-index: 70; display: flex; flex-direction: column; }
.cam .stage { position: relative; flex: 1; overflow: hidden; }
.cam video, .cam .ghost { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam .ghost { opacity: .4; pointer-events: none; }
.cam .controls { display: flex; align-items: center; justify-content: space-around; padding: 16px 10px calc(20px + env(safe-area-inset-bottom)); background: #000; }
.cam .shutter { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: var(--brand); }
.cam .label { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; color: #fff; font-weight: 700; text-shadow: 0 1px 4px #000; }

/* chat */
.msgs { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 82%; padding: 9px 12px; border-radius: 14px; background: var(--panel2); }
.msg.me { align-self: flex-end; background: color-mix(in srgb, var(--brand) 25%, var(--panel2)); }
.msg .by { font-size: 11px; color: var(--muted); margin-bottom: 2px; }

/* permission toggles */
.perm { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:disabled + span { opacity: .5; }

/* sign in page */
.auth { max-width: 440px; margin: 0 auto; padding: 30px 18px 60px; }
.brandmark { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.brandmark .mark { width: 48px; height: 48px; border-radius: 13px; background: var(--brand); display: grid; place-items: center; color: #111; }
.brandmark .mark svg { width: 28px; height: 28px; }
.brandmark b { font-size: 24px; letter-spacing: -.3px; }
.person { width: 100%; text-align: left; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { padding: 9px 8px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { color: var(--muted); font-weight: 600; border-top: 0; }
