/* ============================================================
   Oto-Share — admin panel styles
   Dark, modern SaaS dashboard. Single accent (indigo/violet).
   ============================================================ */

:root {
  /* Palette */
  --bg: #0b0d13;
  --bg-panel: #11141d;
  --bg-elevated: #161a26;
  --bg-hover: #1b202e;
  --bg-input: #0e1119;
  --border: #222738;
  --border-strong: #2e3448;

  --text: #e7eaf2;
  --text-dim: #9aa2b6;
  --text-faint: #6b7288;

  --accent: #6d6cf5;
  --accent-hover: #7f7ef8;
  --accent-soft: rgba(109, 108, 245, 0.14);
  --accent-border: rgba(109, 108, 245, 0.38);

  --ok: #34c98e;
  --ok-soft: rgba(52, 201, 142, 0.13);
  --warn: #e8b341;
  --warn-soft: rgba(232, 179, 65, 0.13);
  --danger: #ef5f75;
  --danger-soft: rgba(239, 95, 117, 0.12);
  --info: #4da3f0;
  --info-soft: rgba(77, 163, 240, 0.13);
  --neutral-soft: rgba(154, 162, 182, 0.13);

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --sidebar-w: 232px;
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.55);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; }
a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

svg { display: block; }

::placeholder { color: var(--text-faint); }

/* ============ Scrollbars ============ */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Login
   ============================================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  background:
    radial-gradient(800px 400px at 50% -10%, rgba(109, 108, 245, 0.12), transparent 65%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.login-brand h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.login-brand p { font-size: 13px; color: var(--text-dim); }

.logo-mark {
  flex: none;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), #9b5cf6);
  color: #fff;
}
.logo-mark svg { width: 22px; height: 22px; }

.login-error {
  background: var(--danger-soft);
  border: 1px solid rgba(239, 95, 117, 0.3);
  color: var(--danger);
  font-size: 13px;
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-4);
}

/* ============================================================
   Forms
   ============================================================ */
.field { margin-bottom: var(--sp-4); }

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: var(--sp-1);
}

.field .field-hint {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: var(--sp-1);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px var(--sp-3);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  color-scheme: dark;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea { resize: vertical; min-height: 88px; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa2b6' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.field-row {
  display: flex;
  gap: var(--sp-3);
}
.field-row > .field { flex: 1; min-width: 0; }

/* Toggle switch */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
  width: 40px;
  height: 22px;
  cursor: pointer;
}
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.switch .track {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.18s;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
}
.switch-row .switch-label { font-weight: 600; }
.switch-row .switch-desc { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }

/* Checkbox */
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  user-select: none;
}
.check input {
  appearance: none;
  width: 17px;
  height: 17px;
  flex: none;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-input);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.check input:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.check input:checked::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(0.5px, -1px);
}
.check input:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); }

/* Radio segmented */
.segmented {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:not(:disabled):hover { background: var(--bg-hover); border-color: var(--text-faint); }

.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:not(:disabled):hover { background: var(--bg-hover); color: var(--text); }

.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(239, 95, 117, 0.25); }
.btn-danger:not(:disabled):hover { background: rgba(239, 95, 117, 0.22); }

.btn-sm { font-size: 12.5px; padding: 5px 10px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-block { width: 100%; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-icon svg { width: 17px; height: 17px; }
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }
.btn-icon.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* Spinner */
.spinner {
  width: 15px;
  height: 15px;
  flex: none;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner.lg { width: 26px; height: 26px; border-width: 2.5px; color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-7) var(--sp-4);
  color: var(--text-dim);
  font-size: 13px;
}

/* ============================================================
   Layout
   ============================================================ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo-mark { width: 32px; height: 32px; }
.sidebar-brand .logo-mark svg { width: 18px; height: 18px; }
.sidebar-brand-name { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; flex: 1; }
.sidebar-close { display: none; }

.sidebar-nav {
  flex: 1;
  padding: var(--sp-3) var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px var(--sp-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-item span:first-of-type { flex: 1; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-hover); }

.nav-badge {
  flex: none;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

.sidebar-footer {
  padding: var(--sp-3) var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-1);
  min-width: 0;
}
.sidebar-user-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
}
.sidebar-user-dot.ok { background: var(--ok); }
.sidebar-user-dot.bad { background: var(--danger); }
.sidebar-user-email {
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.6);
  z-index: 35;
}

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  background: rgba(11, 13, 19, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  min-height: 56px;
}
.topbar-menu { display: none; }
.topbar-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }

.view-root {
  flex: 1;
  padding: var(--sp-5);
  max-width: 1240px;
  width: 100%;
}

/* ============================================================
   Cards / panels
   ============================================================ */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}

.card + .card { margin-top: var(--sp-5); }

.card-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.card-title svg { width: 15px; height: 15px; color: var(--text-dim); }
.card-sub { font-size: 12.5px; color: var(--text-dim); margin-top: calc(-1 * var(--sp-3)); margin-bottom: var(--sp-4); }

.grid {
  display: grid;
  gap: var(--sp-4);
}
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-2 { grid-template-columns: 1fr 1fr; }

/* Stat card */
.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
}
.stat-value .unit { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.stat-foot { font-size: 12.5px; color: var(--text-dim); }
.stat-foot strong { color: var(--text); font-weight: 600; }

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.4;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge.no-dot::before { display: none; }

.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent-hover); }
.badge-neutral { background: var(--neutral-soft); color: var(--text-dim); }

.badge-pulse::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.multiplier-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  margin-left: var(--sp-2);
  white-space: nowrap;
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 720px;
}

thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  white-space: nowrap;
}

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.35;
  font-size: 9px;
  vertical-align: 1px;
}
th.sortable.sorted .sort-arrow { opacity: 1; color: var(--accent-hover); }

tbody td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--bg-hover); }

td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.muted { color: var(--text-dim); }
td.nowrap { white-space: nowrap; }

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-1);
}

.reel-thumb {
  width: 44px;
  height: 58px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: block;
  flex: none;
}
.reel-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
}
.reel-thumb.placeholder svg { width: 18px; height: 18px; }
.reel-thumb.sm { width: 34px; height: 44px; }

.cell-media {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 220px;
}
.cell-media .caption {
  font-weight: 500;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-width: 320px;
}
.cell-media .caption-sub {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 1px;
}

tr.row-dim > td:not(.actions-cell) { opacity: 0.5; }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
  padding: var(--sp-7) var(--sp-5);
  color: var(--text-dim);
}
.empty-state svg { width: 36px; height: 36px; color: var(--text-faint); margin-bottom: var(--sp-2); }
.empty-state h3 { font-size: 14.5px; font-weight: 700; color: var(--text); }
.empty-state p { font-size: 13px; max-width: 380px; }
.empty-state .btn { margin-top: var(--sp-3); }

/* ============================================================
   Toolbar (reels filters etc.)
   ============================================================ */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.toolbar .spacer { flex: 1; }
.toolbar select { width: auto; min-width: 180px; }

/* ============================================================
   Dashboard specifics
   ============================================================ */
.next-pick {
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
}
.next-pick .reel-thumb { width: 72px; height: 96px; border-radius: var(--radius); }
.next-pick-caption {
  font-weight: 500;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.next-pick-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-2);
  font-size: 12.5px;
  color: var(--text-dim);
}
.next-pick-meta strong { color: var(--text); font-variant-numeric: tabular-nums; }

.mini-list { display: flex; flex-direction: column; }
.mini-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.mini-item:last-child { border-bottom: 0; }
.mini-item .mini-caption {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.mini-item .mini-sub { font-size: 12px; color: var(--text-faint); }

/* ============================================================
   Accounts
   ============================================================ */
.account-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.account-item {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}
.account-item:hover { border-color: var(--border-strong); }
.account-avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  text-transform: uppercase;
}
.account-info { flex: 1; min-width: 0; }
.account-username { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-meta { font-size: 12.5px; color: var(--text-dim); margin-top: 1px; }

/* ============================================================
   Settings
   ============================================================ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 var(--sp-4);
}
.settings-sep { border: 0; border-top: 1px solid var(--border); margin: var(--sp-4) 0; }
.save-bar {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(4, 6, 10, 0.65);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--sp-6) var(--sp-4);
  overflow-y: auto;
  animation: fadeIn 0.15s ease;
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  animation: modalIn 0.18s ease;
  margin: auto 0;
}
.modal.modal-sm { max-width: 400px; }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } }

.modal-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 700; flex: 1; }
.modal-body { padding: var(--sp-5); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
}

.modal-reel-preview {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--sp-4);
}
.modal-reel-preview .caption {
  font-size: 12.5px;
  color: var(--text-dim);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.confirm-text { color: var(--text-dim); font-size: 13.5px; }
.confirm-text strong { color: var(--text); }

/* ============================================================
   Toasts
   ============================================================ */
.toast-root {
  position: fixed;
  bottom: var(--sp-5);
  right: var(--sp-5);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-width: 360px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  animation: toastIn 0.22s ease;
}
.toast.leaving { animation: toastOut 0.2s ease forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }

.toast-icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.toast-icon svg { width: 100%; height: 100%; }
.toast.success .toast-icon { color: var(--ok); }
.toast.error .toast-icon { color: var(--danger); }
.toast.info .toast-icon { color: var(--info); }
.toast-msg { flex: 1; }
.toast-msg .toast-title { font-weight: 700; }
.toast-msg .toast-detail { color: var(--text-dim); margin-top: 1px; font-size: 12.5px; }

/* ============================================================
   Misc
   ============================================================ */
.error-inline {
  font-size: 12.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-2);
  word-break: break-word;
  max-width: 340px;
}

.link-ext {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  white-space: nowrap;
}
.link-ext svg { width: 12px; height: 12px; }

.metrics-inline {
  display: flex;
  gap: var(--sp-3);
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.metrics-inline strong { color: var(--text); }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.section-head h3 { font-size: 15px; font-weight: 700; }
.section-head p { font-size: 12.5px; color: var(--text-dim); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: inline-flex; }
  .main { margin-left: 0; }
  .topbar-menu { display: inline-flex; }
  .view-root { padding: var(--sp-4); }
  .topbar { padding: var(--sp-3) var(--sp-4); }
  .toast-root { left: var(--sp-4); right: var(--sp-4); max-width: none; }
  .toolbar select { flex: 1; min-width: 0; }
}
