/* ==========================================================================
   Fanward Team Hub
   Fanward purple-comic palette (dark only, per brand), calm UI type for daily use.
   ========================================================================== */

:root {
  color-scheme: only dark;

  --bg: #080816;
  --surface: #0f0f24;
  --surface-2: #15152f;
  --surface-3: #1c1c3a;
  --border: rgba(240, 240, 255, 0.08);
  --border-strong: rgba(240, 240, 255, 0.16);

  --text: #f0f0ff;
  --text-2: #c4c4dc;
  --muted: #8b8ba8;

  --primary: #9333ea;
  --primary-hover: #7e22ce; /* darker on hover keeps white text at 7:1 */
  --primary-soft: rgba(147, 51, 234, 0.16);
  --primary-text: #c084fc;

  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --info: #818cf8;
  --info-soft: rgba(129, 140, 248, 0.14);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
  --focus: 0 0 0 3px rgba(168, 85, 247, 0.45);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-brand: 'Rajdhani', 'Inter', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;

  --sidebar-w: 264px;
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--primary-text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 22px; height: 22px; }

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 16px;
}
.brand-mark {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.14em;
  background: linear-gradient(90deg, #c084fc, #9333ea);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub {
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 2px 8px;
}

.nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 10px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--text); }
.nav-item.active .icon { color: var(--primary-text); }
.nav-item .nav-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-soon {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 1px 7px;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
}
.user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 10px;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--primary-soft) center / cover no-repeat;
  color: var(--primary-text);
  flex: none;
}
.user-name { font-size: 0.88rem; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-email { font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Account row: three small icon buttons huddled at the right so the name keeps its room */
.user { gap: 8px; }
.user .avatar { width: 30px; height: 30px; font-size: 0.74rem; }
.user-actions { display: flex; flex: none; gap: 0; margin-right: -4px; }
.user-actions .btn-icon { padding: 6px; }
.an-tops.is-single { grid-template-columns: 1fr; }
.help-line { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--muted); padding: 4px 6px; margin-bottom: 6px; border-radius: var(--radius); text-decoration: none; }
.help-line .icon { width: 14px; height: 14px; }
.help-line:hover { color: var(--text); background: var(--surface-2); }

/* Search: sidebar button, Home bar, and the search box itself */
kbd { font-family: inherit; font-size: 0.68rem; font-weight: 600; color: var(--muted); padding: 2px 6px; border: 1px solid var(--border-strong); border-radius: 6px; white-space: nowrap; }
.search-trigger {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 14px; padding: 9px 10px;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius);
  color: var(--muted); font: inherit; font-size: 0.88rem; cursor: pointer; text-align: left;
}
.search-trigger span { flex: 1; }
.search-trigger:hover { color: var(--text); border-color: rgba(168, 85, 247, 0.5); }
@media (max-width: 900px) { .search-trigger kbd { display: none; } }

.main { min-width: 0; display: flex; flex-direction: column; }

/* Top bar: search, Slack, Monday, the bell and the account menu */
.topbar {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 20;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 40px;
  min-height: 60px;
  background: rgba(8, 8, 22, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-backdrop { display: none; }

.content {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 40px 64px;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 40;
    left: 0;
    width: min(300px, 86vw);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(0, 0, 0, 0.55);
  }
  .content { padding: 24px 16px 48px; }
}

/* --------------------------------------------------------------------------
   Page structure
   -------------------------------------------------------------------------- */

.view { display: none; }
.view.active { display: block; animation: fade-in 0.2s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-header { margin-bottom: 28px; }
.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-text);
  margin-bottom: 8px;
}
.page-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.page-lead { margin-top: 8px; color: var(--text-2); max-width: 640px; }

.section-title { font-size: 1rem; font-weight: 650; margin-bottom: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card + .card { margin-top: 20px; }
/* Side-by-side cards share a row: no stacking gap, or the second card sits lower than the first */
.split > .card + .card, .audience-grid > .card + .card { margin-top: 0; }
@media (max-width: 1000px) { .split > .card + .card, .audience-grid > .card + .card { margin-top: 0; } }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.card-title { font-size: 1rem; font-weight: 650; }
.card-sub { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

/* How it works strip */
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  color: var(--text-2);
}
.steps li::before {
  content: counter(step);
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary-text);
}
.steps strong { color: var(--text); font-weight: 600; display: block; }
@media (max-width: 720px) { .steps { grid-template-columns: 1fr; } }

/* How it works, folded into one line */
.how { margin-bottom: 20px; }
.how > summary {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; margin-left: -10px;
  border-radius: var(--radius); color: var(--text-2); font-size: 0.88rem; font-weight: 600;
  cursor: pointer; list-style: none; user-select: none;
}
.how > summary::-webkit-details-marker { display: none; }
.how > summary:hover { background: var(--surface-2); color: var(--text); }
.how > summary .icon { width: 16px; height: 16px; color: var(--primary-text); }
.how > summary .icon:last-child { color: var(--muted); transition: transform 0.15s; }
.how[open] > summary .icon:last-child { transform: rotate(180deg); }
.how .steps { margin: 10px 0 0; }

/* --------------------------------------------------------------------------
   Home
   -------------------------------------------------------------------------- */

.home-search {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 16px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  color: var(--muted); font: inherit; font-size: 0.95rem; text-align: left; cursor: pointer;
}
.home-search span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-search:hover { border-color: rgba(168, 85, 247, 0.5); color: var(--text-2); }
@media (max-width: 900px) { .home-search kbd { display: none; } }
.home-section { margin-bottom: 28px; }
.home-section[hidden] { display: none; }
.home-panels { margin: 0 0 24px; }
.home-panels > .card { min-width: 0; } /* long links in the lists must not widen the page on phones */
.home-week { margin-bottom: 28px; }
.tool-meta { margin-top: auto; font-size: 0.76rem; font-weight: 600; color: var(--primary-text); }

/* Recent items (Home) and search results share one row style */
.recent-list { display: flex; flex-direction: column; }
.recent-row, .palette-row { display: flex; align-items: center; gap: 8px; }
.recent-row { border-bottom: 1px solid var(--border); }
.recent-row:last-child { border-bottom: 0; }
.recent-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 0;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.recent-open:hover .t { text-decoration: underline; }
.recent-icon { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--radius); background: var(--primary-soft); color: var(--primary-text); }
.recent-text { min-width: 0; display: flex; flex-direction: column; }
.recent-text .t { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-text .m { font-size: 0.76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1100px) { .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tool-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.tool-card:hover { border-color: rgba(168, 85, 247, 0.5); background: var(--surface-2); transform: translateY(-2px); }
.tool-card.is-soon { opacity: 0.78; }
@media (max-width: 420px) { .tool-card { padding: 14px; } .tool-card p { display: none; } }
.tool-card-top { display: flex; justify-content: space-between; align-items: center; }
.tool-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary-text);
}
.tool-card h3 { font-size: 0.95rem; font-weight: 650; }
.tool-card p { font-size: 0.88rem; color: var(--muted); }
.tool-card .go { margin-top: auto; font-size: 0.85rem; font-weight: 600; color: var(--primary-text); display: flex; align-items: center; gap: 6px; }

.help-card {
  margin-top: 28px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-2);
  font-size: 0.9rem;
}
.help-card .icon { color: var(--primary-text); margin-top: 2px; }

/* --------------------------------------------------------------------------
   Pills
   -------------------------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ready { background: var(--success-soft); color: var(--success); }
.pill-soon { background: var(--surface-3); color: var(--muted); }
.pill-building { background: var(--info-soft); color: var(--info); }
.pill-keep { background: var(--success-soft); color: var(--success); }
.pill-cut { background: var(--danger-soft); color: var(--danger); }
.pill-check { background: var(--warning-soft); color: var(--warning); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field { margin-bottom: 18px; }
.label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 6px; }
.label .optional { font-weight: 400; color: var(--muted); }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 6px; }

.input, .select, .textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder, .textarea::placeholder { color: #74749a; }
.input:hover, .select:hover { border-color: rgba(240, 240, 255, 0.26); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: #a855f7; box-shadow: var(--focus); }
.input[readonly] { color: var(--muted); }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b8ba8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

.input-group { display: flex; align-items: stretch; }
.input-prefix {
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  flex: none; /* show the whole address; the box beside it takes what's left */
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.input-group .input { flex: 1; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; min-width: 0; }

.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type="color"] {
  width: 44px;
  height: 38px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.form-error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: var(--danger-soft);
  color: #fecaca;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.22); }
.btn-block { width: 100%; padding: 12px 16px; font-size: 0.95rem; }
.btn-sm { padding: 6px 10px; font-size: 0.8rem; gap: 6px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-icon { padding: 8px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   QR codes & links
   -------------------------------------------------------------------------- */

.qr-result {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.qr-frame {
  display: inline-block;
  padding: 14px;
  background: #fff;
  border-radius: var(--radius);
  line-height: 0;
}
.qr-link {
  margin: 14px 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--primary-text);
  word-break: break-all;
}
.qr-result .btn-row { justify-content: center; }

.link-list { display: flex; flex-direction: column; gap: 10px; }
.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.link-title { font-weight: 600; font-size: 0.93rem; }
.link-short { font-family: var(--font-mono); font-size: 0.8rem; color: var(--primary-text); }
.link-dest { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 4px; font-size: 0.78rem; color: var(--muted); }
.link-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.link-actions [data-act="delete"], .link-actions .is-disabled { margin-left: auto; }

.empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
  font-size: 0.9rem;
}
.empty .icon { width: 28px; height: 28px; color: var(--primary-text); margin-bottom: 8px; }

/* --------------------------------------------------------------------------
   Transcriber
   -------------------------------------------------------------------------- */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 20px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover { border-color: #a855f7; background: var(--primary-soft); }
.dropzone .icon { width: 30px; height: 30px; color: var(--primary-text); }
.dropzone-title { font-weight: 600; }
.dropzone-hint { font-size: 0.82rem; color: var(--muted); }

.file-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}
.file-chip .icon { color: var(--primary-text); }
.file-chip-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.file-chip-size { color: var(--muted); }

.progress { margin-top: 14px; }
.progress-bar { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #9333ea, #c084fc); border-radius: 999px; transition: width 0.3s; }
.status { margin-top: 10px; font-size: 0.86rem; color: var(--text-2); }
.status.is-error { color: var(--danger); }
.status.is-done { color: var(--success); }

.output {
  min-height: 340px;
  max-height: 560px;
  overflow-y: auto;
  padding: 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--text-2);
}
.output.is-empty { display: grid; place-items: center; text-align: center; color: var(--muted); }

/* --------------------------------------------------------------------------
   Coming soon
   -------------------------------------------------------------------------- */

.soon-card { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start; }
.soon-card .tool-icon { width: 52px; height: 52px; }
.soon-list { margin: 12px 0 0; padding-left: 20px; color: var(--text-2); font-size: 0.92rem; }
.soon-list li { margin-bottom: 6px; }
@media (max-width: 560px) { .soon-card { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   Subscription review
   -------------------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat { padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.stat-label { font-size: 0.8rem; color: var(--muted); }
.stat-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; margin-top: 2px; }
.stat-note { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.table-wrap { overflow-x: auto; margin: 0 -24px -24px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 620px; }
.table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 13px 24px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td:first-child { color: var(--text); font-weight: 600; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Sign-in gate
   -------------------------------------------------------------------------- */

.auth {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at top, rgba(147, 51, 234, 0.18), transparent 60%), var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 36px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-card .brand { justify-content: center; padding: 0 0 18px; }
.auth-title { font-size: 1.3rem; font-weight: 700; }
.auth-lead { color: var(--text-2); font-size: 0.92rem; margin: 8px 0 24px; }
.auth-google { display: flex; justify-content: center; min-height: 44px; }
.auth-help { margin-top: 20px; font-size: 0.8rem; color: var(--muted); }
.auth-divider { margin: 20px 0 14px; border-top: 1px solid var(--border); }
.auth .form-error { margin: 14px 0 0; text-align: left; }

/* --------------------------------------------------------------------------
   Toasts & confirm dialog
   -------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  animation: toast-in 0.2s ease;
}
.toast .icon { color: var(--success); }
.toast.is-error .icon { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 560px) { .toasts { left: 16px; right: 16px; } }

.dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 24px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dialog h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.dialog p { color: var(--text-2); font-size: 0.92rem; margin-bottom: 20px; }
.dialog .btn-row { justify-content: flex-end; }

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

/* --------------------------------------------------------------------------
   Creator link pages
   -------------------------------------------------------------------------- */

.textarea { resize: vertical; min-height: 64px; line-height: 1.5; }

.photo-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.2rem; border: 2px solid var(--border-strong); }

.link-editor { display: flex; flex-direction: column; gap: 8px; }
.link-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.link-edit-row.is-hidden { opacity: 0.55; }
.link-edit-fields { display: grid; gap: 6px; }
.link-edit-fields .input { padding: 8px 10px; font-size: 0.9rem; }
.link-edit-tools { display: flex; flex-direction: column; gap: 2px; }
.link-edit-tools .btn { padding: 5px; }
.link-edit-tools .icon { width: 16px; height: 16px; }
@media (max-width: 560px) {
  .link-edit-row { grid-template-columns: 1fr; }
  .link-edit-tools { flex-direction: row; }
}

.toggle-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.toggle-row input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); flex: none; }

.preview-card { position: sticky; top: 24px; }
.phone-frame {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  aspect-ratio: 9 / 18;
  border: 8px solid #1c1c3a;
  border-radius: 34px;
  overflow: hidden;
  background: #080816;
}
.phone-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (max-width: 1000px) { .preview-card { position: static; } }

.page-row-main { display: flex; gap: 14px; align-items: center; min-width: 0; }
.page-row-main .avatar { width: 46px; height: 46px; }

/* --------------------------------------------------------------------------
   Export comments & giveaway picker
   -------------------------------------------------------------------------- */

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form .input { flex: 1; min-width: 240px; }

.progress-indeterminate { width: 35% !important; animation: indeterminate 1.2s ease-in-out infinite; }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

.filter-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-row .input { flex: 1; min-width: 220px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 0.88rem; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }

.comments-table-wrap { max-height: 460px; overflow-y: auto; margin: 0 -24px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.comments-table th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.comments-table td:nth-child(2) { white-space: pre-wrap; word-break: break-word; min-width: 260px; }
.comments-table .reply-tag { display: block; font-size: 0.75rem; color: var(--muted); font-weight: 400; }

.winner-controls { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.winner-list { display: grid; gap: 10px; margin-top: 18px; }
.winner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px 16px;
  background: var(--success-soft);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: var(--radius);
}
.winner-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--success); color: #062016; font-weight: 700; font-size: 0.85rem; }
.winner-name { font-weight: 700; }
.winner-text { color: var(--text-2); font-size: 0.88rem; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.winner-meta { font-size: 0.8rem; color: var(--muted); }

/* --------------------------------------------------------------------------
   Accounts: sign-in forms, team page
   -------------------------------------------------------------------------- */

.auth-card { text-align: left; }
.auth-card .brand, .auth-title, .auth-lead { text-align: center; }
.auth-form .auth-link { margin-top: 8px; font-weight: 500; color: var(--text-2); }
.auth .form-error, .form-notice { margin: 14px 0 0; }
.form-notice {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--success-soft);
  color: #bbf7d0;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
}

.invite-result { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.invite-result p:first-child { font-size: 0.9rem; margin-bottom: 10px; }
.invite-result .input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); font-family: var(--font-mono); font-size: 0.8rem; }
.invite-result .input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.member-pills { display: inline-flex; gap: 6px; margin-left: 6px; vertical-align: middle; }

/* --------------------------------------------------------------------------
   Admin board
   -------------------------------------------------------------------------- */

.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  padding: 10px 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--primary); }

.board-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-2);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--primary-soft); border-color: rgba(168, 85, 247, 0.5); color: var(--text); }

/* One person: details on top, actions on their own row so nothing gets squeezed */
.person-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 14px;
  row-gap: 12px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.person-row .avatar { width: 42px; height: 42px; grid-row: span 1; }
.person-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.person-name { font-weight: 650; font-size: 0.97rem; }
.person-email { font-size: 0.85rem; color: var(--text-2); margin-top: 2px; word-break: break-all; }
.person-meta { font-size: 0.8rem; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.person-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.person-actions:empty { display: none; }
.person-actions .select { width: auto; padding: 6px 32px 6px 10px; font-size: 0.8rem; }
.person-actions .spacer { flex: 1; }
.pill-disabled { background: var(--danger-soft); color: var(--danger); }
.pill-leader { background: var(--success-soft); color: var(--success); }
.pill-admin { background: var(--info-soft); color: var(--info); }
.pill-plain::before { display: none; }

.role-guide { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.role-guide ul { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: 0.86rem; line-height: 1.6; }

.activity-list { display: flex; flex-direction: column; }
.activity-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: 0; }
.activity-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.activity-dot .icon { width: 15px; height: 15px; }
.activity-dot.is-bad { background: var(--danger-soft); color: var(--danger); }
.activity-dot.is-good { background: var(--success-soft); color: var(--success); }
.activity-text { font-size: 0.9rem; }
.activity-detail { font-size: 0.8rem; color: var(--muted); }
.activity-time { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 560px) {
  .activity-item { grid-template-columns: auto minmax(0, 1fr); }
  .activity-time { grid-column: 2; }
}
.table tfoot td { font-weight: 700; color: var(--text); border-top: 1px solid var(--border-strong); }

/* --------------------------------------------------------------------------
   Admin board v2: table-first layout (Monday / Slack / Google admin style)
   -------------------------------------------------------------------------- */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.board-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

.attention {
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--warning-soft);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius);
}
.attention-title { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 0.88rem; color: var(--warning); margin-bottom: 8px; }
.attention-items { display: flex; flex-direction: column; gap: 6px; }
.attention-item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 0.9rem; }
.attention-item span { flex: 1; min-width: 200px; }

.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar-search { width: 260px; max-width: 100%; padding: 8px 12px; font-size: 0.88rem; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; flex-wrap: wrap; }
.seg { padding: 6px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: 0.84rem; font-weight: 600; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg:hover { color: var(--text); }
.seg.active { background: var(--surface-3); color: var(--text); }
.seg .count { font-size: 0.72rem; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.seg.active .count { background: var(--primary-soft); color: var(--primary-text); }
/* Phones: filter rows scroll sideways instead of wrapping onto a second line */
@media (max-width: 560px) {
  .table-toolbar .segmented { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .table-toolbar .segmented::-webkit-scrollbar { display: none; }
  .table-toolbar .seg { white-space: nowrap; flex: none; }
}

.bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px; padding: 10px 12px;
  background: var(--primary-soft); border: 1px solid rgba(168, 85, 247, 0.4); border-radius: var(--radius);
  font-size: 0.86rem; font-weight: 600;
}
.bulk-bar #bulkCount { margin-right: 6px; }
.bulk-role { width: auto; padding: 6px 30px 6px 10px; font-size: 0.8rem; }

.data-table-wrap { position: relative; max-width: 100%; min-width: 0; overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th {
  text-align: left; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface);
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover td { background: var(--surface-2); }
.data-table tbody tr.selected td { background: rgba(147, 51, 234, 0.08); }
.data-table tfoot td { font-weight: 700; color: var(--text); border-top: 1px solid var(--border-strong); padding: 10px 14px; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.col-check { width: 36px; }
.col-check input, .data-table td input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.col-menu { width: 44px; text-align: right; }
.cell-person { display: flex; gap: 10px; align-items: center; min-width: 200px; }
.cell-person .avatar { width: 32px; height: 32px; font-size: 0.72rem; }
.cell-name { color: var(--text); font-weight: 600; white-space: nowrap; }
.cell-email { font-size: 0.8rem; color: var(--muted); }
.cell-muted { color: var(--muted); white-space: nowrap; }
.data-table .select.inline-role { width: auto; padding: 5px 28px 5px 9px; font-size: 0.82rem; background-color: transparent; border-color: transparent; }
.data-table .select.inline-role:hover, .data-table .select.inline-role:focus { border-color: var(--border-strong); }
.menu-btn { padding: 6px; }
.table-foot { margin-top: 10px; }
.empty-cell { text-align: center; color: var(--muted); padding: 28px !important; }

/* Phones: keep person, status and the menu; hide the rest */
@media (max-width: 760px) {
  .data-table .hide-sm { display: none; }
  .cell-person { min-width: 0; }
  .cell-name, .cell-email { white-space: normal; word-break: break-word; }
  .toolbar-search { width: 100%; }
}

/* Row "..." menu */
.row-menu {
  position: fixed; z-index: 60; min-width: 200px; padding: 6px;
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}
.row-menu button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 9px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font-size: 0.86rem; text-align: left; cursor: pointer; }
.row-menu button:hover { background: var(--surface-2); }
.row-menu button.danger { color: var(--danger); }
.row-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* Person side panel */
.drawer-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.5); }
.drawer {
  position: fixed; z-index: 80; top: 0; right: 0; bottom: 0; width: min(440px, 100vw);
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow);
  animation: drawer-in 0.18s ease;
}
@keyframes drawer-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; gap: 12px; padding: 20px; border-bottom: 1px solid var(--border); }
.drawer-person { display: flex; gap: 14px; align-items: center; min-width: 0; }
.drawer-name { font-size: 1.1rem; font-weight: 700; }
.drawer-body { padding: 20px; overflow-y: auto; }
.drawer-section { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 24px 0 10px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 0.88rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; color: var(--text); }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.drawer-activity { display: flex; flex-direction: column; gap: 10px; font-size: 0.86rem; }
.drawer-activity .when { color: var(--muted); font-size: 0.78rem; }

.dialog-wide { width: min(480px, calc(100vw - 32px)); }

/* --------------------------------------------------------------------------
   News
   -------------------------------------------------------------------------- */

.news-list { display: flex; flex-direction: column; gap: 10px; }
.news-item {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.news-item:hover { border-color: rgba(168, 85, 247, 0.5); background: var(--surface-2); }
.news-item.no-image { grid-template-columns: minmax(0, 1fr); }
.news-item.is-own { border-left: 3px solid var(--primary); }
.news-thumb { width: 132px; aspect-ratio: 16 / 10; border-radius: var(--radius-sm); background: var(--surface-3); object-fit: cover; display: block; }
.news-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
.news-meta .source { color: var(--text-2); font-weight: 600; }
.news-title { font-weight: 650; font-size: 0.98rem; line-height: 1.35; color: var(--text); }
.news-summary { font-size: 0.86rem; color: var(--text-2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag-pill { font-size: 0.68rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.tag-pill.own { background: var(--primary-soft); color: var(--primary-text); }
@media (max-width: 560px) {
  .news-item { grid-template-columns: 88px minmax(0, 1fr); gap: 12px; }
  .news-thumb { width: 88px; }
  .news-summary { display: none; }
}

.source-list { display: flex; flex-direction: column; gap: 8px; }
.source-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.source-row.off { opacity: 0.55; }
.source-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--primary); }
.source-name { font-weight: 600; font-size: 0.88rem; }
.source-sub { font-size: 0.76rem; color: var(--muted); }
.source-sub.bad { color: var(--warning); }

.source-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.source-tags .tag-list { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.source-tags .edit-tags { padding: 2px 8px; font-size: 0.74rem; }

/* --------------------------------------------------------------------------
   Analytics (chart colors validated against the card surface #0f0f24:
   blue #3987e5, orange #d95926, aqua #199e70, in that fixed order)
   -------------------------------------------------------------------------- */

:root {
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --grid: #24244a;
  --axis: #34345e;
}
.an-section { font-size: 1.05rem; font-weight: 700; margin: 32px 0 14px; }
.an-section:first-of-type { margin-top: 8px; }
.an-chart-card { margin-top: 16px; }
.an-chart { position: relative; width: 100%; }
.an-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.an-chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.an-chart .gridline { stroke: var(--grid); stroke-width: 1; }
.an-chart .baseline { stroke: var(--axis); stroke-width: 1; }
.an-chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.an-chart .crosshair { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; }
.an-chart .dot { stroke: var(--surface); stroke-width: 2; }
.an-chart .end-label { font-size: 11px; font-weight: 600; fill: var(--text-2); }
.an-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; font-size: 0.82rem; color: var(--text-2); }
.an-legend span { display: inline-flex; align-items: center; gap: 6px; }
.an-legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.an-tables { margin-top: 16px; }

.chart-tip {
  position: fixed; z-index: 90; pointer-events: none; min-width: 150px;
  padding: 8px 10px; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-size: 0.8rem; color: var(--text);
}
.chart-tip .tip-date { color: var(--muted); margin-bottom: 4px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.chart-tip .tip-row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.chart-tip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chart-tip b { font-variant-numeric: tabular-nums; }

.stat-delta { font-size: 0.8rem; margin-top: 4px; color: var(--muted); }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }

.audience-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.audience-card .stat-value { font-size: 1.7rem; }
.audience-card .an-chart { margin-top: 12px; }
.audience-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.platform-tag { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.connect-card { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-2); font-size: 0.9rem; }
.connect-card .icon { color: var(--primary-text); margin-top: 2px; }
.connect-card + .connect-card, .audience-grid + .connect-card { margin-top: 12px; }

.content-toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.content-toolbar .select { width: auto; padding: 7px 32px 7px 10px; font-size: 0.85rem; }
.top-performer { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 16px; align-items: center; margin-bottom: 14px; padding: 14px; background: var(--primary-soft); border: 1px solid rgba(168, 85, 247, 0.35); border-radius: var(--radius-lg); text-decoration: none; color: inherit; }
.top-performer img { width: 160px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-3); }
.top-performer .eyebrow { margin-bottom: 4px; }
.top-performer .title { font-weight: 700; font-size: 1rem; color: var(--text); }
.top-performer .nums { font-size: 0.85rem; color: var(--text-2); margin-top: 6px; }
@media (max-width: 560px) { .top-performer { grid-template-columns: 1fr; } .top-performer img { width: 100%; } }
.cell-content { display: flex; gap: 10px; align-items: center; min-width: 240px; }
.cell-content img { width: 64px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--surface-3); flex: none; }
.cell-content a { color: var(--text); text-decoration: none; font-weight: 600; line-height: 1.35; }
.cell-content a:hover { text-decoration: underline; }
.bar-cell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.bar-cell .bar { height: 6px; border-radius: 3px; background: var(--series-1); min-width: 2px; }

/* Analytics "Top" tables are small: no admin-table minimum width */
#anTopLinks .table, #anTopPages .table { min-width: 0; }
#anTopLinks .table td, #anTopLinks .table th, #anTopPages .table td, #anTopPages .table th { padding-left: 0; padding-right: 12px; }

/* --------------------------------------------------------------------------
   Review fixes
   -------------------------------------------------------------------------- */


.home-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.home-stat { padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.home-stat .n { font-size: 1.5rem; font-weight: 700; }
.home-stat .l { font-size: 0.78rem; color: var(--muted); }
.home-news { display: flex; flex-direction: column; }
.home-news a { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.home-news a:last-child { border-bottom: 0; }
.home-news a:hover .t { text-decoration: underline; }
.home-news .t { font-weight: 600; font-size: 0.92rem; line-height: 1.35; }
.home-news .m { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
@media (max-width: 560px) { .home-stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; } .home-stat .n { font-size: 1.2rem; } }

/* Analytics: section order is set by script (working sections first) */
.an-sections { display: flex; flex-direction: column; }
.an-chart-empty { padding: 32px 12px; text-align: center; color: var(--muted); font-size: 0.9rem; }

/* Admin board activity on phones: time above the sentence */
@media (max-width: 560px) {
  .activity-table thead { display: none; }
  .activity-table tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .activity-table td { display: block; padding: 0; border: 0; }
  .activity-table td:first-child { font-size: 0.76rem; margin-bottom: 2px; }
}

/* --------------------------------------------------------------------------
   Analytics v2: YouTube Studio-style overview
   -------------------------------------------------------------------------- */

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; overflow: hidden; }
.kpi {
  position: relative; text-align: left; padding: 16px 18px 18px; border: 0; border-right: 1px solid var(--border);
  background: transparent; color: var(--text); cursor: pointer; transition: background 0.15s;
}
.kpi:last-child { border-right: 0; }
.kpi:hover { background: var(--surface-2); }
.kpi.active { background: var(--surface-2); }
.kpi.active::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--series-1); }
.kpi .kpi-label { font-size: 0.8rem; color: var(--text-2); }
.kpi .kpi-sub { font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .kpi-value { font-size: 1.6rem; font-weight: 700; margin-top: 4px; line-height: 1.15; }
.kpi .kpi-delta { font-size: 0.78rem; margin-top: 2px; color: var(--muted); }
.kpi .kpi-delta.up { color: var(--success); }
.kpi .kpi-delta.down { color: var(--danger); }
.kpi-chart-card { border-top: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); margin-top: 0 !important; }
@media (max-width: 760px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-bottom: 1px solid var(--border); }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi:last-child:nth-child(odd) { grid-column: span 2; border-right: 0; }
  .kpi .kpi-delta .long { display: none; }
  .kpi .kpi-delta .short { display: inline; }
}
.kpi .kpi-delta .short { display: none; }

.an-tops { margin-top: 20px; }
.top-list { display: flex; flex-direction: column; }
.top-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.top-item:last-child { border-bottom: 0; }
.top-item .rank { width: 18px; color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.top-item img { width: 64px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--surface-3); }
.top-item .what { min-width: 0; }
.top-item .what .t { font-weight: 600; font-size: 0.88rem; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.top-item .what .s { font-size: 0.75rem; color: var(--muted); }
.top-item .val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.top-item .val small { display: block; font-weight: 400; font-size: 0.72rem; color: var(--muted); }
a.top-item:hover .t { text-decoration: underline; }
#anConnect .connect-card { margin-top: 20px; }

/* QR codes: lock */
.lock-pill { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 600; }
.lock-pill .icon { width: 12px; height: 12px; }
.link-actions .is-disabled { opacity: 0.45; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   Notifications (the bell)
   -------------------------------------------------------------------------- */
.bell-btn { position: relative; }
.bell-badge {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--primary); color: #fff; font-size: 0.66rem; font-weight: 700;
  line-height: 16px; text-align: center; box-shadow: 0 0 0 2px var(--surface);
}
.notif-panel {
  position: fixed; z-index: 60; width: 380px; max-height: min(560px, 80vh); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.notif-list .empty { padding: 28px 16px; }
.notif { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.86rem; line-height: 1.45; }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--primary); }
.notif-text { color: var(--text-2); }
.notif-text strong { color: var(--text); }
.notif-text .mono { font-family: var(--font-mono); font-size: 0.76rem; color: var(--muted); }
.notif-status { margin-top: 4px; font-size: 0.78rem; color: var(--muted); }
.notif-when { margin-top: 2px; font-size: 0.74rem; color: var(--muted); }
.notif-actions { display: flex; gap: 8px; margin-top: 8px; }
.notif-open { margin: 6px 0 0 -10px; }
@media (max-width: 900px) {
  .notif-panel { left: 12px; right: 12px; top: calc(64px + env(safe-area-inset-top, 0px)); width: auto; }
}

/* QR codes: who else is allowed to change a locked one */
.access-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: 0.78rem; }
.access-label { color: var(--muted); }
.access-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text-2); }
.access-chip button { display: inline-flex; padding: 3px; border: 0; background: transparent; color: var(--muted); border-radius: 999px; cursor: pointer; }
.access-chip button:hover { color: var(--text); background: var(--surface-3); }
.access-chip .icon { width: 12px; height: 12px; }

/* --------------------------------------------------------------------------
   Phone bottom bar
   -------------------------------------------------------------------------- */
.bottom-bar { display: none; }
@media (max-width: 900px) {
  .bottom-bar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; z-index: 25; left: 0; right: 0; bottom: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(8, 8, 22, 0.96); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
  }
  .bb-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    min-height: 48px; padding: 6px 2px; border: 0; border-radius: var(--radius);
    background: transparent; color: var(--muted); font: inherit; font-size: 0.7rem; font-weight: 600; cursor: pointer;
  }
  .bb-item .icon { width: 22px; height: 22px; }
  .bb-item.active { color: var(--text); }
  .bb-item.active .icon { color: var(--primary-text); }
  .bb-item:active { background: var(--surface-2); }
  .content { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .app.nav-open .bottom-bar { visibility: hidden; }
}

/* --------------------------------------------------------------------------
   Search box (Ctrl K)
   -------------------------------------------------------------------------- */
.palette { width: min(620px, calc(100vw - 24px)); padding: 0; margin: 12vh auto auto; overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.palette-input .icon { color: var(--muted); flex: none; }
.palette-input input:focus, .palette-input input:focus-visible { outline: none; box-shadow: none; } /* the box itself is the focus cue */
.palette-input input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font: inherit; font-size: 1rem; padding: 6px 0; }
.palette-input input::-webkit-search-cancel-button { display: none; }
.palette-results { max-height: min(420px, 60vh); overflow-y: auto; padding: 6px; }
.palette-results .empty { padding: 28px 16px; }
.palette-label { padding: 8px 10px 4px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.palette-row { padding: 8px 10px; border-radius: var(--radius); cursor: pointer; }
.palette-row .recent-text { flex: 1; }
.palette-row.active { background: var(--surface-3); }
.palette-row .btn { flex: none; }
.dialog .palette-foot { margin: 0; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 0.74rem; color: var(--muted); }
@media (max-width: 900px) { .palette { margin-top: 12px; } .palette-foot { display: none; } }

/* A QR code row that search or Home just pointed to */
.link-row.is-flash { animation: flash-row 2.2s ease; }
@keyframes flash-row { 0%, 40% { box-shadow: inset 0 0 0 2px var(--primary); background: var(--primary-soft); } 100% { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .link-row.is-flash { animation: none; box-shadow: inset 0 0 0 2px var(--primary); } }

/* --------------------------------------------------------------------------
   Sidebar: search and the bell share one row, so the bell has room
   -------------------------------------------------------------------------- */
.sidebar-tools { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.sidebar-tools .search-trigger { flex: 1; min-width: 0; margin: 0; }
.sidebar-tools .bell-btn { flex: none; }

/* --------------------------------------------------------------------------
   Team communication
   -------------------------------------------------------------------------- */
.announcements { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.announcements:empty { display: none; }
.announcement {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  background: var(--primary-soft); border: 1px solid rgba(168, 85, 247, 0.35); border-radius: var(--radius-lg);
}
.announcement > .icon { flex: none; color: var(--primary-text); margin-top: 2px; }
.announcement.is-urgent { background: var(--warning-soft); border-color: rgba(251, 191, 36, 0.45); }
.announcement.is-urgent > .icon { color: var(--warning); }
.ann-body { flex: 1; min-width: 0; }
.ann-text { color: var(--text); font-size: 0.95rem; line-height: 1.45; overflow-wrap: anywhere; }
.ann-text a { color: var(--primary-text); }
.ann-meta { margin-top: 4px; font-size: 0.76rem; color: var(--muted); }
.ann-actions { display: flex; align-items: center; gap: 2px; flex: none; margin: -4px -6px 0 0; }
.ann-new { align-self: flex-start; }

.mention { color: var(--primary-text); font-weight: 600; }
.count-badge { margin-left: 2px; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-text); font-size: 0.7rem; line-height: 18px; text-align: center; }

/* Notes thread (QR codes, link pages) */
.notes-box { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.notes-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.notes-empty { font-size: 0.84rem; color: var(--muted); }
.note { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.note-head { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.note-when { color: var(--muted); font-size: 0.76rem; }
.note-del { margin-left: auto; width: 28px; height: 28px; }
.note-text { margin-top: 4px; font-size: 0.9rem; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.note-text a { color: var(--primary-text); }
.notes-input { position: relative; }
.notes-form textarea { resize: vertical; min-height: 60px; }
.notes-form .btn-row { justify-content: flex-end; margin-top: 8px; }
.mention-menu {
  position: absolute; z-index: 70; left: 0; right: 0; top: 100%; margin-top: 4px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}
.mention-opt { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 7px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.mention-opt span { font-size: 0.74rem; color: var(--muted); }
.mention-opt.active, .mention-opt:hover { background: var(--surface-3); }

.notif-quote { margin-top: 6px; padding: 6px 10px; border-left: 2px solid var(--border-strong); color: var(--text-2); font-size: 0.82rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Who's on what */
.project-list { display: flex; flex-direction: column; gap: 8px; }
.project-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 150px 150px 150px; gap: 14px; align-items: center;
  width: 100%; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.project-row:hover { border-color: rgba(168, 85, 247, 0.5); background: var(--surface-2); }
.project-main { min-width: 0; display: flex; flex-direction: column; }
.project-title { font-weight: 600; }
.project-note { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-owner, .project-due { font-size: 0.86rem; color: var(--text-2); }
.is-late { color: var(--danger) !important; }
.status-pill { justify-self: start; padding: 3px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.status-todo { background: var(--surface-3); color: var(--text-2); }
.status-doing { background: var(--primary-soft); color: var(--primary-text); }
.status-waiting { background: var(--warning-soft); color: var(--warning); }
.status-done { background: var(--success-soft); color: var(--success); }
@media (max-width: 760px) {
  .project-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .project-main { grid-column: 1 / -1; }
  .project-owner { grid-column: 1; }
  .project-due { grid-column: 1; }
  .status-pill { grid-column: 2; grid-row: 2 / 4; align-self: center; }
}

/* Resources */
.resource-section { margin-bottom: 28px; }
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.resource-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.resource-head { display: flex; align-items: center; gap: 10px; }
.resource-head h3 { flex: 1; min-width: 0; font-size: 0.95rem; font-weight: 650; }
.resource-note { font-size: 0.86rem; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.resource-note:empty { display: none; }
.resource-note a { color: var(--primary-text); }
.resource-card .btn-row { margin-top: auto; }
.resource-card.is-flash { animation: flash-row 2.2s ease; }

/* Dialog bits */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }
.dialog textarea.input { resize: vertical; }
.dialog-sub { font-size: 0.95rem; font-weight: 650; margin-bottom: 4px; }
.account-digest { margin: 4px 0 2px; white-space: normal; }
.digest-preview { margin: 0; padding: 14px 16px; max-height: 480px; overflow: auto; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-2); font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.55; white-space: pre-wrap; }

/* --------------------------------------------------------------------------
   Fanward's two sides: Fanclub and Marketing
   -------------------------------------------------------------------------- */
:root {
  --fanclub: #f0abfc;
  --fanclub-soft: rgba(240, 171, 252, 0.14);
  --marketing: #7dd3fc;
  --marketing-soft: rgba(125, 211, 252, 0.14);
}
/* When the menu is taller than the screen, a fade at the bottom says there's more to scroll */
.nav.has-more { mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); }

/* Label on every item: pink Fanclub, blue Marketing, grey Both sides */
.side-pill { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; vertical-align: middle; white-space: nowrap; }
.side-fanclub { background: var(--fanclub-soft); color: var(--fanclub); }
.side-marketing { background: var(--marketing-soft); color: var(--marketing); }
.side-both { background: var(--surface-3); color: var(--muted); }

/* Each tool's own All / Fanclub / Marketing filter */
.side-filter .seg.active[data-sf="fanclub"] { background: var(--fanclub-soft); color: var(--fanclub); }
.side-filter .seg.active[data-sf="marketing"] { background: var(--marketing-soft); color: var(--marketing); }
.side-filter .seg.active[data-sf="fanclub"] .count { background: var(--fanclub-soft); color: var(--fanclub); }
.side-filter .seg.active[data-sf="marketing"] .count { background: var(--marketing-soft); color: var(--marketing); }
.list-filter { margin-bottom: 12px; }
.news-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 16px; }
.an-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.chip.chip-fanclub:not(.active) { color: var(--fanclub); }
.chip.chip-marketing:not(.active) { color: var(--marketing); }

/* Top of each tool: what it does for each side */
.side-uses { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; font-size: 0.86rem; color: var(--text-2); }
.side-use { display: flex; align-items: baseline; gap: 8px; }
.side-use .side-pill { margin: 0; flex: none; min-width: 72px; text-align: center; }
.side-use-note { color: var(--muted); font-size: 0.8rem; }

/* Home: tool cards, news groups and stat tiles carry their side */
.tool-sides { display: flex; gap: 4px; margin-top: 10px; }
.tool-sides .side-pill { margin: 0; }
.home-news-head { padding: 10px 0 2px; }
.home-news-head:first-child { padding-top: 0; }
.home-stat .side-pill { margin: 6px 0 0; }
.recent-text .side-pill { margin: 2px 0 0; align-self: flex-start; }
.link-title .side-pill { margin: 0 0 0 6px; }
.resource-head .side-pill { margin: 0; }
.project-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.project-title-row .side-pill { margin: 0; }

/* Fanclub / Marketing / Both inside forms */
.side-pick { display: inline-grid; grid-template-columns: repeat(3, auto); gap: 2px; padding: 3px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.side-pick button { padding: 7px 14px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-2); font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer; }
.side-pick button:hover { color: var(--text); }
.side-pick button[aria-checked="true"] { background: var(--surface-3); color: var(--text); }
.side-pick button[aria-checked="true"][data-pick="fanclub"] { background: var(--fanclub-soft); color: var(--fanclub); }
.side-pick button[aria-checked="true"][data-pick="marketing"] { background: var(--marketing-soft); color: var(--marketing); }
.side-pick + .hint { margin-top: 6px; }

/* Slack and Monday: one click from anywhere */
.app-links { display: flex; align-items: center; gap: 6px; margin: -4px 0 12px; }
.app-link {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; padding: 7px 6px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg);
  color: var(--text-2); font-size: 0.84rem; font-weight: 600; text-decoration: none; cursor: pointer;
}
.app-link:hover { color: var(--text); background: var(--surface-2); }
.app-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-link .icon { width: 16px; height: 16px; flex: none; }
.app-chip { padding: 5px 10px; margin-right: 2px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text-2); font-size: 0.8rem; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.app-chip:hover { color: var(--text); background: var(--surface-2); }
.app-link.is-unset, .app-chip.is-unset { opacity: 0.55; }
.app-links .btn-icon { padding: 5px; margin-right: -4px; }
.app-links .btn-icon .icon { width: 15px; height: 15px; }

/* --------------------------------------------------------------------------
   Layout: the top bar holds the everyday buttons, the sidebar is just the menu
   -------------------------------------------------------------------------- */
.topbar-brand { display: none; padding: 0; }
.topbar-search { width: auto; min-width: 0; margin: 0; flex: 0 1 440px; padding: 8px 12px; }
@media (max-width: 1180px) { .topbar { padding-left: 24px; padding-right: 24px; } .topbar-search kbd { display: none; } }
/* The top bar's search is always there on bigger screens, so Home doesn't need a second one */
@media (min-width: 901px) { .home-search { display: none; } }
.topbar-search span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-gap { flex: 1; }
.topbar-search-icon { display: none; }
.topbar .app-links { margin: 0 4px 0 0; gap: 6px; }
.topbar .app-link { flex: none; padding: 7px 12px; }
.topbar .app-edit { margin-left: -2px; }

.account { position: relative; flex: none; }
.account-btn { display: flex; align-items: center; gap: 4px; padding: 3px 6px 3px 3px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.account-btn:hover, .account-btn[aria-expanded="true"] { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.account-btn .avatar { width: 32px; height: 32px; font-size: 0.76rem; }
.account-caret { width: 14px; height: 14px; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 260px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}
.account-who { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.account-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--radius); background: transparent; color: var(--text); font: inherit; font-size: 0.9rem; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer; }
.account-item:hover, .account-item:focus-visible { background: var(--surface-3); }
.account-item .icon { width: 17px; height: 17px; margin-top: 1px; color: var(--muted); flex: none; }
.account-item small { display: block; font-size: 0.76rem; font-weight: 500; color: var(--muted); }

/* Sidebar: logo, then the menu with room to breathe */
.sidebar .brand { padding-bottom: 20px; }
.nav { gap: 1px; }
.nav-item { padding: 8px 10px; }
.nav-group { margin-top: 10px; }
.nav-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  border: 0; border-radius: var(--radius-sm); background: transparent; font-family: inherit; cursor: pointer;
}
.nav-toggle:hover { color: var(--text); }
.nav-toggle .icon { width: 13px; height: 13px; transition: transform 0.18s ease; }
.nav-group.is-folded .nav-toggle .icon { transform: rotate(-90deg); }
.nav-group-items { display: flex; flex-direction: column; gap: 1px; }
.nav-group.is-folded .nav-group-items { display: none; }
@media (prefers-reduced-motion: reduce) { .nav-toggle .icon { transition: none; } }

@media (max-width: 900px) {
  .topbar { padding: 10px 12px 10px 16px; gap: 4px; min-height: 0; }
  .topbar-brand { display: flex; margin-right: auto; }
  .topbar-brand .brand-mark { font-size: 1.1rem; }
  .topbar-search, .topbar-gap, .topbar .app-edit { display: none; }
  .topbar-search-icon { display: inline-flex; }
  .topbar .app-link { padding: 5px 9px; font-size: 0.8rem; border-radius: 999px; }
  .topbar .app-link .icon { display: none; }
  .topbar .btn-icon { padding: 7px; }
  .account-btn { padding: 2px; }
  .account-btn .avatar { width: 30px; height: 30px; }
  .account-caret { display: none; }
}
@media (max-width: 360px) { .topbar .app-link { padding: 5px 7px; } }

/* ==========================================================================
   Calm layout (2026-11): fewer boxes, dots instead of labels, one main button
   per row. Later rules here win over the older ones above.
   ========================================================================== */
:root { --line: rgba(240, 240, 255, 0.07); }

/* Fanclub / Marketing dots */
.side-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: none; vertical-align: middle; margin-right: 8px; background: transparent; }
.side-dot.side-fanclub { background: var(--fanclub); }
.side-dot.side-marketing { background: var(--marketing); }
.side-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 0.78rem; }
.side-legend > span { display: inline-flex; align-items: center; }
.side-filter .seg .side-dot { margin-right: 0; }

/* Page headers: title and one line */
.page-header .eyebrow, .board-header .eyebrow { display: none; }
.page-header { margin-bottom: 18px; }
.page-title { font-size: 1.6rem; }
.page-lead { margin-top: 4px; color: var(--muted); }
.board-header .page-lead { margin-top: 4px !important; }
.page-header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.how { margin-bottom: 18px; }
.how > summary { padding: 4px 8px 4px 0; font-size: 0.86rem; }
.how > summary:hover { background: transparent; }
.how .side-uses { margin: 10px 0 4px; }
.how .steps { margin-top: 12px; }

/* Section headings with a quiet link on the right */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.sec-title { font-size: 0.95rem; font-weight: 600; }
.sec-link { border: 0; background: none; padding: 0; color: var(--muted); font-size: 0.82rem; cursor: pointer; }
.sec-link:hover { color: var(--text); }
.home-section { margin-bottom: 30px; }

/* Announcements: slim strips */
.announcements { gap: 8px; margin-bottom: 26px; }
.announcement { align-items: center; gap: 12px; padding: 9px 10px 9px 14px; background: var(--surface); border: 1px solid var(--line); border-left: 2px solid var(--primary-text); border-radius: 10px; }
.announcement > .icon { margin-top: 0; width: 16px; height: 16px; }
.announcement.is-urgent { border-left-color: var(--warning); background: var(--surface); }
.ann-body { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.ann-text { flex: 1; min-width: 200px; font-size: 0.92rem; }
.ann-text .side-dot { margin-right: 10px; position: relative; top: -1px; }
.ann-meta { margin: 0; white-space: nowrap; color: var(--muted); font-size: 0.78rem; }
.ann-actions { margin: 0; }
.ann-actions .btn-sm { padding: 4px 8px; font-size: 0.78rem; color: var(--muted); }
.ann-new { padding: 2px 0; color: var(--muted); }

/* Home: tool buttons, number strip, two plain lists */
.tool-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-chip { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.tool-chip:hover { border-color: rgba(168, 85, 247, 0.45); background: var(--surface-2); }
.tool-chip-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-text); flex: none; }
.tool-chip-icon .icon { width: 16px; height: 16px; }
.tool-chip-text { display: flex; flex-direction: column; min-width: 0; }
.tool-chip-text .t { font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.tool-chip-text .m { font-size: 0.74rem; color: var(--muted); }
.tool-chip { max-width: 100%; }
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.stat-tile { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border: 0; border-left: 1px solid var(--line); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.stat-tile:first-child { border-left: 0; }
.stat-tile:hover { background: var(--surface-2); }
.stat-tile .n { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; }
.stat-tile .l { display: flex; align-items: center; font-size: 0.8rem; color: var(--muted); }
.stat-tile .l .side-dot { margin-right: 6px; }
.stat-tile .d { font-size: 0.76rem; font-weight: 600; color: var(--success); }
.stat-tile .d.is-down { color: var(--muted); }
.home-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 40px; }
.row-list { border-top: 1px solid var(--line); }
.row-list .empty { padding: 22px 0; }
.home-row { display: flex; align-items: center; gap: 0; width: 100%; padding: 11px 2px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.home-row:hover .t { text-decoration: underline; }
.home-row .side-dot { margin-right: 12px; }
.home-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.home-row-text .t { font-weight: 500; font-size: 0.92rem; line-height: 1.35; }
.home-row-text .m { font-size: 0.78rem; color: var(--muted); }
.home-row-due { flex: none; margin-left: 12px; font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.home-row-due.is-soon { color: var(--warning); }
.home-foot { margin-top: 12px; color: var(--muted); font-size: 0.8rem; }
.home-foot p { margin-top: 8px; }
.home-foot a { color: var(--text-2); }

/* QR codes: one quiet table */
.toolbar-right { display: flex; align-items: center; gap: 6px; }
.qr-table { border-top: 1px solid var(--line); }
.qr-head, .qr-row { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(0, 2fr) 84px minmax(0, 1fr) 150px; gap: 16px; align-items: center; }
.qr-head { padding: 9px 6px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.qr-head .num, .qr-scans { text-align: right; }
.qr-row { padding: 11px 6px; border-bottom: 1px solid var(--line); }
.qr-row:hover { background: var(--surface); }
.qr-row.is-flash { animation: flash-row 2.2s ease; }
.qr-name { display: flex; align-items: center; min-width: 0; }
.qr-name > .side-dot { margin-right: 12px; }
.qr-name-text { min-width: 0; flex: 1; }
.qr-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.qr-title .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-slug { font-family: var(--font-mono); font-size: 0.76rem; color: var(--primary-text); }
.row-flag { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 0.74rem; flex: none; }
.row-flag .icon { width: 13px; height: 13px; }
.row-notes { cursor: pointer; }
.row-notes:has([data-notes-count][hidden]) { display: none; }
.qr-dest { color: var(--muted); font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-scans { font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.25; }
.qr-scans small { display: block; font-weight: 500; font-size: 0.72rem; color: var(--muted); }
.qr-by { color: var(--muted); font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-acts { display: flex; justify-content: flex-end; gap: 2px; }
.qr-row .notes-box { grid-column: 1 / -1; }
.qr-row .access-list { margin-top: 4px; }

/* "..." row menu */
.row-menu { position: fixed; z-index: 70; min-width: 220px; padding: 5px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 11px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
.row-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none; color: var(--text-2); font: inherit; font-size: 0.9rem; font-weight: 500; text-align: left; cursor: pointer; }
.row-menu-item:hover, .row-menu-item:focus-visible { background: var(--surface-3); color: var(--text); box-shadow: none; }
.row-menu-item .icon { width: 16px; height: 16px; color: var(--muted); }
.row-menu-item.is-danger, .row-menu-item.is-danger .icon { color: var(--danger); }
.row-menu-item:disabled { opacity: 0.5; cursor: default; }

/* Side panel (making or changing a QR code) */
.drawer-scrim { position: fixed; inset: 0; z-index: 48; background: rgba(0, 0, 0, 0.5); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(460px, 100vw); padding: 24px 26px 32px; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--border-strong); box-shadow: -20px 0 50px rgba(0, 0, 0, 0.45); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.drawer-title { font-size: 1.15rem; font-weight: 700; }
.drawer-sub { color: var(--muted); font-size: 0.86rem; margin-top: 4px; }
.drawer-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.drawer[data-mode="new"] #qrCancelEdit { display: none; }
.drawer[data-mode="show"] #qrForm { display: none; }
.drawer:not([data-mode="show"]) #qrMakeAnother { display: none; }
.drawer .qr-result { margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.drawer[data-mode="show"] .qr-result { margin-top: 0; }
#qrMakeAnother { margin: 12px auto 0; display: flex; }
body.drawer-open { overflow: hidden; }

/* Who's on what: plain rows */
.project-list { gap: 0; border-top: 1px solid var(--line); }
.project-row { padding: 12px 6px; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.project-row:hover { background: var(--surface); border-color: var(--line); }
.project-title-row .side-dot { margin-right: 0; }

/* Resources: one list per section */
.resource-section .section-title { margin-bottom: 6px; }
.resource-grid { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
.resource-card { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.6fr) auto; align-items: center; gap: 16px; padding: 12px 6px; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.resource-card:hover { background: var(--surface); }
.resource-head .recent-icon { width: 30px; height: 30px; }
.resource-head h3 { font-size: 0.92rem; font-weight: 600; }
.resource-head .side-dot { margin-right: 0; }
.resource-card .resource-note:empty { display: block; }
.resource-card .btn-row { justify-content: flex-end; }
.news-meta .side-dot:not(.side-fanclub):not(.side-marketing) { width: 7px; }
.resource-note { font-size: 0.84rem; color: var(--muted); }
.resource-card .btn-row { margin: 0; flex-wrap: nowrap; }
.resource-card .btn-row .btn { padding: 5px 10px; }

/* News: plain rows */
.news-list { gap: 0; border-top: 1px solid var(--line); }
.news-item { padding: 14px 6px; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.news-item:hover { background: var(--surface); border-color: var(--line); }
.news-item.is-own { border-left: 0; box-shadow: inset 2px 0 0 var(--primary); }
.news-meta .side-dot { margin-right: 2px; }
.tag-pill { padding: 0; background: none; color: var(--muted); font-weight: 500; font-size: 0.76rem; }
.tag-pill.own { background: none; }

@media (max-width: 900px) {
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-tile:nth-child(3) { border-left: 0; }
  .stat-tile:nth-child(n+3) { border-top: 1px solid var(--line); }
  .home-cols { grid-template-columns: minmax(0, 1fr); }
  .qr-head { display: none; }
  .qr-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; }
  .qr-dest, .qr-by { display: none; }
  .qr-act-text { display: none; }
  .resource-card { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .ann-meta { white-space: normal; }
  .toolbar-right { width: 100%; }
  .toolbar-right .toolbar-search { flex: 1; width: auto; }
}

/* Creator link pages: same quiet table as QR codes */
.pages-head, .page-row { grid-template-columns: minmax(0, 3fr) 90px 100px 90px 150px; }
.page-row-name { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.page-row-name:hover .t { text-decoration: underline; }
.page-row-name .avatar { width: 34px; height: 34px; font-size: 0.74rem; }
.page-row-name .qr-name-text { display: flex; flex-direction: column; }
.draft-tag { padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 0.7rem; font-weight: 600; }
@media (max-width: 900px) {
  .page-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .page-row .page-clicks, .page-row .page-buttons { display: none; }
}

/* Monday and Slack stay the default; the hub's own versions are optional */
body:not(.monday-trial) .only-monday-trial, body.monday-trial .only-monday-keep,
body:not(.slack-trial) .only-slack-trial, body.slack-trial .only-slack-keep { display: none !important; }
.mode-note { display: flex; gap: 10px; align-items: flex-start; margin: -4px 0 18px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 0.86rem; }
.mode-note strong { color: var(--text-2); }
.mode-note .icon { width: 16px; height: 16px; margin-top: 2px; color: var(--primary-text); }
.mode-note.is-trial .icon { color: var(--success); }
.ann-mode-note { margin: 0; color: var(--muted); font-size: 0.78rem; }
.notes-form .btn-row { align-items: center; }
.notes-mode-hint { margin-right: auto; color: var(--muted); font-size: 0.78rem; }
.tool-mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.tool-mode-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tool-mode-say { margin: 10px 0 0; }
.home-row-text + .btn, .row-list .empty .btn { margin-left: 10px; }
.tool-mode-grid > .card { margin: 0; }

/* ==========================================================================
   Chat
   ========================================================================== */
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 18px; text-align: center; flex: none; }
.nav-badge.is-dot { min-width: 8px; width: 8px; height: 8px; padding: 0; background: var(--primary-text); }
.bb-item { position: relative; }
.bb-badge { position: absolute; top: 4px; left: calc(50% + 6px); }

body.chat-open .content { max-width: none; padding: 0; }
body.chat-open .help-card { display: none; }
.chat-app { display: grid; grid-template-columns: 260px minmax(0, 1fr); height: var(--chat-h, calc(100vh - 60px)); min-height: 420px; }
.chat-app.has-thread { grid-template-columns: 260px minmax(0, 1fr) 380px; }

/* Channel list */
.chat-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--bg); }
.chat-side-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 12px 8px 18px; }
.chat-title { font-size: 1.2rem; font-weight: 700; }
.chat-side-scroll { flex: 1; overflow-y: auto; padding: 0 8px 16px; }
.chat-group-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px 4px 10px; color: var(--muted); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.chat-group-head .btn-icon { padding: 4px; }
.chat-group-head .btn-icon .icon { width: 15px; height: 15px; }
.chat-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); font: inherit; font-size: 0.92rem; text-align: left; cursor: pointer; }
.chat-item:hover { background: var(--surface-2); color: var(--text-2); }
.chat-item.active { background: var(--primary-soft); color: var(--text); }
.chat-item.unread { color: var(--text); font-weight: 650; }
.chat-item.archived { opacity: 0.6; }
.chat-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .side-dot { margin: 0; }
.chat-hash { display: inline-flex; justify-content: center; width: 16px; color: var(--muted); font-weight: 600; flex: none; }
.chat-hash .icon { width: 13px; height: 13px; }
.chat-avatar { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-text); font-size: 0.62rem; font-weight: 700; flex: none; }
.chat-count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 0.7rem; font-weight: 700; line-height: 18px; text-align: center; }
.chat-count.is-mention { background: var(--primary); color: #fff; }
.chat-empty-side { margin: 4px 10px; color: var(--muted); font-size: 0.8rem; }
.chat-archived-toggle { margin: 14px 10px 0; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.8rem; cursor: pointer; }
.chat-archived-toggle:hover { color: var(--text); }

/* Conversation */
.chat-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.chat-head-text { flex: 1; min-width: 0; }
.chat-name { display: flex; align-items: center; gap: 4px; font-size: 1.02rem; font-weight: 700; }
.chat-name .chat-hash { width: auto; }
.chat-topic { color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-back { display: none; }
.chat-members-btn .icon { width: 15px; height: 15px; }
.chat-mode-note { margin: 10px 18px 0; }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 0 8px; }
.chat-welcome { padding: 40px 24px; color: var(--muted); }
.chat-welcome h3 { color: var(--text); font-size: 1.1rem; margin-bottom: 4px; }
.chat-day { display: flex; align-items: center; gap: 12px; margin: 14px 18px 6px; color: var(--muted); font-size: 0.74rem; font-weight: 600; }
.chat-day::before, .chat-day::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.chat-new { display: flex; align-items: center; gap: 10px; margin: 6px 18px; color: var(--danger); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.chat-new::before { content: ''; flex: 1; border-top: 1px solid rgba(248, 113, 113, 0.5); }

.msg { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 6px 18px; }
.msg.compact { padding-top: 1px; padding-bottom: 1px; }
.msg:hover, .msg:focus-within { background: var(--surface); }
.msg.is-flash { animation: flash-row 2.2s ease; }
.msg-avatar { width: 36px; height: 36px; border-radius: 9px; font-size: 0.74rem; margin-top: 2px; }
.msg-gutter { visibility: hidden; padding-top: 3px; color: var(--muted); font-size: 0.66rem; text-align: right; white-space: nowrap; }
.msg.compact:hover .msg-gutter { visibility: visible; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-who { font-weight: 650; font-size: 0.92rem; }
.msg-head time { color: var(--muted); font-size: 0.72rem; }
.msg-text { color: var(--text-2); font-size: 0.92rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-text a { color: var(--primary-text); }
.msg-text code { padding: 1px 5px; border-radius: 5px; background: var(--surface-3); font-family: var(--font-mono); font-size: 0.84em; }
.msg-text .mention { padding: 0 3px; border-radius: 4px; background: var(--primary-soft); }
.msg-text .mention.is-me { background: rgba(251, 191, 36, 0.18); color: var(--warning); }
.msg.is-deleted .msg-text { color: var(--muted); }
.msg-edited { color: var(--muted); font-size: 0.72rem; }
.msg-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 0.82rem; cursor: pointer; }
.react span { font-size: 0.74rem; font-weight: 600; }
.react.mine { border-color: rgba(168, 85, 247, 0.6); background: var(--primary-soft); color: var(--text); }
.msg-replies { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; padding: 3px 8px 3px 0; border: 0; background: none; color: var(--primary-text); font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.msg-replies span { color: var(--muted); font-weight: 500; }
.msg-replies:hover { text-decoration: underline; }
.msg-tools { position: absolute; top: -12px; right: 16px; display: none; gap: 1px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-2); box-shadow: var(--shadow); }
.msg:hover .msg-tools, .msg:focus-within .msg-tools { display: flex; }
.msg-tools button { display: grid; place-items: center; width: 30px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font-size: 0.95rem; cursor: pointer; }
.msg-tools button:hover { background: var(--surface-3); color: var(--text); }
.msg-tools .icon { width: 15px; height: 15px; }
.msg-edit { width: 100%; resize: vertical; font-size: 0.92rem; }
.msg-edit-hint { color: var(--muted); font-size: 0.72rem; margin-top: 2px; }
.react-pick { position: fixed; z-index: 75; display: flex; gap: 2px; padding: 4px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); }
.react-pick button { width: 34px; height: 34px; border: 0; border-radius: 7px; background: none; font-size: 1.15rem; cursor: pointer; }
.react-pick button:hover { background: var(--surface-3); }

.chat-jump { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 0; border-radius: 999px; background: var(--primary); color: #fff; font: inherit; font-size: 0.82rem; font-weight: 600; box-shadow: var(--shadow); cursor: pointer; }
.chat-jump .icon { width: 14px; height: 14px; }
.chat-composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 18px 16px; }
.chat-composer .notes-input { flex: 1; min-width: 0; }
.chat-composer textarea { display: block; width: 100%; min-height: 44px; max-height: 180px; padding: 11px 14px; resize: none; line-height: 1.4; }
.chat-composer .btn { height: 44px; padding: 0 14px; }
.chat-composer .mention-menu { top: auto; bottom: 100%; margin: 0 0 4px; }
.chat-cant-post { margin: 0 18px 16px; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--muted); font-size: 0.86rem; text-align: center; }

/* Thread */
.chat-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-left: 1px solid var(--line); background: var(--bg); }
.chat-thread[hidden] { display: none; }
.chat-thread-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.chat-thread-head h3 { font-size: 1rem; }
.thread-count { margin-top: 4px; }

/* Pickers and rules */
.chat-people-search { margin-bottom: 8px; }
.chat-people { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.chat-person { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.chat-person:last-child { border-bottom: 0; }
.chat-person:hover { background: var(--surface-2); }
.chat-person-text { display: flex; flex-direction: column; min-width: 0; }
.chat-person-text .t { font-weight: 600; font-size: 0.9rem; }
.chat-person-text .m { color: var(--muted); font-size: 0.76rem; }
.chat-people .hint { padding: 10px 12px; margin: 0; }
#chatChannelForm .check { display: flex; margin-bottom: 12px; }
.side-pick.is-disabled { pointer-events: none; opacity: 0.6; }
.chat-rules { margin: 4px 0 20px; padding-left: 18px; color: var(--text-2); font-size: 0.9rem; line-height: 1.6; }
.chat-rules li { margin-bottom: 6px; }

@media (hover: none) {
  .msg-tools { position: static; display: flex; grid-column: 2; justify-self: start; margin-top: 2px; border: 0; background: none; box-shadow: none; padding: 0; }
  .msg-tools button { width: 34px; height: 30px; color: var(--muted); }
  .msg-gutter { visibility: visible; }
}

@media (max-width: 900px) {
  .chat-app, .chat-app.has-thread { grid-template-columns: minmax(0, 1fr); }
  .chat-app.show-list .chat-main, .chat-app.show-list .chat-thread { display: none; }
  .chat-app:not(.show-list) .chat-side { display: none; }
  .chat-app.has-thread:not(.show-list) .chat-main { display: none; }
  .chat-back { display: inline-flex; }
  .chat-thread { border-left: 0; }
  .chat-head, .chat-composer { padding-left: 12px; padding-right: 12px; }
  .msg { padding-left: 12px; padding-right: 12px; }
  .chat-mode-note { margin: 8px 12px 0; }
}

.chat-mode-note { align-items: center; }
.chat-mode-note > div { flex: 1; }
.chat-note-x { padding: 4px; margin: -4px -6px -4px 0; }
.chat-mode-note.is-dismissed { display: none !important; }

/* "How this chat runs" link and the About dialog */
.chat-runs-link { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 18px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--muted); font: inherit; font-size: 0.8rem; text-align: left; cursor: pointer; }
.chat-runs-link:hover { color: var(--text); background: var(--surface); }
.chat-runs-link .icon { width: 15px; height: 15px; flex: none; }
.chat-help { max-height: min(86vh, 760px); overflow-y: auto; }
.chat-help-sub { margin: 16px 0 6px; font-size: 0.95rem; }
.chat-help h2 + .chat-help-sub { margin-top: 4px; }

/* ==========================================================================
   Chat "currently in progress": the real chat, blurred, behind a card
   ========================================================================== */
#view-chat { position: relative; }
body:not(.chat-wip-on) .chat-wip { display: none; }
body.chat-wip-on #chatApp { filter: blur(2.5px) saturate(0.85); opacity: 0.7; pointer-events: none; user-select: none; }
body.chat-wip-on [data-chat-badge] { display: none !important; }
body.chat-wip-on .chat-mode-note { display: none; }
.chat-wip { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; }
.chat-wip-card { width: min(560px, 100%); padding: 28px; border: 1px solid var(--border-strong); border-radius: 16px; background: rgba(15, 15, 36, 0.92); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); }
.chat-wip-tag { display: inline-block; margin-bottom: 12px; padding: 3px 10px; border-radius: 999px; background: var(--warning-soft); color: var(--warning); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.chat-wip-card h2 { font-size: 1.3rem; font-weight: 700; line-height: 1.3; }
.chat-wip-lead { margin: 10px 0 14px; color: var(--text-2); }
.chat-wip-why { margin: 0 0 20px; padding-left: 18px; color: var(--text-2); font-size: 0.9rem; line-height: 1.6; }
.chat-wip-why li { margin-bottom: 8px; }
.chat-wip-foot { margin: 14px 0 0; color: var(--muted); font-size: 0.8rem; }
