/* ── Shell ─────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100%; }
.topbar {
  height: 52px; flex-shrink: 0; display: flex; align-items: center;
  justify-content: space-between; padding: 0 var(--s5);
  background: var(--header); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.lockup { display: flex; align-items: center; gap: var(--s3); text-decoration: none; min-width: 0; }
.lockup .mark-ii { height: 14px; width: auto; opacity: .92; }
.lockup .mark-cl { height: 13px; width: auto; }
.lockup-bar { width: 1px; height: 18px; background: var(--faint); flex-shrink: 0; }
.lockup-sub { font-size: 9px; letter-spacing: .22em; color: var(--muted); }
.backbtn {
  display: flex; align-items: center; gap: 5px; padding: 7px 11px 7px 8px;
  border: 1px solid var(--border); border-radius: var(--r-pill); color: var(--muted);
  min-height: 34px; transition: color .12s, border-color .12s;
}
.backbtn:hover { color: var(--bone); border-color: var(--muted); }
.backbtn .mono { font-size: 9px; letter-spacing: .14em; }
.backbtn[hidden] { display: none; }
/* the back lives at the top of the sidebar where the sidebar shows; the
   top bar keeps it for a phone */
@media (min-width: 1024px) { .topbar .backbtn { display: none; } }
.topbar-right { display: flex; align-items: center; gap: var(--s3); flex-shrink: 0; }
@media (max-width: 640px) {
  .topbar { padding: 0 var(--s4); gap: var(--s2); }
  .lockup-sub, .lockup .mark-cl, .lockup-bar { display: none; }
  .backbtn .mono { display: none; }
  .backbtn { padding: 7px 9px; }
}
.tag {
  font-size: 9px; letter-spacing: .16em; padding: 3px 9px;
  border-radius: var(--r-pill); border: 1px solid var(--border); color: var(--muted);
  white-space: nowrap;
}
.tag.live { color: var(--acid); border-color: rgba(166, 255, 7, .25); }
.tag.err { color: var(--danger); border-color: rgba(201, 111, 95, .35); }
.avatar {
  width: 26px; height: 26px; border-radius: var(--r-pill);
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--bone);
}
.shell { display: flex; flex: 1; min-height: 0; overflow: hidden; position: relative; }

/* a 56px icon rail that expands over the canvas on hover - the canvas never
   shifts, and nothing acid separates the nav from the work */
.sidebar { width: 56px; flex-shrink: 0; position: relative; z-index: 30; }
.nav-panel {
  position: absolute; top: 0; left: 0; bottom: 0; width: 56px;
  background: var(--header); display: flex; flex-direction: column;
  padding: var(--s4) 0; overflow: hidden; white-space: nowrap;
  transition: width .18s var(--ease), box-shadow .18s;
}
.sidebar:hover .nav-panel, .sidebar:focus-within .nav-panel {
  width: 224px; box-shadow: 18px 0 40px rgba(0, 0, 0, .45);
  border-right: 1px solid var(--border);
}
.nav-label { opacity: 0; transition: opacity .14s .04s; }
.sidebar:hover .nav-label, .sidebar:focus-within .nav-label { opacity: 1; }
.nav-sect {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s3) var(--s4) var(--s2); min-height: 26px;
  font-size: 9px; letter-spacing: .2em; color: var(--muted);
}
.nav-item {
  display: flex; align-items: center; gap: var(--s3); padding: 9px 18px;
  width: 100%; text-align: left; font-size: 12.5px; color: var(--muted);
  transition: color .12s, background .12s;
}
.nav-item svg { flex-shrink: 0; }
.nav-item.active { color: var(--bone); background: var(--surface); }
.nav-item[hidden], .nav-sect[hidden] { display: none; }
.nav-back { color: var(--bone); border-bottom: 1px solid var(--border); margin-bottom: 4px; padding-bottom: 12px; }
.nav-back .nav-label b { font-weight: 400; color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.nav-foot { margin-top: auto; padding: var(--s4) var(--s4) 0; }
.nav-foot p { font-size: 9px; letter-spacing: .14em; color: var(--faint); line-height: 1.9; }
.main { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; }
@media (max-width: 1023px) { .sidebar { display: none; } }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; border-radius: var(--r-inner); min-height: 36px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .02em;
  border: 1px solid var(--border); color: var(--muted);
  transition: background .12s, color .12s, border-color .12s, transform .08s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--bone); color: #141312; border-color: var(--bone); }
.btn-primary:hover { background: #fff; color: #141312; }
.btn-ghost { border-color: transparent; }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); background: none; }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.btn:disabled:hover { background: none; color: var(--muted); }
.btn-sm { padding: 6px 10px; min-height: 30px; font-size: 10px; }
.btn-lg { padding: 12px 20px; min-height: 46px; font-size: 12px; }

/* ── Forms ─────────────────────────────────────────── */
.inp, .sel, .txt {
  width: 100%; border-radius: var(--r-inner); padding: 9px 11px; font-size: 13px;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  outline: none; transition: border-color .12s; min-height: 38px;
}
.inp:focus, .sel:focus, .txt:focus { border-color: var(--bone); }
.inp::placeholder, .txt::placeholder { color: var(--faint); }
.sel { appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23867e76' stroke-width='3'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; }
.txt { resize: vertical; line-height: 1.55; min-height: 70px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .16em; color: var(--muted); }
.field-note { font-size: 11.5px; color: var(--faint); line-height: 1.5; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } }
.saved-tick { font-family: var(--font-mono); font-size: 9px; letter-spacing: .14em; color: var(--ok); opacity: 0; transition: opacity .3s; }
.saved-tick.show { opacity: 1; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 6px 12px; border-radius: var(--r-pill); border: 1px solid var(--border);
  background: var(--surface2); font-size: 11.5px; color: var(--muted);
  transition: all .12s; min-height: 30px;
}
.chip:hover { border-color: var(--muted); color: var(--text); }
.chip.on { background: var(--bone); border-color: var(--bone); color: #141312; font-weight: 500; }
.chip.filter { background: transparent; }
.chip.filter.on { background: var(--surface2); border-color: var(--bone); color: var(--bone); }

/* stepper */
.stepper { display: flex; align-items: center; border: 1px solid var(--border); border-radius: var(--r-inner); width: fit-content; overflow: hidden; }
.stepper button { width: 36px; height: 34px; color: var(--muted); font-size: 15px; }
.stepper button:hover { background: var(--surface2); color: var(--bone); }
.stepper span { min-width: 46px; text-align: center; font-family: var(--font-mono); font-size: 13px; color: var(--bone); border-left: 1px solid var(--border); border-right: 1px solid var(--border); height: 34px; line-height: 34px; }

/* ── Badges & status ───────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: .12em;
  padding: 3px 8px; border-radius: var(--r-pill); border: 1px solid var(--border);
  color: var(--muted); white-space: nowrap;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.b-empty { color: var(--faint); }
.badge.b-ready { color: var(--text); }
.badge.b-work { color: var(--acid); border-color: rgba(166, 255, 7, .25); }
.badge.b-review { color: var(--warn); border-color: rgba(215, 164, 91, .3); }
.badge.b-done { color: var(--ok); border-color: rgba(143, 191, 127, .3); }
.badge.b-frozen { color: var(--danger); border-color: rgba(201, 111, 95, .35); }
.badge.b-work .dot { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ── Cards & surfaces ──────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-outer); box-shadow: var(--raise);
}
.sect { padding: var(--s5); border-bottom: 1px solid var(--border); }
.sect:last-child { border-bottom: 0; }
.sect-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s4); }
.sect-h h5 { font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; color: var(--muted); font-weight: 400; }
.sect-h .n { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }

/* ── Toast ─────────────────────────────────────────── */
#toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%) translateY(10px);
  background: var(--surface2); border: 1px solid var(--border); color: var(--bone);
  font-size: 10.5px; letter-spacing: .06em; padding: 10px 16px; border-radius: var(--r-inner);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 90;
  max-width: min(90vw, 480px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Offline banner ────────────────────────────────── */
.offline {
  flex-shrink: 0; position: sticky; top: 0; z-index: 30; background: var(--surface2);
  border-bottom: 1px solid var(--danger); color: var(--danger);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
  padding: 8px 16px; text-align: center;
}

/* ── Skeletons (honest: labelled, state-worded) ────── */
.skel {
  position: relative; border-radius: var(--r-inner); background: var(--surface2);
  border: 1px solid var(--border); overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.skel .lbl { font-family: var(--font-mono); font-size: 9px; letter-spacing: .14em; color: var(--muted); }
.skel .st { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .18em; color: var(--faint); }
.skel.generating::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(245, 237, 230, .05) 50%, transparent 70%);
  animation: shimmer 1.6s infinite;
}
.skel.generating .st { color: var(--acid); }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ── Image reveal ──────────────────────────────────── */
.reveal { animation: reveal .45s var(--ease); }
@keyframes reveal { from { opacity: 0; filter: blur(8px); transform: scale(.97); } to { opacity: 1; filter: none; transform: none; } }

/* ── Overlay sheets ────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(15, 14, 14, .72);
  display: flex; align-items: center; justify-content: center; padding: var(--s5);
  animation: fadein .16s var(--ease);
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-outer);
  box-shadow: var(--raise); width: 100%; max-width: 560px; max-height: 90dvh;
  display: flex; flex-direction: column; overflow: hidden;
  animation: sheetin .2s var(--ease);
}
.sheet.sheet-wide { max-width: 980px; }
@keyframes sheetin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sheet-body { padding: var(--s5); overflow-y: auto; }
.sheet-foot { padding: var(--s4) var(--s5); border-top: 1px solid var(--border); display: flex; gap: var(--s2); justify-content: flex-end; flex-shrink: 0; }
@media (max-width: 640px) {
  .overlay { padding: 0; align-items: flex-end; }
  .sheet { max-width: none; border-radius: var(--r-outer) var(--r-outer) 0 0; max-height: 94dvh; }
  .sheet-foot { padding-bottom: calc(var(--s4) + var(--safe-b)); }
}

/* ── Action bar (mobile primary action, always in reach) ── */
.actionbar {
  position: sticky; bottom: 0; z-index: 25;
  background: linear-gradient(transparent, var(--bg) 30%);
  padding: var(--s4) var(--s5) calc(var(--s4) + var(--safe-b));
  display: flex; gap: var(--s2); align-items: center;
}
.actionbar .btn { flex: 1; }
.actionbar .est { font-family: var(--font-mono); font-size: 9px; letter-spacing: .1em; color: var(--faint); }

/* the studio is paused by the operator: calm, not an error */
.tag.paused { color: var(--muted); border-color: var(--line); }
.offline.paused { background: var(--panel, #161616); color: var(--muted); }
