/* ==========================================================================
   Upstow UI  ·  "harbour manifest" design language
   Light = bone paper + ink + international orange
   Dark  = harbour night + chalk + signal orange
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --font-display: "Bricolage Grotesque", "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  --bg: #F3EFE6;
  --bg-2: #EAE4D6;
  --card: #FBF9F4;
  --card-2: #F6F2EA;
  --ink: #15171B;
  --ink-2: #4E535D;
  --ink-3: #868B96;
  --line: #D9D2C3;
  --line-2: #C3B9A4;
  --accent: #FF4D00;
  --accent-soft: rgb(255 77 0 / .10);
  --accent-ink: #FFFFFF;
  --accent-2: #F2B800;
  --ok: #178F52;
  --warn: #C98400;
  --bad: #D3263B;
  --info: #2457D6;
  --plate: #15171B;          /* dark plate behind yellow text (chips, key ticket, step numbers) */
  --shadow: 0 1px 2px rgb(21 23 27 / .05), 0 14px 36px -16px rgb(21 23 27 / .22);
  --shadow-lg: 0 2px 4px rgb(21 23 27 / .06), 0 30px 60px -24px rgb(21 23 27 / .35);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 5px;
  --wrap: 1180px;
  --topbar-h: 68px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-pop: cubic-bezier(.2, 1.4, .4, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0B0E13;
  --bg-2: #0F131A;
  --card: #151A23;
  --card-2: #1A202B;
  --ink: #ECE7DC;
  --ink-2: #A5ABB7;
  --ink-3: #6E7582;
  --line: #242B37;
  --line-2: #323B4A;
  --accent: #FF5C1A;
  --accent-soft: rgb(255 92 26 / .14);
  --accent-ink: #14100D;
  --accent-2: #FFD23F;
  --ok: #33C47A;
  --warn: #F0B429;
  --bad: #FF5A6E;
  --info: #6C9BFF;
  --plate: #05070A;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 14px 36px -16px rgb(0 0 0 / .7);
  --shadow-lg: 0 2px 4px rgb(0 0 0 / .5), 0 30px 60px -24px rgb(0 0 0 / .8);
  color-scheme: dark;
}

/* Theme-scoped assets */
.only-light { display: inline-block; }
.only-dark { display: none; }
[data-theme="dark"] .only-light { display: none; }
[data-theme="dark"] .only-dark { display: inline-block; }

/* ---------- reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(800px 500px at -10% 20%, rgb(242 184 0 / .08), transparent 60%);
  background-attachment: fixed;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
img, svg { max-width: 100%; display: block; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sprite { display: none; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, dl, dd, dt, ul, ol { margin: 0; }
code, kbd, pre, .mono { font-family: var(--font-mono); }
code { font-size: .92em; background: var(--bg-2); padding: .1em .4em; border-radius: var(--radius-xs); }
kbd {
  font-size: .75em; padding: .1em .45em; border-radius: var(--radius-xs);
  border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--card);
}
::selection { background: var(--accent-2); color: #15171B; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: .5rem 1rem; z-index: 100; border-radius: var(--radius-sm); }
.skip:focus { left: 8px; }

/* ---------- layout ---------- */
.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
@media (min-width: 720px) { .wrap { width: min(100% - 3rem, var(--wrap)); } }
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section + .section { padding-top: 0; }
.section[hidden] + .section { padding-top: clamp(2.5rem, 6vw, 4.5rem); } /* signed out, the start page skips its session-only sections */
.section__head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.section__head--stack { align-items: start; }

/* ---------- type ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.9rem, 8.2vw, 6.6rem);
  line-height: .92;
  letter-spacing: -.035em;
  font-variation-settings: "opsz" 96;
  text-wrap: balance;
}
.display em {
  font-style: normal;
  color: var(--accent);
  position: relative;
  display: inline-block;
}
.display em::after {
  content: "";
  position: absolute; left: .02em; right: .02em; bottom: .04em;
  height: .08em; background: var(--accent-2);
  transform: skewX(-12deg);
  z-index: -1;
}
.h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem, 4.5vw, 3.2rem); line-height: 1; letter-spacing: -.03em; }
.h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.4rem, 2.6vw, 1.9rem); line-height: 1.1; letter-spacing: -.02em; }
.h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; line-height: 1.2; letter-spacing: -.01em; }
.lede { font-size: clamp(1.05rem, 1.5vw, 1.25rem); color: var(--ink-2); max-width: 52ch; margin-top: 1.4rem; text-wrap: pretty; }
.lede--sm { font-size: 1.02rem; margin-top: .6rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--font-mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--ink-2); margin-bottom: 1rem;
}
.eyebrow__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 2.2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft); } 50% { box-shadow: 0 0 0 8px transparent; } }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.linkish { color: var(--accent); font-weight: 500; display: inline-flex; align-items: center; gap: .3rem; border-bottom: 1px solid transparent; }
.linkish:hover { border-bottom-color: currentColor; }
.ico { width: 1em; height: 1em; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .62rem 1.05rem; border-radius: 999px;
  font-weight: 600; font-size: .95rem; line-height: 1; white-space: nowrap;
  border: 1.5px solid transparent;
  transition: transform .15s var(--ease), background .2s, border-color .2s, color .2s, box-shadow .2s;
  user-select: none;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: translateY(1px) scale(.985); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn--primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px -10px var(--accent); }
.btn--primary:hover { filter: brightness(1.06); box-shadow: 0 12px 26px -10px var(--accent); }
.btn--outline { border-color: var(--line-2); color: var(--ink); background: transparent; }
.btn--outline:hover { border-color: var(--ink); }
.btn--ghost { color: var(--ink-2); }
.btn--ghost:hover { background: var(--bg-2); color: var(--ink); }
.btn--danger { background: var(--bad); color: #fff; }
.btn--lg { padding: .85rem 1.4rem; font-size: 1.02rem; }
.btn--sm { padding: .42rem .8rem; font-size: .85rem; }
.btn--icon { padding: .55rem; border-radius: 50%; position: relative; }
.btn--icon svg { width: 20px; height: 20px; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.topbar__row { display: flex; align-items: center; gap: 1.5rem; height: var(--topbar-h); }
.brand { display: flex; align-items: center; gap: .65rem; margin-right: auto; }
.brand__mark { width: 36px; height: 36px; border-radius: 9px; }
.brand__name { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; letter-spacing: -.03em; }
.nav { display: flex; gap: .25rem; }
.nav a {
  padding: .5rem .85rem; border-radius: 999px; font-weight: 500; color: var(--ink-2);
  transition: background .2s, color .2s;
}
.nav a:hover { color: var(--ink); background: var(--bg-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.topbar__actions { display: flex; align-items: center; gap: .25rem; }
.nav-burger { display: none; }
.account__email {
  font-family: var(--font-mono); font-size: .8rem; color: var(--ink-2);
  max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: .25rem;
}

@media (max-width: 760px) {
  .nav-burger { display: inline-flex; }
  .account__email { display: none; }
  .nav {
    position: absolute; left: 0; right: 0; top: var(--topbar-h);
    flex-direction: column; padding: .75rem 1rem 1rem;
    background: var(--bg); border-bottom: 1px solid var(--line);
    transform: translateY(-8px); opacity: 0; pointer-events: none;
    transition: transform .2s var(--ease), opacity .2s;
    box-shadow: var(--shadow);
  }
  .nav.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .nav a { padding: .8rem 1rem; font-size: 1.05rem; }
}

/* ---------- hero ---------- */
.hero { position: relative; padding-block: clamp(2.5rem, 7vw, 5.5rem) 1rem; overflow: hidden; }
/* the crate field covers the home view down to the separator above "Getting started" */
.crate-field { position: relative; overflow: hidden; }
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.crate-field > :not(.hero__canvas) { position: relative; z-index: 1; }
.hero__grid { position: relative; display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center; }
.hero__copy { animation: rise .7s var(--ease) both; }
.hero__art { animation: rise .7s .12s var(--ease) both; }
.hero__art img { width: 100%; height: auto; filter: drop-shadow(0 30px 40px rgb(0 0 0 / .18)); }
.hero__cta { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 2rem; }
.hero__note { margin-top: .9rem; font-size: .92rem; color: var(--ink-2); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero__art { order: -1; max-width: 360px; margin-inline: auto; }
}

/* stats */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  margin-top: clamp(2rem, 5vw, 3.5rem);
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  position: relative;
}
.stat { background: var(--card); padding: 1.1rem 1.3rem; display: grid; gap: .15rem; }
.stat dt { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); }
.stat dd { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat dd small { font-size: .55em; font-weight: 600; color: var(--ink-2); margin-left: .15em; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ribbon */
.ribbon {
  margin-top: clamp(2rem, 5vw, 4rem);
  background: var(--ink); color: var(--accent-2);
  border-block: 6px solid;
  border-image: repeating-linear-gradient(135deg, var(--accent-2) 0 14px, var(--ink) 14px 28px) 6;
  overflow: hidden; white-space: nowrap;
  transform: rotate(-1.2deg) scale(1.03);
  box-shadow: var(--shadow);
}
[data-theme="dark"] .ribbon { background: var(--card-2); }
.ribbon__track {
  display: inline-flex; gap: 3rem; padding: .7rem 0;
  font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; letter-spacing: .12em; text-transform: uppercase;
  animation: marquee 32s linear infinite;
}
.ribbon__track span { display: inline-flex; align-items: center; gap: 3rem; }
.ribbon__track i { font-style: normal; color: var(--accent); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- dock / dropzone ---------- */
.dock { display: grid; gap: 1.25rem; }
.dropzone {
  position: relative;
  border: 2px dashed var(--line-2);
  border-radius: var(--radius);
  padding: clamp(2rem, 5vw, 3.5rem) 1.5rem 1.5rem;
  text-align: center;
  background:
    linear-gradient(var(--card) 0 0) padding-box,
    radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 1.5px) 0 0 / 22px 22px;
  background-color: var(--card);
  transition: border-color .2s, transform .25s var(--ease), box-shadow .25s, background-color .25s;
  cursor: pointer;
  overflow: hidden;
}
.dropzone::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 1.5px) 0 0 / 22px 22px;
  opacity: .5; pointer-events: none;
}
.dropzone > * { position: relative; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--ink-3); }
.dropzone.is-over {
  border-color: var(--accent); border-style: solid;
  background-color: var(--accent-soft);
  transform: scale(1.01);
  box-shadow: 0 0 0 6px var(--accent-soft), var(--shadow-lg);
}
.dropzone__glyph {
  width: 72px; height: 72px; margin: 0 auto 1rem; border-radius: 20px;
  display: grid; place-items: center;
  background: var(--plate); color: var(--accent-2);
  transform: rotate(-4deg);
  transition: transform .3s var(--ease-pop), background .2s;
  box-shadow: var(--shadow);
}
[data-theme="dark"] .dropzone__glyph { border: 1px solid var(--line-2); }
.dropzone__glyph svg { width: 34px; height: 34px; }
.dropzone:hover .dropzone__glyph, .dropzone.is-over .dropzone__glyph { transform: rotate(4deg) translateY(-6px) scale(1.06); background: var(--accent); color: var(--accent-ink); }
.dropzone__title { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: -.02em; }
.dropzone__sub { color: var(--ink-2); margin-top: .35rem; }
.dropzone__opts { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }
.field { display: grid; gap: .3rem; text-align: left; }
.field > span { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); }
.field input, .field select, .search input, select {
  padding: .55rem .8rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-2); background: var(--card); color: var(--ink);
  min-width: 0;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .search input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field input { font-family: var(--font-mono); font-size: .9rem; width: 220px; max-width: 100%; }
.field--block { width: 100%; }
.field--block input { width: 100%; }
.field__row { display: flex; gap: .4rem; align-items: center; }
.field__row input { flex: 1; }

/* usage meter */
.usage { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.25rem; font-size: .85rem; color: var(--ink-2); }
.usage__bar { flex: 1; min-width: 100px; height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.usage__bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s var(--ease), background-color .3s; }
.usage__bar span.is-warn { background: var(--warn); }
.usage__bar span.is-danger { background: var(--bad); }
#usageText { font-family: var(--font-mono); white-space: nowrap; }
.usage-chip {
  font-family: var(--font-mono); font-size: .75rem; padding: .32em .65em; border-radius: 999px;
  background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap;
}
.usage-chip.is-warn { color: var(--warn); border-color: var(--warn); }
.usage-chip.is-danger { color: var(--bad); border-color: var(--bad); }

/* dropzone full */
.dropzone.is-full { opacity: .6; cursor: not-allowed; }
.dropzone.is-full::after {
  content: attr(data-full-message);
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 1.5rem;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  color: var(--bad); font-weight: 600; text-align: center;
}

/* queue */
.queue { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; animation: rise .4s var(--ease) both; }
.queue__head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); }
.queue__list { list-style: none; padding: 0; margin: 0; }
.qi { display: grid; grid-template-columns: 40px 1fr auto; gap: .9rem; align-items: center; padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); position: relative; animation: rise .35s var(--ease) both; }
.qi:last-child { border-bottom: 0; }
.qi__ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-2); color: var(--ink-2); }
.qi__ico svg { width: 20px; height: 20px; }
.qi__main { min-width: 0; display: grid; gap: .35rem; }
.qi__name { font-family: var(--font-mono); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qi__meta { font-size: .8rem; color: var(--ink-3); display: flex; gap: .6rem; flex-wrap: wrap; }
.qi__bar { height: 5px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.qi__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s var(--ease); border-radius: inherit; }
.qi--done .qi__fill { background: var(--ok); }
.qi--error .qi__fill { background: var(--bad); }
.qi__side { display: flex; gap: .3rem; align-items: center; }
.qi__url { display: flex; gap: .4rem; align-items: center; min-width: 0; }
.qi__url a { font-family: var(--font-mono); font-size: .82rem; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.qi__err { font-size: .82rem; color: var(--bad); }
.stamp {
  display: inline-block; font-family: var(--font-display); font-weight: 800; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ok); border: 3px solid currentColor; border-radius: 6px; padding: .12em .45em; font-size: .85rem;
  transform: rotate(-8deg); animation: stamp .5s var(--ease-pop) both; mix-blend-mode: multiply;
}
[data-theme="dark"] .stamp { mix-blend-mode: screen; }
.stamp--sm { font-size: .68rem; border-width: 2px; color: var(--accent); transform: rotate(-4deg); }
@keyframes stamp { from { opacity: 0; transform: rotate(-20deg) scale(2.4); } 60% { opacity: 1; } to { transform: rotate(-8deg) scale(1); } }
@media (max-width: 640px) {
  .qi { grid-template-columns: 40px 1fr; }
  .qi__side { grid-column: 2; justify-content: flex-start; }
}

/* ---------- recent cards ---------- */
.recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; display: grid; gap: .6rem;
  transition: transform .25s var(--ease), box-shadow .25s, border-color .2s;
  animation: rise .4s var(--ease) both;
  position: relative;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.card__top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.card__name { font-family: var(--font-mono); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__dir { font-size: .78rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); }
.card__meta { font-size: .8rem; color: var(--ink-2); display: flex; gap: .7rem; }
.card__actions { display: flex; gap: .2rem; margin-top: .2rem; }

/* kind badge */
.kind {
  display: inline-flex; align-items: center; gap: .3rem;
  font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 500;
  padding: .25em .55em; border-radius: 4px; background: var(--bg-2); color: var(--ink-2);
}
.kind svg { width: 13px; height: 13px; }
.kind--html { background: var(--accent-soft); color: var(--accent); }
.kind--zip { background: rgb(242 184 0 / .18); color: var(--warn); }
.kind--img { background: rgb(36 87 214 / .12); color: var(--info); }
.kind--json { background: rgb(23 143 82 / .12); color: var(--ok); }

/* ---------- steps ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.step {
  position: relative; padding: 1.5rem 1.4rem 1.4rem; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); display: grid; gap: .5rem; overflow: hidden;
}
.step__n { position: absolute; right: 1rem; top: .5rem; font-family: var(--font-display); font-weight: 800; font-size: 3.4rem; color: var(--line); letter-spacing: -.05em; line-height: 1; }
.step__ico { width: 28px; height: 28px; color: var(--accent); }
.step p { color: var(--ink-2); font-size: .95rem; }
@media (max-width: 800px) { .steps { grid-template-columns: 1fr; } }

/* ---------- manifest ---------- */
.toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: .7rem; width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 2.3rem; padding-right: 2.2rem; width: min(320px, 70vw); }
.search kbd { position: absolute; right: .6rem; }
.manifest { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); font-weight: 500; background: var(--card-2); }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: var(--bg-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .c-path { max-width: 0; width: 44%; }
.tbl .c-act { text-align: right; white-space: nowrap; }
.tbl td { white-space: nowrap; }
.tbl td.c-path { white-space: normal; }
.path { display: grid; gap: .1rem; min-width: 0; }
.path__name { font-family: var(--font-mono); font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.path__name button { font: inherit; color: inherit; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.path__name button:hover { color: var(--accent); }
.path__dir { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.src { font-family: var(--font-mono); font-size: .78rem; color: var(--ink-2); }
.rowacts { display: inline-flex; gap: .1rem; opacity: .55; transition: opacity .15s; }
tr:hover .rowacts, .rowacts:focus-within { opacity: 1; }
@media (max-width: 720px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; }
  .tbl tr { padding: .8rem 1rem; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .35rem .8rem; }
  .tbl td { padding: 0; border: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .tbl .c-path { grid-column: 1 / -1; width: auto; max-width: none; }
  .tbl .c-act { grid-column: 1 / -1; text-align: left; margin-top: .3rem; }
  .tbl td[data-label]::before { content: attr(data-label) " "; font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); margin-right: .3rem; }
  .rowacts { opacity: 1; }
}
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; color: var(--ink-2); font-size: .9rem; }
.pager__btns { display: flex; gap: .3rem; }

.empty { display: grid; place-items: center; text-align: center; padding: clamp(2rem, 6vw, 4rem) 1rem; gap: .4rem; }
.empty img { width: 220px; height: auto; margin-bottom: .8rem; opacity: .95; }
.empty h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; }
.empty p { color: var(--ink-2); max-width: 40ch; }
.skel { padding: 1rem; display: grid; gap: .7rem; }
.skel div { height: 44px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--bg-2), var(--card-2), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- projects ---------- */
.project-form { display: flex; gap: 1rem; align-items: start; flex-wrap: wrap; margin-bottom: 1.5rem; }
.project-form__group { display: grid; gap: .3rem; }
.project-form .btn { margin-top: 1.5rem; }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.project-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem;
  display: grid; gap: .7rem; position: relative; overflow: hidden; animation: rise .4s var(--ease) both;
}
.project-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent-2); }
.project-card__head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.project-card__name { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.project-card__slug { font-family: var(--font-mono); font-size: .8rem; color: var(--ink-3); }
.project-card__actions { display: flex; gap: .2rem; }
.project-card__url { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.project-card__url code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.project-card__aliases { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; }
.project-card__aliases li { display: flex; align-items: center; gap: .5rem; min-width: 0; font-size: .8rem; }
.alias__name { font-weight: 600; }
.alias__target { flex: 1; min-width: 0; font-family: var(--font-mono); color: var(--ink-3); }
.project-card__meta { font-size: .8rem; color: var(--ink-2); display: flex; gap: .8rem; }
.project-card__rename { display: flex; gap: .5rem; align-items: center; }
.project-card__renameInput { flex: 1; min-width: 0; padding: .5rem .7rem; border-radius: var(--radius-sm); border: 1.5px solid var(--accent); background: var(--card); color: var(--ink); }

/* ---------- keys ---------- */
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.keycard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem;
  display: grid; gap: .7rem; position: relative; overflow: hidden; animation: rise .4s var(--ease) both;
}
.keycard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.keycard__head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.keycard__name { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.keycard__prefix { font-family: var(--font-mono); font-size: .85rem; color: var(--ink-2); }
.keycard__meta { font-size: .8rem; color: var(--ink-3); display: flex; gap: .8rem; flex-wrap: wrap; }
.scope { font-family: var(--font-mono); font-size: .7rem; padding: .18em .5em; border-radius: 4px; background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line); }
.scope--upload { color: var(--accent); }
.scope--delete { color: var(--bad); }
.scope--protected { color: var(--warn, var(--ink-2)); }
.scopes { border: 0; padding: 0; margin: 1rem 0 0; display: grid; gap: .4rem; }
.scopes legend { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); margin-bottom: .4rem; }
.chk { display: grid; grid-template-columns: auto auto 1fr; gap: .6rem; align-items: center; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.chk:has(:checked) { border-color: var(--accent); background: var(--accent-soft); }
.chk input { accent-color: var(--accent); width: 16px; height: 16px; }
.chk span { font-family: var(--font-mono); font-size: .9rem; }
.chk small { color: var(--ink-3); }

.ticket {
  position: relative; border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: 1rem 1.1rem; background: var(--card-2);
  display: grid; gap: .7rem; margin-top: .5rem;
}
.ticket::before, .ticket::after {
  content: ""; position: absolute; top: 50%; width: 22px; height: 22px; border-radius: 50%; background: var(--card); border: 1.5px dashed var(--line-2); transform: translateY(-50%);
}
.ticket::before { left: -12px; clip-path: inset(0 0 0 50%); }
.ticket::after { right: -12px; clip-path: inset(0 50% 0 0); }
.ticket__top { display: flex; justify-content: space-between; align-items: center; }
.ticket__label { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); }
.ticket__key { display: block; background: var(--plate); color: var(--accent-2); padding: .8rem .9rem; border-radius: var(--radius-sm); word-break: break-all; font-size: .92rem; }
.ticket__foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }

/* ---------- integrate ---------- */
.baseurl { display: inline-block; margin-top: .7rem; padding: .45rem .8rem; background: var(--plate); color: var(--accent-2); border-radius: var(--radius-sm); font-size: .95rem; max-width: 100%; overflow-wrap: anywhere; }
.integrate { display: grid; grid-template-columns: 320px 1fr; gap: 2rem; align-items: start; }
.docs__baseurl { color: var(--ink-2); font-size: .95rem; }
.docs__baseurl .baseurl { margin-top: .4rem; }
#homeDocs { border-top: 1px solid var(--line); padding-top: clamp(2rem, 5vw, 3.5rem); }
.integrate__side { display: grid; gap: 1.2rem; position: sticky; top: calc(var(--topbar-h) + 1rem); }
.checklist { padding-left: 0; list-style: none; counter-reset: step; display: grid; gap: .8rem; }
.checklist li { position: relative; padding-left: 2.4rem; color: var(--ink-2); font-size: .95rem; }
.checklist li strong { color: var(--ink); }
.checklist li::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: .1em; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--font-mono); font-size: .72rem;
  background: var(--plate); color: var(--accent-2);
}
.checklist a { color: var(--accent); }
.callout { display: flex; gap: .8rem; padding: 1rem; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); font-size: .92rem; color: var(--ink-2); }
.callout svg { width: 22px; height: 22px; flex: none; color: var(--accent); }
.callout strong { color: var(--ink); }
.snippets { display: grid; gap: 1.2rem; min-width: 0; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; }
.tab { padding: .45rem .9rem; border-radius: 999px; font-weight: 500; font-size: .9rem; color: var(--ink-2); border: 1.5px solid transparent; }
.tab:hover { background: var(--bg-2); color: var(--ink); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--bg); }
[data-theme="dark"] .tab[aria-selected="true"] { background: var(--accent-2); color: #15171B; }
.snippet { border-radius: var(--radius); overflow: hidden; background: #0F1218; color: #E6E1D6; border: 1px solid #1E2430; box-shadow: var(--shadow); }
.snippet__bar { display: flex; align-items: center; justify-content: space-between; padding: .5rem .6rem .5rem 1rem; background: #151A23; border-bottom: 1px solid #1E2430; }
.snippet__bar .btn--ghost { color: #A5ABB7; }
.snippet__bar .btn--ghost:hover { background: #1E2430; color: #fff; }
.snippet__lang { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: #6E7582; }
.snippet__code { margin: 0; padding: 1.1rem 1.2rem; overflow-x: auto; font-size: .85rem; line-height: 1.6; tab-size: 2; }
.snippet__code code { background: none; padding: 0; font-size: inherit; color: inherit; }
.snippet__code .c { color: #6E7582; }
.snippet__code .k { color: #FFD23F; }
.snippet__code .s { color: #9FE3B4; }
.snippet__code .v { color: #FF8A5B; }
.endpoints { display: grid; gap: .8rem; }
.epTable { width: 100%; border-collapse: collapse; font-size: .9rem; }
.epTable td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.epTable td:first-child { width: 4.5rem; }
.epTable td:first-child code { color: var(--accent); font-weight: 500; }
.epTable td:nth-child(2) { white-space: nowrap; }
.epTable td:last-child { color: var(--ink-2); }
@media (max-width: 900px) {
  .integrate { grid-template-columns: 1fr; }
  .integrate__side { position: static; }
  .epTable td:nth-child(2) { white-space: normal; word-break: break-all; }
}

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 3rem; padding-block: 1.5rem; font-size: .9rem; }
.footer__row { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.footer__brand { font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; }
.footer__links { margin-left: auto; display: flex; gap: 1rem; }
.footer__links a, .footer__links button { color: var(--ink-2); font: inherit; }
.footer__links a:hover, .footer__links button:hover { color: var(--ink); }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .45); backdrop-filter: blur(3px); z-index: 50; animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); z-index: 51;
  background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  display: grid; grid-template-rows: auto auto 1fr;
  transform: translateX(104%); transition: transform .32s var(--ease);
  padding-top: env(safe-area-inset-top, 0px);
}
.drawer.is-open { transform: none; }
.drawer__head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.4rem .8rem; }
.drawer__title { min-width: 0; display: grid; gap: .3rem; }
.drawer__title h2 { word-break: break-all; font-family: var(--font-mono); font-weight: 500; font-size: 1rem; }
.drawer__actions { display: flex; gap: .3rem; flex-wrap: wrap; padding: 0 1.4rem .9rem; border-bottom: 1px solid var(--line); }
.drawer__body { overflow: auto; background: var(--card); }
.drawer__body iframe { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.drawer__body img { max-width: 100%; margin: 1.5rem auto; }
.drawer__body pre { margin: 0; padding: 1.2rem 1.4rem; font-size: .84rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.drawer__body .empty { height: 100%; }

/* ---------- dialogs ---------- */
.dlg {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0; background: var(--bg); color: var(--ink);
  width: min(520px, calc(100vw - 2rem)); box-shadow: var(--shadow-lg);
  animation: pop .25s var(--ease-pop) both;
}
.dlg--sm { width: min(420px, calc(100vw - 2rem)); }
.dlg::backdrop { background: rgb(0 0 0 / .5); backdrop-filter: blur(6px); }
.dlg__form { padding: 1.4rem 1.5rem 1.5rem; display: grid; gap: .9rem; }
.dlg__head { display: flex; align-items: center; justify-content: space-between; }
.dlg__foot { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .4rem; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.status { padding: .7rem .9rem; border-radius: var(--radius-sm); font-size: .9rem; border: 1px solid var(--line); background: var(--card); display: flex; gap: .5rem; align-items: center; }
.status svg { width: 18px; height: 18px; flex: none; }
.status--ok { border-color: var(--ok); color: var(--ok); }
.status--bad { border-color: var(--bad); color: var(--bad); }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: .55rem 1rem; align-items: center; font-size: .92rem; color: var(--ink-2); }
.shortcuts dt { white-space: nowrap; }

/* ---------- sign-in / sign-up ---------- */
.auth-card {
  width: min(100%, 460px); margin-inline: auto; display: grid; gap: 1rem;
  padding: clamp(1.4rem, 4vw, 2.2rem); border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: rise .5s var(--ease) both;
}
.auth-card__form { display: grid; gap: .55rem; margin-top: .6rem; }
.auth-card__form .btn { justify-content: center; margin-top: .5rem; }
.field__err { color: var(--bad); font-size: .82rem; }
.field__err:empty { display: none; }
.pwmeter { display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: center; }
.pwmeter__bar { position: relative; height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; --pw: var(--line-2); --score: -1; }
.pwmeter__bar::after {
  content: ""; position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--pw);
  width: calc((var(--score) + 1) * 20%); transition: width .25s var(--ease), background-color .25s;
}
.pwmeter[data-score="0"] .pwmeter__bar { --score: 0; --pw: var(--bad); }
.pwmeter[data-score="1"] .pwmeter__bar { --score: 1; --pw: var(--accent); }
.pwmeter[data-score="2"] .pwmeter__bar { --score: 2; --pw: var(--accent-2); }
.pwmeter[data-score="3"] .pwmeter__bar { --score: 3; --pw: var(--info); }
.pwmeter[data-score="4"] .pwmeter__bar { --score: 4; --pw: var(--ok); }
.pwmeter__label { font-family: var(--font-mono); font-size: .75rem; color: var(--ink-2); min-width: 9ch; text-align: right; }
.pwmeter__tips { padding-left: 1.1rem; font-size: .82rem; color: var(--ink-2); display: grid; gap: .15rem; }
.pwmeter__tips:empty { display: none; }

/* ---------- admin ---------- */
.stats--admin { grid-template-columns: repeat(5, 1fr); margin-top: 0; margin-bottom: 1.5rem; }
@media (max-width: 720px) { .stats--admin { grid-template-columns: repeat(2, 1fr); } .stats--admin .stat:last-child { grid-column: 1 / -1; } }
.admin-tabs { margin-bottom: 1.2rem; }
.admin-panel { display: grid; gap: 1rem; animation: rise .35s var(--ease) both; }
.admin-panel__bar { justify-content: flex-start; }
.admin-input {
  padding: .55rem .8rem; border-radius: var(--radius-sm); border: 1.5px solid var(--line-2); background: var(--card); color: var(--ink);
  font-family: var(--font-mono); font-size: .9rem; width: 9rem; min-width: 0;
}
.admin-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.admin-input:disabled { opacity: .5; }
.admin-label { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); }
.admin-check { display: inline-flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--ink-2); }
.admin-check input { accent-color: var(--accent); }
.admin-settings { display: flex; gap: 1.5rem; align-items: start; flex-wrap: wrap; padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.admin-settings__foot { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; align-self: end; }
.admin-ticket { margin-top: 0; }
.ticket__link { font-size: .82rem; color: var(--ink); background: var(--bg-2); }
.chk--radio { grid-template-columns: auto auto 1fr; }
.chk--radio:not(:has(> input:checked)) { border-color: var(--line); background: none; } /* a <select>'s selected option also matches :checked */
.chk--radio .field__row { justify-self: end; }
.chk .admin-input { width: 7rem; height: auto; accent-color: auto; }
.ubar { display: grid; gap: .25rem; min-width: 9rem; }
.ubar__bar { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.ubar__bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.ubar__bar span.is-warn { background: var(--warn); }
.ubar__bar span.is-danger { background: var(--bad); }
.ubar__text { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-2); }
.badge { display: inline-block; font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; padding: .15em .5em; border-radius: 4px; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-2); margin-left: .3rem; }
.badge--admin, .badge--open { color: var(--ok); border-color: var(--ok); }
.badge--disabled, .badge--revoked { color: var(--bad); border-color: var(--bad); }
.badge--used { color: var(--info); border-color: var(--info); }
.badge--expired { color: var(--warn); border-color: var(--warn); }
.tbl .c-email { white-space: normal; word-break: break-all; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); z-index: 60; display: grid; gap: .5rem; max-width: min(360px, calc(100vw - 2rem)); }
.toast {
  display: flex; gap: .6rem; align-items: center; padding: .7rem .9rem; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--bg); font-size: .9rem; box-shadow: var(--shadow-lg);
  animation: toastIn .3s var(--ease-pop) both; border-left: 4px solid var(--accent-2);
}
[data-theme="dark"] .toast { background: var(--card-2); color: var(--ink); border: 1px solid var(--line-2); border-left-width: 4px; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast__link { color: inherit; text-decoration: underline; margin-left: .4em; font-weight: 600; }
.toast--ok { border-left-color: var(--ok); }
.toast--bad { border-left-color: var(--bad); }
.toast--warn { border-left-color: var(--warn); }
.toast.is-leaving { animation: toastOut .25s var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ---------- drop veil ---------- */
.veil {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.veil.is-on { opacity: 1; pointer-events: auto; }
.veil__inner { text-align: center; display: grid; gap: 1rem; justify-items: center; pointer-events: none; }
.veil__stamp {
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  font-size: clamp(2.4rem, 9vw, 6rem); line-height: .95; color: var(--accent);
  border: .12em solid currentColor; border-radius: .12em; padding: .15em .35em;
  transform: rotate(-6deg); animation: stamp .45s var(--ease-pop) both;
}
.veil.is-on .veil__stamp { animation: stamp .45s var(--ease-pop) both; }
.veil__hint { font-size: 1.1rem; color: var(--ink-2); }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .ribbon__track { animation: none; }
}
