/* RevTrac — premium dark theme */

:root {
  --bg-0: #06080F;
  --bg-1: #0A0D17;
  --surface: rgba(255,255,255,0.03);
  --surface-strong: rgba(255,255,255,0.05);
  --border: rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.12);
  --text: #E6E9EF;
  --text-muted: #8B93A7;
  --text-dim: #5A6478;
  --accent: #10B981;
  --accent-2: #34D399;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --rose: #F43F5E;
  --rose-soft: rgba(244, 63, 94, 0.12);
  --blue: #6BB7FF;
  --amber: #F7B955;
  --violet: #B58BFF;
  color-scheme: dark;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03', 'tnum';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.011em;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(16, 185, 129, 0.10) 0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(107, 183, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(181, 139, 255, 0.05) 0%, transparent 60%),
    var(--bg-0);
  min-height: 100vh;
  overflow-x: hidden;
}

.container { max-width: 1320px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 640px) { .container { padding: 0 16px; } }

/* ─── Navbar ─────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 13, 23, 0.7);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; gap: 12px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 19px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text); text-decoration: none;
}
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  display: grid; place-items: center;
  box-shadow: 0 6px 16px -4px rgba(16, 185, 129, 0.5),
              inset 0 1px 0 rgba(255,255,255,0.25);
}
.logo-mark svg { width: 18px; height: 18px; color: #fff; stroke-width: 2.4; }
.logo .accent { color: var(--accent); }

.nav-links {
  display: flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.04);
  padding: 4px; border-radius: 12px;
  border: 1px solid var(--border);
}
.nav-link {
  padding: 8px 14px; border-radius: 9px;
  font-size: 13.5px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: all 0.15s ease;
  display: flex; align-items: center; gap: 6px;
  text-decoration: none;
}
.nav-link:hover { color: var(--text); }
.nav-link.active {
  background: rgba(255,255,255,0.08); color: var(--text);
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 0 0 1px rgba(255,255,255,0.04);
}
.nav-link svg { width: 15px; height: 15px; }

.nav-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  display: grid; place-items: center; cursor: pointer;
  color: var(--text-muted); transition: all 0.15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #B58BFF 0%, #6BB7FF 100%);
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 13px;
  box-shadow: 0 6px 16px -4px rgba(107, 183, 255, 0.4);
  cursor: pointer;
}

@media (max-width: 720px) {
  .nav-inner { padding: 14px 0; }
  .nav-links { gap: 2px; padding: 3px; }
  .nav-link { padding: 7px 9px; font-size: 12.5px; }
  .nav-link span { display: none; }
  .nav-link svg { width: 16px; height: 16px; }
  .avatar { width: 32px; height: 32px; font-size: 12px; }
  .icon-btn { width: 32px; height: 32px; }
  .logo { font-size: 16px; }
  .logo-mark { width: 28px; height: 28px; }
}
@media (max-width: 480px) {
  .container { padding: 0 12px; }
  .page-header { padding: 24px 0 16px; }
  .page-title h1 { font-size: 24px; }
  .page-title p { font-size: 13px; }
  .search { width: 100%; }
  .header-actions { width: 100%; }
  .header-actions > * { flex: 1; justify-content: center; }
}

/* ─── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 40px 0 24px;
  flex-wrap: wrap; gap: 16px;
}
.page-title h1 {
  margin: 0; font-size: 32px; font-weight: 600;
  letter-spacing: -0.028em; color: var(--text);
}
.page-title p { margin: 6px 0 0; color: var(--text-muted); font-size: 14.5px; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 13px; border-radius: 11px;
  font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
  border: 1px solid transparent;
  font-family: inherit;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  color: #042F23;
  background: linear-gradient(180deg, #34D399 0%, #10B981 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset,
              0 8px 18px -6px rgba(16, 185, 129, 0.55),
              0 0 0 1px rgba(16, 185, 129, 0.35);
  font-weight: 600;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary svg { stroke-width: 2.5; }

.btn-ghost {
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border-color: var(--border);
}
.btn-ghost:hover { background: rgba(255,255,255,0.07); border-color: var(--border-strong); }

.btn-danger {
  color: #fff;
  background: linear-gradient(180deg, #FB7185 0%, #F43F5E 100%);
  font-weight: 600;
}
.btn-danger:hover { transform: translateY(-1px); }

.btn-sm { padding: 7px 11px; font-size: 12.5px; }

/* ─── Pills (date presets) ──────────────────────────────────── */
.pill-group {
  display: flex; align-items: center; gap: 2px;
  background: rgba(255,255,255,0.04);
  padding: 4px; border-radius: 12px;
  border: 1px solid var(--border);
}
.pill {
  padding: 7px 12px; border-radius: 9px;
  font-size: 12.5px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: all 0.15s;
  background: transparent; border: none; font-family: inherit;
}
.pill:hover { color: var(--text); }
.pill.active {
  background: rgba(255,255,255,0.08); color: var(--text);
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset;
}

/* ─── Inputs ──────────────────────────────────────────────── */
.input, input[type="text"], input[type="password"], input[type="number"],
input[type="date"], input[type="email"], select, textarea {
  background: rgba(255,255,255,0.04) !important;
  border: 1px solid var(--border) !important;
  border-radius: 9px !important;
  padding: 8px 12px !important;
  color: var(--text) !important;
  font-family: inherit !important;
  font-size: 13.5px !important;
  outline: none !important;
  transition: all 0.15s !important;
}
.input:hover, input:hover, select:hover, textarea:hover { border-color: var(--border-strong) !important; }
.input:focus, input:focus, select:focus, textarea:focus {
  border-color: rgba(16,185,129,0.5) !important;
  background: rgba(255,255,255,0.06) !important;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.12) !important;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
select.input, select {
  padding-right: 28px !important; appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238B93A7' d='M5 6L0 0h10z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
}
input[type="date"] { color-scheme: dark; }

label { color: var(--text-muted); font-size: 12.5px; display: block; margin-bottom: 4px; }

/* ─── Search box ─────────────────────────────────────────── */
.search {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 11px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  width: 280px; max-width: 100%;
  transition: all 0.15s;
}
.search:focus-within { border-color: rgba(16,185,129,0.45); background: rgba(255,255,255,0.06); }
.search svg { width: 15px; height: 15px; color: var(--text-muted); }
.search input {
  flex: 1; background: transparent !important; border: none !important;
  outline: none !important; color: var(--text) !important;
  font-family: inherit !important; font-size: 13.5px !important;
  padding: 0 !important; box-shadow: none !important;
}
.search .kbd {
  font-size: 10.5px; color: var(--text-dim);
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 5px; font-family: ui-monospace, monospace;
}

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  position: relative;
  overflow: hidden;
}
.card-pad { padding: 24px; }
.card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.025) 0%, transparent 30%);
  border-radius: inherit;
}
.card > * { position: relative; }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.card-head h3 {
  margin: 0; font-size: 15.5px; font-weight: 600;
  letter-spacing: -0.014em; color: var(--text);
}
.card-head .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ─── KPI cards ──────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
@media (max-width: 1280px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px)  { .kpi-grid { grid-template-columns: 1fr; } }

/* Dual horizontal bars for spend vs revenue inline visualization */
.dual-bar { display: flex; flex-direction: column; gap: 3px; }
.dual-bar-row {
  height: 7px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.dual-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.dual-bar-fill.spend   { background: linear-gradient(90deg, rgba(244,63,94,0.45), rgba(244,63,94,0.75)); }
.dual-bar-fill.revenue { background: linear-gradient(90deg, rgba(16,185,129,0.45), rgba(16,185,129,0.75)); }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}
.kpi-card::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, transparent 40%);
  pointer-events: none; border-radius: inherit;
}
.kpi-card > * { position: relative; }
.kpi-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }

.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.kpi-icon svg { width: 16px; height: 16px; stroke-width: 2; }
.kpi-icon.blue   { background: rgba(107,183,255,0.12);  color: var(--blue); }
.kpi-icon.amber  { background: rgba(247,185,85,0.12);   color: var(--amber); }
.kpi-icon.violet { background: rgba(181,139,255,0.12);  color: var(--violet); }
.kpi-icon.rose   { background: var(--rose-soft);        color: var(--rose); }

.kpi-delta {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
}
.kpi-delta.down { background: var(--rose-soft); color: var(--rose); }
.kpi-delta svg { width: 11px; height: 11px; stroke-width: 2.6; }

.kpi-label {
  margin-top: 12px;
  font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 500;
}
.kpi-value {
  margin-top: 4px;
  font-size: 28px; font-weight: 600;
  letter-spacing: -0.035em; color: var(--text);
  font-feature-settings: 'tnum';
}
.kpi-value.pos { color: var(--accent); }
.kpi-value.neg { color: var(--rose); }
.kpi-sub { margin-top: 2px; font-size: 12.5px; color: var(--text-dim); }
.kpi-spark { margin-top: 12px; height: 36px; position: relative; }

/* ─── Layout rows ─────────────────────────────────────────── */
.row-2 {
  display: grid; grid-template-columns: 2fr 1fr;
  gap: 16px; margin-bottom: 24px;
}
@media (max-width: 960px) { .row-2 { grid-template-columns: 1fr; } }

.row-3 {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 16px; margin-bottom: 24px;
}
@media (max-width: 960px) { .row-3 { grid-template-columns: 1fr; } }

/* ─── Charts ─────────────────────────────────────────────── */
.chart-box { position: relative; height: 320px; }
.donut-box { position: relative; height: 220px; }
.donut-center {
  position: absolute; inset: 0;
  display: grid; place-items: center; pointer-events: none;
  text-align: center;
}
.donut-center .v {
  font-size: 22px; font-weight: 600; letter-spacing: -0.03em;
  font-feature-settings: 'tnum';
}
.donut-center .l {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px;
}

.legend { margin-top: 16px; max-height: 200px; overflow-y: auto; }
.legend-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; font-size: 13px; border-top: 1px solid var(--border);
}
.legend-row:first-child { border-top: none; }
.legend-row .l { display: flex; align-items: center; gap: 9px; color: var(--text); }
.legend-row .dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-row .v { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ─── Tables ─────────────────────────────────────────────── */
.filters {
  padding: 16px 20px;
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-label {
  font-size: 11.5px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500;
}

@media (max-width: 640px) {
  .filters { padding: 12px 14px; gap: 8px; }
  .filter-group { flex-direction: column; align-items: stretch; gap: 4px; width: calc(50% - 4px); }
  .filter-group .input { width: 100% !important; }
  .filters > div[style*="margin-left:auto"] { margin-left: 0 !important; width: 100%; }
  .filters > div[style*="margin-left:auto"] button { flex: 1; }
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.summary-item { padding: 18px 22px; border-right: 1px solid var(--border); }
.summary-item:last-child { border-right: none; }
.summary-item .label {
  font-size: 11.5px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500;
}
.summary-item .value {
  font-size: 22px; font-weight: 600; margin-top: 4px;
  letter-spacing: -0.025em; font-feature-settings: 'tnum';
}
.summary-item .value.pos { color: var(--accent); }
.summary-item .value.neg { color: var(--rose); }
.summary-item .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.summary-item .sub.pos { color: var(--accent); }
.summary-item .sub.neg { color: var(--rose); }

@media (max-width: 900px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
  .summary-item:nth-child(2) { border-right: none; }
  .summary-item:nth-child(1), .summary-item:nth-child(2) { border-bottom: 1px solid var(--border); }
}
@media (max-width: 480px) {
  .summary-item { padding: 14px 16px; }
  .summary-item .value { font-size: 18px; }
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; font-weight: 500;
  padding: 14px 16px;
  font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-dim);
  background: rgba(255,255,255,0.015);
  border-bottom: 1px solid var(--border);
  user-select: none; white-space: nowrap;
}
thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: var(--text-muted); }
thead th.sorted { color: var(--accent); }
thead th .arrow { margin-left: 4px; opacity: 0.6; }
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle; white-space: nowrap;
}
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: rgba(255,255,255,0.025); }
tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.pos { color: var(--accent); }
.neg { color: var(--rose); }

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 4px; border-radius: 999px;
  background: rgba(255,255,255,0.045);
  border: 1px solid var(--border);
  font-size: 12.5px; font-weight: 500;
}
.badge .emoji {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,0.05); display: grid; place-items: center;
  font-size: 12px;
}
.net-pill {
  display: inline-block;
  padding: 3px 9px; border-radius: 6px;
  font-size: 12px; font-weight: 500;
  background: rgba(107,183,255,0.10); color: #95C9FF;
}
.src-pill {
  display: inline-block;
  padding: 3px 9px; border-radius: 6px;
  font-size: 12px; font-weight: 500;
  background: rgba(181,139,255,0.10); color: #C9AFFF;
}
.src-pill-btn {
  border: 1px solid transparent;
  cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all 0.15s;
}
.src-pill-btn:hover {
  background: rgba(181,139,255,0.18);
  border-color: rgba(181,139,255,0.35);
  color: #DFC8FF;
}
.src-pill-btn .arrow-r {
  width: 11px; height: 11px;
  opacity: 0.5;
  transition: transform 0.15s, opacity 0.15s;
}
.src-pill-btn:hover .arrow-r {
  opacity: 1;
  transform: translateX(2px);
}
.offer { color: var(--text-muted); font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.date { color: var(--text-muted); font-variant-numeric: tabular-nums; }

.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.row-action {
  width: 28px; height: 28px; border-radius: 7px;
  display: grid; place-items: center;
  color: var(--text-dim); cursor: pointer;
  transition: all 0.1s; background: transparent; border: none;
}
.row-action:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.row-action.danger:hover { background: var(--rose-soft); color: var(--rose); }
.row-action svg { width: 14px; height: 14px; }

.table-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  font-size: 13px; color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ─── Top combos ─────────────────────────────────────────── */
.combo-row {
  display: grid;
  grid-template-columns: 1.5fr 1.2fr 1fr 1fr 100px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  gap: 16px;
}
.combo-row.head {
  border-top: none; padding-top: 0; padding-bottom: 10px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim); font-weight: 500;
}
.combo-cat { display: flex; align-items: center; gap: 10px; }
.combo-emoji {
  width: 32px; height: 32px; border-radius: 9px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 15px;
}
.combo-cat .name { font-weight: 500; font-size: 14px; }
.combo-net { font-size: 13.5px; color: var(--text-muted); }
.combo-num { font-size: 13.5px; font-variant-numeric: tabular-nums; font-weight: 500; }
.combo-num.pos { color: var(--accent); }
.combo-num.neg { color: var(--rose); }
.roi-bar {
  position: relative; height: 22px;
  background: rgba(255,255,255,0.03); border-radius: 7px;
  overflow: hidden; display: flex; align-items: center; padding: 0 9px;
}
.roi-bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(16,185,129,0.18) 0%, rgba(16,185,129,0.32) 100%);
  border-right: 1.5px solid var(--accent);
}
.roi-bar-fill.neg {
  background: linear-gradient(90deg, rgba(244,63,94,0.18) 0%, rgba(244,63,94,0.32) 100%);
  border-right-color: var(--rose);
}
.roi-bar-txt { position: relative; font-size: 11.5px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.roi-bar-txt.neg { color: var(--rose); }

@media (max-width: 720px) {
  .combo-row { grid-template-columns: 1fr 1fr; }
  .combo-row > *:nth-child(n+3) { display: none; }
  .combo-row.head { display: none; }
}

/* ─── Modal ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(2, 4, 9, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadein 0.15s ease-out;
  overflow-y: auto;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: rgba(14, 18, 30, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; overflow-x: hidden;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6),
              0 0 0 1px rgba(255,255,255,0.04) inset;
  animation: slidein 0.2s ease-out;
}
.modal-card form > div { min-width: 0; }
.modal-card form > div > div { min-width: 0; }
.modal-card select, .modal-card input, .modal-card textarea { min-width: 0 !important; max-width: 100% !important; }
@keyframes slidein { from { transform: translateY(10px) scale(0.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

@media (max-width: 520px) {
  .modal-card form > div[style*="grid"] {
    grid-template-columns: 1fr !important;
  }
}

/* ─── Date range picker ──────────────────────────────────── */
.date-picker-card {
  background: rgba(14,18,30,0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  display: flex;
  width: 760px;
  max-width: 100%;
  max-height: 92vh;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
  animation: slidein 0.2s ease-out;
}
.dp-left {
  width: 190px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 12px 10px;
  display: flex; flex-direction: column; gap: 1px;
  overflow-y: auto;
}
.dp-preset {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  background: transparent;
  border: none;
  font-family: inherit;
}
.dp-preset:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.dp-preset.active {
  background: rgba(16,185,129,0.12); color: var(--accent); font-weight: 500;
}
.dp-right {
  flex: 1; padding: 14px 18px 16px;
  display: flex; flex-direction: column;
  min-width: 0;
}
.dp-nav {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.dp-months {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 18px; flex: 1; min-width: 0;
}
.dp-month-header {
  text-align: center; font-weight: 500;
  font-size: 13.5px; padding: 6px 0 8px;
  color: var(--text);
}
.dp-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}
.dp-weekdays > div {
  text-align: center; font-size: 10.5px;
  color: var(--text-dim); padding: 4px 0;
  font-weight: 500; text-transform: uppercase;
}
.dp-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.dp-day {
  aspect-ratio: 1;
  display: grid; place-items: center;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  background: transparent; border: none;
  color: var(--text);
  font-family: inherit;
  transition: background 0.1s;
  position: relative;
}
.dp-day:hover { background: rgba(255,255,255,0.06); border-radius: 6px; }
.dp-day.empty { cursor: default; }
.dp-day.empty:hover { background: transparent; }
.dp-day.inrange { background: rgba(16,185,129,0.14); color: var(--text); }
.dp-day.start, .dp-day.end {
  background: var(--accent) !important;
  color: #042F23 !important;
  font-weight: 600;
  border-radius: 7px;
}
.dp-day.start:not(.end) { border-radius: 7px 0 0 7px; }
.dp-day.end:not(.start) { border-radius: 0 7px 7px 0; }
.dp-day.today { box-shadow: 0 0 0 1px rgba(255,255,255,0.18) inset; border-radius: 6px; }

.dp-footer {
  border-top: 1px solid var(--border);
  margin-top: 14px; padding-top: 12px;
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.dp-range-display {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.dp-range-display input {
  padding: 7px 10px !important;
  font-size: 13px !important;
  width: 145px !important;
}
.dp-actions { display: flex; gap: 8px; }
.dp-foot-note {
  font-size: 11px; color: var(--text-dim);
  text-align: right; margin-top: 6px;
}

@media (max-width: 720px) {
  .date-picker-card { flex-direction: column; width: 360px; max-width: 95vw; }
  .dp-left {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 2px; max-height: 140px;
  }
  .dp-preset { font-size: 12px; padding: 7px 8px; text-align: center; }
  .dp-months { grid-template-columns: 1fr; gap: 8px; }
  .dp-right { padding: 12px; }
  .dp-footer { flex-direction: column; align-items: stretch; }
  .dp-range-display { justify-content: center; }
  .dp-range-display input { width: 100% !important; flex: 1; }
  .dp-actions { justify-content: center; }
  .dp-foot-note { text-align: center; }
}

/* ─── Settings ──────────────────────────────────────────── */
.list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 12px; border-radius: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  transition: background 0.1s;
}
.list-item:hover { background: rgba(255,255,255,0.04); }
.list-item .name { font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }

/* ─── Footer ─────────────────────────────────────────────── */
.footer-note {
  text-align: center; color: var(--text-dim);
  font-size: 12.5px; padding: 32px 0 48px;
}

/* ─── Toast ─────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: rgba(14, 18, 30, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  padding: 12px 16px; border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  z-index: 200;
  font-size: 13.5px;
  display: flex; align-items: center; gap: 10px;
  animation: toast-in 0.2s ease-out;
}
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--accent); }
.toast.success svg { color: var(--accent); }
.toast.error { border-left: 3px solid var(--rose); }
.toast.error svg { color: var(--rose); }
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 6px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }
::selection { background: rgba(16,185,129,0.3); }
