/* ============================================================================
   GOTOVO Admin — design system
   Light-first, calm, refined. Optional dark. Implementable as plain CSS in JTE.
   ========================================================================== */

/* ---- Tokens -------------------------------------------------------------- */
:root {
  /* refined, muted purple — set by Tweaks, falls back here */
  --accent:        #6850d6;
  --accent-strong: color-mix(in oklab, var(--accent) 82%, #000);
  --accent-ink:    #ffffff;

  --font: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* spacing */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 48px;

  --r-sm: 7px; --r-md: 10px; --r-lg: 14px; --r-pill: 999px;

  --sidebar: 244px;
  --maxw: 1180px;
}

/* Light theme (default) */
:root, [data-theme="light"] {
  --bg:            #e9eaef;
  --surface:       #ffffff;
  --surface-2:     #fafafc;
  --surface-hover: #f4f3f9;
  --border:        #ebebf1;
  --border-2:      #e0e0e8;
  --shadow:        0 1px 2px rgba(24,24,40,.04), 0 1px 3px rgba(24,24,40,.06);
  --shadow-lg:     0 6px 24px rgba(24,24,40,.10), 0 2px 6px rgba(24,24,40,.06);

  --text:   #1b1b24;
  --text-2: #5b5b68;
  --text-3: #8d8d9b;

  --accent-soft: color-mix(in oklab, var(--accent) 11%, #fff);
  --accent-line: color-mix(in oklab, var(--accent) 26%, #fff);

  --ok-bg: #e7f6ec;  --ok-fg: #1c7a43;
  --off-bg:#eef0f3;  --off-fg:#6b7280;
  --warn-bg:#fdf0e0; --warn-fg:#b1660f;
  --info-bg:#e9eefb; --info-fg:#3953c4;
  --danger-bg:#fdecec; --danger-fg:#c23b3b;
  --danger-soft:#fbe3e3;
}

/* Dark theme */
[data-theme="dark"] {
  --bg:            #0e0e14;
  --surface:       #17171f;
  --surface-2:     #1c1c26;
  --surface-hover: #20202c;
  --border:        #262630;
  --border-2:      #30303c;
  --shadow:        0 1px 2px rgba(0,0,0,.4);
  --shadow-lg:     0 12px 40px rgba(0,0,0,.5);

  --text:   #ececf2;
  --text-2: #a3a3b2;
  --text-3: #71717f;

  --accent-soft: color-mix(in oklab, var(--accent) 22%, #16161e);
  --accent-line: color-mix(in oklab, var(--accent) 45%, #16161e);

  --ok-bg:#13301f;  --ok-fg:#5bd98a;
  --off-bg:#23232e; --off-fg:#9a9aa8;
  --warn-bg:#3a2911; --warn-fg:#f0a850;
  --info-bg:#1b2347; --info-fg:#8ea2f0;
  --danger-bg:#3a1a1d; --danger-fg:#f08a8a;
  --danger-soft:#3a1f22;
}

/* ---- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--accent-line); }
.ico { width: 16px; height: 16px; flex: none; vertical-align: middle; }
svg.ico { display: inline-block; }

/* ---- App frame ----------------------------------------------------------- */
.app { min-height: 100vh; }

/* Sidebar (desktop) */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: var(--s5) var(--s4);
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px var(--s5); }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent); position: relative; flex: none;
  box-shadow: 0 2px 6px color-mix(in oklab, var(--accent) 40%, transparent);
}
.brand-mark::after {
  content: ""; position: absolute; inset: 8px; border-radius: 3px;
  background: var(--accent-ink); opacity: .92;
  clip-path: polygon(0 60%, 35% 60%, 35% 0, 65% 0, 65% 60%, 100% 60%, 50% 100%);
}
.brand-name { font-weight: 700; letter-spacing: .14em; font-size: 14px; }
.brand-name span { color: var(--accent); }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: var(--s2); }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500; font-size: 14px;
  transition: background .12s, color .12s;
}
.nav a .ico { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--surface-hover); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.active .ico { opacity: 1; }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: var(--s4); }
.nav-meta { padding: 8px 11px; font-size: 11.5px; color: var(--text-3); display:flex; align-items:center; gap:8px; }

/* theme toggle (replaces the appearance tweaks) */
.theme-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 11px; margin-bottom: 8px;
  background: transparent; border: 1px solid var(--border-2); border-radius: var(--r-sm);
  color: var(--text-2); font-size: 12.5px; font-weight: 600;
  transition: background .12s, color .12s, border-color .12s;
}
.theme-toggle:hover { background: var(--surface-hover); color: var(--text); border-color: var(--accent-line); }
.theme-toggle .ico { width: 16px; height: 16px; flex: none; }
.theme-toggle.compact { width: auto; padding: 7px; margin: 0; border-radius: var(--r-sm); }
.theme-toggle.compact span { display: none; }
.dot-ok { width:7px;height:7px;border-radius:50%;background:#34c77b; box-shadow:0 0 0 3px color-mix(in oklab,#34c77b 22%, transparent); }

/* Mobile top bar + bottom nav */
.topbar-m, .bottomnav { display: none; }

/* Content area */
.content { margin-left: var(--sidebar); }
.page { max-width: var(--maxw); margin: 0 auto; padding: var(--s7) var(--s7) 80px; }

/* Page header */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s4); margin-bottom: var(--s6); flex-wrap: wrap;
}
.page-title { font-size: 23px; font-weight: 700; letter-spacing: -.02em; }
.page-sub { color: var(--text-2); font-size: 13.5px; margin-top: 3px; }
.page-actions { display: flex; gap: var(--s2); align-items: center; flex: none; }
.page-actions .segmented { flex-wrap: nowrap; }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 8px 14px; font-size: 13.5px; font-weight: 600;
  transition: background .12s, border-color .12s, color .12s, transform .04s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-quiet { background: transparent; color: var(--text-2); padding: 7px 10px; }
.btn-quiet:hover { background: var(--surface-hover); color: var(--text); }
.btn-danger { background: var(--danger-bg); color: var(--danger-fg); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* ---- Cards & surfaces ---------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.card-pad { padding: var(--s5); }
.divider { height: 1px; background: var(--border); border: 0; }

/* ---- Toolbar / filters --------------------------------------------------- */
.toolbar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: var(--s3) var(--s4); margin-bottom: var(--s5);
  display: flex; flex-direction: column; gap: var(--s3);
}
.toolbar-row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.toolbar-row.between { justify-content: space-between; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label {
  font-size: 10.5px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .07em;
}
.grow { flex: 1 1 auto; }

/* search */
.search { position: relative; display: flex; align-items: center; min-width: 200px; }
.search .ico { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
/* higher specificity than the base input[type=search] rule so the icon never overlaps text */
.search input[type=search], .search input[type=text] { padding-left: 36px; }

input[type=text], input[type=number], input[type=date], input[type=search], select, textarea {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  padding: 8px 11px; font-size: 13.5px; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238d8d9b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }

/* segmented control (date presets / sort / tweaks) */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; color: var(--text-2);
  padding: 6px 12px; border-radius: 5px; font-size: 13px; font-weight: 600;
  white-space: nowrap; transition: background .12s, color .12s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--accent);
  box-shadow: var(--shadow); }
[data-theme="dark"] .segmented button.active { background: var(--accent-soft); }

/* tag chips */
.tagscroll { max-height: 78px; overflow-y: auto; overflow-x: hidden; padding: 1px; margin: -1px; }
.tagscroll::-webkit-scrollbar { width: 7px; }
.tagscroll::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border-2); background: var(--surface);
  color: var(--text-2); border-radius: var(--r-pill);
  padding: 4px 11px; font-size: 12.5px; font-weight: 600;
  transition: all .12s; cursor: pointer;
}
.chip:hover { border-color: var(--accent-line); color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.chip .x { font-size: 14px; line-height: 1; opacity: .7; }

/* custom range panel */
.range-custom { display: flex; gap: var(--s3); align-items: flex-end; flex-wrap: wrap;
  padding-top: var(--s1); }
.range-custom .field { min-width: 150px; }

/* ---- Badges -------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: var(--r-sm); padding: 2px 8px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1.5;
}
.badge.dotbadge::before { content:""; width:6px; height:6px; border-radius:50%; background: currentColor; opacity:.8; }
.badge-tag { background: var(--accent-soft); color: var(--accent); font-size: 11px; padding: 2px 7px; font-weight: 600; }
.badge-active   { background: var(--ok-bg);   color: var(--ok-fg); }
.badge-inactive { background: var(--off-bg);  color: var(--off-fg); }
.badge-queued   { background: var(--warn-bg); color: var(--warn-fg); }
.badge-soft     { background: var(--surface-2); color: var(--text-2); border:1px solid var(--border-2); }

/* category badges — soft tint + readable ink (light) */
.cat { --c: #6b7280; --cbg: #eef0f3;
  background: var(--cbg); color: var(--c); }
.cat-hiking        { --c:#2f74c9; --cbg:#e7f0fb; }
.cat-sports        { --c:#7c4ad1; --cbg:#f0e9fb; }
.cat-party         { --c:#c2418c; --cbg:#fbe7f3; }
.cat-workshop      { --c:#b1660f; --cbg:#fbf0e0; }
.cat-education     { --c:#1c8a55; --cbg:#e3f6ec; }
.cat-trip          { --c:#1592ad; --cbg:#e0f4f8; }
.cat-culture       { --c:#7857c8; --cbg:#eeeafb; }
.cat-entertainment { --c:#cf4444; --cbg:#fbe6e6; }
.cat-it-networking { --c:#118a86; --cbg:#e0f3f2; }
[data-theme="dark"] .cat { --cbg: color-mix(in oklab, var(--c) 20%, #16161e); filter: brightness(1.18); }

/* ---- Tables -------------------------------------------------------------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 11px 16px; background: var(--surface-2);
  color: var(--text-3); font-weight: 700; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover td { background: var(--surface-2); }
td .t-title { font-weight: 600; color: var(--text); }
td .t-title:hover { color: var(--accent); }
.num { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* sources dots */
.srcdots { display: inline-flex; gap: 3px; align-items: center; line-height: 0; }
.srcdots i { flex: none; display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .85; }
.srcdots i.off { background: var(--border-2); opacity: 1; }

/* ---- Pagination ---------------------------------------------------------- */
.pager { display: flex; align-items: center; justify-content: space-between;
  margin-top: var(--s4); gap: var(--s3); flex-wrap: wrap; }
.pager .count { font-size: 12.5px; color: var(--text-2); }
.pager .nav-btns { display: flex; align-items: center; gap: var(--s2); }

/* ---- Empty state --------------------------------------------------------- */
.empty { text-align: center; padding: var(--s8) var(--s5); color: var(--text-2); }
.empty .em-ico { width: 40px; height: 40px; margin: 0 auto var(--s3); color: var(--text-3); opacity:.6; }
.empty h3 { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.empty p { font-size: 13px; }

/* ---- Event detail -------------------------------------------------------- */
.detail-head { display: flex; justify-content: space-between; gap: var(--s4); align-items: flex-start; flex-wrap: wrap; }
.detail-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.detail-summary { color: var(--text-2); font-size: 14.5px; line-height: 1.65; margin: var(--s4) 0; max-width: 70ch; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr));
  gap: var(--s4) var(--s5); margin-top: var(--s2); }
.meta-cell .k { font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing:.06em; margin-bottom: 4px; }
.meta-cell .v { font-size: 14px; color: var(--text); display:flex; align-items:center; gap:6px; flex-wrap: wrap; }

/* raw text */
.raw {
  white-space: pre-wrap; word-break: break-word; font-family: var(--mono);
  font-size: 12px; line-height: 1.65; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 14px; max-height: 260px; overflow: auto;
}
.extract-list { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.extract-list .el { display: flex; gap: 6px; align-items: center; color: var(--text-2); }
.extract-list .el b { color: var(--text); font-weight: 600; }

/* section title */
.sec-title { font-size: 12px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .06em; margin: var(--s6) 0 var(--s3); }
.sec-title.first { margin-top: 0; }

/* ---- Settings ------------------------------------------------------------ */
.set-grid { display: grid; gap: var(--s5); }
.set-row { display: flex; justify-content: space-between; gap: var(--s5); align-items: flex-start; flex-wrap: wrap; }
.set-info { flex: 1 1 320px; }
.set-info h3 { font-size: 15px; font-weight: 650; margin-bottom: 4px; }
.set-info p { font-size: 13px; color: var(--text-2); line-height: 1.55; max-width: 60ch; }
.set-control { flex: 0 0 auto; min-width: 240px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* slider */
.slider { display: flex; align-items: center; gap: 12px; width: 240px; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 5px; border-radius: 99px;
  background: var(--border-2); width: 100%; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 17px; height: 17px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--surface);
  box-shadow: var(--shadow); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 17px; height: 17px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface); cursor: pointer; }
.slider-val { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--accent);
  min-width: 42px; text-align: right; }

/* toggle switch */
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--border-2); border-radius: 99px; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  background: #fff; border-radius: 50%; box-shadow: var(--shadow); transition: transform .16s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }

.save-row { display: flex; align-items: center; gap: 12px; }
.save-state { font-size: 12.5px; font-weight: 600; }
.save-state.ok { color: var(--ok-fg); }
.code-area { font-family: var(--mono); font-size: 12px; }

/* digest body */
.digest-body { white-space: pre-wrap; font-size: 14px; line-height: 1.75; color: var(--text); }

/* refetch / inline control rows */
.refetch-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.refetch-row label { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
#resolve-result:not(:empty) { margin-top: 12px; }
.resolve-ok, .resolve-err { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-radius: var(--r-md); padding: 11px 14px; font-size: 13px; }
.resolve-ok { background: var(--ok-bg); color: var(--ok-fg); }
.resolve-err { background: var(--danger-bg); color: var(--danger-fg); }
.resolve-ok .btn { margin-left: auto; }

/* ── Review cards ── */
.rv-card { margin-bottom: 14px; }
.rv-top { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s4); }
.rv-date { text-align: center; line-height: 1.05; flex: none; width: 46px; }
.rv-date .d { font-size: 22px; font-weight: 700; }
.rv-date .m { font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.rv-title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; cursor: pointer; }
.rv-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.1fr); gap: var(--s5); }
.rv-k { font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.rv-summary { font-size: 13.5px; line-height: 1.6; color: var(--text); margin-bottom: 12px; }
.rv-extract { display: flex; flex-direction: column; gap: 7px; }
.rv-ex { font-size: 13px; color: var(--text); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rv-exk { font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; min-width: 64px; }
.rv-sources { display: flex; flex-direction: column; gap: 10px; }
.rv-src { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; }
.rv-src-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.rv-src .raw { background: var(--surface); max-height: 200px; }
[data-theme="dark"] .rv-src .raw { background: var(--bg); }

@media (max-width: 760px) {
  .rv-grid { grid-template-columns: 1fr; gap: var(--s4); }
  .rv-adopted { padding-bottom: var(--s4); border-bottom: 1px solid var(--border); }
}

/* toast / banner */
.banner { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--r-md);
  font-size: 13.5px; margin-bottom: var(--s4); }
.banner-warn { background: var(--warn-bg); color: var(--warn-fg); }
.banner-info { background: var(--info-bg); color: var(--info-fg); }

/* ---- Events list layout variations (Tweak) ------------------------------- */
/* default = table (handled above). rows + cards: */
.ev-rows { display: flex; flex-direction: column; gap: var(--s2); }
.ev-row {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: 13px 16px; display: grid;
  grid-template-columns: 56px 1fr; gap: var(--s4); align-items: start; transition: border-color .12s, transform .04s; }
.ev-row:hover { border-color: var(--accent-line); }
.ev-row .daycol { text-align: center; line-height: 1.05; padding-top: 1px; }
.ev-row .daycol .d { font-size: 20px; font-weight: 700; }
.ev-row .daycol .m { font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing:.05em; }
.ev-row .main { min-width: 0; }
/* title owns its own full-width line; source-count dots are a subtle top-right accent */
.ev-row .titrow { display: flex; align-items: center; gap: 12px; }
.ev-row .titrow .ttl { flex: 1 1 auto; min-width: 0; }
.ev-row .titrow .srcdots { flex: none; }
.ev-row .main .ttl { font-weight: 650; font-size: 14.5px; }
/* meta line: category badge leads, then time · city · venue; wraps on narrow screens */
.ev-row .main .sub { color: var(--text-2); font-size: 12.5px; margin-top: 5px; display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.ev-row .ev-tags { margin-top: 8px; }

.ev-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: var(--s4); }
.ev-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: var(--s4); display: flex; flex-direction: column; gap: 10px; transition: border-color .12s; }
.ev-card:hover { border-color: var(--accent-line); }
.ev-card .ec-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ev-card .ec-date { font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.ev-card .ec-title { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; line-height: 1.3; }
.ev-card .ec-meta { color: var(--text-2); font-size: 12.5px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: auto; }

/* hide variation containers unless selected */
[data-evlayout="table"] .ev-rows, [data-evlayout="table"] .ev-cards,
[data-evlayout="rows"]  .ev-table, [data-evlayout="rows"]  .ev-cards,
[data-evlayout="cards"] .ev-table, [data-evlayout="cards"] .ev-rows { display: none; }

/* density */
[data-density="compact"] tbody td { padding: 8px 16px; }
[data-density="compact"] .ev-row { padding: 9px 14px; }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 960px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding-bottom: 72px; }
  .page { padding: 0 0 80px; max-width: 100%; }

  .topbar-m {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 30;
    background: color-mix(in oklab, var(--surface) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border); padding: 11px 16px;
  }
  .topbar-m .tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .topbar-m .tb-title { font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-m .brand-mark { width: 24px; height: 24px; }
  .topbar-m .tb-actions { display: flex; gap: 6px; align-items: center; }

  .page-inner { padding: var(--s4) var(--s4) 0; }
  .page-head { margin-bottom: var(--s4); }
  .page-title { font-size: 19px; }

  /* mobile bottom nav */
  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: color-mix(in oklab, var(--surface) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--text-3); font-size: 10px; font-weight: 600; padding: 5px 8px; border-radius: 8px; flex: 1; }
  .bottomnav a .ico { width: 21px; height: 21px; }
  .bottomnav a.active { color: var(--accent); }

  /* tables collapse to stacked cards on mobile */
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; }
  table.responsive { border-collapse: separate; }
  table.responsive tr { background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: var(--shadow); padding: 6px 4px; margin-bottom: 10px; }
  table.responsive tr:hover td { background: transparent; }
  table.responsive td { border: 0; padding: 7px 14px; display: flex; justify-content: space-between; gap: 14px; align-items: center; }
  table.responsive td::before {
    content: attr(data-label); font-size: 10.5px; font-weight: 700; color: var(--text-3);
    text-transform: uppercase; letter-spacing: .06em; flex: none; }
  table.responsive td[data-label=""]::before { content: none; }
  table.responsive td.cell-block { flex-direction: column; align-items: stretch; gap: 6px; }
  table.responsive td.cell-block::before { margin-bottom: 2px; }

  .toolbar, .table-wrap, .card { border-radius: var(--r-md); }
  .set-control { min-width: 100%; }
  .slider { width: 100%; }

  /* on mobile, force event variations to a comfortable card/row form */
  .ev-cards { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .ev-cards { grid-template-columns: 1fr; }
  .segmented { width: 100%; }
  .page-actions { width: 100%; }
}

/* On narrow phones, shrink the date column so the content gets even more room. */
@media (max-width: 560px) {
  .ev-row { grid-template-columns: 46px 1fr; column-gap: var(--s3); }
}

/* toast */
.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px;
  animation: toast-in .25s ease both; max-width: 90vw; }
.toast .ico { width: 16px; height: 16px; color: #34c77b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@media (max-width: 960px) { .toast-wrap { bottom: 84px; } }

/* print-friendly review export */
@media print {
  .sidebar, .bottomnav, .topbar-m, .page-actions, .toolbar { display: none !important; }
  .content { margin: 0; }
  body { background: #fff; }
}

/* ── Production additions (live app: async states) ─────────────────────────── */
.save-state.danger { color: var(--danger-fg, #c2410c); }

/* Async data states for the main view */
.view-loading, .view-error {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; min-height: 240px; color: var(--text-3); text-align: center;
}
.view-error { color: var(--danger-fg, #c2410c); }
.view-error .btn { margin-top: 4px; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--border, #e3e3ea); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.is-busy { opacity: .55; pointer-events: none; }
