/* Upform — carbon ground, volt for progress, ember for warnings. */
@font-face { font-family: "Thmanyah Sans"; src: url("/fonts/thmanyah-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("/fonts/thmanyah-sans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Schibsted Grotesk"; src: url("/fonts/schibsted-grotesk-latin-var.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }

:root {
  --bg: #060708; --bg-2: #0B0D10; --card: #101317; --card-2: #161A1F; --field: #0B0D10;
  --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .16);
  --fg: #F4F3EF; --mute: #A0A6AD; --dim: #6B7279;
  --volt: #D4FF3F; --volt-ink: #0B0E02; --volt-soft: rgba(212, 255, 63, .12);
  --ember: #FF6A3D; --ember-soft: rgba(255, 106, 61, .14);
  --sky: #7CC4FF; --sky-soft: rgba(124, 196, 255, .13);
  --r-lg: 20px; --r-md: 14px; --r-sm: 10px;
  --nav-h: 62px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --font: "Schibsted Grotesk", "Thmanyah Sans", "IBM Plex Sans Arabic", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
[hidden] { display: none !important; }
.en { font-family: "Schibsted Grotesk", var(--font); }
input.en, textarea.en { direction: ltr; text-align: left; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.mute { color: var(--mute); } .dim { color: var(--dim); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.b { font-weight: 700; }
.row { display: flex; align-items: center; gap: 10px; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; } .stack { display: grid; gap: 12px; } .gap-s { gap: 6px; }
.center { text-align: center; }

.boot { min-height: 100svh; display: grid; place-items: center; }

/* ------------------------------------------------------------ shell */
.top { position: sticky; top: 0; z-index: 20; padding: calc(10px + var(--safe-t)) 16px 10px; background: rgba(6, 7, 8, .88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top .inner, main, .nav .inner { max-width: 640px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; font: 800 19px/1 "Schibsted Grotesk", sans-serif; letter-spacing: -.02em; direction: ltr; }
.brand img { width: 26px; height: 26px; }
.brand i { font-style: normal; color: var(--volt); }
.sync { font-size: 12px; color: var(--dim); display: inline-flex; align-items: center; gap: 6px; }
.sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--volt); }
.sync.busy::before { background: var(--sky); } .sync.off::before { background: var(--ember); } .sync.off { color: var(--ember); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--card-2); border: 1px solid var(--line-2); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
main { padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 28px); min-height: calc(100svh - 60px); }
main.with-timer { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 96px); }
.nav { position: fixed; inset: auto 0 0 0; z-index: 30; background: rgba(11, 13, 16, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.nav .inner { display: flex; height: var(--nav-h); }
.nav button { flex: 1; display: grid; place-items: center; align-content: center; gap: 3px; color: var(--dim); font-size: 11px; position: relative; }
.nav button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav button.on { color: var(--volt); }
.nav .dot { position: absolute; top: 9px; inset-inline-start: calc(50% + 6px); width: 8px; height: 8px; border-radius: 50%; background: var(--ember); }

/* ------------------------------------------------------------ pieces */
.h1 { font-size: 24px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.h2 { font-size: 17px; font-weight: 700; }
.label { font-size: 12px; color: var(--mute); margin-bottom: 6px; display: block; }
.section { margin-top: 26px; } .section > .h2 { margin-bottom: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.card.flat { background: var(--bg-2); }
.list > * + * { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; width: 100%; text-align: start; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; background: var(--card-2); color: var(--mute); white-space: nowrap; }
.chip.volt { background: var(--volt-soft); color: var(--volt); } .chip.ember { background: var(--ember-soft); color: var(--ember); } .chip.sky { background: var(--sky-soft); color: var(--sky); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: var(--r-md); background: var(--card-2); border: 1px solid var(--line-2); font-weight: 700; font-size: 15px; transition: transform .1s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--volt); color: var(--volt-ink); border-color: var(--volt); }
.btn.danger { color: var(--ember); border-color: rgba(255, 106, 61, .4); background: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link { color: var(--volt); font-weight: 700; font-size: 13px; }
input, select, textarea { width: 100%; background: var(--field); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0 12px; min-height: 46px; outline: none; }
textarea { padding: 12px; min-height: 110px; resize: vertical; line-height: 1.5; }
textarea.code { font: 12px/1.5 ui-monospace, Menlo, monospace; direction: ltr; text-align: left; min-height: 200px; }
input:focus, select:focus, textarea:focus { border-color: var(--volt); }
input::placeholder, textarea::placeholder { color: var(--dim); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(135deg, var(--mute) 50%, transparent 50%); background-position: 14px 20px, 19px 20px; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 34px; }
.field { display: block; } .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.err { color: var(--ember); font-size: 13px; }
.note { background: var(--card-2); border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; color: var(--mute); }
.note.ember { background: var(--ember-soft); color: #FFB59D; } .note.volt { background: var(--volt-soft); color: #E6FF9A; } .note.sky { background: var(--sky-soft); color: #B9E0FF; }
.empty { text-align: center; padding: 44px 12px; display: grid; gap: 12px; justify-items: center; }
.empty .h1 { font-size: 21px; }
.bar { height: 6px; border-radius: 3px; background: var(--card-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--volt); border-radius: 3px; transition: width .3s; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.kpi .v { font-size: 24px; font-weight: 700; line-height: 1.2; } .kpi .v small { font-size: 13px; color: var(--mute); font-weight: 400; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--mute); font-size: 13px; margin-bottom: 10px; }

/* ------------------------------------------------------------ auth */
.auth { min-height: 100svh; display: grid; place-items: center; padding: 24px; }
.auth .box { width: 100%; max-width: 380px; display: grid; gap: 14px; }
.auth .logo { display: grid; justify-items: center; gap: 10px; margin-bottom: 14px; }
.auth .logo img { width: 64px; height: 64px; }
.auth .logo .brand { font-size: 30px; }
.auth .tag { font: 500 13px "Schibsted Grotesk", sans-serif; color: var(--mute); letter-spacing: .04em; direction: ltr; }

/* ------------------------------------------------------------ plan grid */
.weeks { display: grid; gap: 8px; }
.week { display: grid; grid-template-columns: 62px repeat(auto-fit, minmax(54px, 1fr)); gap: 8px; align-items: center; }
.cell { min-height: 50px; border-radius: var(--r-sm); border: 1px solid var(--line-2); display: grid; place-items: center; align-content: center; font-size: 13px; line-height: 1.2; color: var(--mute); }
.cell b { font-size: 16px; color: var(--fg); }
.cell.done { background: var(--volt-soft); border-color: transparent; color: var(--volt); } .cell.done b { color: var(--volt); }
.cell.open { border-color: var(--sky); color: var(--sky); } .cell.open b { color: var(--sky); }
.cell.next { border: 2px solid var(--volt); }
table.plan { width: 100%; border-collapse: collapse; font-size: 13px; }
table.plan td { padding: 9px 0; border-top: 1px solid var(--line); vertical-align: top; }
table.plan td:last-child { text-align: end; white-space: nowrap; color: var(--mute); }

/* ------------------------------------------------------------ logging */
.ex { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.ex + .ex { margin-top: 12px; }
.ex.complete { border-color: rgba(212, 255, 63, .28); }
.ex-head { display: flex; gap: 12px; padding: 14px 16px; width: 100%; text-align: start; align-items: flex-start; }
.ex-idx { width: 28px; height: 28px; border-radius: 50%; background: var(--card-2); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; margin-top: 1px; }
.ex.complete .ex-idx { background: var(--volt); color: var(--volt-ink); }
.ex-name { font-size: 16px; font-weight: 700; line-height: 1.3; }
.ex-body { padding: 0 16px 14px; display: grid; gap: 12px; }
.sets { display: grid; gap: 7px; }
.set { display: grid; grid-template-columns: 22px 1fr 1fr 1fr 46px; gap: 7px; align-items: center; }
.set.head { font-size: 11px; color: var(--dim); text-align: center; }
.set .n { color: var(--dim); font-size: 13px; text-align: center; }
.set input { min-height: 46px; text-align: center; padding: 0 4px; font-size: 17px; font-weight: 700; direction: ltr; font-variant-numeric: tabular-nums; }
.set input::placeholder { font-weight: 400; font-size: 15px; }
.set .ok { height: 46px; border-radius: var(--r-sm); border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--dim); }
.set .ok svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.set.logged input { border-color: rgba(212, 255, 63, .35); }
.set.logged .ok { background: var(--volt); border-color: var(--volt); color: var(--volt-ink); }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }
.tools .btn.on { border-color: var(--volt); color: var(--volt); }
.cues { margin: 0; padding-inline-start: 18px; font-size: 13px; color: var(--mute); display: grid; gap: 4px; }

#timer { position: fixed; inset: auto 0 calc(var(--nav-h) + var(--safe-b)) 0; z-index: 25; padding: 0 12px 10px; pointer-events: none; }
#timer .t { max-width: 616px; margin: 0 auto; pointer-events: auto; background: var(--card-2); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 10px 14px; display: flex; align-items: center; gap: 12px; position: relative; overflow: hidden; }
#timer .t.end { border-color: var(--volt); background: #1B2408; }
#timer .clock { font: 700 26px/1 "Schibsted Grotesk", sans-serif; font-variant-numeric: tabular-nums; direction: ltr; min-width: 74px; }
#timer .fill { position: absolute; inset: auto 0 0 0; height: 3px; background: var(--volt); transform-origin: left; }

/* ------------------------------------------------------------ sheet + toast */
#sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .62); display: flex; align-items: flex-end; justify-content: center; }
#sheet .panel { width: 100%; max-width: 640px; max-height: 92svh; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 10px 18px calc(22px + var(--safe-b)); animation: up .22s cubic-bezier(.2, .7, .2, 1); }
#sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 14px; }
#sheet .panel > .h2 { margin-bottom: 14px; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
#toast { position: fixed; inset: calc(14px + var(--safe-t)) 16px auto 16px; z-index: 60; display: grid; justify-items: center; pointer-events: none; }
#toast div { background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-size: 14px; font-weight: 700; max-width: 100%; animation: up .2s; }
#toast div.bad { background: var(--ember); color: #fff; }

/* ------------------------------------------------------------ charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 11px "Schibsted Grotesk", sans-serif; fill: var(--mute); }
.chart .axis { stroke: var(--line-2); stroke-width: 1; }
.chart .ln { fill: none; stroke: var(--volt); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: var(--bg); stroke: var(--volt); stroke-width: 2.2; }
.chart .ln.sky { stroke: var(--sky); } .chart .pt.sky { stroke: var(--sky); }
.vol { display: grid; grid-template-columns: 96px 1fr 46px; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.vol .track { height: 10px; border-radius: 5px; background: var(--card-2); overflow: hidden; }
.vol .track i { display: block; height: 100%; background: var(--volt); border-radius: 5px; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button { padding: 6px 12px; border-radius: 7px; font-size: 13px; color: var(--mute); }
.seg button.on { background: var(--card-2); color: var(--fg); font-weight: 700; }
.energy { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.energy button { min-height: 46px; border-radius: var(--r-sm); border: 1px solid var(--line-2); font-weight: 700; }
.energy button.on { background: var(--volt); color: var(--volt-ink); border-color: var(--volt); }
.switch { width: 46px; height: 28px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line-2); position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--mute); transition: all .15s; }
.switch.on { background: var(--volt); border-color: var(--volt); } .switch.on::after { inset-inline-start: 21px; background: var(--volt-ink); }
.pw { font: 700 22px ui-monospace, Menlo, monospace; letter-spacing: .08em; direction: ltr; text-align: center; padding: 14px; background: var(--card); border: 1px dashed var(--line-2); border-radius: var(--r-md); user-select: all; }
.errs { margin: 0; padding-inline-start: 18px; display: grid; gap: 6px; font-size: 13px; color: #FFB59D; }
.errs code { color: var(--mute); font-size: 11px; direction: ltr; unicode-bidi: isolate; }
@media (min-width: 560px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
