/* AlveoFit Incentive MIS — Executive Professional Theme v2
   Aesthetic: Refined enterprise — Bloomberg meets Notion
   Fonts: DM Sans (body) + Bricolage Grotesque (display/numbers)
   Philosophy: Data clarity over decoration. Every element earns its place.
*/
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Brand — slightly deeper indigo for professionalism */
  --brand:        #4F46E5;
  --brand-hover:  #4338CA;
  --brand-light:  #EEF2FF;
  --brand-mid:    #C7D2FE;
  --brand-text:   #3730A3;
  --brand-dim:    rgba(79,70,229,0.07);

  /* Backgrounds — subtle warm-cool split */
  --bg:           #F4F6F9;
  --bg2:          #FFFFFF;
  --bg3:          #F8F9FB;
  --surface:      #FFFFFF;
  --surface2:     #F4F6F9;

  /* Borders — hairline precision */
  --border:       #E4E7EC;
  --border2:      #CDD2DA;

  /* Text — true dark, not pure black */
  --text:         #111827;
  --text2:        #4B5563;
  --text3:        #9CA3AF;

  /* Semantic */
  --green:        #047857;
  --green-dim:    rgba(4,120,87,0.07);
  --green-bg:     #ECFDF5;
  --red:          #B91C1C;
  --red-dim:      rgba(185,28,28,0.07);
  --red-bg:       #FEF2F2;
  --blue:         #1D4ED8;
  --blue-dim:     rgba(29,78,216,0.07);
  --blue-bg:      #EFF6FF;
  --amber:        #B45309;
  --amber-dim:    rgba(180,83,9,0.07);
  --amber-bg:     #FFFBEB;
  --purple:       #6D28D9;
  --purple-dim:   rgba(109,40,217,0.07);

  /* Layout */
  --sidebar-w:    252px;
  --header-h:     56px;
  --radius:       7px;
  --radius-lg:    10px;
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.03);
  --shadow:       0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg:    0 8px 24px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-brand: 0 3px 12px rgba(79,70,229,0.22);
  --transition:   0.13s cubic-bezier(0.4,0,0.2,1);

  /* Typography */
  --font:         'DM Sans', -apple-system, system-ui, sans-serif;
  --font-display: 'Bricolage Grotesque', 'DM Sans', sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* ── AUTH ── */
#auth-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  background-image:
    radial-gradient(ellipse 80% 60% at 15% 5%, rgba(79,70,229,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 85% 95%, rgba(109,40,217,0.04) 0%, transparent 60%);
}

.auth-card {
  width: 100%; max-width: 392px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 38px 36px;
  box-shadow: var(--shadow-lg);
}

.auth-logo { text-align: center; margin-bottom: 6px; }
.auth-logo img { height: 32px; }
.auth-tagline { text-align: center; font-size: 10.5px; color: var(--text3); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 30px; font-weight: 500; }
.auth-title { font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.auth-sub { font-size: 12.5px; color: var(--text3); margin-bottom: 24px; }

.default-accounts { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text3); }
.default-accounts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; margin-top: 8px; font-size: 11px; }

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #FCFCFD;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo { padding: 15px 18px 13px; border-bottom: 1px solid var(--border); }
.sidebar-logo img { height: 24px; width: auto; display: block; }
.sidebar-logo .logo-sub { font-size: 10px; color: var(--text3); margin-top: 4px; letter-spacing: 0.02em; font-weight: 400; }
.sidebar-logo .logo-sub a { color: var(--brand); text-decoration: none; font-weight: 500; }

.sidebar-user {
  margin: 9px 10px 4px;
  padding: 9px 11px;
  background: var(--brand-light);
  border: 1px solid rgba(79,70,229,0.12);
  border-radius: var(--radius);
  display: flex; align-items: center; gap: 9px;
}

.sidebar-user-avatar {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 10.5px;
  color: #fff; flex-shrink: 0;
  letter-spacing: 0.03em;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 12px; font-weight: 600; color: var(--brand-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10px; color: var(--brand); margin-top: 1px; font-weight: 500; opacity: 0.8; }

.sidebar-logout {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: transparent;
  border: 1px solid rgba(79,70,229,0.2);
  color: var(--brand);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  transition: all var(--transition);
  flex-shrink: 0;
  opacity: 0.7;
}
.sidebar-logout:hover { background: var(--red-bg); color: var(--red); border-color: rgba(185,28,28,0.3); opacity: 1; }

.nav-section { padding: 6px 0; border-bottom: 1px solid var(--border); }
.nav-section:last-child { border-bottom: none; }
.nav-section-label { padding: 7px 18px 3px; font-size: 9.5px; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase; color: var(--text3); }

.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; margin: 1px 7px;
  border-radius: var(--radius);
  color: var(--text2);
  text-decoration: none;
  font-size: 12.5px; font-weight: 400;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.nav-item:hover { color: var(--text); background: var(--border); }
.nav-item.active { color: var(--brand); background: var(--brand-light); font-weight: 500; }
.nav-item.locked { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.nav-item.locked::after { content: '🔒'; font-size: 9px; margin-left: auto; }
.nav-icon { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.7; }
.nav-item.active .nav-icon { opacity: 1; color: var(--brand); }

/* ── MAIN ── */
#main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* ── TOPBAR ── */
#topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}

.topbar-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-badge {
  background: var(--bg3); color: var(--text3);
  border: 1px solid var(--border);
  border-radius: 5px; padding: 3px 9px;
  font-size: 11.5px; font-weight: 400;
}

.role-badge { padding: 3px 9px; border-radius: 5px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; }

/* ── PAGE CONTENT ── */
#page-content { flex: 1; padding: 22px 24px; overflow-y: auto; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.card-subtitle { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* ── KPI CARDS — executive style ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand) 0%, transparent 100%);
  opacity: 0;
  transition: opacity var(--transition);
}

.kpi-card:hover { box-shadow: var(--shadow); border-color: var(--border2); }
.kpi-card:hover::before { opacity: 1; }

.kpi-label {
  font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text3); margin-bottom: 10px;
}

/* THE KEY CHANGE: Bricolage Grotesque at a sane size */
.kpi-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.kpi-change { font-size: 11px; display: flex; align-items: center; gap: 4px; }
.kpi-change.up { color: var(--green); }
.kpi-change.down { color: var(--red); }
.kpi-change.neutral { color: var(--text3); }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead tr { background: var(--bg3); border-bottom: 1px solid var(--border); }
th { padding: 9px 13px; text-align: left; font-size: 10.5px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text3); white-space: nowrap; }
td { padding: 10px 13px; border-bottom: 1px solid var(--border); color: var(--text2); vertical-align: middle; font-size: 12.5px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg3); }
.td-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
  line-height: 1.4;
}

.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-hover); box-shadow: var(--shadow-brand); }
.btn-outline { background: transparent; color: var(--text2); border-color: var(--border2); }
.btn-outline:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-light); }
.btn-ghost { background: transparent; color: var(--text2); border-color: transparent; }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: rgba(185,28,28,0.2); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green-bg); color: var(--green); border-color: rgba(4,120,87,0.2); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-sm { padding: 4px 9px; font-size: 11.5px; }
.btn-lg { padding: 9px 20px; font-size: 13.5px; font-weight: 600; }

/* ── FORMS ── */
.form-group { margin-bottom: 14px; }
.form-row { display: grid; gap: 14px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

label { display: block; font-size: 11.5px; font-weight: 500; color: var(--text2); margin-bottom: 4px; }

input, select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 11px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.10);
}

input::placeholder { color: var(--text3); }

input[type="checkbox"], input[type="radio"] {
  width: 15px !important; height: 15px !important;
  min-width: 15px !important; padding: 0 !important; margin: 0 !important;
  border: none !important; background: transparent !important;
  box-shadow: none !important; appearance: auto !important;
  -webkit-appearance: checkbox !important;
  accent-color: var(--brand); cursor: pointer; flex-shrink: 0;
}

input[type="radio"] { -webkit-appearance: radio !important; }
select { 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='%239CA3AF' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; padding-right: 28px; }
.input-hint { font-size: 11px; color: var(--text3); margin-top: 3px; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 4px;
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.02em;
}

.badge-won, .badge-success { background: var(--green-bg); color: var(--green); }
.badge-lost, .badge-danger { background: var(--red-bg); color: var(--red); }
.badge-pipeline, .badge-info { background: var(--blue-bg); color: var(--blue); }
.badge-warning { background: var(--amber-bg); color: var(--amber); }
.badge-neutral { background: var(--bg3); color: var(--text3); border: 1px solid var(--border); }
.badge-brand { background: var(--brand-light); color: var(--brand-text); }
.badge-gold { background: #FEF9C3; color: #92400E; }
.badge-silver { background: #F1F5F9; color: #475569; }
.badge-bronze { background: #FFF7ED; color: #9A3412; }

/* Role badges */
.role-CEO      { background: #FEF9C3; color: #78350F; }
.role-DIRECTOR { background: var(--purple-dim); color: var(--purple); }
.role-VP_SALES { background: var(--blue-bg); color: var(--blue); }
.role-RSM      { background: var(--green-bg); color: var(--green); }
.role-KAM      { background: var(--amber-bg); color: var(--amber); }
.role-BDE      { background: var(--brand-light); color: var(--brand-text); }
.role-SALES    { background: var(--red-bg); color: var(--red); }
.role-PRODUCT  { background: var(--green-bg); color: var(--green); }
.role-FINANCE  { background: var(--amber-bg); color: var(--amber); }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }
.page-subtitle { font-size: 12px; color: var(--text3); margin-top: 2px; font-weight: 400; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

/* ── CHARTS ── */
.chart-wrap { position: relative; height: 220px; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(17,24,39,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 820px; max-height: 92vh;
  overflow-y: auto;
  transform: scale(0.98) translateY(4px);
  transition: transform 0.18s cubic-bezier(0.34,1.4,0.64,1);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header { padding: 16px 22px 13px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--text); }
.modal-close { width: 26px; height: 26px; border-radius: 5px; background: var(--bg3); border: 1px solid var(--border); color: var(--text3); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; transition: all var(--transition); }
.modal-close:hover { background: var(--red-bg); color: var(--red); border-color: rgba(185,28,28,0.2); }
.modal-body { padding: 18px 22px; }
.modal-footer { padding: 12px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── TOAST ── */
#toast-container { position: fixed; bottom: 18px; right: 18px; z-index: 9999; display: flex; flex-direction: column; gap: 7px; pointer-events: none; }
.toast {
  background: var(--text);
  border-radius: var(--radius);
  padding: 10px 14px; font-size: 12.5px; color: #fff;
  max-width: 300px; pointer-events: all;
  transform: translateX(110%);
  transition: transform 0.26s cubic-bezier(0.34,1.5,0.64,1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  display: flex; align-items: center; gap: 8px;
}
.toast::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: var(--text3); }
.toast.show { transform: translateX(0); }
.toast.success::before { background: #34D399; }
.toast.error::before { background: #F87171; }
.toast.info::before { background: #60A5FA; }

/* ── TABS ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab { padding: 8px 14px; font-size: 12.5px; font-weight: 400; color: var(--text3); cursor: pointer; transition: all var(--transition); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text2); }
.tab.active { color: var(--brand); font-weight: 500; border-bottom-color: var(--brand); }

/* ── MISC ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.section-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text3); margin-bottom: 10px; padding-bottom: 7px; border-bottom: 1px solid var(--border); }

.empty-state { text-align: center; padding: 48px 24px; }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 10px; opacity: 0.6; }
.empty-state .empty-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }
.empty-state .empty-body { font-size: 12.5px; color: var(--text3); }

/* ── LEADERBOARD ── */
.leaderboard-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); transition: all var(--transition); margin-bottom: 7px; }
.leaderboard-item:hover { border-color: var(--border2); box-shadow: var(--shadow); }
.lb-rank { font-family: var(--font-display); font-size: 14px; font-weight: 600; width: 24px; text-align: center; flex-shrink: 0; color: var(--text3); }
.lb-rank.gold   { color: #D97706; }
.lb-rank.silver { color: #64748B; }
.lb-rank.bronze { color: #9A3412; }
.lb-avatar { width: 32px; height: 32px; border-radius: 7px; background: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 11px; color: #fff; flex-shrink: 0; }
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--text); }
.lb-meta { font-size: 11px; color: var(--text3); margin-top: 1px; }
.lb-payout { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--brand); text-align: right; }
.lb-deals { font-size: 11px; color: var(--text3); text-align: right; }

/* ── PROGRESS ── */
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 5px; }
.progress-fill { height: 100%; background: var(--brand); border-radius: 2px; transition: width 0.5s cubic-bezier(0.4,0,0.2,1); }
.progress-fill.green { background: var(--green); }
.progress-fill.red { background: var(--red); }

/* ── DEVICE CARD ── */
.device-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; transition: all var(--transition); }
.device-card:hover { border-color: var(--border2); box-shadow: var(--shadow); }
.device-card-name { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.device-card-asp { font-size: 11.5px; color: var(--text3); margin-bottom: 12px; }
.pool-vis { display: flex; height: 5px; border-radius: 3px; overflow: hidden; gap: 1px; margin-bottom: 5px; }
.pool-vis-seg.team { background: var(--brand); }
.pool-vis-seg.dist-base { background: var(--blue); }
.pool-vis-seg.dist-act { background: var(--purple); }
.pool-vis-seg.reserve { background: var(--border2); }
.pool-legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 10.5px; color: var(--text3); }
.pool-legend-item { display: flex; align-items: center; gap: 3px; }
.pool-legend-dot { width: 7px; height: 7px; border-radius: 2px; }

/* ── CALCULATOR ── */
.calc-output { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; margin-top: 18px; }
.calc-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.calc-row:last-child { border-bottom: none; }
.calc-row .calc-label { color: var(--text2); }
.calc-row .calc-val { font-family: var(--font-mono); font-size: 12px; color: var(--text); font-weight: 500; }
.calc-row.total .calc-label { color: var(--brand); font-weight: 600; }
.calc-row.total .calc-val { color: var(--brand); font-size: 16px; font-weight: 600; font-family: var(--font-display); }

/* ── FINANCE ── */
.finance-emp-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--border); transition: background var(--transition); }
.finance-emp-row:hover { background: var(--bg3); }
.finance-emp-row:last-child { border-bottom: none; }
.payout-amount { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--green); }

/* ── ACCESS DENIED ── */
.access-denied { text-align: center; padding: 56px 24px; background: var(--red-bg); border: 1px solid rgba(185,28,28,0.15); border-radius: var(--radius-lg); margin: 20px; }
.access-denied .ad-icon { font-size: 40px; margin-bottom: 10px; }
.access-denied .ad-title { font-family: var(--font-display); font-size: 18px; color: var(--red); margin-bottom: 6px; }
.access-denied .ad-body { font-size: 12.5px; color: var(--text2); }

/* ── DEAL FORM PAGE ── */
.deal-form-page { max-width: 960px; margin: 0 auto; }
.deal-form-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 14px; }
.deal-form-section-title { font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.deal-form-section-title::before { content: ''; width: 2px; height: 14px; background: var(--brand); border-radius: 2px; }

/* ── AUDIT LOG ── */
.audit-entry { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.audit-entry:last-child { border-bottom: none; }
.audit-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.audit-dot.create { background: var(--green); }
.audit-dot.update { background: var(--brand); }
.audit-dot.delete { background: var(--red); }
.audit-dot.login  { background: var(--amber); }
.audit-meta { flex: 1; }
.audit-action { font-size: 12.5px; color: var(--text); font-weight: 500; }
.audit-detail { font-size: 11px; color: var(--text3); margin-top: 2px; }
.audit-time { font-size: 11px; color: var(--text3); white-space: nowrap; font-family: var(--font-mono); }

/* ── INTEGRATION CARD ── */
.integration-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; display: flex; align-items: flex-start; gap: 12px; }
.integration-icon { width: 38px; height: 38px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.integration-name { font-family: var(--font-display); font-weight: 600; font-size: 13.5px; margin-bottom: 2px; color: var(--text); }
.integration-desc { font-size: 11.5px; color: var(--text3); }

/* ── LOADING ── */
.spinner { width: 16px; height: 16px; border: 1.5px solid var(--border2); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.65s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-loading { display: flex; align-items: center; justify-content: center; min-height: 200px; gap: 10px; color: var(--text3); font-size: 12.5px; }

input[type="range"] { -webkit-appearance: none; padding: 0; height: 3px; background: var(--bg3); border: 1px solid var(--border); border-radius: 2px; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--brand); cursor: pointer; border: 2px solid #fff; box-shadow: var(--shadow-sm); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.18s ease forwards; }

@media (max-width: 900px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.12); }
  #main { margin-left: 0; }
  .form-row.cols-3, .form-row.cols-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .form-row.cols-2,.form-row.cols-3,.form-row.cols-4 { grid-template-columns: 1fr; }
  .grid-2,.grid-3 { grid-template-columns: 1fr; }
  #page-content { padding: 14px; }
}

@media print {
  #sidebar, #topbar, .btn, button, .tabs { display: none !important; }
  #main { margin-left: 0 !important; }
  body { background: white !important; }
  .card { border: 1px solid #ddd; break-inside: avoid; }
}
