/* ═══════════════════════════════════════════════════════════════════
   ZippCRM Design System v2.0
   Visual language: Atlas-aligned — structured dark, blue-primary,
   clean borders, sans-serif throughout, enterprise-grade clarity
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* ── Core backgrounds ── */
  --bg:           #07101f;
  --panel:        #0d1c32;
  --panel-strong: #0f2240;
  --bg3:          #122850;

  /* ── Borders ── */
  --line:         rgba(30, 70, 120, 0.55);
  --line-soft:    rgba(30, 70, 120, 0.28);

  /* ── Text ── */
  --text:         #dce8f8;
  --muted:        #7fa8cc;
  --subtle:       #4d7099;

  /* ── Accent palette ── */
  --accent:       #1e6fff;      /* Primary blue */
  --accent-2:     #00d4aa;      /* Teal / success */
  --accent-3:     #f5a623;      /* Amber / warning */
  --danger:       #e8445a;      /* Red / critical */
  --accent-glow:  rgba(30, 111, 255, 0.15);
  --teal-glow:    rgba(0, 212, 170, 0.12);

  /* ── Shadows ── */
  --shadow:       0 20px 60px rgba(2, 8, 20, 0.5);
  --shadow-sm:    0 4px 16px rgba(2, 8, 20, 0.35);

  /* ── Typography ── */
  --sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --serif: 'Inter', 'Segoe UI', system-ui, sans-serif;

  /* ── Radii ── */
  --radius-xs:  6px;
  --radius-sm:  10px;
  --radius:     14px;
  --radius-lg:  18px;
  --radius-xl:  22px;
}

/* ══════════════════════════════════
   BASE RESET
   ══════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Subtle ambient gradient — much less loud than before */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 15% 0%, rgba(30,111,255,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 35% at 90% 100%, rgba(0,212,170,0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ══════════════════════════════════
   AMBIENT ORBS (kept for compat, toned down)
   ══════════════════════════════════ */
.ambient { position: fixed; border-radius: 999px; filter: blur(100px); pointer-events: none; z-index: 0; }
.ambient-one { width: 320px; height: 320px; top: -60px; right: 5%; background: rgba(30,111,255,0.06); opacity: 1; }
.ambient-two { width: 380px; height: 380px; bottom: -80px; left: 0%; background: rgba(0,212,170,0.05); opacity: 1; }

/* ══════════════════════════════════
   AUTH SHELL
   ══════════════════════════════════ */
.auth-shell {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 100;
  background: rgba(4, 10, 22, 0.85);
  backdrop-filter: blur(24px);
}

.auth-card {
  width: min(780px, calc(100vw - 2rem));
  padding: 32px;
  border-radius: var(--radius-xl);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

.auth-card h2 {
  font-size: 26px;
  font-weight: 800;
  color: white;
  margin-bottom: 4px;
}

.auth-help { margin-top: 24px; }

.auth-account-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.auth-account-row {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-soft);
  transition: border-color 0.18s;
}

.auth-account-row:hover { border-color: rgba(30,111,255,0.4); }

.auth-account-row strong {
  display: block;
  font-size: 13px;
  color: white;
  margin-bottom: 3px;
}

.auth-account-row .meta { margin: 0; }

.auth-account-row code {
  color: #7dd4ff;
  font-size: 12px;
}

/* ══════════════════════════════════
   APP SHELL LAYOUT
   ══════════════════════════════════ */
.shell {
  position: relative;
  display: grid;
  grid-template-columns: 268px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.24s ease;
  z-index: 1;
}

.shell.sidebar-collapsed { grid-template-columns: 1fr; }

/* ══════════════════════════════════
   SIDEBAR
   ══════════════════════════════════ */
.sidebar {
  padding: 24px 16px;
  border-right: 1px solid var(--line);
  background: rgba(7, 14, 28, 0.96);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: opacity 0.2s ease, transform 0.24s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.shell.sidebar-collapsed .sidebar {
  position: absolute;
  left: 0; top: 0;
  width: 268px;
  height: 100%;
  opacity: 0;
  transform: translateX(-110%);
  pointer-events: none;
}

/* ── Brand ── */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 0 4px;
}

.brand-mark {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 18px;
  font-weight: 900;
  color: var(--bg);
  background: linear-gradient(135deg, #1e6fff, #00d4aa);
  flex-shrink: 0;
}

.brand h1 {
  font-size: 20px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.brand .eyebrow { margin-bottom: 1px; }

/* ── Nav ── */
.nav {
  display: grid;
  gap: 2px;
  margin-bottom: 24px;
}

.nav-link {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-align: left;
  color: var(--muted);
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
  font-family: var(--sans);
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.nav-link.active {
  color: #7db8ff;
  background: rgba(30,111,255,0.1);
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-link-secondary { font-size: 12.5px; opacity: 0.8; }
.nav-link-secondary.active { opacity: 1; }

/* ── Side panel ── */
.side-panel {
  padding: 14px 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line-soft);
}

.side-panel ul {
  margin: 8px 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

/* ══════════════════════════════════
   MAIN CONTENT AREA
   ══════════════════════════════════ */
.main {
  padding: 24px 28px;
  min-width: 0;
  position: relative;
  z-index: 1;
}

/* ── Top bar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

.topbar h2 {
  font-size: 22px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.topbar-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-tools > .user-menu { margin-left: auto; }

/* ══════════════════════════════════
   TYPOGRAPHY ATOMS
   ══════════════════════════════════ */
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 10px;
  font-weight: 700;
}

/* ── Semantic eyebrow colour modifiers ─────────────────────────────────────
   Usage: class="eyebrow eyebrow--info"  (never use inline style="color:…")
   Each token maps to a single semantic meaning:
     --accent  : primary brand blue  → section / module headings
     --info    : mid blue            → informational / data panels (most common)
     --success : teal                → revenue, positive outcomes
     --warning : amber               → renewals, maker-checker, caution
     --urgent  : soft red            → next-72h, SLA breach
     --danger  : hot red             → penalty engine, risk exposure
     --audit   : purple              → immutable audit trail, governance, library
     --positive: green               → top performers, approved items
     --nav     : sidebar section divider (no colour change, just spacing)
   ──────────────────────────────────────────────────────────────────────── */
.eyebrow--accent  { color: #6eb3ff; }
.eyebrow--info    { color: #7db8ff; }
.eyebrow--success { color: #5dffd9; }
.eyebrow--warning { color: #ffc97a; }
.eyebrow--urgent  { color: #ff8599; }
.eyebrow--danger  { color: #f87171; }
.eyebrow--audit   { color: #b8a0ff; }
.eyebrow--positive{ color: #22c55e; }
.eyebrow--nav       { padding: 0 4px; margin-bottom: 6px; margin-top: 14px; }
.eyebrow--nav-first { margin-top: 4px; }

.meta, .subtle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.section-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ── Headings ── */
.brand h1, .topbar h2, .hero h3, .panel h3 {
  font-family: var(--sans);
  letter-spacing: -0.2px;
}

.panel h3 { font-size: 15px; font-weight: 700; color: white; line-height: 1.2; }

/* ══════════════════════════════════
   BUTTONS
   ══════════════════════════════════ */
.nav-link,
.primary-button,
.ghost-button,
.mini-button {
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: var(--sans);
}

a.ghost-button, a.mini-button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-button {
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13.5px;
  color: white;
  background: var(--accent);
  letter-spacing: 0.1px;
}

.primary-button:hover { background: #3b82ff; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(30,111,255,0.4); }

.ghost-button {
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line-soft);
}

.ghost-button:hover { color: var(--text); background: rgba(255,255,255,0.1); border-color: var(--line); }

.ghost-button.workspace-active {
  color: #7db8ff;
  background: rgba(30,111,255,0.12);
  border-color: rgba(30,111,255,0.4);
}

.mini-button {
  padding: 7px 13px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line-soft);
}

.secondary-button {
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line-soft);
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: var(--sans);
}

.secondary-button:hover {
  color: var(--text);
  background: rgba(255,255,255,0.1);
  border-color: var(--line);
}

.mini-button:hover { color: var(--text); background: rgba(255,255,255,0.1); }
.mini-button[disabled] { cursor: not-allowed; opacity: 0.4; }

.danger-button {
  color: #ffd4db;
  background: rgba(180,40,64,0.35);
  border: 1px solid rgba(232,68,90,0.4);
}

.danger-button:hover { background: rgba(180,40,64,0.55); }

.circular-refresh-button {
  width: 38px; height: 38px;
  padding: 0;
  border-radius: 999px;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.lane-add-button {
  width: 38px; height: 38px;
  border-radius: 999px;
  border: 1px dashed rgba(30,111,255,0.45);
  background: rgba(30,111,255,0.07);
  color: #7db8ff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.18s;
}

.lane-add-button:hover { background: rgba(30,111,255,0.15); border-color: rgba(30,111,255,0.7); }

/* ══════════════════════════════════
   PANELS & CARDS
   ══════════════════════════════════ */
.side-panel, .panel, .flash {
  background: var(--panel);
  border: 1px solid var(--line);
}

.panel {
  padding: 18px 20px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.panel-head .meta { margin-top: 4px; max-width: 42rem; }

.detail-panel {
  background: linear-gradient(180deg, #0d1e35 0%, #09182c 100%);
}

.atlas-panel { min-height: calc(100vh - 160px); }

.atlas-frame {
  width: 100%;
  min-height: calc(100vh - 260px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.01);
}

.card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(13,30,53,0.8);
  border: 1px solid var(--line);
  transition: border-color 0.18s;
}

.card:hover { border-color: rgba(30,111,255,0.35); }

/* ── Flash / notification bar ── */
.flash {
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  display: none;
}

.flash:not(.hidden) { display: block; }
.flash.error { border-color: rgba(232,68,90,0.4); background: rgba(120,24,45,0.18); color: #ffd0d8; }

/* ══════════════════════════════════
   HERO SECTIONS
   ══════════════════════════════════ */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  margin-bottom: 16px;
  border-radius: var(--radius-xl);
}

.hero h3 {
  max-width: 760px;
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 800;
  line-height: 1.25;
  color: white;
}

.compliance-hero { align-items: flex-start; }

.assignment-hero {
  padding: 18px 22px;
  align-items: flex-start;
}

.assignment-hero > div { max-width: 980px; }
.assignment-hero .eyebrow { margin-bottom: 6px; }
.assignment-hero h3 { max-width: 980px; margin: 0 0 8px; font-size: clamp(18px, 2vw, 22px); line-height: 1.22; }
.assignment-hero .meta { max-width: 920px; margin: 0; line-height: 1.7; }

/* ══════════════════════════════════
   GRID LAYOUTS
   ══════════════════════════════════ */
.content-grid,
.projects-layout,
.regulator-grid,
.detail-columns {
  display: grid;
  gap: 14px;
}

.regulator-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 14px;
}

.content-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  margin-bottom: 14px;
}

.projects-layout {
  grid-template-columns: minmax(340px, 440px) 1fr;
  transition: grid-template-columns 0.24s ease;
}

.projects-layout.list-collapsed,
.projects-layout.detail-expanded { grid-template-columns: 1fr; }

.projects-layout.list-collapsed #project-list-panel,
.projects-layout.detail-expanded #project-list-panel { display: none; }

#project-detail-panel { transition: transform 0.2s ease, min-width 0.2s ease; }

.workspace-toolbar { margin-bottom: 14px; }

/* ══════════════════════════════════
   SEARCH INPUT
   ══════════════════════════════════ */
input[type="search"] {
  min-width: 240px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  padding: 9px 14px;
  font-size: 13px;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.18s;
}

input[type="search"]:focus { border-color: rgba(30,111,255,0.55); }
input[type="search"]::placeholder { color: var(--subtle); }

/* ══════════════════════════════════
   USER MENU
   ══════════════════════════════════ */
.user-menu { position: relative; }

.user-menu-trigger {
  width: 38px; height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s;
}

.user-menu-trigger:hover { background: rgba(255,255,255,0.1); border-color: rgba(30,111,255,0.5); outline: none; }

.user-menu-avatar {
  width: 28px; height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-size: 11px;
  font-weight: 800;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  padding: 8px;
  border-radius: var(--radius-lg);
  background: #0a1928;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 6px;
  z-index: 50;
}

.user-menu-summary {
  padding: 4px 4px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.user-menu-summary strong,
.user-menu-summary .meta { display: block; }
.user-menu-summary .meta { margin-top: 2px; font-size: 12px; }

.user-menu-item {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: all 0.18s;
}

.user-menu-item:hover { background: rgba(255,255,255,0.08); color: white; }

/* ══════════════════════════════════
   FORMS
   ══════════════════════════════════ */
.crud-form {
  display: grid;
  gap: 10px;
}

.crud-form input,
.crud-form select,
.crud-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  padding: 10px 13px;
  font: 13px/1.4 var(--sans);
  outline: none;
  transition: border-color 0.18s, background 0.18s;
  -webkit-appearance: none;
}

.crud-form input:focus,
.crud-form select:focus,
.crud-form textarea:focus {
  border-color: rgba(30,111,255,0.55);
  background: rgba(30,111,255,0.05);
}

.crud-form input::placeholder,
.crud-form textarea::placeholder { color: var(--subtle); }

.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.crud-form textarea { min-height: 88px; resize: vertical; }

.crud-form select[multiple] {
  min-height: 136px;
  padding-block: 8px;
}

/* ══════════════════════════════════
   GENERIC FORM CONTROL (dark-themed)
   Used by selects and date inputs outside .crud-form
   ══════════════════════════════════ */
.form-control {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  padding: 7px 11px;
  font: 13px/1.4 var(--sans);
  outline: none;
  transition: border-color 0.18s, background 0.18s;
  -webkit-appearance: none;
  appearance: none;
}
.form-control:focus {
  border-color: rgba(30,111,255,0.55);
  background: rgba(30,111,255,0.05);
}

/* Native date / time / month inputs — force dark-mode chrome */
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"] {
  color-scheme: dark;
}
.form-control[type="date"],
.form-control[type="time"],
.form-control[type="datetime-local"] {
  color-scheme: dark;
  min-width: 140px;
}

.field-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  width: 100%;
  position: relative;
  min-height: 16px;
}

.field-help span { flex: 1; padding-right: 0; }

.field-label {
  display: block;
  margin: 2px 0 -2px;
  color: #aac6e8;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.form-status {
  order: -1;
  padding: 10px 13px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.form-status.error {
  border-color: rgba(232,68,90,0.4);
  background: rgba(120,24,45,0.2);
  color: #ffd0d8;
}

.form-status.success {
  border-color: rgba(0,212,170,0.35);
  background: rgba(0,100,80,0.15);
  color: #d0fff4;
}

/* ── Nav info chips (sit at far-right of nav buttons) ── */
.nav-info-chip {
  margin-left: auto;
  flex-shrink: 0;
  pointer-events: all;
}
.nav-info-chip::after {
  right: -8px;
  left: auto;
  bottom: calc(100% + 6px);
  width: 240px;
}

/* ── Help chips (tooltip) ── */
.help-chip {
  position: relative;
  width: 15px; height: 15px;
  border: 1px solid rgba(30,111,255,0.35);
  border-radius: 999px;
  background: rgba(30,111,255,0.08);
  color: #7db8ff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  padding: 0;
  z-index: 2;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  vertical-align: middle;
}

.help-chip::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: 220px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #06111f;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s;
  z-index: 100;
}

.help-chip:hover::after, .help-chip:focus-visible::after { opacity: 1; }

/* ══════════════════════════════════
   BILLING COMPONENTS
   ══════════════════════════════════ */

/* ── Tile selector ──────────────────────────────────────────────────────── */
.billing-tile-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}

.billing-tile {
  --tile-clr: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 8px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 2px solid var(--line-soft);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  text-align: center;
  user-select: none;
}

/* Hide the native checkbox — the tile IS the interactive element */
.billing-tile input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.billing-tile:hover {
  border-color: var(--tile-clr);
  background: rgba(255,255,255,0.06);
}

.billing-tile.selected {
  border-color: var(--tile-clr);
  background: color-mix(in srgb, var(--tile-clr) 14%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tile-clr) 22%, transparent),
              0 4px 16px color-mix(in srgb, var(--tile-clr) 18%, transparent);
}

.billing-tile-icon {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 2px;
  color: var(--muted);
  transition: color 0.15s;
}
.billing-tile.selected .billing-tile-icon,
.billing-tile:hover    .billing-tile-icon { color: var(--tile-clr); }

.billing-tile-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.billing-tile-desc {
  font-size: 9.5px;
  color: var(--muted);
  line-height: 1.3;
}

/* Checkmark badge — visible only when selected */
.billing-tile-check {
  position: absolute;
  top: 7px; right: 7px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--tile-clr);
  color: #000;
  font-size: 9px;
  font-weight: 900;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.billing-tile.selected .billing-tile-check { display: flex; }

/* Subtitle shown on tile after popup data is saved */
.billing-tile-summary {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.billing-tile.selected .billing-tile-summary {
  color: var(--tile-clr, var(--accent));
  opacity: 1;
}
/* "Click to edit" hint — shown as a top-right badge, not overlapping summary */
.billing-tile.selected::before {
  content: "✎ edit";
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 9px;
  color: var(--tile-clr, var(--accent));
  opacity: 0.55;
  font-style: italic;
  letter-spacing: 0.03em;
  pointer-events: none;
}

/* ── Detail cards ───────────────────────────────────────────────────────── */
.billing-detail-container { display: grid; gap: 12px; }

.billing-detail-toolbar {
  display: flex;
  justify-content: flex-end;
}

.billing-detail-empty {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
  border: 1px dashed var(--line-soft);
  font-size: 13px;
}

.billing-detail-grid { display: grid; gap: 14px; }

.billing-summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.billing-summary-card {
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border-left: 3px solid var(--tile-clr, var(--accent));
  border-top: 1px solid color-mix(in srgb, var(--tile-clr, var(--accent)) 20%, transparent);
  border-right: 1px solid color-mix(in srgb, var(--tile-clr, var(--accent)) 10%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--tile-clr, var(--accent)) 10%, transparent);
}

.billing-summary-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.billing-summary-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.billing-summary-copy {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.billing-summary-amount {
  color: var(--tile-clr, var(--accent));
  font-size: 15px;
  font-weight: 800;
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.billing-detail-card {
  --tile-clr: var(--accent);
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-soft);
  border-top: 3px solid var(--tile-clr);
}

.billing-detail-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.billing-detail-card-icon {
  font-size: 22px;
  color: var(--tile-clr);
  flex-shrink: 0;
}

.billing-detail-card-desc {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.billing-modal-box {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.billing-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

/* Billing form: label-above-input stacked layout (single column) */
.billing-detail-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px 0;
}

/* Labels get a top margin to separate groups */
.billing-detail-fields .field-label {
  margin-top: 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(170,198,232,0.7);
}

.billing-detail-fields .field-label:first-child { margin-top: 0; }

/* All inputs, selects, textareas inside billing cards get dark styling */
.billing-detail-fields input,
.billing-detail-fields select,
.billing-detail-fields textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font: 13px/1.4 var(--sans);
  outline: none;
  transition: border-color 0.18s, background 0.18s;
  -webkit-appearance: none;
  appearance: none;
  color-scheme: dark;
  margin-bottom: 6px;
}

.billing-detail-fields input:focus,
.billing-detail-fields select:focus,
.billing-detail-fields textarea:focus {
  border-color: var(--tile-clr, rgba(30,111,255,0.6));
  background: rgba(30,111,255,0.07);
}

.billing-detail-fields input::placeholder,
.billing-detail-fields textarea::placeholder { color: rgba(255,255,255,0.28); }

.billing-detail-fields textarea { min-height: 68px; resize: vertical; }

/* Two-column layout for pairs of short fields (numbers) on wider cards */
@media (min-width: 480px) {
  .billing-detail-fields {
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
  }
  /* Full-width for text, textarea, select */
  .billing-detail-fields textarea,
  .billing-detail-fields input[type="text"],
  .billing-detail-fields select,
  .billing-detail-fields label:has(+ textarea),
  .billing-detail-fields label:has(+ input[type="text"]),
  .billing-detail-fields label:has(+ select) {
    grid-column: 1 / -1;
  }
  /* Month inputs also full-width (dates are wide) */
  .billing-detail-fields input[type="month"],
  .billing-detail-fields input[type="date"],
  .billing-detail-fields label:has(+ input[type="month"]),
  .billing-detail-fields label:has(+ input[type="date"]) {
    grid-column: 1 / -1;
  }
  .billing-summary-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ══════════════════════════════════
   STACK LISTS & CARD ROWS
   ══════════════════════════════════ */
.stack-list,
.project-list,
.assignment-list,
.lead-list { display: grid; gap: 8px; }

.project-list, .assignment-list, .lead-list { gap: 10px; }

.project-card,
.assignment-card,
.lead-card,
.list-row,
.checklist-row,
.doc-row,
.liaison-row,
.billing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: rgba(13,28,53,0.7);
  border: 1px solid var(--line);
  transition: border-color 0.18s, background 0.18s;
}

.project-card:hover,
.assignment-card:hover,
.lead-card:hover,
.list-row:hover { border-color: rgba(30,111,255,0.4); background: rgba(16,34,65,0.8); }

.lead-card, .project-card, .assignment-card {
  min-height: 120px;
  text-align: left;
  align-items: flex-start;
  cursor: pointer;
}

.lead-card > div:first-child,
.project-card > div:first-child,
.assignment-card > div:first-child { flex: 1; min-width: 0; }

.lead-card > div:last-child,
.project-card > div:last-child,
.assignment-card > div:last-child { min-width: 120px; text-align: right; flex-shrink: 0; }

.project-card strong,
.assignment-card strong,
.lead-card strong,
.list-row strong,
.project-detail strong,
.card strong {
  color: white;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.project-card.active {
  border-color: rgba(30,111,255,0.55);
  background: rgba(30,111,255,0.08);
}

.assignment-card.active,
.lead-card.active {
  border-color: rgba(30,111,255,0.55);
  background: rgba(30,111,255,0.08);
}

/* ══════════════════════════════════
   KPI ROW — always one line, scroll if needed
   ══════════════════════════════════ */
.kpi-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 12px;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
  -webkit-overflow-scrolling: touch;
}
.kpi-row > div {
  flex: 1 1 0;
  min-width: 130px;
  max-width: 240px;
}
.kpi-row::-webkit-scrollbar { height: 4px; }
.kpi-row::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }
.kpi-row::-webkit-scrollbar-track { background: transparent; }

/* ══════════════════════════════════
   STATUS & METRIC PILLS
   ══════════════════════════════════ */
.metric-strip, .pipeline-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.metric-pill,
.pipeline-pill,
.stage-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.metric-pill, .pipeline-pill, .status-pill {
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--line-soft);
  color: var(--muted);
}

.stage-pill {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line-soft);
  color: var(--muted);
}

.stage-pill.active {
  background: rgba(30,111,255,0.14);
  border-color: rgba(30,111,255,0.45);
  color: #7db8ff;
}

.stage-pill.blocked {
  background: rgba(232,68,90,0.12);
  border-color: rgba(232,68,90,0.35);
  color: #ff8599;
}

/* ─── Status badges ─── */
.priority-critical,
.status-pending {
  color: #ffd4db;
  background: rgba(163,33,60,0.25);
  border: 1px solid rgba(232,68,90,0.35);
}

.priority-high,
.status-expiring {
  color: #ffd9a0;
  background: rgba(146,83,18,0.25);
  border: 1px solid rgba(245,166,35,0.35);
}

.priority-medium,
.status-in_review {
  color: #b0f5e0;
  background: rgba(0,120,90,0.2);
  border: 1px solid rgba(0,212,170,0.3);
}

.status-verified,
.status-approved,
.status-paid,
.status-ready {
  color: #b0f5e0;
  background: rgba(0,140,100,0.2);
  border: 1px solid rgba(0,212,170,0.35);
}

.status-submitted,
.status-assigned {
  color: #b8d8ff;
  background: rgba(30,111,255,0.15);
  border: 1px solid rgba(30,111,255,0.3);
}

.status-rejected,
.status-blocked,
.status-overdue {
  color: #ffd4db;
  background: rgba(163,33,60,0.22);
  border: 1px solid rgba(232,68,90,0.3);
}

.status-in_progress,
.status-wip {
  color: #b0f5e0;
  background: rgba(0,120,90,0.18);
  border: 1px solid rgba(0,212,170,0.28);
}

.status-done,
.status-closed {
  color: #c8ffed;
  background: rgba(0,140,100,0.22);
  border: 1px solid rgba(0,212,170,0.3);
}

.status-awaiting,
.status-awaited,
.status-locked,
.status-open {
  color: var(--muted);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line-soft);
}

/* SLA traffic light pills — new in v2 */
.sla-green {
  color: #b0f5e0;
  background: rgba(0,140,100,0.18);
  border: 1px solid rgba(0,212,170,0.3);
}

.sla-amber {
  color: #ffd9a0;
  background: rgba(146,83,18,0.22);
  border: 1px solid rgba(245,166,35,0.35);
}

.sla-red {
  color: #ffd4db;
  background: rgba(163,33,60,0.22);
  border: 1px solid rgba(232,68,90,0.35);
}

/* ══════════════════════════════════
   INLINE ACTIONS & ALLOCATION FORMS
   ══════════════════════════════════ */
.inline-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.inline-allocation-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-allocation-form select,
.inline-allocation-form input {
  min-width: 110px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  padding: 7px 10px;
  font: 13px var(--sans);
  outline: none;
}

/* ══════════════════════════════════
   PROCESS STRIPS & GUIDE GRIDS
   ══════════════════════════════════ */
.process-strip, .guide-grid { display: grid; gap: 12px; }

.process-strip { grid-template-columns: repeat(3, 1fr); margin-bottom: 14px; }
.guide-grid { grid-template-columns: repeat(4, 1fr); }
.compliance-guide { margin-bottom: 14px; }

.process-card, .guide-card {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: rgba(13,28,53,0.7);
  border: 1px solid var(--line);
}

.process-card h4, .guide-card strong { margin: 0 0 6px; color: white; font-size: 13px; }

/* ══════════════════════════════════
   AI CHAT
   ══════════════════════════════════ */
.ai-chat-history { min-height: 320px; margin-bottom: 14px; }
.ai-draft-card h4 { margin: 0 0 12px; font-size: 14px; font-weight: 700; color: white; }
.ai-draft-card .metric-strip { margin-bottom: 4px; }

.code-block {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'SFMono-Regular', 'Menlo', 'Monaco', monospace;
  font-size: 12px;
  color: var(--text);
}

.ai-chat-row { align-items: flex-start; }
.ai-chat-row strong { display: block; margin-bottom: 5px; color: white; }

#assignments-view { display: grid; gap: 14px; align-content: start; }

/* ══════════════════════════════════
   ADMIN CONSOLE
   ══════════════════════════════════ */
.admin-console-intro {
  padding: 20px 24px;
  margin-bottom: 14px;
  border-radius: var(--radius-xl);
  background: linear-gradient(160deg, rgba(18,36,65,0.98) 0%, rgba(11,22,42,0.96) 100%);
  border: 1px solid var(--line);
}

.admin-console-intro-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.admin-console-intro .meta { max-width: 58rem; margin-top: 8px; }

.admin-console-metrics {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 10px;
  margin-top: 14px;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.admin-console-metrics > .admin-metric-card {
  flex: 1 1 0;
  min-width: 130px;
}

.admin-metric-card {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-soft);
}

.admin-metric-card strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  line-height: 1.1;
  color: white;
}

.admin-segmented {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  padding: 4px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

.admin-segmented-button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--sans);
  cursor: pointer;
  transition: all 0.18s;
}

.admin-segmented-button.active {
  background: rgba(30,111,255,0.15);
  border: 1px solid rgba(30,111,255,0.35);
  color: #7db8ff;
}

.admin-console-grid { display: grid; gap: 14px; margin-bottom: 14px; }
.admin-console-grid-three { grid-template-columns: repeat(3, 1fr); }
.admin-console-grid-two { grid-template-columns: repeat(2, 1fr); }
.admin-console-grid-one { grid-template-columns: 1fr; }

.admin-panel { padding: 16px 18px; }
.admin-panel .panel-head .meta { margin-top: 5px; max-width: 42rem; }

#compliance-admin-desk { margin-bottom: 14px; }

.admin-create-wrap {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line-soft);
}

.admin-inline-metrics { display: flex; align-items: center; gap: 6px; }
.admin-panel-catalog .stack-list { gap: 10px; }

.admin-catalog-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: rgba(13,28,53,0.7);
  border: 1px solid var(--line);
  transition: border-color 0.18s;
}

.admin-catalog-card:hover { border-color: rgba(30,111,255,0.4); }

.admin-catalog-main { display: grid; gap: 5px; min-width: 0; flex: 1; }

.admin-catalog-side {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 6px;
  min-width: 140px;
}

.admin-pill-row, .admin-inline-meta { display: flex; flex-wrap: wrap; gap: 5px; }

.admin-workflow-card { display: grid; gap: 12px; }
.admin-task-master-list { margin-top: 2px; }
.admin-panel-catalog { min-width: 0; }

/* ── Phase 2 data tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead tr {
  border-bottom: 1px solid var(--line);
}

.data-table th {
  padding: 9px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(30, 70, 120, 0.18);
  vertical-align: middle;
  color: var(--text);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td { background: rgba(255,255,255,0.02); }

.data-table td[colspan] {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 24px;
}

.admin-data-table {
  display: grid;
  gap: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}

.admin-data-head,
.admin-data-row {
  display: grid;
  grid-template-columns: 1.5fr 1.55fr 1fr 1.1fr 0.8fr;
  gap: 14px;
  align-items: center;
}

.admin-data-head {
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.admin-data-row {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(30,70,120,0.2);
  transition: background 0.15s;
}

.admin-data-row:hover { background: rgba(255,255,255,0.02); }
.admin-data-row:last-child { border-bottom: none; }
.admin-data-row strong { display: block; margin-bottom: 3px; }

.admin-task-template-card,
.admin-task-template-add {
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line-soft);
}

.admin-role-modal-panel {
  width: min(980px, 100%);
  max-height: calc(100vh - 5rem);
  overflow: auto;
}

.admin-role-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.admin-role-modal-head strong { display: block; font-size: 17px; margin-bottom: 5px; }
.admin-role-permission-form { display: grid; gap: 14px; margin-top: 14px; }

.admin-role-permission-table {
  display: grid;
  gap: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}

.admin-role-permission-head,
.admin-role-permission-row {
  display: grid;
  grid-template-columns: 1.8fr 0.4fr 0.4fr;
  gap: 14px;
  align-items: center;
  padding: 11px 14px;
}

.admin-role-permission-head {
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.admin-role-permission-row { border-bottom: 1px solid rgba(30,70,120,0.2); }
.admin-role-permission-row:last-child { border-bottom: none; }

.admin-role-permission-row input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  justify-self: center;
}

/* ══════════════════════════════════
   PROJECT DETAIL
   ══════════════════════════════════ */
.project-detail { min-height: 720px; }

.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.project-header h3 {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 5px;
  color: white;
}

.stage-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

.detail-columns { grid-template-columns: 1.35fr 1fr; gap: 16px; }
.project-workboard-section { margin-bottom: 16px; }
.detail-stack { display: grid; gap: 14px; }

.project-detail .card { padding: 16px 18px; }
.project-detail .crud-form { gap: 12px; }

.project-detail .crud-form input,
.project-detail .crud-form select,
.project-detail .crud-form textarea {
  background: rgba(255,255,255,0.06);
  border-color: rgba(30,111,255,0.25);
}

.project-detail .crud-form input::placeholder,
.project-detail .crud-form textarea::placeholder { color: var(--subtle); }

.project-task-card { padding: 14px 16px; }

.task-subsection {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line-soft);
}

.task-entry-panel {
  background: rgba(30,111,255,0.06);
  border-color: rgba(30,111,255,0.2);
}

.task-summary-panel {
  background: rgba(0,212,170,0.04);
  border-color: rgba(0,212,170,0.15);
}

/* ── Workline modules ── */
.workline-module {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-xl);
  background: rgba(13,28,53,0.6);
  border: 1px solid var(--line);
}

/* ── Pill tab bar (used by DPDP, Client Queries, and other views) ─── */
.tabs-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 8px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--line);
  color: var(--text);
}

.tab-btn.active {
  background: rgba(30,111,255,0.14);
  border-color: rgba(30,111,255,0.45);
  color: #7db8ff;
  font-weight: 700;
}

.workline-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.workline-tab {
  padding: 8px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--sans);
  cursor: pointer;
  transition: all 0.18s;
}

.workline-tab.active {
  background: rgba(30,111,255,0.12);
  border-color: rgba(30,111,255,0.4);
  color: #7db8ff;
}

.workline-module .panel-head { margin-bottom: 12px; }

.workline-module-details {
  background: rgba(0,212,170,0.04);
  border-color: rgba(0,212,170,0.18);
}

.workline-module-ownership { background: rgba(255,255,255,0.03); }

.workline-module-timesheets {
  background: rgba(30,111,255,0.04);
  border-color: rgba(30,111,255,0.15);
}

.workline-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.workline-summary-item {
  padding: 11px 13px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-soft);
}

.workline-summary-item strong { display: block; margin-top: 3px; font-size: 14px; color: white; }

.project-task-modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}

.project-task-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Generic modal overlay (Phase 2 modals) ── */
/* ── Generic modal shell (modal-shell / modal-head / modal-close) ── */
.modal-shell {
  background: linear-gradient(160deg, #0d1f3c 0%, #091626 100%);
  border: 1px solid rgba(30, 111, 255, 0.2);
  border-radius: 16px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.modal-head .modal-close {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 5px 9px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.modal-head .modal-close:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text);
}

/* ── crud-form inside modal-shell: proper padding and row pairing ── */
.modal-shell .crud-form {
  padding: 20px 22px 22px;
  gap: 0;
}

.modal-shell .crud-form .field-label {
  margin: 14px 0 5px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(170,198,232,0.75);
}

.modal-shell .crud-form .field-label:first-child { margin-top: 0; }

.modal-shell .crud-form input,
.modal-shell .crud-form select,
.modal-shell .crud-form textarea {
  padding: 9px 12px;
  font-size: 13px;
}

.modal-shell .crud-form textarea {
  min-height: 72px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 22, 0.78);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-box {
  background: linear-gradient(160deg, #0d1f3c 0%, #091626 100%);
  border: 1px solid rgba(30, 111, 255, 0.2);
  border-radius: 16px;
  padding: 28px 32px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}

.modal-box h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

/* ── Task layer modal ── */
.task-layer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4,10,22,0.75);
  backdrop-filter: blur(8px);
  z-index: 90;
}

.task-layer-shell {
  position: fixed;
  inset: 0;
  z-index: 91;
  display: grid;
  place-items: center;
  padding: 28px;
  pointer-events: none;
}

.task-layer-panel {
  width: min(1100px, 100%);
  max-height: calc(100vh - 56px);
  overflow: auto;
  pointer-events: auto;
  border-radius: 24px;
}

.task-layer-panel .project-task-card {
  margin-top: 0;
  background: linear-gradient(180deg, #0f2040 0%, #091828 100%);
  border: 1px solid rgba(30,111,255,0.25);
  box-shadow: 0 28px 80px rgba(0,0,0,0.5);
  padding: 18px 20px 22px;
}

.project-stage-stack { display: grid; gap: 12px; }

.project-stage-section {
  padding: 14px 16px;
  border-radius: var(--radius-xl);
  background: rgba(13,28,53,0.6);
  border: 1px solid var(--line);
}

.project-stage-body, .project-kanban-stack { display: grid; gap: 10px; }

.project-stage-header { display: flex; align-items: center; }

.project-stage-task-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-soft);
  transition: border-color 0.18s;
}

.project-stage-task-row:hover { border-color: rgba(30,111,255,0.35); }
.project-stage-task-row strong { display: block; margin-bottom: 5px; font-size: 13.5px; }

.project-stage-task-row .inline-actions { justify-content: flex-end; flex-wrap: wrap; }
.project-task-card { margin-top: 5px; }

.project-stage-add-row { margin-top: 6px; display: grid; justify-items: start; }

.project-task-lane-form {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line-soft);
}

.project-stage-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.project-lane-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.project-task-lane-form textarea { min-height: 92px; }

/* ── Dashboard overrides ── */
#dashboard-view .card,
#dashboard-view .panel {
  background: linear-gradient(160deg, #0d1e35 0%, #091828 100%);
}

#dashboard-view .regulator-grid .card {
  min-height: 140px;
  display: grid;
  align-content: start;
  gap: 5px;
}

#dashboard-view .regulator-grid .card h3 {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.18;
  color: white;
}

#dashboard-view .list-row { min-height: 80px; align-items: flex-start; }
#dashboard-view .metric-strip { margin-bottom: 4px; }

/* ── Lead detail ── */
#lead-detail .card:first-child,
#lead-detail .card:last-child { position: relative; }

/* ══════════════════════════════════
   LIBRARY (REGULATORY)
   ══════════════════════════════════ */
.library-row { display: flex; align-items: flex-start; gap: 12px; }
.library-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 6px;
  min-width: 140px;
}

#library-view .panel-head .meta { margin-top: 6px; max-width: 36rem; }

/* ══════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════ */
.empty-state {
  display: grid;
  place-items: center;
  color: var(--muted);
  padding: 48px 20px;
  text-align: center;
  font-size: 13px;
}

/* ══════════════════════════════════
   VISIBILITY HELPERS
   ══════════════════════════════════ */
.hidden, .view { display: none !important; }
.view.active { display: block !important; }

/* ══════════════════════════════════
   CLIENT ROLE — NAV ISOLATION
   Applied via body[data-user-role="client"] set in setCurrentUser().
   CSS is the primary enforcement layer — faster and not subject to JS
   timing or re-render bugs. JS class-toggles are a secondary fallback.
   WHITELIST approach: hide ALL nav items, then explicitly show the
   small set that clients are permitted to see.
   ══════════════════════════════════ */
body[data-user-role="client"] .nav-link {
  display: none !important;
}
/* Client-permitted nav items (whitelist — everything else stays hidden) */
body[data-user-role="client"] .nav-link[data-view="client-portal"],
body[data-user-role="client"] .nav-link[data-view="projects"],
body[data-user-role="client"] .nav-link[data-view="assignments"],
body[data-user-role="client"] .nav-link[data-view="kanban"],
body[data-user-role="client"] .nav-link[data-view="gantt"],
body[data-user-role="client"] .nav-link[data-view="inbound-email"],
body[data-user-role="client"] .nav-link[data-view="bom-tracker"],
body[data-user-role="client"] .nav-link[data-view="risk-alerts"],
body[data-user-role="client"] .nav-link[data-role-show="client"] {
  display: block !important;
}
/* Hide all sidebar section eyebrow headers for clients */
body[data-user-role="client"] .eyebrow--nav {
  display: none !important;
}
/* Sidebar compliance principles panel is internal — hide for clients */
body[data-user-role="client"] .side-panel {
  display: none !important;
}

/* ── CLIENT READ-ONLY ENFORCEMENT ───────────────────────────────────────────
   Clients can view shared views but cannot create, edit, or delete.
   Primary action buttons (btn-primary) represent write operations.
   Forms inside these views are staff-only entry points.
   ─────────────────────────────────────────────────────────────────────────── */
body[data-user-role="client"] #kanban-view .btn-primary,
body[data-user-role="client"] #kanban-view [data-action="add-task"],
body[data-user-role="client"] #kanban-view [data-action="create"],
body[data-user-role="client"] #gantt-view .btn-primary,
body[data-user-role="client"] #inbound-email-view .btn-primary,
body[data-user-role="client"] #inbound-email-view form,
body[data-user-role="client"] #bom-tracker-view .btn-primary,
body[data-user-role="client"] #bom-tracker-view [data-action="add"],
body[data-user-role="client"] #risk-alerts-view .btn-primary {
  display: none !important;
}

/* View-only banner shown inside shared views when user is a client */
body[data-user-role="client"] #kanban-view::before,
body[data-user-role="client"] #gantt-view::before,
body[data-user-role="client"] #inbound-email-view::before,
body[data-user-role="client"] #bom-tracker-view::before,
body[data-user-role="client"] #risk-alerts-view::before {
  content: "👁 View Only — data shown is scoped to your projects";
  display: block;
  background: rgba(0, 212, 170, 0.08);
  border: 1px solid rgba(0, 212, 170, 0.25);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.78rem;
  color: #00d4aa;
  margin-bottom: 16px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* ══════════════════════════════════
   DASHBOARD HEADER METRIC CHIPS
   ══════════════════════════════════ */
#dashboard-header-metrics .metric-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

#dashboard-header-metrics .metric-chip .val {
  font-size: 22px;
  font-weight: 800;
  color: white;
  line-height: 1;
}

#dashboard-header-metrics .metric-chip .lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  font-weight: 700;
}

/* ── Regulator tag pills ── */
.reg-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.reg-rbi  { background: rgba(30,111,255,0.15); color: #7db8ff; border: 1px solid rgba(30,111,255,0.3); }
.reg-sebi { background: rgba(0,212,170,0.12);  color: #5dffd9; border: 1px solid rgba(0,212,170,0.28); }
.reg-irdai{ background: rgba(245,166,35,0.12); color: #ffc97a; border: 1px solid rgba(245,166,35,0.28); }
.reg-mca  { background: rgba(180,80,255,0.12); color: #d4a0ff; border: 1px solid rgba(180,80,255,0.28); }

/* ══════════════════════════════════
   SECTION DIVIDERS IN DETAIL PANELS
   ══════════════════════════════════ */
.detail-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-block: 8px 12px;
}

.detail-section-head h4 {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  flex-shrink: 0;
}

.detail-section-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

/* ══════════════════════════════════
   SCROLLBAR STYLING
   ══════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(30,70,120,0.5); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(30,111,255,0.5); }

/* ══════════════════════════════════
   FOCUS RING ACCESSIBILITY
   ══════════════════════════════════ */
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid rgba(30,111,255,0.7);
  outline-offset: 2px;
}

/* ══════════════════════════════════
   SELECTION COLOR
   ══════════════════════════════════ */
::selection { background: rgba(30,111,255,0.3); color: white; }

/* ══════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════ */
@media (max-width: 980px) {
  .shell,
  .projects-layout,
  .detail-columns,
  .admin-console-grid-three,
  .admin-console-grid-two { grid-template-columns: 1fr; }

  .process-strip,
  .guide-grid { grid-template-columns: 1fr; }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
    position: static;
    height: auto;
    overflow: visible;
  }

  .topbar,
  .hero,
  .project-header,
  .panel-head { flex-direction: column; align-items: flex-start; }

  .topbar-tools,
  input[type="search"] { width: 100%; }

  .topbar-tools > .user-menu { margin-left: 0; }

  .admin-catalog-card { flex-direction: column; }
  .admin-catalog-side { min-width: 0; justify-content: flex-start; }
  .admin-segmented { width: 100%; flex-wrap: wrap; }
  .admin-data-head { display: none; }
  .admin-data-row { grid-template-columns: 1fr; gap: 6px; }
}

/* ══════════════════════════════════
   GENERIC BADGE SYSTEM  (badge-*)
   Used by automation, SLA, returns tracker
   ══════════════════════════════════ */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-success {
  color: #b0f5e0;
  background: rgba(0,140,100,0.2);
  border: 1px solid rgba(0,212,170,0.35);
}

.badge-danger {
  color: #ffd4db;
  background: rgba(163,33,60,0.25);
  border: 1px solid rgba(232,68,90,0.35);
}

/* softer red — overdue (past due but not yet breached) */
.badge-danger-light {
  color: #ffb8a0;
  background: rgba(200,80,20,0.2);
  border: 1px solid rgba(249,115,22,0.35);
}

.badge-warning {
  color: #ffd9a0;
  background: rgba(146,83,18,0.25);
  border: 1px solid rgba(245,166,35,0.38);
}

.badge-neutral {
  color: var(--text-muted, #8b9bb4);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
}

.badge-info {
  color: #b8d8ff;
  background: rgba(30,111,255,0.15);
  border: 1px solid rgba(30,111,255,0.3);
}

/* Deal Detail side panel — hidden state must override the flex layout */
.deal-detail-panel--hidden {
  display: none !important;
}

/* Hide Manual Entry button for client role — backend enforces this too */
body[data-user-role="client"] #inbound-manual-entry-btn {
  display: none !important;
}

/* Nav badge — critical alert count pill on sidebar items */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  background: #e74c3c;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  line-height: 1;
  vertical-align: middle;
  letter-spacing: 0;
}
