:root {
  /* Surfaces — deep ink with a faint cool cast */
  --bg: #0a0d12;
  --surface: #11161d;
  --surface-2: #161d27;
  --surface-3: #1f2833;
  --border: #242e3a;
  --border-strong: #354455;
  /* Text */
  --text: #eef2f7;
  --text-dim: #9aa8b8;
  --text-faint: #64727f;
  /* Accents */
  --accent: #6fe3c0;
  --accent-2: #5cb6ff;
  --accent-strong: #45d3ac;
  --accent-ink: #04201a;
  --gold: #e7c98a;
  --link: #8ed8ff;
  /* Status */
  --ok: #6fe39a;
  --warn: #f2c25f;
  --bad: #ff8a99;
  --info: #9eb7ff;
  /* Shape */
  --radius-sm: 9px;
  --radius: 13px;
  --radius-lg: 20px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.24);
  --sidebar-w: 256px;
  --content-max: 1280px;
  --card-aspect: 4 / 3;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --mono: var(--font-mono);
  --sans: var(--font-sans);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Atmospheric depth: a soft top glow + barely-there grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1100px 620px at 78% -8%, rgba(92, 182, 255, 0.10), transparent 60%),
    radial-gradient(900px 520px at 0% 0%, rgba(111, 227, 192, 0.07), transparent 55%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }

::selection { background: rgba(111, 227, 192, 0.28); }

main#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* ---------- Top nav ---------- */
/* Global nav runs across the top so it claims vertical, not horizontal, space —
   the content area then gets the full page width. */
.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  padding: 10px 34px;
  background: rgba(11, 15, 21, 0.86);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; flex: none;
  box-shadow: 0 6px 14px rgba(69, 211, 172, 0.3);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.02; }
.brand-text .top { font-size: 9px; letter-spacing: .22em; text-transform: uppercase; color: var(--text-faint); }
.brand-text .bottom { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text); }

.topnav-links { display: flex; align-items: center; gap: 4px; }
.topnav-cta { margin-left: auto; }

.btn-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  font-weight: 700; font-size: 13px; letter-spacing: .01em;
  border: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.btn-cta:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 10px 22px rgba(69, 211, 172, 0.3); filter: brightness(1.03); }
.btn-cta svg { width: 16px; height: 16px; }

.nav-item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 550; font-size: 13.5px;
  transition: background .12s ease, color .12s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--surface-3); color: var(--text); }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon { display: flex; color: var(--text-faint); }
.nav-icon svg { width: 16px; height: 16px; display: block; }

/* ---------- Content ---------- */
.content { width: 100%; }
.content-inner { max-width: var(--content-max); margin: 0 auto; padding: 24px 34px 64px; }
/* Grid-heavy views (Sites, a site's Pages/Media) use the full window width so the
   card grids add columns as the window grows, instead of capping at the prose
   max-width. Forms inside still self-constrain via their own max-width. */
.content-inner.full { max-width: none; }

/* Global breadcrumb bar — sits above page content, not inside its card */
.crumb-bar { margin-bottom: 16px; }
.breadcrumbs { color: var(--text-dim); font-size: 12.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--text-dim); }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs .sep { color: var(--text-faint); }
.breadcrumbs code { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head .titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.page-title { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -0.01em; }
.page-sub { color: var(--text-dim); font-size: 13.5px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards / sections ---------- */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.section > h2 { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin-bottom: 16px; letter-spacing: -0.005em; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-faint); margin-bottom: 10px; }

/* ---------- Entity header (site / page) ---------- */
.entity-head-row { display: flex; gap: 22px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.entity-head { display: grid; grid-template-columns: 88px 1fr; gap: 20px; align-items: center; }
.entity-logo {
  width: 88px; height: 88px;
  border-radius: 18px;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
  flex: none;
}
.entity-logo img { max-width: 82%; max-height: 82%; display: block; object-fit: contain; }
.entity-copy { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.entity-copy h1, .entity-copy h2 { font-family: var(--font-display); font-size: 23px; font-weight: 600; letter-spacing: -0.01em; }
.entity-url { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); word-break: break-all; }
/* Domain + stat badges on one row: minor details grouped, less vertical stacking. */
.entity-url-row { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; }
.entity-url-row .stat-row { margin-top: 0; }
.meta-line { color: var(--text-dim); font-size: 13px; }
.meta-line.mono { font-family: var(--font-mono); font-size: 12px; word-break: break-all; }

/* monogram fallback */
.site-card-monogram {
  width: 100%; height: 100%;
  border-radius: inherit;
  background: linear-gradient(150deg, rgba(111, 227, 192, .26), rgba(92, 182, 255, .2));
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 600; font-size: 24px; letter-spacing: .02em;
}

/* ---------- Sites grid ---------- */
.sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.site-card, .page-card, .batch-card {
  color: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.site-card:hover, .page-card:hover, .batch-card:hover,
.site-card:focus-visible, .page-card:focus-visible, .batch-card:focus-visible {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  text-decoration: none;
  outline: none;
}
.site-card { display: grid; grid-template-columns: 64px 1fr; gap: 15px; padding: 16px; align-items: center; }
.site-card-logo {
  width: 64px; height: 64px;
  border-radius: 15px;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
}
.site-card-logo img, .settings-logo-preview img { max-width: 82%; max-height: 82%; display: block; object-fit: contain; }
.site-card-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.site-card-title {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.site-card-domain { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stat-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.stat {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
}
.stat b { color: var(--text); font-weight: 650; }

/* ---------- Tabs (segmented) ---------- */
.tab-row {
  display: inline-flex;
  gap: 3px;
  margin-top: 4px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  flex-wrap: wrap;
}
.tab-link {
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  border: none;
}
.tab-link:hover { color: var(--text); text-decoration: none; }
.tab-link.active { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-sm); }

/* Tab-heading: the section tabs ARE the heading — active tab is heading-sized,
   the rest are smaller clickable links beside it (one element, not tabs + h2). */
.tab-heading { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin: 4px 0 16px; }
.tab-h { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--text-faint); line-height: 1.2; }
.tab-h:hover { color: var(--text-dim); text-decoration: none; }
.tab-h.active { font-size: 23px; color: var(--text); }
.tab-h.active:hover { color: var(--text); }

/* ---------- Page cards ---------- */
.page-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.page-card { overflow: hidden; display: flex; flex-direction: column; }
.page-card-preview {
  width: 100%;
  aspect-ratio: var(--card-aspect, 4 / 3);
  background: #080c11;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.page-card-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-fallback { color: var(--text-faint); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.page-card-body { padding: 14px 15px; display: flex; flex-direction: column; gap: 7px; }
.page-card-title {
  font-size: 14.5px; font-weight: 600; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.page-card-path { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-card-stats { color: var(--text-dim); font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- Batch / job cards ---------- */
.batches { display: flex; flex-direction: column; gap: 10px; }
.batch-card { padding: 15px 17px; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; }
.batch-card .name { font-weight: 650; font-size: 14.5px; }
.batch-card .meta { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; }
.batch-card .right { text-align: right; display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }

/* ---------- Pills / tags ---------- */
.status-pill, .kind-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.done { color: var(--ok); border-color: rgba(111, 227, 154, .32); }
.status-pill.running { color: var(--accent); border-color: rgba(111, 227, 192, .32); }
.status-pill.partial { color: var(--warn); border-color: rgba(242, 194, 95, .32); }
.status-pill.failed { color: var(--bad); border-color: rgba(255, 138, 153, .32); }
.status-pill.queued { color: var(--text-dim); }
.kind-tag.image { color: var(--accent); }
.kind-tag.video { color: var(--info); }
.kind-tag.audio { color: var(--warn); }

/* ---------- Buttons / forms ---------- */
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.form-grid { display: flex; flex-direction: column; gap: 16px; max-width: 720px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 12.5px; color: var(--text-dim); font-weight: 600; }
.form-field .hint { font-size: 11.5px; color: var(--text-faint); }

input[type="text"], textarea, select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13.5px;
  width: 100%;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input[type="text"]::placeholder, textarea::placeholder { color: var(--text-faint); }
input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(69, 211, 172, 0.15);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
textarea.urls { min-height: 150px; font-family: var(--font-mono); font-size: 12.5px; }
input[type="file"] { font-size: 12.5px; color: var(--text-dim); }

button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: transform .1s ease, box-shadow .1s ease, opacity .1s ease, filter .1s ease;
}
button:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); filter: brightness(1.03); }
button.secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
button.secondary:hover { background: var(--surface-3); border-color: var(--border-strong); box-shadow: none; filter: none; }
button[disabled], .thumb-button[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
a.btn-secondary {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 15px; font-weight: 600; font-size: 13px;
  white-space: nowrap;
}
a.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-strong); text-decoration: none; }
a.btn-secondary svg { width: 15px; height: 15px; flex: none; }

details.advanced {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
details.advanced > summary {
  cursor: pointer; padding: 11px 14px; font-size: 12.5px; font-weight: 600;
  color: var(--text-dim); list-style: none; display: flex; align-items: center; gap: 8px;
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: "▸"; color: var(--text-faint); transition: transform .12s ease; }
details.advanced[open] > summary::before { transform: rotate(90deg); }
details.advanced .advanced-body { padding: 4px 14px 16px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- Tables ---------- */
.pages-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pages-table th, .pages-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.pages-table th { color: var(--text-faint); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; }
.pages-table td.mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.pages-table tbody tr { cursor: pointer; transition: background .1s ease; }
.pages-table tbody tr:hover td { background: var(--surface-2); }
.pages-table tbody tr:last-child td { border-bottom: none; }

/* ---------- Media sections + gallery ---------- */
.media-section { margin-bottom: 22px; }
.media-section:last-child { margin-bottom: 0; }
.media-section-head { display: flex; align-items: baseline; gap: 10px; }
.media-section-head h3 { font-family: var(--font-display); font-size: 15.5px; font-weight: 600; color: var(--text); }
.media-section-head .count { font-size: 12px; color: var(--text-faint); }
/* Collapsible sections: the header is a toggle; a caret rotates when open. The grid is
   wrapped in .section-body / .section-body-inner so its height animates via the
   grid-template-rows 1fr↔0fr trick (the inner clips with overflow:hidden). The 12px
   head→grid gap lives inside the animated area so it collapses away too. */
.media-section-head.toggle { cursor: pointer; user-select: none; align-items: center; border-radius: 8px; margin-left: -6px; padding: 3px 6px; transition: background .12s ease; }
.media-section-head.toggle:hover { background: var(--surface-2); }
.media-section-head.toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.section-caret { display: inline-flex; color: var(--text-faint); transition: transform .18s ease; }
.section-caret svg { width: 15px; height: 15px; }
.media-section:not(.collapsed) .section-caret { transform: rotate(90deg); }
.section-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .26s cubic-bezier(.2,.7,.2,1); }
.media-section.collapsed .section-body { grid-template-rows: 0fr; }
.section-body-inner { overflow: hidden; min-height: 0; }
/* The head→grid gap is a child margin (not inner padding) so it's clipped away when
   collapsed — padding would otherwise leave a sliver since it isn't subject to overflow. */
.section-body-inner > * { margin-top: 12px; }
.media-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.media-count { color: var(--text-dim); font-size: 12.5px; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.media-grid.dense { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 9px; }

/* Smaller images: a fixed-height justified strip of cards — the thumbnail keeps
   its natural aspect, with the page it links to captioned underneath (so the link
   never covers the image). Items read left-to-right in size order, grouping
   similar sizes together (largest first). */
.media-strip { display: flex; flex-wrap: wrap; gap: 12px; align-content: flex-start; }
.media-card { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.media-strip .media-tile { width: 100%; height: 132px; border-radius: 10px; }
.media-strip .media-tile img, .media-strip .media-tile video { object-fit: cover; }
.tile-link {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--link);
  max-width: 100%; min-width: 0;
}
.tile-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-link svg { width: 12px; height: 12px; flex: none; }
.tile-link:hover { text-decoration: none; }
.tile-link:hover span { text-decoration: underline; }
.media-tile {
  position: relative;
  display: block;
  aspect-ratio: var(--tile-aspect, 1 / 1);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 0;
  cursor: pointer;
  transition: border-color .12s ease, transform .12s ease;
}
.media-grid.dense .media-tile { border-radius: 10px; }
.media-tile:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.media-tile[disabled] { cursor: not-allowed; }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile .tile-icon {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--text-faint);
}
.media-tile .tile-icon svg { width: 28px; height: 28px; }
.media-tile .tile-icon .placeholder { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.tile-corner {
  position: absolute; top: 7px; left: 7px;
  display: flex; align-items: center; gap: 4px;
  padding: 3px 6px; border-radius: 7px;
  background: rgba(8, 12, 17, 0.78); backdrop-filter: blur(4px);
  color: #fff; font-size: 10px; font-weight: 600;
}
.tile-corner svg { width: 12px; height: 12px; }
.tile-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 18px 9px 7px;
  background: linear-gradient(180deg, transparent, rgba(6, 10, 14, 0.92));
  color: #eef4fa; font-size: 10.5px; font-family: var(--font-mono);
  display: flex; justify-content: space-between; gap: 6px;
  opacity: 0; transition: opacity .12s ease; pointer-events: none;
}
.media-tile:hover .tile-overlay { opacity: 1; }

/* ---------- Screenshot thumbnail ---------- */
.shot-thumb {
  position: relative; display: block; padding: 0;
  width: 200px; max-width: 100%;
  border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; transition: border-color .12s ease, transform .12s ease;
}
.shot-thumb:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.shot-thumb img { width: 100%; display: block; max-height: 150px; object-fit: cover; object-position: top; }
.shot-thumb .shot-label {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px 9px 6px; font-size: 10.5px; color: #eef4fa;
  background: linear-gradient(180deg, transparent, rgba(6, 10, 14, 0.9));
  display: flex; align-items: center; gap: 6px;
}
.shot-thumb .shot-label svg { width: 13px; height: 13px; }

/* ---------- Site settings ---------- */
.site-settings-grid { display: grid; gap: 16px; max-width: 560px; }
.settings-logo-preview {
  margin-top: 16px; width: 120px; height: 120px;
  border-radius: 18px; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Modal / lightbox ---------- */
.modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 6, 10, 0.84);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px; pointer-events: auto;
  animation: fade .16s ease;
}
/* Lightbox shrinks to fit its media (capped at most of the viewport) rather than
   always being full-width, so a narrow portrait image leaves clickable backdrop on
   either side to dismiss the modal. */
.modal-card {
  width: fit-content;
  max-width: min(1700px, 97vw);
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: pop .18s cubic-bezier(.2,.8,.2,1);
}
/* A full-page preview (saved-site iframe) fills the width — it's a whole page, not a
   single asset, so it overrides the shrink-to-fit sizing above. */
.modal-wide { width: min(1700px, 97vw); }
/* A dialog (form) doesn't need the full width — keep it a comfortable reading size. */
.modal-dialog { width: min(640px, 96vw); }
.modal-dialog-body { padding: 20px; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
/* max-width keeps a long filename/URL from forcing the (now shrink-to-fit) card wide;
   it ellipsizes instead. */
.modal-title { font-size: 13.5px; font-weight: 600; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); color: var(--text-dim); }
/* The media and its prev/next arrows are flex siblings with a gap, so the browser
   lays the arrows out a fixed distance to either side of the media automatically —
   symmetric, always hugging the content, no JS measurement. */
.modal-body { position: relative; display: flex; align-items: center; justify-content: center; gap: 60px; background: #05080c; padding: 16px; min-height: 240px; overflow: hidden; flex: 1; }
/* Cap media to the body's available height (viewport minus the card's head/foot/
   padding chrome) so it scales to fit instead of overflowing/scrolling. min-width:0 +
   object-fit:contain let a too-wide image shrink to share space with the arrows while
   keeping its aspect ratio. */
.modal-body img, .modal-body video, .modal-body audio { max-width: 100%; max-height: calc(100vh - 170px); min-width: 0; object-fit: contain; border-radius: 8px; }
.modal-body iframe { width: 100%; height: calc(100vh - 170px); border: 0; background: #fff; border-radius: 8px; }
/* Prev/next image navigation — circular controls sitting a `gap` to each side of the
   media; dimmed-out at the ends of the set. */
.modal-nav {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border-radius: 999px;
  background: rgba(12, 16, 22, 0.72); border: 1px solid var(--border-strong);
  color: var(--text); cursor: pointer; z-index: 2; backdrop-filter: blur(4px);
  transition: background .14s ease, opacity .14s ease, transform .14s ease;
}
.modal-nav svg { width: 22px; height: 22px; }
.modal-nav:hover:not(:disabled) { background: rgba(20, 26, 34, 0.92); transform: scale(1.08); box-shadow: none; }
.modal-nav:disabled { opacity: 0.28; cursor: default; }
/* Popover: an anchored control panel that floats over the page with NO dimmed
   backdrop — the page stays fully visible; a transparent scrim catches the
   click-to-dismiss. */
.popover-scrim { position: fixed; inset: 0; background: transparent; pointer-events: auto; }
.popover-panel {
  position: fixed;
  width: min(440px, 92vw);
  max-height: calc(100vh - 76px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  z-index: 51;
  animation: popover-in .14s cubic-bezier(.2,.8,.2,1);
}
@keyframes popover-in { from { opacity: 0; transform: translateY(-6px) scale(.985); } to { opacity: 1; transform: none; } }
.popover-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 4px; }
.popover-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--text); }
.popover-x { background: none; border: none; color: var(--text-faint); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; box-shadow: none; }
.popover-x:hover { color: var(--text); transform: none; box-shadow: none; filter: none; }
.popover-body { padding: 6px 14px 14px; }
.popover-body .form-grid { gap: 12px; }

.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.modal-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-dim); font-size: 12px; }
.modal-meta .mono { font-family: var(--font-mono); }
.modal-foot .actions-row { margin-top: 0; }

/* ---------- States ---------- */
.empty {
  color: var(--text-dim);
  padding: 44px 24px; text-align: center;
  border: 1px dashed var(--border); border-radius: var(--radius);
  background: rgba(22, 29, 39, 0.4);
}
.empty .empty-title { font-family: var(--font-display); color: var(--text); font-weight: 600; font-size: 17px; margin-bottom: 6px; }
.error { color: var(--bad); padding: 12px 14px; background: rgba(255, 138, 153, .09); border: 1px solid rgba(255, 138, 153, .32); border-radius: var(--radius-sm); margin-bottom: 12px; }
.note { color: var(--ok); font-size: 12.5px; }

.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.loading { display: flex; align-items: center; gap: 10px; color: var(--text-dim); padding: 30px 4px; font-size: 13px; }

.mono { font-family: var(--font-mono); }

/* ---------- Motion ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.reveal > * { animation: rise .42s cubic-bezier(.2,.7,.2,1) backwards; }
.reveal > *:nth-child(1) { animation-delay: .02s; }
.reveal > *:nth-child(2) { animation-delay: .06s; }
.reveal > *:nth-child(3) { animation-delay: .10s; }
.reveal > *:nth-child(4) { animation-delay: .14s; }
.reveal > *:nth-child(5) { animation-delay: .18s; }
.reveal > *:nth-child(6) { animation-delay: .22s; }
.reveal > *:nth-child(7) { animation-delay: .26s; }
.reveal > *:nth-child(8) { animation-delay: .30s; }
.reveal > *:nth-child(n+9) { animation-delay: .34s; }

@media (prefers-reduced-motion: reduce) {
  .reveal > *, .modal-card, .modal-backdrop { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .topnav { padding: 9px 18px; gap: 14px; }
  .content-inner { padding: 20px 18px 48px; }
  .entity-head { grid-template-columns: 1fr; }
  .entity-logo { width: 72px; height: 72px; }
  .page-title { font-size: 25px; }
}

/* ---------- Account control (top nav) ---------- */
/* Sits at the far right of the top nav, grouped with the CTA (which carries the
   margin-left:auto). Email truncates so a long address can't blow out the bar. */
.account-menu {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-left: 4px;
}
.account-email {
  font-size: 12.5px;
  color: var(--text-dim);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-logout {
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.account-logout:hover { background: var(--surface-3); border-color: var(--accent); }

@media (max-width: 900px) {
  .account-email { max-width: 130px; }
}

/* ---------- Auth pages (login / signup / forgot / reset) ---------- */
/* The auth pages are server-rendered (src/templates.js) with their own scoped
   inline <style>; these are shared niceties layered on top of the design tokens.
   Kept here too so they survive even if the inline block is trimmed. */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  position: relative;
  z-index: 1;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 30px 28px;
}
.auth-card h1 { font-family: var(--font-display); font-size: 21px; margin-bottom: 4px; }
.auth-card .sub { color: var(--text-dim); font-size: 13px; margin-bottom: 20px; }
.auth-field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.auth-field label { font-size: 12px; font-weight: 600; color: var(--text-dim); letter-spacing: .3px; }
.auth-field input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
}
.auth-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(111, 227, 192, 0.18); }
