/* TechOps Control Panel — app-level styles
   Built on top of /design-system/colors_and_type.css                                */

/* ---------- THEMES ---------------------------------------------------- */
:root {
  /* Surface layers - default LIGHT theme */
  --app-bg:          #F6F9FC;        /* slightly cooler than dc-white for chrome */
  --app-surface:     var(--pure-white);
  --app-surface-2:   #FBFCFE;
  --app-line:        var(--gray-1);
  --app-line-soft:   #EAF0F5;
  --app-fg:          var(--dc-blue);
  --app-fg-muted:    var(--gray-6);
  --app-fg-subtle:   var(--gray-5);

  /* Sidebar (light theme default) */
  --nav-bg:          var(--pure-white);
  --nav-fg:          var(--dc-blue);
  --nav-fg-muted:    var(--gray-5);
  --nav-active-bg:   #EAF2F8;
  --nav-active-fg:   var(--dc-blue);
  --nav-line:        var(--gray-1);
  --nav-brand-bg:    var(--pure-white);

  /* Topbar */
  --topbar-bg:       var(--pure-white);
  --topbar-line:     var(--gray-1);

  /* Accent application */
  --accent-pill-fg:  var(--dc-blue);
  --accent-pill-bg:  var(--dc-yellow);

  /* Density */
  --row-h:           44px;
  --pad-y:           16px;
  --pad-x:           20px;
  --card-pad:        22px;
  --table-pad-y:     12px;
  --table-pad-x:     14px;
  --label-size:      11px;
}

[data-theme="dark"] {
  --app-bg:          #0A1626;
  --app-surface:     #11233D;
  --app-surface-2:   #15294A;
  --app-line:        #1F3A60;
  --app-line-soft:   #182E4F;
  --app-fg:          #E6EEF7;
  --app-fg-muted:    #94A8C4;
  --app-fg-subtle:   #6C82A0;
  --nav-bg:          #07101C;
  --nav-fg:          #E6EEF7;
  --nav-fg-muted:    #7E94B2;
  --nav-active-bg:   #15294A;
  --nav-active-fg:   var(--dc-electric-blue);
  --nav-line:        #16273F;
  --nav-brand-bg:    #07101C;
  --topbar-bg:       #0A1626;
  --topbar-line:     #16273F;
}

[data-theme="navy"] {
  /* Datacor navy sidebar, light content. The brand's signature combo. */
  --nav-bg:          var(--dc-blue);
  --nav-fg:          var(--dc-white);
  --nav-fg-muted:    #8FA7C2;
  --nav-active-bg:   rgba(255,255,255,0.08);
  --nav-active-fg:   var(--dc-electric-blue);
  --nav-line:        rgba(255,255,255,0.10);
  --nav-brand-bg:    var(--dc-blue);
  --topbar-bg:       var(--pure-white);
  --topbar-line:     var(--gray-1);
}

[data-density="compact"] {
  --row-h:           34px;
  --pad-y:           10px;
  --pad-x:           14px;
  --card-pad:        16px;
  --table-pad-y:     7px;
  --table-pad-x:     11px;
}

/* Blue-only accent mode: replace yellow primary CTAs with blue */
[data-accent="blue"] {
  --accent-pill-fg:  var(--dc-white);
  --accent-pill-bg:  var(--dc-blue);
}

/* ---------- BASE ----------------------------------------------------- */
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  font-family: var(--font-sans);
  background: var(--app-bg);
  color: var(--app-fg);
  font-size: 14px;
  line-height: 1.45;
}
button { font-family: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(18,46,79,.18); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- APP SHELL ----------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "brand topbar"
    "nav   main";
  height: 100vh;
  width: 100%;
}
.app[data-nav="top"] {
  grid-template-columns: 1fr;
  grid-template-rows: 56px 48px 1fr;
  grid-template-areas:
    "topbar"
    "nav"
    "main";
}
.app[data-nav="palette"] {
  grid-template-columns: 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "topbar"
    "main";
}
.app[data-nav="palette"] .sidebar,
.app[data-nav="palette"] .brand { display: none; }

.brand {
  grid-area: brand;
  display: flex; align-items: center;
  padding: 0 18px;
  background: var(--nav-brand-bg);
  border-right: 1px solid var(--nav-line);
  border-bottom: 1px solid var(--nav-line);
  gap: 10px;
}
.brand-logo { height: 22px; width: auto; display: block; }
.brand-product {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nav-fg-muted);
  padding: 3px 8px;
  border: 1px solid var(--nav-fg-muted);
  border-radius: 999px;
  margin-left: 6px;
}
[data-theme="navy"] .brand-product { color: var(--dc-electric-blue); border-color: var(--dc-electric-blue); }

.topbar {
  grid-area: topbar;
  display: flex; align-items: center;
  padding: 0 16px;
  gap: 10px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-line);
  overflow: hidden;
  min-width: 0;
  /* stay locked to viewport width even when page content causes horizontal scroll */
  position: sticky;
  left: 0;
  max-width: 100vw;
}
.topbar-brand {
  display: flex; align-items: center;
  flex-shrink: 0;
  padding-right: 16px;
  border-right: 1px solid var(--app-line);
  height: 100%;
}
.topbar-search {
  flex: 1 1 0%;
  min-width: 0;
  background: var(--app-bg);
  border: 1px solid var(--app-line);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--app-fg-muted);
  font-size: 13px;
  cursor: text;
  overflow: hidden;
}
.topbar-search:hover { border-color: var(--dc-blue); }
/* right-side controls never shrink off screen */
.topbar-icon-btn,
.topbar-user { flex-shrink: 0; }
.topbar-icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent;
  border-radius: 8px; cursor: pointer;
  color: var(--app-fg-muted);
  position: relative;
}
.topbar-icon-btn:hover { background: var(--app-bg); color: var(--app-fg); }
.topbar-icon-btn .pip {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ui-red); border: 2px solid var(--topbar-bg);
}
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  cursor: pointer;
  background: var(--app-surface);
}
.topbar-user:hover { border-color: var(--dc-blue); }
.topbar-user .av {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--dc-blue); color: var(--dc-yellow);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.topbar-user .name { font-size: 13px; font-weight: 600; color: var(--app-fg); }
.topbar-user .role { font-size: 11px; color: var(--app-fg-muted); }

/* kbd hint hides when search box gets tight (JS hides brand below 220px search width) */
@media (max-width: 500px) {
  .topbar-search kbd { display: none; }
}

/* ---------- SIDEBAR -------------------------------------------------- */
.sidebar {
  grid-area: nav;
  background: var(--nav-bg);
  border-right: 1px solid var(--nav-line);
  display: flex; flex-direction: column;
  overflow-y: auto;
  padding: 16px 12px;
}
.sidebar-section { margin-bottom: 18px; }
.sidebar-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--nav-fg-muted);
  padding: 6px 10px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--nav-fg);
  cursor: pointer;
  border: none; background: transparent;
  width: 100%; text-align: left;
  position: relative;
  transition: background 100ms ease;
}
.sidebar-link:hover { background: var(--nav-active-bg); }
.sidebar-link.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-fg);
  font-weight: 600;
}
.sidebar-link.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; background: var(--dc-yellow); border-radius: 0 3px 3px 0;
}
[data-accent="blue"] .sidebar-link.active::before { background: var(--dc-electric-blue); }
.sidebar-link .ic { flex: 0 0 18px; display: inline-flex; }
.sidebar-link .count {
  margin-left: auto;
  font-size: 11px; font-weight: 700;
  background: var(--app-bg); color: var(--app-fg-muted);
  padding: 2px 8px; border-radius: 999px;
  min-width: 24px; text-align: center;
}
.sidebar-link .count.urgent      { background: var(--ui-red);         color: #fff; }
.sidebar-link .count.outage      { background: var(--ui-red);         color: #fff; }
.sidebar-link .count.maintenance { background: var(--dc-medium-blue); color: #fff; }
.sidebar-link .count.degraded    { background: var(--dc-yellow);      color: #000; }
[data-theme="navy"] .sidebar-link .count { background: rgba(255,255,255,0.08); color: var(--dc-electric-blue); }
[data-theme="navy"] .sidebar-link .count.urgent      { background: var(--ui-red);         color: #fff; }
[data-theme="navy"] .sidebar-link .count.outage      { background: var(--ui-red);         color: #fff; }
[data-theme="navy"] .sidebar-link .count.maintenance { background: var(--dc-medium-blue); color: #fff; }
[data-theme="navy"] .sidebar-link .count.degraded    { background: var(--dc-yellow);      color: #000; }

/* Multi-badge stack — used when a nav item carries more than one count
   (e.g. Incidents shows outage + degraded + maintenance side by side). The
   wrapper grabs the right-aligned slot so the badges sit flush together. */
.sidebar-link .badge-stack { margin-left: auto; display: inline-flex; gap: 4px; }
.sidebar-link .badge-stack .count { margin-left: 0; }
.topnav-link  .badge-stack { display: inline-flex; gap: 4px; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px;
  border-top: 1px solid var(--nav-line);
  font-size: 11px;
  color: var(--nav-fg-muted);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-footer .status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ui-green);
  box-shadow: 0 0 0 3px rgba(88,190,77,0.18);
}

/* ---------- TOP NAV (alternative) ----------------------------------- */
.topnav {
  grid-area: nav;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-line);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 4px;
  overflow: visible;  /* dropdowns must not be clipped by the nav row */
}
.topnav-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 14px;
  height: 100%;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--nav-fg);
  cursor: pointer;
  border: none; background: transparent;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.topnav-link:hover { color: var(--dc-blue); }
.topnav-link.active {
  color: var(--dc-blue);
  border-bottom-color: var(--dc-yellow);
  font-weight: 700;
}
[data-accent="blue"] .topnav-link.active { border-bottom-color: var(--dc-blue); }
.topnav-link .count {
  font-size: 10px; font-weight: 700;
  background: var(--app-bg); color: var(--app-fg-muted);
  padding: 1px 7px; border-radius: 999px;
}
.topnav-link .count.urgent      { background: var(--ui-red);         color: #fff; }
.topnav-link .count.outage      { background: var(--ui-red);         color: #fff; }
.topnav-link .count.maintenance { background: var(--dc-medium-blue); color: #fff; }
.topnav-link .count.degraded    { background: var(--dc-yellow);      color: #000; }
.topnav-chevron-ico { margin-left: 2px; opacity: 0.55; }

/* Dropdown — hidden until parent hovered */
.topnav-item { position: relative; height: 100%; display: inline-flex; align-items: stretch; }
.topnav-dropdown {
  display: none;
  position: absolute; top: 100%; left: 0;
  min-width: 180px;
  background: var(--nav-bg);
  border: 1px solid var(--nav-line);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 200;
  padding: 4px;
  flex-direction: column; gap: 1px;
}
.topnav-item:hover .topnav-dropdown { display: flex; }
.topnav-dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  font-size: 13px; font-weight: 500;
  color: var(--nav-fg);
  background: transparent; border: none;
  border-radius: 6px; cursor: pointer;
  white-space: nowrap; text-align: left;
}
.topnav-dropdown-item:hover { background: var(--nav-line); color: var(--dc-blue); }
.topnav-dropdown-item.active { color: var(--dc-blue); font-weight: 700; }

/* Sidebar nested children */
.sidebar-children { padding-left: 12px; }
.sidebar-link.sidebar-child {
  font-size: 12.5px;
  padding-left: 28px;
  opacity: 0.9;
}
.sidebar-link.sidebar-child.active { opacity: 1; }

/* ---------- MAIN ----------------------------------------------------- */
.main {
  grid-area: main;
  overflow: auto;
  min-width: 0;
  background: var(--app-bg);
}
.page {
  padding: 32px 40px 80px;
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 900px) {
  .page { padding: 24px 20px 60px; }
}
@media (max-width: 600px) {
  .page { padding: 16px 12px 48px; }
}
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 24px;
  gap: 20px;
}
.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--app-fg);
}
.page-header .eyebrow {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--app-fg-muted);
  margin-bottom: 6px;
}
.page-header .sub {
  font-size: 14px;
  color: var(--app-fg-muted);
  margin-top: 6px;
  max-width: 60ch;
}
.page-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- BUTTONS -------------------------------------------------- */
.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 8px;
  letter-spacing: 0.01em;
  transition: all 120ms ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent-pill-bg);
  color: var(--accent-pill-fg);
  border-color: var(--dc-blue);
}
.btn-primary:hover { filter: brightness(0.96); }
.btn-blue {
  background: var(--dc-blue);
  color: var(--dc-white);
  border-color: var(--dc-blue);
}
.btn-blue:hover { background: #0B1F37; }
.btn-ghost {
  background: transparent;
  color: var(--app-fg);
  border-color: var(--app-line);
}
.btn-ghost:hover { background: var(--app-bg); border-color: var(--app-fg); }
.btn-sm { font-size: 12px; padding: 6px 14px; }
.btn-icon {
  padding: 7px 9px;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- CARDS ---------------------------------------------------- */
.card {
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 14px;
  padding: var(--card-pad);
}
.card-elev {
  background: var(--app-surface);
  border-radius: 14px;
  padding: var(--card-pad);
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
}
.card-pad-0 { padding: 0; }
.card-title {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--app-fg-muted);
  margin: 0 0 12px;
}
.card-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--app-line-soft);
}
.card-h h3 {
  font-size: 14px; font-weight: 700; margin: 0;
  color: var(--app-fg);
}

/* ---------- BADGES --------------------------------------------------- */
.b {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.b .dot { width: 6px; height: 6px; border-radius: 50%; }
.b-blue   { background: #E6EDF4; color: var(--dc-blue); border: 1px solid var(--dc-blue); }
.b-yellow { background: var(--dc-yellow); color: var(--dc-blue); border: 1px solid var(--dc-blue); }
.b-green  { background: #E4F4E2; color: #2A7A22; border: 1px solid var(--ui-green); }
.b-red    { background: #FBE6E9; color: #8E1C2C; border: 1px solid var(--ui-red); }
.b-orange { background: #FFEBD1; color: #7A4300; border: 1px solid var(--ui-orange); }
.b-gray   { background: var(--app-bg); color: var(--app-fg-muted); border: 1px solid var(--app-line); }
.b-soft   { background: transparent; color: var(--app-fg-muted); border: 1px solid var(--app-line); }

/* Severity badges */
.sev { padding: 3px 9px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.sev-critical { background: #2A0710; color: #FFC2CC; }
.sev-high     { background: #C72B3F; color: #fff; }
.sev-medium   { background: #FA8500; color: #fff; }
.sev-low      { background: #E6EDF4; color: var(--dc-blue); }
.sev-info     { background: var(--app-bg); color: var(--app-fg-muted); }

/* ---------- TABLES --------------------------------------------------- */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.tbl th, .tbl td {
  text-align: left;
  padding: var(--table-pad-y) var(--table-pad-x);
  border-bottom: 1px solid var(--app-line-soft);
  vertical-align: middle;
}
.tbl th {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--app-fg-muted);
  background: var(--app-surface-2);
  border-bottom: 1px solid var(--app-line);
  position: sticky; top: 0;
  user-select: none;
}
.tbl tbody tr { transition: background 80ms; }
.tbl tbody tr:hover { background: var(--app-bg); cursor: pointer; }
.tbl tbody tr.selected { background: #E6EDF4; }
.tbl td.mono { font-family: var(--font-mono); font-size: 12px; }

/* ---------- INPUTS --------------------------------------------------- */
.input, .select, .textarea {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--app-line);
  border-radius: 8px;
  background: var(--app-surface);
  color: var(--app-fg);
  width: 100%;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--dc-blue);
  box-shadow: 0 0 0 3px rgba(255,197,23,0.30);
}
[data-accent="blue"] .input:focus,
[data-accent="blue"] .select:focus,
[data-accent="blue"] .textarea:focus {
  box-shadow: 0 0 0 3px rgba(18,46,79,0.18);
}
.textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.label {
  display: block;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--app-fg-muted);
  margin-bottom: 5px;
}

/* ---------- AVATARS --------------------------------------------------- */
.av {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--dc-blue); color: var(--dc-yellow);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex: 0 0 auto;
}
.av-sm { width: 22px; height: 22px; font-size: 9px; }
.av-lg { width: 40px; height: 40px; font-size: 13px; }
.av-stack { display: inline-flex; }
.av-stack .av { border: 2px solid var(--app-surface); margin-left: -8px; }
.av-stack .av:first-child { margin-left: 0; }

.av-c2 { background: var(--dc-medium-blue); color: #fff; }
.av-c3 { background: var(--dc-dark-green); color: #fff; }
.av-c4 { background: var(--dc-light-green); color: var(--dc-blue); }
.av-c5 { background: var(--dc-light-blue); color: var(--dc-blue); }

/* ---------- LAYOUT HELPERS ------------------------------------------- */
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.stack { display: flex; flex-direction: column; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 18px; }
.muted { color: var(--app-fg-muted); }
.subtle { color: var(--app-fg-subtle); }
.mono { font-family: var(--font-mono); }
.eyebrow {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--app-fg-muted);
}
.divider { height: 1px; background: var(--app-line-soft); margin: 14px 0; }
.divider-v { width: 1px; background: var(--app-line-soft); align-self: stretch; }

/* ---------- KPI / STAT ----------------------------------------------- */
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--app-fg-muted);
}
.kpi-value {
  font-size: 36px; font-weight: 400; line-height: 1; letter-spacing: -0.02em;
  color: var(--app-fg);
}
.kpi-value em {
  font-style: italic; font-weight: 400;
  color: var(--dc-medium-blue);
}
.kpi-delta { font-size: 12px; font-weight: 600; }
.kpi-delta.up { color: var(--ui-green); }
.kpi-delta.down { color: var(--ui-red); }
.kpi-delta.neutral { color: var(--app-fg-muted); }

/* ---------- ICONS ----------------------------------------------------- */
.ico { width: 18px; height: 18px; flex: 0 0 18px; }
.ico-lg { width: 22px; height: 22px; flex: 0 0 22px; }
.ico-circle {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--dc-blue);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--dc-blue);
  flex: 0 0 auto;
  background: var(--app-surface);
}
.ico-circle.tint-yellow { background: var(--dc-yellow); }
.ico-circle.tint-blue { background: var(--dc-blue); color: var(--dc-white); }
.ico-circle.tint-blue-soft { background: #E6EDF4; }

/* ---------- TAB BAR --------------------------------------------------- */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--app-line);
  margin-bottom: 20px;
}
.tabs .tab {
  font: inherit;
  background: transparent; border: none;
  padding: 10px 16px;
  font-size: 13px; font-weight: 600;
  color: var(--app-fg-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
}
.tabs .tab:hover { color: var(--app-fg); }
.tabs .tab.active { color: var(--app-fg); border-bottom-color: var(--dc-yellow); }
[data-accent="blue"] .tabs .tab.active { border-bottom-color: var(--dc-blue); }
.tabs .tab .count {
  margin-left: 6px;
  font-size: 10px; font-weight: 700;
  background: var(--app-bg); color: var(--app-fg-muted);
  padding: 1px 7px; border-radius: 999px;
}

/* ---------- COMMAND PALETTE ------------------------------------------ */
.cp-overlay {
  position: fixed; inset: 0;
  background: rgba(18,46,79,0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 14vh;
  z-index: 80;
  animation: fade-in 160ms ease;
}
.cp {
  width: 640px; max-width: 92vw;
  background: var(--app-surface);
  border-radius: 14px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--app-line);
  overflow: hidden;
}
.cp-input {
  width: 100%;
  padding: 18px 22px;
  font: inherit; font-size: 16px;
  border: none; outline: none;
  background: var(--app-surface); color: var(--app-fg);
  border-bottom: 1px solid var(--app-line-soft);
}
.cp-list { max-height: 480px; overflow-y: auto; padding: 6px; }
.cp-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--app-fg-muted);
  padding: 10px 14px 4px;
}
.cp-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 8px;
  cursor: pointer; font-size: 13px;
  color: var(--app-fg);
}
.cp-item:hover, .cp-item.cp-active { background: var(--nav-active-bg); }
.cp-item .ico { color: var(--app-fg-muted); }
.cp-item .cp-shortcut { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--app-fg-muted); }

/* ---------- ANIMATIONS ----------------------------------------------- */
@keyframes fade-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
/* Animation as enhancement only; explicit opacity:1 baseline so capture environments
   that pause the animation clock don't leave content invisible. */
.fade-in { opacity: 1; animation: fade-in 240ms cubic-bezier(0.22, 1, 0.36, 1); }
.pop-in  { opacity: 1; animation: pop-in 240ms cubic-bezier(0.22, 1, 0.36, 1); }

/* ---------- MODAL ---------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(18,46,79,0.45);
  z-index: 70;
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  animation: fade-in 160ms ease;
}
.modal {
  background: var(--app-surface);
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  width: min(720px, 92vw);
  max-height: 88vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-h {
  padding: 18px 24px;
  border-bottom: 1px solid var(--app-line-soft);
  display: flex; align-items: center; gap: 12px;
}
.modal-h h2 { margin: 0; font-size: 18px; font-weight: 700; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-f {
  padding: 14px 24px;
  border-top: 1px solid var(--app-line-soft);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  background: var(--app-surface-2);
}

/* ---------- TOAST ---------------------------------------------------- */
.toast-area {
  position: fixed; top: 80px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 90;
}
.toast {
  background: var(--dc-blue);
  color: var(--dc-white);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: pop-in 200ms cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 360px;
}
.toast .ico { color: var(--dc-yellow); }

/* ---------- PROGRESS / METER ----------------------------------------- */
.meter {
  height: 6px;
  border-radius: 999px;
  background: var(--app-bg);
  overflow: hidden;
  position: relative;
}
.meter > span {
  display: block; height: 100%;
  background: var(--dc-blue);
  border-radius: 999px;
  transition: width 240ms ease;
}
.meter.thin { height: 4px; }
.meter.thick { height: 8px; }

/* Risk score */
.risk-meter {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700;
}
.risk-meter .bars {
  display: inline-flex; gap: 2px;
}
.risk-meter .bars > i {
  width: 4px; height: 14px; background: var(--app-line);
  border-radius: 1px;
}
.risk-meter.low .bars > i:nth-child(-n+2) { background: var(--ui-green); }
.risk-meter.med .bars > i:nth-child(-n+3) { background: var(--ui-orange); }
.risk-meter.high .bars > i:nth-child(-n+5) { background: var(--ui-red); }
.risk-meter.crit .bars > i { background: var(--ui-red); }

/* ---------- DECISIONS PAGE (marketing-polished) ---------------------- */
.dec-hero {
  background: var(--dc-blue) url('design-system/pattern_dark.png') center/cover no-repeat;
  color: var(--dc-white);
  padding: 56px 48px 72px;
  border-radius: 0;
  position: relative;
  overflow: hidden;
}
.dec-hero h1 {
  font-family: var(--font-sans);
  font-size: 64px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.05;
  max-width: 18ch;
  color: var(--dc-white);
}
.dec-hero h1 em {
  font-style: italic;
  color: var(--dc-electric-blue);
  font-weight: 400;
}
.dec-hero .lede {
  margin-top: 16px;
  font-size: 17px;
  max-width: 56ch;
  color: rgba(243,252,255,0.85);
  line-height: 1.5;
}
.dec-hero .eyebrow { color: var(--dc-electric-blue); margin-bottom: 16px; }
.dec-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 40px;
  border-top: 1px solid rgba(255,255,255,0.15);
}
.dec-stat {
  padding: 24px 24px 0 0;
  border-right: 1px solid rgba(255,255,255,0.15);
}
.dec-stat:last-child { border-right: none; padding-right: 0; }
.dec-stat-val { font-size: 44px; font-weight: 400; letter-spacing: -0.02em; line-height: 1; }
.dec-stat-val em { font-style: italic; color: var(--dc-electric-blue); }
.dec-stat-label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 8px; color: rgba(243,252,255,0.65); }

.dec-filters {
  background: var(--app-surface);
  padding: 24px 48px;
  border-bottom: 1px solid var(--app-line);
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.dec-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  font-size: 12px; font-weight: 700;
  border-radius: 999px;
  border: 1px solid var(--app-line);
  background: var(--app-surface);
  color: var(--app-fg);
  cursor: pointer;
}
.dec-pill.active {
  background: var(--dc-blue); color: var(--dc-white);
  border-color: var(--dc-blue);
}
.dec-pill .num { font-size: 10px; opacity: 0.7; }

.dec-grid {
  padding: 40px 48px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}
.dec-card {
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  transition: all 180ms cubic-bezier(0.22, 1, 0.36, 1);
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
  overflow: hidden;
}
.dec-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--dc-blue); }
.dec-card-h {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
}
.dec-card .ard-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--app-fg-muted);
  letter-spacing: 0.04em;
}
.dec-card h3 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.005em;
  margin: 6px 0 0;
  line-height: 1.25;
  color: var(--app-fg);
}
.dec-card .summary {
  font-size: 13.5px; line-height: 1.5;
  color: var(--app-fg-muted);
}
.dec-card-f {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--app-line-soft);
  font-size: 12px;
  color: var(--app-fg-muted);
}
.dec-card .ribbon {
  position: absolute; top: 18px; right: -32px;
  transform: rotate(45deg);
  padding: 3px 36px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.dec-card .ribbon-approved { background: var(--ui-green); color: #fff; }
.dec-card .ribbon-denied   { background: var(--ui-red); color: #fff; }
.dec-card .ribbon-conditional { background: var(--ui-orange); color: #fff; }

/* Decisions Two-pane variant */
.dec-twopane { display: grid; grid-template-columns: 380px 1fr; min-height: 70vh; }
.dec-twopane .list { border-right: 1px solid var(--app-line); overflow-y: auto; max-height: 80vh; }
.dec-twopane .list-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--app-line-soft);
  cursor: pointer;
}
.dec-twopane .list-item:hover { background: var(--app-bg); }
.dec-twopane .list-item.active { background: #E6EDF4; border-left: 3px solid var(--dc-yellow); padding-left: 17px; }
.dec-twopane .detail { padding: 32px 40px; overflow-y: auto; }

/* Decisions table variant */
.dec-table { padding: 24px 48px; }
@media (max-width: 900px) {
  .dec-filters { padding: 16px 20px; }
  .dec-table    { padding: 16px 20px; }
}
@media (max-width: 600px) {
  .dec-filters { padding: 12px; }
  .dec-table    { padding: 12px; }
}

/* ---------- KANBAN --------------------------------------------------- */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.kanban-col {
  background: var(--app-bg);
  border-radius: 12px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 480px;
}
.kanban-col-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 6px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--app-fg-muted);
}
.kanban-card {
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  cursor: grab;
  display: flex; flex-direction: column; gap: 8px;
}
.kanban-card:hover { box-shadow: var(--shadow-sm); }
.kanban-card .title { font-weight: 700; line-height: 1.3; font-size: 13.5px; }

/* ---------- CONVERSATION --------------------------------------------- */
.thread { display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 12px; }
.msg .body {
  background: var(--app-surface);
  border: 1px solid var(--app-line-soft);
  border-radius: 12px;
  padding: 12px 16px;
  flex: 1;
  font-size: 13.5px; line-height: 1.5;
}
.msg .who {
  font-weight: 700; font-size: 13px;
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 4px;
}
.msg .who .time { font-weight: 400; font-size: 11px; color: var(--app-fg-muted); }
.msg.system .body {
  background: transparent; border: 1px dashed var(--app-line);
  color: var(--app-fg-muted); font-style: italic;
}
.msg.decision .body {
  background: #E4F4E2; border-color: var(--ui-green);
}
.msg.decision .body .who { color: #2A7A22; }

/* ---------- LICENSE bars --------------------------------------------- */
.seat-bar {
  display: flex; gap: 2px; height: 18px; border-radius: 4px; overflow: hidden;
  background: var(--app-bg);
}
.seat-bar > span { display: block; }
.seat-used  { background: var(--dc-blue); }
.seat-free  { background: var(--gray-1); }
.seat-overage { background: var(--ui-red); }

/* ---------- TOOLTIP -------------------------------------------------- */
.tt { position: relative; }
.tt::after {
  content: attr(data-tt);
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--dc-blue); color: var(--dc-white);
  font-size: 11px; padding: 4px 8px; border-radius: 4px;
  white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 120ms;
}
.tt:hover::after { opacity: 1; }
