@layer theme, base, components, utilities;

/* Teju's Note — component styles. Layout utilities come from Tailwind (CDN);
   colours are semantic tokens so light/dark mode is automatic. */

@font-face {
  font-family: "Jakarta";
  src: url("fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("fonts/caveat-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --tn-bg: #f5f1e8;
  --tn-surface: #fffdf8;
  --tn-surface-2: #faf6ee;
  --tn-ink: #1d2130;
  --tn-ink-2: #474b58;
  --tn-muted: #847e70;
  --tn-line: #e8e1d2;
  --tn-line-2: #d6ccb8;
  --tn-pen: #2b45c4;
  --tn-pen-hover: #2138a6;
  --tn-pen-soft: #e7ebfb;
  --tn-on-pen: #ffffff;
  --tn-marker: #ffd84a;
  --tn-marker-soft: #fff2bd;
  --tn-marker-stroke: #ffd84a;
  --tn-ok: #1b7f50;
  --tn-ok-soft: #dcf2e5;
  --tn-warn: #a86200;
  --tn-warn-soft: #fcefd2;
  --tn-bad: #c0392b;
  --tn-bad-soft: #fbe2dd;
  --tn-shadow: 60 45 20;
  --tn-rule: rgba(43, 69, 196, 0.10);
  --tn-margin: rgba(214, 70, 70, 0.28);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tn-bg: #121210;
    --tn-surface: #1b1a17;
    --tn-surface-2: #22211d;
    --tn-ink: #eeeae0;
    --tn-ink-2: #c4bfb3;
    --tn-muted: #8f8a7e;
    --tn-line: #2f2d28;
    --tn-line-2: #3d3a33;
    --tn-pen: #93a6ff;
    --tn-pen-hover: #aebcff;
    --tn-pen-soft: #252b47;
    --tn-on-pen: #0f1220;
    --tn-marker: #e6c13b;
    --tn-marker-soft: #3a3218;
    --tn-marker-stroke: rgba(230, 193, 59, 0.42);
    --tn-ok: #52c58f;
    --tn-ok-soft: #16302a;
    --tn-warn: #e5a444;
    --tn-warn-soft: #33270f;
    --tn-bad: #f07b6b;
    --tn-bad-soft: #3a1d19;
    --tn-shadow: 0 0 0;
    --tn-rule: rgba(147, 166, 255, 0.10);
    --tn-margin: rgba(240, 123, 107, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --tn-bg: #121210;
  --tn-surface: #1b1a17;
  --tn-surface-2: #22211d;
  --tn-ink: #eeeae0;
  --tn-ink-2: #c4bfb3;
  --tn-muted: #8f8a7e;
  --tn-line: #2f2d28;
  --tn-line-2: #3d3a33;
  --tn-pen: #93a6ff;
  --tn-pen-hover: #aebcff;
  --tn-pen-soft: #252b47;
  --tn-on-pen: #0f1220;
  --tn-marker: #e6c13b;
  --tn-marker-soft: #3a3218;
  --tn-marker-stroke: rgba(230, 193, 59, 0.42);
  --tn-ok: #52c58f;
  --tn-ok-soft: #16302a;
  --tn-warn: #e5a444;
  --tn-warn-soft: #33270f;
  --tn-bad: #f07b6b;
  --tn-bad-soft: #3a1d19;
  --tn-shadow: 0 0 0;
  --tn-rule: rgba(147, 166, 255, 0.10);
  --tn-margin: rgba(240, 123, 107, 0.25);
  color-scheme: dark;
}

/* ------------------------------------------------------------- base --- */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--tn-bg);
  color: var(--tn-ink);
  font-family: "Jakarta", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--tn-marker-soft); color: var(--tn-ink); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--tn-pen); outline-offset: 2px; border-radius: 10px; }

/* Faint paper grain behind everything */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgb(var(--tn-shadow) / 0.035) 1px, transparent 1px);
  background-size: 18px 18px;
}

@layer components {
.hand { font-family: "Caveat", "Comic Sans MS", cursive; }
.tnum { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ brand --- */
.wordmark {
  font-family: "Caveat", cursive;
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.marker {
  background: linear-gradient(100deg, transparent 0 2%, var(--tn-marker-stroke) 3% 96%, transparent 97%) no-repeat;
  background-size: 100% 42%;
  background-position: 0 88%;
  padding: 0 0.12em;
  border-radius: 2px;
}
.marker-full {
  background: linear-gradient(100deg, transparent 0 1%, var(--tn-marker-soft) 2% 97%, transparent 98%);
  padding: 0 0.2em;
  border-radius: 3px;
}

/* ------------------------------------------------------------ chrome --- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--tn-bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--tn-line) 70%, transparent);
}
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  color: var(--tn-ink-2);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--tn-surface); border-color: var(--tn-line); color: var(--tn-ink); }
.worker-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--tn-muted); display: inline-block; }
.worker-dot.on { background: var(--tn-ok); box-shadow: 0 0 0 3px var(--tn-ok-soft); }

.crumbs { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.crumbs::-webkit-scrollbar { display: none; }
.crumbs.fade-l { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28px); mask-image: linear-gradient(90deg, transparent 0, #000 28px); }
.crumbs a { padding: 4px 8px; border-radius: 8px; color: var(--tn-muted); font-size: 13px; font-weight: 500; }
.crumbs a:hover { background: var(--tn-surface); color: var(--tn-ink); }
.crumbs a[aria-current] { color: var(--tn-ink); font-weight: 600; }
.crumbs svg { color: var(--tn-line-2); flex: none; }

/* ----------------------------------------------------------- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 12px;
  font-weight: 600; font-size: 14px; letter-spacing: .1px;
  border: 1px solid var(--tn-line); background: var(--tn-surface); color: var(--tn-ink);
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s, color .15s;
  box-shadow: 0 1px 0 rgb(var(--tn-shadow) / .04);
}
.btn:hover { border-color: var(--tn-line-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--tn-pen); border-color: var(--tn-pen); color: var(--tn-on-pen); box-shadow: 0 6px 16px -8px var(--tn-pen); }
.btn-primary:hover { background: var(--tn-pen-hover); border-color: var(--tn-pen-hover); }
.btn-soft { background: var(--tn-pen-soft); border-color: transparent; color: var(--tn-pen); }
.btn-soft:hover { border-color: color-mix(in srgb, var(--tn-pen) 30%, transparent); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--tn-ink-2); }
.btn-ghost:hover { background: var(--tn-surface); border-color: var(--tn-line); }
.btn-danger { background: var(--tn-bad); border-color: var(--tn-bad); color: #fff; }
.btn-sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn-lg { height: 50px; padding: 0 22px; border-radius: 14px; font-size: 15px; }
.btn .spin { display: none; }
.btn.is-busy .spin { display: inline-block; }
.spin { width: 16px; height: 16px; border-radius: 99px; border: 2px solid currentColor; border-right-color: transparent; animation: tn-spin .7s linear infinite; }
@keyframes tn-spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- cards --- */
.card {
  background: var(--tn-surface);
  border: 1px solid var(--tn-line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgb(var(--tn-shadow) / .04), 0 8px 24px -18px rgb(var(--tn-shadow) / .25);
}
.card-inset { background: var(--tn-surface-2); border: 1px solid var(--tn-line); border-radius: 14px; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tn-muted); }

/* Lined notebook paper */
.lined {
  background-color: var(--tn-surface);
  background-image:
    linear-gradient(90deg, transparent 38px, var(--tn-margin) 38px, var(--tn-margin) 39.5px, transparent 39.5px),
    repeating-linear-gradient(transparent 0 27px, var(--tn-rule) 27px 28px);
  background-position: 0 0, 0 14px;
}

/* ------------------------------------------------------ folder cards --- */
.folder-card {
  --c: #3f6fe0;
  position: relative; display: block;
  padding-top: 11px;
  transition: transform .18s cubic-bezier(.2,.8,.2,1);
  -webkit-user-select: none; user-select: none;
}
.folder-card:hover { transform: translateY(-2px); }
.folder-card:active { transform: translateY(0) scale(.99); }
.folder-card .tab {
  position: absolute; top: 0; left: 14px;
  width: 42%; height: 18px;
  background: color-mix(in srgb, var(--c) 78%, var(--tn-surface));
  border-radius: 10px 12px 0 0;
  clip-path: polygon(0 0, 82% 0, 100% 100%, 0 100%);
}
.folder-card .body {
  position: relative;
  min-height: 118px;
  border-radius: 6px 18px 18px 18px;
  padding: 16px 16px 14px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--c) 16%, var(--tn-surface)) 0%, color-mix(in srgb, var(--c) 9%, var(--tn-surface)) 100%);
  border: 1px solid color-mix(in srgb, var(--c) 26%, var(--tn-line));
  box-shadow: 0 1px 0 rgb(255 255 255 / .5) inset, 0 10px 22px -18px color-mix(in srgb, var(--c) 70%, #000);
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
}
.folder-card .code {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: color-mix(in srgb, var(--c) 80%, var(--tn-ink));
  background: color-mix(in srgb, var(--c) 16%, transparent);
  padding: 2px 7px; border-radius: 6px;
}
.folder-card .name { font-weight: 700; font-size: 15.5px; line-height: 1.25; color: var(--tn-ink); overflow-wrap: anywhere; }
.folder-card .meta { font-size: 12.5px; color: var(--tn-ink-2); opacity: .85; }
.folder-swatch { width: 12px; height: 12px; border-radius: 4px; background: var(--c); flex: none; }

/* -------------------------------------------------------- note rows --- */
.note-row {
  --c: #3f6fe0;
  position: relative; display: flex; gap: 14px; align-items: center;
  padding: 14px 14px 14px 18px;
  background: var(--tn-surface);
  border: 1px solid var(--tn-line);
  border-radius: 16px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  overflow: hidden;
}
.note-row::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--c);
}
.note-row:hover { border-color: var(--tn-line-2); box-shadow: 0 8px 22px -16px rgb(var(--tn-shadow) / .4); }
.note-row > .flex-none { align-self: flex-start; }
.note-row .title { font-weight: 650; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.note-row .meta { font-size: 12.5px; color: var(--tn-muted); }
.src-icons { display: inline-flex; gap: 8px; color: var(--tn-muted); font-size: 12px; align-items: center; }
.src-icons span { display: inline-flex; align-items: center; gap: 3px; }
.src-icons .on { color: var(--tn-ink-2); }

/* ------------------------------------------------------------- pills --- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: 99px;
  font-size: 12px; font-weight: 650; white-space: nowrap;
  background: var(--tn-surface-2); color: var(--tn-ink-2); border: 1px solid var(--tn-line);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; opacity: .9; }
.pill-draft { color: var(--tn-muted); }
.pill-queued { color: var(--tn-warn); background: var(--tn-warn-soft); border-color: transparent; }
.pill-processing { color: var(--tn-pen); background: var(--tn-pen-soft); border-color: transparent; }
.pill-processing::before { animation: tn-pulse 1.2s ease-in-out infinite; }
.pill-ready { color: var(--tn-ok); background: var(--tn-ok-soft); border-color: transparent; }
.pill-failed { color: var(--tn-bad); background: var(--tn-bad-soft); border-color: transparent; }
@keyframes tn-pulse { 50% { opacity: .25; } }

/* ------------------------------------------------------------- forms --- */
.field { display: block; }
.field > .label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 6px; color: var(--tn-ink); }
.field > .help { display: block; font-size: 12.5px; color: var(--tn-muted); margin-top: 6px; }
.input, .textarea, .select {
  width: 100%; box-sizing: border-box;
  background: var(--tn-surface); color: var(--tn-ink);
  border: 1px solid var(--tn-line-2); border-radius: 12px;
  padding: 11px 13px; font: inherit; font-size: 16px; /* 16px stops iOS zoom */
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--tn-muted); opacity: .8; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--tn-pen); box-shadow: 0 0 0 4px var(--tn-pen-soft); }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23847e70' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches label { position: relative; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; pointer-events: none; }
.swatches span {
  display: block; width: 32px; height: 32px; border-radius: 10px; background: var(--c);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .08);
  transition: transform .12s;
}
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--tn-surface), 0 0 0 4px var(--c); transform: scale(1.04); }
.swatches input:focus-visible + span { outline: 2px solid var(--tn-pen); outline-offset: 4px; }

.alert { border-radius: 12px; padding: 11px 13px; font-size: 14px; border: 1px solid transparent; }
.alert-bad { background: var(--tn-bad-soft); color: var(--tn-bad); }
.alert-ok { background: var(--tn-ok-soft); color: var(--tn-ok); }
.alert-warn { background: var(--tn-warn-soft); color: var(--tn-warn); }
.alert-info { background: var(--tn-pen-soft); color: var(--tn-pen); }

/* ------------------------------------------- sheets (native <dialog>) --- */
dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; max-width: 100%; width: 100%;
  max-height: 92dvh;
  background: var(--tn-surface); color: var(--tn-ink);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -20px 60px -20px rgb(0 0 0 / .35);
  overflow: hidden;
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: tn-sheet-up .28s cubic-bezier(.2,.9,.25,1); }
dialog.sheet::backdrop { background: rgb(18 16 12 / .42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: tn-fade .2s ease; }
dialog.sheet .sheet-head { padding: 10px 20px 12px; border-bottom: 1px solid var(--tn-line); position: relative; }
dialog.sheet .sheet-head::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 9px; background: var(--tn-line-2); margin: 0 auto 12px; }
dialog.sheet .sheet-body { padding: 18px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
dialog.sheet .sheet-foot { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--tn-line); display: flex; gap: 10px; justify-content: flex-end; background: var(--tn-surface-2); }
@media (min-width: 640px) {
  dialog.sheet { margin: auto; width: min(560px, calc(100% - 32px)); border-radius: 22px; max-height: 86dvh; box-shadow: 0 30px 80px -30px rgb(0 0 0 / .45); }
  dialog.sheet[open] { animation: tn-pop .22s cubic-bezier(.2,.9,.25,1); }
  dialog.sheet .sheet-head::before { display: none; }
  dialog.sheet .sheet-head { padding-top: 18px; }
}
@keyframes tn-sheet-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes tn-pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tn-fade { from { opacity: 0; } }

/* Action menu items inside sheets */
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 13px 12px; border-radius: 12px; border: 0; background: transparent;
  text-align: left; cursor: pointer; font-size: 15px; font-weight: 550;
}
.menu-item:hover { background: var(--tn-surface-2); }
.menu-item .mi-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--tn-surface-2); border: 1px solid var(--tn-line); color: var(--tn-ink-2); flex: none; }
.menu-item.danger { color: var(--tn-bad); }
.menu-item.danger .mi-icon { color: var(--tn-bad); background: var(--tn-bad-soft); border-color: transparent; }
.menu-item small { display: block; font-size: 12.5px; color: var(--tn-muted); font-weight: 450; }

/* Folder picker tree */
.tree-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 10px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; text-align: left; font-size: 14.5px; }
.tree-item:hover:not([disabled]) { background: var(--tn-surface-2); }
.tree-item[aria-selected="true"] { background: var(--tn-pen-soft); color: var(--tn-pen); font-weight: 650; }
.tree-item[disabled] { opacity: .38; cursor: not-allowed; }

/* ------------------------------------------------------------- toast --- */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(18px + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 8px; z-index: 80; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; max-width: 440px;
  background: var(--tn-ink); color: var(--tn-bg);
  padding: 11px 16px; border-radius: 14px; font-size: 14px; font-weight: 550;
  box-shadow: 0 16px 40px -14px rgb(0 0 0 / .5);
  display: flex; gap: 10px; align-items: center;
  animation: tn-pop .2s ease;
}
.toast.bad { background: var(--tn-bad); color: #fff; }

/* --------------------------------------------------------------- FAB --- */
.fab {
  position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 40;
  width: 58px; height: 58px; border-radius: 20px; border: 0;
  background: var(--tn-pen); color: var(--tn-on-pen);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 14px 30px -10px var(--tn-pen), 0 2px 6px rgb(0 0 0 / .15);
  transition: transform .15s;
}
.fab:active { transform: scale(.94); }
@media (min-width: 768px) { .fab { display: none; } }

/* ------------------------------------------------------- uploads etc --- */
.dropzone {
  border: 1.5px dashed var(--tn-line-2); border-radius: 16px;
  background: var(--tn-surface-2);
  transition: border-color .15s, background .15s;
}
.dropzone.is-over { border-color: var(--tn-pen); background: var(--tn-pen-soft); }
.file-row { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 10px; border-radius: 12px; background: var(--tn-surface); border: 1px solid var(--tn-line); }
.file-row .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
.file-row .fname { font-weight: 600; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.file-badge { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; flex: none; text-transform: uppercase; }
.file-badge.recording { background: color-mix(in srgb, #d6589a 16%, var(--tn-surface)); color: #b8407e; }
.file-badge.slides { background: color-mix(in srgb, #ea7a2e 16%, var(--tn-surface)); color: #c75f17; }
.file-badge.document { background: color-mix(in srgb, #3f6fe0 14%, var(--tn-surface)); color: #2f5bc6; }
:root[data-theme="dark"] .file-badge.recording { color: #f08cbf; }
:root[data-theme="dark"] .file-badge.slides { color: #f5a36a; }
:root[data-theme="dark"] .file-badge.document { color: #93a6ff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .file-badge.recording { color: #f08cbf; }
  :root:not([data-theme="light"]) .file-badge.slides { color: #f5a36a; }
  :root:not([data-theme="light"]) .file-badge.document { color: #93a6ff; }
}
.bar { height: 6px; border-radius: 99px; background: var(--tn-line); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--tn-pen); transition: width .3s ease; }
.bar.ok > i { background: var(--tn-ok); }
.bar.bad > i { background: var(--tn-bad); }
.bar.indeterminate > i { width: 35% !important; animation: tn-indet 1.3s ease-in-out infinite; }
@keyframes tn-indet { 0% { transform: translateX(-110%); } 100% { transform: translateX(300%); } }
audio { width: 100%; height: 40px; }

/* Pipeline stepper */
.steps { display: grid; gap: 2px; }
.step { display: flex; align-items: center; gap: 12px; padding: 7px 0; font-size: 14px; color: var(--tn-muted); }
.step .dot { width: 22px; height: 22px; border-radius: 99px; border: 1.5px solid var(--tn-line-2); display: grid; place-items: center; flex: none; background: var(--tn-surface); }
.step.done { color: var(--tn-ink-2); }
.step.done .dot { background: var(--tn-ok); border-color: var(--tn-ok); color: #fff; }
.step.active { color: var(--tn-ink); font-weight: 650; }
.step.active .dot { border-color: var(--tn-pen); box-shadow: 0 0 0 4px var(--tn-pen-soft); }
.step.active .dot::after { content: ""; width: 8px; height: 8px; border-radius: 99px; background: var(--tn-pen); animation: tn-pulse 1.2s ease-in-out infinite; }
.step.failed .dot { background: var(--tn-bad); border-color: var(--tn-bad); color: #fff; }

.log { font-size: 12.5px; line-height: 1.55; max-height: 220px; overflow-y: auto; }
.log .ev { display: grid; grid-template-columns: 64px 1fr; gap: 8px; padding: 3px 0; }
.log .ev time { color: var(--tn-muted); font-variant-numeric: tabular-nums; }
.log .ev.warn { color: var(--tn-warn); }
.log .ev.error { color: var(--tn-bad); }
.log .ev.success { color: var(--tn-ok); font-weight: 600; }

/* Context inheritance list */
.ctx-row { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 10px 0; border-bottom: 1px dashed var(--tn-line); }
.ctx-row:last-child { border-bottom: 0; }
.ctx-row dt { font-size: 12px; font-weight: 650; color: var(--tn-muted); text-transform: uppercase; letter-spacing: .06em; }
.ctx-row dd { margin: 0; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ctx-from { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--tn-muted); font-weight: 500; }
.ctx-empty { color: var(--tn-muted); font-style: italic; }

/* Collapsible cards */
details.fold > summary { list-style: none; cursor: pointer; -webkit-user-select: none; user-select: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary .chev { transition: transform .2s; color: var(--tn-muted); }
details.fold[open] > summary .chev { transform: rotate(180deg); }

/* Empty states */
.empty { text-align: center; padding: 36px 20px; }
.empty .hand { font-size: 26px; color: var(--tn-ink-2); line-height: 1.1; }

/* Code/token display */
.token { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; background: var(--tn-surface-2); border: 1px solid var(--tn-line); border-radius: 10px; padding: 10px 12px; }
} /* end components */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
