:root {
  --bg:        #0a0b0f;
  --panel:     #14161f;
  --panel-2:   #1a1d28;
  --ink:       #eceef4;
  --ink-soft:  #d7dbe4;
  --muted:     #99a1b2;
  --line:      rgba(255,255,255,.09);
  --line-soft: rgba(255,255,255,.05);
  --accent:    #8aa2ff;
  --accent-2:  #ffb27c;
  --accent-3:  #7ed6a6;   /* NZ */
  --accent-ink:#0a0b0f;
  --radius:    16px;
  --maxw:      720px;
  /* all-sans: headlines use the same family, distinguished by weight + size */
  --serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; min-height: 100vh;
}
.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-color: var(--bg);
  /* colored glows sit on top of the page-background texture (first layer = topmost) */
  background-image:
    radial-gradient(60rem 40rem at 80% -10%, rgba(138,162,255,.14), transparent 60%),
    radial-gradient(50rem 35rem at -10% 0%, rgba(255,178,124,.10), transparent 55%),
    url("/static/page-bg.webp");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
a { color: inherit; text-decoration: none; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(140%) blur(14px);
  background: linear-gradient(180deg, rgba(10,11,15,.86), rgba(10,11,15,.55));
  border-bottom: 1px solid var(--line-soft);
}
/* Signed in there are five controls competing with the site name for 720px. Without a
   floor under the brand, flexbox shrinks it to nothing before it ever wraps — and a
   title with no overflow rule then paints straight over the first button. So: the brand
   keeps a minimum, the buttons take a row of their own when that doesn't fit, and the
   title ellipsises rather than spilling. --header-h is re-measured whenever this
   changes shape, so the sticky filter bar follows it down. */
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 15px 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: min(100%, 170px); }
.brand-mark { font-size: 22px; color: var(--accent); filter: drop-shadow(0 0 12px rgba(138,162,255,.5)); flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title { font-family: var(--serif); font-weight: 700; font-size: 21px; letter-spacing: -.01em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-tagline { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line); padding: 9px 15px;
  border-radius: 999px; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.btn:hover { background: #20232f; border-color: rgba(255,255,255,.16); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-accent { color: var(--accent-ink); background: linear-gradient(180deg, #9fb2ff, var(--accent)); border: none; box-shadow: 0 6px 20px rgba(138,162,255,.28); }
.btn-accent:hover { background: linear-gradient(180deg, #aebdff, #93a9ff); box-shadow: 0 8px 26px rgba(138,162,255,.36); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); box-shadow: none; }
.btn-ghost:hover { background: var(--line-soft); color: var(--ink); border-color: rgba(255,255,255,.16); }
/* These wrap rather than scroll, unlike .chips below. A filter you can't see is one
   you'll find by scrolling the row you're already looking at; a Sign out clipped off
   the edge just reads as broken. Admin controls stay visible and the header grows. */
.header-actions {
  display: flex; align-items: center; gap: 10px;
  flex: 0 1 auto; min-width: 0; max-width: 100%; margin-left: auto;
  flex-wrap: wrap; justify-content: flex-end;
}
.header-actions > * { flex: none; }
.icon-btn { background: transparent; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 6px; border-radius: 8px; line-height: 1; }
.icon-btn:hover { color: var(--ink); background: var(--line-soft); }

/* ---------------------------------------------------------------- overflow menu */
.menu-wrap { position: relative; flex: none; }
.menu-btn { padding: 9px 12px; }
.menu-btn svg { display: block; }
/* Folded away, the draft queue and a running job would go unnoticed — the dot is
   the one thing that still has to be visible from outside. */
.menu-dot {
  position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 0 2px var(--bg);
}
.menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; min-width: 215px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 14px; padding: 6px;
  box-shadow: 0 20px 50px rgba(0,0,0,.55); animation: pop .14s ease;
}
.menu-item {
  display: block; width: 100%; text-align: left; white-space: nowrap;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--ink-soft);
  background: transparent; border: none; border-radius: 9px; padding: 9px 12px; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.menu-item:hover { background: var(--line-soft); color: var(--ink); }
.menu-item:disabled { opacity: .6; cursor: default; }
.menu-sep { height: 1px; background: var(--line-soft); margin: 5px 8px; }

/* ---------------------------------------------------------------- chips (filter + category selector) */
/* Sticks under the header so the search box and the counts stay reachable however far
   you've scrolled. --header-h is measured in JS, since the header grows when the
   tagline wraps. */
.filter-bar {
  position: sticky; top: var(--header-h, 72px); z-index: 15;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 -20px; padding: 14px 20px 12px;
  background: linear-gradient(180deg, rgba(10,11,15,.94), rgba(10,11,15,.72));
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
/* The filters live on one line, always. They shrink to fit the width available, and if
   even that isn't enough (signed in, six of them, a narrow phone) the row scrolls
   sideways rather than wrapping onto a second line of sticky chrome. */
.chips {
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 auto; min-width: 0; overflow-x: auto;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; white-space: nowrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--ink-soft);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; cursor: pointer; transition: all .15s ease;
}
.chip:hover { color: var(--ink); border-color: rgba(255,255,255,.18); }
.chip.active { color: var(--accent-ink); background: linear-gradient(180deg, #9fb2ff, var(--accent)); border-color: transparent; }
.chip-n { font-size: 11px; opacity: .65; }

/* search sits with the filters — same row, pushed to the end */
.search { position: relative; display: flex; align-items: center; margin-left: auto; }
.search-icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.search input {
  font-family: var(--sans); font-size: 13px; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 28px 7px 31px; width: 220px; outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;   /* never width: it shifts under the cursor */
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(138,162,255,.16); }
.search-clear {
  position: absolute; right: 8px; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 12px; line-height: 1; padding: 3px;
}
.search-clear:hover { color: var(--ink); }
@media (max-width: 600px) {
  /* Same reasoning as the filter bar: a sticky header costs screen on every scroll, so
     the admin controls get tighter rather than taking another row of it. */
  .header-actions { gap: 6px; }
  .header-actions .btn { font-size: 12.5px; padding: 8px 11px; gap: 5px; }
  .header-actions .btn svg { width: 15px; height: 15px; }
  /* .header-inner's `padding: 15px 0` cancels .wrap's gutters. On a wide screen the
     max-width keeps it off the edges anyway, and the lost 20px is what lines the title
     up with the cards. On a phone there is no such margin: the row goes edge to edge,
     and the last button ends up flush against the glass. Put the gutters back. */
  .header-inner { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 560px) {
  /* The bar is sticky, so every row it takes is screen you never get back: chips on one
     line, search on its own. Chip text and padding scale with the viewport so four (or
     six, signed in) still fit across a phone. */
  .filter-bar { gap: 8px; padding: 10px 20px; }
  .chips { gap: 5px; }
  .chip { font-size: clamp(11px, 3.1vw, 13px); padding: 7px clamp(7px, 2.6vw, 14px); gap: 4px; }
  .chip-n { font-size: clamp(9.5px, 2.6vw, 11px); }
  .search { flex: 0 0 100%; margin-left: 0; }         /* always its own row */
  .search input { width: 100%; padding-top: 9px; padding-bottom: 9px; }
  .search-clear { right: 5px; padding: 9px; font-size: 13px; }   /* a thumb, not a cursor */
}

/* the no-JS copy of the feed — what a crawler (or a reader without JS) gets instead
   of an empty shell, so it should be readable rather than hidden away */
.crawlable { max-width: var(--maxw); margin: 0 auto; padding: 28px 18px; }
.crawlable h1 { font-size: 26px; margin: 0 0 4px; }
.crawlable h2 { font-size: 17px; margin: 22px 0 4px; }
.crawlable p { margin: 4px 0; color: var(--ink-soft); }
.crawlable a { color: var(--accent); }
.crawlable small { color: var(--muted); }
.chip.active .chip-n { opacity: .8; }

/* ---------------------------------------------------------------- big-picture digest */
.digest { margin-top: 20px; animation: rise .4s ease both; }
.digest-inner {
  position: relative; overflow: hidden;
  background:
    radial-gradient(44rem 22rem at 100% -60%, rgba(138,162,255,.12), transparent 60%),
    linear-gradient(180deg, var(--panel), #11131b);
  border: 1px solid rgba(138,162,255,.24);
  border-radius: var(--radius);
  padding: 15px 18px 14px;
  box-shadow: 0 12px 34px rgba(0,0,0,.28);
}
.digest-inner::before {   /* accent rule down the left edge — "this is the editorial read" */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.digest-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.digest-mark { color: var(--accent); font-size: 15px; filter: drop-shadow(0 0 10px rgba(138,162,255,.5)); flex: none; }
.digest-kicker { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.digest-sec { color: var(--muted); }
.digest-meta { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.digest-lead { font-family: var(--serif); font-weight: 700; font-size: 18.5px; line-height: 1.4; letter-spacing: -.012em; color: var(--ink); margin: 0; }
.digest-body { margin: 9px 0 0; color: var(--ink-soft); font-size: 14.5px; line-height: 1.65; }
.digest-foot { margin-top: 11px; font-size: 11.5px; color: var(--muted); }
/* loading shimmer while the first briefing is written */
.digest-skeleton { display: flex; flex-direction: column; gap: 9px; padding: 3px 0 5px; }
.digest-skeleton span { height: 12px; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.13), rgba(255,255,255,.05)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.digest-skeleton span:nth-child(1) { width: 95%; }
.digest-skeleton span:nth-child(2) { width: 88%; }
.digest-skeleton span:nth-child(3) { width: 70%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- feed + cards */
.feed { display: flex; flex-direction: column; gap: 22px; padding: 22px 0 10px; }
/* Only cards arriving for the first time animate. Re-ordering the feed re-attaches
   existing nodes, and if the animation lived on .topic-wrap itself every card would
   replay the fade on every keystroke — which is exactly what made searching flash. */
.topic-wrap.enter { animation: rise .4s ease both; }
/* and while typing, nothing animates at all: the list should just settle */
#feed.searching .topic-wrap.enter { animation: none; }
.topic-wrap.dragging { opacity: .45; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.card {
  position: relative;
  background: linear-gradient(180deg, var(--panel), #11131b);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 18px;
  transition: transform .16s ease, border-color .2s ease, box-shadow .2s ease;
}
.card:hover { border-color: rgba(138,162,255,.28); }
.topic-wrap.dragging .card { box-shadow: 0 18px 44px rgba(0,0,0,.5); }

/* topic bar (TOP of every card) */
.topic-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 11px; }
.cat-chip {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; border-radius: 999px;
  padding: 3px 9px; border: 1px solid transparent; cursor: default;
}
.cat-chip.business { color: var(--accent-2); background: rgba(255,178,124,.12); border-color: rgba(255,178,124,.26); }
.cat-chip.tech { color: var(--accent); background: rgba(138,162,255,.13); border-color: rgba(138,162,255,.3); }
.cat-chip.nz { color: var(--accent-3); background: rgba(126,214,166,.12); border-color: rgba(126,214,166,.28); }
.cat-chip.editable { cursor: pointer; }
.cat-chip.editable:hover { filter: brightness(1.18); }
.topic-name { font-family: var(--serif); font-weight: 700; font-size: 19px; letter-spacing: -.012em; color: var(--ink); }
.topic-name.add-label { font-family: var(--sans); font-weight: 600; font-size: 12.5px; color: var(--muted); cursor: pointer; border: 1px dashed var(--line); border-radius: 999px; padding: 3px 10px; }
.topic-name.add-label:hover { color: var(--accent); border-color: rgba(138,162,255,.4); }
/* a standalone link's commentary, promoted into the topic title slot — present it
   AS the topic title (inherits .topic-name's weight/size, not the italic note look) */
.topic-name.promoted-note { flex: 1 1 auto; min-width: 0; }
.topic-edit { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px; opacity: 0; transition: opacity .15s ease, color .2s ease; }
.card:hover .topic-edit { opacity: 1; }
.topic-edit:hover { color: var(--accent); }
.topic-count { font-size: 12px; color: var(--muted); margin-left: auto; }

/* Copy this post's own link. Reader-facing, unlike the admin's ✎ beside it, so it
   stays visible instead of waiting for a hover — a phone has no hover to wait for,
   and sharing is mostly what a phone is for. */
.topic-share {
  margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 7px; line-height: 1; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 999px;
  color: var(--muted);
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}
.topic-count + .topic-share { margin-left: 0; }   /* the count already pushed us right */
.topic-share:hover { color: var(--accent); background: rgba(138,162,255,.08); border-color: rgba(138,162,255,.3); }
.topic-share.copied { color: var(--accent-3); background: rgba(126,214,166,.1); border-color: rgba(126,214,166,.32); }
.share-said { font-size: 11.5px; font-weight: 600; }

/* ---------------------------------------------------------------- single post (/p/<id>)
   One card on its own, with the two ways back into the blog: a quiet one above for
   anyone who arrived knowing where they were, and an inviting one below for whoever
   followed a shared link and has just finished reading. */
.post-back {
  display: inline-block; margin: 20px 0 0; font-size: 13px; font-weight: 600;
  color: var(--muted); text-decoration: none; transition: color .2s ease;
}
.post-back:hover { color: var(--accent); }
.post-more {
  display: block; margin: 4px 0 10px; padding: 13px;
  text-align: center; font-size: 13.5px; font-weight: 600;
  color: var(--muted); text-decoration: none;
  border: 1px dashed var(--line); border-radius: 12px;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.post-more:hover { color: var(--accent); border-color: rgba(138,162,255,.4); background: rgba(138,162,255,.06); }
.post-more .arrow { transition: transform .18s ease; display: inline-block; }
.post-more:hover .arrow { transform: translateX(3px); }

/* card-level controls */
.drag-handle, .card-delete {
  position: absolute; top: 12px; width: 28px; height: 28px; display: grid; place-items: center;
  background: rgba(10,11,15,.72); border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; opacity: 0; z-index: 3; backdrop-filter: blur(4px);
  transition: opacity .15s ease, background .2s ease, color .2s ease;
}
.drag-handle { left: 12px; color: var(--muted); cursor: grab; user-select: none; touch-action: none; }
.card-delete { right: 12px; color: var(--ink-soft); }
.card:hover .drag-handle, .card:hover .card-delete { opacity: 1; }
.drag-handle:hover { color: var(--ink); background: #20232f; }
.drag-handle:active { cursor: grabbing; }
.card-delete:hover { background: #5b1d22; color: #ffd9dc; border-color: #7a2a30; }

/* ---------------------------------------------------------------- articles */
.articles { display: flex; flex-direction: column; gap: 12px; }
.article { position: relative; }

/* the article card: ONLY link-derived content (source, image, title, summary, tags) */
.art-card {
  position: relative;
  background: rgba(255,255,255,.018);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 13px 14px;
  transition: border-color .2s ease, background .2s ease;
}
.art-card:hover { border-color: var(--line); background: rgba(255,255,255,.032); }

.art-row { display: flex; gap: 14px; align-items: flex-start; }
.art-thumb { flex: none; width: 116px; height: 82px; object-fit: cover; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-soft); }
.art-thumb-ph { background: linear-gradient(135deg, #1a1d28, #14161f); }
.art-main { flex: 1 1 auto; min-width: 0; }

/* commentary = YOUR note, a distinct callout sitting above the article card */
.commentary {
  border-left: 2px solid var(--accent-2);
  background: rgba(255,178,124,.06);
  padding: 7px 12px; margin: 0 0 9px;
  border-radius: 0 8px 8px 0;
  color: var(--ink-soft); font-style: italic; font-size: 14px; line-height: 1.5;
}

.kicker { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.kicker img { width: 15px; height: 15px; border-radius: 4px; flex: none; background: var(--panel-2); }
.kicker .dot { opacity: .5; }
.kicker .src { color: var(--ink-soft); font-weight: 500; }

.art-title {
  display: inline-block; font-family: var(--serif); font-weight: 600; font-size: 16px;
  line-height: 1.35; letter-spacing: -.01em; color: var(--ink-soft); margin: 0;
  background-image: linear-gradient(currentColor, currentColor); background-size: 0% 1.5px;
  background-repeat: no-repeat; background-position: 0 100%; transition: background-size .25s ease;
}
.art-title:hover { background-size: 100% 1.5px; }
.summary { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
/* A card holding several articles is a running story, not five posts stacked up — clamp
   each summary to a couple of lines so it doesn't take over the feed. The full text is
   still in the DOM for anything reading the page rather than looking at it. */
.topic-wrap.multi .summary {
  display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.topic-wrap.multi .art-thumb { width: 92px; height: 66px; }

.art-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; }
.read-original { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--accent); }
.read-original .arrow { transition: transform .18s ease; }
.read-original:hover .arrow { transform: translateX(3px); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.tag { font-size: 11px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line-soft); padding: 2px 8px; border-radius: 999px; }

.art-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 5px; opacity: 0; transition: opacity .15s ease; z-index: 2; }
.art-card:hover .art-actions { opacity: 1; }
.art-act { width: 26px; height: 26px; display: grid; place-items: center; background: rgba(10,11,15,.6); color: var(--ink-soft); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: 12px; transition: background .2s ease, color .2s ease; }
.art-act:hover { background: #20232f; color: var(--ink); }

.add-link-btn {
  margin-top: 14px; width: 100%; padding: 8px 12px;
  font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--muted);
  background: transparent; border: 1px dashed var(--line); border-radius: 11px; cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.add-link-btn:hover { color: var(--accent); border-color: rgba(138,162,255,.4); background: rgba(138,162,255,.06); }

/* drafts (admin only): AI-suggested entries awaiting approval */
.draft-badge { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; border-radius: 999px; padding: 3px 9px; color: var(--accent-2); background: rgba(255,178,124,.14); border: 1px solid rgba(255,178,124,.4); }
.is-draft .card { border-color: rgba(255,178,124,.32); }
.is-draft .card:hover { border-color: rgba(255,178,124,.5); }
.draft-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.draft-decide { display: flex; gap: 8px; margin-left: auto; }
.btn-sm { font-size: 13px; padding: 8px 14px; }
/* explicit Business|Tech toggle for reviewing drafts */
.seg-group { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg { font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--muted); background: transparent; border: none; padding: 7px 14px; cursor: pointer; transition: background .15s ease, color .15s ease; }
.seg:hover { color: var(--ink); }
.seg.active { color: var(--accent-ink); }
.seg[data-setcat="business"].active { background: linear-gradient(180deg, #ffc89a, var(--accent-2)); }
.seg[data-setcat="tech"].active { background: linear-gradient(180deg, #9fb2ff, var(--accent)); }
.seg[data-setcat="nz"].active { background: linear-gradient(180deg, #9ce2bd, var(--accent-3)); }
[data-reject]:hover { background: #5b1d22; color: #ffd9dc; border-color: #7a2a30; }
.chip-draft.active { color: var(--accent-ink); background: linear-gradient(180deg, #ffc89a, var(--accent-2)); border-color: transparent; }

/* ---------------------------------------------------------------- states */
.loading { display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--muted); padding: 60px 0; }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-mark { font-size: 34px; color: var(--accent); filter: drop-shadow(0 0 16px rgba(138,162,255,.5)); }
.empty h2 { font-family: var(--serif); color: var(--ink); font-weight: 600; font-size: 24px; margin: 14px 0 6px; }
.empty p { margin: 0 0 20px; }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); border-top-color: #fff; display: inline-block; animation: spin .7s linear infinite; flex: none; }
.btn-accent .spinner { border-color: rgba(10,11,15,.35); border-top-color: var(--accent-ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- footer */
.site-footer { color: var(--muted); font-size: 13px; text-align: center; padding: 40px 20px 56px; }
.site-footer a { color: var(--ink-soft); text-decoration: underline; text-underline-offset: 2px; }

/* ---------------------------------------------------------------- modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(5,6,9,.66); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 480px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: pop .2s ease; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-sm { max-width: 400px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 15px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field .muted { color: var(--muted); font-weight: 400; }
.field-hint { font-size: 12px; color: var(--muted); }
.field input, .field select {
  width: 100%; font-family: var(--sans); font-size: 15px; color: var(--ink);
  background: #0d0f16; border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 13px; outline: none; transition: border-color .18s ease, box-shadow .18s ease;
}
.field input::placeholder { color: #5d6473; }
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(138,162,255,.18); }
.field input:disabled { color: var(--muted); opacity: .8; }
.cat-select { display: flex; gap: 8px; }
.cat-select .chip.active { color: var(--accent-ink); }
.modal-error { color: #ff9ba3; font-size: 13.5px; margin: 0 0 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------------------------------------------------------------- stats (admin) */
.chip-stats.active { color: var(--accent-ink); background: linear-gradient(180deg, #9fb2ff, var(--accent)); border-color: transparent; }
.stats { padding: 22px 0 10px; display: flex; flex-direction: column; gap: 18px; }
.stats-loading { display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--muted); padding: 50px 0; }
.stats-empty { color: var(--muted); text-align: center; padding: 26px 0; margin: 0; }
.stats-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.stats-block {
  background: linear-gradient(180deg, var(--panel), #11131b);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 18px;
}
.stats-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.stats-head h3 { font-family: var(--serif); font-weight: 600; font-size: 16px; margin: 0; letter-spacing: -.01em; }
.stats-note { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* KPI row — a handful of headline numbers, not a chart */
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-tile {
  display: flex; flex-direction: column; gap: 3px; padding: 14px 15px 13px;
  background: linear-gradient(180deg, var(--panel), #11131b);
  border: 1px solid var(--line); border-radius: 13px;
}
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
/* proportional figures: tabular-nums makes a big standalone number read loose */
.stat-value { font-family: var(--sans); font-weight: 600; font-size: 27px; line-height: 1.15; color: var(--ink); letter-spacing: -.02em; }
.stat-hint { font-size: 11.5px; color: var(--muted); }

/* single-series column strip: views per bucket, one hue, no legend needed */
.sbar { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 132px; border-bottom: 1px solid var(--line); }
/* the column owns the full slot; the BAR is capped at 24px and centred in it, so the
   slot's leftover reads as air instead of a fat block */
.sbar-col { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; cursor: default; }
.sbar-fill { width: 100%; max-width: 24px; background: var(--accent); border-radius: 4px 4px 0 0; transition: filter .15s ease; }
.sbar-col:hover .sbar-fill, .sbar-col:focus-visible .sbar-fill { filter: brightness(1.25); }
/* anchored to the strip, not the column: an edge bar's tooltip can't overflow the
   card, and sitting inside the plot keeps it clear of the heading */
.sbar-tip {
  position: absolute; left: 50%; top: 4px; transform: translateX(-50%);
  max-width: 96%; white-space: nowrap; font-size: 12px; color: var(--ink-soft);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 10px; opacity: 0; pointer-events: none; transition: opacity .12s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,.45); font-variant-numeric: tabular-nums; z-index: 4;
}
.sbar-col:hover .sbar-tip, .sbar-col:focus-visible .sbar-tip { opacity: 1; }
.sbar-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); padding-top: 7px; font-variant-numeric: tabular-nums; }

/* per-article table — past ~7 rows a table beats any chart */
.stats-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.stats-table th { text-align: right; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 0 0 9px 12px; white-space: nowrap; }
.stats-table th:first-child { text-align: left; padding-left: 0; }
.stats-table td { text-align: right; padding: 9px 0 9px 12px; border-top: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.stats-table td:first-child { text-align: left; padding-left: 0; }
.sa-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sa-title a { color: var(--ink); }
.sa-title a:hover { color: var(--accent); }
.sa-src { font-size: 11.5px; color: var(--muted); }
.stats-table .muted { color: var(--muted); }

/* breakdowns — the bar carries magnitude, the text stays in ink tokens */
.stats-minis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stats-mini { background: linear-gradient(180deg, var(--panel), #11131b); border: 1px solid var(--line); border-radius: 13px; padding: 14px 15px 12px; }
.stats-mini h4 { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.stats-mini ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.stats-mini li { position: relative; display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 4px 8px; border-radius: 7px; overflow: hidden; }
.sl-bar { position: absolute; inset: 0 auto 0 0; background: rgba(138,162,255,.15); border-radius: 7px; }
.sl-name { position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.sl-n { position: relative; color: var(--muted); font-variant-numeric: tabular-nums; }
.stats-foot { font-size: 11.5px; color: var(--muted); text-align: center; margin: 0; line-height: 1.8; }
.stats-foot a { color: var(--ink-soft); text-decoration: underline; text-underline-offset: 2px; }

/* ---------------------------------------------------------------- videos (admin) */
/* A grid of tiles wants more room than a column of prose: the blog's 720px measure
   would put two narrow tiles a row on a laptop. */
.wrap-wide { max-width: 1120px; }
.videos-page .vid-grid {
  display: grid; gap: 18px; padding: 24px 0 10px;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
}
.vid-tile {
  position: relative; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--panel), #11131b);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  animation: rise .4s ease both;
  transition: border-color .2s ease, transform .16s ease, box-shadow .2s ease;
}
.vid-tile:hover { border-color: rgba(138,162,255,.3); box-shadow: 0 12px 30px rgba(0,0,0,.3); }

/* the whole poster is the play button — a small glyph target isn't worth defending */
.vid-thumb {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9;
  padding: 0; border: none; background: var(--panel-2); cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
}
.vid-poster { width: 100%; height: 100%; object-fit: cover; display: block; }
.vid-poster-ph { background: linear-gradient(135deg, #1a1d28, #14161f); }
.vid-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; opacity: .82; transition: opacity .18s ease, transform .18s ease;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,.7));
}
.vid-thumb:hover .vid-play { opacity: 1; transform: scale(1.12); }
.vid-dur {
  position: absolute; right: 8px; bottom: 8px; font-size: 11.5px; font-weight: 600;
  color: var(--ink); background: rgba(5,6,9,.78); border-radius: 6px; padding: 2px 6px;
  font-variant-numeric: tabular-nums; backdrop-filter: blur(3px);
}
/* the file is gone but the row survived — a restore, since videos aren't backed up */
.vid-tile.is-gone { opacity: .72; }
.vid-tile.is-gone .vid-thumb { cursor: default; }
.vid-tile.is-gone .vid-title { cursor: default; }
.vid-tile.is-gone .vid-title:hover { color: var(--ink); }
.vid-gone {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: 0 14px; font-size: 12px; font-weight: 600; color: var(--accent-2);
}
.vid-body { padding: 12px 14px 13px; display: flex; flex-direction: column; gap: 5px; flex: 1 1 auto; }
.vid-title {
  font-family: var(--serif); font-weight: 600; font-size: 15.5px; line-height: 1.35;
  letter-spacing: -.01em; color: var(--ink); margin: 0; cursor: pointer;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.vid-title:hover { color: var(--accent); }
.vid-note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.vid-foot {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-top: auto; padding-top: 6px; font-size: 11.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.vid-actions { position: absolute; top: 9px; right: 9px; display: flex; gap: 5px; opacity: 0; transition: opacity .15s ease; }
.vid-tile:hover .vid-actions { opacity: 1; }

/* drop target — the empty state, and what the whole page turns into mid-drag */
.dropzone {
  margin-top: 26px; padding: 54px 24px; text-align: center; cursor: pointer;
  border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted);
  background: rgba(255,255,255,.012); transition: border-color .2s ease, background .2s ease;
}
.dropzone:hover { border-color: rgba(138,162,255,.4); background: rgba(138,162,255,.05); }
.dz-mark { font-size: 30px; color: var(--accent); filter: drop-shadow(0 0 16px rgba(138,162,255,.5)); }
.dropzone h2 { font-family: var(--serif); color: var(--ink); font-weight: 600; font-size: 22px; margin: 12px 0 6px; }
.dropzone p { margin: 0; font-size: 13.5px; }
body.dragging-file .dropzone { border-color: var(--accent); background: rgba(138,162,255,.09); }
body.dragging-file::after {
  content: ""; position: fixed; inset: 0; z-index: 40; pointer-events: none;
  border: 2px dashed rgba(138,162,255,.55); border-radius: 10px; margin: 8px;
}

/* upload queue — one row per file, progress and whatever went wrong */
.up-queue { display: flex; flex-direction: column; gap: 10px; padding: 22px 0 0; }
.uq-row {
  background: linear-gradient(180deg, var(--panel), #11131b);
  border: 1px solid var(--line); border-radius: 13px; padding: 12px 14px;
}
.uq-row.is-err { border-color: rgba(255,155,163,.4); }
.uq-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.uq-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; color: var(--ink); }
.uq-size, .uq-pct { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.uq-pct { color: var(--accent); font-weight: 600; min-width: 36px; text-align: right; }
.uq-ok { font-size: 12px; font-weight: 600; color: var(--accent-3); flex: none; }
.uq-err { font-size: 12px; color: #ff9ba3; flex: none; }
.uq-warn { display: block; margin-top: 8px; font-size: 11.5px; color: var(--accent-2); line-height: 1.5; }
.uq-bar { height: 5px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; }
.uq-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #9fb2ff); transition: width .2s ease; }

/* player — the video gets the screen; the caption sits under it */
.lightbox { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lb-inner { width: 100%; max-width: 1000px; display: flex; flex-direction: column; gap: 12px; }
.lb-inner video {
  width: 100%; max-height: 76vh; background: #000; border-radius: 14px;
  border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.65); display: block;
}
.lb-meta { text-align: center; }
.lb-meta h2 { font-family: var(--serif); font-weight: 600; font-size: 19px; margin: 0 0 4px; color: var(--ink); }
.lb-meta p { margin: 0 0 5px; font-size: 14px; color: var(--ink-soft); }
.lb-facts { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-close { position: fixed; top: 14px; right: 16px; font-size: 20px; color: var(--ink-soft); z-index: 2; }

@media (max-width: 600px) {
  .videos-page .vid-grid { grid-template-columns: 1fr; gap: 14px; }
  .dropzone { padding: 40px 18px; }
  .lb-inner video { max-height: 60vh; border-radius: 10px; }
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 600px) {
  .stat-tiles { grid-template-columns: repeat(2, 1fr); }
  .stats-minis { grid-template-columns: 1fr; }
  .stat-value { font-size: 23px; }
  .stats-block { padding: 14px 15px 16px; }
  .stats-table { font-size: 12.5px; }
  .stats-table th, .stats-table td { padding-left: 8px; }
  .sbar-tip { white-space: normal; text-align: center; font-size: 11.5px; }
  .brand-tagline { display: none; }
  /* Side-by-side leaves the summary a ~150px column — three words a line. On a phone
     the image goes full width and the text gets the whole card. */
  .art-row { flex-direction: column; gap: 10px; }
  .art-thumb { width: 100%; height: 160px; }
  .topic-wrap.multi .art-thumb { width: 100%; height: 120px; }
  .art-title { font-size: 16px; }
  .topic-name { font-size: 19px; }
  .summary { font-size: 14px; }
  .card { padding: 14px 15px 16px; }
  .art-card { padding: 11px 12px; }
  .digest-lead { font-size: 16.5px; }
  .digest-inner { padding: 14px 15px 13px; }
}

/* iOS Safari zooms into any field whose text is under 16px, which throws the page out of
   view the moment you tap the search box — results included. 16px is the threshold, and
   it's the only fix that doesn't involve disabling pinch-zoom, which is worse. */
@media (pointer: coarse) {
  .search input, .field input, .field select { font-size: 16px; }
  /* With the keyboard up there are only ~340px of screen left under two sticky bars,
     so while you're typing the filters step aside and give it back to the results. */
  .filter-bar.keyboard .chips { display: none; }
}
