:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #172033;
  --muted: #6b7280;
  --line: #e5e7eb;
  --navy: #17365d;
  --blue: #2f6fed;
  --teal: #0f6b78;
  --green: #12805c;
  --amber: #b7791f;
  --red: #c2414a;
  --purple: #7c3aed;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: #102a43;
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 22px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; background: linear-gradient(135deg, #3b82f6, #14b8a6); }
.brand-name { font-weight: 800; font-size: 14px; }
.brand-sub { font-size: 11px; color: #b8c7d9; margin-top: 2px; }
.nav { display: grid; gap: 6px; margin-top: 22px; }
.nav-item { width: 100%; border: 0; background: transparent; color: #c7d5e5; text-align: left; padding: 11px 12px; border-radius: 10px; display: flex; align-items: center; gap: 10px; font-weight: 650; }
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(255,255,255,.10); }
.nav-item span { width: 20px; text-align: center; opacity: .9; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 16px 8px 0; display: flex; gap: 9px; align-items: flex-start; }
.sidebar-footer strong, .sidebar-footer span { display: block; }
.sidebar-footer strong { font-size: 12px; }
.sidebar-footer span { color: #9fb3c8; font-size: 11px; margin-top: 2px; }
.status-dot { width: 8px; height: 8px; margin-top: 5px; background: #22c55e; border-radius: 50%; }
.main { min-width: 0; }
.topbar { min-height: 86px; padding: 20px 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(10px); }
.topbar h1 { margin: 0; font-size: 22px; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; gap: 10px; }
.view { display: none; padding: 26px 28px 40px; }
.view.active { display: block; }
.btn { border: 0; border-radius: 9px; padding: 10px 14px; font-weight: 700; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { filter: brightness(.95); }
.btn.secondary { background: #eef2f7; color: #26374a; }
.btn.danger { background: #fff1f2; color: #be123c; }
.btn.small { padding: 7px 10px; font-size: 12px; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-size: 22px; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.kpi-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.kpi-card { padding: 18px; }
.kpi-card .label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.kpi-card .value { font-size: 28px; font-weight: 850; margin-top: 9px; }
.kpi-card .sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.two-col { grid-template-columns: 1.2fr .8fr; margin-top: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-header h3 { margin: 0; font-size: 15px; }
.card-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.card-body { padding: 18px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 10px; margin: 11px 0; }
.bar-track { height: 8px; background: #eef2f7; border-radius: 100px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #2f6fed, #14b8a6); border-radius: inherit; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 960px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 12px; text-align: left; vertical-align: middle; white-space: nowrap; }
th { position: sticky; top: 0; background: #f8fafc; color: #475569; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; z-index: 1; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdff; }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 750; background: #eef2f7; color: #405066; }
.badge.blue { background: #e8f0ff; color: #2459c4; }
.badge.green { background: #e8f7f1; color: #08745a; }
.badge.amber { background: #fff6df; color: #946200; }
.badge.red { background: #fff0f1; color: #b42335; }
.badge.purple { background: #f2ebff; color: #6d28d9; }
.badge.teal { background: #e4f6f6; color: #0f6b78; }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar-left, .toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.input, select, textarea { width: 100%; border: 1px solid #d8dee8; background: #fff; border-radius: 9px; padding: 9px 10px; color: var(--text); outline: none; }
.input:focus, select:focus, textarea:focus { border-color: #7ba3ff; box-shadow: 0 0 0 3px rgba(47,111,237,.10); }
.search { width: 280px; }
.filter-select { width: auto; min-width: 150px; }
.section-title { display: flex; justify-content: space-between; gap: 12px; align-items: end; margin-bottom: 14px; }
.section-title h2 { margin: 0; font-size: 18px; }
.section-title p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.creator-name { font-weight: 800; }
.subtle { color: var(--muted); font-size: 11px; }
.link { color: var(--blue); text-decoration: none; font-weight: 700; }
.link:hover { text-decoration: underline; }
.metric { font-variant-numeric: tabular-nums; }
.shortlist-layout { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.filters-card { position: sticky; top: 112px; }
.filters { padding: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.filters .span-2 { grid-column: span 2; }
.field label { display: block; font-size: 11px; color: #58677a; margin-bottom: 6px; font-weight: 750; }
.match-score { font-weight: 850; color: var(--green); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.rule-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.rule-card { padding: 18px; }
.rule-card h3 { margin: 0 0 12px; font-size: 15px; }
.rule-table { width: 100%; min-width: 0; }
.rule-table th, .rule-table td { white-space: normal; padding: 9px; }
.rule-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 10px; }
.campaign-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.campaign-card { padding: 16px; }
.campaign-card h3 { margin: 0; font-size: 15px; }
.campaign-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.campaign-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.campaign-stat { background: var(--surface-2); border-radius: 10px; padding: 10px; }
.campaign-stat strong, .campaign-stat span { display: block; }
.campaign-stat strong { font-size: 16px; }
.campaign-stat span { color: var(--muted); font-size: 10px; margin-top: 2px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal-backdrop.hidden { display: none; }
.modal { width: min(980px, 96vw); max-height: 92vh; overflow: auto; background: #fff; border-radius: 16px; box-shadow: 0 30px 80px rgba(15,23,42,.25); }
.modal.medium { width: min(760px, 96vw); }
.modal-header { display: flex; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; }
.modal-header p { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; padding: 20px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; right: 22px; bottom: 22px; background: #172033; color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; font-size: 13px; }
.toast.hidden { display: none; }
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .campaign-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { grid-template-columns: repeat(2, 1fr); }
  .sidebar-footer { display: none; }
  .topbar { position: static; }
  .shortlist-layout, .two-col, .rule-grid { grid-template-columns: 1fr; }
  .filters-card { position: static; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .span-3 { grid-column: span 2; }
}
@media (max-width: 640px) {
  .topbar { align-items: flex-start; gap: 14px; flex-direction: column; }
  .view, .topbar { padding-left: 16px; padding-right: 16px; }
  .kpi-grid, .campaign-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-3 { grid-column: span 1; }
  .search { width: 100%; }
}
.pipeline-grid { display: grid; grid-template-columns: repeat(4, minmax(220px,1fr)); gap: 12px; overflow-x: auto; align-items: start; }
.pipeline-col { background: #eef2f7; border: 1px solid var(--line); border-radius: 12px; min-height: 280px; padding: 10px; }
.pipeline-col-header { display: flex; justify-content: space-between; align-items: center; padding: 4px 3px 10px; font-weight: 800; font-size: 12px; }
.pipeline-card { background: #fff; border: 1px solid #dde4ec; border-radius: 10px; padding: 11px; margin-bottom: 8px; box-shadow: 0 4px 12px rgba(15,23,42,.04); }
.pipeline-card strong { display: block; font-size: 12px; }
.pipeline-card .meta { color: var(--muted); font-size: 10px; margin-top: 4px; line-height: 1.4; }
.owner-chip { display:inline-flex; margin-top:8px; padding:3px 7px; border-radius:999px; background:#e8f0ff; color:#2459c4; font-size:10px; font-weight:800; }
.progress { height: 7px; border-radius: 999px; background:#eef2f7; overflow:hidden; margin-top:8px; }
.progress > div { height:100%; background:linear-gradient(90deg,#2f6fed,#14b8a6); }
@media (max-width: 900px) { .pipeline-grid { grid-template-columns: repeat(4, 260px); } }

/* Access control / account switcher */
.account-switcher { display:flex; align-items:center; gap:9px; padding:6px 8px; border:1px solid var(--line); border-radius:11px; background:#fff; min-width:290px; }
.account-avatar { width:34px; height:34px; border-radius:9px; display:grid; place-items:center; background:#e8f0ff; color:#2459c4; font-weight:850; font-size:11px; flex:0 0 auto; }
.account-meta { min-width:92px; }
.account-meta strong, .account-meta span { display:block; line-height:1.15; }
.account-meta strong { font-size:11px; }
.account-meta span { color:var(--muted); font-size:10px; margin-top:3px; }
.account-switcher select { width:auto; min-width:130px; border:0; background:#f8fafc; padding:7px 8px; }
.permission-grid { display:grid; grid-template-columns: 180px repeat(10, minmax(90px, 1fr)); min-width:1000px; }
.permission-grid > div { padding:10px; border-right:1px solid var(--line); border-bottom:1px solid var(--line); font-size:11px; }
.permission-grid .head { background:#f8fafc; font-weight:800; color:#475569; text-transform:uppercase; letter-spacing:.03em; }
.permission-grid .role-cell { font-weight:800; }
.permission-chip { display:inline-flex; align-items:center; justify-content:center; min-width:44px; padding:4px 7px; border-radius:999px; font-size:10px; font-weight:850; }
.permission-chip.rw { background:#e8f7f1; color:#08745a; }
.permission-chip.ro { background:#e8f0ff; color:#2459c4; }
.permission-chip.none { background:#f1f5f9; color:#94a3b8; }
.access-note { background:#fff8e6; border:1px solid #f2d28c; color:#76550a; border-radius:10px; padding:12px 14px; font-size:12px; line-height:1.5; margin-bottom:14px; }
.account-table select { min-width:130px; }
.readonly-control { opacity:.55; pointer-events:none; }
.scope-note { display:inline-flex; margin-left:6px; padding:2px 6px; border-radius:999px; background:#f1f5f9; color:#64748b; font-size:10px; font-weight:700; }
@media (max-width:900px){ .account-switcher{min-width:0; width:100%;}.topbar-actions{flex-wrap:wrap;width:100%;}.account-meta{display:none;} }

/* Client Portal v1.2 */
.client-hero { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; padding:20px; border-radius:16px; background:linear-gradient(135deg,#eef5ff,#eefbf8); border:1px solid #dbe7f4; margin-bottom:18px; }
.client-hero h2 { margin:4px 0 6px; font-size:24px; }
.client-hero p { margin:0; max-width:720px; color:var(--muted); font-size:13px; line-height:1.55; }
.client-eyebrow { display:inline-flex; font-size:10px; font-weight:850; letter-spacing:.12em; color:#2459c4; }
.client-security { padding:8px 10px; background:#fff; border:1px solid #dce6f2; border-radius:999px; font-size:11px; font-weight:800; white-space:nowrap; }
.client-campaign-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.client-campaign-card { padding:16px; }
.client-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.client-card-head h3 { margin:4px 0 0; font-size:16px; }
.client-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin:14px 0; }
.client-metrics > div { background:#f8fafc; border:1px solid #edf1f5; border-radius:10px; padding:10px; }
.client-metrics strong,.client-metrics span { display:block; }
.client-metrics strong { font-size:18px; }
.client-metrics span { margin-top:2px; color:var(--muted); font-size:10px; }
.client-progress-label { display:flex; justify-content:space-between; align-items:center; margin-top:10px; font-size:11px; color:var(--muted); }
.client-card-footer { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-top:14px; color:var(--muted); font-size:11px; }
.client-detail-header { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; margin:16px 0; }
.client-detail-header h2 { margin:4px 0 5px; font-size:22px; }
.client-detail-header p { margin:0; color:var(--muted); font-size:12px; }
.client-kpis { grid-template-columns:repeat(5,minmax(0,1fr)); }
.client-funnel { margin-top:16px; }
.client-step-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; }
.client-step { text-align:center; background:#f8fafc; border:1px solid var(--line); border-radius:12px; padding:14px 10px; position:relative; }
.client-step .step-index { width:24px; height:24px; border-radius:50%; background:#e8f0ff; color:#2459c4; display:grid; place-items:center; font-size:10px; font-weight:850; margin:0 auto 7px; }
.client-step strong,.client-step span { display:block; }
.client-step strong { font-size:20px; }
.client-step span { margin-top:3px; color:var(--muted); font-size:10px; }
.client-table { min-width:1500px; }
.client-select { min-width:140px; }
.client-comment-cell { display:flex; align-items:flex-end; gap:6px; min-width:240px; }
.client-comment-cell textarea { min-width:180px; resize:vertical; }
.client-comment-box { display:grid; gap:8px; margin-bottom:14px; }
.client-comment-box .btn { justify-self:start; }
.comment-feed { display:grid; gap:10px; }
.comment-item { border:1px solid var(--line); border-radius:10px; padding:11px; background:#fbfdff; }
.comment-head { display:flex; justify-content:space-between; gap:12px; align-items:center; }
.comment-head strong { font-size:12px; }
.comment-head span { color:var(--muted); font-size:10px; }
.comment-item p { margin:7px 0 0; font-size:12px; line-height:1.5; white-space:normal; }
.permission-grid { grid-template-columns:180px repeat(14,minmax(90px,1fr)); min-width:1550px; }
@media (max-width:1200px){ .client-campaign-grid{grid-template-columns:repeat(2,1fr);} .client-kpis{grid-template-columns:repeat(3,1fr);} }
@media (max-width:900px){ .client-hero,.client-detail-header{flex-direction:column;} .client-step-grid{grid-template-columns:repeat(2,1fr);} .client-campaign-grid{grid-template-columns:1fr;} }
@media (max-width:640px){ .client-kpis,.client-step-grid{grid-template-columns:1fr;} .client-metrics{grid-template-columns:repeat(2,1fr);} }

/* Campaign lifecycle + data backup v1.3 */
.campaign-tabs { display:flex; gap:8px; margin-bottom:12px; flex-wrap:wrap; }
.campaign-tab { border:1px solid var(--line); background:#fff; color:#475569; border-radius:10px; padding:9px 12px; font-weight:800; cursor:pointer; }
.campaign-tab span { display:inline-flex; min-width:22px; justify-content:center; margin-left:6px; padding:2px 6px; border-radius:999px; background:#f1f5f9; font-size:10px; }
.campaign-tab.active { background:#172033; color:#fff; border-color:#172033; }
.campaign-tab.active span { background:rgba(255,255,255,.15); color:#fff; }
.campaign-filterbar { display:flex; gap:10px; align-items:center; padding:12px; margin-bottom:14px; flex-wrap:wrap; }
.campaign-filterbar .search { flex:1 1 260px; }
.campaign-actions { display:flex; justify-content:space-between; align-items:end; gap:10px; margin-top:12px; flex-wrap:wrap; }
.campaign-status-control { display:flex; flex-direction:column; gap:4px; min-width:145px; }
.campaign-status-control span { color:var(--muted); font-size:10px; font-weight:800; }
.campaign-status-control select { padding:7px 8px; }
.campaign-empty { grid-column:1 / -1; }
.backup-kpis { grid-template-columns:repeat(5,minmax(0,1fr)); }
.backup-actions { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-top:12px; }
.backup-actions.vertical { flex-direction:column; align-items:stretch; margin-top:0; }
@media (max-width:1100px){ .backup-kpis{grid-template-columns:repeat(3,1fr);} }
@media (max-width:700px){ .backup-kpis{grid-template-columns:1fr 1fr;} .campaign-filterbar{align-items:stretch;} .campaign-filterbar .filter-select{width:100%;} }
.campaign-action-buttons { display:flex; gap:7px; flex-wrap:wrap; align-items:center; }

/* Commerce Ops v1.4 */
.commerce-kpis { grid-template-columns:repeat(4,minmax(0,1fr)); margin-bottom:16px; }
.performance-kpis { grid-template-columns:repeat(5,minmax(0,1fr)); margin-bottom:16px; }
.wide-table { min-width:1450px; }
.row-alert { background:#fff7ed; }
.danger-text { color:#b91c1c !important; font-weight:800; }
.task-layout { align-items:start; }
.audit-feed { padding:14px; display:grid; gap:9px; max-height:620px; overflow:auto; }
.audit-item { border:1px solid var(--line); border-radius:10px; padding:10px 11px; background:#fbfdff; }
.audit-item > div { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.audit-item strong { font-size:11px; }
.audit-item span { color:var(--muted); font-size:9px; text-align:right; }
.audit-item p { margin:6px 0 0; font-size:11px; color:#475569; line-height:1.45; }
@media (max-width:1200px){ .commerce-kpis,.performance-kpis{grid-template-columns:repeat(3,1fr);} }
@media (max-width:700px){ .commerce-kpis,.performance-kpis{grid-template-columns:1fr 1fr;} }


/* Visual Refresh v1.4.1 — more energy, still professional */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --line: #e2e8f0;
  --navy: #17365d;
  --blue: #3b6fd8;
  --teal: #12818b;
  --green: #1f8a67;
  --amber: #c78824;
  --red: #c9505b;
  --purple: #7961d2;
  --cyan: #2f91bd;
  --rose: #b86183;
  --shadow: 0 10px 28px rgba(23, 54, 93, .075);
  --shadow-hover: 0 16px 34px rgba(23, 54, 93, .12);
}
body { background: radial-gradient(circle at 82% 3%, rgba(121,97,210,.075), transparent 22%), radial-gradient(circle at 45% 0%, rgba(18,129,139,.055), transparent 24%), var(--bg); }
.sidebar { background: linear-gradient(180deg, #102a43 0%, #153954 58%, #113348 100%); box-shadow: 8px 0 30px rgba(15, 42, 67, .08); }
.brand-mark { background: linear-gradient(135deg, #4f78df 0%, #2aa8a3 55%, #7961d2 100%); box-shadow: 0 8px 22px rgba(42,168,163,.22); }
.nav-item { position:relative; overflow:hidden; transition:background .18s ease, transform .18s ease, color .18s ease; }
.nav-item:hover { transform:translateX(2px); }
.nav-item.active { background:linear-gradient(90deg,rgba(75,119,220,.28),rgba(42,168,163,.15)); box-shadow:inset 3px 0 0 #6fd3cc; }
.nav-item:nth-child(2).active,.nav-item:nth-child(3).active,.nav-item:nth-child(4).active { box-shadow:inset 3px 0 0 #79a2ff; }
.nav-item:nth-child(7).active,.nav-item:nth-child(8).active { box-shadow:inset 3px 0 0 #55c3bd; }
.nav-item:nth-child(9).active { box-shadow:inset 3px 0 0 #9b87e3; }
.nav-item:nth-child(10).active { box-shadow:inset 3px 0 0 #5abf8f; }
.nav-item:nth-child(11).active,.nav-item:nth-child(12).active { box-shadow:inset 3px 0 0 #e0a14a; }
.topbar { background:rgba(255,255,255,.88); border-bottom-color:#dfe6ef; box-shadow:0 3px 18px rgba(23,54,93,.045); }
.card,.client-campaign-card,.campaign-card,.rule-card { transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.card:hover,.client-campaign-card:hover,.campaign-card:hover { border-color:#d6dfeb; box-shadow:var(--shadow-hover); }
.kpi-card { position:relative; overflow:hidden; border-top:3px solid #7da2ec; }
.kpi-card::after { content:""; position:absolute; right:-22px; top:-28px; width:92px; height:92px; border-radius:50%; background:rgba(59,111,216,.055); pointer-events:none; }
.kpi-grid .kpi-card:nth-child(2) { border-top-color:#38aaa6; }
.kpi-grid .kpi-card:nth-child(2)::after { background:rgba(18,129,139,.06); }
.kpi-grid .kpi-card:nth-child(3) { border-top-color:#9a85dd; }
.kpi-grid .kpi-card:nth-child(3)::after { background:rgba(121,97,210,.06); }
.kpi-grid .kpi-card:nth-child(4) { border-top-color:#55ad7e; }
.kpi-grid .kpi-card:nth-child(4)::after { background:rgba(31,138,103,.06); }
.kpi-grid .kpi-card:nth-child(5) { border-top-color:#dea046; }
.kpi-grid .kpi-card:nth-child(5)::after { background:rgba(199,136,36,.07); }
.kpi-card .value { color:#183b63; }
.btn.primary { background:linear-gradient(135deg,#416fda,#2f80cf); box-shadow:0 6px 14px rgba(59,111,216,.18); }
.btn.secondary { background:#edf2f8; color:#314761; }
.btn.secondary:hover { background:#e5edf6; }
.table-wrap { box-shadow:0 6px 18px rgba(23,54,93,.035); }
th { background:linear-gradient(180deg,#f9fbfe,#f3f6fa); color:#4b5f76; }
tbody tr:hover { background:#f6faff; }
.input:focus,select:focus,textarea:focus { border-color:#75a0e6; box-shadow:0 0 0 3px rgba(65,111,218,.10); }
.badge.blue { background:#e9f0ff; color:#315fbf; }
.badge.green { background:#e8f7ef; color:#167052; }
.badge.amber { background:#fff4dd; color:#9a6616; }
.badge.red { background:#fff0f2; color:#b23d4c; }
.badge.purple { background:#f1edff; color:#6d56bd; }
.badge.teal { background:#e5f6f6; color:#106f77; }
.bar-track { background:#eaf0f6; }
.bar-fill { background:linear-gradient(90deg,#4f78df 0%,#2fa0b0 50%,#52aa80 100%); }
.section-title h2 { color:#183b63; }
.card-header h3 { color:#213f60; }
.campaign-card { border-top:3px solid #789ce3; }
.campaign-card:nth-child(3n+2) { border-top-color:#43aaa6; }
.campaign-card:nth-child(3n+3) { border-top-color:#9581d9; }
.campaign-stat:nth-child(1) { background:#f2f6ff; }
.campaign-stat:nth-child(2) { background:#eef9f8; }
.campaign-stat:nth-child(3) { background:#f6f2ff; }
.pipeline-col:nth-child(1) { background:#f3f6fc; border-top:3px solid #7c9ee3; }
.pipeline-col:nth-child(2) { background:#f1f8fa; border-top:3px solid #57aeb7; }
.pipeline-col:nth-child(3) { background:#f4f9f5; border-top:3px solid #64ad82; }
.pipeline-col:nth-child(4) { background:#fbf7ee; border-top:3px solid #d6a14b; }
.client-hero { background:linear-gradient(135deg,#edf4ff 0%,#effaf7 55%,#f5f1ff 100%); border-color:#d8e4ef; }
.client-security { color:#315f75; }
.client-metrics > div:nth-child(4n+1),.client-step:nth-child(5n+1) { background:#f2f6ff; }
.client-metrics > div:nth-child(4n+2),.client-step:nth-child(5n+2) { background:#eef9f8; }
.client-metrics > div:nth-child(4n+3),.client-step:nth-child(5n+3) { background:#f4f1ff; }
.client-metrics > div:nth-child(4n),.client-step:nth-child(5n+4) { background:#f5faf5; }
.client-step:nth-child(5n) { background:#fff8ed; }
.campaign-tab.active { background:linear-gradient(135deg,#27496d,#376e8c); border-color:#27496d; }
.row-alert { background:#fff8ec; }
.audit-item { background:linear-gradient(135deg,#fbfdff,#f7faff); }
.toast { background:linear-gradient(135deg,#183b63,#176b73); }
#view-partnership .section-title h2,#view-creators .section-title h2,#view-shortlist .section-title h2 { color:#345faa; }
#view-operations .section-title h2,#view-deliverables .section-title h2 { color:#16757c; }
#view-commerce .section-title h2 { color:#6e59b5; }
#view-performance .section-title h2 { color:#287a5a; }
#view-tasks .section-title h2,#view-finance .section-title h2 { color:#9b681c; }
#view-client .section-title h2 { color:#315f9f; }
#view-backup .section-title h2,#view-access .section-title h2,#view-rules .section-title h2 { color:#53677d; }
#view-commerce .kpi-card { border-top-color:#9683dc; }
#view-performance .kpi-card { border-top-color:#5aaa7d; }
#view-finance .kpi-card,#view-tasks .kpi-card { border-top-color:#d69b3d; }
#view-operations .kpi-card,#view-deliverables .kpi-card { border-top-color:#49aaa8; }
#view-client .kpi-card { border-top-color:#6f99df; }
.table-wrap,.modal,.account-switcher,.comment-item { background:rgba(255,255,255,.97); }


/* Branding + sidebar overflow fix v1.4.2 */
.sidebar {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.24) transparent;
}
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.20); border-radius: 999px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.32); }
.nav { flex: 0 0 auto; }
.sidebar-footer { margin-top: 18px; padding-bottom: 4px; flex: 0 0 auto; }
.brand { flex: 0 0 auto; }
.brand-name { letter-spacing: .025em; }
.topbar-heading { display: flex; align-items: center; gap: 15px; min-width: 0; }
.topbar-logo {
  width: 104px;
  height: 48px;
  object-fit: contain;
  object-position: center;
  background: #fff;
  border: 1px solid #e5eaf1;
  border-radius: 11px;
  padding: 3px 6px;
  box-shadow: 0 5px 16px rgba(23,54,93,.08);
  flex: 0 0 auto;
}
.topbar-copy { min-width: 0; }
.topbar-product {
  color: #49617c;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .12em;
  margin-bottom: 2px;
}
.topbar { min-height: 94px; }
@media (max-width: 1040px) {
  .topbar-logo { width: 84px; height: 42px; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
}
@media (max-width: 760px) {
  .topbar-logo { display: none; }
  .topbar-product { font-size: 9px; }
}


/* Supabase & Auth Enhancements */
.sidebar-footer {
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
  border-radius: 10px;
  padding: 8px 10px;
  margin-top: 14px;
}
.sidebar-footer:hover {
  background: rgba(255, 255, 255, 0.08);
}
.status-dot.online {
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}
.status-dot.offline {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}
.status-dot.error {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e5eaf1;
  padding-bottom: 8px;
}
.auth-tab {
  background: transparent;
  border: 0;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 14px;
  color: #64748b;
  cursor: pointer;
  border-radius: 8px;
  transition: all .2s;
}
.auth-tab.active {
  background: #eff6ff;
  color: #1e40af;
}

.cfg-callout {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #334155;
  margin-bottom: 16px;
}
.cfg-callout code {
  background: #e2e8f0;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}
.cfg-callout.success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}
.cfg-callout.warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}
.cfg-callout.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.topbar-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  transition: all .2s;
}
.topbar-badge-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.topbar-badge-btn .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
}
.topbar-badge-btn .dot.online {
  background: #10b981;
}
