/* Root Strength app styles */
:root {
  --black: #0A0A0A;
  --panel: #141413;
  --panel-2: #1b1b19;
  --line: rgba(245, 245, 240, 0.12);
  --line-strong: rgba(245, 245, 240, 0.22);
  --maroon: #7A1B1B;
  --maroon-light: #9c2626;
  --red: #D14E4E;
  --gold: #B8860B;
  --gold-light: #d4a017;
  --ok: #4f9d69;
  --off: #F5F5F0;
  --dim: #c9c9c2;
  --muted: #8f8f89;
  --heading: 'Oswald', 'Arial Narrow', Arial, sans-serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --radius: 6px;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--black); color: var(--off); font-family: var(--body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; overflow-x: hidden; }
h1, h2, h3, h4 { font-family: var(--heading); text-transform: uppercase; letter-spacing: 0.03em; line-height: 1.15; margin: 0; color: #fff; font-weight: 600; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; } h4 { font-size: 0.85rem; color: var(--dim); }
p { margin: 0 0 0.75rem; }
a { color: var(--gold-light); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg, canvas, video { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 0.85rem; } .xs { font-size: 0.75rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 0.75rem; }
.row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 1rem; }
.stack-sm { display: grid; gap: 0.5rem; }
.grid-2 { display: grid; gap: 0.75rem; grid-template-columns: 1fr 1fr; }
.eyebrow { font-family: var(--heading); font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-light); font-weight: 600; }

/* shell */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 0.75rem; padding: calc(0.6rem + var(--safe-t)) 1rem 0.6rem; background: rgba(10,10,10,0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .brand { display: flex; align-items: center; gap: 0.6rem; }
.topbar .brand img { width: 30px; height: 30px; object-fit: contain; }
.topbar .brand b { font-family: var(--heading); letter-spacing: 0.12em; font-size: 0.95rem; display: block; line-height: 1; }
.topbar .brand i { font-style: normal; font-family: var(--heading); letter-spacing: 0.2em; font-size: 0.6rem; color: var(--red); display: block; margin-top: 0.15rem; }
.topbar .title { font-family: var(--heading); text-transform: uppercase; letter-spacing: 0.06em; font-size: 1rem; flex: 1; text-align: center; }
.topbar .spacer { flex: 1; }
.iconbtn { background: transparent; border: 1px solid var(--line); border-radius: var(--radius); color: var(--dim); min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0 0.6rem; font-size: 0.85rem; }
.iconbtn:hover { border-color: var(--gold); color: var(--gold-light); }
.content { flex: 1; width: 100%; max-width: 920px; margin: 0 auto; padding: 1rem 1rem calc(var(--tab-h) + var(--safe-b) + 1.5rem); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; background: rgba(15,15,14,0.97); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem; height: var(--tab-h); color: var(--muted); font-size: 0.68rem; font-family: var(--heading); letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; }
.tabs a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--gold-light); }
@media (min-width: 900px) {
  .tabs { top: 0; bottom: auto; right: auto; width: 200px; flex-direction: column; justify-content: flex-start; padding: 5.2rem 0.75rem 1rem; border-top: 0; border-right: 1px solid var(--line); }
  .tabs a { flex: none; flex-direction: row; justify-content: flex-start; gap: 0.75rem; height: 46px; padding: 0 0.9rem; border-radius: var(--radius); font-size: 0.8rem; }
  .tabs a.on { background: var(--panel); }
  .shell .topbar, .shell .content { margin-left: 200px; width: calc(100% - 200px); max-width: none; }
  .content { max-width: none; padding: 1.25rem 2rem 2rem; }
  .content > * { max-width: 920px; }
  .topbar { z-index: 50; }
}

/* cards & lists */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.card.flat { padding: 0; overflow: hidden; }
.card.accent { border-color: var(--maroon); background: linear-gradient(165deg, rgba(122,27,27,0.16), var(--panel) 65%); }
.card.gold { border-color: var(--gold); background: linear-gradient(165deg, rgba(184,134,11,0.12), var(--panel) 65%); }
.card h3 { margin-bottom: 0.4rem; }
.list { display: grid; }
.list > * { border-top: 1px solid var(--line); }
.list > *:first-child { border-top: 0; }
.item { display: flex; align-items: center; gap: 0.8rem; padding: 0.85rem 1rem; cursor: pointer; }
.item:hover { background: rgba(255,255,255,0.025); }
.item .t { font-weight: 600; } .item .s { color: var(--muted); font-size: 0.85rem; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--maroon); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--heading); letter-spacing: 0.05em; flex-shrink: 0; }
.chev { color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.55rem; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 0.72rem; color: var(--dim); white-space: nowrap; }
.chip.ok { border-color: rgba(79,157,105,0.55); color: #7fd29c; }
.chip.warn { border-color: rgba(212,160,23,0.6); color: var(--gold-light); }
.chip.bad { border-color: rgba(209,78,78,0.6); color: var(--red); }
.stat { text-align: left; } .stat b { display: block; font-family: var(--heading); font-size: 1.7rem; color: #fff; line-height: 1.1; } .stat span { font-size: 0.75rem; color: var(--muted); }
.sectionhead { display: flex; align-items: baseline; justify-content: space-between; margin: 0.5rem 0 0.5rem; }
.banner { border: 1px solid rgba(212,160,23,0.5); background: rgba(184,134,11,0.1); border-radius: var(--radius); padding: 0.75rem 1rem; font-size: 0.88rem; }
.banner.warn-red { border-color: rgba(209,78,78,0.55); background: rgba(122,27,27,0.18); }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; border-radius: var(--radius); border: 1px solid transparent; padding: 0.7rem 1.1rem; font-family: var(--heading); font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; font-size: 0.85rem; cursor: pointer; background: var(--maroon); color: #fff; min-height: 44px; }
.btn:hover { background: var(--maroon-light); }
.btn.gold { background: var(--gold); color: var(--black); } .btn.gold:hover { background: var(--gold-light); }
.btn.ghost { background: transparent; border-color: var(--line-strong); color: var(--off); } .btn.ghost:hover { border-color: var(--gold); color: var(--gold-light); }
.btn.danger { background: transparent; border-color: rgba(209,78,78,0.6); color: var(--red); }
.btn.sm { padding: 0.4rem 0.75rem; min-height: 34px; font-size: 0.75rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
label.f { display: grid; gap: 0.3rem; font-size: 0.78rem; font-family: var(--heading); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=number], input[type=date], input[type=password], select, textarea { width: 100%; background: var(--black); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0.7rem 0.8rem; color: #fff; font-family: var(--body); text-transform: none; letter-spacing: 0; font-size: 1rem; min-height: 44px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
.seg { display: flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg button { flex: 1; background: transparent; border: 0; color: var(--dim); padding: 0.55rem 0.5rem; font-family: var(--heading); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.75rem; cursor: pointer; border-right: 1px solid var(--line); min-height: 40px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--maroon); color: #fff; }
.scroll-seg { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll-seg .seg { min-width: max-content; }
.check { width: 34px; height: 34px; border-radius: 6px; border: 2px solid var(--line-strong); background: transparent; color: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; padding: 0; }
.check.on { background: var(--gold); border-color: var(--gold); color: var(--black); }
.check svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 3; }
.pim { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.pim button { height: 40px; border-radius: 5px; border: 1px solid var(--line-strong); background: transparent; color: var(--dim); font-family: var(--heading); cursor: pointer; }
.pim button.on { background: var(--maroon); color: #fff; border-color: var(--maroon-light); }
.hint { font-size: 0.78rem; color: var(--muted); margin-top: 0.2rem; }

/* sheet */
#sheet-root { position: relative; z-index: 100; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 14px 14px 0 0; padding: 1.1rem 1.1rem calc(1.4rem + var(--safe-b)); animation: up .18s ease-out; }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 12px; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet .grab { width: 42px; height: 4px; background: var(--line-strong); border-radius: 4px; margin: -0.3rem auto 0.9rem; }
#toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); transform: translateX(-50%) translateY(20px); background: #fff; color: #111; padding: 0.6rem 1rem; border-radius: 999px; font-size: 0.88rem; opacity: 0; pointer-events: none; transition: all .2s; z-index: 200; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* drill cards */
.drill { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.drill > summary { list-style: none; display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; cursor: pointer; }
.drill > summary::-webkit-details-marker { display: none; }
.drill[open] > summary { border-bottom: 1px solid var(--line); }
.drill .body { padding: 0.9rem 1rem 1rem; display: grid; gap: 0.7rem; font-size: 0.93rem; }
.drill ol { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.3rem; }
.tag { font-family: var(--heading); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-light); }
.cue { border-left: 3px solid var(--gold); padding: 0.25rem 0.7rem; color: var(--off); background: rgba(184,134,11,0.08); font-size: 0.88rem; }

/* charts */
.chart { width: 100%; max-width: 560px; height: auto; margin: 0 auto; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--body); }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.75rem; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 0.35rem; }
.bar { height: 8px; background: var(--panel-2); border-radius: 8px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--gold); }

/* login / splash */
.splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1.25rem calc(2rem + var(--safe-b)); gap: 1.5rem; text-align: center; background: radial-gradient(ellipse at 50% -10%, rgba(122,27,27,0.35), transparent 60%), var(--black); }
.splash img.logo { width: min(260px, 62vw); }
.splash .choices { display: grid; gap: 0.75rem; width: min(380px, 100%); }
.choice { text-align: left; padding: 1rem 1.1rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); cursor: pointer; display: block; width: 100%; }
.choice:hover { border-color: var(--gold); }
.choice b { font-family: var(--heading); text-transform: uppercase; letter-spacing: 0.06em; display: block; font-size: 1.05rem; }
.choice span { color: var(--muted); font-size: 0.85rem; }

/* analysis */
.stagebox { position: relative; background: #000; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stagebox video, .stagebox canvas { width: 100%; height: auto; max-height: 62vh; object-fit: contain; background: #000; }
.stagebox canvas.overlay { position: absolute; inset: 0; pointer-events: none; }
.metric { display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 0.75rem; padding: 0.7rem 0; border-top: 1px solid var(--line); align-items: baseline; }
.metric:first-child { border-top: 0; }
.metric .k { font-weight: 600; } .metric .v { font-family: var(--heading); font-size: 1.2rem; color: #fff; text-align: right; } .metric .n { grid-column: 1 / -1; font-size: 0.8rem; color: var(--muted); }
.flag { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.flag:first-child { border-top: 0; }
.flag .check { margin-top: 0.1rem; }
progress { width: 100%; height: 8px; accent-color: var(--gold); }
table.t { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.t th { text-align: left; font-family: var(--heading); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); padding: 0.4rem 0.4rem; border-bottom: 1px solid var(--line-strong); }
table.t td { padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* inline icons inside buttons and items */
.btn svg, .iconbtn svg, .item svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.avatar.photo { width: 64px; height: 64px; overflow: hidden; background: var(--panel-2); border: 2px solid var(--gold); }
.avatar.photo img { width: 100%; height: 100%; object-fit: cover; }

/* messaging */
.thread { max-height: 52vh; min-height: 220px; overflow-y: auto; padding: 0.75rem 0.9rem; display: flex; flex-direction: column; gap: 0.35rem; }
.msg { display: flex; flex-direction: column; max-width: 82%; gap: 0.1rem; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.them { align-self: flex-start; align-items: flex-start; }
.bub { padding: 0.55rem 0.8rem; border-radius: 14px; font-size: 0.95rem; line-height: 1.4; word-break: break-word; }
.msg.me .bub { background: var(--maroon); color: #fff; border-bottom-right-radius: 4px; }
.msg.them .bub { background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.composer { display: flex; gap: 0.5rem; align-items: flex-end; margin-top: 0.6rem; }
.composer textarea { min-height: 44px; max-height: 120px; flex: 1; }
.tabs a { position: relative; }
.badge { position: absolute; top: 6px; left: 54%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 0.65rem; line-height: 18px; text-align: center; font-family: var(--body); letter-spacing: 0; }
@media (min-width: 900px) { .badge { position: static; margin-left: auto; } }
.dotnew { width: 9px; height: 9px; border-radius: 50%; background: var(--red); flex-shrink: 0; }
