/* ═══════════════════════════════════════════════════════════════════
   ZippCRM Design System v3  ·  Linear + Stripe hybrid
   Visual language: dark sidebar, clean content, precision typography,
   flat surfaces, 8px grid, no glow / no gradients.

   Load order: <link rel="stylesheet" href="./styles.css" />
               <link rel="stylesheet" href="./design-system.css" />

   This file overrides the foundational layer (tokens, shell, nav,
   core components). View-specific styles in styles.css are preserved.
   ═══════════════════════════════════════════════════════════════════ */

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

/* ══════════════════════════════════════════════════════════════════
   1. DESIGN TOKENS
   ══════════════════════════════════════════════════════════════════ */
:root {
  /* ── Sidebar (permanently dark, never themed) ── */
  --sb-bg:          #0b0f18;
  --sb-border:      rgba(255,255,255,0.06);
  --sb-text-hi:     #d4d8e0;
  --sb-text-lo:     #5f6980;
  --sb-text-dim:    #2e3648;
  --sb-active-bg:   rgba(30,111,255,0.11);
  --sb-active-line: #1e6fff;
  --sb-hover-bg:    rgba(255,255,255,0.035);
  --sb-width:       192px;

  /* ── Content area — dark mode (default) ── */
  /* Backgrounds */
  --bg:           #0f1117;    /* page canvas     — was #07101f (muddy navy) */
  --panel:        #161b22;    /* card / panel    — was #0d1c32 */
  --panel-strong: #1c2230;    /* elevated card   — was #0f2240 */
  --bg3:          #222836;    /* deep tray       — was #122850 */

  /* Borders — neutral, not blue-tinted */
  --line:         rgba(255,255,255,0.09);   /* was rgba(30,70,120,0.55) */
  --line-soft:    rgba(255,255,255,0.055);  /* was rgba(30,70,120,0.28) */

  /* Text — neutral white, not blue-cast */
  --text:         #e8eaed;   /* was #dce8f8 */
  --muted:        #8b9198;   /* was #7fa8cc */
  --subtle:       #4a5568;   /* was #4d7099 */

  /* ── Accent ── */
  --accent:       #1e6fff;
  --accent-h:     #3b82f6;
  --accent-sub:   rgba(30,111,255,0.09);
  --accent-bd:    rgba(30,111,255,0.22);
  --accent-2:     #22c55e;   /* success / green  — was #00d4aa */
  --accent-3:     #f59e0b;   /* warning / amber  — was #f5a623 */
  --danger:       #ef4444;   /* critical / red   — was #e8445a */
  --accent-glow:  rgba(30,111,255,0.07);   /* halved — used sparingly */
  --teal-glow:    rgba(34,197,94,0.06);

  /* ── Urgency semantic tokens ── */
  --red:          #ef4444;
  --red-sub:      rgba(239,68,68,0.09);
  --red-text:     #f87171;
  --red-bd:       rgba(239,68,68,0.2);

  --amber:        #f59e0b;
  --amber-sub:    rgba(245,158,11,0.09);
  --amber-text:   #fbbf24;
  --amber-bd:     rgba(245,158,11,0.2);

  --green:        #22c55e;
  --green-sub:    rgba(34,197,94,0.09);
  --green-text:   #4ade80;
  --green-bd:     rgba(34,197,94,0.2);

  /* ── Regulator palette ── */
  --rbi:          #3b82f6;
  --rbi-sub:      rgba(59,130,246,0.1);
  --rbi-bd:       rgba(59,130,246,0.22);

  --sebi:         #a78bfa;
  --sebi-sub:     rgba(167,139,250,0.1);
  --sebi-bd:      rgba(167,139,250,0.22);

  --irdai:        #34d399;
  --irdai-sub:    rgba(52,211,153,0.1);
  --irdai-bd:     rgba(52,211,153,0.22);

  --mca:          #fbbf24;
  --mca-sub:      rgba(251,191,36,0.1);
  --mca-bd:       rgba(251,191,36,0.22);

  /* ── Shadows — flat, not dramatic ── */
  --shadow:    0 4px 20px rgba(0,0,0,0.22);
  --shadow-sm: 0 2px 8px  rgba(0,0,0,0.14);

  /* ── Typography ── */
  --sans:   'Inter', system-ui, -apple-system, sans-serif;
  --serif:  'Inter', system-ui, sans-serif;
  --mono:   'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  /* ── Type scale (px) ── */
  --ts-xs:   10px;
  --ts-sm:   11px;
  --ts-base: 13px;
  --ts-md:   14px;
  --ts-lg:   16px;
  --ts-xl:   20px;
  --ts-2xl:  24px;

  /* ── Spacing — 8px grid ── */
  --sp1:  4px;
  --sp2:  8px;
  --sp3:  12px;
  --sp4:  16px;
  --sp5:  20px;
  --sp6:  24px;
  --sp8:  32px;
  --sp10: 40px;

  /* ── Radius — rectangular, not pill ── */
  --radius-xs: 4px;   /* chips, badges */
  --radius-sm: 6px;   /* buttons, inputs */
  --radius:    8px;   /* cards, panels */
  --radius-lg: 10px;  /* modals */
  --radius-xl: 12px;  /* large sheets */

  /* ── Layout ── */
  --topbar-h: 48px;
  --trans:    120ms ease;

  /* ── Windows <select> fix (keep) ── */
  --select-opt-bg:          #1c2230;
  --select-opt-text:        #e8eaed;
  --select-opt-bg-active:   #1e6fff;
  --select-opt-text-active: #ffffff;
}

/* ── Light mode (triggered by JS toggle: document.documentElement.dataset.theme = 'light') ── */
[data-theme="light"] {
  --bg:           #ffffff;
  --panel:        #f7f8fa;
  --panel-strong: #f0f2f5;
  --bg3:          #e4e7ec;
  --line:         rgba(0,0,0,0.09);
  --line-soft:    rgba(0,0,0,0.055);
  --text:         #0d1117;
  --muted:        #6b7280;
  --subtle:       #9ca3af;
  --red-text:     #dc2626;
  --amber-text:   #b45309;
  --green-text:   #16a34a;
  --rbi:          #2563eb;
  --sebi:         #7c3aed;
  --irdai:        #059669;
  --mca:          #d97706;
  --select-opt-bg:   #f7f8fa;
  --select-opt-text: #0d1117;
}

/* ══════════════════════════════════════════════════════════════════
   2. RESET + BASE
   ══════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--sans);
  font-size: var(--ts-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

/* Kill the old ambient glow orbs */
.ambient,
body::before { display: none !important; }

/* ══════════════════════════════════════════════════════════════════
   3. SHELL LAYOUT
   ══════════════════════════════════════════════════════════════════ */
.shell {
  display: flex;
  min-height: 100vh;
  /* override old grid layout */
  grid-template-columns: unset;
  transition: none;
}

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

/* ══════════════════════════════════════════════════════════════════
   4. SIDEBAR
   ══════════════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sb-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sb-bg);
  border-right: 0.5px solid var(--sb-border);
  overflow: hidden;
  z-index: 200;
  /* override old styles */
  padding: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  opacity: 1;
  transform: none;
  transition: transform var(--trans);
}

/* Collapsed: slide out */
.shell.sidebar-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sb-width)));
  opacity: 1; /* override old opacity:0 */
  pointer-events: none;
}

/* ── Brand / Logo ── */
.brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--sp2);
  padding: 0 var(--sp4);
  border-bottom: 0.5px solid var(--sb-border);
  flex-shrink: 0;
  margin-bottom: 0; /* override old 28px */
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  /* override old gradient */
  background-image: none;
  letter-spacing: 0;
}

.brand h1 {
  font-size: var(--ts-base);
  font-weight: 600;
  color: var(--sb-text-hi);
  letter-spacing: 0;
  line-height: 1.2;
}

.brand .eyebrow {
  font-size: 9px;
  color: var(--sb-text-dim);
  margin-bottom: 1px;
  letter-spacing: 0.04em;
  font-weight: 500;
}

/* ── Nav container ── */
.nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp2) 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.07) transparent;
  /* override old display:grid gap:2px margin-bottom */
  margin-bottom: 0;
}

.nav::-webkit-scrollbar { width: 3px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 3px; }

/* ── Nav section labels ── */
.eyebrow--nav {
  font-size: 9px;
  font-weight: 600;
  color: var(--sb-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--sp3) var(--sp4) var(--sp1);
  margin: 0; /* override old margin-top:14px */
  display: block;
  pointer-events: none;
  line-height: 1;
}

.eyebrow--nav-first { padding-top: var(--sp2); }

/* ── Nav item ── */
.nav-link {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 5px var(--sp4) 5px calc(var(--sp4) - 2px);
  border: none;
  border-left: 2px solid transparent;
  border-radius: 0; /* kill old border-radius-sm */
  background: transparent;
  color: var(--sb-text-lo);
  font-size: var(--ts-sm);
  font-family: var(--sans);
  font-weight: 400;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--trans), color var(--trans);
  gap: var(--sp2);
  line-height: 1.5;
  /* override old padding: 10px 12px */
}

.nav-link:hover {
  background: var(--sb-hover-bg);
  color: var(--sb-text-hi);
  transform: none; /* override any transform from old styles */
  box-shadow: none;
}

.nav-link.active {
  background: var(--sb-active-bg);
  border-left-color: var(--sb-active-line);
  color: #c8d4f0;
  font-weight: 500;
  /* override old active color */
}

.nav-link-secondary { font-size: var(--ts-sm); opacity: 0.9; }
.nav-link-secondary.active { opacity: 1; }

/* ── Nav icon spans — zero out inline margin-right / opacity set in HTML ── */
.nav-link > span:first-child {
  flex-shrink: 0;
  margin-right: 0 !important;  /* inline style cleanup */
  opacity: 0.55;
  font-size: 13px;
  line-height: 1;
}

/* Nav badge */
.nav-badge,
span[id$="-badge"] {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px !important;
  margin-left: auto;
  background: var(--red) !important;
  color: #fff !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  border-radius: var(--radius-xs) !important;  /* rectangular, not pill */
  line-height: 1;
  flex-shrink: 0;
  vertical-align: unset !important;
}

/* Hide old compliance principles panel */
.side-panel { display: none !important; }

/* ── Sidebar user strip (bottom) ── */
.sidebar-user-strip {
  padding: var(--sp2) var(--sp4);
  border-top: 0.5px solid var(--sb-border);
  display: flex;
  align-items: center;
  gap: var(--sp2);
  flex-shrink: 0;
}

.sidebar-user-strip .user-avatar-sm {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(30,111,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: #7aadff;
  flex-shrink: 0;
}

.sidebar-user-strip .user-name {
  font-size: 10px;
  color: var(--sb-text-lo);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* ══════════════════════════════════════════════════════════════════
   5. MAIN CONTENT AREA
   ══════════════════════════════════════════════════════════════════ */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sb-width);
  padding: 0; /* override old padding:24px 28px — views own their padding */
  transition: margin-left var(--trans);
}

.shell.sidebar-collapsed .main {
  margin-left: 0;
}

/* ══════════════════════════════════════════════════════════════════
   6. TOPBAR
   ══════════════════════════════════════════════════════════════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 var(--sp6);
  gap: var(--sp3);
  background: var(--bg);
  border-bottom: 0.5px solid var(--line-soft);
  flex-shrink: 0;
  /* override old: margin-bottom, padding-bottom, border-bottom style */
  margin-bottom: 0;
  padding-bottom: 0;
  flex-wrap: nowrap;
}

.topbar-left {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--sp2);
}

.topbar-title,
.topbar h2 {
  font-size: var(--ts-md);
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  letter-spacing: 0;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* override old: 22px / font-weight:800 */
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  flex-wrap: nowrap;
}

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

/* ══════════════════════════════════════════════════════════════════
   7. VIEWS
   ══════════════════════════════════════════════════════════════════ */
.view {
  display: none;
  flex: 1;
  padding: var(--sp5) var(--sp6);
}

.view.active {
  display: block;
}

.view.hidden {
  display: none !important;
}

/* Projects view gets no top-level padding — its own workspace manages layout */
#projects-view.view.active {
  padding: 0;
}

/* ══════════════════════════════════════════════════════════════════
   8. TYPOGRAPHY
   ══════════════════════════════════════════════════════════════════ */
.eyebrow {
  font-size: var(--ts-xs);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  line-height: 1;
  margin: 0 0 var(--sp1);
}

/* Eyebrow colour modifiers (semantic) */
.eyebrow--accent  { color: var(--accent); }
.eyebrow--info    { color: #60a5fa; }
.eyebrow--success { color: var(--green-text); }
.eyebrow--warning { color: var(--amber-text); }
.eyebrow--urgent  { color: #fb7185; }
.eyebrow--danger  { color: var(--red-text); }
.eyebrow--audit   { color: #c084fc; }
.eyebrow--positive{ color: var(--green-text); }

h1 { font-size: var(--ts-2xl); font-weight: 600; color: var(--text); line-height: 1.2; letter-spacing: -0.3px; }
h2 { font-size: var(--ts-xl);  font-weight: 600; color: var(--text); line-height: 1.25; letter-spacing: -0.2px; }
h3 { font-size: var(--ts-lg);  font-weight: 600; color: var(--text); line-height: 1.3; }
h4 { font-size: var(--ts-md);  font-weight: 600; color: var(--text); }
h5 { font-size: var(--ts-base);font-weight: 600; color: var(--text); }

p  { color: var(--muted); line-height: 1.6; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.section-title {
  font-size: var(--ts-sm);
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--sp3);
}

/* ══════════════════════════════════════════════════════════════════
   9. BUTTONS  (rectangular, not pill)
   ══════════════════════════════════════════════════════════════════ */
button, .btn {
  font-family: var(--sans);
  cursor: pointer;
  transition: background var(--trans), border-color var(--trans), color var(--trans), opacity var(--trans);
  white-space: nowrap;
  border: none;
}

.primary-button, button.primary-button {
  display: inline-flex;
  align-items: center;
  gap: var(--sp2);
  height: 32px;
  padding: 0 var(--sp4);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--ts-base);
  font-weight: 500;
  font-family: var(--sans);
  letter-spacing: 0;
  /* override old: padding:10px 20px, border-radius:999px, font-weight:700 */
}

.primary-button:hover {
  background: var(--accent-h);
  transform: none; /* kill old translateY(-1px) */
  box-shadow: none;
}

.primary-button:active { opacity: 0.9; }
.primary-button:disabled { opacity: 0.45; cursor: not-allowed; }

.secondary-button, button.secondary-button {
  display: inline-flex;
  align-items: center;
  gap: var(--sp2);
  height: 32px;
  padding: 0 var(--sp3);
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: var(--ts-base);
  font-weight: 500;
  font-family: var(--sans);
  /* override old: padding:10px 20px, border-radius:999px */
}

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

.ghost-button, button.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: var(--sp2);
  height: 30px;
  padding: 0 var(--sp3);
  background: transparent;
  color: var(--muted);
  border: 0.5px solid var(--line-soft);
  border-radius: var(--radius-sm);
  font-size: var(--ts-sm);
  font-weight: 500;
  font-family: var(--sans);
  /* override old: padding:9px 16px, border-radius:999px, font-weight:600 */
}

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

.ghost-button.workspace-active {
  color: var(--accent);
  border-color: var(--accent-bd);
  background: var(--accent-sub);
}

.mini-button, button.mini-button {
  display: inline-flex;
  align-items: center;
  gap: var(--sp1);
  height: 26px;
  padding: 0 var(--sp3);
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  border: 0.5px solid var(--line-soft);
  border-radius: var(--radius-sm);
  font-size: var(--ts-sm);
  font-weight: 500;
  font-family: var(--sans);
  cursor: pointer;
}

.mini-button:hover {
  background: rgba(255,255,255,0.09);
  color: var(--text);
}

.mini-button[disabled] { cursor: not-allowed; opacity: 0.4; }

.danger-button, button.danger-button {
  display: inline-flex;
  align-items: center;
  gap: var(--sp2);
  height: 32px;
  padding: 0 var(--sp4);
  background: rgba(239,68,68,0.1);
  color: var(--red-text);
  border: 0.5px solid var(--red-bd);
  border-radius: var(--radius-sm);
  font-size: var(--ts-base);
  font-weight: 500;
  font-family: var(--sans);
}

.danger-button:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/* Icon action buttons (table rows) */
.icon-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--line);
  background: transparent;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--trans), border-color var(--trans);
  color: var(--muted);
}

.icon-action-btn:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text);
  transform: none;
}

.icon-action-btn--danger:hover  { background: rgba(239,68,68,0.12);  color: var(--red-text);   border-color: var(--red-bd); }
.icon-action-btn--warn:hover    { background: rgba(245,158,11,0.1);  color: var(--amber-text); border-color: var(--amber-bd); }
.icon-action-btn--success:hover { background: rgba(34,197,94,0.1);   color: var(--green-text); border-color: var(--green-bd); }

/* Misc buttons */
.circular-refresh-button {
  width: 30px; height: 30px;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: grid;
  place-items: center;
}

.lane-add-button {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 0.5px dashed var(--accent-bd);
  background: var(--accent-sub);
  color: var(--accent);
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

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

/* ══════════════════════════════════════════════════════════════════
   10. SEARCH INPUT (topbar)
   ══════════════════════════════════════════════════════════════════ */
#search,
input[type="search"] {
  height: 30px;
  padding: 0 var(--sp3);
  background: rgba(255,255,255,0.05);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: var(--ts-sm);
  color: var(--text);
  font-family: var(--sans);
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
  /* override old: border-radius:999px */
}

#search { min-width: 180px; }

#search:focus,
input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-sub);
}

#search::placeholder,
input[type="search"]::placeholder { color: var(--subtle); }

/* ══════════════════════════════════════════════════════════════════
   11. FORM CONTROLS
   ══════════════════════════════════════════════════════════════════ */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
textarea {
  width: 100%;
  padding: 7px var(--sp3);
  background: rgba(255,255,255,0.04);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: var(--ts-base);
  font-family: var(--sans);
  color: var(--text);
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
  appearance: none;
}

.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="tel"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-sub);
}

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

select {
  width: 100%;
  padding: 7px var(--sp8) 7px var(--sp3);
  background: rgba(255,255,255,0.04);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: var(--ts-base);
  font-family: var(--sans);
  color: var(--text);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%235f6980' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  transition: border-color var(--trans);
  cursor: pointer;
}

select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-sub); }
select option { background: var(--select-opt-bg); color: var(--select-opt-text); }
select option:checked { background: var(--select-opt-bg-active); color: var(--select-opt-text-active); }

.field-label, .form-label, label {
  display: block;
  font-size: var(--ts-sm);
  font-weight: 500;
  color: var(--muted);
  margin-bottom: var(--sp1);
  line-height: 1.4;
}

.field-help { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--sp4); }

.help-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 0.5px solid var(--line);
  font-size: 9px;
  color: var(--muted);
  cursor: help;
  flex-shrink: 0;
}

.crud-form { display: flex; flex-direction: column; gap: var(--sp4); }

.field-label.required::after { content: ' *'; color: var(--red-text); }

/* ══════════════════════════════════════════════════════════════════
   12. PANELS & CARDS
   ══════════════════════════════════════════════════════════════════ */
.panel, .flash {
  background: var(--panel);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  /* override old: padding:18px 20px, box-shadow:var(--shadow-sm), border-radius:var(--radius-xl) */
  padding: 0;
  box-shadow: none;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp3) var(--sp4);
  border-bottom: 0.5px solid var(--line-soft);
  gap: var(--sp3);
  /* override old margin-bottom:14px */
  margin-bottom: 0;
}

.panel-head h3, .panel-head h2 {
  font-size: var(--ts-base);
  font-weight: 600;
  color: var(--text);
  /* override old: white, 15px */
}

.panel-head .meta { margin-top: 0; }

.panel-body { padding: var(--sp4); }

.card {
  background: var(--panel);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp4);
  transition: border-color var(--trans);
}

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

.detail-panel {
  background: var(--panel);
  background-image: none; /* kill old gradient */
}

/* Flash / notification */
.flash {
  padding: var(--sp3) var(--sp4);
  margin-bottom: var(--sp4);
  border-radius: var(--radius);
  display: none;
}

.flash:not(.hidden) { display: block; }
.flash.error { border-color: var(--red-bd); background: rgba(239,68,68,0.08); color: var(--red-text); }

/* Hero sections */
.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp4);
  margin-bottom: var(--sp5);
  padding: 0;
  flex-wrap: wrap;
  /* override old: padding:20px 24px, border-radius */
  background: transparent;
  border: none;
}

.hero h3 {
  font-size: var(--ts-xl);
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  /* override old: clamp(18px,2vw,24px), font-weight:800 */
}

.assignment-hero { padding: 0; align-items: flex-start; }
.assignment-hero h3 { font-size: var(--ts-xl); line-height: 1.25; margin-bottom: var(--sp3); }

/* ══════════════════════════════════════════════════════════════════
   13. TABLES
   ══════════════════════════════════════════════════════════════════ */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ts-base);
}

thead { background: var(--panel-strong); }

th {
  padding: 8px var(--sp4);
  font-size: var(--ts-xs);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  border-bottom: 0.5px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 9px var(--sp4);
  color: var(--muted);
  border-bottom: 0.5px solid var(--line-soft);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background var(--trans);
  cursor: pointer;
}

tbody tr:hover { background: var(--panel-strong); }

/* First column — primary text */
td:first-child { color: var(--text); font-weight: 500; }

/* ══════════════════════════════════════════════════════════════════
   14. MODAL
   ══════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp5);
  /* override old: display:none — kept as inline style toggle */
}

.modal-shell {
  background: var(--panel);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0,0,0,0.3);
  /* override old: border-radius:var(--radius-xl) */
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp4) var(--sp5);
  border-bottom: 0.5px solid var(--line-soft);
}

.modal-head h3 {
  font-size: var(--ts-md);
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 0.5px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--trans);
  /* override old: often has implicit styles */
}

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

/* ══════════════════════════════════════════════════════════════════
   15. BADGE / PILL SYSTEM
   ══════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-xs); /* rectangular, not pill — override 999px */
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.5;
}

.badge-success {
  background: var(--green-sub);
  color: var(--green-text);
  border: 0.5px solid var(--green-bd);
}

.badge-danger {
  background: var(--red-sub);
  color: var(--red-text);
  border: 0.5px solid var(--red-bd);
}

.badge-danger-light {
  background: rgba(234,88,12,0.09);
  color: #fb923c;
  border: 0.5px solid rgba(234,88,12,0.2);
}

.badge-warning {
  background: var(--amber-sub);
  color: var(--amber-text);
  border: 0.5px solid var(--amber-bd);
}

.badge-neutral {
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  border: 0.5px solid var(--line);
}

.badge-info {
  background: var(--accent-sub);
  color: var(--accent);
  border: 0.5px solid var(--accent-bd);
}

/* Regulator badges */
.badge-rbi   { background: var(--rbi-sub);   color: var(--rbi);   border: 0.5px solid var(--rbi-bd); }
.badge-sebi  { background: var(--sebi-sub);  color: var(--sebi);  border: 0.5px solid var(--sebi-bd); }
.badge-irdai { background: var(--irdai-sub); color: var(--irdai); border: 0.5px solid var(--irdai-bd); }
.badge-mca   { background: var(--mca-sub);   color: var(--mca);   border: 0.5px solid var(--mca-bd); }

/* SLA chips */
.sla-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.sla-chip-red    { background: var(--red-sub);   color: var(--red-text);   border: 0.5px solid var(--red-bd); }
.sla-chip-amber  { background: var(--amber-sub);  color: var(--amber-text); border: 0.5px solid var(--amber-bd); }
.sla-chip-green  { background: var(--green-sub);  color: var(--green-text); border: 0.5px solid var(--green-bd); }

/* Status dots */
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-dot-red   { background: var(--red); }
.status-dot-amber { background: var(--amber); }
.status-dot-green { background: var(--green); }
.status-dot-gray  { background: var(--subtle); }

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

.user-menu-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 0.5px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color var(--trans);
  padding: 0;
  /* override old: width:38px, height:38px */
}

.user-menu-trigger:hover { border-color: var(--accent-bd); }

.user-menu-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-sub);
  color: var(--accent);
  font-size: var(--ts-xs);
  font-weight: 600;
  /* override old: gradient */
  background-image: none;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + var(--sp2));
  right: 0;
  width: 200px;
  background: var(--panel);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  z-index: 500;
  overflow: hidden;
}

.user-menu-dropdown.hidden { display: none; }

.user-menu-summary {
  padding: var(--sp3) var(--sp4);
  border-bottom: 0.5px solid var(--line-soft);
}

.user-menu-summary strong { display: block; font-size: var(--ts-base); color: var(--text); font-weight: 600; }
.user-menu-summary .meta  { font-size: var(--ts-sm); color: var(--muted); margin-top: 2px; }

.user-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: var(--sp2) var(--sp4);
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: var(--ts-sm);
  font-family: var(--sans);
  cursor: pointer;
  text-align: left;
  transition: background var(--trans);
  gap: var(--sp2);
}

.user-menu-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }

/* ══════════════════════════════════════════════════════════════════
   17. COMMAND PALETTE
   ══════════════════════════════════════════════════════════════════ */
#cmd-palette {
  background: var(--panel) !important;
  border: 0.5px solid var(--line) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 16px 48px rgba(0,0,0,0.35) !important;
}

#cmd-input {
  color: var(--text) !important;
  background: transparent !important;
  font-family: var(--sans) !important;
}

/* ══════════════════════════════════════════════════════════════════
   18. AUTH SHELL
   ══════════════════════════════════════════════════════════════════ */
.auth-shell {
  background: rgba(7,10,18,0.88);
  backdrop-filter: blur(20px);
}

.auth-card {
  background: var(--panel);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.auth-card h2 { font-size: var(--ts-2xl); font-weight: 700; }

.auth-account-row {
  border: 0.5px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
}

.auth-account-row:hover { border-color: var(--accent-bd); }

/* ══════════════════════════════════════════════════════════════════
   19. SETUP BANNER
   ══════════════════════════════════════════════════════════════════ */
#setup-banner {
  background: var(--accent);
  color: #fff;
  padding: 9px var(--sp6);
  font-size: var(--ts-sm);
  display: flex;
  align-items: center;
  gap: var(--sp3);
}

/* ══════════════════════════════════════════════════════════════════
   20. GRID LAYOUTS (content)
   ══════════════════════════════════════════════════════════════════ */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--sp3);
  margin-bottom: var(--sp4);
}

.regulator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp3);
  margin-bottom: var(--sp4);
}

.detail-columns {
  display: grid;
  gap: var(--sp3);
}

/* ══════════════════════════════════════════════════════════════════
   21. TABS (segmented control)
   ══════════════════════════════════════════════════════════════════ */
.tab-group {
  display: flex;
  border: 0.5px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: fit-content;
}

.tab-btn {
  padding: 5px var(--sp4);
  background: transparent;
  border: none;
  border-right: 0.5px solid var(--line-soft);
  font-size: var(--ts-sm);
  font-family: var(--sans);
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--trans), color var(--trans);
}

.tab-btn:last-child { border-right: none; }
.tab-btn:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.tab-btn.active { background: var(--accent-sub); color: var(--accent); }

/* ══════════════════════════════════════════════════════════════════
   22. DROP ZONE (file upload)
   ══════════════════════════════════════════════════════════════════ */
.drop-zone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: var(--sp8) var(--sp6);
  text-align: center;
  color: var(--muted);
  font-size: var(--ts-sm);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: border-color var(--trans), background var(--trans);
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-sub);
  color: var(--accent);
}

/* ══════════════════════════════════════════════════════════════════
   23. ALERT BARS
   ══════════════════════════════════════════════════════════════════ */
.alert-bar {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  padding: var(--sp3) var(--sp4);
  border-radius: var(--radius-sm);
  font-size: var(--ts-sm);
}

.alert-bar-info    { background: var(--accent-sub); color: var(--accent);     border: 0.5px solid var(--accent-bd); }
.alert-bar-warning { background: var(--amber-sub);  color: var(--amber-text); border: 0.5px solid var(--amber-bd); }
.alert-bar-danger  { background: var(--red-sub);    color: var(--red-text);   border: 0.5px solid var(--red-bd); }
.alert-bar-success { background: var(--green-sub);  color: var(--green-text); border: 0.5px solid var(--green-bd); }

/* ══════════════════════════════════════════════════════════════════
   24. SCROLLBARS
   ══════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ══════════════════════════════════════════════════════════════════
   25. UTILITY CLASSES
   ══════════════════════════════════════════════════════════════════ */
.hidden       { display: none !important; }
.sr-only      { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.muted        { color: var(--muted); }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.text-danger  { color: var(--red-text); }
.text-success { color: var(--green-text); }
.text-warning { color: var(--amber-text); }
.text-accent  { color: var(--accent); }
.w-full       { width: 100%; }

/* ══════════════════════════════════════════════════════════════════
   26. DARK MODE THEME TOGGLE
   ══════════════════════════════════════════════════════════════════ */
#theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--sp1);
  height: 28px;
  padding: 0 var(--sp3);
  background: rgba(255,255,255,0.06);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: var(--ts-xs);
  font-weight: 500;
  font-family: var(--sans);
  color: var(--muted);
  cursor: pointer;
  transition: background var(--trans);
}

#theme-toggle:hover { background: rgba(255,255,255,0.1); color: var(--text); }

/* ══════════════════════════════════════════════════════════════════
   27. RESPONSIVE
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  :root { --sb-width: 0px; }
  .sidebar { transform: translateX(-192px); }
  .main    { margin-left: 0; }
  .shell.sidebar-open .sidebar { transform: translateX(0); --sb-width: 192px; }
  .topbar  { padding: 0 var(--sp4); }
  #search  { min-width: 120px; width: 120px; }
}

/* ══════════════════════════════════════════════════════════════════
   28. DS COMPONENT LIBRARY  (replaces all inline styles in JS output)
   ══════════════════════════════════════════════════════════════════ */

/* ── Layout ── */
.ds-grid { display: grid; gap: var(--sp4); }
.ds-grid--2 { grid-template-columns: repeat(2, 1fr); }
.ds-grid--3 { grid-template-columns: repeat(3, 1fr); }
.ds-grid--4 { grid-template-columns: repeat(4, 1fr); }
.ds-grid--5 { grid-template-columns: repeat(5, 1fr); }
.ds-col-2   { grid-column: span 2; }
.ds-col-3   { grid-column: span 3; }
@media (max-width: 1100px) { .ds-grid--4 { grid-template-columns: repeat(2, 1fr); } .ds-grid--5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px)  { .ds-grid--2, .ds-grid--3, .ds-grid--4, .ds-grid--5 { grid-template-columns: 1fr; } .ds-col-2, .ds-col-3 { grid-column: span 1; } }

/* ── Section wrapper ── */
.ds-section { margin-bottom: var(--sp6); }
.ds-section__hd {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp3); margin-bottom: var(--sp3); flex-wrap: wrap;
}
.ds-section__title {
  font-size: var(--ts-sm); font-weight: 600; color: var(--text);
  letter-spacing: 0.01em; display: flex; align-items: center; gap: var(--sp2);
}
.ds-section__sub { font-size: var(--ts-xs); color: var(--muted); margin-top: 2px; }
.ds-section__actions { display: flex; align-items: center; gap: var(--sp2); flex-shrink: 0; }
.ds-divider { border: none; border-top: 0.5px solid var(--line); margin: var(--sp4) 0; }

/* ── Card ── */
.ds-card {
  background: var(--panel);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp4);
  transition: border-color var(--trans);
}
.ds-card--sm   { padding: var(--sp3); }
.ds-card--lg   { padding: var(--sp6); }
.ds-card--accent  { border-color: var(--accent-bd);  background: rgba(30,111,255,0.04); }
.ds-card--success { border-color: var(--green-bd);   background: var(--green-sub); }
.ds-card--warning { border-color: var(--amber-bd);   background: var(--amber-sub); }
.ds-card--danger  { border-color: var(--red-bd);     background: var(--red-sub); }
.ds-card--muted   { border-color: var(--line-soft);  background: rgba(255,255,255,0.02); }
.ds-card:hover    { border-color: var(--line); }

/* ── Stat card ── */
.ds-stat {
  background: var(--panel);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp4) var(--sp4) var(--sp3);
  display: flex; flex-direction: column; gap: 2px;
  cursor: default; transition: border-color var(--trans);
  min-width: 0;
}
.ds-stat--clickable { cursor: pointer; }
.ds-stat--clickable:hover { border-color: var(--accent-bd); background: var(--accent-sub); }
.ds-stat--red    { border-color: var(--red-bd);   background: var(--red-sub); }
.ds-stat--amber  { border-color: var(--amber-bd); background: var(--amber-sub); }
.ds-stat--green  { border-color: var(--green-bd); background: var(--green-sub); }
.ds-stat--blue   { border-color: var(--accent-bd);background: var(--accent-sub); }
.ds-stat__icon   { font-size: 16px; margin-bottom: var(--sp1); opacity: 0.7; }
.ds-stat__num    { font-size: 24px; font-weight: 700; line-height: 1; color: var(--text); letter-spacing: -0.5px; }
.ds-stat__num--red   { color: var(--red-text); }
.ds-stat__num--amber { color: var(--amber-text); }
.ds-stat__num--green { color: var(--green-text); }
.ds-stat__num--blue  { color: var(--accent); }
.ds-stat__label  { font-size: var(--ts-xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; margin-top: 2px; }
.ds-stat__sub    { font-size: var(--ts-xs); color: var(--subtle); margin-top: 1px; }
.ds-stat__hint   { font-size: 9px; color: var(--accent); margin-top: var(--sp1); }

/* ── Item list ── */
.ds-list { border: 0.5px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ds-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp3); padding: var(--sp3) var(--sp4);
  border-bottom: 0.5px solid var(--line-soft);
  background: var(--panel); transition: background var(--trans);
  border-left: 2px solid transparent;
  min-width: 0;
}
.ds-row:last-child { border-bottom: none; }
.ds-row:hover      { background: var(--panel-strong); }
.ds-row--red    { border-left-color: var(--red); }
.ds-row--amber  { border-left-color: var(--amber); }
.ds-row--green  { border-left-color: var(--green); }
.ds-row--blue   { border-left-color: var(--accent); }
.ds-row--active { background: var(--accent-sub); border-left-color: var(--accent); }
.ds-row-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ds-row-title   { font-size: var(--ts-base); font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-row-meta    { font-size: var(--ts-xs); color: var(--muted); display: flex; align-items: center; gap: var(--sp2); flex-wrap: wrap; }
.ds-row-end     { display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp1); flex-shrink: 0; }

/* ── Empty state ── */
.ds-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--sp10) var(--sp6); text-align: center; color: var(--subtle);
  font-size: var(--ts-sm); gap: var(--sp2);
}
.ds-empty__icon  { font-size: 28px; opacity: 0.35; }
.ds-empty__title { font-size: var(--ts-base); font-weight: 500; color: var(--muted); }
.ds-empty__sub   { font-size: var(--ts-xs); }

/* ── Badge (replaces status-pill / inline border-radius:999px patterns) ── */
.ds-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px; border-radius: var(--radius-xs);
  font-size: 10px; font-weight: 600; line-height: 1.4;
  white-space: nowrap; flex-shrink: 0;
  background: rgba(255,255,255,0.07); color: var(--muted);
  border: 0.5px solid var(--line);
}
.ds-badge--red    { background: var(--red-sub);   color: var(--red-text);   border-color: var(--red-bd); }
.ds-badge--amber  { background: var(--amber-sub); color: var(--amber-text); border-color: var(--amber-bd); }
.ds-badge--green  { background: var(--green-sub); color: var(--green-text); border-color: var(--green-bd); }
.ds-badge--blue   { background: var(--accent-sub);color: var(--accent);     border-color: var(--accent-bd); }
.ds-badge--muted  { background: rgba(255,255,255,0.04); color: var(--subtle); border-color: var(--line-soft); }
.ds-badge--purple { background: rgba(167,139,250,0.1); color: #a78bfa; border-color: rgba(167,139,250,0.25); }
/* Regulator badges */
.ds-badge--rbi   { background: var(--rbi-sub);   color: var(--rbi);   border-color: var(--rbi-bd); }
.ds-badge--sebi  { background: var(--sebi-sub);  color: var(--sebi);  border-color: var(--sebi-bd); }
.ds-badge--irdai { background: var(--irdai-sub); color: var(--irdai); border-color: var(--irdai-bd); }
.ds-badge--mca   { background: var(--mca-sub);   color: var(--mca);   border-color: var(--mca-bd); }
.ds-badge--fema  { background: rgba(239,68,68,0.1); color: #f87171; border-color: rgba(239,68,68,0.22); }

/* ── Chip (larger, pill shape for filter pills) ── */
.ds-chip {
  display: inline-flex; align-items: center; gap: var(--sp1);
  padding: 4px 10px; border-radius: 999px;
  font-size: var(--ts-xs); font-weight: 500;
  background: rgba(255,255,255,0.06); color: var(--muted);
  border: 0.5px solid var(--line); cursor: default;
  transition: background var(--trans);
}
.ds-chip--red    { background: var(--red-sub);   color: var(--red-text);   border-color: var(--red-bd); }
.ds-chip--amber  { background: var(--amber-sub); color: var(--amber-text); border-color: var(--amber-bd); }
.ds-chip--green  { background: var(--green-sub); color: var(--green-text); border-color: var(--green-bd); }
.ds-chip--blue   { background: var(--accent-sub);color: var(--accent);     border-color: var(--accent-bd); }
.ds-chip--active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Button variants ── */
.ds-btn {
  display: inline-flex; align-items: center; gap: var(--sp1);
  padding: 6px var(--sp3); border-radius: var(--radius-sm);
  font-size: var(--ts-sm); font-weight: 500; font-family: var(--sans);
  border: 0.5px solid var(--line); background: rgba(255,255,255,0.05);
  color: var(--text); cursor: pointer; transition: background var(--trans), border-color var(--trans);
  white-space: nowrap;
}
.ds-btn:hover     { background: rgba(255,255,255,0.09); border-color: var(--line); }
.ds-btn:disabled  { opacity: 0.4; cursor: not-allowed; }
.ds-btn--sm       { padding: 3px var(--sp2); font-size: var(--ts-xs); }
.ds-btn--primary  { background: var(--accent); border-color: var(--accent); color: #fff; }
.ds-btn--primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.ds-btn--danger   { color: var(--red-text); border-color: var(--red-bd); background: var(--red-sub); }
.ds-btn--danger:hover  { background: rgba(239,68,68,0.18); }
.ds-btn--success  { color: var(--green-text); border-color: var(--green-bd); background: var(--green-sub); }
.ds-btn--ghost    { background: transparent; border-color: transparent; }
.ds-btn--ghost:hover { background: rgba(255,255,255,0.06); }

/* ── Form field ── */
.ds-field { display: flex; flex-direction: column; gap: 4px; }
.ds-field__label { font-size: var(--ts-xs); font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.ds-field__value { font-size: var(--ts-base); color: var(--text); }
.ds-field__hint  { font-size: var(--ts-xs); color: var(--subtle); }

/* ── Data label / value pairs ── */
.ds-label { font-size: var(--ts-xs); color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.ds-value { font-size: var(--ts-base); color: var(--text); font-weight: 500; }
.ds-meta  { font-size: var(--ts-xs); color: var(--muted); }

/* ── Table ── */
.ds-table { width: 100%; border-collapse: collapse; font-size: var(--ts-sm); }
.ds-table thead th {
  padding: var(--sp2) var(--sp3); text-align: left;
  font-size: var(--ts-xs); font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 0.5px solid var(--line); white-space: nowrap;
  background: rgba(255,255,255,0.02);
}
.ds-table tbody td {
  padding: var(--sp2) var(--sp3); border-bottom: 0.5px solid var(--line-soft);
  vertical-align: middle; color: var(--text);
}
.ds-table tbody tr:last-child td { border-bottom: none; }
.ds-table tbody tr:hover td      { background: rgba(255,255,255,0.025); }
.ds-table--compact thead th,
.ds-table--compact tbody td      { padding: var(--sp1) var(--sp2); }

/* ── Progress bar ── */
.ds-progress { height: 4px; background: rgba(255,255,255,0.07); border-radius: 999px; overflow: hidden; }
.ds-progress__bar { height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.4s ease; }
.ds-progress__bar--green { background: var(--green); }
.ds-progress__bar--amber { background: var(--amber); }
.ds-progress__bar--red   { background: var(--red); }

/* ── Kanban ── */
.ds-kanban { display: flex; gap: var(--sp3); overflow-x: auto; padding-bottom: var(--sp2); }
.ds-kanban__col {
  flex-shrink: 0; width: 280px;
  background: rgba(255,255,255,0.025);
  border: 0.5px solid var(--line);
  border-radius: var(--radius); display: flex; flex-direction: column;
}
.ds-kanban__col-hd {
  padding: var(--sp3) var(--sp4);
  border-bottom: 0.5px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.ds-kanban__col-title { font-size: var(--ts-sm); font-weight: 600; color: var(--text); }
.ds-kanban__col-count { font-size: var(--ts-xs); color: var(--muted); }
.ds-kanban__items     { flex: 1; padding: var(--sp2); display: flex; flex-direction: column; gap: var(--sp2); overflow-y: auto; }
.ds-kanban-card {
  background: var(--panel); border: 0.5px solid var(--line);
  border-radius: var(--radius-sm); padding: var(--sp3);
  cursor: pointer; transition: border-color var(--trans), background var(--trans);
  display: flex; flex-direction: column; gap: var(--sp1);
}
.ds-kanban-card:hover { border-color: var(--accent-bd); background: var(--panel-strong); }
.ds-kanban-card__title { font-size: var(--ts-sm); font-weight: 500; color: var(--text); line-height: 1.35; }
.ds-kanban-card__meta  { font-size: var(--ts-xs); color: var(--muted); display: flex; gap: var(--sp2); flex-wrap: wrap; align-items: center; }

/* ── Timeline / activity feed ── */
.ds-timeline { display: flex; flex-direction: column; }
.ds-timeline-item {
  display: flex; gap: var(--sp3);
  padding: var(--sp3) 0;
  border-bottom: 0.5px solid var(--line-soft);
  position: relative;
}
.ds-timeline-item:last-child { border-bottom: none; }
.ds-timeline-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
  margin-top: 5px;
}
.ds-timeline-dot--red   { background: var(--red); }
.ds-timeline-dot--amber { background: var(--amber); }
.ds-timeline-dot--green { background: var(--green); }
.ds-timeline-body { flex: 1; min-width: 0; }
.ds-timeline-title { font-size: var(--ts-sm); font-weight: 500; color: var(--text); line-height: 1.4; }
.ds-timeline-meta  { font-size: var(--ts-xs); color: var(--muted); margin-top: 2px; display: flex; gap: var(--sp2); flex-wrap: wrap; }
.ds-timeline-time  { font-size: var(--ts-xs); color: var(--subtle); flex-shrink: 0; white-space: nowrap; }

/* ── Alert bar ── */
.ds-alert { padding: var(--sp3) var(--sp4); border-radius: var(--radius-sm); border: 0.5px solid; display: flex; gap: var(--sp3); align-items: flex-start; font-size: var(--ts-sm); }
.ds-alert--red    { background: var(--red-sub);   border-color: var(--red-bd);   color: var(--red-text); }
.ds-alert--amber  { background: var(--amber-sub); border-color: var(--amber-bd); color: var(--amber-text); }
.ds-alert--green  { background: var(--green-sub); border-color: var(--green-bd); color: var(--green-text); }
.ds-alert--blue   { background: var(--accent-sub);border-color: var(--accent-bd);color: var(--accent); }

/* ── Filter bar ── */
.ds-filter-bar { display: flex; align-items: center; gap: var(--sp2); flex-wrap: wrap; padding: var(--sp3) var(--sp4); border-bottom: 0.5px solid var(--line-soft); background: rgba(255,255,255,0.02); }
.ds-filter-bar select { height: 28px; padding: 0 var(--sp2); font-size: var(--ts-xs); background: transparent; border: 0.5px solid var(--line); border-radius: var(--radius-sm); color: var(--text); cursor: pointer; }

/* ── Page header (inside a view) ── */
.ds-page-hd { padding: var(--sp5) var(--sp6) var(--sp4); border-bottom: 0.5px solid var(--line-soft); display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp4); flex-wrap: wrap; }
.ds-page-hd__left   { flex: 1; min-width: 0; }
.ds-page-hd__title  { font-size: var(--ts-xl); font-weight: 700; color: var(--text); letter-spacing: -0.3px; line-height: 1.15; }
.ds-page-hd__sub    { font-size: var(--ts-sm); color: var(--muted); margin-top: 2px; }
.ds-page-hd__right  { display: flex; align-items: center; gap: var(--sp2); flex-shrink: 0; }

/* ── Content padding wrapper ── */
.ds-body { padding: var(--sp5) var(--sp6); }
.ds-body--compact { padding: var(--sp4); }

/* ── Two-pane layout (list + detail) ── */
.ds-split { display: grid; grid-template-columns: 340px 1fr; gap: 0; min-height: 0; flex: 1; }
.ds-split__list { border-right: 0.5px solid var(--line); overflow-y: auto; }
.ds-split__detail { overflow-y: auto; padding: var(--sp5) var(--sp6); }
@media (max-width: 900px) { .ds-split { grid-template-columns: 1fr; } .ds-split__list { border-right: none; border-bottom: 0.5px solid var(--line); } }

/* ── Revenue / metric strip ── */
.ds-strip { display: flex; gap: var(--sp2); flex-wrap: wrap; align-items: center; }
.ds-strip-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-xs);
  font-size: var(--ts-xs); font-weight: 600;
  background: rgba(255,255,255,0.05); border: 0.5px solid var(--line);
  color: var(--muted);
}
.ds-strip-pill--blue  { color: var(--accent);     border-color: var(--accent-bd); }
.ds-strip-pill--amber { color: var(--amber-text); border-color: var(--amber-bd); }
.ds-strip-pill--green { color: var(--green-text); border-color: var(--green-bd); }
.ds-strip-pill--red   { color: var(--red-text);   border-color: var(--red-bd); }

/* ── Loading skeleton ── */
.ds-skeleton { background: rgba(255,255,255,0.06); border-radius: var(--radius-xs); animation: ds-pulse 1.4s ease-in-out infinite; }
@keyframes ds-pulse { 0%,100% { opacity:0.6; } 50% { opacity:0.3; } }

/* ── Regulator tag (replaces regTag() inline outputs) ── */
.reg-tag { display: inline-flex; align-items: center; padding: 1px 5px; border-radius: 3px; font-size: 9px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.reg-tag--rbi   { background: var(--rbi-sub);   color: var(--rbi);   border: 0.5px solid var(--rbi-bd); }
.reg-tag--sebi  { background: var(--sebi-sub);  color: var(--sebi);  border: 0.5px solid var(--sebi-bd); }
.reg-tag--irdai { background: var(--irdai-sub); color: var(--irdai); border: 0.5px solid var(--irdai-bd); }
.reg-tag--mca   { background: var(--mca-sub);   color: var(--mca);   border: 0.5px solid var(--mca-bd); }
.reg-tag--fema  { background: rgba(239,68,68,0.1); color: #f87171; border: 0.5px solid rgba(239,68,68,0.22); }
.reg-tag--other { background: rgba(255,255,255,0.06); color: var(--muted); border: 0.5px solid var(--line); }

@media (max-width: 600px) {
  .view { padding: var(--sp4); }
  .topbar h2 { font-size: var(--ts-base); }
}
