/* RevBits LinkedIn Manager: dark admin console.
   Neutral graphite surfaces, one blue for actions, brand cyan for accents. */

:root {
  --bg: #0a0d13;
  --bg-sidebar: #0d1118;
  --surface: #11161f;
  --surface-2: #161c27;
  --surface-3: #1c2330;
  --border: #1f2632;
  --border-strong: #2b3442;

  --text: #e6ebf2;
  --text-muted: #8b95a6;
  --text-dim: #5d6779;

  --primary: #3b82f6;
  --primary-hover: #2f72e4;
  --primary-soft: rgba(59, 130, 246, 0.14);
  --accent: #00c8dc;
  --accent-soft: rgba(0, 200, 220, 0.12);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
  --ring: 0 0 0 3px rgba(59, 130, 246, 0.35);

  --sidebar-w: 248px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

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

a { color: #7fb0ff; text-decoration: none; }
a:hover { color: #a9c9ff; }

h1, h2, h3 { margin: 0; color: var(--text); font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: 24px; line-height: 1.25; }
h2 { font-size: 15px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }

code, .mono { font-family: var(--mono); font-size: 12px; }
code {
  overflow-wrap: anywhere;
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  color: #c9d3e3;
}

.material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  user-select: none;
}
.icon-xs { font-size: 15px !important; }

.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.no-margin { margin: 0 0 4px; }
.truncate { max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[hidden] { display: none !important; }

::selection { background: rgba(59, 130, 246, 0.35); }
* { scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }

/* ---------------------------------------------------------------- shell */
/* One grid for the whole app: a 60px top bar across the full width, the
   sidebar under it, and content + footer sharing the same .container so
   their edges always line up. */

:root {
  --topbar-h: 60px;
  --rail-w: 72px;
  --gutter: 32px;
  --container: 1200px;
}

.container { width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* top bar */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  background: rgba(13, 17, 24, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 40;
}
.topbar-brand {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border-right: 1px solid var(--border);
  transition: flex-basis 0.18s ease, width 0.18s ease;
  overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-logo { width: 26px; height: 26px; object-fit: contain; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }
.brand-product { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }
.topbar-main { flex: 1; min-width: 0; height: 100%; }
.topbar-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.icon-btn {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  border: 0; border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }

.breadcrumb { min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.crumb-section { color: var(--text-muted); }
.crumb-sep { font-size: 18px; color: var(--text-dim); }
.crumb-page { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.user-menu summary { margin-right: -6px; }
.status-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12.5px; font-weight: 500;
}
.status-chip:hover { color: var(--text); border-color: #3a4558; }
.status-chip .status-dot { width: 8px; height: 8px; }
.status-chip.is-ok .status-dot { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-chip.is-off .status-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

.user-menu { position: relative; }
.user-menu summary {
  list-style: none;
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 6px 0 4px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  user-select: none;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover, .user-menu[open] summary { background: var(--surface-2); }
.user-menu summary:focus-visible { outline: none; box-shadow: var(--ring); }
.avatar {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #00b4c8);
  color: #fff; font-size: 12px; font-weight: 700;
}
.user-name { font-size: 13px; font-weight: 500; }
.user-caret { font-size: 18px; color: var(--text-muted); transition: transform 0.15s; }
.user-menu[open] .user-caret { transform: rotate(180deg); }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 220px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  animation: pop 0.14s ease-out;
}
.menu-head { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.menu-title { font-weight: 600; font-size: 13px; }
.menu-sub { font-size: 12px; color: var(--text-muted); }
.menu a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: 13px; }
.menu a:hover { background: var(--surface-3); color: var(--text); }
.menu a .material-symbols-outlined { font-size: 18px; color: var(--text-muted); }

/* sidebar (below the top bar) */
.sidebar {
  position: fixed;
  top: var(--topbar-h); bottom: 0; left: 0;
  width: var(--sidebar-w);
  padding: 16px 12px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 30;
  transition: width 0.18s ease;
}
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
button.nav-link { width: 100%; border: 0; background: transparent; font: inherit; font-weight: 500; cursor: pointer; text-align: left; }
.collapse-btn .material-symbols-outlined { transition: transform 0.18s ease; }
.nav-kbd {
  margin-left: auto;
  min-width: 20px; height: 20px; padding: 0 5px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 4px;
  font: 500 11px var(--mono);
  color: var(--text-dim);
}
.nav-section {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim);
  padding: 14px 12px 6px;
  white-space: nowrap;
}
.nav-section:first-child { padding-top: 4px; }
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.is-active { background: var(--primary-soft); color: #d6e5ff; }
.nav-link.is-active .material-symbols-outlined { color: #7fb0ff; font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20; }
.nav-link.is-active::before {
  content: "";
  position: absolute; left: -12px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--primary);
}
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  margin-left: auto;
  min-width: 22px; height: 20px; padding: 0 7px;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.nav-link.is-active .nav-badge { background: var(--primary); color: #fff; }

/* main column */
.has-shell .main {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.18s ease;
}
.content { flex: 1; padding-top: 32px; padding-bottom: 40px; }

/* footer */
.app-footer { border-top: 1px solid var(--border); background: var(--bg-sidebar); }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 52px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.footer-left, .footer-right { display: flex; align-items: center; gap: 12px; }
.footer-logo { width: 16px; height: 16px; object-fit: contain; opacity: 0.8; }
.footer-item { display: inline-flex; align-items: center; gap: 6px; }
.footer-item .material-symbols-outlined { font-size: 16px; }
.footer-sep { width: 1px; height: 14px; background: var(--border-strong); }

/* ---- collapsed rail: by the user, or automatically on narrower screens */
html.sidebar-collapsed .topbar-brand { flex-basis: var(--rail-w); width: var(--rail-w); justify-content: center; padding: 0; }
html.sidebar-collapsed .topbar-toggle, html.sidebar-collapsed .brand-text { display: none; }
html.sidebar-collapsed .brand-logo { width: 28px; height: 28px; }
html.sidebar-collapsed .collapse-btn .material-symbols-outlined { transform: rotate(180deg); }
html.sidebar-collapsed .sidebar { width: var(--rail-w); padding-left: 12px; padding-right: 12px; }
html.sidebar-collapsed .has-shell .main { margin-left: var(--rail-w); }
html.sidebar-collapsed .nav-label { display: none; }
html.sidebar-collapsed .nav-section { padding: 10px 0; }
html.sidebar-collapsed .nav-section::before { content: ""; display: block; height: 1px; margin: 0 6px; background: var(--border); }
html.sidebar-collapsed .nav-section:first-child { display: none; }
html.sidebar-collapsed .nav-link { justify-content: center; padding: 0; }
html.sidebar-collapsed .nav-badge {
  position: absolute; top: 4px; right: 4px; margin: 0;
  min-width: 16px; height: 16px; padding: 0 4px;
  font-size: 10px;
  background: var(--primary); color: #fff;
}
html.sidebar-collapsed .nav-link .material-symbols-outlined { font-size: 22px; }
html.sidebar-collapsed .nav-link::after {
  content: attr(data-tip);
  position: fixed;
  left: calc(var(--rail-w) + 8px);
  transform: translateX(-4px);
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop);
  color: var(--text);
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.12s, transform 0.12s;
  z-index: 60;
}
html.sidebar-collapsed .nav-link:hover::after,
html.sidebar-collapsed .nav-link:focus-visible::after { opacity: 1; transform: translateX(0); }

/* ------------------------------------------------------------ page head */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.subtitle { color: var(--text-muted); margin-top: 4px; }
.page-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* -------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: 500 13.5px/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
  text-decoration: none;
}
.btn .material-symbols-outlined { font-size: 18px; }
.btn:hover { text-decoration: none; }
.btn:focus-visible, .btn-icon:focus-visible, input:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-danger, .btn-danger-ghost { background: transparent; color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }
.btn-danger:hover:not(:disabled), .btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); color: #fecaca; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon-danger:hover { background: var(--danger-soft); color: #fca5a5; }

/* --------------------------------------------------------------- panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-pad { padding: 24px; }
.panel-pad h1 { margin-bottom: 12px; }
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-head > .material-symbols-outlined { color: var(--text-muted); }
.panel-head-note { margin-left: auto; }
.panel-head .pill { margin-left: auto; }
.panel-body { padding: 20px; }
.panel-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.panel-foot [data-event-status] { margin-right: auto; }
.section-lead { margin-bottom: 16px; max-width: 760px; }
.step {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: #9cc1ff;
  font-size: 12px;
  font-weight: 600;
}

/* --------------------------------------------------------------- forms */

label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0 0 6px;
}
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

input[type=text], input[type=url], input[type=password], textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  padding: 9px 12px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 90px; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 26px 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--text-muted);
  text-align: center;
  cursor: pointer;
  margin: 0;
  transition: border-color 0.12s, background 0.12s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone.has-file { border-style: solid; border-color: rgba(0, 200, 220, 0.45); background: var(--accent-soft); }
.dropzone .material-symbols-outlined { font-size: 28px; color: var(--text-muted); margin-bottom: 4px; }
.dz-title { color: var(--text); font-weight: 500; font-size: 13.5px; }
.dz-title u { color: #7fb0ff; text-decoration: none; }
.dz-sub { font-size: 12px; color: var(--text-dim); }
.dropzone-compact { flex-direction: row; flex-wrap: wrap; gap: 4px 10px; padding: 16px; }
.dropzone-compact .material-symbols-outlined { margin: 0; font-size: 22px; }
.dropzone-compact .dz-sub { width: 100%; }

/* toggle switch */
.toggle { position: relative; display: inline-block; width: 34px; height: 20px; margin: 0; vertical-align: middle; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
  position: absolute; inset: 0;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.toggle .slider::before {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  left: 2px; top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.15s, background 0.15s;
}
.toggle input:checked + .slider { background: var(--primary); border-color: var(--primary); }
.toggle input:checked + .slider::before { transform: translateX(14px); background: #fff; }

.switch-inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; font-size: 12.5px; color: var(--text-muted); }
.switch-inline input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 30px; height: 18px; border-radius: var(--radius-pill); background: var(--surface-3); border: 1px solid var(--border-strong); transition: background 0.15s; }
.switch::before { content: ""; position: absolute; width: 12px; height: 12px; left: 2px; top: 2px; border-radius: 50%; background: var(--text-muted); transition: transform 0.15s, background 0.15s; }
.switch-inline input:checked + .switch { background: var(--primary); border-color: var(--primary); }
.switch-inline input:checked + .switch::before { transform: translateX(12px); background: #fff; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.segmented button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--text-muted);
  font: 500 12.5px var(--font);
  cursor: pointer;
}
.segmented button .material-symbols-outlined { font-size: 17px; }
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }

/* ---------------------------------------------------------------- pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill-muted { background: var(--surface-3); color: var(--text-muted); border-color: var(--border-strong); }
.pill-accent { background: var(--accent-soft); color: #67e8f9; border-color: rgba(0, 200, 220, 0.3); }
.pill-ok, .pill-published { background: var(--success-soft); color: #86efac; border-color: rgba(34, 197, 94, 0.3); }
.pill-warn { background: var(--warn-soft); color: #fcd34d; border-color: rgba(245, 158, 11, 0.3); }
.pill-rejected { background: var(--surface-3); color: var(--text-muted); border-color: var(--border-strong); }
.pill-failed { background: var(--danger-soft); color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }
.pill-expired { background: var(--surface-3); color: var(--text-dim); border-color: var(--border-strong); }
.dot-sep { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--text-dim); margin: 0 8px; vertical-align: middle; }

/* approved-but-unposted drafts */
.scheduled-panel { margin-bottom: 24px; }
.scheduled-list { list-style: none; margin: 0; padding: 6px 8px; }
.scheduled-item { display: flex; align-items: center; gap: 14px; padding: 8px 12px; border-radius: var(--radius); }
.scheduled-item:hover { background: var(--surface-2); }
.scheduled-item + .scheduled-item { border-top: 1px solid var(--border); }
.scheduled-thumb { width: 44px; height: 44px; flex: none; border-radius: 6px; object-fit: cover; background: #06080c; }
.scheduled-thumb-empty { display: grid; place-items: center; color: var(--text-dim); }
.scheduled-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.scheduled-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scheduled-item-full { align-items: flex-start; padding: 14px 12px; }
.scheduled-item-full .scheduled-thumb { width: 96px; height: 96px; }
.scheduled-item-full .scheduled-title { white-space: normal; font-size: 15px; }
.scheduled-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.scheduled-caption {
  color: var(--text-muted); font-size: 13px; margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; margin-bottom: 20px;
  border: 1px solid; border-radius: var(--radius);
  font-size: 13px; line-height: 1.5;
}
.notice .material-symbols-outlined { flex: none; margin-top: 1px; }
.notice-ok { background: var(--primary-soft); border-color: rgba(59, 130, 246, 0.3); color: #cfe0ff; }
.notice-warn { background: var(--warn-soft); border-color: rgba(245, 158, 11, 0.35); color: #fde68a; }
.notice-warn strong, .notice-ok strong { color: inherit; }
.notice-info { background: var(--surface-2, rgba(255, 255, 255, 0.03)); border-color: var(--border); color: var(--text-muted); }
.notice-info > .material-symbols-outlined { color: var(--accent); }
.notice-info strong { color: var(--text); font-weight: 600; }

/* Template size guidance */
.size-note { margin: 0 0 20px; }
.size-note-body { flex: 1; min-width: 0; }
.size-note-body > strong { display: block; margin-bottom: 4px; }
.size-note-body p { margin: 0 0 10px; }
.size-table { width: 100%; max-width: 640px; border-collapse: collapse; margin: 4px 0 10px; font-size: 12.5px; }
.size-table th {
  text-align: left; font-weight: 600; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-dim); padding: 6px 10px 6px 0; border-bottom: 1px solid var(--border);
}
.size-table td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--border); color: var(--text-muted); vertical-align: top; }
.size-table tr:last-child td { border-bottom: 0; }
.size-table td:first-child { color: var(--text); font-weight: 500; white-space: nowrap; }
.size-table td.mono { white-space: nowrap; color: var(--text); }
.size-tips { margin: 0; padding-left: 18px; }
.size-tips li { margin: 2px 0; }
@media (max-width: 640px) {
  .size-table th:last-child, .size-table td:last-child { display: none; }
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* -------------------------------------------------------- review cards */

.cards { display: flex; flex-direction: column; gap: 16px; }
.card {
  display: grid;
  grid-template-columns: minmax(260px, 380px) 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s, opacity 0.15s;
}
.card:hover { border-color: var(--border-strong); }
.card.is-loading { opacity: 0.6; pointer-events: none; }

.card-media { display: flex; flex-direction: column; background: var(--bg-sidebar); border-right: 1px solid var(--border); }
.card-image { position: relative; aspect-ratio: 1 / 1; background: #06080c; }
.card-image img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.2s; }
.card-image.is-rendering img { opacity: 0.35; }
.card-image.is-rendering::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.card-media-actions { display: flex; gap: 4px; padding: 8px; border-top: 1px solid var(--border); }
.card-media-actions .btn:first-child { flex: 1; }

.image-placeholder, .img-broken {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 20px; text-align: center; color: var(--text-dim);
}
.image-placeholder .material-symbols-outlined { font-size: 36px; }
.ph-title { color: var(--text-muted); font-weight: 500; }
.ph-sub { font-size: 12px; }

.card-body { padding: 20px 22px; display: flex; flex-direction: column; min-width: 0; }
.meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 8px; }
.meta .source { color: var(--text); font-weight: 500; }
.meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-dim); }
.article-title { font-size: 17px; line-height: 1.4; margin-bottom: 16px; }
.card-body textarea { margin-bottom: 14px; }
.card-body input { margin-bottom: 14px; }
.qa-line { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }

.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.actions-spacer { flex: 1; }
.status-line { font-size: 12.5px; min-height: 18px; margin-top: 8px; color: var(--text-muted); }
.is-ok { color: #86efac !important; }
.is-error { color: #fca5a5 !important; }
.is-info { color: var(--text-muted) !important; }

.empty-state {
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}
.empty-state .material-symbols-outlined { font-size: 40px; color: var(--text-dim); margin-bottom: 10px; }
.empty-state h2 { font-size: 17px; margin-bottom: 6px; }
.empty-state p { max-width: 420px; margin: 0 auto; }
.empty-inline { padding: 18px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border-strong); border-radius: var(--radius); margin-top: 16px; }

/* --------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }
.sources-table, .history-table { width: 100%; border-collapse: collapse; }
.sources-table { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); }
.sources-table th, .history-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.sources-table td, .history-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sources-table tr:last-child td, .history-table tr:last-child td { border-bottom: 0; }
.sources-table tbody tr:hover, .history-table tbody tr:hover { background: var(--surface-2); }

.source-form-grid { display: grid; grid-template-columns: 1fr 2fr 140px auto; gap: 12px; align-items: end; }
.source-form-grid .field { margin: 0; }
.linkedin-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* ------------------------------------------------------------ templates */

.template-upload { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.template-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
  transition: border-color 0.12s, opacity 0.12s, transform 0.12s;
}
.template-tile img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: #06080c; }
.template-tile.is-disabled img { opacity: 0.35; filter: grayscale(0.7); }
.template-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 12px; }
.template-name-wrap { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.template-name { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.template-style { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* template style editor */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 24px; align-items: start; }
.preview-frame {
  position: relative;
  aspect-ratio: 1200 / 627;
  border-radius: var(--radius);
  overflow: hidden;
  background: #06080c;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.preview-frame img { width: 100%; height: 100%; display: block; object-fit: cover; transition: opacity 0.15s; }
.preview-frame.is-loading img { opacity: 0.5; }
.preview-frame.is-loading::after {
  content: ""; position: absolute; right: 12px; top: 12px;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.25); border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.segmented-block { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
.segmented-block button { justify-content: center; padding: 0 6px; }
.label-value { float: right; color: var(--text-dim); font-weight: 400; }
.range { width: 100%; accent-color: var(--primary); margin: 6px 0 0; }
.modal-foot [data-editor-status] { margin-right: auto; }
@media (max-width: 760px) { .editor-layout { grid-template-columns: 1fr; } }
.template-tools { display: flex; align-items: center; gap: 4px; }

.template-grid-pick { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.template-grid-pick .template-tile { cursor: pointer; }
.template-grid-pick .template-tile:hover { border-color: var(--primary); transform: translateY(-1px); }
.template-grid-pick .template-name { padding: 8px 12px; }
.template-current {
  display: none;
  position: absolute; top: 8px; right: 8px;
  background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: var(--radius-pill);
}
.template-tile.is-current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.template-tile.is-current .template-current { display: block; }
.template-tile.is-busy { opacity: 0.5; pointer-events: none; }

/* -------------------------------------------------------- event layout */

.event-layout { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 20px; align-items: start; }
.event-layout .panel { margin-bottom: 0; }

/* -------------------------------------------------------------- cropper */

.cropper { display: flex; flex-direction: column; gap: 12px; }
.cropper-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cropper-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  min-height: 360px;
  background:
    repeating-conic-gradient(#0f131a 0% 25%, #0b0e14 0% 50%) 50% / 20px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.crop-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #000;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 10px 30px rgba(0, 0, 0, 0.5);
  cursor: grab;
  touch-action: none;
  user-select: none;
  container-type: inline-size;
  outline: none;
}
.crop-frame:focus-visible { box-shadow: 0 0 0 2px var(--primary), 0 10px 30px rgba(0, 0, 0, 0.5); }
.crop-frame.is-dragging { cursor: grabbing; }
.crop-frame.is-hidden { display: none; }
.crop-square { max-width: 460px; }
.crop-wide { max-width: 760px; }

.crop-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; will-change: transform; }

.crop-grid {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(33.33% - 0.5px), rgba(255, 255, 255, 0.35) 33.33%, transparent calc(33.33% + 0.5px)),
    linear-gradient(to right, transparent calc(66.66% - 0.5px), rgba(255, 255, 255, 0.35) 66.66%, transparent calc(66.66% + 0.5px)),
    linear-gradient(to bottom, transparent calc(33.33% - 0.5px), rgba(255, 255, 255, 0.35) 33.33%, transparent calc(33.33% + 0.5px)),
    linear-gradient(to bottom, transparent calc(66.66% - 0.5px), rgba(255, 255, 255, 0.35) 66.66%, transparent calc(66.66% + 0.5px));
  opacity: 0;
  transition: opacity 0.15s;
}
.crop-frame.is-dragging .crop-grid { opacity: 1; }

.crop-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-dim); font-size: 13px;
  background: #07090d;
  cursor: default;
}
.crop-empty .material-symbols-outlined { font-size: 34px; }
.cropper.has-image .crop-empty { display: none; }

/* Branding overlay: 1 --u == 1 px of the rendered canvas (see event_composer.py). */
.crop-overlay { position: absolute; inset: 0; pointer-events: none; font-family: 'Inter', Arial, sans-serif; transition: opacity 0.15s; }
.cropper.hide-overlay .crop-overlay { opacity: 0; }
.crop-wide .crop-overlay { --u: calc(100cqw / 1200); --m: 50; --logo: 72; --pill: 18; --foot: 64; --foot-font: 21; --title: 52; --title-gap: 36; }
.crop-square .crop-overlay { --u: calc(100cqw / 1080); --m: 45; --logo: 88; --pill: 22; --foot: 84; --foot-font: 28; --title: 68; --title-gap: 56; }
/* Dark overlay, same four styles and strength maths as post templates
   (--ov-a is overlay_strength / 100, set by the Cropper). */
.ov-tint { position: absolute; inset: 0; }
.crop-overlay[data-overlay="tint"] .ov-tint { background: rgba(0, 0, 0, var(--ov-a, 0.8)); }
.crop-overlay[data-overlay="bottom"] .ov-tint {
  background: linear-gradient(to bottom,
    rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 30%,
    rgba(0, 0, 0, calc(var(--ov-a, 0.8) * 0.17)) 50%,
    rgba(0, 0, 0, calc(var(--ov-a, 0.8) * 0.41)) 65%,
    rgba(0, 0, 0, calc(var(--ov-a, 0.8) * 0.72)) 85%,
    rgba(0, 0, 0, var(--ov-a, 0.8)) 100%);
}
.crop-overlay[data-overlay="gradient"] .ov-tint {
  background: linear-gradient(to bottom right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, var(--ov-a, 0.8)) 100%);
}
.crop-overlay[data-overlay="none"] .ov-tint { background: none; }
/* Layers switched off per photo */
.cropper.hide-title .ov-title-wrap,
.cropper.hide-badge .ov-logo,
.cropper.hide-badge .ov-pill,
.cropper.hide-footer .ov-footer { display: none; }
.cropper.hide-footer .ov-title-wrap { bottom: calc(var(--u) * var(--title-gap)); }
.ov-logo { position: absolute; left: calc(var(--u) * var(--m)); top: calc(var(--u) * var(--m)); height: calc(var(--u) * var(--logo)); }
.ov-pill {
  position: absolute;
  right: calc(var(--u) * var(--m));
  top: calc(var(--u) * (var(--m) + 8));
  padding: calc(var(--u) * 8) calc(var(--u) * 18);
  border: calc(var(--u) * 2) solid #00c8dc;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.47);
  color: #fff;
  font-weight: 700;
  font-size: calc(var(--u) * var(--pill));
  line-height: 1.15;
}
.ov-title-wrap {
  position: absolute;
  left: calc(var(--u) * var(--m));
  right: calc(var(--u) * var(--m));
  bottom: calc(var(--u) * (var(--foot) + var(--title-gap)));
}
.ov-bar { display: block; width: 12cqw; height: calc(var(--u) * 5); background: #00c8dc; margin-bottom: calc(var(--u) * 18); }
.ov-title {
  color: #fff;
  font-weight: 700;
  font-size: calc(var(--u) * var(--title));
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.ov-title.is-placeholder { color: rgba(255, 255, 255, 0.45); }
.ov-footer {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(var(--u) * var(--foot));
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 calc(var(--u) * var(--m));
  background: rgba(8, 10, 16, 0.88);
  border-top: calc(var(--u) * 3) solid #00c8dc;
  color: #dce1e6;
  font-size: calc(var(--u) * var(--foot-font));
}
.ov-footer strong { color: #fff; font-weight: 700; }

.cropper-controls { display: flex; align-items: center; gap: 8px; }
.cropper-controls input[type=range] { flex: 0 1 260px; accent-color: var(--primary); }
.zoom-readout { color: var(--text-muted); min-width: 44px; }
.controls-spacer { flex: 1; }
.cropper-hint { font-size: 12px; color: var(--text-dim); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.crop-warn { color: #fcd34d; display: inline-flex; align-items: center; gap: 4px; }
.cropper:not(.has-image) .cropper-controls,
.cropper:not(.has-image) .style-panel { opacity: 0.4; pointer-events: none; }

/* Filmstrip: the post's photos, click to edit, × to remove */
.filmstrip { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.film-tile { position: relative; width: 92px; flex: none; }
.film-pick {
  display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; overflow: hidden;
  border: 2px solid var(--border-strong); border-radius: 8px; background: #06080c; cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.film-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.film-pick:hover { border-color: var(--text-dim); }
.film-tile.is-active .film-pick { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.film-num {
  position: absolute; left: 6px; bottom: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  background: rgba(8, 10, 16, 0.85); color: #e6ebf2; pointer-events: none;
}
.film-tile:first-child .film-num { background: var(--accent); color: #04121a; }
.film-remove {
  position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface-3); color: var(--text-muted);
  cursor: pointer; opacity: 0; transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.film-remove .material-symbols-outlined { font-size: 14px; }
.film-tile:hover .film-remove, .film-remove:focus-visible { opacity: 1; }
.film-remove:hover { color: #fca5a5; border-color: rgba(239, 68, 68, 0.5); }
.film-add {
  width: 92px; aspect-ratio: 4 / 3; flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 2px dashed var(--border-strong); border-radius: 8px; background: transparent; color: var(--text-muted);
  font-size: 11.5px; font-weight: 500; cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.film-add:hover { border-color: var(--primary); color: var(--text); background: var(--primary-soft); }

/* Per-photo style panel (overlay + layers) */
.style-panel {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.style-row { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.style-label { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); min-width: 92px; }
.segmented-sm button { padding: 0 10px; height: 26px; font-size: 12px; }
.style-strength { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 180px; min-width: 160px; }
.style-strength input[type=range] { flex: 1; accent-color: var(--primary); margin: 0; }
.style-strength input[type=range]:disabled { opacity: 0.35; }
.style-strength .mono { min-width: 36px; text-align: right; color: var(--text-muted); font-size: 12px; }
.chip-toggle { position: relative; margin: 0; cursor: pointer; }
.chip-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.chip-toggle > span {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px 0 8px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--bg);
  font-size: 12px; font-weight: 500; color: var(--text-muted); transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip-toggle > span .material-symbols-outlined { font-size: 15px; }
.chip-toggle:hover > span { color: var(--text); }
.chip-toggle input:checked + span { background: var(--primary-soft); border-color: rgba(59, 130, 246, 0.5); color: #d6e5ff; }
.chip-toggle input:focus-visible + span { box-shadow: 0 0 0 2px var(--primary); }
.style-note { flex-basis: 100%; font-size: 12px; color: var(--text-dim); }

/* Review card: multi-photo count + thumbnail strip */
.image-count {
  position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; background: rgba(8, 10, 16, 0.82); color: #e6ebf2;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em; pointer-events: none;
}
.card-thumbs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.card-thumb {
  width: 48px; height: 48px; padding: 0; overflow: hidden; flex: none;
  border: 2px solid var(--border-strong); border-radius: 6px; background: #06080c; cursor: pointer; transition: border-color 0.15s;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb:hover { border-color: var(--text-dim); }
.card-thumb.is-active { border-color: var(--primary); }

/* --------------------------------------------------------------- modals */

.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 5, 9, 0.72); backdrop-filter: blur(3px); animation: fade 0.15s ease-out; }
.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  animation: pop 0.16s ease-out;
}
.modal-lg { max-width: 920px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; margin-bottom: 2px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
body.modal-open { overflow: hidden; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.985); } }

/* -------------------------------------------------------------- login */

.no-shell .content { max-width: none; padding: 0; }
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1000px 500px at 50% -10%, rgba(59, 130, 246, 0.12), transparent 70%), var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-pop);
}
.login-logo { width: 44px; height: 44px; object-fit: contain; margin-bottom: 18px; }
.login-card h1 { font-size: 21px; margin-bottom: 4px; }
.login-sub { color: var(--text-muted); margin-bottom: 22px; }
.login-form input { margin-bottom: 16px; }

/* ------------------------------------------------- flashes / snackbar */

.flashes { padding-top: 20px; }
.flashes + .content { padding-top: 12px; }
.flash { padding: 10px 14px; border-radius: var(--radius); border: 1px solid; font-size: 13px; margin-bottom: 12px; }
.flash-error { background: var(--danger-soft); border-color: rgba(239, 68, 68, 0.35); color: #fecaca; }
.flash-success { background: var(--success-soft); border-color: rgba(34, 197, 94, 0.35); color: #bbf7d0; }
.flash-info { background: var(--primary-soft); border-color: rgba(59, 130, 246, 0.35); color: #cfe0ff; }

.snackbar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  min-width: 260px;
  max-width: 520px;
  padding: 11px 16px;
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 200;
}
.snackbar.is-show { opacity: 1; transform: translate(-50%, 0); }
.snackbar.is-success { border-left-color: var(--success); }
.snackbar.is-error { border-left-color: var(--danger); }

/* ----------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .event-layout { grid-template-columns: 1fr; }
  .card { grid-template-columns: 260px 1fr; }
}

/* Narrower screens always get the icon rail (the toggle is hidden). */
@media (max-width: 1100px) {
  .topbar-brand { flex-basis: var(--rail-w) !important; width: var(--rail-w) !important; justify-content: center; padding: 0 !important; }
  .topbar-brand [data-sidebar-toggle], .brand-text, .sidebar-foot { display: none; }
  .brand { display: flex !important; }
  .brand-logo { width: 28px; height: 28px; }
  .sidebar { width: var(--rail-w) !important; padding-left: 12px !important; padding-right: 12px !important; }
  .has-shell .main { margin-left: var(--rail-w) !important; }
  .nav-label { display: none; }
  .nav-section { padding: 10px 0 !important; }
  .nav-section::before { content: ""; display: block; height: 1px; margin: 0 6px; background: var(--border); }
  .nav-section:first-child { display: none; }
  .nav-link { justify-content: center; padding: 0; }
  .nav-link .material-symbols-outlined { font-size: 22px; }
  .nav-badge {
    position: absolute; top: 4px; right: 4px; margin: 0;
    min-width: 16px; height: 16px; padding: 0 4px;
    font-size: 10px; background: var(--primary); color: #fff;
  }
  .nav-link::after {
    content: attr(data-tip);
    position: fixed; left: calc(var(--rail-w) + 8px);
    transform: translateX(-4px);
    padding: 6px 10px; border-radius: 6px;
    background: var(--surface-3); border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-pop); color: var(--text);
    font-size: 12.5px; font-weight: 500; white-space: nowrap;
    opacity: 0; pointer-events: none;
    transition: opacity 0.12s, transform 0.12s; z-index: 60;
  }
  .nav-link:hover::after, .nav-link:focus-visible::after { opacity: 1; transform: translateX(0); }
}

@media (max-width: 900px) {
  :root { --gutter: 20px; }
  .card { grid-template-columns: 1fr; }
  .card-media { border-right: 0; border-bottom: 1px solid var(--border); }
  .source-form-grid { grid-template-columns: 1fr; }
  .cropper-stage { padding: 10px; min-height: 0; }
  .modal { padding: 0; align-items: stretch; }
  .modal-dialog { max-height: 100vh; border-radius: 0; }
  .footer-right .footer-sep, .footer-right .footer-item:last-child { display: none; }
}

@media (max-width: 640px) {
  :root { --rail-w: 60px; --gutter: 16px; }
  .crumb-section, .crumb-sep, .status-text, .user-name, .user-caret { display: none; }
  .status-chip { padding: 0; width: 32px; justify-content: center; }
  .topbar-actions { gap: 6px; }
  .footer-inner { flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; padding-top: 12px; padding-bottom: 12px; }
}

/* ------------------------------------------------------------ analytics */
/* Chart colours: validated categorical slots on the dark surface, sequential blue ramp,
   reserved status colours. Text in charts always uses text tokens, never series colour. */
#analytics, #engagement {
  --an-surface: var(--surface);
  --an-cell-empty: rgba(255, 255, 255, 0.04);
  --series-1: #3b82f6;  /* blue (brand) */
  --series-2: #d95926;  /* orange */
  --series-3: #199e70;  /* aqua */
  --series-4: #c98500;  /* yellow */
  --series-neutral: #5d6779;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-critical: #d03b3b;
  --seq-100: #cde2fb; --seq-200: #9ec5f4; --seq-300: #6da7ec; --seq-400: #3987e5; --seq-500: #256abf; --seq-600: #184f95;
}
.an { display: flex; flex-direction: column; gap: 20px; transition: opacity 0.15s; }
.an.is-loading { opacity: 0.55; pointer-events: none; }
.an-filters { align-items: center; gap: 12px; }
.an-grid { display: grid; gap: 20px; align-items: stretch; }
.an-grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.an-grid-1-1 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.an-grid-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.an-stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.an-stack .an-card { flex: 1 0 auto; }  /* grow to fill, never shrink below content */
.an-card { margin: 0; min-width: 0; display: flex; flex-direction: column; }
.an-card-head { align-items: flex-start; gap: 12px; }
.an-card-head h2 { margin: 0; }
.an-card-head > div:first-child { flex: 1; min-width: 0; }
.an-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.an-card-tools { display: flex; align-items: center; gap: 10px; flex: none; }
.an-card-tools .btn-icon.is-active { color: var(--text); background: var(--surface-3); }
.an-card-body { flex: 1; min-height: 120px; overflow: hidden; }  /* charts never spill out of their card */
.an-card-body-flush { padding: 6px 0; }
.an-svg { display: block; overflow: visible; font-family: inherit; }
.an-grid, .an-axis, .an-cross { stroke-width: 1; }
.an-svg .an-grid { stroke: rgba(255, 255, 255, 0.06); }
.an-svg .an-axis { stroke: var(--border-strong); }
.an-svg .an-cross { stroke: var(--text-dim); stroke-dasharray: 3 3; }
.an-tick { font-size: 11px; fill: var(--text-dim); font-variant-numeric: tabular-nums; }
.an-label { font-size: 12px; fill: var(--text-muted); }
.an-value { font-size: 11px; fill: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.an-track { fill: rgba(255, 255, 255, 0.05); }
.an-bar-group { transition: opacity 0.1s; }
.an-bar-group.is-hover path { filter: brightness(1.15); }
.an-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 150px; color: var(--text-dim); font-size: 13px; text-align: center; padding: 16px;
}
.an-empty .material-symbols-outlined { font-size: 28px; opacity: 0.7; }

/* Legend */
.an-legend { display: inline-flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.lg-item { display: inline-flex; align-items: center; gap: 6px; }
.lg-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* Tooltip */
.an-tooltip {
  position: fixed; z-index: 1000; pointer-events: none; min-width: 140px; max-width: 280px;
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: rgba(17, 22, 31, 0.97); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); font-size: 12px; color: var(--text);
}
.tt-title { font-weight: 600; margin-bottom: 4px; color: var(--text); }
.tt-text { color: var(--text-muted); line-height: 1.45; }
.tt-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.tt-swatch { width: 8px; height: 8px; border-radius: 2px; }
.tt-k { color: var(--text-muted); flex: 1; }
.tt-v { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Tables */
.an-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.an-table th { text-align: left; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); padding: 6px 8px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.an-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.an-table td:first-child { color: var(--text); }
.an-table .num { text-align: right; font-variant-numeric: tabular-nums; }
[data-table] { max-height: 320px; overflow: auto; }

/* KPI tiles */
.an-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.kpi {
  position: relative; padding: 14px 16px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); min-width: 0; outline: none; overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}
.kpi:hover, .kpi:focus-visible { border-color: var(--border-strong); transform: translateY(-1px); }
.kpi-warn { border-color: rgba(250, 178, 25, 0.35); }
.kpi-bad { border-color: rgba(208, 59, 59, 0.4); }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; min-height: 28px; min-width: 0; }
.kpi-label { display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); }
.kpi-label .material-symbols-outlined { font-size: 16px; color: var(--text-muted); }
.kpi-spark { flex: 0 1 96px; width: 96px; max-width: 42%; min-width: 0; height: 28px; opacity: 0.9; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); line-height: 1.1; margin: 8px 0 6px; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-delta { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 1px 7px; border-radius: 999px; flex: none; }
.kpi-delta-good { color: #6ee7a0; background: rgba(12, 163, 12, 0.14); }
.kpi-delta-bad { color: #fca5a5; background: rgba(208, 59, 59, 0.16); }
.kpi-delta-none { color: var(--text-dim); background: rgba(255, 255, 255, 0.04); font-weight: 500; }

/* Funnel */
.an-funnel { display: flex; flex-direction: column; gap: 12px; }
.fn-row { display: grid; grid-template-columns: 1fr; gap: 5px; cursor: default; }
.fn-head { display: flex; justify-content: space-between; font-size: 13px; }
.fn-stage { color: var(--text); font-weight: 500; }
.fn-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.fn-track { height: 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.fn-bar { height: 100%; border-radius: 6px; transition: width 0.3s ease; }
.fn-conv { font-size: 11.5px; color: var(--text-dim); min-height: 14px; }
.fn-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-muted); }
.fn-foot strong { color: var(--text); }

/* Mix */
.mx-block + .mx-block { margin-top: 18px; }
.mx-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--text); margin-bottom: 8px; }
.mx-bar { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; background: rgba(255, 255, 255, 0.05); }
.mx-seg { height: 100%; min-width: 3px; }
.mx-seg-empty { background: transparent; }
.mx-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.mx-legend strong { color: var(--text); font-variant-numeric: tabular-nums; }
.mx-models { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 16px; }

/* Lists */
.an-list { display: flex; flex-direction: column; }
.an-list-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.an-list-row:last-child { border-bottom: 0; }
.an-list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.an-list-title { color: var(--text); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
a.an-list-title:hover { color: #d6e5ff; text-decoration: underline; }
.an-list-meta { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-fail-icon { color: #fca5a5; font-size: 20px; }

@media (max-width: 1280px) {
  .an-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .an-grid-2-1, .an-grid-1-1, .an-grid-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .an-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 24px; }
}

/* ------------------------------------------------------------ engagement */
.an-card-ai { background: linear-gradient(160deg, rgba(59, 130, 246, 0.08), var(--surface) 55%); }
.ai-icon { font-size: 18px; color: var(--accent); vertical-align: -3px; margin-right: 6px; }
.ai-empty { display: flex; gap: 14px; align-items: flex-start; padding: 8px 0; }
.ai-empty .material-symbols-outlined { font-size: 30px; color: var(--accent); flex: none; }
.ai-empty p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; }
.ai-summary { font-size: 14.5px; line-height: 1.6; color: var(--text); margin: 0 0 16px; }
.ai-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.ai-block { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.02); }
.ai-block-title { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.ai-good .ai-block-title { color: #6ee7a0; }
.ai-warn .ai-block-title { color: #fcd34d; }
.ai-next .ai-block-title { color: #93c5fd; }
.ai-block ul { margin: 0; padding-left: 16px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.ai-block li + li { margin-top: 4px; }

.pill-sent { text-transform: capitalize; gap: 4px; }
.pill-sent-positive { background: rgba(12, 163, 12, 0.16); color: #86efac; }
.pill-sent-neutral { background: rgba(93, 103, 121, 0.25); color: #c3c9d4; }
.pill-sent-negative { background: rgba(208, 59, 59, 0.18); color: #fca5a5; }
.pill-sent-mixed { background: rgba(250, 178, 25, 0.16); color: #fcd34d; }

.sent-bar { display: flex; gap: 2px; height: 8px; width: 110px; border-radius: 4px; overflow: hidden; background: rgba(255, 255, 255, 0.05); }
.sent-bar span { display: block; height: 100%; min-width: 3px; }
.sent-bar.is-empty { opacity: 0.5; }
.sent-list { display: flex; flex-direction: column; gap: 4px; }
.sent-list-head { margin-top: 18px; }
.sent-row { display: grid; grid-template-columns: 1fr auto 32px; gap: 10px; align-items: center; padding: 6px 8px; margin: 0 -8px; border: 0; border-radius: 8px; background: transparent; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.sent-row:hover { background: rgba(255, 255, 255, 0.04); }
.sent-row-title { font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sent-row-n { font-size: 11.5px; color: var(--text-dim); text-align: right; }

.sub-chart + .sub-chart { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.sub-chart-title { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 4px; }

.up-pos { min-width: 36px; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-muted); }
.up-pos.is-next { background: var(--primary); color: #fff; }
.up-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: #06080c; flex: none; }
.up-eta { flex: none; color: var(--text-muted); }

.tracker th:first-child, .tracker td:first-child { padding-left: 20px; }
.tracker th:last-child, .tracker td:last-child { padding-right: 20px; }
.tracker-row { cursor: pointer; transition: background 0.12s; }
.tracker-row:hover, .tracker-row:focus-visible { background: rgba(255, 255, 255, 0.03); outline: none; }
.tracker-row.is-untracked td.num { color: var(--text-dim); }
.tracker-post { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 460px; }
.tracker-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: #06080c; flex: none; }
.tracker-thumb-empty { display: inline-block; border: 1px dashed var(--border-strong); }
.tracker-actions { text-align: right; white-space: nowrap; }
.tracker td.muted { white-space: nowrap; }
.tracker td.num { color: var(--text); font-weight: 500; }
.tracker-foot { display: flex; justify-content: center; padding: 10px; border-top: 1px solid var(--border); }

/* Post modal */
.post-modal-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.post-modal-head img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex: none; }
.post-modal-head h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 560px; }
.post-modal-body { display: grid; grid-template-columns: minmax(280px, 5fr) minmax(300px, 7fr); gap: 24px; }
.post-col { min-width: 0; }
.post-section-title { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); margin: 0 0 8px; }
.post-section-title + .post-section-title, .post-col .post-section-title:not(:first-child) { margin-top: 22px; }
.metrics-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.metrics-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.metrics-form input { width: 100%; }
.metrics-form-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }
.post-insight { font-size: 13px; line-height: 1.55; color: var(--text-muted); padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: rgba(255, 255, 255, 0.02); margin-bottom: 10px; }
.post-insight p { margin: 8px 0 0; color: var(--text); }
.post-insight-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.comments-form textarea { width: 100%; resize: vertical; }
.comments-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.comment-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; max-height: 360px; overflow: auto; padding-right: 4px; }
.comment { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.02); border-left-width: 3px; }
.comment.is-positive { border-left-color: var(--status-good); }
.comment.is-negative { border-left-color: var(--status-critical); }
.comment.is-neutral { border-left-color: var(--series-neutral); }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-size: 12.5px; font-weight: 600; color: var(--text); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comment-del { opacity: 0; transition: opacity 0.15s; }
.comment:hover .comment-del { opacity: 1; }
.comment-text { font-size: 13px; line-height: 1.5; color: var(--text-muted); white-space: pre-wrap; }
.comment-themes { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.comment-empty { padding: 10px 0; }
.btn.is-busy { opacity: 0.6; pointer-events: none; }

@media (max-width: 860px) {
  .post-modal-body { grid-template-columns: 1fr; }
}
