/* ===========================================================================
   Embarc OS
   Design language read from embarcsolutions.com, 2026-11-18:
     display   Archivo Black, weight 400, UPPERCASE, tight negative tracking
     eyebrow   Inter 800, 10px, UPPERCASE, +3px tracking
     body      Inter
     accent    #2DA9E5, pill buttons at 18px radius
     surfaces  white at low opacity over the ink, not a separate slate colour
   =========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Inter:wght@400;600;800&display=swap');

:root{
  --ink:#0A0E14;
  --accent:#2DA9E5;
  --text:#FFFFFF;
  --dim:rgba(255,255,255,.45);
  --dimmer:rgba(255,255,255,.3);
  --surface:rgba(255,255,255,.05);
  --surface-2:rgba(255,255,255,.08);
  --line:rgba(255,255,255,.1);
  --ok:#3FB950; --warn:#D29922; --bad:#F85149; --live:#2DA9E5;
  --r:18px;
  --display:"Archivo Black",-apple-system,BlinkMacSystemFont,sans-serif;
  --body:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  --safe-top:env(safe-area-inset-top,0px);
  --safe-bot:env(safe-area-inset-bottom,0px);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;background:var(--ink);color:var(--text);
  font:400 15px/1.5 var(--body);overscroll-behavior-y:none}
/* The page itself must never scroll. #root needs its own height or .app's
   height:100% resolves to auto, the body scrolls instead of main, and the
   sticky header sits on top of the first card. */
body{overflow:hidden}
#root{height:100%}
button{font:inherit;color:inherit;border:0;background:none;cursor:pointer}
input{font:inherit}
a{color:inherit;text-decoration:none}

.loading{display:grid;place-items:center;height:100%}
.spinner{width:26px;height:26px;border:3px solid var(--line);border-top-color:var(--accent);
  border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---- type ---- */
.display{font:400 clamp(22px,6.4vw,30px)/1.05 var(--display);text-transform:uppercase;
  letter-spacing:-.025em;margin:0}
.eyebrow{font:800 10px/1 var(--body);text-transform:uppercase;letter-spacing:3px;
  color:var(--dim)}
.lede{color:var(--dim);font-size:14px;line-height:1.5}

/* ---- chrome ---- */
/* Anchored to the viewport, not measured against it.

   Two attempts at this failed because both were percentages of a chain:
   html -> body -> #root -> .app. First 100dvh won the cascade and came out
   short in an installed iOS PWA. Then plain 100% came out shorter still: a
   screenshot from an iPhone 16 Pro (402x874pt) showed the bar ending about
   66pt above the bottom, which is that device's TOP safe inset, so the chain
   was resolving to the viewport minus an inset somewhere along it.

   position:fixed with inset:0 resolves against the viewport itself, so there
   is no chain left to get this wrong. The bar is at the bottom because the
   bottom is where the box ends, not because four elements agreed on a
   number. The drawer and the sheet are already anchored this way. */
.app{position:fixed;inset:0;display:flex;flex-direction:column}
header{padding:calc(var(--safe-top) + 16px) 18px 14px;background:var(--ink);
  position:sticky;top:0;z-index:5;border-bottom:1px solid var(--line)}
header .top{display:flex;align-items:center;gap:12px;min-height:30px}
header .grow{flex:1;min-width:0}
.back{width:34px;height:34px;border-radius:50%;background:var(--surface);
  display:grid;place-items:center;font-size:17px;flex:none}
.back:active{background:var(--surface-2)}
/* The signed-in address rides on the eyebrow line, not beside the title.
   Centred against the whole stack it sat level with the title and the two
   collided: "WORKFLOWS" ran straight into "BRANDON@EMBARC...". The eyebrow
   row has room to spare and the title now gets the full width. */
.brow{display:flex;align-items:baseline;gap:10px;min-width:0}
.brow .eyebrow{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.who{font:800 10px/1 var(--body);text-transform:uppercase;letter-spacing:2px;
  color:var(--dimmer);margin-left:auto;flex:none;max-width:46vw;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
header .top .display{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.trail{display:flex;gap:6px;flex-wrap:wrap;margin-top:7px}
.trail span{font:800 9px/1 var(--body);text-transform:uppercase;letter-spacing:1.6px;
  color:var(--dimmer)}
.trail span+span::before{content:"/";margin-right:6px;opacity:.5}
/* Back is a labelled control, not a bare chevron: "< Photo review" says where
   it goes. That frees the top-left corner for the menu, which then stays
   reachable at every depth instead of only from the top level. */
.up{font:800 9px/1 var(--body);text-transform:uppercase;letter-spacing:1.6px;
  color:var(--accent);padding:5px 10px 5px 0;min-height:30px}
.trail{align-items:center;min-height:30px}

main{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:16px 16px 28px}
.app > nav{display:flex;border-top:1px solid var(--line);background:rgba(10,14,20,.96);
  backdrop-filter:blur(12px);padding:9px 0 calc(var(--safe-bot) + 9px)}
.app > nav button{flex:1;display:flex;flex-direction:column;align-items:center;gap:5px;
  font:800 9px/1 var(--body);text-transform:uppercase;letter-spacing:1.4px;
  color:var(--dimmer);padding:3px 0}
.app > nav button.on{color:var(--accent)}
.app > nav .ico{font-size:16px;line-height:1}

/* ---- surfaces ---- */
.card{background:var(--surface);border-radius:var(--r);padding:16px;margin-bottom:12px}
.card.tap:active{background:var(--surface-2)}
.row{display:flex;align-items:center;gap:10px}
.grow{flex:1;min-width:0}
.title{font:600 16px/1.3 var(--body)}
.title.sm{font-size:15px}
.sub{color:var(--dim);font-size:13.5px;margin-top:5px;line-height:1.45}
.micro{color:var(--dimmer);font-size:12px;margin-top:5px}
.dot{width:8px;height:8px;border-radius:50%;flex:none}
.chev{color:var(--dimmer);font-size:18px;flex:none}

.pill{font:800 9px/1 var(--body);text-transform:uppercase;letter-spacing:1.3px;
  border:1px solid;border-radius:999px;padding:4px 9px;white-space:nowrap}

/* ---- section heads ---- */
.sect{margin:22px 0 12px}
.sect:first-child{margin-top:4px}
.sect .display{font-size:clamp(18px,5vw,22px)}
.sect .lede{margin-top:5px;font-size:13px}

.fold{display:flex;align-items:center;gap:10px;width:100%;text-align:left;
  padding:14px 16px;background:var(--surface);border-radius:var(--r);margin-bottom:10px}
.fold .count{font:800 10px/1 var(--body);letter-spacing:1.5px;color:var(--dimmer)}
.fold .mark{font-size:13px;color:var(--dimmer);transition:transform .18s}
.fold[aria-expanded="true"] .mark{transform:rotate(90deg)}
.folded{padding-left:4px}

/* ---- attention ---- */
.alert{border-radius:var(--r);padding:15px 16px;margin-bottom:14px;
  background:rgba(248,81,73,.1);border:1px solid rgba(248,81,73,.35)}
.alert .eyebrow{color:var(--bad)}
.alert .title{margin-top:7px}

/* ---- buttons ---- */
.btn{display:block;width:100%;text-align:center;padding:15px;border-radius:999px;
  background:var(--accent);color:#fff;font:800 12px/1 var(--body);
  text-transform:uppercase;letter-spacing:1.6px;margin-top:14px}
.btn:active{filter:brightness(1.12)}
.btn[disabled]{background:var(--surface);color:var(--dimmer)}
.btn.ghost{background:var(--surface);color:var(--text)}

.card input{width:100%;margin-top:8px;background:var(--surface-2);color:var(--text);
  border:1px solid var(--line);border-radius:14px;padding:13px;font-size:16px}
.card input:focus{outline:0;border-color:var(--accent)}

pre.mono{font:12px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--text);
  background:var(--surface);border-radius:12px;padding:13px;overflow-x:auto;margin:0}

.empty{text-align:center;padding:34px 18px;color:var(--dim)}
.empty .display{font-size:18px;color:var(--dimmer);margin-bottom:8px}

/* ---- stat strip ---- */
.stats{display:flex;gap:10px;margin-bottom:14px}
.stat{flex:1;background:var(--surface);border-radius:var(--r);padding:14px 10px;text-align:center}
.stat .n{font:400 26px/1 var(--display);letter-spacing:-.02em}
.stat .eyebrow{margin-top:7px;display:block;font-size:9px;letter-spacing:1.6px}
.stat.bad .n{color:var(--bad)} .stat.ok .n{color:var(--ok)} .stat.accent .n{color:var(--accent)}

/* ---- auth ---- */
.auth{display:flex;flex-direction:column;justify-content:center;min-height:100%;
  padding:calc(var(--safe-top) + 30px) 24px calc(var(--safe-bot) + 30px);
  max-width:430px;margin:0 auto}
.auth img{width:150px;margin:0 auto 10px;display:block}
.auth .display{text-align:center;font-size:19px;margin-bottom:30px;color:var(--dim)}
.auth label{display:block;margin:16px 0 7px}
.auth input{width:100%;background:var(--surface);color:var(--text);
  border:1px solid var(--line);border-radius:14px;padding:14px;font-size:16px}
.auth input:focus{outline:0;border-color:var(--accent)}
.auth .msg{margin-top:16px;font-size:14px;text-align:center;line-height:1.5}
.auth .msg.err{color:var(--bad)}
.auth .msg.ok{color:var(--ok)}
.auth .link{display:block;text-align:center;color:var(--accent);margin-top:18px;
  font:800 10px/1 var(--body);text-transform:uppercase;letter-spacing:2px}

/* ===========================================================================
   Navigation drawer
   The menu takes three quarters of a phone screen and the page stays visible
   behind a scrim, so the operator can see what they are leaving and tap back
   to it. Capped at 360px: past that the width stops helping and starts
   looking like a mistake on a tablet.
   =========================================================================== */
.scrim{position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:20;opacity:0;
  pointer-events:none;transition:opacity .22s ease}
body.menu-open .scrim{opacity:1;pointer-events:auto}

.drawer{position:fixed;top:0;bottom:0;left:0;z-index:21;
  width:75%;max-width:360px;min-width:260px;
  background:#10151D;border-right:1px solid var(--line);
  display:flex;flex-direction:column;
  transform:translateX(-102%);transition:transform .24s cubic-bezier(.2,.8,.2,1);
  padding-top:var(--safe-top);padding-bottom:var(--safe-bot)}
body.menu-open .drawer{transform:translateX(0)}
@media (prefers-reduced-motion:reduce){
  .drawer,.scrim{transition:none}
}

.drawer-head{padding:18px 18px 14px;border-bottom:1px solid var(--line)}
.drawer-head .micro{margin-top:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.tree{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:10px 10px 16px}
.trow{display:flex;align-items:center;gap:11px;width:100%;text-align:left;
  min-height:46px;padding:9px 12px;border-radius:12px}
.trow:active{background:var(--surface-2)}
.trow.group{margin-top:8px}
.trow.group:first-child{margin-top:0}
.trow .mark{font-size:12px;color:var(--dimmer);transition:transform .18s;flex:none}
@media (prefers-reduced-motion:reduce){ .trow .mark{transition:none} }
.trow.group[aria-expanded="true"] .mark{transform:rotate(90deg)}
.glabel{display:block;font:800 10px/1.2 var(--body);text-transform:uppercase;
  letter-spacing:2.2px;color:var(--dim)}
.trow.group.holds .glabel{color:var(--text)}
.trow.group .micro{display:block;margin-top:3px;font-size:11px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.trow .count{font:800 9px/1 var(--body);letter-spacing:1.4px;color:var(--dimmer);flex:none}
.trow .badge{font:800 10px/1 var(--body);background:var(--bad);color:#fff;flex:none;
  min-width:19px;height:19px;border-radius:999px;display:grid;place-items:center;padding:0 5px}

/* Items sit one level in. One level, and only ever one: past two levels the
   indentation stops being readable. */
.trow.item{margin-left:16px;width:calc(100% - 16px)}
.ilabel{font:600 14.5px/1.3 var(--body);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.trow.item.on{background:rgba(45,169,229,.14)}
.trow.item.on .ilabel{color:var(--accent)}

.drawer-close{padding:14px;border-top:1px solid var(--line);
  font:800 10px/1 var(--body);text-transform:uppercase;letter-spacing:2px;color:var(--dim)}

.menu{width:34px;height:34px;border-radius:50%;background:var(--surface);
  display:grid;place-items:center;flex:none;font-size:15px}
.menu:active{background:var(--surface-2)}

/* On a wide screen the same tree stops being modal and simply stays open,
   which is what every desktop app of this kind does. */
@media (min-width:900px){
  .scrim{display:none}
  /* The drawer is rendered after the page so it overlays correctly on a
     phone; on a wide screen order:-1 puts it back on the left where a
     permanent sidebar belongs. */
  .drawer{position:static;transform:none;width:300px;max-width:300px;flex:none;order:-1}
  .drawer-close{display:none}
  .menu{display:none}
  body{display:block}
  #root{display:flex}
  /* Back into normal flow here: the shell is fixed on a phone so the bottom
     bar cannot miss the bottom, but on a wide screen it sits beside the
     permanent tree and a fixed box would cover it. */
  .app{position:static;flex:1;min-width:0}
  /* Scoped to the shell: the tree is a <nav> too, and a bare nav{display:none}
     collapsed it to zero height. */
  .app > nav{display:none}   /* the tree replaces the bottom bar */
  main{padding:22px 26px 34px;max-width:860px}
}

/* ---- the photo, and overruling the judge on it ---- */
/* It leads the screen: nobody can overrule a verdict they cannot see. */
.photo{border-radius:var(--r);overflow:hidden;background:var(--surface);
  margin-bottom:14px;display:grid;place-items:center}
/* Capped so the first rules are on screen with it: this is a screen for
   judging the photo against the rules, not a photo viewer. Tap to enlarge. */
.photo img{width:100%;height:auto;display:block;max-height:38vh;object-fit:contain;
  transition:max-height .2s ease}
.photo.big img{max-height:82vh}
.photo::after{content:"Tap to enlarge";position:absolute;right:10px;bottom:9px;
  font:800 9px/1 var(--body);text-transform:uppercase;letter-spacing:1.4px;
  color:var(--dim);background:rgba(10,14,20,.78);padding:6px 9px;border-radius:999px}
.photo.big::after{content:"Tap to shrink"}
.photo{position:relative}
@media (prefers-reduced-motion:reduce){ .photo img{transition:none} }

.deny{border:1px solid var(--bad);color:var(--bad);border-radius:999px;
  padding:7px 13px;font:800 9px/1 var(--body);text-transform:uppercase;
  letter-spacing:1.3px;flex:none;min-height:32px}
.deny:active{background:rgba(248,81,73,.16)}
.deny[disabled]{opacity:.5}
.card.denied{background:rgba(248,81,73,.07);box-shadow:inset 0 0 0 1px rgba(248,81,73,.3)}

/* The reason prompt. A deny with no reason is a decision the next person has
   to reverse-engineer. */
.scrim.show{opacity:1;pointer-events:auto}
.sheet{position:fixed;left:0;right:0;bottom:0;z-index:22;background:#10151D;
  border-top:1px solid var(--line);border-radius:22px 22px 0 0;
  padding:22px 20px calc(var(--safe-bot) + 20px);
  animation:rise .22s cubic-bezier(.2,.8,.2,1)}
@keyframes rise{from{transform:translateY(100%)}to{transform:translateY(0)}}
@media (prefers-reduced-motion:reduce){ .sheet{animation:none} }
.sheet input{width:100%;margin-top:14px;background:var(--surface-2);color:var(--text);
  border:1px solid var(--line);border-radius:14px;padding:14px;font-size:16px}
.sheet input:focus{outline:0;border-color:var(--accent)}
.sheet .micro{margin-top:10px}
.sheet .btn{margin-top:12px}

/* A traceback. Monospace and horizontally scrollable: wrapping a stack trace
   makes it unreadable, and on a phone the only alternative is a line that
   runs off the screen with no way to see the end of it. */
.trace{background:var(--surface-2);border-radius:var(--r);padding:14px;
  margin:0 0 12px;overflow-x:auto;-webkit-overflow-scrolling:touch;
  font:400 11px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace;
  color:var(--dim);white-space:pre;max-height:46vh;overflow-y:auto}
