/* GR brand: deep navy, ivory, muted gold rule. Gains navy-blue, losses muted crimson (no green / orange). */
:root { --navy-deep:#0E2340; --navy:#142E52; --navy-light:#2A4A76; --ivory:#E3D6B4; --ivory-light:#F3ECDA; --paper:#F6F3EC;
  --card:#FFFFFF; --line:#E2DACA; --gold:#8A8573; --text:#1B2A41; --muted:#6E6A5E; --gain:#1F5FA8; --loss:#A63D40; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--text); font: 15px/1.4 -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; }
h1, h2 { font-family: Georgia, serif; color: var(--navy); font-weight: 600; }
h1 { font-size: 24px; margin: 8px 0; }
h2 { font-size: 16px; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--ivory); }
.logo { width: 64px; height: 64px; border-radius: 14px; }
.plain .center { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center; gap: 10px; }
.narrow { max-width: 420px; margin: 0 auto; }
.muted { color: var(--muted); } .small { font-size: 13px; }
button, input, select, textarea { font: inherit; }
button.primary, button.secondary { width: 100%; padding: 13px 16px; border-radius: 10px; border: 1px solid var(--navy); }
button.primary { background: var(--navy); color: var(--ivory-light); }
button.secondary { background: var(--card); color: var(--navy); }
button.link { background: none; border: 0; color: var(--navy-light); text-decoration: underline; padding: 8px; }
form { width: 100%; display: flex; flex-direction: column; gap: 10px; }
input[type=password], input[type=search], textarea, select { width: 100%; padding: 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--text); }
details summary { cursor: pointer; }
video#cam { width: 100%; max-width: 360px; border-radius: 12px; background: #000; aspect-ratio: 1; object-fit: cover; }
.error { color: var(--loss); background: #F8ECEC; border-radius: 8px; padding: 10px; width: 100%; }
.warn { color: var(--navy); background: var(--ivory-light); border-radius: 8px; padding: 8px; }
.spinner { width: 32px; height: 32px; margin: 24px auto; border: 3px solid var(--ivory); border-top-color: var(--navy);
  border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.main header.top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; background: var(--navy-deep); color: var(--ivory-light);
  border-bottom: 2px solid var(--gold); }
.main header .logo { width: 34px; height: 34px; border-radius: 8px; }
.main header .title { flex: 1; font-family: Georgia, serif; font-size: 17px; min-width: 0; }
.main header select { background: var(--navy); color: var(--ivory-light); border-color: var(--navy-light); padding: 8px; }
.icon { background: none; border: 1px solid var(--navy-light); color: var(--ivory-light); border-radius: 8px; width: 38px; height: 38px; font-size: 17px; }
main { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 2; }
nav.tabs button { flex: 1; background: none; border: 0; padding: 14px 4px; color: var(--muted); font-weight: 600; border-top: 3px solid transparent; }
nav.tabs button.on { color: var(--navy); border-top-color: var(--gold); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 12px 0; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.kpi:first-child { grid-column: 1 / -1; background: var(--navy); color: var(--ivory-light); border-color: var(--navy); }
.kpi:first-child .kl, .kpi:first-child .ks { color: var(--ivory); }
.kl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kv { font-size: 21px; font-family: Georgia, serif; font-weight: 600; margin: 2px 0; }
.kpi:first-child .kv { font-size: 28px; }
.ks { font-size: 12px; color: var(--muted); }
.gain { color: var(--gain); } .loss { color: var(--loss); }
.kpi:first-child .gain, .kpi:first-child .loss { color: inherit; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 8px 4px; border-bottom: 1px solid #F0EBDF; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: left; }
tr:last-child td { border-bottom: 0; }
.r { text-align: right; white-space: nowrap; } .nw { white-space: nowrap; }
.sub { font-size: 12px; color: var(--muted); }
.sub.gain { color: var(--gain); } .sub.loss { color: var(--loss); }
tr.tap { cursor: pointer; }
.bar { margin: 8px 0; } .bl { display: flex; justify-content: space-between; font-size: 13px; gap: 8px; }
.bt { height: 8px; background: var(--ivory-light); border-radius: 4px; margin-top: 3px; overflow: hidden; }
.bf { height: 100%; border-radius: 4px; }
.c0{background:#142E52}.c1{background:#3A6595}.c2{background:#C9B98F}.c3{background:#7F9CC0}.c4{background:#8A8573}
.c5{background:#B9CBE0}.c6{background:#5C4E33}.c7{background:#E3D6B4}.c8{background:#2A4A76}
.banner { background: var(--ivory-light); border-left: 3px solid var(--gold); padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; }
.chip { white-space: nowrap; border: 1px solid var(--line); background: var(--card); color: var(--navy); border-radius: 16px; padding: 6px 12px; }
.chip.on { background: var(--navy); color: var(--ivory-light); border-color: var(--navy); }
details.hold { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin: 8px 0; }
details.hold summary { list-style: none; display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; }
details.hold summary::-webkit-details-marker { display: none; }
.hn { font-weight: 600; min-width: 0; } .hv { text-align: right; white-space: nowrap; font-weight: 600; }
details.hold dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; padding: 4px 12px 12px; font-size: 14px; }
dt { color: var(--muted); } dd { margin: 0; text-align: right; }
.foot { font-size: 12px; color: var(--muted); text-align: center; padding: 12px 0; }
.hidden-file { display: none; }
.help { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; font-size: 14px; width: 100%; }
.help p { margin: 8px 0; }
