:root {
  --ink: #14161d;
  --surface: #1c2029;
  --surface-2: #232834;
  --line: rgba(233, 231, 224, 0.09);
  --text: #e9e7e0;
  --muted: #8d909b;
  --faint: #5c5f6a;

  --left: #5b8def;
  --left-soft: #8fb1f4;
  --center: #a89f8c;
  --right: #e0584d;
  --right-soft: #ec8a82;

  --serif: "Fraunces", georgia, serif;
  --sans: "Instrument Sans", system-ui, sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, monospace;

  --r: 14px;
}

* { box-sizing: border-box; }

/* Author rules that set `display` (e.g. .spinner, .auth-modal) would otherwise
   beat the user-agent [hidden] style. Make the hidden attribute authoritative
   so toggling `element.hidden` reliably shows/hides across the whole app. */
[hidden] { display: none !important; }

html { background: var(--ink); }

body {
  margin: 0 auto;
  max-width: 720px;
  padding: 0 16px calc(40px + env(safe-area-inset-bottom));
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

:focus-visible { outline: 2px solid var(--left-soft); outline-offset: 2px; border-radius: 4px; }

.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; }
.c-left { color: var(--left-soft); }
.c-right { color: var(--right-soft); }

/* ---------- masthead ---------- */

.masthead {
  position: static;
  top: 0;
  z-index: 20;
  margin: 0 -16px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 10px;
  /* Solid, fully opaque background. The previous translucent + backdrop-filter
     let stories bleed through while scrolling (looked like the bar covered the
     feed) and rendered inconsistently on mobile browsers, where backdrop-filter
     support is spotty. A solid fill is consistent everywhere. */
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}

.brand-row { display: flex; align-items: center; justify-content: space-between; }

.wordmark {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.01em;
}
.wordmark em { font-style: italic; font-weight: 500; color: var(--center); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--muted);
  transition: color 0.15s, transform 0.4s;
}
.icon-btn:hover { color: var(--text); }
.icon-btn.spin svg { animation: spin 0.7s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

/* aggregate tilt bar */
.tilt { margin-top: 10px; }
.tilt-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface-2);
}
.tilt-bar span { transition: flex-grow 0.5s ease; }
.tilt-caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 5px;
}
.tilt-label { font-size: 11px; color: var(--faint); letter-spacing: 0.06em; text-transform: uppercase; }

/* filters & controls */
.controls { 
  display: flex; 
  flex-direction: column; 
  gap: 12px; 
  margin-top: 12px;
  width: 100%;
}

/* Dedicated scrolling track wrapper */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto !important;
  scroll-behavior: smooth;
  padding-bottom: 6px;
  margin-bottom: -4px;
  flex-wrap: nowrap !important; 
  width: 100%;                  
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-grow: 1;              /* Allow full width tracking expansions */
  min-height: 31px;          /* FIXED: Reserves space so text insertion never expands layout heights */
}
.chips::-webkit-scrollbar { display: none !important; }

.chip {
  flex: 0 0 auto !important; /* Strictly forbids pills from collapsing or compressing */
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface);
  transition: color 0.15s, border-color 0.15s;
}
.chip:hover { color: var(--text); }
.chip.is-active { color: var(--ink); background: var(--text); border-color: var(--text); font-weight: 500; }

/* Isolated switch container layout fixes */
.switch { 
  display: inline-flex; 
  align-items: center; 
  gap: 8px; 
  cursor: pointer; 
  user-select: none;
  align-self: flex-start; 
  flex-shrink: 0;
  margin-top: 4px;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 32px; height: 18px;
  border-radius: 9px;
  background: var(--surface-2);
  position: relative;
  transition: background 0.15s;
  flex: 0 0 auto;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .track { background: var(--center); }
.switch input:checked + .track::after { transform: translateX(14px); background: var(--ink); }
.switch input:focus-visible + .track { outline: 2px solid var(--left-soft); outline-offset: 2px; }
.switch-label { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ---------- feed ---------- */

#feed { padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-main {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  width: 100%;
  text-align: left;
  padding: 14px 16px 12px;
}

.card-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.03em;
}

/* Translucent pill styles for distinct visual contrast */
.lean {
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid;
}
.lean-left       { color: var(--left-soft);  background: rgba(91, 141, 239, 0.14);  border-color: color-mix(in srgb, var(--left) 45%, transparent); }
.lean-lean_left  { color: var(--left-soft);  background: rgba(91, 141, 239, 0.08);  border-color: color-mix(in srgb, var(--left) 30%, transparent); }
.lean-center     { color: var(--center);     background: rgba(168, 159, 140, 0.14); border-color: color-mix(in srgb, var(--center) 40%, transparent); }
.lean-lean_right { color: var(--right-soft); background: rgba(224, 88, 77, 0.08);   border-color: color-mix(in srgb, var(--right) 30%, transparent); }
.lean-right      { color: var(--right-soft); background: rgba(224, 88, 77, 0.14);   border-color: color-mix(in srgb, var(--right) 45%, transparent); }
.lean-mixed      { color: var(--text);       background: rgba(141, 144, 155, 0.18); border-color: var(--line); }
.lean-pending    { color: var(--faint);      background: transparent;                border-color: var(--line); font-style: italic; text-transform: none; }

.card h2 {
  margin: 7px 0 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

/* Front-of-card summary: ALWAYS clamped to 2 lines via structural CSS. The
   full, unclipped summary string is preserved on the card dataset and injected
   into .card-detail on expand, so truncation never loses data. */
.card .summary {
  margin: 7px 0 0;
  font-size: 14px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Anchor statistics metrics and tags cleanly to card footer floors */
.bar-row { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  margin-top: auto; 
  padding-top: 14px;
}
.bar {
  flex: 1;
  display: flex;
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface-2);
}
.bar span { min-width: 0; }
.seg-left   { background: var(--left); }
.seg-center { background: var(--center); }
.seg-right  { background: var(--right); }
.bar-counts { font-family: var(--mono); font-size: 11px; color: var(--faint); white-space: nowrap; }

.card-topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; padding: 0 16px 14px; }
.topic-tag {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 2px 9px;
  transition: color 0.15s;
}
.topic-tag:hover { color: var(--text); }

/* expanded sources */
.card-detail { border-top: 1px solid var(--line); padding: 4px 16px 12px; }
.card-detail .framing {
  margin: 10px 0 4px;
  padding-left: 10px;
  border-left: 2px solid var(--center);
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--muted);
}
.detail-head {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.source {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.source:last-child { border-bottom: 0; }
.source .dot {
  flex: 0 0 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  position: relative;
  top: 1px;
  align-self: flex-start;
  margin-top: 5px;
}
.source .meta { min-width: 0; }
.source .outlet { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.source a {
  display: block;
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
}
.source a:hover { color: var(--text); text-decoration: underline; }

/* skeletons, empty, error */
.skeleton {
  height: 110px;
  border-radius: var(--r);
  background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%);
  background-size: 200% 100%;
}
@media (prefers-reduced-motion: no-preference) {
  .skeleton { animation: shimmer 1.4s infinite linear; }
  @keyframes shimmer { to { background-position: -200% 0; } }
  .card-detail { animation: unfold 0.18s ease-out; }
  @keyframes unfold { from { opacity: 0; transform: translateY(-4px); } }
}

.notice {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.notice strong { display: block; font-family: var(--serif); font-size: 17px; color: var(--text); margin-bottom: 6px; }

.endcap { text-align: center; padding-top: 28px; color: var(--faint); }

/* ---------- desktop ---------- */

@media (min-width: 880px) {
  body { max-width: 1240px; }

  /* Allow chips container to expand naturally but stay scrollable */
  .chips { 
    flex-wrap: nowrap !important; 
    overflow-x: auto !important; 
    flex-grow: 1;
    max-width: calc(100% - 180px); /* Leaves exact room for the switch */
  }

  /* Keep the items aligned closely without massive artificial gaps */
  .controls {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start; /* Keeps items pushed together naturally */
    gap: 32px;                   /* Uniform, clean spacing between the chips track and the toggle */
    min-height: 31px;            /* FIXED: Keeps row layout tracking locked on load */
  }
  
  /* Push the switch to anchor cleanly next to the dynamic chips track */
  .switch { 
    flex: 0 0 auto; 
    margin-top: 0; 
    margin-left: auto; /* Pushes just the switch to the right edge neatly */
    align-self: center; 
  }

  #feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 14px;
    align-items: stretch;
  }
}

/* ========================================================================= *
 *  Bedrock additions: brand actions, sort field, hero image, detail pane,
 *  settings drawer, sliders, and the source intake manager.
 * ========================================================================= */

.brand-actions { display: flex; align-items: center; gap: 4px; }

/* sort dropdown + multi toggle live together on the right of the controls row */
.control-tail {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.sort-field { display: inline-flex; align-items: center; gap: 8px; }
.sort-label { font-size: 13px; color: var(--muted); }
.sort-field select,
.select-row select,
.source-add select {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
}
.sort-field select:hover { border-color: var(--muted); }

@media (min-width: 880px) {
  .control-tail { margin-left: auto; flex: 0 0 auto; }
}

/* header image on cards */
.card-hero {
  width: 100%;
  aspect-ratio: 16 / 8;
  overflow: hidden;
  background: var(--surface-2);
}
.card-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* expanded detail: full unclamped summary + omissions */
.card-detail .detail-summary {
  margin: 12px 0 2px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
}
.card-detail .omissions {
  margin: 4px 0 8px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13.5px;
}
.card-detail .omissions li { margin: 3px 0; }

/* ---------- drawer ---------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 13, 0.55);
  backdrop-filter: blur(2px);
  z-index: 40;
  animation: fade 0.18s ease-out;
}
@keyframes fade { from { opacity: 0; } }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(420px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  z-index: 41;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -18px 0 50px rgba(0, 0, 0, 0.35);
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top)) 18px 14px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 0; font-family: var(--serif); font-size: 21px; font-weight: 600; }

.drawer-body {
  overflow-y: auto;
  padding: 6px 18px calc(28px + env(safe-area-inset-bottom));
  scrollbar-width: thin;
}

.setting-block { padding: 18px 0; border-bottom: 1px solid var(--line); }
.setting-block:last-child { border-bottom: 0; }
.setting-block h3 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
}
.setting-hint { margin: 0 0 12px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.muted-note { font-size: 13px; color: var(--faint); }

/* gate that dims personalization when signed out */
.personalize-gate.locked { opacity: 0.5; pointer-events: none; filter: grayscale(0.3); }

/* form fields + buttons */
.field input,
.source-add input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  margin-bottom: 8px;
}
.field input::placeholder,
.source-add input::placeholder { color: var(--faint); }

.btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--text); color: var(--ink); border-color: var(--text); }
.btn-primary:hover { opacity: 0.9; }
.btn-danger { color: var(--right-soft); border-color: color-mix(in srgb, var(--right) 40%, transparent); width: 100%; }
.btn-danger:hover { background: rgba(224, 88, 77, 0.1); }

.auth-actions { display: flex; gap: 8px; }
.auth-error { margin: 8px 0 0; font-size: 12.5px; color: var(--right-soft); }

/* omit checklist */
.omit-list { display: flex; flex-wrap: wrap; gap: 8px; }
.omit-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
}
.omit-item input { accent-color: var(--right); }
.omit-item:has(input:checked) { color: var(--text); border-color: var(--right-soft); }

/* sliders */
.slider-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 14px;
  font-size: 13.5px;
  color: var(--text);
}
.slider-row input[type="range"] { grid-column: 1 / 2; width: 100%; accent-color: var(--center); }
.slider-row output { grid-column: 2 / 3; color: var(--muted); min-width: 38px; text-align: right; }
.slider-row span { grid-column: 1 / 3; color: var(--muted); }

.select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  font-size: 13.5px;
}
.switch.wide { display: flex; width: 100%; margin: 0; justify-content: flex-start; gap: 10px; }

/* source manager */
.source-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.source-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.src-meta { flex: 1; min-width: 0; }
.src-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.src-url { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-fail { font-size: 11px; color: var(--right-soft); margin-top: 3px; }
.src-del {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.src-del:hover { color: var(--right-soft); background: rgba(224, 88, 77, 0.1); }

.source-add { display: flex; flex-direction: column; gap: 0; }
.source-add select { margin-bottom: 8px; }

.switch.tiny { margin: 2px 0 0; flex: 0 0 auto; }
.switch.tiny .track { width: 30px; height: 17px; }
.switch.tiny .track::after { width: 13px; height: 13px; }
.switch.tiny input:checked + .track::after { transform: translateX(13px); }

/* ========================================================================= *
 *  Login-gate modal, admin panel, spinner, invite banner
 * ========================================================================= */

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 9, 13, 0.74);
  backdrop-filter: blur(6px);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 26px 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  animation: rise 0.22s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.auth-wordmark { font-size: 24px; margin: 0 0 14px; }
.auth-title { margin: 0 0 16px; font-family: var(--serif); font-size: 20px; font-weight: 600; }
.auth-card .field input { width: 100%; }
.btn-block { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px; }

.auth-disabled-note {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  text-align: center;
}

/* button spinner */
.spinner {
  width: 15px; height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin360 0.6s linear infinite;
}
@keyframes spin360 { to { transform: rotate(360deg); } }
.btn[disabled] { opacity: 0.7; cursor: progress; }
#invite-btn { display: inline-flex; align-items: center; gap: 8px; }

/* admin invite banner */
.invite-banner {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.5;
  animation: fade 0.2s ease-out;
}
.invite-banner.ok { color: #b9e6c3; background: rgba(91, 200, 120, 0.12); border: 1px solid rgba(91, 200, 120, 0.3); }
.invite-banner.warn { color: var(--text); background: var(--surface-2); border: 1px solid var(--line); }
.invite-link { display: inline-block; margin-top: 6px; color: var(--left-soft); word-break: break-all; }

/* ghost button (e.g. "Continue without signing in") */
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  margin-top: 10px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--line); background: var(--surface-2); }

/* ========================================================================= *
 *  Desktop story popout
 * ========================================================================= */

body.modal-open { overflow: hidden; }

.story-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.story-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 13, 0.66);
  backdrop-filter: blur(4px);
  animation: fade 0.18s ease-out;
}
.story-modal-card {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: rise 0.22s ease-out;
}
.story-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  background: color-mix(in srgb, var(--ink) 55%, transparent);
  backdrop-filter: blur(4px);
}
.story-modal-body { overflow-y: auto; scrollbar-width: thin; }
.story-modal-body .card-hero { aspect-ratio: 16 / 7; }
.story-modal-content { padding: 16px 22px 24px; }
.story-modal-title {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.story-modal .bar-row { margin-top: 14px; }
.modal-topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.story-detail { margin-top: 6px; }
.story-detail .detail-summary { margin-top: 14px; }

/* ========================================================================= *
 *  Keyword search box
 * ========================================================================= */

.search-row { position: relative; display: flex; align-items: center; width: 100%; }
.search-icon { position: absolute; left: 13px; color: var(--faint); pointer-events: none; }
#search-input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 36px;
  transition: border-color 0.15s;
}
#search-input::placeholder { color: var(--faint); }
#search-input:focus { border-color: var(--muted); outline: none; }
#search-input::-webkit-search-cancel-button { display: none; }
.search-clear {
  position: absolute;
  right: 10px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  color: var(--faint);
  transition: color 0.15s, background 0.15s;
}
.search-clear:hover { color: var(--text); background: var(--surface-2); }

@media (min-width: 880px) {
  .controls { flex-wrap: wrap; }
  .search-row { flex: 0 0 100%; }
}

/* ========================================================================= *
 *  Admin page
 * ========================================================================= */

.admin-body { max-width: 1100px; }
.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(18px + env(safe-area-inset-top)) 0 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.admin-tag {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  vertical-align: middle;
}
.admin-main { padding-bottom: 60px; }
.admin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.admin-card h2 { margin: 0 0 12px; font-family: var(--serif); font-size: 18px; font-weight: 600; }
.admin-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.admin-card-head h2 { margin: 0; }
.admin-invite { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-invite input {
  flex: 1; min-width: 200px; font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
}

.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--faint); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.admin-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.ta-r { text-align: right; }
.ta-c { text-align: center; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
