/* ═══════════════════════════════════════════════════════════════
   DESIGN SYSTEM — Scrap3
   ═══════════════════════════════════════════════════════════════ */

:root {
  --teal:      #1D9E75;
  --teal-dk:   #0F6E56;
  --teal-lt:   #E1F5EE;
  --teal-md:   #B2DFD0;
  --slate:     #2C3E50;
  --slate-lt:  #3D5166;
  --grey-lt:   #F7F9FA;
  --grey-md:   #EEF1F3;
  --grey-bd:   #D0D7DE;
  --grey-text: #6B7480;
  --amber:     #FAEEDA;
  --amber-d:   #854F0B;
  --amber-bd:  #F5A623;
  --red:       #C0392B;
  --red-lt:    #FDEDEC;
  --red-bd:    #E74C3C;
  --green:     #1E8449;
  --green-lt:  #EAFAF1;
  --blue:      #2471A3;
  --blue-lt:   #EBF5FB;
  --blue-bd:   #3498DB;
  --white:     #FFFFFF;
  --text-1:    #1A202C;
  --text-2:    #4A5568;
  --text-3:    #718096;

  --font: 'Inter', system-ui, -apple-system, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.12), 0 8px 16px rgba(0,0,0,0.06);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);

  --header-h: 60px;
  --transition: 0.15s ease;
}

/* ─── RESET & BASE ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-1);
  background: #F0F4F8;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── LOCK SCREEN ──────────────────────────────────────────────── */
.lock-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, var(--slate) 0%, #1a2a3a 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}

.lock-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.lock-logo {
  width: 80px; height: 80px;
  background: var(--teal);
  border-radius: var(--radius-lg);
  color: var(--white);
  font-size: 24px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
  letter-spacing: -1px;
  overflow: hidden;
}

.lock-title {
  font-size: 22px; font-weight: 700;
  color: var(--slate); line-height: 1.3;
  margin-bottom: 24px;
}

.lock-subtitle {
  font-size: 13px; color: var(--text-3);
  margin-bottom: 20px;
}

.btn-lock {
  width: 100%;
  padding: 12px;
  background: var(--teal);
  color: var(--white);
  border: none; border-radius: var(--radius-md);
  font-size: 15px; font-weight: 600;
  cursor: pointer; margin-top: 8px;
  transition: background var(--transition);
}
.btn-lock:hover { background: var(--teal-dk); }

.btn-lock-secondary {
  width: 100%; padding: 10px;
  background: none; border: 1px solid var(--grey-bd);
  border-radius: var(--radius-md);
  color: var(--text-3); font-size: 12px;
  cursor: pointer; margin-top: 8px;
  transition: all var(--transition);
}
.btn-lock-secondary:hover { border-color: var(--red-bd); color: var(--red); }

.btn-lock-danger {
  background: var(--red);
}
.btn-lock-danger:hover { background: #b91c1c; }
.btn-lock-danger:disabled {
  background: var(--grey-bd); color: var(--text-3);
  cursor: not-allowed; opacity: 0.7;
}

/* ── Password field with show/hide eye ─────────────────────────── */
.lock-pw-wrap {
  position: relative; display: flex; align-items: center;
}
.lock-pw-wrap input {
  flex: 1; padding-right: 38px !important;
}
.lock-pw-eye {
  position: absolute; right: 8px;
  background: none; border: none;
  cursor: pointer; font-size: 16px; line-height: 1;
  color: var(--text-3); padding: 4px;
  transition: color var(--transition);
  user-select: none;
}
.lock-pw-eye:hover { color: var(--teal); }

/* ── Hint display ──────────────────────────────────────────────── */
.lock-hint {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px; color: #92400e;
  margin-bottom: 12px;
  text-align: left;
  line-height: 1.4;
}

@keyframes lock-spin { to { transform: rotate(360deg); } }

.lock-forgot {
  text-align: center; margin-top: 12px; font-size: 12px;
}
.lock-forgot a { color: var(--text-3); text-decoration: underline; }
.lock-forgot a:hover { color: var(--primary); }

.lock-subtitle-warn { color: #d97706; font-weight: 600; font-size: 14px; }

.lock-reset-warning {
  font-size: 12px; color: var(--text-3);
  background: #fff7ed; border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 16px;
  line-height: 1.5;
}

.lock-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--red-lt);
  border-left: 3px solid var(--red-bd);
  border-radius: var(--radius-sm);
  color: var(--red); font-size: 13px;
  text-align: left;
}

/* ─── APP SHELL ────────────────────────────────────────────────── */
#app {
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* ─── HEADER ───────────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 1px 0 rgba(0,0,0,0.05), 0 2px 8px rgba(0,0,0,0.04);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky; top: 0; z-index: 100;
}

.header-brand {
  display: flex; align-items: center; gap: 10px;
  min-width: 180px;
}

.brand-mark {
  width: 36px; height: 36px;
  background: var(--teal); color: var(--white);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; letter-spacing: -0.5px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 14px; font-weight: 700; color: var(--slate); }
.brand-sub  { font-size: 10px; color: var(--text-3); }

.tab-nav {
  display: flex; gap: 2px; flex: 1;
  justify-content: center;
}

.tab-btn {
  padding: 8px 14px;
  border: none; border-radius: var(--radius-md);
  background: none; color: var(--text-2);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab-btn:hover { background: var(--grey-md); color: var(--teal); }
.tab-btn.active {
  background: var(--slate); color: #fff;
  font-weight: 600;
}

.header-actions {
  display: flex; align-items: center; gap: 8px;
  min-width: 180px; justify-content: flex-end;
}

.btn-header {
  padding: 7px 12px;
  border: 1px solid var(--grey-bd);
  border-radius: var(--radius-sm);
  background: var(--white); color: var(--text-2);
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.btn-header:hover { border-color: var(--teal); color: var(--teal); }
.btn-header-lock { border-color: var(--grey-bd); }
.btn-header-lock:hover { border-color: var(--red-bd); color: var(--red); background: var(--red-lt); }
.btn-icon-lock {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--grey-bd); border-radius: var(--radius-sm);
  background: var(--white); color: var(--text-2);
  font-size: 15px; cursor: pointer;
  transition: all var(--transition); flex-shrink: 0;
}
.btn-icon-lock:hover { border-color: var(--red-bd); color: var(--red); background: var(--red-lt); }

/* ─── MAIN CONTENT ─────────────────────────────────────────────── */
#main-content { flex: 1; padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }

.tab-panel { animation: fadeIn 0.15s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ─── MODULE HEADER ────────────────────────────────────────────── */
.module-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}

.module-header h2 {
  font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--slate);
}

.module-date { font-size: 12px; color: var(--text-3); }

.module-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.record-count { font-size: 12px; color: var(--text-3); margin-bottom: 12px; }

/* ─── BUTTONS ──────────────────────────────────────────────────── */
.btn-primary {
  padding: 9px 18px;
  background: var(--teal); color: var(--white);
  border: none; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(29,158,117,0.3);
}
.btn-primary:hover { background: var(--teal-dk); box-shadow: 0 4px 12px rgba(29,158,117,0.4); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  padding: 9px 18px;
  background: var(--white); color: var(--text-2);
  border: 1px solid var(--grey-bd);
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary:hover { border-color: var(--teal); color: var(--teal); }

.btn-danger {
  padding: 9px 18px;
  background: var(--red); color: var(--white);
  border: none; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background var(--transition);
}
.btn-danger:hover { background: #a93226; }

.btn-link {
  background: none; border: none;
  color: var(--teal); font-size: 12px; font-weight: 500;
  cursor: pointer; text-decoration: underline;
}
.btn-link:hover { color: var(--teal-dk); }

.btn-icon {
  width: 30px; height: 30px;
  border: 1px solid var(--grey-bd);
  border-radius: var(--radius-sm);
  background: var(--white); color: var(--text-2);
  font-size: 13px; cursor: pointer;
  transition: all var(--transition);
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-lt); }
.btn-icon-danger:hover { border-color: var(--red-bd); color: var(--red); background: var(--red-lt); }

/* ─── SEARCH & FILTER ──────────────────────────────────────────── */
.search-input {
  padding: 8px 12px;
  border: 1px solid var(--grey-bd);
  border-radius: var(--radius-md);
  font-size: 13px; color: var(--text-1);
  background: var(--white); width: 220px;
  transition: border-color var(--transition);
}
.search-input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(29,158,117,0.1); }

.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--grey-bd);
  border-radius: var(--radius-md);
  font-size: 13px; color: var(--text-1);
  background: var(--white); cursor: pointer;
  transition: border-color var(--transition);
}
.filter-select:focus { outline: none; border-color: var(--teal); }

.filter-tabs {
  display: flex; gap: 2px;
  background: var(--grey-md);
  border-radius: var(--radius-md);
  padding: 3px;
}

.filter-tab {
  padding: 6px 14px;
  border: none; border-radius: var(--radius-sm);
  background: none; color: var(--text-2);
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.filter-tab.active { background: var(--white); color: var(--teal); font-weight: 600; box-shadow: var(--shadow-sm); }

/* ─── TABLES ───────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--grey-bd);
}

.data-table {
  width: 100%; border-collapse: collapse;
  background: var(--white); font-size: 13px;
}

.data-table thead tr {
  background: #1A2635;
  color: var(--white);
}

.data-table thead th {
  padding: 12px 14px;
  text-align: left; font-weight: 600;
  font-size: 11px; letter-spacing: 0.04em;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--grey-md);
  transition: background var(--transition);
}
.data-table tbody tr:hover { background: var(--grey-lt); }
.data-table tbody tr:last-child { border-bottom: none; }

.data-table td {
  padding: 11px 14px; vertical-align: middle;
}

.action-cell { white-space: nowrap; }
.action-cell .btn-icon + .btn-icon { margin-left: 4px; }

.row-done { opacity: 0.55; }
.row-overdue { background: #fff8f8 !important; }

/* ─── BADGES ───────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 9px;
  border-radius: 20px; font-size: 11px; font-weight: 600;
  white-space: nowrap; letter-spacing: 0.02em;
}
.badge-green  { background: var(--green-lt); color: var(--green); }
.badge-red    { background: var(--red-lt);   color: var(--red); }
.badge-amber  { background: var(--amber);    color: var(--amber-d); }
.badge-blue   { background: var(--blue-lt);  color: var(--blue); }
.badge-grey   { background: var(--grey-md);  color: var(--text-2); }
.badge-teal   { background: var(--teal-lt);  color: var(--teal-dk); }

/* ─── STAGE COUNTERS (Prospects) ───────────────────────────────── */
.stage-counters {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 16px;
}

.stage-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: var(--white);
  border: 1px solid var(--grey-bd);
  border-radius: 20px; font-size: 11px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
  white-space: nowrap;
}
.stage-pill:hover { border-color: var(--teal); color: var(--teal); }
.stage-pill-active { background: var(--teal-lt); border-color: var(--teal); color: var(--teal-dk); font-weight: 600; }

.stage-count {
  background: var(--grey-md); color: var(--text-2);
  border-radius: 10px; padding: 1px 6px;
  font-size: 10px; font-weight: 700;
}
.stage-pill-active .stage-count { background: var(--teal); color: var(--white); }

/* ─── DASHBOARD ────────────────────────────────────────────────── */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 24px;
}
.kpi-grid-8 { grid-template-columns: repeat(4, 1fr); }

.kpi-card {
  background: var(--white);
  border: none;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-card);
  border-top: 3px solid var(--teal);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), #34D399);
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi-card.kpi-warn::before  { background: linear-gradient(90deg, var(--red-bd), #F87171); }
.kpi-card.kpi-amber::before { background: linear-gradient(90deg, var(--amber-bd), #FCD34D); }

.kpi-label  { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.kpi-value  { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; color: var(--slate); line-height: 1; margin-bottom: 4px; }
.kpi-denom  { font-size: 14px; font-weight: 400; color: var(--text-3); }
.kpi-teal     { color: var(--teal); }
.kpi-warn-val { color: var(--red-bd); }
.kpi-sub    { font-size: 11px; color: var(--text-3); }

.kpi-bar-track { height: 4px; background: var(--grey-md); border-radius: 2px; margin: 6px 0 2px; overflow: hidden; }
.kpi-bar-fill  { height: 4px; border-radius: 2px; transition: width .4s ease; }

.dashboard-panels {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.panel {
  background: var(--white);
  border: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.panel-header {
  padding: 16px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--grey-md);
  display: flex; align-items: center; justify-content: space-between;
}

.panel-header h3 { font-size: 13px; font-weight: 700; color: var(--slate); letter-spacing: -0.01em; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mini-table thead tr { background: var(--grey-lt); border-bottom: 1px solid var(--grey-md); }
.mini-table thead th { padding: 8px 12px; text-align: left; font-weight: 600; font-size: 11px; color: var(--text-3); }
.mini-table tbody tr { border-bottom: 1px solid var(--grey-md); }
.mini-table tbody tr:last-child { border-bottom: none; }
.mini-table td { padding: 9px 12px; vertical-align: middle; }

.client-cards { padding: 8px; display: flex; flex-direction: column; gap: 4px; }

.client-mini-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.client-mini-card:hover { background: var(--grey-lt); }

.client-avatar {
  width: 32px; height: 32px;
  background: var(--teal-lt); color: var(--teal-dk);
  border-radius: 50%; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.client-mini-name { font-size: 13px; font-weight: 600; color: var(--text-1); }

.empty-state { padding: 20px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ─── EMPTY MODULE ─────────────────────────────────────────────── */
.empty-module {
  text-align: center; padding: 60px 20px;
  color: var(--text-3);
}
.empty-module p { font-size: 14px; }

/* ─── FORMS ────────────────────────────────────────────────────── */
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; margin-bottom: 16px;
}
.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 5px; }

.form-group label {
  font-size: 12px; font-weight: 600;
  color: var(--text-2); letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 11px;
  border: 1px solid var(--grey-bd);
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-1);
  font-family: var(--font);
  background: var(--white);
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(29,158,117,0.1);
}

.form-group input.invalid,
.form-group select.invalid {
  border-color: var(--red-bd);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.1);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.checkbox-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 6px; padding: 10px;
  background: var(--grey-lt);
  border: 1px solid var(--grey-bd);
  border-radius: var(--radius-sm);
  max-height: 160px; overflow-y: auto;
}

.checkbox-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-1);
  cursor: pointer; padding: 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.checkbox-label:hover { background: var(--teal-lt); }
.checkbox-label input[type="checkbox"] { accent-color: var(--teal); cursor: pointer; }

/* ─── MODAL ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 10000; padding: 40px 20px;
  overflow-y: auto;
  backdrop-filter: blur(2px);
}

.modal-box {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 680px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-header {
  padding: 18px 24px;
  background: linear-gradient(135deg, var(--slate) 0%, #1a2a3a 100%);
  display: flex; align-items: center; justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 700; color: var(--white); }

.modal-close {
  width: 30px; height: 30px;
  border: none; background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  color: var(--white); font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.3); }

.modal-body { padding: 24px; max-height: 70vh; overflow-y: auto; }

.modal-footer {
  padding: 14px 24px;
  background: var(--grey-lt);
  border-top: 1px solid var(--grey-md);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ─── CONFIRM DIALOG ───────────────────────────────────────────── */
.confirm-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 28px 20px;
  max-width: 400px; width: 100%;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.15s ease;
}

.confirm-message {
  font-size: 14px; color: var(--text-1);
  margin-bottom: 20px; line-height: 1.5;
}

.confirm-actions {
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ─── TOAST ────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9000; display: flex; flex-direction: column; gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0; transform: translateX(20px);
  transition: all 0.25s ease;
  max-width: 320px;
  border-left: 4px solid;
}

.toast-show { opacity: 1; transform: none; }

.toast-success { background: var(--green-lt); border-color: var(--green); color: var(--green); }
.toast-error   { background: var(--red-lt);   border-color: var(--red);   color: var(--red); }
.toast-info    { background: var(--blue-lt);   border-color: var(--blue);  color: var(--blue); }
.toast-warning { background: var(--amber);     border-color: var(--amber-d); color: var(--amber-d); }

/* ─── TEXT UTILITIES ───────────────────────────────────────────── */
.text-muted       { color: var(--text-3); }
.text-sm          { font-size: 11px; }
.text-red         { color: var(--red); }
.text-green       { color: var(--green); }
.text-amber       { color: var(--amber-d); }
.text-teal        { color: var(--teal); }
.text-strikethrough { text-decoration: line-through; }
.font-bold        { font-weight: 700; }

/* ─── SCROLLBAR ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--grey-lt); }
::-webkit-scrollbar-thumb { background: var(--grey-bd); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--teal-md); }

/* ─── UTILITY ──────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── RESPONSIVE ───────────────────────────────────────────────── */
@media (max-width: 1300px) {
  .kpi-grid-8 { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1100px) {
  .kpi-grid, .kpi-grid-8 { grid-template-columns: repeat(4, 1fr); }
  .dashboard-panels { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .kpi-grid, .kpi-grid-8 { grid-template-columns: repeat(2, 1fr); }
  .tab-nav { overflow-x: auto; }
  .tab-btn { font-size: 12px; padding: 7px 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-full { grid-column: 1; }
  #main-content { padding: 16px; }
}
@media (max-width: 600px) {
  .kpi-grid, .kpi-grid-8 { grid-template-columns: 1fr 1fr; }
  .app-header { flex-wrap: wrap; height: auto; padding: 10px 14px; }
  .header-brand { min-width: unset; }
  .brand-sub { display: none; }
  .header-actions .btn-header { font-size: 11px; padding: 6px 8px; }
  .checkbox-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Life Planning tab integration ─────────────────────────────── */
.tab-btn-lep {
  background: linear-gradient(135deg, #b7861f 0%, #d4a017 100%);
  color: #fff;
  border-left: 3px solid #8a6010;
}
.tab-btn-lep.active,
.tab-btn-lep:hover {
  background: linear-gradient(135deg, #d4a017 0%, #f0bc28 100%);
}

#tab-lifeplanning {
  padding: 0;
  height: calc(100vh - var(--header-h) - var(--tab-nav-h, 48px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#lep-root {
  flex: 1;
  overflow-y: auto;
}

.lep-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 240px;
  gap: 16px;
  color: var(--text-muted);
}

.lep-loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: lep-spin 0.8s linear infinite;
}

@keyframes lep-spin {
  to { transform: rotate(360deg); }
}

.lep-loading-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.btn-icon-lep {
  background: transparent;
  color: #d4a017;
  border-color: #d4a017;
}
.btn-icon-lep:hover {
  background: #d4a01722;
}

/* ── FNA tab integration ────────────────────────────────────────── */
.tab-btn-fna {
  background: linear-gradient(135deg, #1a3a5c 0%, #1e4976 100%);
  color: #60A5FA;
  border-left: 3px solid #1a3a5c;
}
.tab-btn-fna.active,
.tab-btn-fna:hover {
  background: linear-gradient(135deg, #1e4976 0%, #2563eb 100%);
  color: #fff;
}

#tab-fna {
  padding: 0;
  height: calc(100vh - var(--header-h) - var(--tab-nav-h, 48px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#fna-root {
  flex: 1;
  overflow-y: auto;
}

#fna-tool-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#fna-wellness-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px 24px;
}

/* ── FNA scoped dark-theme overrides ────────────────────────────── */
#tab-fna .fna-root { min-height: unset; }

.fna-root {
  background: #0A0E1A;
  color: #E8E4D9;
  font-family: 'Inter', sans-serif;
  min-height: 100%;
  padding: 20px;
  box-sizing: border-box;
}

.fna-root .section-card {
  background: #111827;
  border: 1px solid #1E2740;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
}

.fna-root .section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.fna-root .fade-in {
  animation: fna-fade-in 0.3s ease;
}

@keyframes fna-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Tab nav inside FNA */
.fna-root .fna-tab-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  border-bottom: 1px solid #1E2740;
  padding-bottom: 10px;
}

.fna-root .tab-btn {
  padding: 8px 14px;
  border-radius: 8px 8px 0 0;
  border: 1px solid #1E2740;
  background: #0A0E1A;
  color: #6B7280;
  font-size: 12px;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  transition: all 0.15s;
}

.fna-root .tab-btn.active,
.fna-root .tab-btn:hover {
  background: #1E2740;
  color: #E8E4D9;
  border-color: #374151;
}

/* Buttons inside FNA */
.fna-root .btn-primary {
  background: #2563EB;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.fna-root .btn-primary:hover { background: #1D4ED8; }

.fna-root .btn-ghost {
  background: transparent;
  color: #6B7280;
  border: 1px solid #1E2740;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.fna-root .btn-ghost:hover { background: #1E2740; color: #E8E4D9; }

.fna-root .btn-danger {
  background: #DC2626;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.fna-root .btn-danger:hover { background: #B91C1C; }

/* Form elements inside FNA */
.fna-root label {
  display: block;
  font-size: 11px;
  color: #9CA3AF;
  margin-bottom: 5px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fna-root input,
.fna-root select,
.fna-root textarea {
  width: 100%;
  background: #0A0E1A;
  border: 1px solid #1E2740;
  border-radius: 8px;
  color: #E8E4D9;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}

.fna-root input:focus,
.fna-root select:focus,
.fna-root textarea:focus {
  border-color: #2563EB;
}

.fna-root input[type="checkbox"],
.fna-root input[type="radio"] {
  width: auto;
  padding: 0;
}

.fna-root select option {
  background: #111827;
  color: #E8E4D9;
}

.fna-root textarea {
  resize: vertical;
  min-height: 80px;
}

/* Tables inside FNA */
.fna-root table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.fna-root th {
  background: #0A0E1A;
  color: #6B7280;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 10px;
  border-bottom: 1px solid #1E2740;
  text-align: left;
}

.fna-root td {
  padding: 10px;
  border-bottom: 1px solid #0A0E18;
  color: #E8E4D9;
  vertical-align: middle;
}

.fna-root tr:hover td {
  background: #111827;
}

/* Grid helpers inside FNA */
.fna-root .grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.fna-root .header-accent {
  color: #F59E0B;
}

/* Recharts inside FNA */
.fna-root .recharts-text,
.fna-root .recharts-cartesian-axis-tick-value {
  fill: #6B7280;
  font-size: 11px;
}

.fna-root .recharts-tooltip-wrapper .recharts-default-tooltip {
  background: #111827 !important;
  border-color: #1E2740 !important;
  color: #E8E4D9 !important;
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE — applied via body.dark
   ═══════════════════════════════════════════════════════════════ */
body.dark {
  --grey-lt:   #060B17;
  --grey-md:   #0A1020;
  --white:     #0D1525;
  --grey-bd:   #1E2740;
  --text-1:    #F1F5F9;
  --text-2:    #9CA3AF;
  --text-3:    #6B7280;
  --teal-lt:   #0D2B1D;
  --teal-md:   #164A35;
  --amber:     #1C1200;
  --amber-d:   #F59E0B;
  --red-lt:    #1A0505;
  --blue-lt:   #0A1525;
  --green-lt:  #0A1F12;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.6);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.7);
}

body.dark .data-table thead tr  { background: #1E2740; }
body.dark .data-table tbody tr:hover { background: #0A1020; }
body.dark .modal-header          { background: #1E2740; }
body.dark .panel-header          { background: var(--grey-md); border-color: var(--grey-bd); }
body.dark .filter-tab.active     { background: var(--grey-md); }
body.dark .row-overdue           { background: #1A0808 !important; }
body.dark ::-webkit-scrollbar-track { background: #0A1020; }
body.dark .lock-card             { background: #0D1525; }
body.dark .lock-title            { color: #F1F5F9; }
body.dark .confirm-card,
body.dark .modal                 { background: #0D1525; }
body.dark .modal-footer          { background: var(--grey-md); }

/* ─── SETTINGS MODULE ──────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

.settings-nav {
  background: var(--white);
  border: 1px solid var(--grey-bd);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 80px;
}

.settings-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 1px solid var(--grey-bd);
  transition: all var(--transition);
  border: none; background: none; width: 100%; text-align: left;
}
.settings-nav-item:last-child { border-bottom: none; }
.settings-nav-item:hover { background: var(--grey-lt); color: var(--teal); }
.settings-nav-item.active { background: var(--teal-lt); color: var(--teal-dk); font-weight: 600; }
.settings-nav-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }

.settings-panel {
  background: var(--white);
  border: 1px solid var(--grey-bd);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.settings-section {
  padding: 24px;
  border-bottom: 1px solid var(--grey-md);
}
.settings-section:last-child { border-bottom: none; }

.settings-section-title {
  font-size: 11px; font-weight: 700;
  color: var(--text-3); letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 16px;
}

.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--grey-md);
  gap: 16px;
}
.settings-row:last-child { border-bottom: none; }

.settings-row-info { flex: 1; min-width: 0; }
.settings-row-label { font-size: 14px; font-weight: 600; color: var(--text-1); }
.settings-row-desc  { font-size: 12px; color: var(--text-3); margin-top: 2px; line-height: 1.4; }

/* ─── TOGGLE SWITCH ────────────────────────────────────────────── */
.toggle-wrap {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.toggle-track {
  position: relative; width: 44px; height: 24px;
  background: var(--grey-bd); border-radius: 12px;
  cursor: pointer; transition: background var(--transition);
  flex-shrink: 0;
}
.toggle-track.on { background: var(--teal); }
.toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: var(--white); border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-track.on .toggle-thumb { transform: translateX(20px); }
.toggle-label { font-size: 12px; font-weight: 600; color: var(--text-2); min-width: 28px; }

/* ─── THEME CARDS ──────────────────────────────────────────────── */
.theme-cards {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.theme-card {
  width: 120px; border-radius: var(--radius-md);
  border: 2px solid var(--grey-bd);
  cursor: pointer; overflow: hidden;
  transition: all var(--transition);
}
.theme-card:hover  { border-color: var(--teal); transform: translateY(-2px); }
.theme-card.active { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(29,158,117,0.2); }
.theme-card-preview {
  height: 64px; display: flex; flex-direction: column;
  gap: 4px; padding: 8px;
}
.theme-card-bar  { height: 6px; border-radius: 3px; }
.theme-card-name {
  padding: 6px 10px;
  font-size: 11px; font-weight: 600;
  text-align: center;
  background: var(--grey-lt);
  color: var(--text-2);
  border-top: 1px solid var(--grey-bd);
}

/* ── Source dots ──────────────────────────────────────────── */
.src-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  flex-shrink: 0;
}
.src-crm   { background: var(--teal); }
.src-agent { background: #8B5CF6; }

/* ── Promote button ───────────────────────────────────────── */
.btn-icon-promote {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff !important;
  border-color: #059669;
  font-weight: 700;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
}
.btn-icon-promote:hover {
  background: linear-gradient(135deg, #059669, #047857);
}

/* ── App shell layout ─────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* ── Sidebar ──────────────────────────────────────────────────── */
#sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #080E1C;
  border-right: 1px solid #1E2740;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid #1E2740;
  flex-shrink: 0;
}

.sidebar-brand-text {}
.sidebar-name { font-size: 13px; font-weight: 700; color: var(--slate); letter-spacing: -0.01em; }
.sidebar-sub  { font-size: 10px; color: #6B7280; margin-top: 1px; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: none;
  color: #9CA3AF;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}

.sidebar-item:hover {
  background: #0D1526;
  color: #E2E8F0;
}

.sidebar-item.active {
  background: #1E2740;
  color: #F1F5F9;
  font-weight: 600;
}

.snav-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.7;
}
.sidebar-item.active .snav-icon { opacity: 1; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid #1E2740;
  flex-shrink: 0;
}

.sidebar-user { margin-bottom: 6px; }

/* ── Content area ─────────────────────────────────────────────── */
#content-area {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-section {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.app-section.hidden { display: none !important; }

/* ── CRM top nav bar ──────────────────────────────────────────── */
.crm-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--grey-bd);
  padding: 0 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.crm-topbar .tab-nav { border: none; background: none; padding: 0; }

#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ── Section header (Documents, Products, CPD) ────────────────── */
.section-header {
  padding: 28px 32px 8px;
  border-bottom: 1px solid #1E2740;
  flex-shrink: 0;
}
.section-title {
  font-size: 20px;
  font-weight: 700;
  color: #F1F5F9;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.section-sub {
  font-size: 12px;
  color: #6B7280;
  margin: 0;
}

/* ── Section placeholder ──────────────────────────────────────── */
.section-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #6B7280;
  font-size: 13px;
  text-align: center;
  padding: 40px;
}
.section-placeholder svg { opacity: 0.4; }
.section-placeholder p { margin: 0; max-width: 380px; }

/* ── Document grid ────────────────────────────────────────────── */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  padding: 24px 32px;
}

.doc-card {
  background: #0D1321;
  border: 1px solid #1E2740;
  border-radius: 10px;
  padding: 16px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .15s;
}
.doc-card:hover { border-color: #374151; }

.doc-icon { color: #60A5FA; }

.doc-name {
  font-size: 11px;
  font-weight: 600;
  color: #E2E8F0;
  line-height: 1.4;
  flex: 1;
  letter-spacing: 0.01em;
}

.doc-actions {
  display: flex;
  gap: 6px;
}

.doc-btn {
  flex: 1;
  text-align: center;
  padding: 5px 0;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: opacity .15s;
}
.doc-btn:hover { opacity: 0.8; }
.doc-btn-view { background: #1E3A5F; color: #60A5FA; border: 1px solid #1E4070; }
.doc-btn-dl   { background: #1E2740; color: #9CA3AF; border: 1px solid #2D3748; }

/* ── Home / Landing page ──────────────────────────────────────── */
.home-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 40px 24px;
  background: #FFFFFF;
  min-height: 0;
}

.home-brand-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.home-logo {
  animation: logo-pulse 4s ease-in-out infinite;
}

@keyframes logo-pulse {
  0%, 100% { transform: scale(1);   opacity: 1;    }
  50%       { transform: scale(1.04); opacity: 0.9; }
}

.home-tagline-wrap {
  position: relative;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-tagline {
  position: absolute;
  font-size: 22px;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color: #0F172A;
  white-space: nowrap;
  letter-spacing: -0.02em;
  text-align: center;
}

.home-tl-1 {
  animation: tl-show-hide 8s ease-in-out infinite;
}
.home-tl-2 {
  animation: tl-show-hide 8s ease-in-out infinite 4s;
  animation-fill-mode: backwards;
}

@keyframes tl-show-hide {
  0%           { opacity: 0; transform: translateY(8px);  }
  8%, 42%      { opacity: 1; transform: translateY(0);    }
  50%, 100%    { opacity: 0; transform: translateY(-8px); }
}

.tl-excellence {
  color: #FFFFFF;
  background: #0F172A;
  padding: 2px 8px 3px;
  border-radius: 4px;
  font-weight: 800;
}

.tl-standard {
  color: #D4A017;
  font-weight: 800;
}

/* ── Adviser profile card ─────────────────────────────────────── */
.home-profile-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 20px 28px;
  min-width: 340px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.home-profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5B21B6, #3B82F6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

.home-profile-info { flex: 1; min-width: 0; }

.home-profile-name {
  font-size: 16px;
  font-weight: 700;
  color: #0F172A;
  letter-spacing: -0.01em;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  margin-bottom: 2px;
}

.home-profile-role {
  font-size: 11px;
  color: #A78BFA;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}

.home-profile-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.home-profile-field {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: #9CA3AF;
}
.home-profile-field-label {
  font-weight: 600;
  color: #9CA3AF;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  width: 52px;
  flex-shrink: 0;
  padding-top: 1px;
}
.home-profile-field-val { color: #374151; font-size: 12px; }

/* ── Agent cards ──────────────────────────────────────────────── */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 24px 32px;
}

.agent-card {
  background: #0D1321;
  border: 1px solid #1E2740;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 14px;
  transition: border-color .15s;
}
.agent-card:hover { border-color: #374151; }

.agent-num {
  font-size: 11px;
  font-weight: 800;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  letter-spacing: 0.06em;
  border: 1px solid;
  border-radius: 8px;
  padding: 4px 8px;
  height: fit-content;
  flex-shrink: 0;
  white-space: nowrap;
}

.agent-body { flex: 1; min-width: 0; }

.agent-name {
  font-size: 13px;
  font-weight: 700;
  color: #F1F5F9;
  letter-spacing: -0.01em;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  margin-bottom: 3px;
}

.agent-mandate {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-bottom: 7px;
}

.agent-desc {
  font-size: 11px;
  color: #9CA3AF;
  line-height: 1.55;
}

/* ── Documents — secure external drive ───────────────────────── */
.docs-secure-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px 32px;
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}

.docs-secure-icon { margin-bottom: 4px; }

.docs-secure-text h3 {
  font-size: 16px;
  font-weight: 700;
  color: #F1F5F9;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.docs-secure-text p {
  font-size: 13px;
  color: #6B7280;
  margin: 0;
  line-height: 1.55;
}

.docs-drive-link-wrap {
  width: 100%;
  background: #0D1321;
  border: 1px solid #1E2740;
  border-radius: 12px;
  padding: 16px 18px;
  text-align: left;
}

.docs-drive-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #6B7280;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   CLIENT PROFILES — cp-* components
   ═══════════════════════════════════════════════════════════════ */

/* List view shell */
.cp-list-wrap        { display:flex; flex-direction:column; height:100%; overflow:hidden; }
.cp-list-toolbar     { display:flex; align-items:center; gap:12px; padding:20px 24px 14px; flex-wrap:wrap; border-bottom:1px solid var(--grey-bd); background:var(--white); flex-shrink:0; }
.cp-list-title       { font-size:20px; font-weight:700; color:var(--text-1); flex:1 1 120px; }

/* Stage filter pills */
.cp-stage-pills      { display:flex; gap:6px; padding:10px 24px; flex-wrap:wrap; background:var(--grey-lt); border-bottom:1px solid var(--grey-bd); flex-shrink:0; }
.cp-stage-pill       { font-size:11px; font-weight:500; padding:4px 11px; border-radius:20px; border:1px solid var(--grey-bd); color:var(--text-3); background:var(--white); cursor:pointer; transition:all var(--transition); }
.cp-stage-pill:hover { border-color:var(--teal); color:var(--teal); }
.cp-stage-pill.active { background:var(--teal-lt); border-color:var(--teal); color:var(--teal-dk); font-weight:600; }

/* Table scroll area */
.cp-table-wrap       { flex:1; overflow-y:auto; padding:16px 24px 32px; }

/* Empty state */
.cp-empty            { text-align:center; padding:64px 24px; color:var(--text-3); font-size:14px; }
.cp-empty strong     { display:block; font-size:15px; color:var(--text-2); margin-bottom:6px; font-weight:600; }

/* Avatar circle */
.cp-avatar    { width:36px; height:36px; border-radius:50%; background:var(--teal); color:var(--white); font-size:12px; font-weight:700; display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; user-select:none; }
.cp-avatar-lg { width:52px; height:52px; font-size:17px; }

/* Inline stage badge */
.cp-stage-badge { display:inline-block; font-size:10px; font-weight:600; padding:3px 8px; border-radius:10px; white-space:nowrap; }

/* Detail view shell */
.cp-detail-wrap        { display:flex; flex-direction:column; height:100%; overflow:hidden; }
.cp-detail-header      { display:flex; align-items:center; gap:14px; padding:16px 24px; border-bottom:1px solid var(--grey-bd); flex-wrap:wrap; background:var(--white); flex-shrink:0; }
.cp-back-btn           { height:32px; padding:0 12px; font-size:12px; font-weight:600; color:var(--text-3); border:1px solid var(--grey-bd); border-radius:var(--radius-sm); background:var(--white); cursor:pointer; white-space:nowrap; transition:all var(--transition); }
.cp-back-btn:hover     { border-color:var(--teal); color:var(--teal); background:var(--teal-lt); }
.cp-detail-info        { flex:1; min-width:0; }
.cp-detail-name        { font-size:18px; font-weight:700; color:var(--text-1); line-height:1.25; }
.cp-detail-sub         { font-size:11px; color:var(--text-3); margin-top:3px; }
.cp-delete-btn         { height:32px; padding:0 14px; font-size:12px; font-weight:600; color:var(--red); border:1px solid var(--red-bd); border-radius:var(--radius-sm); background:var(--red-lt); cursor:pointer; white-space:nowrap; transition:all var(--transition); }
.cp-delete-btn:hover   { background:var(--red); color:var(--white); }

/* Tab bar */
.cp-tab-bar          { display:flex; border-bottom:1px solid var(--grey-bd); padding:0 24px; overflow-x:auto; background:var(--white); flex-shrink:0; }
.cp-tab-btn          { font-size:13px; font-weight:500; color:var(--text-3); padding:10px 14px; border:none; background:none; cursor:pointer; border-bottom:2px solid transparent; white-space:nowrap; transition:all var(--transition); }
.cp-tab-btn:hover    { color:var(--text-1); }
.cp-tab-btn.active   { color:var(--teal); border-bottom-color:var(--teal); font-weight:600; }

/* Tab body scroll area */
.cp-tab-body { flex:1; overflow-y:auto; padding:20px 24px 40px; background:var(--grey-lt); }

/* Form card sections */
.cp-section       { background:var(--white); border:1px solid var(--grey-bd); border-radius:var(--radius-md); padding:20px; margin-bottom:14px; box-shadow:var(--shadow-sm); }
.cp-section-title { font-size:10px; font-weight:700; color:var(--text-3); text-transform:uppercase; letter-spacing:0.07em; margin-bottom:14px; }

/* Responsive form grid */
.cp-form-grid           { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.cp-form-grid.cols1     { grid-template-columns:1fr; }
.cp-form-grid.cols3     { grid-template-columns:1fr 1fr 1fr; }
.cp-field               { display:flex; flex-direction:column; gap:4px; }
.cp-field.span2         { grid-column:span 2; }
.cp-label               { font-size:10px; font-weight:700; color:var(--text-3); text-transform:uppercase; letter-spacing:0.06em; }
.cp-input,.cp-select,.cp-textarea {
  border:1px solid var(--grey-bd); border-radius:var(--radius-sm);
  font-size:13px; color:var(--text-1); padding:8px 10px;
  background:var(--white); font-family:var(--font); outline:none; width:100%;
  transition:border-color var(--transition);
}
.cp-input:focus,.cp-select:focus,.cp-textarea:focus {
  border-color:var(--teal); box-shadow:0 0 0 3px rgba(29,158,117,0.1);
}
.cp-textarea { resize:vertical; min-height:80px; }
.cp-select   { cursor:pointer; }

/* Save button row */
.cp-save-row { display:flex; justify-content:flex-end; margin-top:12px; }
.cp-save-btn           { height:36px; padding:0 22px; background:var(--teal); color:var(--white); border:none; border-radius:var(--radius-sm); font-size:13px; font-weight:600; cursor:pointer; transition:background var(--transition); }
.cp-save-btn:hover     { background:var(--teal-dk); }

/* Repeating array rows (policies, children, etc.) */
.cp-array-row  { display:flex; gap:12px; align-items:flex-start; background:var(--grey-lt); border:1px solid var(--grey-bd); border-radius:var(--radius-sm); padding:14px; margin-bottom:10px; }
.cp-row-del    { flex-shrink:0; width:28px; height:28px; background:var(--red-lt); color:var(--red); border:1px solid var(--red-bd); border-radius:var(--radius-sm); cursor:pointer; font-size:14px; display:flex; align-items:center; justify-content:center; margin-top:2px; transition:all var(--transition); }
.cp-row-del:hover  { background:var(--red); color:var(--white); }
.cp-add-row-btn    { font-size:12px; font-weight:600; color:var(--teal); border:1px dashed var(--teal-md); background:var(--teal-lt); border-radius:var(--radius-sm); padding:7px 14px; cursor:pointer; display:inline-flex; align-items:center; transition:background var(--transition); }
.cp-add-row-btn:hover { background:var(--teal-md); }

/* Checkbox / toggle */
.cp-toggle-wrap  { display:flex; align-items:center; gap:8px; padding:7px 0; }
.cp-toggle       { width:16px; height:16px; accent-color:var(--teal); cursor:pointer; }
.cp-toggle-label { font-size:13px; color:var(--text-2); }

/* Dark mode overrides */
body.dark .cp-list-toolbar,.cp-detail-header  { border-color:#1F2937; }
body.dark .cp-stage-pills  { background:#0A0E1A; border-color:#1F2937; }
body.dark .cp-section      { background:#111827; border-color:#1F2937; }
body.dark .cp-tab-bar      { background:#0D1117; border-color:#1F2937; }
body.dark .cp-detail-header{ background:#0D1117; border-color:#1F2937; }
body.dark .cp-tab-body     { background:#0A0E1A; }
body.dark .cp-input,body.dark .cp-select,body.dark .cp-textarea { background:#1F2937; border-color:#374151; color:#F9FAFB; }
body.dark .cp-array-row    { background:#1F2937; border-color:#374151; }

@media (max-width:720px) {
  .cp-form-grid,.cp-form-grid.cols3 { grid-template-columns:1fr; }
  .cp-detail-header { flex-wrap:wrap; }
}

/* ─── HOME SETTINGS VIEW ──────────────────────────────────────── */
#home-settings-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
#home-settings-view.hidden { display: none !important; }

.home-settings-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--grey-bd);
  background: var(--white);
  flex-shrink: 0;
}

.home-actions {
  display: flex;
  justify-content: center;
  padding: 28px 0 0;
}
.home-settings-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  border: 1px solid var(--grey-bd);
  border-radius: var(--radius-md);
  background: var(--white);
  cursor: pointer;
  transition: all var(--transition);
}
.home-settings-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-lt);
}

/* ─── TOOLS & CALCULATORS ─────────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 4px;
}
.tools-tile {
  background: var(--white);
  border: 1px solid var(--grey-bd);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: default;
}
.tools-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
body.dark .tools-tile { background: #111827; border-color: #1F2937; }
body.dark .home-settings-topbar { background: #0D1117; border-color: #1F2937; }

/* ═══════════════════════════════════════════════════════════════
   WORLD-CLASS UPGRADE — Scrap3 v2.0
   2026-05-16 — Premium design system extension
   ═══════════════════════════════════════════════════════════════ */

/* ─── ADDITIONAL DESIGN TOKENS ──────────────────────────────────── */
:root {
  /* Extended palette */
  --teal-10:    #F0FAF6;
  --teal-20:    #D1F3E8;
  --slate-800:  #0F172A;
  --slate-700:  #1A2435;
  --neutral-50: #F8FAFC;
  --neutral-100:#F1F5F9;
  --neutral-800:#1E293B;
  --neutral-900:#0F172A;

  /* Z-index scale */
  --z-dropdown:  200;
  --z-sticky:    300;
  --z-overlay:   400;
  --z-modal:     10001;
  --z-toast:     9000;
  --z-tooltip:   700;
  --z-lock:      9999;

  /* Easing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Extended shadows */
  --shadow-xs:      0 1px 2px rgba(0,0,0,0.05);
  --shadow-xl:      0 32px 64px rgba(0,0,0,0.14), 0 16px 32px rgba(0,0,0,0.08);
  --shadow-teal:    0 4px 16px rgba(29,158,117,0.25);
  --shadow-teal-lg: 0 8px 32px rgba(29,158,117,0.35);
  --glow-teal:      0 0 0 3px rgba(29,158,117,0.15), 0 0 0 1px rgba(29,158,117,0.4);
}

/* ─── LOCK SCREEN — PREMIUM ─────────────────────────────────────── */
.lock-screen {
  background: var(--neutral-900);
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(29,158,117,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 80%, rgba(15,110,86,0.10) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%231D9E75' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E");
}

.lock-card {
  background: rgba(13,21,37,0.96);
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow:
    0 0 0 1px rgba(29,158,117,0.08),
    0 32px 80px rgba(0,0,0,0.6),
    0 16px 40px rgba(0,0,0,0.4);
  backdrop-filter: blur(24px);
}

.lock-title {
  color: #F1F5F9;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.lock-subtitle { color: #94A3B8; }

.lock-logo {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dk) 100%);
  box-shadow: var(--shadow-teal-lg);
  border-radius: var(--radius-xl);
  width: 88px;
  height: 80px;
  margin-bottom: 24px;
}

.btn-lock {
  background: linear-gradient(135deg, #1DB97D 0%, #0F8A64 100%);
  box-shadow: var(--shadow-teal);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 13px;
  border-radius: var(--radius-md);
  transition: all 0.2s var(--ease-out-expo);
}
.btn-lock:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-teal-lg);
}
.btn-lock:active { transform: scale(0.98); }

/* Form fields inside lock card */
.lock-card .form-group input {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  color: #F1F5F9;
  border-radius: var(--radius-md);
}
.lock-card .form-group input::placeholder { color: #64748B; }
.lock-card .form-group input:focus {
  border-color: var(--teal);
  background: rgba(29,158,117,0.08);
  box-shadow: var(--glow-teal);
}
.lock-card .form-group label { color: #94A3B8; }

/* ─── SIDEBAR — PREMIUM ─────────────────────────────────────────── */
#sidebar {
  background: #060C18;
  border-right: 1px solid #111B2E;
}

.sidebar-brand { border-bottom: 1px solid #111B2E; }

/* Fix sidebar brand name colour (was var(--slate) = dark on dark) */
.sidebar-name { color: #E2E8F0; }
.sidebar-sub  { color: #4B5563; }

/* Active item: left bar indicator */
.sidebar-item {
  position: relative;
  padding-left: 16px;
}
.sidebar-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 60%;
  background: var(--teal);
  border-radius: 0 2px 2px 0;
  transition: transform 0.2s var(--ease-spring);
}
.sidebar-item.active::before {
  transform: translateY(-50%) scaleY(1);
}
.sidebar-item.active {
  background: linear-gradient(90deg, rgba(29,158,117,0.18) 0%, rgba(29,158,117,0.05) 100%);
  color: #E2E8F0;
}
.sidebar-item.active .snav-icon {
  color: var(--teal);
  opacity: 1;
}
.sidebar-item:hover { background: #0D1A2E; }

/* Sidebar footer improvements */
.sidebar-footer {
  background: #040912;
  border-top: 1px solid #111B2E;
}

/* Sidebar navigation badge (alert count) */
.snav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  background: var(--red-bd);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 9px;
  padding: 0 4px;
  margin-left: auto;
  flex-shrink: 0;
  animation: badge-pop 0.3s var(--ease-spring);
}

/* Sidebar section divider labels */
.sidebar-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #2D3748;
  padding: 14px 16px 4px;
  user-select: none;
}

/* ─── NOTIFICATION BELL ─────────────────────────────────────────── */
@keyframes badge-pop {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.notif-bell-wrap {
  position: relative;
  display: inline-flex;
}
.notif-bell-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--grey-bd);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  flex-shrink: 0;
}
.notif-bell-btn:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-lt); }

.notif-badge {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 16px; height: 16px;
  background: var(--red-bd);
  color: #fff;
  font-size: 9px; font-weight: 700;
  border-radius: 8px;
  padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--white);
  animation: badge-pop 0.3s var(--ease-spring);
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  width: 320px;
  background: var(--white);
  border: 1px solid var(--grey-bd);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-md);
}
.notif-panel-title { font-size: 13px; font-weight: 700; color: var(--text-1); }
.notif-panel-clear {
  font-size: 11px; color: var(--teal);
  cursor: pointer; border: none; background: none; font-weight: 500;
}
.notif-panel-clear:hover { text-decoration: underline; }
.notif-list { max-height: 340px; overflow-y: auto; }

.notif-item {
  display: flex; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-md);
  transition: background var(--transition);
  cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--grey-lt); }
.notif-item.unread { background: #F0FAF6; }

.notif-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0; margin-top: 5px;
}
.notif-item:not(.unread) .notif-dot { background: var(--grey-bd); }
.notif-text  { font-size: 12px; color: var(--text-1); line-height: 1.45; flex: 1; }
.notif-time  { font-size: 10px; color: var(--text-3); margin-top: 3px; }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: 12px; }

/* ─── SKELETON LOADERS ──────────────────────────────────────────── */
@keyframes skeleton-shimmer {
  0%   { background-position: -500px 0; }
  100% { background-position: 500px 0; }
}

.skeleton {
  background: linear-gradient(90deg,
    var(--grey-md) 25%, var(--neutral-50) 50%, var(--grey-md) 75%
  );
  background-size: 1000px 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text    { height: 14px; margin-bottom: 8px; }
.skeleton-text-sm { height: 11px; border-radius: 3px; margin-bottom: 6px; width: 60%; }
.skeleton-title   { height: 22px; margin-bottom: 12px; width: 35%; }
.skeleton-avatar  { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.skeleton-btn     { height: 34px; width: 100px; }

.skeleton-kpi {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 8px;
}
.skeleton-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--grey-md);
}
.skeleton-row:last-child { border-bottom: none; }

/* ─── EMPTY STATES — PREMIUM ────────────────────────────────────── */
.empty-state-card {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 72px 32px;
  text-align: center; gap: 16px;
}
.empty-state-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--teal-lt);
  display: flex; align-items: center; justify-content: center;
  color: var(--teal);
  font-size: 32px;
  margin-bottom: 4px;
  box-shadow: 0 0 0 8px rgba(29,158,117,0.08);
}
.empty-state-title {
  font-size: 16px; font-weight: 700;
  color: var(--text-1); letter-spacing: -0.01em;
}
.empty-state-desc {
  font-size: 13px; color: var(--text-3);
  max-width: 300px; line-height: 1.6;
}

/* ─── SPINNER / LOADING ─────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--grey-md);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: var(--z-overlay);
  border-radius: inherit;
}
body.dark .loading-overlay { background: rgba(13,21,37,0.85); }

/* ─── FOCUS VISIBLE — ACCESSIBILITY ────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
  outline: none;
}

/* ─── TOOLTIP ───────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%; transform: translateX(-50%) translateY(4px);
  background: #0F172A;
  color: #fff;
  font-size: 11px; font-weight: 500;
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: var(--z-tooltip);
  line-height: 1.4;
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── INLINE ALERT BANNERS ──────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px; border-left: 4px solid;
  margin-bottom: 16px; line-height: 1.5;
}
.alert-icon { flex-shrink: 0; font-size: 16px; margin-top: 1px; }
.alert-body { flex: 1; }
.alert-title { font-weight: 700; margin-bottom: 2px; }
.alert-success { background: var(--green-lt);  border-color: var(--green);    color: var(--green); }
.alert-warning { background: var(--amber);     border-color: var(--amber-bd); color: var(--amber-d); }
.alert-error   { background: var(--red-lt);    border-color: var(--red-bd);   color: var(--red); }
.alert-info    { background: var(--blue-lt);   border-color: var(--blue-bd);  color: var(--blue); }

/* ─── PROGRESS STEPS ────────────────────────────────────────────── */
.progress-steps {
  display: flex; align-items: center;
  margin-bottom: 24px; overflow-x: auto;
}
.progress-step {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  flex: 1; position: relative; padding: 0 8px; min-width: 80px;
}
.progress-step + .progress-step::before {
  content: ''; position: absolute;
  left: calc(-50% + 14px); top: 14px;
  width: calc(100% - 28px);
  height: 2px; background: var(--grey-md);
}
.progress-step.done + .progress-step::before { background: var(--teal); }
.step-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--grey-bd);
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--text-3);
  position: relative; z-index: 1;
  transition: all 0.2s ease;
}
.progress-step.done   .step-dot { background: var(--teal); border-color: var(--teal); color: #fff; }
.progress-step.active .step-dot { border-color: var(--teal); color: var(--teal); box-shadow: 0 0 0 4px rgba(29,158,117,0.15); }
.step-label { font-size: 10px; font-weight: 600; color: var(--text-3); text-align: center; white-space: nowrap; }
.progress-step.done   .step-label { color: var(--teal-dk); }
.progress-step.active .step-label { color: var(--teal); }

/* ─── DIVIDER WITH LABEL ────────────────────────────────────────── */
.divider-label {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-3); font-size: 11px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  margin: 20px 0;
}
.divider-label::before, .divider-label::after {
  content: ''; flex: 1; height: 1px; background: var(--grey-md);
}

/* ─── CHIP / TAG ────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  background: var(--grey-md); border-radius: 20px;
  font-size: 11px; font-weight: 500; color: var(--text-2);
  white-space: nowrap;
}
.chip-teal  { background: var(--teal-lt);  color: var(--teal-dk); }
.chip-green { background: var(--green-lt); color: var(--green); }
.chip-red   { background: var(--red-lt);   color: var(--red); }
.chip-amber { background: var(--amber);    color: var(--amber-d); }
.chip-blue  { background: var(--blue-lt);  color: var(--blue); }

/* ─── STAT ROW ──────────────────────────────────────────────────── */
.stat-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--grey-md); font-size: 13px;
}
.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--text-3); font-size: 12px; }
.stat-value { font-weight: 600; color: var(--text-1); }

/* ─── KEYBOARD SHORTCUT BADGE ───────────────────────────────────── */
.kbd {
  background: var(--grey-md); border: 1px solid var(--grey-bd);
  border-radius: 4px; padding: 2px 6px;
  font-size: 10px; font-weight: 600; color: var(--text-2);
  font-family: var(--font);
}

/* ─── SCROLL-TO-TOP BUTTON ──────────────────────────────────────── */
.scroll-top-btn {
  position: fixed; bottom: 24px; right: 24px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--slate); color: #fff;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(8px) scale(0.9);
  transition: all 0.2s var(--ease-out-expo);
  z-index: var(--z-sticky);
  pointer-events: none;
}
.scroll-top-btn.visible {
  opacity: 1; transform: translateY(0) scale(1);
  pointer-events: auto;
}
.scroll-top-btn:hover { background: var(--teal); transform: translateY(-2px) scale(1.05); }

/* ─── MODAL CLASS ALIAS (HTML uses .modal not .modal-box) ───────── */
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 680px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.2s ease;
}
.modal .modal-header {
  padding: 18px 24px;
  background: linear-gradient(135deg, var(--slate) 0%, #1a2a3a 100%);
  display: flex; align-items: center; justify-content: space-between;
}
.modal .modal-title, .modal h2 {
  font-size: 16px; font-weight: 700; color: var(--white);
}
.modal .modal-close {
  width: 30px; height: 30px;
  border: none; background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  color: var(--white); font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.modal .modal-close:hover { background: rgba(255,255,255,0.3); }
.modal .modal-body { padding: 24px; max-height: 68vh; overflow-y: auto; }
.modal .modal-footer {
  padding: 14px 24px; background: var(--grey-lt);
  border-top: 1px solid var(--grey-md);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ─── CONFIRM CARD ALIAS (HTML uses .confirm-card not .confirm-box) */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: var(--z-modal); padding: 20px;
  backdrop-filter: blur(2px);
}
.confirm-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 28px 20px;
  max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.15s ease;
}
.confirm-card p { font-size: 14px; color: var(--text-1); line-height: 1.55; margin-bottom: 20px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn-confirm-cancel {
  padding: 9px 18px; background: var(--white); color: var(--text-2);
  border: 1px solid var(--grey-bd); border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all var(--transition); font-family: var(--font);
}
.btn-confirm-cancel:hover { background: var(--grey-lt); }
.btn-confirm-ok {
  padding: 9px 18px; background: var(--red); color: var(--white);
  border: none; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background var(--transition); font-family: var(--font);
}
.btn-confirm-ok:hover { background: #a93226; }

/* ─── BUTTONS — ENHANCED ────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, #1DB97D 0%, #0F8A64 100%);
  box-shadow: 0 2px 8px rgba(29,158,117,0.28);
  transition: all 0.18s var(--ease-out-expo);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #1DC87E 0%, #0C7356 100%);
  box-shadow: 0 6px 18px rgba(29,158,117,0.38);
  transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.97); box-shadow: 0 2px 6px rgba(29,158,117,0.2); }

.btn-secondary { transition: all 0.15s ease; }
.btn-secondary:hover { background: var(--teal-lt); border-color: var(--teal); color: var(--teal-dk); }

/* ─── KPI CARDS — ENHANCED ─────────────────────────────────────── */
.kpi-card {
  transition: all 0.2s var(--ease-out-expo);
}
.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.06);
}

/* KPI trend indicator */
.kpi-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600;
}
.kpi-trend-up   { color: var(--green); }
.kpi-trend-down { color: var(--red-bd); }
.kpi-trend-flat { color: var(--text-3); }

/* ─── PANEL HOVER ────────────────────────────────────────────────── */
.panel { transition: box-shadow 0.2s ease; }
.panel:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.08); }

/* ─── MODULE HEADER — IMPROVED ──────────────────────────────────── */
/* Remove the invisible dark-on-dark gradient from previous iteration */
.module-header h2 {
  font-size: 22px;
  letter-spacing: -0.03em;
  color: var(--slate);
  background: none;
  -webkit-text-fill-color: unset;
  background-clip: unset;
}

/* ─── DATA TABLE — ENHANCED ─────────────────────────────────────── */
.data-table thead th {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #151E2D;
}
.data-table tbody tr td:first-child {
  border-left: 2px solid transparent;
  transition: border-color 0.1s ease;
}
.data-table tbody tr:hover td:first-child { border-left-color: var(--teal); }

/* ─── AVATAR GRADIENT SYSTEM ────────────────────────────────────── */
.avatar-A,.avatar-B,.avatar-C { background: linear-gradient(135deg,#6366F1,#8B5CF6); }
.avatar-D,.avatar-E,.avatar-F { background: linear-gradient(135deg,#14B8A6,#0891B2); }
.avatar-G,.avatar-H,.avatar-I { background: linear-gradient(135deg,#F59E0B,#EF4444); }
.avatar-J,.avatar-K,.avatar-L { background: linear-gradient(135deg,#10B981,#059669); }
.avatar-M,.avatar-N,.avatar-O { background: linear-gradient(135deg,#3B82F6,#2563EB); }
.avatar-P,.avatar-Q,.avatar-R { background: linear-gradient(135deg,#EC4899,#DB2777); }
.avatar-S,.avatar-T,.avatar-U { background: linear-gradient(135deg,#1D9E75,#0F6E56); }
.avatar-V,.avatar-W,.avatar-X { background: linear-gradient(135deg,#F97316,#EA580C); }
.avatar-Y,.avatar-Z            { background: linear-gradient(135deg,#A855F7,#7C3AED); }

/* ─── MOBILE TOPBAR ─────────────────────────────────────────────── */
/* Hidden by default; shown only on small screens via media query below */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 16px;
  background: var(--white);
  border-bottom: 1px solid var(--grey-md);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  box-shadow: 0 1px 0 var(--grey-md);
}
.menu-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--grey-bd);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer; color: var(--text-2);
  transition: all var(--transition); flex-shrink: 0;
}
.menu-toggle:hover { border-color: var(--teal); color: var(--teal); }

/* ─── MOBILE SIDEBAR ────────────────────────────────────────────── */
@media (max-width: 860px) {
  .mobile-topbar { display: flex; }

  #sidebar {
    position: fixed; top: 0; left: 0;
    height: 100vh; z-index: var(--z-overlay);
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease-out-expo);
    width: 240px;
    box-shadow: var(--shadow-xl);
  }
  #sidebar.mobile-open { transform: translateX(0); }

  .sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    z-index: calc(var(--z-overlay) - 1);
    animation: fadeIn 0.2s ease;
    cursor: pointer;
  }
  .sidebar-backdrop.visible { display: block; }
  #content-area { width: 100%; }
}
@media (min-width: 861px) {
  .mobile-topbar { display: none !important; }
  .menu-toggle   { display: none; }
}

/* ─── PRINT STYLES ──────────────────────────────────────────────── */
@media print {
  #sidebar, .crm-topbar, .module-actions,
  .btn-primary, .btn-secondary, .btn-icon,
  #toast-container, .notif-bell-wrap,
  .scroll-top-btn, .header-actions { display: none !important; }

  body { background: #fff; color: #000; font-size: 12px; }
  .app-shell { display: block; }
  #content-area, .app-section { overflow: visible; height: auto; }
  #main-content { padding: 0; max-width: 100%; }
  .panel, .kpi-card { box-shadow: none !important; border: 1px solid #ccc; }
  .data-table thead tr { background: #e8e8e8 !important; color: #000 !important; }
  .data-table thead th { font-size: 9px; padding: 6px 8px; }
  .data-table td { padding: 6px 8px; font-size: 11px; }
  @page { margin: 1.5cm; size: A4; }
}

/* ─── DARK MODE ENHANCEMENTS ────────────────────────────────────── */
body.dark .skeleton {
  background: linear-gradient(90deg, #0A1020 25%, #0D1525 50%, #0A1020 75%);
  background-size: 1000px 100%;
}
body.dark .notif-panel      { background: #0D1525; border-color: #1E2740; }
body.dark .notif-item:hover { background: #0A1020; }
body.dark .notif-item.unread { background: rgba(29,158,117,0.07); }
body.dark .confirm-card     { background: #0D1525; }
body.dark .confirm-card p   { color: #E2E8F0; }
body.dark .modal            { background: #0D1525; }
body.dark .modal .modal-footer { background: #060C18; }
body.dark .empty-state-icon { background: rgba(29,158,117,0.12); }
body.dark [data-tooltip]::after { background: #1E2740; }
body.dark .data-table tbody tr:hover td:first-child { border-left-color: var(--teal); }
body.dark .btn-confirm-cancel { background: #1E2740; border-color: #2D3748; color: #E2E8F0; }
body.dark .notif-bell-btn { background: #0D1525; border-color: #1E2740; color: #9CA3AF; }
body.dark .stat-row { border-color: #1E2740; }
body.dark .divider-label::before, body.dark .divider-label::after { background: #1E2740; }

/* ─── LOCK CARD — DARK BACKGROUND FIXES ────────────────────────── */
/* The lock card is always dark (rgba(13,21,37,0.96)).
   These fix light-coloured inner elements that were unreadable on it. */

.lock-hint {
  background: rgba(245,158,11,0.12);
  border-color: rgba(245,158,11,0.3);
  color: #FCD34D;
}

.lock-reset-warning {
  background: rgba(249,115,22,0.1);
  border-color: rgba(249,115,22,0.25);
  color: #FCA27A;
}

.lock-error {
  background: rgba(239,68,68,0.12);
  border-left-color: #EF4444;
  color: #FCA5A5;
}

.lock-subtitle-warn { color: #FBBF24; }

/* ─── CONTENT-AREA flex column so mobile-topbar stacks above sections */
#content-area {
  display: flex;
  flex-direction: column;
}
.app-section {
  flex: 1;
  min-height: 0;
}

/* ─── NOTIFICATION PANEL — open upward from sidebar footer ──────── */
.notif-bell-wrap .notif-panel {
  left: 0;
  right: auto;
  bottom: calc(100% + 8px);
  top: auto;
  width: 300px;
}

/* ─── MOBILE TOPBAR DARK MODE ──────────────────────────────────── */
body.dark .mobile-topbar {
  background: #0D1117;
  border-bottom-color: #1E2740;
}
body.dark .menu-toggle {
  background: #0D1117;
  border-color: #1E2740;
  color: #9CA3AF;
}
