@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

/* ─── RESET ──────────────────────────────────────────────────────────────── */

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

:root {
  --bg:              #060606;
  --surface:         #0d0d0d;
  --surface-2:       #141414;
  --surface-3:       #1c1c1c;
  --border:          #1e1e1e;
  --border-mid:      #2a2a2a;
  --border-light:    #363636;
  --text:            #ededed;
  --text-secondary:  #888;
  --text-muted:      #4a4a4a;
  --text-dim:        #2c2c2c;
  --success:         #22c55e;
  --success-bg:      rgba(34,197,94,.1);
  --warning:         #f59e0b;
  --warning-bg:      rgba(245,158,11,.1);
  --danger:          #ef4444;
  --danger-bg:       rgba(239,68,68,.1);
  --sidebar-w:       252px;
  --header-h:        54px;
  --r:               8px;
  --r-lg:            12px;
  --r-xl:            16px;
  --ease:            cubic-bezier(0.4, 0, 0.2, 1);
  --accent:          #2563eb;
  --accent-2:        #7c3aed;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv01","cv09","ss01";
}

/* ─── SCROLLBAR ──────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ─── UTILITIES ──────────────────────────────────────────────────────────── */

.hidden { display: none !important; }
.text-muted { color: var(--text-secondary); }

/* ─── PRESENTATION MODE ──────────────────────────────────────────────────── */
body.presentation-mode .sidebar         { display: none !important; }
body.presentation-mode .token-badge     { display: none !important; }
body.presentation-mode #extract-all-btn { display: none !important; }
body.presentation-mode .header-sep      { display: none !important; }
body.presentation-mode .header-title    { display: none !important; }
body.presentation-mode .sales-card      { display: none !important; }
body.presentation-mode #present-btn     { background: rgba(220,38,38,0.15); border-color: rgba(220,38,38,0.4); color: #f87171; }
body.presentation-mode #op-panel-btn   { display: none !important; }

/* ─── OPERATIONAL PANEL ──────────────────────────────────────────────────── */
.op-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.op-topbar-title {
  flex: 1;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.op-content {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.op-section-title {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.op-alerts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.op-no-alerts {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
}
.alert-card {
  border-radius: var(--r-lg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.alert-card.red    { background: #130808; border: 1px solid #7f1d1d; border-left: 3px solid #ef4444; }
.alert-card.yellow { background: #12100a; border: 1px solid #78350f; border-left: 3px solid #f59e0b; }
.alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 2px;
}
.alert-card.red    .alert-badge { color: #f87171; }
.alert-card.yellow .alert-badge { color: #fbbf24; }
.alert-client { font-size: .8rem; font-weight: 700; color: var(--text); }
.alert-type   { font-size: .75rem; color: var(--text-secondary); margin-top: 1px; }
.alert-value  { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 6px; }
.alert-card.red    .alert-value { color: #ef4444; }
.alert-card.yellow .alert-value { color: #f59e0b; }
.alert-detail { font-size: .65rem; color: var(--text-muted); margin-top: 2px; }

/* Op panel — summary bar */
.op-summary {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.op-summary-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
}
.op-summary-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}
.op-summary-num {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.op-summary-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.op-summary-red .op-summary-num    { color: #ef4444; }
.op-summary-red .op-summary-label  { color: #7f1d1d; }
.op-summary-yellow .op-summary-num   { color: #f59e0b; }
.op-summary-yellow .op-summary-label { color: #78350f; }
.op-summary-gray .op-summary-num   { color: var(--text-secondary); }
.op-summary-gray .op-summary-label { color: var(--text-muted); }

/* Op panel — sub-tab navigation */
.op-tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  padding: 0 24px;
}
.op-tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 120ms var(--ease), border-color 120ms var(--ease);
  margin-bottom: -1px;
  letter-spacing: .04em;
}
.op-tab-btn:hover { color: var(--text); }
.op-tab-btn.active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.op-tab-pane { padding: 0; }
.op-tab-pane.hidden { display: none; }

/* Op panel — filter tabs */
.op-filter-bar {
  display: flex;
  gap: 4px;
  padding: 10px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.op-filter-btn {
  padding: 5px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms var(--ease);
}
.op-filter-btn:hover { color: var(--text); border-color: var(--border-mid); }
.op-filter-btn.active { background: var(--text); color: #000; border-color: transparent; font-weight: 600; }

/* Op panel — updated-at */
.op-updated-at {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  flex: 1;
}

/* Op panel — client block */
.op-client-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 16px;
}
.op-client-block-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: background 100ms var(--ease);
}
.op-client-block-header:hover { background: var(--surface-3); }
.op-client-block-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.op-client-block-count {
  font-size: 0.65rem;
  color: var(--text-muted);
}
.op-alert-rows {
  display: flex;
  flex-direction: column;
}
.op-alert-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: background 100ms var(--ease);
}
.op-alert-row:last-child { border-bottom: none; }
.op-alert-row.red    { border-left-color: #ef4444; }
.op-alert-row.yellow { border-left-color: #f59e0b; }
.op-alert-row:hover  { background: var(--surface-2); }
.op-alert-row-badge {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  width: 68px;
  flex-shrink: 0;
}
.op-alert-row.red    .op-alert-row-badge { color: #f87171; }
.op-alert-row.yellow .op-alert-row-badge { color: #fbbf24; }
.op-alert-row-type {
  font-size: 0.75rem;
  color: var(--text-secondary);
  flex: 1;
}
.op-alert-row-value {
  font-size: 0.875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.op-alert-row.red    .op-alert-row-value { color: #ef4444; }
.op-alert-row.yellow .op-alert-row-value { color: #f59e0b; }
.op-alert-row-detail {
  font-size: 0.65rem;
  color: var(--text-muted);
  min-width: 200px;
  max-width: 320px;
  line-height: 1.4;
}

/* Op panel — no data section */
.op-nodata-section {
  margin-top: 8px;
}
.op-nodata-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.op-nodata-chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: var(--surface);
  cursor: pointer;
  transition: all 100ms;
}
.op-nodata-chip:hover { border-color: var(--border-mid); color: var(--text); background: var(--surface-2); }

/* ─── WEEKLY CHANGES ────────────────────────────────────────────────────── */

.wc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.wc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.wc-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wc-card-icon {
  font-size: 1rem;
  line-height: 1;
}
.wc-card-title {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}
.wc-card-count {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.wc-card--new    .wc-card-count { color: #ef4444; }
.wc-card--ok     .wc-card-count { color: #22c55e; }
.wc-card--better .wc-card-count { color: #4ade80; }
.wc-card--worse  .wc-card-count { color: #f87171; }

.wc-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}
.wc-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 100ms;
  font-size: 0.7rem;
}
.wc-item:hover { background: var(--surface-2); }
.wc-item-name { flex: 1; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-item-val  { font-size: 0.65rem; font-weight: 700; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.wc-item-val.green { color: #4ade80; }
.wc-item-val.red   { color: #f87171; }
.wc-item-val.muted { color: var(--text-muted); }
.wc-empty { font-size: 0.7rem; color: var(--text-muted); padding: 8px 0; }

/* ─── PORTFOLIO VISION ───────────────────────────────────────────────────── */

.pv-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto auto;
  gap: 14px;
}
.pv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 24px;
}
.pv-card--wide { /* spans right column only — natural */ }
.pv-card--full {
  grid-column: 1 / -1; /* full width */
}
.pv-card-title {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Rankings */
.pv-rankings {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.pv-rank-label {
  font-size: 0.575rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.pv-rank-green { color: #4ade80; }
.pv-rank-red   { color: #f87171; }

.pv-rank-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pv-rank-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background 100ms;
  border: 1px solid var(--border);
}
.pv-rank-item:hover { background: var(--surface-2); border-color: var(--border-mid); }
.pv-rank-pos {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 14px;
  flex-shrink: 0;
  text-align: center;
}
.pv-rank-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pv-rank-val {
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.pv-rank-item.best  .pv-rank-val { color: #4ade80; }
.pv-rank-item.worst .pv-rank-val { color: #f87171; }

/* Performance Score Badge */
.pv-score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 28px;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  cursor: help;
  padding: 0 8px;
}
.pv-score-badge.green  { background: rgba(34,197,94,.12);  color: #4ade80; border: 1px solid rgba(34,197,94,.3);  }
.pv-score-badge.yellow { background: rgba(245,158,11,.12); color: #fbbf24; border: 1px solid rgba(245,158,11,.3); }
.pv-score-badge.red    { background: rgba(239,68,68,.12);  color: #f87171; border: 1px solid rgba(239,68,68,.3);  }

.pv-score-sub {
  font-size: .6rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.pv-score-tooltip {
  position: fixed;
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  font-size: .7rem;
  color: var(--text-secondary);
  line-height: 2;
  box-shadow: 0 12px 40px rgba(0,0,0,.7);
  z-index: 9999;
  pointer-events: none;
  min-width: 220px;
  white-space: nowrap;
}
.pv-score-tooltip strong { color: var(--text); font-size: .75rem; }
.pv-score-tooltip .tt-row { display: flex; justify-content: space-between; gap: 20px; }
.pv-score-tooltip .tt-contrib { color: var(--text); font-weight: 600; }

.pv-warn-icon { color: #f59e0b; font-size: .75rem; cursor: help; margin-left: 3px; }

/* Op panel — operational metrics table */
.op-metrics-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.op-metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.775rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.op-metrics-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
.op-th-sortable {
  cursor: pointer;
  user-select: none;
  transition: color 100ms;
}
.op-th-sortable:hover { color: var(--text-secondary) !important; }
.op-th-sortable.sorted { color: var(--text) !important; }
.op-metrics-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
.op-metrics-table tbody tr:last-child td { border-bottom: none; }
.op-metrics-table tbody tr:hover td { background: var(--surface-2); }

.op-client-link {
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: color 100ms;
}
.op-client-link:hover { color: #60a5fa; text-decoration: underline; }

.op-var {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  font-weight: 600;
}
.op-var.good  { color: #4ade80; }
.op-var.bad   { color: #f87171; }
.op-var.neutral { color: var(--text-muted); }

.op-rate-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.65rem;
  font-weight: 700;
}
.op-rate-badge.green  { background: rgba(34,197,94,.12);  color: #4ade80;  border: 1px solid rgba(34,197,94,.25);  }
.op-rate-badge.yellow { background: rgba(245,158,11,.12); color: #fbbf24;  border: 1px solid rgba(245,158,11,.25); }
.op-rate-badge.red    { background: rgba(239,68,68,.12);  color: #f87171;  border: 1px solid rgba(239,68,68,.25);  }

.op-rel-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 4px 8px;
  cursor: pointer;
  appearance: none;
  padding-right: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  transition: border-color 120ms;
}
.op-rel-select:focus { outline: none; border-color: var(--border-light); }
.op-rel-select[data-level="Alto"]  { border-color: rgba(34,197,94,.4);  color: #4ade80; }
.op-rel-select[data-level="Médio"] { border-color: rgba(245,158,11,.4); color: #fbbf24; }
.op-rel-select[data-level="Baixo"] { border-color: rgba(239,68,68,.4);  color: #f87171; }

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: var(--r);
  border: 1px solid var(--border-mid);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
  white-space: nowrap;
  user-select: none;
  letter-spacing: 0.01em;
}
.btn:hover  { background: var(--surface-3); border-color: var(--border-light); color: var(--text); }
.btn:active { opacity: 0.65; }
.btn:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-primary {
  background: var(--text);
  color: #000;
  border-color: transparent;
  font-weight: 600;
}
.btn-primary:hover { background: #d4d4d4; color: #000; }

.btn-sm { padding: 4px 10px; font-size: 0.6875rem; }

.btn-icon-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 4px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 120ms var(--ease), background 120ms var(--ease);
}
.btn-icon-delete:hover { color: var(--danger); background: var(--danger-bg); }

/* ─── INPUTS ─────────────────────────────────────────────────────────────── */

.input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8125rem;
  padding: 8px 12px;
  transition: border-color 120ms var(--ease), background 120ms var(--ease);
  width: 100%;
}
.input:focus { outline: none; border-color: var(--border-light); background: var(--surface-3); }
.input::placeholder { color: var(--text-muted); }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}
select.input option { background: var(--surface-2); }

/* ─── LOGIN ──────────────────────────────────────────────────────────────── */

.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.login-box {
  width: 100%;
  max-width: 320px;
  padding: 44px 40px;
  text-align: center;
  border: 1px solid var(--border-mid);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: 0 0 0 1px rgba(255,255,255,.03), 0 40px 80px rgba(0,0,0,.6);
}

.login-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
  margin: 0 auto 36px;
  display: block;
  border-radius: 8px;
}

.login-box h2 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.login-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.login-form { display: flex; flex-direction: column; gap: 10px; }

.login-error {
  color: var(--danger);
  font-size: 0.75rem;
  min-height: 16px;
  text-align: left;
}

/* ─── APP LAYOUT ─────────────────────────────────────────────────────────── */

.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ─── HEADER ─────────────────────────────────────────────────────────────── */

.header {
  height: var(--header-h);
  border-bottom: 1px solid rgba(37,99,235,0.2);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #0a0a0a 0%, #0f1729 100%);
  z-index: 50;
}

.header-logo {
  height: 24px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.header-sep {
  width: 1px;
  height: 16px;
  background: var(--border-mid);
  flex-shrink: 0;
}

.header-title {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.token-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  color: var(--text-secondary);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
}

.token-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
  transition: background 0.3s;
}
.token-dot.valid   { background: var(--success); box-shadow: 0 0 6px rgba(34,197,94,.6); }
.token-dot.invalid { background: var(--danger); }

/* ─── BODY ───────────────────────────────────────────────────────────────── */

.body { display: flex; flex: 1; overflow: hidden; border-top: none; }

/* ─── SIDEBAR ────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  border-right: 1px solid rgba(37,99,235,0.15);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: var(--surface);
}

.sidebar-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

#client-count {
  font-size: 0.65rem;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-radius: 99px;
  padding: 1px 7px;
  font-weight: 500;
}

.sidebar-search {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-search .input {
  background: var(--bg);
  font-size: 0.775rem;
  padding: 7px 11px;
}

.client-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.client-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 100ms var(--ease), color 100ms var(--ease);
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.client-item:hover { background: var(--surface-2); color: var(--text); }
.client-item.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }

.client-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.client-dot.on { background: var(--success); }
.client-item.active .client-dot { background: rgba(255,255,255,.3); }
.client-item.active .client-dot.on { background: #4ade80; }

.client-name { flex: 1; line-height: 1.3; }

.client-alert-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.client-alert-dot.green  { background: #22c55e; box-shadow: 0 0 5px rgba(34,197,94,.5); }
.client-alert-dot.yellow { background: #f59e0b; box-shadow: 0 0 5px rgba(245,158,11,.5); }
.client-alert-dot.red    { background: #ef4444; box-shadow: 0 0 5px rgba(239,68,68,.6); }

.btn-copy-link {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 3px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 4px;
  flex-shrink: 0;
  opacity: 0.6;
}
.client-item:hover .btn-copy-link { display: flex; }
.btn-copy-link:hover { opacity: 1; color: var(--text-secondary); }
.client-item.active .btn-copy-link { color: rgba(255,255,255,0.5); }
.client-item.active .btn-copy-link:hover { color: rgba(255,255,255,0.9); }

/* ─── MAIN ───────────────────────────────────────────────────────────────── */

.main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.main::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 500px;
  background: url('/assets/logoDelta.jpeg') center/contain no-repeat;
  opacity: 0.025;
  pointer-events: none;
  z-index: 0;
}

/* ─── EMPTY STATE ────────────────────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 14px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state svg { opacity: 0.12; }
.empty-state p { font-size: 0.8125rem; color: var(--text-secondary); }

/* ─── CLIENT HEADER ──────────────────────────────────────────────────────── */

.client-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.client-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  flex: 1;
  letter-spacing: -0.03em;
  min-width: 180px;
  color: var(--text);
  line-height: 1.1;
}

/* ─── NOTES WIDGET ───────────────────────────────────────────────────────── */

.notes-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 18px;
}
.notes-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.notes-widget-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}
.notes-saved-indicator {
  font-size: 0.6rem;
  color: var(--success);
  letter-spacing: 0.02em;
  transition: opacity 0.3s;
}
.notes-textarea {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  line-height: 1.6;
  width: 100%;
  resize: none;
  min-height: 52px;
  max-height: 160px;
  outline: none;
  padding: 0;
}
.notes-textarea::placeholder { color: var(--text-dim); }
.notes-textarea:focus { color: var(--text); }

body.presentation-mode .notes-widget { display: none !important; }

/* ─── PERIOD TABS ────────────────────────────────────────────────────────── */

.period-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  width: fit-content;
}

.period-tab {
  padding: 5px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms var(--ease);
}
.period-tab:hover { color: var(--text); }
.period-tab.active { background: var(--text); color: #000; font-weight: 600; }

.date-range-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.date-range-row .input { width: 148px; }

/* ─── METRICS GRID ───────────────────────────────────────────────────────── */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* ── Base metric card ── */
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 120ms var(--ease);
  position: relative;
  overflow: hidden;
}

/* Subtle top-edge highlight — hallmark of premium dark cards */
.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.07) 50%, transparent 100%);
  pointer-events: none;
}

.metric-card:hover { border-color: var(--border-mid); }

/* ── Featured metric card (dark gradient) — hero KPIs ── */
.metric-card--featured {
  background: linear-gradient(135deg, #1a2744 0%, #0f1729 100%);
  border-color: rgba(37,99,235,0.3);
  color: #fff;
}
.metric-card--featured::before { display: none; }
.metric-card--featured:hover { border-color: rgba(37,99,235,0.5); }
.metric-card--featured .metric-label { color: rgba(255,255,255,0.6); }
.metric-card--featured .metric-value { color: #fff; }
.metric-card--featured .metric-change { color: rgba(255,255,255,0.4); }

.metric-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.metric-delta {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 4px;
}
.metric-delta.positive { color: #4ade80; }
.metric-delta.negative { color: #f87171; }
.metric-card--featured .metric-delta.positive { color: #4ade80; }
.metric-card--featured .metric-delta.negative { color: #f87171; }

/* ─── SKELETON ───────────────────────────────────────────────────────────── */

.skeleton {
  height: 1.75rem;
  width: 60%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── CACHE INFO ─────────────────────────────────────────────────────────── */

.cache-info {
  font-size: 0.625rem;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

/* ─── SECTION TITLE ──────────────────────────────────────────────────────── */

.section-title {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

/* ─── SALES SECTION ──────────────────────────────────────────────────────── */

.sales-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 12px;
}

.sales-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

/* ─── TABLES ─────────────────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.775rem;
  font-variant-numeric: tabular-nums;
}

thead th {
  text-align: left;
  padding: 0 10px 10px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

tbody td:first-child { color: var(--text); font-weight: 500; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

.table-empty {
  color: var(--text-muted);
  font-size: 0.775rem;
  padding: 20px 10px;
  text-align: center;
}

/* ─── TOAST ──────────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 9999;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  color: var(--text);
  font-size: 0.775rem;
  padding: 10px 16px;
  border-radius: var(--r);
  box-shadow: 0 8px 32px rgba(0,0,0,.7), 0 2px 8px rgba(0,0,0,.4);
  animation: toastIn 0.18s var(--ease);
  max-width: 280px;
  letter-spacing: 0.01em;
}
.toast.success { border-left: 2px solid var(--success); }
.toast.error   { border-left: 2px solid var(--danger); }

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

/* ══════════════════════════════════════════════════════════════════════════ */
/* ── CLIENT PUBLIC PAGE ─────────────────────────────────────────────────── */
/* ══════════════════════════════════════════════════════════════════════════ */

.client-page { min-height: 100vh; background: var(--bg); }

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.page-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  flex-direction: column;
  gap: 12px;
  color: var(--text-secondary);
}

.cp-header {
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
}
.cp-logo { height: 26px; width: auto; object-fit: contain; }
.cp-updated { font-size: 0.65rem; color: var(--text-muted); letter-spacing: 0.04em; }

.cp-hero {
  padding: 52px 40px 40px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #0c0c0c 0%, var(--bg) 100%);
}
.cp-hero-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.cp-hero-name {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.cp-hero-sub {
  font-size: 0.775rem;
  color: var(--text-secondary);
  margin-top: 12px;
}

.cp-content {
  max-width: 1160px;
  margin: 0 auto;
  padding: 40px 40px 60px;
}

.cp-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  width: fit-content;
  margin-bottom: 28px;
}
.cp-tab {
  padding: 6px 20px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms var(--ease);
}
.cp-tab:hover { color: var(--text); }
.cp-tab.active { background: var(--text); color: #000; font-weight: 600; }

.cp-section { display: none; }
.cp-section.active { display: block; }

.cp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 32px;
}

.cp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 120ms var(--ease);
}
.cp-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent);
}
.cp-card:hover { border-color: var(--border-mid); }

.cp-card.featured {
  background: #fff;
  border-color: transparent;
  color: #000;
}
.cp-card.featured::before { display: none; }

.cp-card .cp-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.cp-card.featured .cp-label { color: #888; }

.cp-card .cp-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.cp-card.featured .cp-value { color: #000; }

.cp-no-data {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  padding: 40px 0;
  text-align: center;
}

.cp-sales-section { margin-top: 4px; }
.cp-sales-title {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.cp-sales-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.cp-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  text-align: center;
  min-width: 120px;
}
.cp-chip-value {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.cp-chip-label {
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.4;
}

.cp-footer {
  border-top: 1px solid var(--border);
  padding: 18px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cp-powered {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.cp-powered img { height: 18px; opacity: 0.3; filter: brightness(0) invert(1); }
.cp-footer-date { font-size: 0.65rem; color: var(--text-muted); }

/* ─── LOGIN — 2FA ────────────────────────────────────────────────────────── */

.login-totp-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 6px;
  text-align: center;
}

.input-totp {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  font-variant-numeric: tabular-nums;
  padding: 10px;
}

/* ─── MODAL ──────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 80px rgba(0,0,0,.7);
}

.modal-header {
  display: flex;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 0.875rem;
  font-weight: 700;
  flex: 1;
  letter-spacing: -0.01em;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r);
  transition: color 120ms, background 120ms;
}
.modal-close-btn:hover { color: var(--text); background: var(--surface-3); }

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  flex-shrink: 0;
}

.modal-tab {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 120ms, border-color 120ms;
}
.modal-tab:hover { color: var(--text); }
.modal-tab.active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stab-pane { display: flex; flex-direction: column; gap: 20px; }
.stab-pane.hidden { display: none; }

/* ─── SETTINGS ───────────────────────────────────────────────────────────── */

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.settings-row-label { font-size: 0.75rem; color: var(--text-secondary); }
.settings-row-value { font-size: 0.8rem; font-weight: 600; }

.settings-section-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-section-title {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ─── TOTP ───────────────────────────────────────────────────────────────── */

.totp-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r);
  font-size: 0.8rem;
}
.totp-on  { background: var(--success-bg); border: 1px solid rgba(34,197,94,.25); color: #4ade80; }
.totp-off { background: var(--warning-bg); border: 1px solid rgba(245,158,11,.2); color: var(--text-secondary); }

.totp-setup { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.totp-setup-hint { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }
.totp-qr {
  width: 180px;
  height: 180px;
  border-radius: var(--r);
  background: #fff;
  padding: 8px;
  display: block;
  margin: 4px auto;
}

/* ─── USER LIST ──────────────────────────────────────────────────────────── */

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  margin-bottom: 6px;
}
.user-row-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.user-row-email { font-size: 0.8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.user-badge {
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-admin    { background: rgba(37,99,235,.15);  color: #60a5fa; border: 1px solid rgba(37,99,235,.3); }
.badge-gestor   { background: rgba(168,85,247,.15); color: #c084fc; border: 1px solid rgba(168,85,247,.3); }
.badge-2fa      { background: rgba(34,197,94,.1);   color: #4ade80; border: 1px solid rgba(34,197,94,.25); }
.badge-inactive { background: rgba(239,68,68,.1);   color: #f87171; border: 1px solid rgba(239,68,68,.2); }
.user-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ─── CHECKBOX CLIENT LIST ─────────────────────────────────────────────────── */
.checkbox-client-list {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 0;
  background: var(--surface);
}
.checkbox-client-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: .8rem;
  color: var(--text-secondary);
  transition: background .1s;
}
.checkbox-client-row:hover { background: var(--surface-2); }
.checkbox-client-row input[type="checkbox"] { accent-color: var(--accent, #6366f1); flex-shrink: 0; }

/* ─── CLIENT LABEL DOTS ────────────────────────────────────────────────────── */
.client-label-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; cursor:default; display:inline-block; }

/* ─── ALERT LEGEND ─────────────────────────────────────────────────────────── */
.alert-legend { border:1px solid var(--border); border-radius:8px; margin-bottom:14px; overflow:hidden; }
.alert-legend-toggle {
  width:100%; display:flex; justify-content:space-between; align-items:center;
  padding:9px 14px; background:var(--surface-2); border:none; cursor:pointer;
  font-size:.72rem; color:var(--text-secondary); font-weight:600;
}
.alert-legend-toggle:hover { filter:brightness(1.08); }
.alert-legend-body { padding:10px 14px; display:flex; flex-direction:column; gap:7px; }
.alert-legend-group-title { font-size:.62rem; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--text-muted); margin-bottom:2px; }
.alert-legend-row { display:flex; gap:10px; font-size:.72rem; line-height:1.5; }
.alert-legend-type { font-weight:700; color:var(--text-secondary); white-space:nowrap; min-width:130px; }
.alert-legend-desc { color:var(--text-muted); }

/* ─── HAMBURGER BUTTON ───────────────────────────────────────────────────── */

.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
  transition: background 120ms var(--ease), border-color 120ms var(--ease);
}
.menu-btn:hover { background: var(--surface-2); border-color: var(--border-mid); }

/* ─── SIDEBAR OVERLAY (mobile) ───────────────────────────────────────────── */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 90;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .metrics-grid, .cp-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* Hamburger */
  .menu-btn { display: flex; }

  /* Header: esconde itens não essenciais */
  .header-title { display: none; }
  .header-sep   { display: none; }
  #extract-all-btn { display: none !important; }
  #present-btn     { display: none !important; }
  .token-badge     { display: none; }
  .header { padding: 0 12px; gap: 10px; }

  /* Sidebar como overlay deslizante */
  .sidebar {
    display: flex !important;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    width: min(var(--sidebar-w), 85vw);
    transform: translateX(-110%);
    transition: transform 220ms var(--ease);
    box-shadow: 4px 0 32px rgba(0,0,0,.6);
  }
  .sidebar.open { transform: translateX(0); }

  /* Conteúdo principal */
  .main { padding: 20px 16px; }

  /* Grids */
  .metrics-grid, .cp-grid { grid-template-columns: repeat(2, 1fr); }
  .sales-grid  { grid-template-columns: 1fr; }
  .wc-grid     { grid-template-columns: repeat(2, 1fr); }
  .pv-grid { grid-template-columns: 1fr; }

  /* Painel operacional */
  .op-content  { padding: 18px 16px; }
  .op-summary  { padding: 10px 16px; flex-wrap: wrap; gap: 6px; }
  .op-summary-item { padding: 0 10px; }

  /* Barras de abas — scrolláveis */
  .op-tab-bar    { padding: 0 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .op-filter-bar { padding: 8px 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .op-tab-btn    { flex-shrink: 0; padding: 10px 14px; }
  .op-filter-btn { flex-shrink: 0; }

  /* Linha de alerta */
  .op-alert-row-detail { min-width: unset; max-width: 160px; }

  /* Section tabs e period tabs — scrolláveis */
  .section-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .section-tab  { flex-shrink: 0; }
  .period-tabs  { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .period-tab   { flex-shrink: 0; }

  /* Tabelas inline com scroll */
  .sales-card table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Client profile */
  .cp-header, .cp-hero, .cp-content, .cp-footer { padding-left: 20px; padding-right: 20px; }
  .cp-hero-name { font-size: 2rem; }
  .cp-content { padding-top: 28px; }
}

@media (max-width: 480px) {
  .metrics-grid, .cp-grid { grid-template-columns: 1fr; }
  .wc-grid   { grid-template-columns: 1fr; }
  .form-row  { grid-template-columns: 1fr; }
  .header    { padding: 0 10px; gap: 8px; }
  .op-alert-row { gap: 8px; padding: 10px 14px; }
  .op-alert-row-badge  { width: 52px; }
  .op-alert-row-detail { display: none; }
}

/* ─── WATERMARK ──────────────────────────────────────────────────────────── */

.app::after {
  content: '';
  position: fixed;
  bottom: -5%;
  right: -5%;
  width: 44vw;
  height: 44vw;
  background-image: url('/assets/logoDelta.jpeg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.03;
  pointer-events: none;
  z-index: 0;
  filter: grayscale(1) brightness(0.15) invert(1);
}

/* ─── SECTION TABS ───────────────────────────────────────────────────────── */

.section-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.section-tab {
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 120ms var(--ease), border-color 120ms var(--ease);
  margin-bottom: -1px;
  letter-spacing: 0.01em;
}
.section-tab:hover { color: var(--text); }
.section-tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; border-bottom-color: transparent; border-radius: 6px 6px 0 0; }

.section-pane { display: none; flex-direction: column; gap: 24px; padding-top: 24px; }
.section-pane.active { display: flex; }

/* ─── EXECUTIVE SUMMARY ──────────────────────────────────────────────────── */

.exec-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 18px 24px;
  font-size: 0.8125rem;
  line-height: 1.8;
  color: var(--text-secondary);
}
.exec-summary strong { color: var(--text); font-weight: 600; }
.exec-summary-title {
  font-size: 0.575rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ─── TRAFFIC LIGHTS ─────────────────────────────────────────────────────── */

.tl { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.tl-green  { background: var(--success); box-shadow: 0 0 5px rgba(34,197,94,.6); }
.tl-yellow { background: var(--warning); box-shadow: 0 0 5px rgba(245,158,11,.5); }
.tl-red    { background: var(--danger);  box-shadow: 0 0 5px rgba(239,68,68,.5); }
.tl-gray   { background: var(--text-dim); }

.metric-card-header { display: flex; align-items: center; gap: 7px; }
.metric-change {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* ─── INVESTMENT CARDS ───────────────────────────────────────────────────── */

/* Card de Agendamento — âmbar escuro */
.icc-appt-card {
  background: #111008;
  border: 1px solid #2e2508;
  border-left: 3px solid #d97706;
  border-radius: var(--r-lg);
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #fde68a;
}
.icc-appt-label {
  font-size: 0.575rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #92670a;
}
.icc-appt-value {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  color: #fbbf24;
}
.icc-appt-sub {
  font-size: 0.7rem;
  color: #78500e;
  margin-top: 6px;
}

/* Card de Venda — branco */
.investment-car-card {
  background: #fff;
  color: #000;
  border-radius: var(--r-lg);
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.investment-car-card .icc-label {
  font-size: 0.575rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #777;
}
.investment-car-card .icc-value {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.investment-car-card .icc-sub {
  font-size: 0.7rem;
  color: #999;
  margin-top: 6px;
}

/* ─── CHART ──────────────────────────────────────────────────────────────── */

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
}
.chart-card canvas { max-height: 240px; }

/* ─── FUNNEL ─────────────────────────────────────────────────────────────── */

.funnel-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.funnel-step { width: 100%; display: flex; flex-direction: column; align-items: center; }
.funnel-bar {
  height: 46px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  transition: width .65s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
/* Cada step tem gradiente diferente */
.funnel-bar[data-step="0"] { background: linear-gradient(90deg, #1d4ed8, #2563eb); }
.funnel-bar[data-step="1"] { background: linear-gradient(90deg, #7c3aed, #8b5cf6); }
.funnel-bar[data-step="2"] { background: linear-gradient(90deg, #0e7490, #06b6d4); }
.funnel-bar[data-step="3"] { background: linear-gradient(90deg, #b45309, #d97706); }
.funnel-bar[data-step="4"] { background: linear-gradient(90deg, #15803d, #16a34a); }
.funnel-bar[data-step="5"] { background: linear-gradient(90deg, #9f1239, #e11d48); }
.funnel-bar-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.funnel-bar-value {
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.funnel-rate { font-size: 0.6rem; color: var(--text-muted); padding: 4px 0; }
.funnel-arrow { color: var(--text-muted); font-size: 0.75rem; padding: 2px 0; }

/* ─── AD TABLE ───────────────────────────────────────────────────────────── */

.ad-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  overflow: auto;
}
.sortable th { cursor: pointer; user-select: none; }
.sortable th:hover { color: var(--text-secondary); }
.sort-icon { margin-left: 4px; opacity: .3; font-size: 0.65em; }
.sort-icon.active { opacity: 1; }

/* ─── FOLLOWERS ──────────────────────────────────────────────────────────── */

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

/* ─── APPOINTMENT CHECK BUTTON ───────────────────────────────────────────── */

.appt-check-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all .15s;
  flex-shrink: 0;
}
.appt-check-btn:hover { border-color: #4ade80; color: #4ade80; }
.appt-check-btn.checked { background: #4ade80; border-color: #4ade80; color: #000; }

/* ─── AD PREVIEW THUMBNAIL ───────────────────────────────────────────────── */

.ad-preview-thumb {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--border);
  display: block;
}
.ad-preview-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
  color: var(--text-muted);
}

/* ─── INVESTMENT PER ATTENDED CARD (purple dark) ─────────────────────────── */

.icc-attended-card {
  background: #0e0814;
  border: 1px solid #4c1d95;
  border-left: 3px solid #7c3aed;
  border-radius: var(--r-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.icc-attended-label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: #a78bfa; margin-bottom: 6px; }
.icc-attended-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.03em; color: #c4b5fd; font-variant-numeric: tabular-nums; }
.icc-attended-sub { font-size: 0.65rem; color: #7c3aed; margin-top: 4px; }

/* ── Budget / Verba ─────────────────────────────────────────────────────────── */
.budget-topbar { display:flex; align-items:center; justify-content:space-between; padding:10px 0 4px; gap:12px; }
.budget-summary-bar { display:flex; align-items:center; gap:8px; font-size:.8rem; }
.budget-sum-item { color:var(--text-muted); }
.budget-sum-item.budget-sum-red    { color:#f87171; font-weight:600; }
.budget-sum-item.budget-sum-yellow { color:#fbbf24; font-weight:600; }
.budget-sum-sep { color:var(--border-mid); }

.budget-row-red    td { background:rgba(248,113,113,.07) !important; }
.budget-row-yellow td { background:rgba(251,191,36,.07)  !important; }

.budget-balance-val { font-variant-numeric:tabular-nums; font-weight:600; }
.budget-fetched-at  { font-size:.65rem; color:var(--text-muted); }

.budget-days        { font-weight:700; font-variant-numeric:tabular-nums; }
.budget-days.red    { color:#f87171; }
.budget-days.yellow { color:#fbbf24; }
.budget-days.green  { color:#4ade80; }

.btn-icon { background:none; border:1px solid var(--border); border-radius:4px; color:var(--text-muted); cursor:pointer; padding:2px 6px; font-size:.75rem; transition:color 120ms,border-color 120ms; }
.btn-icon:hover { color:var(--text); border-color:var(--border-mid); }

.budget-card-section summary::-webkit-details-marker { display:none; }

.budget-config-panel { background:var(--bg); border:1px solid var(--border-mid); border-radius:8px; padding:16px 20px; margin-top:16px; }
.budget-config-title { font-weight:600; font-size:.85rem; margin:0 0 12px; color:var(--text); }
.budget-config-fields { display:flex; flex-wrap:wrap; gap:12px; }
.budget-config-fields label { display:flex; flex-direction:column; gap:4px; font-size:.75rem; color:var(--text-muted); min-width:140px; }
.budget-config-fields select,
.budget-config-fields input  { background:var(--bg); border:1px solid var(--border-mid); border-radius:4px; color:var(--text); font-size:.8rem; padding:4px 8px; }

.budget-type-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: .75rem;
  font-weight: 600;
  padding: 2px 6px;
  cursor: pointer;
  transition: border-color 120ms;
}
.budget-type-select:hover { border-color: var(--border-mid); }
