/* The Lean Operator app. Flat surfaces, one accent, no blur, no fixed backgrounds. */
@font-face {
  font-family: "Hanken Grotesk";
  src: url("fonts/hanken-grotesk-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #0b0c0b;
  --surface: #141614;
  --surface-2: #1b1e1b;
  --border: #262a26;
  --border-2: #363b36;
  --fg: #f2f4ef;
  --muted: #9aa39b;
  --dim: #6b736c;
  --lime: #A3E635;
  --lime-dim: #7fb62a;
  --ink: #0a0a0a;
  --danger: #ff8a7a;
  --r: 16px;
  --r-sm: 12px;
  --tab-h: 62px;
  --rail-w: 240px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--fg);
  background: var(--bg) linear-gradient(180deg, #151c11 0, var(--bg) 340px) no-repeat;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  font-size: 16px;
  overscroll-behavior-y: none;
}
a { color: var(--lime); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
img, svg { display: block; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
h1 { font-size: 26px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; margin: 0 0 6px; }
h2 { font-size: 15px; font-weight: 700; color: var(--muted); letter-spacing: .01em; margin: 26px 0 10px; }
p { margin: 0 0 10px; }
.lead { color: var(--muted); font-size: 16px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 14px; }
.hl { color: var(--lime); }
.kicker { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

/* splash: shown only while the app is loading */
.splash { position: fixed; inset: 0; background: #0a0a0a; display: grid; place-items: center; z-index: 70; }
.splash-mark { width: 96px; height: 96px; border-radius: 22%; animation: splash-pulse 1.6s ease-in-out infinite; }
.splash-foot { position: absolute; left: 0; right: 0; bottom: calc(56px + var(--safe-b)); display: grid; justify-items: center; gap: 8px; color: var(--dim); font-size: 15px; font-weight: 500; }
.splash-foot img { height: 26px; width: auto; opacity: .9; }
@keyframes splash-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .splash-mark { animation: none; } }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { opacity: .7; height: 28px; width: auto; }
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b)); }
.screen .logo { height: 24px; width: auto; margin-bottom: 32px; }
.panel { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 24px 22px; }
.panel h1 { font-size: 24px; }
.steps { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-sm); font-size: 15px; }
.steps .n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--ink); background: var(--lime); }
.inline-ico { display: inline-block; vertical-align: -5px; width: 18px; height: 18px; margin: 0 2px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; font-weight: 700; font-size: 16px; width: 100%; border: 1px solid transparent; }
.btn:active { opacity: .85; }
.btn-lime { background: var(--lime); color: var(--ink); }
.btn-ghost { background: var(--surface-2); border-color: var(--border-2); color: var(--fg); }
.btn-text { color: var(--muted); font-weight: 600; min-height: 44px; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 15px; width: auto; }
.btn-danger { color: var(--danger); }
.btn[disabled] { opacity: .5; cursor: default; }
.mt { margin-top: 12px; }
.mt-lg { margin-top: 22px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }

/* forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--border-2); background: var(--surface-2); color: var(--fg); outline: none; }
.input:focus { border-color: var(--lime); }
.input::placeholder { color: var(--dim); }
.input.pin { letter-spacing: .35em; font-size: 22px; text-align: center; }
textarea.input { min-height: 150px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239aa39b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.error { color: var(--danger); background: rgba(255,138,122,.08); border: 1px solid rgba(255,138,122,.25); padding: 10px 14px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 12px; }
.status { font-size: 14px; color: var(--muted); min-height: 20px; }
.status.ok { color: var(--lime); }
.check { display: inline-flex; align-items: center; gap: 8px; margin-right: 12px; font-size: 15px; min-height: 40px; }
.check input { width: 20px; height: 20px; accent-color: var(--lime); margin: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 150px; }

/* shell */
.shell { min-height: 100vh; min-height: 100dvh; }
.top { display: flex; align-items: center; justify-content: space-between; padding: calc(12px + var(--safe-t)) 18px 8px; }
.top img { height: 20px; width: auto; }
.top .badge { font-size: 12px; font-weight: 700; color: var(--lime); border: 1px solid var(--border-2); border-radius: 999px; padding: 4px 10px; }
.view { padding: 8px 18px calc(24px + var(--tab-h) + var(--safe-b)); max-width: 720px; margin: 0 auto; min-width: 0; overflow-x: hidden; }
.view.wide { max-width: 980px; }
.view.full { max-width: none; padding: 0 0 calc(var(--tab-h) + var(--safe-b)); }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--surface); border-top: 1px solid var(--border); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; z-index: 20; }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--dim); font-size: 11px; font-weight: 600; }
.tabs a.active { color: var(--lime); }
.tabs svg { width: 24px; height: 24px; }

.preview-bar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + var(--safe-t)) 16px 10px; background: var(--lime); color: var(--ink); font-weight: 700; font-size: 15px; }
.preview-bar span { display: flex; align-items: center; gap: 8px; }
.preview-bar svg { width: 20px; height: 20px; }
.preview-bar .btn { background: var(--ink); color: var(--lime); width: auto; min-height: 40px; }
@media (min-width: 900px) { .preview-bar { margin-left: var(--rail-w); } }

.rail { display: none; }
@media (min-width: 900px) {
  .tabs { display: none; }
  .rail { display: flex; flex-direction: column; gap: 4px; position: fixed; top: 0; bottom: 0; left: 0; width: var(--rail-w); padding: 22px 14px; background: var(--surface); border-right: 1px solid var(--border); }
  .rail img { height: 20px; width: auto; align-self: flex-start; margin: 4px 10px 18px; }
  .rail a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-sm); color: var(--muted); font-weight: 600; }
  .rail a.active { color: var(--lime); background: var(--surface-2); }
  .rail a:hover { color: var(--fg); }
  .rail .spacer { flex: 1; }
  .top { display: none; }
  .main { margin-left: var(--rail-w); }
  .view { padding: 36px 32px 60px; }
  .view.full { padding: 0; }
  h1 { font-size: 32px; }
}

/* rows and cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px; }
.card.lime { border-color: var(--lime-dim); }
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); color: var(--fg); text-align: left; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
a.item:active, button.item:active { background: var(--surface-2); }
.item.today { border-color: var(--lime-dim); }
.item.locked { color: var(--dim); background: transparent; }
.item .ico { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 14px; }
.item.today .ico { background: var(--lime); color: var(--ink); }
.item.done .ico { background: rgba(163,230,53,.14); color: var(--lime); }
.item.locked .ico { background: transparent; border: 1px solid var(--border); color: var(--dim); }
.item .txt { flex: 1; min-width: 0; }
.item .t { font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.item.locked .s { color: var(--dim); }
.item .end { flex: none; font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.item.today .end { color: var(--lime); }
.item .end svg { width: 18px; height: 18px; }

.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 12px 0 8px; }
.progress i { display: block; height: 100%; background: var(--lime); border-radius: 999px; }

.stat { display: grid; gap: 2px; }
.stat b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.stat span { font-size: 13px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.prose { font-size: 17px; line-height: 1.6; }
.prose p { margin: 0 0 14px; }
.res { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--fg); }
.res .ico { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--lime); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.res .lbl { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res .x { color: var(--dim); padding: 8px; }
.entry { padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); }
.entry .who { font-weight: 700; display: flex; justify-content: space-between; gap: 8px; }
.entry .when { font-size: 12px; color: var(--dim); font-weight: 500; }
.entry .txt { white-space: pre-wrap; margin-top: 6px; font-size: 15px; }
.entry .txt.blank { color: var(--dim); }
.qa-l { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 8px; }
.entry .qa-l + .txt { margin-top: 2px; }
textarea.qa { min-height: 84px; }

/* resource cards */
.rgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.rcard { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; color: var(--fg); }
.rcard:active { background: var(--surface-2); }
.rthumb { aspect-ratio: 16 / 9; background: var(--surface-2); position: relative; display: grid; place-items: center; overflow: hidden; }
.rthumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.rthumb.noimg { background: linear-gradient(160deg, #1d2716, #141614); }
.rbig { font-size: 24px; font-weight: 800; color: var(--lime); letter-spacing: .06em; }
.rbig svg { width: 34px; height: 34px; }
.rtype { position: absolute; top: 10px; left: 10px; font-size: 11px; font-weight: 700; color: var(--ink); background: var(--lime); padding: 3px 8px; border-radius: 999px; }
.rmeta { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.rtxt { flex: 1; min-width: 0; }
.rlbl { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rsub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.rmeta .x { color: var(--dim); padding: 8px; }
.item.call { border-color: var(--lime-dim); }
.item.call .ico { background: var(--lime); color: var(--ink); }
.btn-text svg { width: 18px; height: 18px; }

/* in-app viewer */
.viewer { flex: 1; background: #0e100e; }
.vimg { display: block; max-width: 100%; margin: 14px auto; }
.vpages { display: grid; gap: 10px; padding: 14px; max-width: 980px; margin: 0 auto; }
.vpage { background: #fff; border-radius: 6px; overflow: hidden; }
.vpage canvas { width: 100%; height: auto; display: block; }

/* folded add-file form */
.adder > summary { list-style: none; cursor: pointer; }
.adder > summary::-webkit-details-marker { display: none; }
.adder[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-color: var(--lime-dim); }
.adder[open] > summary .end svg { transform: rotate(90deg); }
.adder-body { border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }

.filters { margin: 0 0 12px; }
.filters .input { width: auto; flex: 1; min-width: 140px; }
.filters input.input { flex: 2; min-width: 160px; }

/* overlays: photo view and crop */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.88); display: grid; place-items: center; padding: 18px; }
.photo-view { width: 100%; max-width: 420px; display: grid; gap: 12px; }
.photo-view img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 24px; background: var(--surface); }
.crop { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px; }
.cropbox { width: 100%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: #000; position: relative; touch-action: none; cursor: grab; border: 2px solid var(--lime-dim); }
.cropbox img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; }
.zoom { width: 100%; margin-top: 14px; accent-color: var(--lime); }

/* cohort mates */
.mates { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.mates::-webkit-scrollbar { display: none; }
.mate { flex: none; display: grid; justify-items: center; gap: 6px; width: 72px; color: var(--muted); font-size: 12px; font-weight: 600; text-align: center; }
.mate .avatar { width: 56px; height: 56px; font-size: 18px; }
.mate span { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* program blocks on the admin forms */
.prog { border: 1px solid var(--border-2); border-radius: var(--r-sm); background: var(--surface-2); overflow: hidden; }
.prog.on { border-color: var(--lime-dim); }
.prog-h { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; min-height: 52px; }
.prog-h input { width: 22px; height: 22px; accent-color: var(--lime); margin: 0; flex: none; }
.prog-n { font-weight: 700; flex: 1; }
.prog-k { font-size: 12px; color: var(--muted); font-weight: 600; }
.prog.on .prog-k { color: var(--lime); }
.prog-b { padding: 4px 14px 6px 48px; border-top: 1px solid var(--border); background: var(--surface); }
.prog-b .field { margin-bottom: 10px; margin-top: 10px; }
@media (max-width: 520px) { .prog-b { padding-left: 14px; } }
.pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 26px; }
.pager .btn { width: auto; flex: 1; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; min-height: 40px; }
.back svg { width: 18px; height: 18px; }

.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; background: var(--lime); color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 15px; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 88px; height: 88px; font-size: 30px; }
.me-head { display: flex; align-items: center; gap: 16px; margin: 6px 0 20px; }
.me-head input[type=file] { display: none; }

.frame-bar { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.frame-bar .btn { width: auto; }
.frame { flex: 1; width: 100%; border: 0; background: #fff; min-height: calc(100vh - 110px - var(--tab-h)); }
@media (min-width: 900px) { .frame { min-height: calc(100vh - 58px); } }

.skel { background: var(--surface-2); border-radius: 8px; height: 14px; }
.skel.lg { height: 60px; border-radius: var(--r); }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--border-2); border-radius: var(--r); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-wrap { overflow-x: auto; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--lime); font-size: 11px; font-weight: 700; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .item, .tabs a { transition: opacity .12s, background-color .12s; }
}
