/* Flux Works Driver Development. Tokens taken from the 9 screen designs. */
:root {
  --page: #0A0A0A;
  --black: #000000;
  --panel: #141414;
  --raised: #1C1C1C;
  --line: #262626;
  --line-soft: #1C1C1C;
  --white: #FFFFFF;
  --soft: #C7C7C7;
  --muted: #A3A3A3;
  --dim: #737373;
  --blue: #4FAEF2;
  --blue-deep: #10273A;
  --danger: #FF6B6B;
  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--page); color: var(--white); }
body { font-family: var(--body); font-size: 15px; line-height: 1.5; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: var(--white); }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; display: block; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: 96px; }
.app.no-nav { padding-bottom: 32px; }

/* Type */
.display { font-family: var(--display); font-stretch: 125%; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; line-height: 1.05; }
h1.display { margin: 0; font-size: 30px; }
.h2 { margin: 0; font-family: var(--display); font-stretch: 125%; font-weight: 700; font-size: 15px; letter-spacing: 1.5px; text-transform: uppercase; }
.num { font-family: var(--display); font-stretch: 125%; font-weight: 700; }
.muted { color: var(--muted); }
.soft { color: var(--soft); }
.small { font-size: 13px; }
.blue { color: var(--blue); }
p { margin: 0; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 40px; height: 40px; border-radius: 20px; }
.brand b { display: block; font-family: var(--display); font-stretch: 125%; font-weight: 800; font-size: 17px; letter-spacing: 3px; line-height: 1.15; }
.brand small { display: block; font-size: 10px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); line-height: 1.15; }
.back { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 16px 0 12px; border-radius: 22px; background: var(--raised); text-decoration: none; font-weight: 600; font-size: 13px; }

/* Layout */
.section { padding: 30px 20px 0; display: flex; flex-direction: column; gap: 14px; }
.section.tight { padding-top: 18px; gap: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 14px; background: var(--black); border: 1px solid var(--line); font-size: 12px; font-weight: 500; }
.chip.blue { border-color: var(--blue); color: var(--blue); }
.chip.solid { background: var(--raised); border-color: var(--raised); }

/* Buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px; border: 0; border-radius: 26px; background: var(--white); color: var(--black); text-decoration: none; font-family: var(--display); font-stretch: 125%; font-weight: 700; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; width: 100%; }
.btn.blue { background: var(--blue); }
.btn.ghost { background: var(--raised); color: var(--white); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid #3A1F1F; }
.btn[disabled] { opacity: .5; cursor: default; }
.pill { display: inline-flex; align-items: center; height: 44px; padding: 0 16px; border-radius: 22px; background: var(--raised); border: 0; text-decoration: none; font-size: 13px; font-weight: 600; cursor: pointer; }
.link { background: none; border: 0; padding: 0; color: var(--white); text-decoration: underline; cursor: pointer; font-weight: 600; }

/* Cards */
.panel { background: var(--panel); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.frame { margin: 22px 16px 0; padding: 8px; background: var(--black); border-radius: 26px; }
.hero { background: var(--white); color: var(--page); border-radius: 20px; padding: 20px 20px 18px; display: flex; flex-direction: column; gap: 4px; }
.hero .label { font-size: 12px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: #525252; }
.hero .big { font-family: var(--display); font-stretch: 125%; font-weight: 800; font-size: 54px; line-height: 1.05; letter-spacing: -1px; }
.hero .tag { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 13px; background: var(--page); color: var(--white); font-size: 12px; font-weight: 600; }
.under { display: flex; justify-content: space-between; padding: 12px 14px 6px; font-size: 13px; color: var(--muted); }
.under strong { color: var(--white); font-weight: 600; }
.under .gain { color: var(--blue); font-weight: 700; }

.focus { background: var(--blue); color: var(--black); border-radius: 20px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.focus .h2 { font-size: 13px; }
.focus p { font-size: 17px; font-weight: 600; line-height: 1.35; }

.lock { border: 1px dashed #333; border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.lock .icon { width: 36px; height: 36px; border-radius: 18px; background: var(--raised); display: flex; align-items: center; justify-content: center; }

/* Lists */
.list > * { border-top: 1px solid var(--line); }
.list > *:last-child { border-bottom: 1px solid var(--line); }
.note { display: flex; gap: 16px; padding: 14px 0; }
.note .n { flex: none; width: 28px; font-family: var(--display); font-stretch: 125%; font-weight: 800; font-size: 15px; color: var(--blue); }
.note .n.dim { color: var(--dim); }
.note b { display: block; font-weight: 600; font-size: 15px; }
.note p { color: var(--soft); }

.lap { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; padding: 12px 0; }
.lap .i { display: flex; align-items: center; gap: 8px; color: var(--muted); padding-left: 16px; }
.lap .i.best { padding-left: 0; }
.lap .i.best::before { content: ""; width: 8px; height: 8px; background: var(--blue); }
.lap .t { font-size: 16px; }

.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sectors { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sectors > div { padding: 14px 0 14px 14px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.sectors > div:first-child { padding-left: 0; border-left: 0; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { padding: 14px; background: var(--panel); border-radius: 16px; display: flex; flex-direction: column; gap: 2px; }
.tile .num { font-size: 16px; }

.session { display: flex; flex-direction: column; gap: 6px; padding: 16px; background: var(--panel); border-radius: 20px; text-decoration: none; }
.session .name { font-family: var(--display); font-stretch: 125%; font-weight: 700; font-size: 17px; text-transform: uppercase; }
.session .best { font-family: var(--display); font-stretch: 125%; font-weight: 800; font-size: 26px; }

/* Corner table */
.ctable { width: 100%; border-collapse: collapse; font-size: 13px; }
.ctable th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px 0; font-size: 12px; }
.ctable td { padding: 12px 0; border-top: 1px solid var(--line); }
.ctable td:last-child, .ctable th:last-child { text-align: right; }
.bad { color: var(--blue); font-weight: 600; }
.metric { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.metric > div { background: var(--black); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.metric .num { font-size: 15px; }

/* Charts */
.chart { width: 100%; height: auto; }
.legend { display: flex; gap: 18px; font-size: 12px; color: var(--soft); flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 3px; background: var(--white); display: inline-block; }
.legend i.b { background: var(--blue); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 16px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
label.field .hint { font-weight: 400; color: var(--muted); }
.input { height: 52px; padding: 0 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-size: 16px; width: 100%; }
.input:focus { outline: none; border-color: var(--blue); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #A3A3A3 50%), linear-gradient(135deg, #A3A3A3 50%, transparent 50%); background-position: calc(100% - 22px) 23px, calc(100% - 16px) 23px; background-size: 6px 6px; background-repeat: no-repeat; }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.choice label { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-weight: 600; font-size: 14px; text-align: center; cursor: pointer; }
.choice input:checked + span { border-color: var(--blue); color: var(--blue); background: #0E1A24; }
.choice input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.two { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }
.drop { border: 1px dashed #3A3A3A; border-radius: 20px; padding: 26px 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; cursor: pointer; }
.drop input { display: none; }
.files { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.bar { height: 6px; background: var(--raised); border-radius: 3px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--blue); transition: width .2s; }
.err { color: var(--danger); font-size: 13px; }

/* Pricing */
.toggle { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel); border-radius: 22px; padding: 4px; }
.toggle button { height: 40px; border: 0; border-radius: 18px; background: transparent; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--muted); }
.toggle button[aria-pressed="true"] { background: var(--white); color: var(--black); }
.plan { background: var(--panel); border-radius: 24px; padding: 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.plan.featured { background: var(--white); color: var(--black); }
.plan.featured .muted { color: #525252; }
.price { font-family: var(--display); font-stretch: 125%; font-weight: 800; font-size: 40px; line-height: 1; }
.ticks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.ticks li { display: flex; gap: 10px; }
.ticks li::before { content: ""; flex: none; width: 14px; height: 8px; margin-top: 6px; border-left: 2px solid var(--blue); border-bottom: 2px solid var(--blue); transform: rotate(-45deg); }
.plan.featured .ticks li::before { border-color: var(--black); }
details { border-top: 1px solid var(--line); padding: 14px 0; }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary { font-weight: 600; cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
details p { color: var(--soft); padding-top: 6px; }

/* Profile */
.who { display: flex; align-items: center; gap: 16px; }
.avatar { width: 64px; height: 64px; border-radius: 32px; background: var(--blue); color: var(--black); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-stretch: 125%; font-weight: 800; font-size: 22px; }
.stat .num { font-size: 26px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }

/* Auth */
.auth { padding: 8px 20px 0; display: flex; flex-direction: column; gap: 22px; }
.auth h1 { font-size: 34px; }
.privacy { display: flex; gap: 12px; padding: 16px; background: var(--panel); border-radius: 18px; font-size: 13px; color: var(--soft); }
.privacy b { color: var(--white); display: block; font-size: 14px; }

/* States */
.spin { width: 28px; height: 28px; border: 3px solid var(--raised); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { min-height: 50vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 0 30px; }
.empty { background: var(--panel); border-radius: 24px; padding: 28px 22px; display: flex; flex-direction: column; gap: 12px; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 16px; background: #0E1A24; border: 1px solid #16324A; font-size: 13px; text-decoration: none; }

/* Nav */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--black); border-top: 1px solid var(--line-soft); padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
.nav > div { max-width: 480px; margin: 0 auto; display: flex; align-items: center; justify-content: space-around; }
.nav a { min-width: 60px; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; }
.nav a[aria-current="page"] { color: var(--white); }
.nav a.up { width: 58px; height: 58px; border-radius: 18px; background: var(--blue); color: var(--black); }

/* Dialog and toast */
dialog { background: var(--panel); color: var(--white); border: 1px solid var(--line); border-radius: 24px; padding: 22px; width: min(92vw, 420px); }
dialog::backdrop { background: rgba(0, 0, 0, .7); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 20; max-width: min(92vw, 440px); padding: 12px 18px; border-radius: 16px; background: var(--white); color: var(--black); font-weight: 600; font-size: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.toast.bad { background: var(--danger); color: var(--black); }

[hidden] { display: none !important; }
.privacy svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } .bar > div { transition: none; } }

/* Where the time goes */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.phase { border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.phase .num { font-size: 22px; }
.phase.brk { background: #0E1A24; border: 1px solid #16324A; }
.phase.brk > .small:first-child { color: var(--blue); font-weight: 700; }
.phase.ext { background: var(--panel); border: 1px solid var(--line); }
.phase.ext > .small:first-child { font-weight: 700; }
.pbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--raised); }
.pbar span:first-child { background: var(--blue); }
.pbar span:last-child { background: var(--white); }
.cbars { display: flex; flex-direction: column; gap: 10px; }
.cbar { display: grid; grid-template-columns: 58px 1fr 70px; align-items: center; gap: 10px; }
.cbar .track { display: flex; height: 12px; background: var(--raised); border-radius: 6px; overflow: hidden; }
.cbar .b { background: var(--blue); }
.cbar .e { background: var(--white); }
.cbar .num { text-align: right; }
.nav .brand.side, .nav .uplabel { display: none; }

/* Desktop: sidebar navigation, wider content, two column reports. Phones are unchanged. */
@media (min-width: 900px) {
  body { font-size: 15px; }
  .app { max-width: 1240px; margin: 0; padding: 0 40px 60px 268px; }
  .app.no-nav { max-width: 600px; margin: 0 auto; padding: 0 24px 48px; }
  .top { padding: 22px 20px 6px; }
  .app:not(.no-nav) > .top .brand { visibility: hidden; }
  h1.display { font-size: 38px; }
  .nav { top: 0; bottom: 0; left: 0; right: auto; width: 228px; border-top: 0; border-right: 1px solid var(--line-soft); padding: 22px 14px; }
  .nav > div { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px; max-width: none; height: 100%; }
  .nav .brand.side { display: flex; padding: 0 8px 22px; }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 46px; padding: 0 14px; font-size: 14px; border-radius: 14px; }
  .nav a:hover { background: var(--panel); color: var(--white); }
  .nav a[aria-current="page"] { background: var(--raised); }
  .nav a.up { order: 1; width: auto; height: 50px; margin-bottom: 14px; color: var(--black); font-weight: 700; }
  .nav a.up:hover { background: var(--blue); color: var(--black); filter: brightness(1.08); }
  .nav .brand.side { order: 0; }
  .nav a:not(.up):not(.brand) { order: 2; }
  .nav .uplabel { display: inline; }
  .dash { columns: 2; column-gap: 28px; }
  .dash > * { break-inside: avoid; }
  .dash > .section:first-child { padding-top: 18px; }
  .frame { max-width: 620px; }
  .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
  .plans { display: grid; grid-template-columns: repeat(2, 1fr); align-items: stretch; gap: 14px; }
  .plans .plan .btn { margin-top: auto; }
  .toggle { max-width: 520px; }
  .banner { max-width: 760px; }
  .toast { bottom: 28px; }
  .auth { padding-top: 40px; }
}
@media (min-width: 1500px) {
  .app { max-width: 1480px; }
}

/* Analyst workspace */
.ws { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 0; }
.ws-side, .ws-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ws-side { order: 2; } /* phones: graphs first, pickers below */
.ws-list { display: flex; flex-direction: column; gap: 2px; }
.ws-scroll { max-height: 300px; overflow-y: auto; }
.ws-item { display: grid; grid-template-columns: auto auto 1fr auto auto; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 10px; font-size: 13px; cursor: pointer; }
.ws-item:hover { background: var(--raised); }
.ws-item.on { background: #0E1A24; }
.ws-item input { accent-color: #4FAEF2; }
.ws-item i, .dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.dot { margin-right: 6px; }
#ws-ch .ws-item { grid-template-columns: auto 1fr auto; }
.ws-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ws-corners { display: flex; flex-wrap: wrap; gap: 6px; }
.ws-c { height: 34px; padding: 0 12px; font-size: 12px; }
.ws-plots { display: flex; flex-direction: column; background: var(--panel); border-radius: 18px; padding: 10px 12px; gap: 4px; }
.ws-plot canvas { width: 100%; display: block; touch-action: pan-y; cursor: crosshair; }
.ws-zoom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: #0E1A24; border: 1px solid #16324A; font-size: 13px; }
.ws-zoom[hidden] { display: none; }
.ws-zoom span { flex: 1; min-width: 160px; }
.ws-zoom .pill { height: 36px; }
.pill[disabled] { opacity: .4; }
.ws-ptitle { display: flex; align-items: baseline; gap: 8px; font-size: 12px; padding-top: 4px; }
.ws-x { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; }
.ws-bottom { display: grid; gap: 12px; }
.ws-bottom canvas { width: 100%; display: block; }
.ws-table td, .ws-table th { padding: 7px 4px; font-size: 13px; }
.ws-table th { text-align: right; white-space: nowrap; }
.ws-table th:first-child { text-align: left; }
.ws-table td:not(:first-child) { text-align: right; }
.ws-ins { text-align: left; background: var(--black); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; color: var(--white); }
.ws-ins.high { border-left-color: #FF7A7A; }
.ws-ins.medium { border-left-color: #F5A524; }
.ws-ins.info { border-left-color: var(--blue); }
.ws-ins:hover { background: var(--raised); }
@media (min-width: 900px) {
  .ws { display: grid; grid-template-columns: 300px minmax(0, 1fr); align-items: start; padding: 18px 0 0 20px; }
  .ws-side { order: 0; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
  .ws-scroll { max-height: 340px; }
  .ws-bottom { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (min-width: 1300px) { .app.ws-wide { max-width: none; } }
@media (min-width: 1280px) { .plans { grid-template-columns: repeat(4, 1fr); } }
