/* ============================================================
   DEVSYS – Light Modern Dashboard
   Clean card-based UI
   ============================================================ */

:root {
  /* Pegar Grama brand – matches pegar-grama.com */
  --navy: #0D1B3E;
  --navy-2: #13335C;
  --navy-3: #1B3F6E;
  --sidebar-bg: #0D1B3E;
  --sidebar-hover: #13335C;
  --sidebar-active: #1B3F6E;
  --sidebar-text: #e8eef8;
  --primary: #0D1B3E;
  --primary-light: #1B3F6E;
  --accent: #B8952A;
  --accent-hover: #9a7d24;
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #2F7A4D;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #2E5BB8;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  /* Dark console surfaces — derived from brand navy (all admin portals) */
  --console-bg: #0D1B3E;
  --console-panel: #13335C;
  --console-panel2: #1B3F6E;
  --console-line: rgba(255, 255, 255, 0.14);
  --console-sub: #a8b8d4;
  --console-green: #46c496;
  --console-red: #e5726e;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .logo { font-weight: 700; font-size: 1.15rem; letter-spacing: 0.02em; }
.sidebar-brand .logo span { color: var(--accent); }
.sidebar-brand .tagline { font-size: 0.7rem; opacity: 0.7; margin-top: 2px; }
.sidebar-role-badge {
  display: inline-block; margin-top: 0.45rem;
  font: 700 0.58rem/1 "Inter", sans-serif; letter-spacing: 0.1em; text-transform: uppercase;
  color: #ffd98a; background: rgba(184, 149, 42, 0.16); border: 1px solid rgba(184, 149, 42, 0.35);
  padding: 0.28rem 0.45rem; border-radius: 5px;
}

.sidebar-nav { flex: 1; padding: 0.65rem 0 1rem; overflow-y: auto; }
.nav-group { margin-bottom: 0.35rem; }
.nav-group-label {
  font: 700 0.62rem/1 "Inter", sans-serif; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38); padding: 0.65rem 1.25rem 0.35rem;
}
.sidebar-nav .nav-item {
  display: flex; align-items: center; gap: 0.55rem;
  width: calc(100% - 1.1rem); margin: 0.1rem 0.55rem;
  padding: 0.55rem 0.75rem; border-radius: 8px;
  color: rgba(255, 255, 255, 0.78); font-size: 0.84rem; transition: all 0.15s;
  text-decoration: none; border: 0; background: none; cursor: pointer; font-family: inherit; text-align: left;
}
.sidebar-nav a.nav-item { display: flex; }
.sidebar-nav .nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-item.active {
  background: linear-gradient(90deg, rgba(184, 149, 42, 0.2), rgba(184, 149, 42, 0.04));
  color: #fff; font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-icon { width: 1.15rem; text-align: center; opacity: 0.88; font-size: 0.78rem; flex-shrink: 0; }
.nav-label { flex: 1; min-width: 0; }
.nav-tag {
  margin-left: auto; flex-shrink: 0;
  font: 700 0.55rem/1 "Inter", sans-serif; letter-spacing: 0.06em; text-transform: uppercase;
  color: #ffd98a; background: rgba(184, 149, 42, 0.16); padding: 0.18rem 0.38rem; border-radius: 4px;
}
/* Legacy flat links (hr/financier portals) */
.sidebar-nav a {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.7rem 1.5rem; color: rgba(255,255,255,0.75); font-size: 0.875rem; transition: all 0.15s;
}
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav a.active {
  background: var(--sidebar-active); color: #fff;
  border-right: 3px solid var(--accent); font-weight: 500;
}

.sidebar-footer {
  padding: 1rem 1.5rem; border-top: 1px solid rgba(255,255,255,0.08); font-size: 0.8rem;
  margin-top: auto; flex-shrink: 0;
}
.sidebar-footer .user-name { font-weight: 600; color: #fff; }
.sidebar-footer .user-role { opacity: 0.7; font-size: 0.75rem; }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.75rem; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 1.2rem; font-weight: 600; color: var(--text); }
.topbar .subtitle { font-size: 0.8rem; color: var(--text-muted); }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.topbar-signout {
  display: none;
  margin-left: auto;
  flex-shrink: 0;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  font: 600 0.78rem/1 var(--font);
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  min-height: 40px;
}
.topbar-signout:hover { background: rgba(255,255,255,0.22); }

.content { padding: 1.5rem 1.75rem; flex: 1; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.stat-card.mint { background: #eef2f9; border-color: #c5d4e8; }
.stat-card.rose { background: #fff1f2; border-color: #fecdd3; }
.stat-card.sky  { background: #f0f9ff; border-color: #bae6fd; }
.stat-card.amber{ background: #fffbeb; border-color: #fde68a; }
.stat-card.violet{ background: #f5f3ff; border-color: #ddd6fe; }
.stat-card.navy { background: #eef2f9; border-color: #c5d4e8; }
.stat-card.navy .value { color: var(--navy); }

.stat-card .value { font-size: 1.6rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-card .label { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }
.stat-card .sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }
.stat-card.clickable, .fin-mini.clickable, .fin-kpi.clickable, .hr-kpi.clickable {
  cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.stat-card.clickable:hover, .fin-mini.clickable:hover, .fin-kpi.clickable:hover, .hr-kpi.clickable:hover {
  transform: translateY(-2px); box-shadow: 0 6px 18px rgba(13, 27, 62, 0.1);
}
.stat-card.clickable:focus-visible, .fin-mini.clickable:focus-visible, .fin-kpi.clickable:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.card.clickable {
  cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card.clickable:hover {
  transform: translateY(-2px); box-shadow: 0 6px 18px rgba(13, 27, 62, 0.1);
}

.card {
  background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card-title { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.card-subtitle { font-size: 0.78rem; color: var(--text-muted); }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.25rem; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: 1fr; } }

.module-list { list-style: none; }
.module-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 0; border-bottom: 1px solid var(--border);
}
.module-item:last-child { border-bottom: none; }
.module-item .mod-title { font-weight: 500; font-size: 0.9rem; }
.module-item .mod-status { font-size: 0.75rem; color: var(--text-muted); }
.module-item .mod-link { font-size: 0.8rem; color: var(--primary); font-weight: 500; }
.module-item .mod-link.live { color: var(--accent); }

.alert-list { list-style: none; }
.alert-item { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.55rem 0; font-size: 0.85rem; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.alert-dot.red { background: var(--danger); }
.alert-dot.orange { background: var(--warning); }
.alert-dot.green { background: var(--success); }
.alert-dot.blue { background: var(--info); }

.table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th {
  text-align: left; padding: 0.75rem 1rem; background: #f8fafc; color: var(--text-muted);
  font-weight: 550; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}
td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* Action cells: flex goes on inner wrapper, not <td> (flex on td breaks column alignment) */
th.col-actions, td.col-actions {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
}
.table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

th.pricing-col, td.pricing-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 4.5rem;
}
th.pricing-col { font-size: 0.68rem; }

tr.clickable-row { cursor: pointer; }
tr.clickable-row:hover td { background: #eef2ff; }
tr.clickable-row td:first-child { color: var(--primary, #0D1B3E); font-weight: 600; }

.section-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}
.section-back:hover { color: var(--primary, #0D1B3E); }

.badge {
  display: inline-block; padding: 0.18rem 0.55rem; border-radius: 999px;
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-approved { background: #dbeafe; color: #1e40af; }
.badge-declined { background: #fee2e2; color: #991b1b; }
.badge-settled { background: #fef9c3; color: #854d0e; }
.badge-info { background: #e0e7ff; color: #3730a3; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

.btn {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.5rem 1rem;
  border-radius: 8px; font-size: 0.85rem; font-weight: 500; border: none; cursor: pointer; transition: all 0.15s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); color: #fff; }
.btn-accent { background: var(--accent); color: #1e293b; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: #f8fafc; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.78rem; }
.btn-danger { background: var(--danger); color: #fff; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.3rem; font-weight: 500; }
.form-control {
  width: 100%; padding: 0.55rem 0.85rem; background: #fff; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.875rem;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13, 27, 62, 0.12); }

.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #0A1E38 0%, #0D1B3E 60%, #0E2C50 100%); padding: 1.5rem;
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 16px;
  padding: 2rem 2.25rem; box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-card h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.2rem; }
.login-card .subtitle { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; }

.alert { padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.85rem; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.text-sm { font-size: 0.85rem; }
.text-muted { color: var(--text-muted); }
.hidden { display: none !important; }

/* ---------- Modals, actions, pipeline (merged enhancements) ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 1rem;
}
.modal-overlay.hidden { display: none !important; }
.modal-panel {
  width: 100%; max-width: 440px; background: var(--card-bg);
  border-radius: 14px; padding: 1.5rem; box-shadow: 0 24px 60px rgba(0,0,0,0.2);
  border: 1px solid var(--border);
}
.modal-panel h3 { font-size: 1.05rem; margin-bottom: 1rem; }

/* Team invite modal — centered overlay */
body.team-modal-open { overflow: hidden; }
.team-invite-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 3000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1.25rem;
  background: rgba(13, 27, 62, 0.68) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.team-invite-overlay.hidden { display: none !important; }
.team-invite-dialog {
  width: 100%;
  max-width: 520px;
  max-height: min(90vh, 720px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: teamModalIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes teamModalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.team-invite-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 50%, var(--navy-3) 100%);
  color: var(--sidebar-text);
  padding: 1.45rem 1.55rem 1.35rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-shrink: 0;
}
.team-invite-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 1;
  margin: 0 0 0.35rem;
}
.team-invite-hero h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
  line-height: 1.2;
}
.team-invite-sub {
  font-size: 0.84rem;
  opacity: 0.88;
  margin: 0;
  line-height: 1.45;
  max-width: 28rem;
}
.team-invite-close {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.team-invite-close:hover { background: rgba(255, 255, 255, 0.22); }
.team-invite-body {
  padding: 1.35rem 1.55rem;
  overflow-y: auto;
  flex: 1;
}
.team-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}
.team-role-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}
.team-role-pill {
  flex: 1;
  min-width: 5.5rem;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.team-role-pill:hover {
  border-color: var(--navy-3);
  color: var(--primary);
}
.team-role-pill.active {
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  border-color: var(--navy);
  color: var(--sidebar-text);
  box-shadow: 0 4px 14px rgba(13, 27, 62, 0.28);
}
.team-source-pills { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.25rem; }
.team-source-pill {
  flex: 1;
  min-width: 7rem;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.team-source-pill.active {
  background: #fff8e8;
  border-color: rgba(184, 149, 42, 0.55);
  color: var(--navy);
}
.team-scope-card {
  margin-top: 1rem;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}
.team-scope-head {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}
.team-scope-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.75rem;
}
.team-scope-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  line-height: 1.3;
  padding: 0.35rem 0;
}
.team-scope-icon {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  flex-shrink: 0;
}
.team-scope-item.allowed .team-scope-icon {
  background: rgba(13, 27, 62, 0.1);
  color: var(--navy);
}
.team-scope-item.allowed .team-scope-label {
  color: var(--text);
}
.team-scope-item.denied .team-scope-icon {
  background: #fee2e2;
  color: #991b1b;
}
.team-scope-item.denied .team-scope-label {
  color: var(--text-muted);
}
.team-invite-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 1rem 1.55rem 1.25rem;
  border-top: 1px solid var(--border);
  background: #fafbfc;
  flex-shrink: 0;
}

/* Shared DEVSYS dialogs (confirm, forms, alerts) */
body.devsys-modal-open { overflow: hidden; }
.devsys-dialog-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2900 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1.25rem;
  background: rgba(13, 27, 62, 0.68) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.devsys-dialog-overlay.hidden { display: none !important; }
.devsys-dialog {
  width: 100%;
  max-width: 480px;
  max-height: min(90vh, 680px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: teamModalIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.devsys-dialog.devsys-dialog-wide { max-width: 560px; }
.devsys-dialog-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 55%, var(--navy-3) 100%);
  color: var(--sidebar-text);
  padding: 1.15rem 1.35rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.devsys-dialog-hero h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.25;
}
.devsys-dialog-hero p {
  font-size: 0.82rem;
  opacity: 0.88;
  margin: 0.35rem 0 0;
  line-height: 1.4;
}
.devsys-dialog-close {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  font-size: 1.25rem;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
.devsys-dialog-body {
  padding: 1.25rem 1.35rem;
  overflow-y: auto;
  flex: 1;
}
.devsys-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.9rem 1.35rem 1.15rem;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}
.devsys-dialog-msg {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
  margin: 0;
}
.devsys-dialog-pre {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 0.8rem;
  word-break: break-all;
  white-space: pre-wrap;
}
.devsys-schedule-table { width: 100%; font-size: 0.82rem; border-collapse: collapse; }
.devsys-schedule-table th, .devsys-schedule-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.devsys-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4000;
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  transition: opacity 0.2s;
}
.devsys-toast.hidden { opacity: 0; pointer-events: none; }
.devsys-toast-success { background: var(--navy); color: #fff; }
.devsys-toast-error { background: #fee2e2; color: #991b1b; }

.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.35rem; }
.client-check-list {
  max-height: 140px; overflow: auto; border: 1px solid var(--border);
  border-radius: 10px; padding: 0.55rem 0.75rem; background: #fff;
  margin-top: 0.35rem;
}
.client-check-list label {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 500; color: var(--text); font-size: 0.875rem;
  padding: 0.35rem 0; cursor: pointer;
}

.action-item {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.85rem 0; border-bottom: 1px solid var(--border);
}
.action-item:last-child { border-bottom: none; }
.action-title { font-weight: 500; font-size: 0.9rem; }
.action-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
.action-btns { display: flex; gap: 0.4rem; flex-shrink: 0; }

.pipeline { display: flex; flex-direction: column; gap: 0.75rem; }
.pipeline-stage { display: grid; grid-template-columns: 1fr auto; gap: 0.75rem; align-items: center; }
.pipeline-bar-wrap { height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.pipeline-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: 999px; min-width: 4px; }
.pipeline-meta { display: flex; flex-direction: column; align-items: flex-end; min-width: 90px; }
.pipeline-count { font-weight: 700; color: var(--primary); font-size: 0.95rem; }
.pipeline-label { font-size: 0.7rem; color: var(--text-muted); text-align: right; }

.invite-list { max-height: 320px; overflow-y: auto; }
.invite-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0; border-bottom: 1px solid var(--border);
}
.invite-row:last-child { border-bottom: none; }
.invite-row label { flex: 1; cursor: pointer; font-size: 0.875rem; }
.invite-row small { color: var(--text-muted); display: block; }

.empty-state { text-align: center; padding: 1.5rem 1rem; color: var(--text-muted); }
.empty-title { font-weight: 500; color: var(--text); }
.empty-sub { font-size: 0.82rem; margin-top: 0.25rem; }

.mobile-menu-btn {
  display: none; background: transparent; border: none; color: var(--primary);
  font-size: 1.3rem; cursor: pointer; margin-right: 0.75rem; padding: 0.25rem 0.35rem;
  line-height: 1; flex-shrink: 0;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 27, 62, 0.55);
  z-index: 99;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-backdrop.open { display: block; }

body.sidebar-open { overflow: hidden; }

.sidebar-close {
  display: none;
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}

/* Enroll page (employee, no sidebar) */
.enroll-header {
  background: var(--sidebar-bg); color: #fff; padding: 1rem 1.5rem;
  font-weight: 700; font-size: 1rem;
}
.enroll-header span { color: var(--accent); }
.enroll-wrap { max-width: 520px; margin: 2rem auto; padding: 0 1rem; }
.enroll-wrap.consent-wide { max-width: 720px; }
.consent-doc { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem 1.35rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.consent-doc h1 { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.2rem; color: var(--text); }
.consent-doc .consent-kicker { color: var(--hr-brand, #157a68); font: 700 0.68rem/1 "Inter", sans-serif; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 0.35rem; }
.consent-doc h2 { font-size: 0.92rem; font-weight: 700; margin: 1.15rem 0 0.55rem; color: var(--text); }
.consent-doc ol { margin: 0 0 0.5rem 1.1rem; color: var(--text); font-size: 0.86rem; line-height: 1.55; }
.consent-doc ol li { margin-bottom: 0.45rem; }
.consent-row { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.45rem 0; border-bottom: 1px solid #f1f5f9; font-size: 0.86rem; }
.consent-row:last-child { border-bottom: none; }
.consent-row .k { color: var(--text-muted); }
.consent-row .v { font-weight: 600; color: var(--text); text-align: right; }
.consent-sign { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 0.85rem 1rem; margin: 0.75rem 0 1rem; }
.consent-sign .sig { font-family: Georgia, "Times New Roman", serif; font-size: 1.25rem; color: var(--navy, #0D1B3E); }
.consent-check { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.88rem; margin: 0.85rem 0; padding: 0.9rem 1rem; border: 1px solid #a7f3d0; background: #f0fdf4; border-radius: 10px; cursor: pointer; }
.consent-check input { margin-top: 2px; width: 18px; height: 18px; flex-shrink: 0; }
.consent-online-banner { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; border-radius: 10px; padding: 0.75rem 0.9rem; font-size: 0.86rem; line-height: 1.45; margin-bottom: 1rem; }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.consent-imei {
  background: #0D1B3E; color: #fff; font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.06em; text-align: center; padding: 0.9rem 1rem; border-radius: 10px;
  font-size: 1.05rem; margin: 0.35rem 0 0.85rem; word-break: break-all;
}
.consent-protect { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 0.85rem 1rem; font-size: 0.86rem; line-height: 1.55; color: var(--text); margin-bottom: 0.5rem; }
.consent-protect ul { margin: 0.45rem 0 0 1.1rem; }
.consent-protect li { margin-bottom: 0.4rem; }
.consent-inspect { margin: 0 0 0.5rem 1.1rem; color: var(--text); font-size: 0.86rem; line-height: 1.55; }
.consent-inspect li { margin-bottom: 0.4rem; }
.consent-mismatch { margin-top: 1.15rem; padding-top: 1rem; border-top: 1px solid #e2e8f0; }
.device-option {
  border: 1px solid var(--border); border-radius: 10px; padding: 1rem;
  margin-bottom: 0.75rem; cursor: pointer; transition: all 0.15s; background: #fff;
}
.device-option:hover, .device-option.selected {
  border-color: var(--primary); background: #eef2f9;
}
.device-option.selected { box-shadow: 0 0 0 2px rgba(13, 27, 62, 0.15); }

@media (max-width: 768px) {
  .mobile-menu-btn { display: inline-block; }
  .sidebar-close { display: block; }
  .topbar-signout { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar {
    display: flex;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    width: min(280px, 88vw);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }
  .sidebar-nav { min-height: 0; }
  .sidebar-footer {
    position: sticky;
    bottom: 0;
    background: inherit;
    z-index: 2;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }
  .sidebar-brand { padding-right: 2.5rem; }
  .main-area { width: 100%; }
  .topbar {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .topbar h1 { font-size: 1.05rem; line-height: 1.3; }
  .topbar .subtitle { font-size: 0.72rem; }
  .content { padding: 1rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .stat-card { padding: 0.9rem 1rem; }
  .stat-card .value { font-size: 1.35rem; }
  .card { padding: 1rem; }
  .card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.75rem;
  }
  .card-header .flex {
    flex-wrap: wrap;
    width: 100%;
    gap: 0.5rem;
  }
  .card-header .form-control { width: 100% !important; max-width: none !important; }
  .action-item { flex-direction: column; align-items: flex-start; }
  .action-btns { flex-wrap: wrap; width: 100%; }
  .module-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
  }
  .pipeline-stage { grid-template-columns: 1fr; gap: 0.35rem; }
  .pipeline-meta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
  }
  th, td { padding: 0.6rem 0.75rem; font-size: 0.78rem; }
  td .table-actions {
    flex-wrap: wrap;
    gap: 0.35rem !important;
  }
  .btn-sm { font-size: 0.72rem; padding: 0.28rem 0.55rem; }
  .modal-overlay { padding: 0.75rem; align-items: flex-end; }
  .team-invite-overlay { align-items: center !important; padding: 1rem; }
  .team-field-grid { grid-template-columns: 1fr; }
  .team-scope-list { grid-template-columns: 1fr; }
  .team-invite-dialog { max-height: 92vh; border-radius: 16px; }
  .modal-panel {
    max-width: none;
    max-height: 88vh;
    overflow-y: auto;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
  .login-page { padding: 1rem; align-items: flex-start; padding-top: 2rem; }
  .login-card { padding: 1.5rem 1.25rem; max-width: none; }
  .consent-row { flex-direction: column; gap: 0.12rem; align-items: flex-start; }
  .consent-row .v { text-align: left; }
  .device-option { padding: 0.85rem; }
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    max-width: 100%;
    margin: 0 -0.25rem;
  }
  .table-wrap table { min-width: 480px; }
  .table-compact table { min-width: 0 !important; }
  .funnel-row,
  .hr-funnel {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 0.35rem;
  }
  .funnel-node,
  .hr-fnode {
    flex: 0 0 auto;
    min-width: 76px;
    scroll-snap-align: start;
  }
  .attn-row,
  .hr-arow {
    flex-direction: column;
    align-items: stretch;
  }
  .attn-row .act {
    margin-left: 0;
    align-self: flex-start;
    min-height: 40px;
    padding: 0.4rem 0.85rem;
  }
  .topbar > div:first-child {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    flex: 1;
  }
  .mobile-menu-btn { margin-right: 0; flex-shrink: 0; }
  body.admin-console,
  body.hr-portal,
  body.fin-portal,
  body.rep-portal {
    overflow-x: hidden;
    max-width: 100vw;
  }
  .main-area,
  .content { max-width: 100%; min-width: 0; }
  .fin-kpis { grid-template-columns: 1fr 1fr; }
  .fin-strip { grid-template-columns: 1fr 1fr; }
  .hr-kpis { grid-template-columns: 1fr 1fr; }
  .admin-console .fin-strip { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .fin-kpis, .hr-kpis, .fin-strip { grid-template-columns: 1fr; }
  .admin-console .fin-strip { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 0.98rem; }
}

/* Console wireframe enrichment — scoped UI tokens (navy theme) */
.pill-ok { background: #d1fae5; color: #065f46; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.pill-bad { background: #fee2e2; color: #991b1b; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.pill-warn { background: #fef3c7; color: #92400e; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.scope-note {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(15, 61, 46, 0.04); border: 1px dashed rgba(15, 61, 46, 0.25);
  border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--text-muted);
}
.unit-card {
  display: flex; align-items: center; gap: 12px; border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; margin-top: 10px; cursor: pointer; background: #fff;
}
.unit-card.selected { border-color: #6366f1; box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35); background: rgba(99, 102, 241, 0.06); }
.funnel-row { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.funnel-node {
  flex: 1; min-width: 70px; text-align: center; background: #f8fafc;
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 6px;
}
.funnel-node .fv { font-size: 1.25rem; font-weight: 800; }
.funnel-node .fl { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.funnel-node.mark { border-color: rgba(184, 149, 42, 0.55); box-shadow: 0 0 0 1px rgba(184, 149, 42, 0.2); position: relative; }
.funnel-badge {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  font: 700 0.58rem/1 "Inter", sans-serif; letter-spacing: 0.04em; color: #fff;
  background: var(--primary); padding: 3px 7px; border-radius: 20px; white-space: nowrap;
}
.funnel-arrow { align-self: center; color: var(--text-muted); font-size: 0.85rem; padding: 0 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.funnel-loss { font-size: 0.62rem; font-weight: 700; color: var(--rose, #c0392b); line-height: 1; min-height: 0.75rem; }
.notif-channel { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2, #eef2f7); }
.notif-sms { background: rgba(52, 152, 219, 0.15); color: #2980b9; }
.notif-whatsapp { background: rgba(37, 211, 102, 0.15); color: #128c7e; }
.notif-email { background: rgba(155, 89, 182, 0.15); color: #8e44ad; }
.notif-log { background: rgba(127, 140, 141, 0.15); color: #636e72; }
.badge-muted { background: rgba(127, 140, 141, 0.2); color: #636e72; }

/* Master Admin — white dashboard + white sidebar, navy/gold header only */
body.admin-console {
  background: var(--bg);
  color: var(--text);
}
.admin-console .main-area,
.admin-console .content {
  background: var(--bg);
  color: var(--text);
}
.admin-console .sidebar {
  background: #fff;
  color: var(--text);
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 14px rgba(15, 23, 42, 0.05);
}
.admin-console .sidebar-brand {
  border-bottom: 1px solid var(--border);
}
.admin-console .sidebar-brand .logo { color: var(--navy); }
.admin-console .sidebar-brand .tagline { color: var(--text-muted); opacity: 1; }
.admin-console .sidebar-role-badge {
  color: #8a6b16;
  background: rgba(184, 149, 42, 0.12);
  border-color: rgba(184, 149, 42, 0.35);
}
.admin-console .nav-group-label { color: #94a3b8; }
.admin-console .sidebar-nav .nav-item {
  color: #64748b;
}
.admin-console .sidebar-nav .nav-item:hover {
  background: #f8fafc;
  color: var(--navy);
}
.admin-console .sidebar-nav .nav-item.active {
  background: linear-gradient(90deg, rgba(184, 149, 42, 0.16), rgba(184, 149, 42, 0.04));
  color: var(--navy);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.admin-console .nav-tag {
  color: #8a6b16;
  background: rgba(184, 149, 42, 0.14);
}
.admin-console .sidebar-footer {
  border-top: 1px solid var(--border);
}
.admin-console .sidebar-footer .user-name { color: var(--text); }
.admin-console .sidebar-footer .user-role { color: var(--text-muted); opacity: 1; }
.admin-console .sidebar-close { color: var(--text); }
.admin-console .admin-sidebar-signout {
  margin-top: 0.6rem;
  width: 100%;
}
.admin-console .topbar {
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.admin-console .topbar h1 { color: #fff; }
.admin-console .topbar .subtitle { color: rgba(232, 238, 248, 0.78); }
.admin-console .mobile-menu-btn { color: #fff; }
.admin-console .stat-card .value.money { color: #059669; }
.admin-console .portfolio-table td.money { color: #059669; }
.admin-console .portfolio-eyebrow { color: var(--accent); }
.admin-console .team-chip.on {
  background: #fff8e8;
  color: var(--navy);
  border-color: rgba(184, 149, 42, 0.55);
  box-shadow: inset 0 0 0 1px rgba(184, 149, 42, 0.2);
}
.admin-console .team-role-pill.active {
  background: #fff8e8;
  border-color: rgba(184, 149, 42, 0.55);
  color: var(--navy);
  box-shadow: 0 2px 8px rgba(184, 149, 42, 0.18);
}
.admin-console .team-table-card {
  background: #f8fafc;
  border-color: #dbe3ef;
}
.admin-console .team-drawer {
  background: linear-gradient(180deg, #fffbeb, #fff);
  border-color: #fde68a;
}
.admin-console .team-role-card:nth-child(1) {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.admin-console .team-role-card:nth-child(2) {
  background: #fffbeb;
  border-color: #fde68a;
}
.admin-console .team-role-card:nth-child(3) {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.admin-console .deal-config-card {
  background: #fffbeb;
  border-color: #fde68a;
  max-width: 760px;
}
.admin-console .deal-config-form { padding-top: 0.25rem; }
.admin-console .deal-config-form #commissionClientLabel {
  background: #f8fafc;
}
.admin-console .deal-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.admin-console .deal-config-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.35rem;
}
.admin-console .deal-close-btn {
  background: #059669;
  border-color: #059669;
  color: #fff;
}
@media (max-width: 640px) {
  .admin-console .deal-config-grid { grid-template-columns: 1fr; }
  .admin-console .deal-config-actions .btn { flex: 1 1 100%; min-height: 44px; }
}

/* Accounts Rep — white dashboard + white sidebar, navy/gold header */
body.rep-portal {
  background: var(--bg);
  color: var(--text);
}
.rep-portal .main-area,
.rep-portal .content {
  background: var(--bg);
  color: var(--text);
}
.rep-portal .sidebar {
  background: #fff;
  color: var(--text);
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 14px rgba(15, 23, 42, 0.05);
}
.rep-portal .sidebar-brand-lite {
  padding: 1rem 1.25rem 0.5rem;
  color: var(--navy);
  border-bottom: 1px solid var(--border);
}
.rep-portal .sidebar-brand-lite .t1 { font-weight: 700; font-size: 0.95rem; }
.rep-portal .sidebar-brand-lite .t2 { font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; }
.rep-portal .nav-group-label { color: #94a3b8; }
.rep-portal .sidebar-nav .nav-item { color: #64748b; }
.rep-portal .sidebar-nav .nav-item:hover {
  background: #f8fafc;
  color: var(--navy);
}
.rep-portal .sidebar-nav .nav-item.active {
  background: linear-gradient(90deg, rgba(184, 149, 42, 0.16), rgba(184, 149, 42, 0.04));
  color: var(--navy);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.rep-portal .sidebar-footer { border-top: 1px solid var(--border); }
.rep-portal .sidebar-footer .user-name { color: var(--text); }
.rep-portal .sidebar-footer .user-role { color: var(--text-muted); opacity: 1; }
.rep-portal .rep-sidebar-signout { margin-top: 0.6rem; width: 100%; }
.rep-portal .sidebar-close { color: var(--text); }
.rep-portal .topbar {
  background: linear-gradient(180deg, #1a3560, var(--navy));
  border-bottom: 3px solid var(--accent);
}
.rep-portal .topbar h1 { color: #fff; }
.rep-portal .topbar .text-muted { color: rgba(232, 238, 248, 0.78) !important; }
.rep-portal .mobile-menu-btn { color: #fff; }
.rep-portal .sidebar-role-badge,
.rep-portal .sidebar-brand .tagline { display: none; }

/* Individual programme (HR-style portal for single clients) */
body.ind-portal {
  background: var(--bg);
  color: var(--text);
}
.ind-portal .main-area,
.ind-portal .content { background: var(--bg); color: var(--text); }

/* Portfolio overview (Master Admin Screen 1) */
.portfolio-bar {
  display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 0.75rem 1rem; margin-bottom: 1.25rem;
}
.portfolio-bar .lbl { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; }
.portfolio-bar .form-control { width: auto; min-width: 180px; font-size: 0.82rem; padding: 0.45rem 0.65rem; }
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.view-toggle button {
  background: #fff; border: 0; color: var(--text-muted); font-size: 0.78rem;
  font-weight: 500; padding: 0.45rem 0.85rem; cursor: pointer;
}
.view-toggle button.on { background: var(--primary); color: #fff; font-weight: 600; }
.portfolio-eyebrow {
  font: 700 0.68rem/1 "Inter", sans-serif; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 0.25rem;
}
.portfolio-lead { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }
.fin-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.85rem; margin-bottom: 1.25rem;
}
.fin-mini {
  background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 0.85rem 1rem;
}
.fin-mini .k {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 600;
}
.fin-mini .v { font-size: 1rem; font-weight: 700; margin-top: 0.35rem; }
.fin-mini .v.pos { color: #059669; }
.fin-mini .v.neg { color: #dc2626; }
.fin-mini .v sub { font-size: 0.78rem; font-weight: 500; color: var(--text-muted); }
.stat-card .value.money { color: #059669; }
.portfolio-table th.num, .portfolio-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.portfolio-table td.money { color: #059669; font-weight: 600; }
.attn-list { display: flex; flex-direction: column; gap: 0.65rem; margin-top: 0.5rem; }
.attn-row {
  display: flex; align-items: flex-start; gap: 0.75rem;
  background: #f8fafc; border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 9px; padding: 0.75rem 0.85rem;
}
.attn-row.bad { border-left-color: #dc2626; }
.attn-row .an { font-weight: 600; font-size: 0.85rem; }
.attn-row .as { color: var(--text-muted); font-size: 0.78rem; margin-top: 0.15rem; }
.attn-row .act {
  margin-left: auto; color: var(--primary); font-size: 0.78rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; background: none; border: 0; padding: 0;
}
.attn-row .act:hover { text-decoration: underline; }
@media (max-width: 960px) {
  .fin-strip { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .fin-strip { grid-template-columns: 1fr; }
  .funnel-arrow { display: none; }
}

/* Team & Access (Screen 2) */
.team-toolbar {
  display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.team-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; flex: 1; }
.team-chip {
  font-size: 0.78rem; color: var(--text-muted); border: 1px solid var(--border);
  background: #fff; padding: 0.4rem 0.85rem; border-radius: 20px; cursor: pointer;
}
.team-chip.on { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.team-wrap {
  display: grid; grid-template-columns: 1.55fr 1fr; gap: 1rem; margin-bottom: 1.25rem;
}
.team-drawer {
  background: linear-gradient(180deg, #f8fafc, #fff);
  border: 1px solid var(--border); border-radius: 12px; padding: 1.1rem 1.15rem;
  align-self: start; position: sticky; top: 1rem;
}
.team-drawer-head h4 { margin: 0 0 0.2rem; font-size: 0.95rem; font-weight: 600; }
.team-email { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.team-scope-cell { font-size: 0.82rem; color: var(--text-muted); max-width: 220px; }
.team-scope-list-compact { display: flex; flex-direction: column; gap: 0.25rem; }
.team-scope-row {
  display: flex; justify-content: space-between; gap: 0.75rem;
  font-size: 0.78rem; padding: 0.2rem 0;
}
.scope-yes { color: #059669; font-weight: 700; }
.scope-no { color: #dc2626; font-weight: 700; }
.team-roles-card { margin-top: 0.25rem; }
.team-role-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; margin-top: 0.75rem;
}
.team-role-card {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 0.9rem 1rem;
}
.team-role-title {
  font-weight: 700; font-size: 0.85rem; display: flex; align-items: center; gap: 0.45rem;
  margin-bottom: 0.35rem;
}
.team-role-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.team-role-dot.green { background: #059669; }
.team-role-dot.amber { background: var(--accent); }
.team-role-dot.blue { background: #3b82f6; }
.team-role-card ul {
  margin: 0; padding-left: 1.1rem; color: var(--text-muted); font-size: 0.78rem; line-height: 1.55;
}
.team-lockline {
  color: #b45309; font-size: 0.74rem; font-weight: 600; margin: 0.55rem 0 0; line-height: 1.45;
}
@media (max-width: 960px) {
  .team-wrap { grid-template-columns: 1fr; }
  .team-drawer { position: static; }
  .team-role-grid { grid-template-columns: 1fr; }
}
.map-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 1rem; }
.map-panel { background: #f8fafc; }
.map-confirm-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
@media (max-width: 768px) {
  .map-grid { grid-template-columns: 1fr; }
  .funnel-node { min-width: calc(50% - 6px); }
}

/* Financier portal — white dashboard + white sidebar, purple header only */
.fin-portal {
  --fin-brand: #7c6cf0;
  --fin-header: #4f46a8;
  background: var(--bg);
  color: var(--text);
}
.fin-portal .app-shell { min-height: calc(100vh - 58px); }
.fin-portal .sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 14px rgba(15, 23, 42, 0.05);
  width: 236px;
  color: var(--text);
}
.fin-portal .sidebar-nav .nav-item { color: #64748b; }
.fin-portal .sidebar-nav .nav-item:hover {
  background: #f8fafc;
  color: var(--fin-header);
}
.fin-portal .nav-group-label { color: #94a3b8; }
.fin-portal .sidebar-nav .nav-item.active {
  background: linear-gradient(90deg, rgba(124,108,240,.16), rgba(124,108,240,.04));
  color: var(--fin-header);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--fin-brand);
}
.fin-portal .nav-count {
  margin-left: auto;
  font: 700 0.62rem/1 "Inter", sans-serif;
  color: #fff;
  background: var(--fin-brand);
  padding: 3px 7px;
  border-radius: 10px;
}
.fin-portal .sidebar-footer { border-top: 1px solid var(--border); }
.fin-portal .sidebar-footer .user-name { color: var(--text); }
.fin-portal .sidebar-footer .user-role { color: var(--text-muted); opacity: 1; }
.fin-portal .fin-sidebar-signout { margin-top: 0.6rem; width: 100%; }
.fin-portal .sidebar-close { color: var(--text); }
.fin-portal .main-area,
.fin-portal .content { background: var(--bg); color: var(--text); }
.fin-portal .content { padding: 1.25rem 1.5rem 2rem; }
.fin-portal .btn-primary { background: var(--fin-brand); color: #fff; border: 0; font-weight: 700; }
.fin-portal .btn-outline { color: var(--text); border-color: var(--border); background: #fff; }
.fin-top {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #6356e8, var(--fin-header));
  padding: 0 1.35rem; height: 58px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.fin-brand { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.fin-logo { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, #a89cf5, var(--fin-brand)); display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 0.85rem; }
.fin-brand-name { font-size: 1rem; font-weight: 700; color: #fff; }
.fin-role-badge { font: 700 0.62rem/1 "Inter", sans-serif; letter-spacing: 0.12em; color: #e8e4ff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); padding: 5px 8px; border-radius: 6px; }
.fin-powered { color: rgba(255,255,255,0.55); font-size: 0.68rem; }
.fin-topright { display: flex; align-items: center; gap: 1rem; font-size: 0.82rem; flex-wrap: wrap; }
.fin-topright .fin-date { color: rgba(255,255,255,0.72); }
.fin-topright a { color: #c4b8ff; text-decoration: none; }
.fin-user { display: flex; align-items: center; gap: 0.55rem; padding-left: 1rem; border-left: 1px solid rgba(255,255,255,0.18); }
.fin-avatar { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.72rem; color: #fff; }
.fin-user .n { font-weight: 600; font-size: 0.82rem; color: #fff; }
.fin-user .r { color: rgba(255,255,255,0.6); font-size: 0.68rem; }
.fin-logout { color: rgba(255,255,255,0.78); font-size: 0.82rem; background: none; border: 0; cursor: pointer; font-family: inherit; }
.fin-ctxbar { display: flex; align-items: center; gap: 0.75rem; background: #fff; padding: 0.65rem 1.35rem; border-bottom: 1px solid var(--border); }
.fin-ctxbar .who { font-size: 0.82rem; color: var(--text-muted); }
.fin-eyebrow { color: var(--fin-brand); font: 700 0.68rem/1 "Inter", sans-serif; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 0.25rem; }
.fin-h1 { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.15rem; color: var(--text); }
.fin-lead { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 0.5rem; }
.fin-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.85rem; margin: 1rem 0 0.75rem; }
.fin-kpi { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 1rem; box-shadow: var(--shadow); }
.fin-kpi.sky { background: #f0f9ff; border-color: #bae6fd; }
.fin-kpi.mint { background: #ecfdf5; border-color: #a7f3d0; }
.fin-kpi.amber { background: #fffbeb; border-color: #fde68a; }
.fin-kpi.violet { background: #f5f3ff; border-color: #ddd6fe; }
.fin-kpi.act { border-color: rgba(124,108,240,.45); box-shadow: 0 0 0 1px rgba(124,108,240,.15); }
.fin-kpi.act.violet { background: #ede9fe; border-color: rgba(124,108,240,.55); }
.fin-kpi .v { font-size: 1.45rem; font-weight: 800; color: var(--text); }
.fin-kpi .v.b { color: var(--fin-brand); }
.fin-kpi .v.g { color: #059669; }
.fin-kpi .k { color: var(--text-muted); font-size: 0.78rem; margin-top: 0.15rem; }
.fin-kpi .d { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.35rem; }
.fin-portal .fin-strip .fin-mini { background: #fff; border: 1px solid var(--border); }
.fin-portal .fin-strip .fin-mini.sky { background: #f0f9ff; border-color: #bae6fd; }
.fin-portal .fin-strip .fin-mini.mint { background: #ecfdf5; border-color: #a7f3d0; }
.fin-portal .fin-strip .fin-mini.amber { background: #fffbeb; border-color: #fde68a; }
.fin-portal .fin-strip .fin-mini.rose { background: #fff1f2; border-color: #fecdd3; }
.fin-portal .fin-strip .fin-mini .v { color: var(--text); }
.fin-portal .fin-strip .fin-mini .k { color: var(--text-muted); }
.fin-lower { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; margin-top: 1rem; }
.fin-portal .cname { font-weight: 600; }
.fin-portal .tiny { color: var(--text-muted); font-size: 0.68rem; }
.fin-portal .act-btn { background: var(--fin-brand); color: #fff; border: 0; font-weight: 700; font-size: 0.75rem; padding: 0.4rem 0.75rem; border-radius: 7px; cursor: pointer; }
.fin-portal td.r, .fin-portal th.r { text-align: right; }
.fin-recon-note { margin-top: 0.85rem; padding-top: 0.85rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.75rem; line-height: 1.5; }
.fin-map-top { display: grid; grid-template-columns: 1fr 1.25fr; gap: 1rem; margin-top: 1rem; }
.fin-req .rk { color: var(--text-muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; margin-top: 0.75rem; }
.fin-req .rv { font-size: 0.88rem; font-weight: 600; margin-top: 0.15rem; color: var(--text); }
.fin-req .lock { display: inline-block; margin-left: 0.35rem; font-size: 0.65rem; color: var(--text-muted); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; }
.fin-unit { display: flex; align-items: center; gap: 0.75rem; border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem 0.85rem; margin-top: 0.55rem; background: #f8fafc; cursor: pointer; }
.fin-unit.sel { border-color: var(--fin-brand); box-shadow: 0 0 0 1px rgba(124,108,240,.35); background: rgba(124,108,240,.06); }
.fin-radio { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--text-muted); flex: none; position: relative; }
.fin-unit.sel .fin-radio { border-color: var(--fin-brand); }
.fin-unit.sel .fin-radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--fin-brand); }
.fin-unit .um { font-weight: 600; font-size: 0.82rem; color: var(--text); }
.fin-unit .ud { color: var(--text-muted); font-size: 0.72rem; margin-top: 2px; }
.fin-unit .uc { margin-left: auto; }
.fin-confirm-bar { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; background: rgba(124,108,240,.06); border: 1px solid rgba(124,108,240,.25); border-radius: 12px; padding: 0.85rem 1.1rem; margin-top: 1rem; }
.fin-confirm-bar .ct { font-size: 0.82rem; color: var(--text-muted); flex: 1; min-width: 200px; }
.fin-confirm-bar .ct b { color: var(--text); }
.fin-lane-note { background: rgba(124,108,240,.05); border: 1px dashed rgba(124,108,240,.35); border-radius: 10px; padding: 0.75rem 0.85rem; margin-top: 1rem; }
.fin-lane-note .nt { font-weight: 700; font-size: 0.78rem; color: var(--fin-brand); }
.fin-lane-note .ns { color: var(--text-muted); font-size: 0.75rem; margin-top: 2px; line-height: 1.45; }
.fin-portal .map-panel { background: #f8fafc; border: 1px solid var(--border); }
.fin-pending-banner { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 0.75rem 1rem; margin-bottom: 1rem; font-size: 0.82rem; color: #92400e; }
@media (max-width: 960px) { .fin-kpis, .fin-strip { grid-template-columns: 1fr 1fr; } .fin-lower, .fin-map-top { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .fin-kpis, .fin-strip { grid-template-columns: 1fr; } }

/* Insurer portal — white sidebar + orange header (distinct from financier purple) */
.ins-portal {
  --ins-brand: #ea580c;
  --ins-header: #c2410c;
  background: var(--bg);
  color: var(--text);
}
.ins-portal .app-shell { min-height: calc(100vh - 58px); }
.ins-portal .sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 14px rgba(15, 23, 42, 0.05);
  width: 236px;
  color: var(--text);
}
.ins-portal .sidebar-nav .nav-item { color: #64748b; }
.ins-portal .sidebar-nav .nav-item:hover {
  background: #fff7ed;
  color: var(--ins-brand);
}
.ins-portal .nav-group-label { color: #94a3b8; }
.ins-portal .sidebar-nav .nav-item.active {
  background: #fff7ed;
  color: var(--ins-brand);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--ins-brand);
}
.ins-portal .sidebar-footer { border-top: 1px solid var(--border); }
.ins-portal .sidebar-footer .user-name { color: var(--text); }
.ins-portal .sidebar-footer .user-role { color: var(--text-muted); opacity: 1; }
.ins-portal .ins-sidebar-signout { margin-top: 0.6rem; width: 100%; }
.ins-portal .sidebar-close { color: var(--text); }
.ins-portal .main-area,
.ins-portal .content { background: var(--bg); color: var(--text); }
.ins-portal .content { padding: 1.25rem 1.5rem 2rem; }
.ins-portal .btn-primary { background: var(--ins-brand); color: #fff; border: 0; font-weight: 700; }
.ins-portal .btn-primary:hover { background: var(--ins-header); color: #fff; }
.ins-portal .btn-outline { color: var(--text); border-color: var(--border); background: #fff; }
.ins-portal .fin-eyebrow { color: var(--ins-brand); }
.ins-top {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #f97316, var(--ins-header));
  padding: 0 1.35rem; height: 58px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.ins-brand { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.ins-logo {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, #fdba74, var(--ins-brand));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 0.85rem;
}
.ins-brand-name { font-size: 1rem; font-weight: 700; color: #fff; }
.ins-role-badge {
  font: 700 0.62rem/1 "Inter", sans-serif; letter-spacing: 0.12em;
  color: #ffedd5; background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.28); padding: 5px 8px; border-radius: 6px;
}
.ins-powered { color: rgba(255,255,255,0.55); font-size: 0.68rem; }
.ins-topright { display: flex; align-items: center; gap: 1rem; font-size: 0.82rem; flex-wrap: wrap; }
.ins-user {
  display: flex; align-items: center; gap: 0.55rem; padding-left: 1rem;
  border-left: 1px solid rgba(255,255,255,0.18);
}
.ins-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.72rem; color: #fff;
}
.ins-user .n { font-weight: 600; font-size: 0.82rem; color: #fff; }
.ins-user .r { color: rgba(255,255,255,0.6); font-size: 0.68rem; }
.ins-logout {
  color: rgba(255,255,255,0.78); font-size: 0.82rem;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.ins-ctxbar {
  display: flex; align-items: center; gap: 0.75rem;
  background: #fff; padding: 0.65rem 1.35rem; border-bottom: 1px solid var(--border);
}
.ins-ctxbar .who { font-size: 0.82rem; color: var(--text-muted); }
.ins-portal .fin-strip .fin-mini { background: #fff; border: 1px solid var(--border); }
.ins-portal .fin-kpi { background: #fff; }

/* HR portal — white dashboard, teal header */
.hr-portal {
  --hr-brand: #25b79a;
  --hr-header: #157a68;
  background: var(--bg);
  color: var(--text);
}
.hr-portal .app-shell { min-height: calc(100vh - 58px); }
.hr-portal .sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 14px rgba(15, 23, 42, 0.05);
  width: 236px;
}
.hr-portal .sidebar-nav .nav-item {
  color: #64748b;
}
.hr-portal .sidebar-nav .nav-item:hover {
  background: #f8fafc;
  color: var(--text);
}
.hr-portal .nav-group-label {
  color: #94a3b8;
}
.hr-portal .sidebar-nav .nav-item.active {
  background: linear-gradient(90deg, rgba(37,183,154,.14), rgba(37,183,154,.04));
  color: var(--hr-header);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--hr-brand);
}
.hr-portal .sidebar-footer {
  border-top: 1px solid var(--border);
}
.hr-portal .sidebar-footer .user-name { color: var(--text); }
.hr-portal .sidebar-footer .user-role { color: var(--text-muted); opacity: 1; }
.hr-portal .hr-sidebar-signout { margin-top: 0.6rem; width: 100%; }
.hr-portal .sidebar-close { color: var(--text); }
.hr-portal .nav-count { margin-left: auto; font: 700 0.62rem/1 "Inter", sans-serif; color: #04231d; background: var(--hr-brand); padding: 3px 7px; border-radius: 10px; }
.hr-portal .main-area,
.hr-portal .content { background: var(--bg); color: var(--text); }
.hr-portal .content { padding: 1.25rem 1.5rem 2rem; }
.hr-portal .btn-primary { background: var(--hr-brand); color: #fff; border: 0; font-weight: 700; }
.hr-portal .btn-outline { color: var(--text); border-color: var(--border); background: #fff; }
.hr-top {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #1fa888, var(--hr-header));
  padding: 0 1.35rem; height: 58px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.hr-brand { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.hr-logo { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, #5fd4bc, var(--hr-brand)); display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 0.85rem; }
.hr-brand-name { font-size: 1rem; font-weight: 700; color: #fff; }
.hr-role-badge { font: 700 0.62rem/1 "Inter", sans-serif; letter-spacing: 0.12em; color: #d4fff5; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); padding: 5px 8px; border-radius: 6px; }
.hr-powered { color: rgba(255,255,255,0.55); font-size: 0.68rem; }
.hr-topright { display: flex; align-items: center; gap: 1rem; font-size: 0.82rem; flex-wrap: wrap; }
.hr-topright .hr-date { color: rgba(255,255,255,0.72); }
.hr-topright a { color: #b8f5e8; text-decoration: none; }
.hr-user { display: flex; align-items: center; gap: 0.55rem; padding-left: 1rem; border-left: 1px solid rgba(255,255,255,0.18); }
.hr-avatar { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.72rem; color: #fff; }
.hr-user .n { font-weight: 600; font-size: 0.82rem; color: #fff; }
.hr-user .r { color: rgba(255,255,255,0.6); font-size: 0.68rem; }
.hr-logout { color: rgba(255,255,255,0.78); font-size: 0.82rem; background: none; border: 0; cursor: pointer; font-family: inherit; }
.hr-ctxbar { display: flex; align-items: center; gap: 0.75rem; background: #fff; padding: 0.65rem 1.35rem; border-bottom: 1px solid var(--border); }
.hr-ctxbar .who { font-size: 0.82rem; color: var(--text-muted); }
.hr-ctxbar .who b { color: var(--text); }
.hr-eyebrow { color: var(--hr-brand); font: 700 0.68rem/1 "Inter", sans-serif; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 0.25rem; }
.hr-h1 { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.15rem; color: var(--text); }
.hr-lead { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 0.5rem; }
.hr-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.85rem; margin: 1rem 0 0.75rem; }
.hr-kpi { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 1rem; box-shadow: var(--shadow); }
.hr-kpi.mint { background: #ecfdf5; border-color: #a7f3d0; }
.hr-kpi.sky  { background: #f0f9ff; border-color: #bae6fd; }
.hr-kpi.amber{ background: #fffbeb; border-color: #fde68a; }
.hr-kpi.teal { background: #ecfdf5; border-color: #6ee7b7; }
.hr-kpi.act { border-color: rgba(37,183,154,.45); box-shadow: 0 0 0 1px rgba(37,183,154,.15); }
.hr-kpi.act.teal { background: #d1fae5; border-color: rgba(37,183,154,.55); }
.hr-kpi .v { font-size: 1.55rem; font-weight: 800; color: var(--text); }
.hr-kpi .v.b { color: var(--hr-brand); }
.hr-kpi .k { color: var(--text-muted); font-size: 0.78rem; margin-top: 0.15rem; }
.hr-kpi .d { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.35rem; }
.hr-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; margin-bottom: 1.15rem; }
.hr-mini { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem 0.85rem; }
.hr-mini.teal { background: #ecfdf5; border-color: #a7f3d0; }
.hr-mini.sky  { background: #f0f9ff; border-color: #bae6fd; }
.hr-mini.rose { background: #fff1f2; border-color: #fecdd3; }
.hr-mini .k { color: var(--text-muted); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; }
.hr-mini .v { font-size: 1rem; font-weight: 700; margin-top: 0.3rem; color: var(--text); }
.hr-mini .v.g { color: #059669; }
.hr-funnel { display: flex; align-items: stretch; margin-top: 1rem; flex-wrap: wrap; gap: 4px; }
.hr-fnode { flex: 1; min-width: 72px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 0.65rem 0.35rem; text-align: center; position: relative; }
.hr-fnode.sky   { background: #f0f9ff; border-color: #bae6fd; }
.hr-fnode.amber { background: #fffbeb; border-color: #fde68a; }
.hr-fnode.mint  { background: #ecfdf5; border-color: #a7f3d0; }
.hr-fnode.violet{ background: #f5f3ff; border-color: #ddd6fe; }
.hr-fnode.rose  { background: #fff1f2; border-color: #fecdd3; }
.hr-fnode.navy  { background: #eef2f9; border-color: #c5d4e8; }
.hr-fnode .fv { font-size: 1.15rem; font-weight: 800; color: var(--text); }
.hr-fnode .fl { font-size: 0.62rem; color: var(--text-muted); margin-top: 3px; line-height: 1.25; }
.hr-fnode.mark { border-color: rgba(192,90,84,.55); }
.hr-farr { align-self: center; color: var(--text-muted); padding: 0 4px; font-size: 0.8rem; }
.hr-cbadge { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); font: 800 0.55rem/1 "Inter", sans-serif; color: #fff; background: #c05a54; padding: 4px 7px; border-radius: 20px; white-space: nowrap; }
.hr-lower { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.hr-attn { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.75rem; }
.hr-arow { display: flex; gap: 0.65rem; align-items: flex-start; background: #f8fafc; border: 1px solid var(--border); border-left: 3px solid var(--hr-brand); border-radius: 9px; padding: 0.65rem 0.75rem; }
.hr-arow.bad { border-left-color: #dc2626; }
.hr-arow .an { font-weight: 600; font-size: 0.82rem; color: var(--text); }
.hr-arow .as { color: var(--text-muted); font-size: 0.72rem; margin-top: 2px; }
.hr-arow .act { margin-left: auto; color: var(--hr-brand); font-size: 0.75rem; white-space: nowrap; cursor: pointer; background: none; border: 0; font-family: inherit; font-weight: 600; }
.hr-portal .cname { font-weight: 600; }
.hr-portal .tiny { color: var(--text-muted); font-size: 0.68rem; }
.hr-portal .hr-approve-btn { background: var(--hr-brand); color: #fff; border: 0; font-weight: 700; font-size: 0.75rem; padding: 0.4rem 0.75rem; border-radius: 7px; cursor: pointer; }
.hr-portal .hr-decline-btn { background: #fff; color: var(--text-muted); border: 1px solid var(--border); font-size: 0.75rem; padding: 0.4rem 0.65rem; border-radius: 7px; margin-left: 0.35rem; cursor: pointer; }
.hr-portal td.r, .hr-portal th.r { text-align: right; }
.hr-lane-note { background: rgba(37,183,154,.05); border: 1px dashed rgba(37,183,154,.35); border-radius: 10px; padding: 0.75rem 0.85rem; margin-top: 1rem; }
.hr-lane-note .nt { font-weight: 700; font-size: 0.78rem; color: var(--hr-brand); }
.hr-lane-note .ns { color: var(--text-muted); font-size: 0.75rem; margin-top: 2px; line-height: 1.45; }
@media (max-width: 960px) { .hr-kpis { grid-template-columns: 1fr 1fr; } .hr-strip { grid-template-columns: 1fr; } .hr-lower { grid-template-columns: 1fr; } .hr-farr { display: none; } }
@media (max-width: 640px) { .hr-kpis { grid-template-columns: 1fr; } }

/* Individual client portal — white dashboard, blue header (uses HR layout) */
.ind-portal .hr-top {
  background: linear-gradient(180deg, #2E5BB8, #1e4080);
}
.ind-portal .hr-role-badge { color: #dbeafe; }
.ind-portal .hr-eyebrow { color: #2E5BB8; }
.ind-portal .btn-primary { background: #2E5BB8; color: #fff; }
.ind-portal .nav-count { background: #2E5BB8; color: #fff; }
.ind-portal .sidebar-nav .nav-item.active {
  box-shadow: inset 2px 0 0 #2E5BB8;
  background: linear-gradient(90deg, rgba(46,91,184,.18), rgba(46,91,184,.04));
}

/* Compact tables — full grid on desktop */
@media (min-width: 769px) {
  .table-compact tbody tr.compact-row {
    display: table-row;
    position: static;
    border: 0;
    border-radius: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: default;
  }
  .table-compact tbody tr.compact-row td {
    display: table-cell;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
  }
  .table-compact tbody tr.compact-row td.m-expand { display: none; }
  .table-compact thead { display: table-header-group; }
}

/* Wireframe portals — hide in-content topbar on desktop (custom header above shell) */
@media (min-width: 769px) {
  .fin-portal .topbar,
  .hr-portal .topbar,
  .ins-portal .topbar { display: none; }
}

/* Portal + admin mobile — usable on phones and small tablets */
@media (max-width: 768px) {
  /* Hide duplicate desktop headers; use in-shell topbar for nav */
  .hr-portal .hr-top,
  .fin-portal .fin-top,
  .ins-portal .ins-top { display: none !important; }

  .hr-portal .topbar {
    display: flex;
    align-items: center;
    background: linear-gradient(180deg, #1fa888, #157a68);
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding: 0.55rem 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .fin-portal .topbar {
    display: flex;
    align-items: center;
    background: linear-gradient(180deg, #6356e8, #4f46a8);
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding: 0.55rem 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .ins-portal .topbar {
    display: flex;
    align-items: center;
    background: linear-gradient(180deg, #f97316, #c2410c);
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding: 0.55rem 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .hr-portal .topbar h1,
  .fin-portal .topbar h1,
  .ins-portal .topbar h1 { color: #fff; font-size: 1rem; font-weight: 600; }
  .hr-portal .mobile-menu-btn {
    color: #fff;
    font-size: 1.35rem;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .fin-portal .mobile-menu-btn {
    color: #fff;
    font-size: 1.35rem;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .ins-portal .mobile-menu-btn {
    color: #fff;
    font-size: 1.35rem;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .rep-portal .mobile-menu-btn {
    color: #fff;
    font-size: 1.35rem;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* White drawers on mobile — readable close affordance */
  .admin-console .sidebar,
  .hr-portal .sidebar,
  .fin-portal .sidebar,
  .ins-portal .sidebar,
  .rep-portal .sidebar {
    background: #fff;
  }
  .admin-console .sidebar-close,
  .hr-portal .sidebar-close,
  .fin-portal .sidebar-close,
  .ins-portal .sidebar-close,
  .rep-portal .sidebar-close {
    color: var(--text);
    min-width: 44px;
    min-height: 44px;
  }

  .hr-ctxbar,
  .fin-ctxbar,
  .ins-ctxbar {
    flex-wrap: wrap;
    align-items: stretch;
    padding: 0.65rem 1rem;
    gap: 0.5rem;
    background: #fff;
  }
  .hr-ctxbar .who,
  .fin-ctxbar .who {
    width: 100%;
    flex: none;
    font-size: 0.75rem;
    line-height: 1.35;
  }
  .hr-ctxbar > div[style*="flex:1"],
  .fin-ctxbar > div[style*="flex:1"] { display: none; }
  .hr-ctxbar .btn,
  .fin-ctxbar .btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-height: 44px;
    font-size: 0.82rem;
    padding: 0.55rem 0.75rem;
    text-align: center;
  }

  .hr-portal .content,
  .fin-portal .content { padding: 1rem 1rem 2rem; }
  .hr-portal .app-shell,
  .fin-portal .app-shell { min-height: 0; }
  .hr-h1, .fin-h1 { font-size: 1.05rem; }
  .hr-lead, .fin-lead { font-size: 0.78rem; }

  .hr-portal .hr-arow,
  .fin-portal .fin-confirm-bar { flex-wrap: wrap; }
  .hr-portal .hr-arow .act {
    margin-left: 0;
    margin-top: 0.35rem;
    white-space: normal;
    min-height: 40px;
    padding: 0.4rem 0.85rem;
  }
  .hr-portal .hr-approve-btn,
  .hr-portal .hr-decline-btn { min-height: 40px; }

  .fin-portal .fin-unit {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .fin-portal .fin-unit .uc {
    margin-left: 0;
    width: 100%;
    margin-top: 0.35rem;
  }
  .fin-portal .fin-confirm-bar .btn {
    width: 100%;
    min-height: 44px;
  }
  .fin-portal .act-btn {
    min-height: 40px;
    padding: 0.5rem 0.85rem;
  }

  .admin-console .content { padding: 1rem 1rem 2rem; }
  .admin-console .portfolio-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .admin-console .portfolio-bar .form-control { width: 100%; min-width: 0; }
  .admin-console .portfolio-bar .view-toggle { width: 100%; display: flex; }
  .admin-console .portfolio-bar .view-toggle button { flex: 1; }
  .admin-console .portfolio-bar > a.btn { width: 100%; text-align: center; }
  .admin-console .portfolio-bar > div[style*="flex:1"] { display: none; }
  .admin-console .card { padding: 1rem; margin-bottom: 1rem; }
  .admin-console .attn-row .act { align-self: flex-start; }

  /* Compact expandable tables — 2–3 columns on mobile, tap to expand */
  .table-compact {
    overflow-x: visible;
    border: 0;
    background: transparent;
  }
  .table-compact table {
    min-width: 0 !important;
    width: 100%;
    border: 0;
  }
  .table-compact thead { display: none; }
  .table-compact tbody tr.compact-empty td {
    display: block;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    background: #fff;
    color: var(--text-muted);
  }
  .table-compact tbody tr.compact-row {
    display: block;
    position: relative;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 0.65rem;
    padding: 0.75rem 2.25rem 0.75rem 0.85rem;
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: border-color 0.15s;
  }
  .table-compact tbody tr.compact-row.expanded {
    border-color: rgba(184, 149, 42, 0.45);
  }
  .table-compact tbody tr.compact-row td {
    display: none;
    border: 0;
    padding: 0;
    background: transparent !important;
  }
  .table-compact tbody tr.compact-row td.m-pri {
    display: block;
    padding: 0.12rem 0;
    line-height: 1.35;
  }
  .table-compact tbody tr.compact-row:not(.expanded) td.m-detail,
  .table-compact tbody tr.compact-row:not(.expanded) td.m-actions {
    display: none;
  }
  .table-compact tbody tr.compact-row td.m-pri:first-of-type {
    font-weight: 600;
    font-size: 0.9rem;
  }
  .table-compact tbody tr.compact-row:not(.expanded) td.m-pri:not(:first-of-type) {
    font-size: 0.78rem;
    opacity: 0.9;
    margin-top: 0.08rem;
  }
  .table-compact tbody tr.compact-row td.m-expand {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    padding: 0;
    opacity: 0.7;
  }
  .row-chevron {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s;
  }
  .compact-row.expanded .row-chevron { transform: rotate(45deg); }
  .table-compact tbody tr.compact-row.expanded td.m-detail,
  .table-compact tbody tr.compact-row.expanded td.m-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.45rem 0;
    margin-top: 0.35rem;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
  }
  .table-compact tbody tr.compact-row.expanded td.m-detail::before,
  .table-compact tbody tr.compact-row.expanded td.m-actions::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    flex: 0 0 40%;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .table-compact tbody tr.compact-row.expanded td.m-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .table-compact tbody tr.compact-row.expanded td.m-actions::before { margin-bottom: 0.15rem; }
  .table-compact tbody tr.compact-row.expanded td.m-actions .table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
}
