/* ==========================================================================
   Digital Flame × MetaScraper Design System
   Strict Brand Palette:
     - White:               #FFFFFF
     - Digital Flame Coral: #F05A50
     - Digital Flame Navy:  #233246
   ========================================================================== */

:root {
  --white: #ffffff;
  --coral: #f05a50;
  --coral-hover: #dc483e;
  --coral-soft: rgba(240, 90, 80, 0.10);
  --coral-soft-strong: rgba(240, 90, 80, 0.18);
  --coral-border: rgba(240, 90, 80, 0.28);

  --navy: #233246;
  --navy-deep: #1a2636;
  --navy-elevated: #2c3e56;
  --navy-muted: rgba(35, 50, 70, 0.64);
  --navy-subtle: rgba(35, 50, 70, 0.44);
  --navy-border: rgba(35, 50, 70, 0.11);
  --navy-border-strong: rgba(35, 50, 70, 0.20);
  --navy-tint: rgba(35, 50, 70, 0.035);
  --navy-tint-hover: rgba(35, 50, 70, 0.065);

  --canvas: #f7f8fa; /* Pure #233246 at ~3% on #FFFFFF */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(35, 50, 70, 0.05);
  --shadow-md: 0 6px 20px rgba(35, 50, 70, 0.08);
  --shadow-lg: 0 18px 42px rgba(35, 50, 70, 0.18);
  --sidebar-w: 256px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  background: var(--canvas);
  color: var(--navy);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.num {
  font-variant-numeric: tabular-nums;
}

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

/* Sidebar (#233246) */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-box {
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--coral);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(240, 90, 80, 0.35);
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.58);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.sidebar-section {
  padding: 16px 14px 8px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.45);
  padding: 0 10px 8px;
}

.sidebar-select {
  width: 100%;
  background: var(--navy-elevated);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--white);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

.sidebar-select:focus {
  border-color: var(--coral);
}

.sidebar-select option {
  background: var(--navy);
  color: var(--white);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}

.nav-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.nav-btn.active {
  background: var(--coral);
  color: var(--white);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(240, 90, 80, 0.30);
}

.nav-btn.active svg {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
}

.nav-btn.active .nav-badge {
  background: rgba(255, 255, 255, 0.24);
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.db-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.72);
  background: var(--navy-deep);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--coral);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(240, 90, 80, 0.28);
}

/* ───────────────────────── Main Workspace ───────────────────────── */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--navy-border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.topbar-sub {
  font-size: 12.5px;
  color: var(--navy-muted);
  margin-top: 1px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ───────────────────────── Buttons ───────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--coral);
  color: var(--white);
  border-color: var(--coral);
}

.btn-primary:hover:not(:disabled) {
  background: var(--coral-hover);
  border-color: var(--coral-hover);
}

.btn-navy {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.btn-navy:hover:not(:disabled) {
  background: var(--navy-elevated);
}

.btn-outline {
  background: var(--white);
  color: var(--navy);
  border-color: var(--navy-border-strong);
}

.btn-outline:hover:not(:disabled) {
  background: var(--navy-tint);
  border-color: var(--navy);
}

.btn-ghost-coral {
  background: var(--coral-soft);
  color: var(--coral);
  border-color: var(--coral-border);
}

.btn-ghost-coral:hover:not(:disabled) {
  background: var(--coral);
  color: var(--white);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ───────────────────────── Content Container ───────────────────────── */
.content-wrap {
  padding: 22px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Demo Notice Banner */
.demo-banner {
  background: var(--white);
  border: 1px solid var(--coral-border);
  border-left: 4px solid var(--coral);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.demo-banner-text {
  font-size: 13px;
  color: var(--navy);
}

.demo-banner-text strong {
  color: var(--coral);
}

/* ───────────────────────── Filter Bar ───────────────────────── */
.filter-card {
  background: var(--white);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy-subtle);
}

.segmented {
  display: inline-flex;
  background: var(--navy-tint);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--navy-border);
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 5px 11px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy-muted);
  cursor: pointer;
  transition: all 0.14s ease;
}

.seg-btn:hover {
  color: var(--navy);
}

.seg-btn.active {
  background: var(--navy);
  color: var(--white);
}

.seg-btn.active-coral {
  background: var(--coral);
  color: var(--white);
}

.input-ctrl, .select-ctrl {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--navy-border-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--navy);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--navy-subtle);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  padding-left: 32px;
}

.preset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--navy-border);
}

.preset-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--navy-border-strong);
  background: var(--white);
  color: var(--navy);
  cursor: pointer;
  transition: all 0.14s ease;
}

.chip:hover {
  border-color: var(--coral);
  color: var(--coral);
}

.chip.active {
  background: var(--coral);
  border-color: var(--coral);
  color: var(--white);
}

/* ───────────────────────── KPI Grid ───────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--white);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card.accent-coral::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--coral);
}

.kpi-card.accent-navy::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--navy);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy-muted);
}

.kpi-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--coral-soft);
  color: var(--coral);
}

.kpi-card.accent-navy .kpi-icon {
  background: var(--navy-tint);
  color: var(--navy);
}

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--navy);
  line-height: 1.15;
}

.kpi-meta {
  font-size: 11.5px;
  color: var(--navy-subtle);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  line-height: 1.35;
}

.kpi-meta strong {
  color: var(--navy);
  font-weight: 600;
}

/* ───────────────────────── Cards & Charts ───────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 18px;
}

.grid-2-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel {
  background: var(--white);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--navy-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--navy);
}

.panel-sub {
  font-size: 12px;
  color: var(--navy-muted);
  margin-top: 2px;
}

.panel-body {
  padding: 18px 20px;
}

.chart-box {
  position: relative;
  height: 270px;
  width: 100%;
}

/* Platform Compare Cards */
.platform-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.plat-box {
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid var(--navy-border);
  background: var(--white);
}

.plat-box.fb {
  border-top: 3px solid var(--navy);
}

.plat-box.ig {
  border-top: 3px solid var(--coral);
}

.plat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.plat-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--navy);
}

.plat-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.plat-stat-label {
  font-size: 11px;
  color: var(--navy-subtle);
}

.plat-stat-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

/* ───────────────────────── Data Table (Spreadsheet Matrix) ───────────────────────── */
.table-toolbar {
  padding: 12px 18px;
  border-bottom: 1px solid var(--navy-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--white);
}

.table-scroll {
  overflow-x: auto;
  width: 100%;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

table.data-table thead th {
  background: var(--navy);
  color: var(--white);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 11px 10px;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  cursor: pointer;
  user-select: none;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

table.data-table thead th.right,
table.data-table tbody td.right,
table.data-table tfoot td.right {
  text-align: right;
}

table.data-table thead th:hover {
  background: var(--navy-elevated);
}

table.data-table thead th.sorted {
  background: var(--coral);
}

table.data-table tbody tr {
  border-bottom: 1px solid var(--navy-border);
  transition: background 0.12s ease;
}

table.data-table tbody tr.post-row {
  cursor: pointer;
}

table.data-table tbody tr.post-row:hover {
  background: var(--coral-soft);
}

table.data-table tbody tr.group-header-row {
  background: var(--navy-tint);
  font-weight: 700;
  color: var(--navy);
}

table.data-table tbody tr.group-subtotal-row {
  background: rgba(240, 90, 80, 0.06);
  font-weight: 700;
  color: var(--navy);
  border-bottom: 2px solid var(--navy-border-strong);
}

table.data-table tbody td {
  padding: 9px 10px;
  vertical-align: middle;
  white-space: nowrap;
}

table.data-table tbody td.title-cell {
  white-space: normal;
  min-width: 190px;
  max-width: 260px;
}

.post-title-main {
  font-weight: 600;
  color: var(--navy);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-title-sub {
  font-size: 11px;
  color: var(--navy-subtle);
}

table.data-table tfoot td {
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  padding: 11px 10px;
  white-space: nowrap;
  border-top: 2px solid var(--coral);
}

/* Badges (Strictly 3 Brand Colors) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.badge-fb {
  background: var(--navy);
  color: var(--white);
}

.badge-ig {
  background: var(--coral);
  color: var(--white);
}

.badge-type {
  background: var(--navy-tint);
  color: var(--navy);
  border: 1px solid var(--navy-border);
}

.badge-paid {
  background: var(--coral-soft);
  color: var(--coral);
  border: 1px solid var(--coral-border);
}

.badge-organic {
  background: var(--white);
  color: var(--navy-muted);
  border: 1px solid var(--navy-border-strong);
}

/* ───────────────────────── Accounts Grid ───────────────────────── */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 18px;
}

.account-card {
  background: var(--white);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.account-card.is-demo {
  border-style: dashed;
  border-color: var(--coral-border);
}

.acc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.acc-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}

.acc-ids {
  font-size: 12px;
  color: var(--navy-muted);
  margin-top: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.acc-channels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.channel-pill {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--navy-tint);
  border: 1px solid var(--navy-border);
}

.channel-pill-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy-muted);
}

.channel-pill-val {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy);
  margin-top: 2px;
}

.channel-pill-sub {
  font-size: 11.5px;
  color: var(--navy-subtle);
}

.perm-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.perm-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--white);
  border: 1px solid var(--navy-border-strong);
  color: var(--navy);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.acc-error {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--coral-soft);
  border: 1px solid var(--coral-border);
  color: var(--coral);
  font-size: 12px;
}

.acc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--navy-border);
}

/* ───────────────────────── Modal & Drawer ───────────────────────── */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 38, 54, 0.56);
  backdrop-filter: blur(2px);
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.backdrop.open {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--navy-border);
}

.modal-header {
  background: var(--navy);
  color: var(--white);
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.icon-close {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: var(--white);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.icon-close:hover {
  background: var(--coral);
}

.modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
}

.form-field small {
  font-size: 11.5px;
  color: var(--navy-subtle);
}

.form-field textarea {
  min-height: 76px;
  padding: 9px 10px;
  border: 1px solid var(--navy-border-strong);
  border-radius: var(--radius-sm);
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.form-field textarea:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-soft);
}

.verify-box {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--navy-border-strong);
  background: var(--navy-tint);
  font-size: 12.5px;
  display: none;
}

.verify-box.show {
  display: block;
}

.verify-box.error {
  background: var(--coral-soft);
  border-color: var(--coral-border);
  color: var(--coral);
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--navy-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--canvas);
}

/* Slide-Over Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 38, 54, 0.45);
  z-index: 85;
  display: none;
  justify-content: flex-end;
}

.drawer-backdrop.open {
  display: flex;
}

.drawer {
  width: 100%;
  max-width: 560px;
  background: var(--white);
  height: 100%;
  overflow-y: auto;
  box-shadow: -12px 0 36px rgba(35, 50, 70, 0.22);
  display: flex;
  flex-direction: column;
}

.drawer-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.drawer-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mini-metric {
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--canvas);
}

.mini-metric-label {
  font-size: 10.5px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--navy-subtle);
}

.mini-metric-val {
  font-size: 17px;
  font-weight: 800;
  color: var(--navy);
  margin-top: 2px;
}

.comment-item {
  padding: 10px 12px;
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.code-block {
  background: var(--navy);
  color: var(--white);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-x: auto;
  line-height: 1.55;
  margin: 0;
}

/* Toast Notification */
.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 390px;
}

.toast {
  background: var(--navy);
  color: var(--white);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--coral);
  font-size: 13px;
  animation: slideIn 0.2s ease;
}

.toast.error {
  background: var(--coral);
  border-left-color: var(--navy);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-section {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.view-section.active {
  display: flex;
}

.empty-state {
  padding: 46px 24px;
  text-align: center;
  color: var(--navy-muted);
}

.empty-state h3 {
  color: var(--navy);
  margin: 0 0 6px;
}

.steps-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.step-card {
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--white);
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--coral);
  color: var(--white);
  font-weight: 700;
  font-size: 12.5px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}

.step-card h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--navy);
}

.step-card p {
  margin: 0;
  font-size: 12.5px;
  color: var(--navy-muted);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; }
  .app-shell { flex-direction: column; }
  .main-area { margin-left: 0; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2-equal { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   v2: Auth, sidebar groups, user card, settings, role gating
   ========================================================================== */
.sidebar { overflow-y: auto; }
.nav-scroll { flex: 1; padding-bottom: 8px; }
.nav-group-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.42); padding: 14px 22px 4px;
}
.nav-scroll .nav-list { padding-top: 2px; padding-bottom: 2px; }

.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-sm);
  background: var(--navy-deep); border: 1px solid rgba(255,255,255,0.07);
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--coral); color: var(--white);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.user-meta { min-width: 0; flex: 1; }
.user-name { font-size: 13px; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.55); text-transform: capitalize; }
.user-logout {
  background: rgba(255,255,255,0.08); border: none; color: var(--white);
  width: 30px; height: 30px; border-radius: 6px; cursor: pointer; display: grid; place-items: center;
}
.user-logout:hover { background: var(--coral); }

/* Role gating */
.role-viewer .write-only { display: none !important; }
.role-manager .admin-only, .role-viewer .admin-only { display: none !important; }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.settings-tabs {
  background: var(--white); border: 1px solid var(--navy-border); border-radius: var(--radius-lg);
  padding: 8px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm);
}
.settings-tab {
  text-align: left; border: none; background: transparent; padding: 10px 12px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13.5px; color: var(--navy-muted); cursor: pointer;
}
.settings-tab:hover { background: var(--navy-tint); color: var(--navy); }
.settings-tab.active { background: var(--navy); color: var(--white); }
.settings-pane { display: none; }
.settings-pane.active { display: flex; }
.settings-form { display: flex; flex-direction: column; gap: 18px; }

/* Login */
.login-body { background: var(--white); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-hero {
  background: var(--navy); color: var(--white); padding: 40px 56px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
.login-hero-copy h1 { font-size: 34px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 16px; font-weight: 800; }
.login-hero-copy h1 span { color: var(--coral); }
.login-hero-copy p { color: rgba(255,255,255,0.72); font-size: 15px; max-width: 460px; margin: 0 0 22px; }
.login-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.login-points li { position: relative; padding-left: 22px; font-size: 13.5px; color: rgba(255,255,255,0.85); }
.login-points li::before { content: ''; position: absolute; left: 0; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
.login-hero-foot { font-size: 12px; color: rgba(255,255,255,0.45); }
.login-panel { display: grid; place-items: center; padding: 32px; background: var(--white); }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { margin: 0 0 4px; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--navy); }
.login-sub { margin: 0 0 24px; color: var(--navy-muted); }
.login-input { height: 42px; width: 100%; font-size: 14px; }
.login-submit { width: 100%; height: 44px; font-size: 14px; }
.pw-wrap { position: relative; }
.pw-wrap .login-input { padding-right: 60px; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--coral); font-weight: 600; font-size: 12px; cursor: pointer; padding: 6px;
}

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { padding: 28px; }
  .login-hero-copy h1 { font-size: 24px; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-tabs { flex-direction: row; flex-wrap: wrap; }
}

/* Demo banner only belongs on data views */
body[data-view="settings"] #demoBanner,
body[data-view="logs"] #demoBanner { display: none !important; }

/* ==========================================================================
   v3.1 · Smooth UI, live data, analytics (chart palette from analytics reference)
   Shell stays white / coral / navy. Charts & analytic accents use the soft palette.
   ========================================================================== */
:root {
  --p-blue: #8ba8f3;
  --p-slate: #9aa7bc;
  --p-amber: #efb878;
  --p-violet: #b49be0;
  --p-mint: #7dcba0;
  --p-rose: #f0829b;
  --p-sky: #c5dcf5;
  --p-lav: #f4f2fb;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 0% { background-position: -240px 0; } 100% { background-position: 240px 0; } }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(125, 203, 160, 0.55); } 70% { box-shadow: 0 0 0 7px rgba(125, 203, 160, 0); } 100% { box-shadow: 0 0 0 0 rgba(125, 203, 160, 0); } }
@keyframes spinKf { to { transform: rotate(360deg); } }

.view-section.active { animation: fadeUp 0.32s var(--ease) both; }

.panel, .kpi-card, .filter-card { border-radius: 16px; transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease), border-color 0.25s var(--ease); }
.panel:hover, .kpi-card:hover { box-shadow: 0 10px 28px rgba(35, 50, 70, 0.09); }
.kpi-card:hover { transform: translateY(-2px); }
.kpi-grid .kpi-card { animation: fadeUp 0.4s var(--ease) both; }
.kpi-grid .kpi-card:nth-child(2) { animation-delay: 0.04s; }
.kpi-grid .kpi-card:nth-child(3) { animation-delay: 0.08s; }
.kpi-grid .kpi-card:nth-child(4) { animation-delay: 0.12s; }
.kpi-grid .kpi-card:nth-child(5) { animation-delay: 0.16s; }
.kpi-grid .kpi-card:nth-child(6) { animation-delay: 0.20s; }

.btn, .chip, .seg-btn, .nav-btn, .input-ctrl, .select-ctrl { transition: background-color 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.12s var(--ease); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.data-table tbody tr { transition: background-color 0.15s var(--ease); }

/* Analytic panels */
.a-panel { background: #fff; }
.t-ico { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--p-blue)); margin-right: 8px; vertical-align: 1px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--p-blue)) 22%, transparent); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 1200px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .grid-3 { grid-template-columns: 1fr; } }
.chart-box.sm { height: 230px; position: relative; }
.chart-box.is-empty canvas { visibility: hidden; }
.chart-box.is-empty::after { content: 'No data for this selection'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--navy-subtle); font-size: 12.5px; font-weight: 600; }

.section-label { display: flex; align-items: center; gap: 12px; margin: 8px 2px -4px; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--navy-subtle); }
.section-label::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--navy-border-strong), transparent); }

/* KPI deltas */
.kpi-delta { display: inline-flex; align-items: center; gap: 4px; margin: 2px 0 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1.5; background: var(--p-lav); color: var(--navy-muted); }
.kpi-delta:empty { display: none; }
.kpi-delta.up { background: rgba(125, 203, 160, 0.2); color: #2f8a5f; }
.kpi-delta.down { background: rgba(240, 130, 155, 0.2); color: #c2455f; }
.kpi-delta small { font-weight: 600; opacity: 0.75; }

/* Insights */
.insight-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.insight-card { display: flex; gap: 12px; padding: 14px 16px; background: #fff; border: 1px solid var(--navy-border); border-radius: 16px; animation: fadeUp 0.4s var(--ease) both; transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease); }
.insight-card:hover { box-shadow: 0 10px 26px rgba(35, 50, 70, 0.09); transform: translateY(-2px); }
.insight-ico { flex: 0 0 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--p-lav); color: #6f86c9; }
.insight-card.good .insight-ico { background: rgba(125, 203, 160, 0.22); color: #2f8a5f; }
.insight-card.warn .insight-ico { background: rgba(240, 130, 155, 0.22); color: #c2455f; }
.insight-card.neutral .insight-ico { background: rgba(139, 168, 243, 0.22); color: #4f6fc8; }
.insight-ico svg { width: 17px; height: 17px; }
.insight-title { font-size: 13px; font-weight: 700; color: var(--navy); line-height: 1.3; }
.insight-text { font-size: 12.5px; color: var(--navy-muted); margin-top: 2px; line-height: 1.45; }

/* Live pill */
.live-pill { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--navy-border-strong); background: #fff; color: var(--navy); font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.live-pill:hover { border-color: var(--navy-muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--p-slate); }
.live-pill.on .live-dot { background: var(--p-mint); animation: livePulse 2s infinite; }
.live-pill.syncing { background: rgba(139, 168, 243, 0.14); border-color: var(--p-blue); }
.live-pill.syncing .live-dot { background: var(--p-blue); animation: spinKf 0.9s linear infinite; border-radius: 50%; border: 2px solid var(--p-blue); border-top-color: transparent; width: 11px; height: 11px; background: transparent; }
.live-pill.off { color: var(--navy-subtle); }

.btn-excel { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--coral-border); background: var(--coral-soft); color: var(--coral-hover); font-weight: 700; cursor: pointer; }
.btn-excel:hover:not(:disabled) { background: var(--coral); color: #fff; border-color: var(--coral); }
.btn-excel svg { width: 15px; height: 15px; }

/* Data refresh feedback */
.refreshing .kpi-value, .refreshing .chart-box { transition: opacity 0.2s var(--ease); }
.flash { animation: flashBg 1.1s var(--ease); }
@keyframes flashBg { 0% { background-color: rgba(139, 168, 243, 0.25); } 100% { background-color: transparent; } }

/* Rate bar in tables */
.rate-cell { display: flex; align-items: center; gap: 8px; min-width: 90px; }
.rate-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--p-lav); overflow: hidden; }
.rate-bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--p-blue), var(--p-violet)); transition: width 0.6s var(--ease); }

/* Export modal */
.export-preview { margin-bottom: 16px; padding: 14px; border-radius: 12px; background: var(--p-lav); }
.export-sheets { display: flex; flex-wrap: wrap; gap: 6px; }
.export-sheets span { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #fff; color: var(--navy); border: 1px solid var(--navy-border); }
.export-sheets span::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--c); }
.export-filters { margin-top: 10px; font-size: 12px; color: var(--navy-muted); line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ───────── Settings v2 · branding, users, refined navigation ───────── */
.brand-logo.has-img { width: auto; min-width: 38px; max-width: 150px; height: 38px; padding: 4px 8px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.18); overflow: hidden; }
.brand-logo.has-img img { height: 100%; width: auto; max-width: 134px; object-fit: contain; display: block; }
.brand-logo:empty { display: none; }

.settings-layout { grid-template-columns: 252px minmax(0, 1fr); gap: 20px; }
.settings-tabs { position: sticky; top: 16px; padding: 10px; gap: 4px; }
.settings-nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--navy-subtle); padding: 10px 10px 4px; }
.settings-tab { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border: 1px solid transparent; border-radius: var(--radius-md); transition: background .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease); }
.settings-tab .st-ico { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--navy-tint); color: var(--navy-muted); transition: inherit; }
.settings-tab .st-ico svg { width: 18px; height: 18px; }
.settings-tab .st-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.settings-tab .st-text strong { font-size: 13.5px; font-weight: 650; color: var(--navy); }
.settings-tab .st-text small { font-size: 11.5px; font-weight: 500; color: var(--navy-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-tab:hover { background: var(--navy-tint); color: var(--navy); }
.settings-tab:focus-visible { outline: 2px solid var(--coral); outline-offset: 1px; }
.settings-tab.active { background: var(--coral-soft); border-color: var(--coral-border); color: var(--navy); }
.settings-tab.active .st-ico { background: var(--coral); color: #fff; box-shadow: 0 4px 10px rgba(240, 90, 80, .32); }
.settings-pane.active { display: block; animation: paneIn .28s var(--ease); }
@keyframes paneIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .settings-pane.active { animation: none; } }

.profile-hero { display: flex; align-items: center; gap: 16px; padding: 18px 20px; margin: 0 20px; border: 1px solid var(--navy-border); border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--canvas), #fff); }
.profile-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; box-shadow: 0 0 0 4px var(--coral-soft); }
.profile-name { font-size: 17px; font-weight: 700; color: var(--navy); }
.profile-meta { margin-top: 4px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--navy-muted); flex-wrap: wrap; }
.profile-hero + .settings-form { padding-top: 18px; }

.form-field .opt { font-weight: 500; color: var(--navy-subtle); font-size: 11.5px; }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid var(--navy-border); margin-top: 2px; padding-top: 16px; }
.muted-note { color: var(--navy-subtle); font-size: 12px; }

.asset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.asset-card { border: 1px solid var(--navy-border); border-radius: var(--radius-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #fff; transition: border-color .18s var(--ease), box-shadow .18s var(--ease); }
.asset-card:hover { border-color: var(--navy-border-strong); box-shadow: var(--shadow-md); }
.asset-head { display: flex; flex-direction: column; gap: 2px; }
.asset-head strong { font-size: 14px; color: var(--navy); }
.asset-head small { font-size: 12px; color: var(--navy-subtle); }
.asset-preview { height: 120px; border-radius: var(--radius-md); border: 1px dashed var(--navy-border-strong); display: grid; place-items: center; overflow: hidden;
  background-color: #fff; background-image: linear-gradient(45deg, #f1f3f6 25%, transparent 25%, transparent 75%, #f1f3f6 75%), linear-gradient(45deg, #f1f3f6 25%, transparent 25%, transparent 75%, #f1f3f6 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.asset-preview img { max-width: 80%; max-height: 80%; object-fit: contain; }
.asset-preview-fav img { width: 48px; height: 48px; image-rendering: auto; }
.asset-preview .asset-empty { font-size: 12.5px; color: var(--navy-subtle); background: rgba(255,255,255,.9); padding: 4px 10px; border-radius: 99px; }
.asset-actions { display: flex; gap: 8px; align-items: center; }
.asset-actions label.btn { cursor: pointer; }

.brand-preview-wrap { display: flex; flex-direction: column; gap: 8px; }
.brand-preview-row { display: flex; gap: 14px; align-items: stretch; flex-wrap: wrap; }
.pv-sidebar { background: var(--navy); color: #fff; border-radius: var(--radius-md); padding: 16px 18px; min-width: 250px; display: flex; align-items: center; }
.pv-tab { display: flex; align-items: center; gap: 8px; align-self: center; background: #e9edf2; border: 1px solid var(--navy-border-strong); border-bottom: none; border-radius: 10px 10px 0 0; padding: 8px 14px; font-size: 12.5px; color: var(--navy); max-width: 260px; }
.pv-tab img { width: 16px; height: 16px; object-fit: contain; }
.pv-tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.u-cell { display: flex; align-items: center; gap: 10px; }
.u-avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.u-avatar.r-admin { background: var(--coral); }
.u-avatar.r-manager { background: var(--p-blue); }
.u-avatar.r-viewer { background: var(--p-slate); }

@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-tabs { position: static; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .settings-nav-label, .settings-tab .st-text small { display: none; }
  .settings-tab { flex: none; }
  .asset-grid { grid-template-columns: 1fr; }
}

/* ───────── Top / least performers ───────── */
.perf-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.perf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 4px 20px 8px; }
.perf-head { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 6px 12px; border-radius: 8px 8px 0 0; }
.perf-top { background: rgba(125, 203, 160, .22); color: #2f8f63; }
.perf-least { background: rgba(240, 130, 155, .20); color: #c23b57; }
.perf-col .table-scroll { border: 1px solid var(--navy-border); border-top: none; border-radius: 0 0 8px 8px; }
.perf-months-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--navy-subtle); padding: 14px 20px 6px; }
.chg-up { color: #3e9f72; font-weight: 700; }
.chg-down { color: #d9546f; font-weight: 700; }
.chg-na { color: var(--navy-subtle); }
@media (max-width: 900px) { .perf-grid { grid-template-columns: 1fr; } }

/* ───────── Stacked brand (uploaded logo on top, name below) ───────── */
.brand-box.brand-stack { flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 22px 20px 18px; }
.brand-stack .brand-logo.has-img { width: auto; min-width: 96px; max-width: 180px; height: auto; min-height: 64px; max-height: 132px; padding: 8px; border-radius: 6px; background: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); display: grid; place-items: center; }
.brand-stack .brand-logo.has-img img { width: auto; height: auto; max-width: 164px; max-height: 114px; object-fit: contain; display: block; }
.brand-stack .brand-title { font-size: 17px; font-weight: 700; line-height: 1.25; }
.brand-stack .brand-sub { margin-top: 4px; }
.login-hero .brand-box.brand-stack { align-items: flex-start; text-align: left; }
.pv-sidebar .brand-box.brand-stack { padding: 6px 0; }
.pv-sidebar { justify-content: center; }

/* Stacked logo: show the image as-is (no white frame around it) */
.brand-stack .brand-logo.has-img { padding: 0; background: transparent; box-shadow: none; border-radius: 0; min-width: 0; min-height: 0; overflow: visible; }
.brand-stack .brand-logo.has-img img { max-width: 172px; max-height: 130px; border-radius: 10px; }

/* ═════════════════════════════════════════════════════════════════════
   Design layer v4 · refined surfaces, typography and depth
   (pure overrides: no markup/JS contracts changed)
   ═════════════════════════════════════════════════════════════════════ */
:root {
  --canvas: #f3f5fa;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(35, 50, 70, .04), 0 2px 6px rgba(35, 50, 70, .04);
  --shadow-md: 0 4px 10px rgba(35, 50, 70, .05), 0 14px 34px rgba(35, 50, 70, .08);
  --ring: 0 0 0 3px rgba(240, 90, 80, .18);
  --grad-coral: linear-gradient(135deg, #f66b61 0%, #ea4b40 100%);
  --grad-navy: linear-gradient(180deg, #2d405a 0%, #233246 100%);
  --line: rgba(35, 50, 70, .08);
}
html, body { font-feature-settings: 'cv11', 'ss01'; letter-spacing: -.003em; }
body {
  background:
    radial-gradient(1100px 480px at 92% -8%, rgba(240, 90, 80, .07), transparent 60%),
    radial-gradient(900px 520px at -5% 0%, rgba(139, 168, 243, .10), transparent 60%),
    var(--canvas);
  background-attachment: fixed;
}
::selection { background: rgba(240, 90, 80, .22); }
* { scrollbar-width: thin; scrollbar-color: rgba(35, 50, 70, .22) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: rgba(35, 50, 70, .2); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(35, 50, 70, .35); background-clip: content-box; border: 2px solid transparent; }

/* Sidebar */
.sidebar { background: linear-gradient(180deg, #27394f 0%, #1c2a3c 100%); border-right: none; box-shadow: 6px 0 28px rgba(20, 30, 45, .16); }
.sidebar-label { letter-spacing: .1em; font-weight: 700; opacity: .55; }
.sidebar-select { border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .10); }
.sidebar-select:hover { background: rgba(255, 255, 255, .09); }
.nav-btn { border-radius: 12px; padding: 10px 13px; }
.nav-btn:hover { transform: translateX(2px); }
.nav-btn.active { background: var(--grad-coral); box-shadow: 0 8px 18px rgba(240, 90, 80, .34), inset 0 1px 0 rgba(255, 255, 255, .22); }
.nav-badge { background: rgba(255, 255, 255, .12); font-variant-numeric: tabular-nums; }
.db-pill { border-radius: 12px; background: rgba(0, 0, 0, .18); }
.sidebar-footer { border-top: 1px solid rgba(255, 255, 255, .07); }

/* Top bar + page frame */
.topbar { background: rgba(255, 255, 255, .82); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line); padding: 14px 32px; }
.topbar-left h1 { font-size: 21px; font-weight: 800; letter-spacing: -.03em; }
.topbar-sub { font-size: 12.5px; }
.content-wrap { padding: 26px 32px 60px; gap: 22px; width: 100%; max-width: 1760px; margin: 0 auto; }

/* Welcome strip */
.hero-strip { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 26px; border-radius: 20px; color: #fff; margin-bottom: 20px;
  background: radial-gradient(520px 220px at 100% 0%, rgba(240, 90, 80, .45), transparent 70%), linear-gradient(135deg, #2d405a 0%, #1c2a3c 100%);
  box-shadow: 0 14px 34px rgba(28, 42, 60, .22); position: relative; overflow: hidden; }
.hero-strip::after { content: ''; position: absolute; right: -40px; bottom: -70px; width: 220px; height: 220px; border-radius: 50%; border: 36px solid rgba(255, 255, 255, .05); }
.hero-hello { font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
.hero-sub { margin-top: 4px; font-size: 13.5px; color: rgba(255, 255, 255, .72); max-width: 640px; }
.hero-date { position: relative; z-index: 1; font-size: 12.5px; font-weight: 600; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .14); white-space: nowrap; }

/* Filters, inputs, segmented controls */
.filter-card { padding: 16px 20px; background: #fff; }
.filter-label { letter-spacing: .09em; font-weight: 700; color: var(--navy-subtle); }
.input-ctrl, .select-ctrl { min-height: 38px; border-radius: 10px; border: 1px solid rgba(35, 50, 70, .14); background-color: #fff; }
.input-ctrl:hover, .select-ctrl:hover { border-color: rgba(35, 50, 70, .28); }
.input-ctrl:focus, .select-ctrl:focus { outline: none; border-color: var(--coral); box-shadow: var(--ring); }
.segmented { background: #edf0f6; border: none; border-radius: 12px; padding: 3px; }
.seg-btn { border-radius: 9px; font-weight: 600; }
.seg-btn.active { background: var(--grad-navy); color: #fff; box-shadow: 0 2px 8px rgba(35, 50, 70, .28); }
.seg-btn.active-coral { background: var(--grad-coral); color: #fff; box-shadow: 0 4px 12px rgba(240, 90, 80, .32); }
.chip { border-radius: 999px; font-weight: 600; }
.chip.active { background: var(--grad-coral); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(240, 90, 80, .28); }

/* Buttons */
.btn { border-radius: 10px; font-weight: 600; letter-spacing: -.005em; }
.btn-primary { background: var(--grad-coral); border-color: transparent; box-shadow: 0 6px 14px rgba(240, 90, 80, .26), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn-primary:hover:not(:disabled) { background: var(--grad-coral); filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 10px 22px rgba(240, 90, 80, .34), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn-navy { background: var(--grad-navy); border-color: transparent; box-shadow: 0 6px 14px rgba(35, 50, 70, .22); }
.btn-navy:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.btn-outline { background: #fff; border: 1px solid rgba(35, 50, 70, .14); }
.btn-outline:hover:not(:disabled) { border-color: rgba(35, 50, 70, .32); background: #fafbfe; }

/* KPI cards */
.kpi-grid { gap: 16px; }
.kpi-card { padding: 18px 20px; background: linear-gradient(180deg, #fff 0%, #fbfcfe 100%); border-color: var(--line); gap: 8px; }
.kpi-card.accent-coral::before, .kpi-card.accent-navy::before { height: 3px; opacity: .9; }
.kpi-label { font-size: 11px; letter-spacing: .09em; font-weight: 700; }
.kpi-value { font-size: 31px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.kpi-icon { width: 36px; height: 36px; border-radius: 12px; }
.kpi-icon svg { width: 17px; height: 17px; }
.kpi-grid .kpi-card:nth-child(1) .kpi-icon { background: rgba(240, 90, 80, .12); color: #ea4b40; }
.kpi-grid .kpi-card:nth-child(2) .kpi-icon { background: rgba(139, 168, 243, .22); color: #5472c8; }
.kpi-grid .kpi-card:nth-child(3) .kpi-icon { background: rgba(180, 155, 224, .22); color: #7f61c4; }
.kpi-grid .kpi-card:nth-child(4) .kpi-icon { background: rgba(125, 203, 160, .24); color: #2f8f63; }
.kpi-grid .kpi-card:nth-child(5) .kpi-icon { background: rgba(239, 184, 120, .28); color: #b9741c; }
.kpi-grid .kpi-card:nth-child(6) .kpi-icon { background: rgba(240, 130, 155, .20); color: #c23b57; }

/* Panels */
.panel, .filter-card, .kpi-card { border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.panel:hover, .kpi-card:hover { box-shadow: var(--shadow-md); }
.panel-header { padding: 18px 22px; border-bottom: 1px solid rgba(35, 50, 70, .06); }
.panel-title { font-size: 15px; font-weight: 700; letter-spacing: -.015em; }
.panel-sub { font-size: 12.5px; line-height: 1.45; }
.panel-body { padding: 20px 22px; }
.table-toolbar { padding: 14px 22px; }
.insight-card { border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.plat-box { border-radius: 14px; }

/* Tables: light header, roomy rows, soft hover */
table.data-table { font-size: 13px; }
table.data-table thead th { background: #f4f6fb; color: #5b6a80; font-weight: 700; font-size: 10.5px; letter-spacing: .08em; padding: 12px 14px; border-right: none; border-bottom: 1px solid rgba(35, 50, 70, .08); }
table.data-table thead th:hover { background: #eaeef7; color: var(--navy); }
table.data-table thead th.sorted { background: rgba(240, 90, 80, .10); color: #d8402f; box-shadow: inset 0 -2px 0 var(--coral); }
table.data-table tbody td { padding: 12px 14px; }
table.data-table tbody tr { border-bottom: 1px solid rgba(35, 50, 70, .06); }
table.data-table tbody tr.post-row:hover { background: rgba(240, 90, 80, .05); }
table.data-table tbody tr:last-child { border-bottom: none; }
table.data-table tbody tr.group-header-row { background: #f7f8fc; }
table.data-table tfoot td { background: var(--grad-navy); padding: 13px 14px; }
.post-title-main { font-weight: 650; }

/* Badges: soft tinted pills with a status dot */
.badge { padding: 3px 10px; font-weight: 650; letter-spacing: 0; }
.badge-fb { background: rgba(35, 50, 70, .08); color: var(--navy); }
.badge-fb::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--navy); }
.badge-ig { background: rgba(240, 90, 80, .12); color: #d8402f; }
.badge-ig::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--coral); }
.badge-type { background: #f1f3f8; border-color: transparent; color: #4a586b; }

/* Modals, drawer, toasts */
.backdrop { -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.modal { border-radius: 22px; box-shadow: 0 30px 70px rgba(20, 30, 45, .30); }
.modal-header { padding: 20px 24px; }
.drawer { box-shadow: -24px 0 60px rgba(20, 30, 45, .22); }
.toast { border-radius: 12px; box-shadow: 0 12px 30px rgba(20, 30, 45, .22); }

/* Sign-in page */
.login-hero { position: relative; overflow: hidden;
  background: radial-gradient(760px 460px at 8% 108%, rgba(240, 90, 80, .34), transparent 62%), radial-gradient(520px 360px at 100% 0%, rgba(139, 168, 243, .16), transparent 60%), linear-gradient(160deg, #2c3f58 0%, #1a2738 100%); }
.login-hero::after { content: ''; position: absolute; right: -90px; top: 18%; width: 340px; height: 340px; border-radius: 50%; border: 56px solid rgba(255, 255, 255, .04); pointer-events: none; }
.login-hero > * { position: relative; z-index: 1; }
.login-hero-copy h1 { font-size: 38px; letter-spacing: -.035em; }
.login-points li::before { box-shadow: 0 0 0 4px rgba(240, 90, 80, .22); }
.login-panel { background: radial-gradient(700px 400px at 100% 100%, rgba(240, 90, 80, .06), transparent 60%), linear-gradient(180deg, #fff 0%, #f5f7fb 100%); }
.login-card { background: #fff; padding: 38px 36px; border-radius: 22px; border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(35, 50, 70, .12); }
.login-card h2 { font-size: 27px; letter-spacing: -.035em; }
.login-input { height: 44px; border-radius: 12px; }
.login-submit { height: 46px; border-radius: 12px; font-weight: 700; }

@media (max-width: 760px) {
  .content-wrap { padding: 18px 16px 48px; }
  .topbar { padding: 12px 16px; }
  .hero-strip { padding: 18px; }
  .kpi-value { font-size: 26px; }
}
@media print { .hero-strip { display: none; } }

/* Greeting band sits above the page title, on the Dashboard view only */
.hero-strip { margin: 0; border-radius: 0 0 22px 22px; padding: 22px 32px 24px; }
body[data-view]:not([data-view="overview"]) .hero-strip { display: none; }
@media (max-width: 760px) { .hero-strip { padding: 18px 16px 20px; border-radius: 0 0 18px 18px; } }

/* ═════════ Density pass v4.2 · compact, fit-to-screen layout ═════════ */
:root { --sidebar-w: 232px; }
html, body { font-size: 13.5px; }

/* Sidebar: tighter brand + nav */
.brand-box { padding: 14px 16px 12px; }
.brand-box.brand-stack { padding: 14px 16px 12px; gap: 8px; }
.brand-stack .brand-logo.has-img { min-width: 0; min-height: 0; max-width: 150px; max-height: 84px; }
.brand-stack .brand-logo.has-img img { max-width: 138px; max-height: 76px; }
.brand-stack .brand-title { font-size: 15px; }
.sidebar-section { padding: 10px 12px 4px; }
.nav-btn { padding: 8px 11px; font-size: 13px; }
.nav-btn svg { width: 16px; height: 16px; }
.sidebar-footer { padding: 10px 12px; gap: 8px; }

/* Greeting band: one slim line */
.hero-strip { padding: 10px 24px; border-radius: 0 0 16px 16px; }
.hero-strip::after { display: none; }
.hero-hello { font-size: 16px; letter-spacing: -.02em; }
.hero-sub { margin-top: 1px; font-size: 12px; }
.hero-date { padding: 5px 12px; font-size: 11.5px; }

/* Top bar */
.topbar { padding: 9px 24px; gap: 12px; }
.topbar-left h1 { font-size: 18px; letter-spacing: -.025em; }
.topbar-sub { font-size: 12px; margin-top: 0; }
.topbar-actions { gap: 8px; }
.btn { min-height: 34px; padding-top: 0; padding-bottom: 0; font-size: 12.5px; }
.btn-sm { min-height: 30px; font-size: 12px; }
.live-pill { height: 34px; }
.btn-excel { height: 34px; padding: 0 12px; font-size: 12.5px; }

/* Page frame */
.content-wrap { padding: 12px 24px 40px; gap: 14px; max-width: 1840px; }
.view-section { gap: 14px; }
#view-overview, .view-section.active { gap: 14px; }

/* Filters: compact single block */
.filter-card { padding: 10px 14px; gap: 8px; border-radius: 14px; }
.filter-row { gap: 8px 12px; }
.filter-group { gap: 3px; }
.filter-label { font-size: 9.5px; letter-spacing: .08em; }
.input-ctrl, .select-ctrl { min-height: 34px; font-size: 12.5px; border-radius: 9px; }
.segmented { padding: 2px; border-radius: 10px; }
.seg-btn { padding-top: 5px; padding-bottom: 5px; font-size: 12px; }
.chip { padding: 4px 11px; font-size: 12px; }

/* KPI cards: compact tiles, auto-fit so they never waste a row */
.kpi-grid { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 10px; }
.kpi-card { padding: 11px 14px; gap: 3px; border-radius: 14px; }
.kpi-top { gap: 8px; }
.kpi-label { font-size: 10px; letter-spacing: .07em; line-height: 1.25; }
.kpi-value { font-size: 23px; letter-spacing: -.035em; line-height: 1.1; }
.kpi-icon { width: 28px; height: 28px; border-radius: 9px; flex: none; }
.kpi-icon svg { width: 14px; height: 14px; }
.kpi-delta { margin: 0; padding: 1px 7px; font-size: 10px; }
.kpi-meta { font-size: 11px; gap: 2px 5px; }
.kpi-card.accent-coral::before, .kpi-card.accent-navy::before { height: 2px; }
.kpi-card:hover { transform: none; }

/* Panels */
.panel, .insight-card { border-radius: 14px; }
.panel-header { padding: 11px 16px; }
.panel-title { font-size: 13.5px; }
.panel-sub { font-size: 11.5px; margin-top: 1px; }
.panel-body { padding: 12px 16px; }
.table-toolbar { padding: 10px 16px; }
.grid-2, .grid-2-equal, .grid-3 { gap: 12px; }
.chart-box { height: 220px; }
.chart-box.sm { height: 175px; }
.insight-strip { gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.insight-card { padding: 10px 12px; gap: 10px; }
.insight-ico { flex-basis: 28px; height: 28px; border-radius: 9px; }
.insight-title { font-size: 12.5px; }
.insight-text { font-size: 11.5px; line-height: 1.4; }
.plat-box { padding: 10px 12px; }
.platform-split { margin-bottom: 10px; gap: 10px; }
.perf-grid { padding: 4px 16px 6px; gap: 12px; }

/* Tables */
table.data-table { font-size: 12.5px; }
table.data-table thead th { padding: 9px 11px; }
table.data-table tbody td { padding: 8px 11px; }
table.data-table tfoot td { padding: 10px 11px; }

/* Settings + modals */
.settings-layout { gap: 14px; }
.modal-header { padding: 16px 20px; }

@media (max-width: 760px) {
  .content-wrap { padding: 10px 12px 40px; }
  .topbar { padding: 8px 12px; }
  .hero-strip { padding: 8px 14px; }
  .hero-sub { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 21px; }
}

@media (max-width: 900px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .topbar-sub { display: none; }
  .topbar-actions { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
  .topbar-actions .btn, .topbar-actions .btn-excel, .topbar-actions .live-pill { flex: 0 0 auto; font-size: 12px; padding-left: 10px; padding-right: 10px; }
}

/* Filter labels v4.3: darker, larger, clearer hierarchy */
.filter-label { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #2b3b52; line-height: 1.2; }
.filter-group { gap: 5px; }
.filter-card { padding: 12px 16px; }
.filter-card .input-ctrl, .filter-card .select-ctrl { min-height: 36px; font-size: 13px; color: var(--navy); border-color: #d5dbe6; }
.filter-card .seg-btn { font-size: 12.5px; }

/* KPI labels v4.4: darker, larger, easier to scan */
.kpi-label { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #2b3b52; line-height: 1.25; }
.kpi-value { color: var(--navy); }
.kpi-delta { font-size: 10.5px; }
.kpi-delta small { opacity: .9; }

/* ===== Settings polish v4.5 ===== */
#view-settings .settings-layout { grid-template-columns: 264px minmax(0, 1fr); gap: 18px; align-items: start; }
#view-settings .settings-tabs { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); padding: 12px; gap: 3px; }
#view-settings .settings-nav-label { color: #5b6b82; font-size: 10.5px; padding: 10px 10px 5px; }
#view-settings .settings-tab { position: relative; padding: 9px 10px; border-radius: 12px; }
#view-settings .settings-tab .st-text strong { font-size: 13.5px; }
#view-settings .settings-tab .st-text small { font-size: 11.5px; color: #6c7b90; }
#view-settings .settings-tab:hover:not(.active) { background: #f4f6fb; }
#view-settings .settings-tab.active { background: linear-gradient(90deg, rgba(240,90,80,.10), rgba(240,90,80,.03)); border-color: rgba(240,90,80,.28); }
#view-settings .settings-tab.active::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--coral); }

#view-settings .settings-pane.panel { overflow: hidden; }
#view-settings .settings-pane > .panel-header { padding: 16px 22px; background: linear-gradient(180deg, #fbfcfe, #f5f7fb); border-bottom: 1px solid var(--line); }
#view-settings .settings-pane .panel-title { font-size: 16px; font-weight: 750; color: var(--navy); }
#view-settings .settings-pane .panel-sub { font-size: 12.5px; color: #5b6b82; margin-top: 3px; }
#view-settings .settings-form { padding: 20px 22px 22px; gap: 20px; }
#view-settings .form-grid { gap: 16px 18px; }
#view-settings .form-field { gap: 6px; }
#view-settings .form-field label { font-size: 12px; font-weight: 700; letter-spacing: .02em; color: #2b3b52; }
#view-settings .form-field small { font-size: 11.5px; color: #6c7b90; line-height: 1.4; }
#view-settings .input-ctrl, #view-settings .select-ctrl { min-height: 40px; font-size: 13.5px; border: 1px solid #d5dbe6; border-radius: 10px; background: #fff; color: var(--navy); transition: border-color .15s, box-shadow .15s; }
#view-settings .input-ctrl:hover, #view-settings .select-ctrl:hover { border-color: #b9c3d3; }
#view-settings .input-ctrl:focus, #view-settings .select-ctrl:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(240,90,80,.15); outline: none; }
#view-settings .input-ctrl:disabled { background: #f3f5f9; color: #5b6b82; cursor: not-allowed; }
#view-settings .settings-form > div:last-child:not(.form-grid):not(.asset-grid):not(.brand-preview-wrap) { padding-top: 16px; border-top: 1px solid var(--line); }
#view-settings .settings-form .btn-primary { min-height: 38px; padding: 0 20px; }

#view-settings .profile-hero { margin: 20px 22px 0; padding: 18px 22px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(135deg, #fff5f4 0%, #f5f7fd 100%); }
#view-settings .profile-avatar { width: 64px; height: 64px; font-size: 24px; background: linear-gradient(135deg, #233246, #3a5072); box-shadow: 0 0 0 4px #fff, 0 0 0 6px rgba(240,90,80,.35); }
#view-settings .profile-name { font-size: 18px; }
#view-settings .profile-hero + .settings-form { padding-top: 20px; }

#view-settings .asset-card { border-radius: 14px; padding: 16px 18px; }
#view-settings .asset-head strong { font-size: 14px; }
#view-settings .asset-head small { color: #6c7b90; }
#view-settings .asset-preview { height: 128px; border-radius: 12px; border-color: #c9d1de; }
#view-settings .brand-preview-wrap { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: #fafbfd; }
#view-settings .brand-preview-wrap .filter-label { font-size: 11.5px; }
#view-settings .pv-sidebar { border-radius: 12px; background: linear-gradient(180deg, #233246, #1b2838); }

#view-settings .settings-form .form-field.full:has(#prefComments) { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfd; }
#view-settings #prefComments { width: 17px; height: 17px; accent-color: var(--coral); }
#view-settings .form-field.full label[style] { font-size: 13px; font-weight: 600; }

#view-settings .table-scroll { padding: 4px 8px 10px; }
#view-settings table.data-table thead th { font-size: 11px; letter-spacing: .05em; color: #2b3b52; }
#view-settings .u-avatar { width: 34px; height: 34px; }

@media (max-width: 900px) {
  #view-settings .settings-layout { grid-template-columns: 1fr; }
  #view-settings .settings-tabs { padding: 8px; }
  #view-settings .settings-tab.active::before { display: none; }
  #view-settings .settings-form { padding: 16px; }
  #view-settings .settings-pane > .panel-header { padding: 14px 16px; }
  #view-settings .profile-hero { margin: 16px 16px 0; }
}

/* ===== Platform polish v4.6 ===== */
@media (min-width: 901px) {
  .topbar-left { min-width: 0; flex: 1 1 auto; }
  .topbar-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .topbar-actions { flex: 0 0 auto; flex-wrap: nowrap; }
  .topbar-actions .btn, .topbar-actions .btn-excel, .topbar-actions .live-pill { white-space: nowrap; }
}
html { scroll-behavior: smooth; }
::selection { background: rgba(240, 90, 80, .22); color: var(--navy); }
.btn:focus-visible, .nav-btn:focus-visible, .seg-btn:focus-visible, .chip:focus-visible, .btn-excel:focus-visible, .live-pill:focus-visible, .user-logout:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.input-ctrl:focus, .select-ctrl:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(240, 90, 80, .14); outline: none; }

/* Friendlier empty states */
td.empty-state { padding: 26px 16px; color: #5b6b82; font-size: 12.5px; text-align: center; }
td.empty-state h3 { font-size: 14px; font-weight: 700; color: var(--navy); margin: 0 0 4px; }
td.empty-state:has(h3)::before { content: ""; display: block; width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 14px; background: #fff3f2 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F05A50' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.5 5.1 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.5-6.9A2 2 0 0 0 16.7 4H7.3a2 2 0 0 0-1.8 1.1z'/%3E%3C/svg%3E") center/22px no-repeat; border: 1px solid rgba(240, 90, 80, .22); }
.chart-box.is-empty::after { color: #6c7b90; font-size: 13px; flex-direction: column; gap: 6px; }

/* Panels & section titles: slightly clearer hierarchy */
.panel-title { color: var(--navy); }
.panel-sub { color: #5b6b82; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ===== Connect page as inline tab v4.8 ===== */
.acc-tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); }
.acc-tab { border: 0; background: transparent; padding: 8px 16px; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 650; color: #5b6b82; cursor: pointer; transition: background .15s, color .15s; }
.acc-tab:hover:not(.active) { background: #f4f6fb; color: var(--navy); }
.acc-tab.active { background: linear-gradient(135deg, #f7685d, #ea4b40); color: #fff; box-shadow: 0 4px 10px rgba(240, 90, 80, .28); }
.acc-tab:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.acc-pane { display: none; }
.acc-pane.active { display: block; animation: paneIn .25s var(--ease); }
.acc-form { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 18px; max-width: 920px; }
.acc-form .form-field label { font-size: 12px; font-weight: 700; color: #2b3b52; }
.acc-form .input-ctrl, .acc-form .select-ctrl { min-height: 40px; font-size: 13.5px; border-radius: 10px; }
.acc-form textarea { min-height: 96px; border-radius: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.acc-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; }
.acc-actions-right { display: flex; gap: 8px; }
@media (max-width: 760px) { .acc-form { padding: 16px; } .acc-actions-right { width: 100%; } .acc-actions-right .btn { flex: 1; } }

/* ===== Sidebar text: pure white v4.9 ===== */
.nav-btn { color: #fff; font-weight: 550; }
.nav-btn svg { opacity: 1; }
.nav-btn:hover:not(.active) { background: rgba(255, 255, 255, .10); color: #fff; }
.nav-group-label { color: rgba(255, 255, 255, .92); font-weight: 700; letter-spacing: .1em; }
.sidebar-label { color: #fff; opacity: .92; font-weight: 700; }
.nav-badge { background: rgba(255, 255, 255, .2); color: #fff; }
.sidebar .brand-sub { color: rgba(255, 255, 255, .85); }
.sidebar .user-role, .sidebar .user-meta small { color: rgba(255, 255, 255, .85); }
.sidebar-footer, .sidebar-footer * { color: #fff; }
.sidebar-footer .btn-primary { color: #fff; }