/* ============================================
   IA-NET · Plataforma de Gestión Duoc UC
   Sistema visual basado en Manual Imagen
   Corporativa Duoc UC — Marzo 2024
   ============================================ */

:root {
  /* Paleta institucional */
  --ink: #1A1A1A;
  --ink-pure: #000000;
  --paper: #FFFFFF;
  --bone: #FAFAFA;
  --mist: #F4F4F4;
  --line: #E5E5E5;
  --line-soft: #EFEFEF;
  --mute: #666666;
  --mute-soft: #8A8A8A;
  --mute-2: #B5B5B5;

  --yellow: #F1B634;
  --yellow-soft: #FEF3D6;
  --yellow-deep: #C8932A;

  /* Acento de área (transversal por defecto = sin color) */
  --area: #1A1A1A;
  --area-tint: #F4F4F4;

  /* Estados funcionales */
  --ok: #2F7D52;
  --ok-tint: #E5F1EA;
  --warn: #C77514;
  --warn-tint: #FBEFD9;
  --err: #B82A1F;
  --err-tint: #FAE6E3;
  --info: #2F6FB3;
  --info-tint: #E6EEF8;

  /* Densidad / radios */
  --r-xs: 2px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;

  /* Tipografía */
  --sans: 'Lato', system-ui, sans-serif;
  --serif: 'Merriweather', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bone);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

::selection { background: var(--yellow); color: var(--ink); }

/* Tabular numerals everywhere we display money / codes */
.num, .mono, .tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}
.mono { font-family: var(--mono); }

/* ====== Wordmark / brand bar ====== */
.brandbar {
  background: var(--ink);
  color: var(--paper);
}
.brandbar .duoc {
  font-family: var(--sans);
  font-weight: 900;
  letter-spacing: -0.01em;
}
.brandbar .duoc .uc { color: var(--yellow); }

.ianet-mark {
  font-family: var(--sans);
  font-weight: 900;
  letter-spacing: 0.18em;
  font-size: 13px;
}
.ianet-mark .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--yellow);
  margin: 0 0.4em 2px 0;
  vertical-align: middle;
}

/* ====== Layout primitives ====== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w, 240px) 1fr var(--bot-w, 0px);
  grid-template-rows: 56px 1fr;
  height: 100vh;
  width: 100vw;
  background: var(--bone);
  transition: grid-template-columns 220ms ease;
}
.app[data-nav="top"] {
  grid-template-columns: 1fr var(--bot-w, 0px);
  grid-template-rows: 56px 44px 1fr;
}
.app[data-bot="left"] {
  grid-template-columns: var(--bot-w, 0px) var(--sidebar-w, 240px) 1fr;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
  grid-column: 1 / -1;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: stretch;
  border-bottom: 3px solid var(--yellow);
  position: relative;
  z-index: 10;
}
.topbar .seg {
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 14px;
}
.topbar .seg.grow { flex: 1; }
.topbar .brandblock {
  border-right: 1px solid rgba(255,255,255,0.12);
  min-width: var(--sidebar-w, 240px);
  padding-right: 22px;
}
.app[data-nav="top"] .topbar .brandblock { min-width: 280px; }

.topbar .duoc-tag {
  font-weight: 900;
  font-size: 14px;
  letter-spacing: -0.01em;
  line-height: 1;
}
.topbar .duoc-tag .uc { color: var(--yellow); }

.topbar .sep-v {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,0.18);
}
.topbar .ianet {
  font-weight: 900;
  letter-spacing: 0.22em;
  font-size: 12px;
}
.topbar .ianet .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--yellow);
  margin-right: 8px;
  vertical-align: 1px;
}
.topbar .area-tag {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  font-weight: 700;
}

.topbar .search {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--r-sm);
  padding: 6px 10px 6px 32px;
  color: var(--paper);
  font-size: 13px;
  width: 340px;
  outline: none;
  position: relative;
}
.topbar .search-wrap {
  position: relative;
  flex: 1;
  max-width: 420px;
}
.topbar .search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.6;
  pointer-events: none;
}
.topbar .search:focus {
  border-color: var(--yellow);
  background: rgba(255,255,255,0.08);
}
.topbar .search::placeholder { color: rgba(255,255,255,0.4); }

.topbar .meta {
  display: flex;
  align-items: center;
  gap: 18px;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
}
.topbar .meta .pill {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--paper);
}
.topbar .meta .pill .ind {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 0 3px rgba(74,222,128,0.18);
}

.topbar .user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 4px;
}
.topbar .user .av {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  display: grid; place-items: center;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.topbar .user .name { font-weight: 700; color: var(--paper); font-size: 13px; }
.topbar .user .role { font-size: 10.5px; color: rgba(255,255,255,0.55); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; }

.topbar .iconbtn {
  background: transparent;
  border: 0;
  padding: 6px;
  color: rgba(255,255,255,0.8);
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  position: relative;
}
.topbar .iconbtn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.topbar .iconbtn .badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 14px; height: 14px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 9px;
  font-weight: 900;
  border-radius: 999px;
  padding: 0 4px;
  display: grid; place-items: center;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar .nav-section {
  padding: 16px 14px 6px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute-soft);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar .nav-section .ix {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--mute-2);
  letter-spacing: 0;
}
.sidebar .nav-items { padding: 0 8px; display: flex; flex-direction: column; gap: 1px; }
.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  position: relative;
  border: 1px solid transparent;
}
.sidebar .nav-item:hover { background: var(--mist); }
.sidebar .nav-item.active {
  background: var(--ink);
  color: var(--paper);
}
.sidebar .nav-item.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--yellow);
}
.sidebar .nav-item .ix {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--mute-2);
  width: 18px;
}
.sidebar .nav-item.active .ix { color: var(--yellow); }
.sidebar .nav-item .ico { width: 16px; height: 16px; }
.sidebar .nav-item .count {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--mono);
  background: var(--mist);
  color: var(--mute);
  padding: 2px 6px;
  border-radius: var(--r-xs);
  font-weight: 700;
}
.sidebar .nav-item.active .count {
  background: rgba(255,255,255,0.12);
  color: var(--yellow);
}

.sidebar .periodcard {
  margin: 14px 12px 8px;
  border: 1px solid var(--line);
  background: var(--bone);
  padding: 12px;
  border-radius: var(--r-sm);
}
.sidebar .periodcard .label {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--mute-soft);
  text-transform: uppercase;
  font-weight: 700;
}
.sidebar .periodcard .val {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 18px;
  margin-top: 4px;
}
.sidebar .periodcard .meta {
  margin-top: 8px;
  font-size: 11px;
  color: var(--mute);
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
}
.sidebar .periodcard .bar {
  height: 4px;
  background: var(--line);
  margin-top: 6px;
  position: relative;
  border-radius: 99px;
  overflow: hidden;
}
.sidebar .periodcard .bar .fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--yellow);
  border-radius: 99px;
}

.sidebar .foot {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--mute);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .foot .l1 { font-weight: 900; color: var(--ink); letter-spacing: 0.04em; }

/* Topbar nav variant */
.topnav {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  padding: 0 28px;
  gap: 0;
  overflow-x: auto;
}
.topnav .nav-item {
  padding: 12px 16px;
  font-weight: 700;
  font-size: 13px;
  color: var(--mute);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.topnav .nav-item:hover { color: var(--ink); }
.topnav .nav-item.active {
  color: var(--ink);
  border-bottom-color: var(--yellow);
}
.topnav .nav-item .ix {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--mute-2);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main {
  overflow-y: auto;
  background: var(--bone);
  position: relative;
}

.page-head {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 22px 32px 0;
}
.page-head .breadcrumb {
  font-size: 11px;
  color: var(--mute);
  font-family: var(--mono);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.page-head .breadcrumb a { color: var(--mute); }
.page-head .breadcrumb .sep { color: var(--mute-2); }
.page-head .breadcrumb .cur { color: var(--ink); font-weight: 700; }

.page-head .row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
}
.page-head h1 {
  font-family: var(--sans);
  font-weight: 900;
  font-size: 26px;
  margin: 0;
  letter-spacing: -0.015em;
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.page-head h1 .ix {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  letter-spacing: 0;
  font-weight: 700;
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: var(--r-xs);
}
.page-head .sub {
  color: var(--mute);
  margin-top: 6px;
  max-width: 640px;
  font-size: 13px;
}
.page-head .actions { display: flex; gap: 8px; align-items: center; }

.page-tabs {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--line-soft);
  margin: 0 -32px;
  padding: 0 32px;
}
.page-tabs .tab {
  padding: 10px 0;
  margin-right: 22px;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--mute);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-top: -1px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-tabs .tab:hover { color: var(--ink); }
.page-tabs .tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.page-tabs .tab .ct {
  font-family: var(--mono);
  background: var(--mist);
  color: var(--mute);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: var(--r-xs);
}

.page-body {
  padding: 24px 32px 80px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  line-height: 1;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary {
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--yellow);
}
.btn-primary:hover { background: var(--yellow-deep); border-color: var(--yellow-deep); }
.btn-dark {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn-dark:hover { background: #000; }
.btn-ghost {
  background: var(--paper);
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { background: var(--mist); border-color: var(--mute-2); }
.btn-soft {
  background: var(--mist);
  color: var(--ink);
}
.btn-soft:hover { background: var(--line); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn-link {
  background: transparent;
  border: 0;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--yellow);
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
  padding: 0;
  font-weight: 700;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================
   CARDS / PANELS
   ============================================ */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.card-pad { padding: 18px; }
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.005em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-head .ix {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--mute);
  background: var(--mist);
  padding: 1px 5px;
  border-radius: var(--r-xs);
  font-weight: 700;
}
.card-head .sub { font-size: 11.5px; color: var(--mute); font-weight: 400; }
.card-head .right { display: flex; align-items: center; gap: 8px; }

/* Grids */
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-12 { grid-template-columns: repeat(12, 1fr); }

/* ============================================
   KPI / METRIC BLOCKS
   ============================================ */
.kpi {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
}
.kpi .label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
}
.kpi .val {
  font-family: var(--sans);
  font-weight: 900;
  font-size: 30px;
  letter-spacing: -0.02em;
  margin-top: 8px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi .val .pre {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--mute);
  font-size: 14px;
  margin-right: 4px;
}
.kpi .unit { color: var(--mute); font-weight: 700; font-size: 13px; margin-left: 4px; }
.kpi .delta {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
}
.kpi .delta.up { color: var(--ok); }
.kpi .delta.down { color: var(--err); }
.kpi .delta.flat { color: var(--mute); }
.kpi .spark { margin-top: 12px; height: 28px; }
.kpi.feature {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.kpi.feature .label { color: rgba(255,255,255,0.55); }
.kpi.feature .val { color: var(--paper); }
.kpi.feature .val .pre { color: var(--yellow); }
.kpi.feature::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--yellow);
}

/* ============================================
   BADGES & CHIPS
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--mist);
  color: var(--ink);
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge.dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.badge-ok    { background: var(--ok-tint);   color: var(--ok); }
.badge-warn  { background: var(--warn-tint); color: var(--warn); }
.badge-err   { background: var(--err-tint);  color: var(--err); }
.badge-info  { background: var(--info-tint); color: var(--info); }
.badge-yellow{ background: var(--yellow-soft); color: var(--yellow-deep); }
.badge-dark  { background: var(--ink); color: var(--paper); }
.badge-area  { background: color-mix(in srgb, var(--area) 10%, transparent); color: var(--area); }
.badge-line  { background: var(--paper); border-color: var(--line); color: var(--ink); }
.badge-square { border-radius: var(--r-xs); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
}
.chip:hover { border-color: var(--mute-2); }
.chip.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.chip .ct {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--mist);
  color: var(--mute);
  padding: 1px 5px;
  border-radius: var(--r-xs);
}
.chip.active .ct {
  background: rgba(255,255,255,0.15);
  color: var(--yellow);
}

/* ============================================
   TABLES
   ============================================ */
.table-wrap {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
}
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  padding: 10px 14px;
  background: var(--bone);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FBFBF9; }
.table .num { text-align: right; font-family: var(--mono); }
.table .right { text-align: right; }
.table .ix-cell {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
}
.table .strong { font-weight: 700; }
.table .row-actions {
  display: flex; gap: 4px; justify-content: flex-end;
  opacity: 0;
  transition: opacity 120ms;
}
.table tbody tr:hover .row-actions { opacity: 1; }
.table .iconbtn {
  background: transparent;
  border: 1px solid transparent;
  width: 26px; height: 26px;
  border-radius: var(--r-xs);
  display: grid; place-items: center;
  color: var(--mute);
}
.table .iconbtn:hover { background: var(--mist); color: var(--ink); border-color: var(--line); }

/* Progress bar in table cell */
.tprog {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
}
.tprog .bar {
  flex: 1;
  height: 6px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}
.tprog .bar .fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--ink);
  border-radius: 99px;
}
.tprog .bar .fill.warn { background: var(--warn); }
.tprog .bar .fill.err  { background: var(--err); }
.tprog .bar .fill.ok   { background: var(--ok); }
.tprog .bar .fill.area { background: var(--area); }
.tprog .pct {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  min-width: 40px;
  text-align: right;
  font-weight: 700;
}

/* ============================================
   FORMS
   ============================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}
.input, .select, .textarea {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--mute-2); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px var(--yellow-soft);
}
.input::placeholder { color: var(--mute-2); }
.field-help { font-size: 11px; color: var(--mute); }
.field-err { font-size: 11px; color: var(--err); font-weight: 700; }

.input-group {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--paper);
}
.input-group:focus-within { border-color: var(--yellow); box-shadow: 0 0 0 3px var(--yellow-soft); }
.input-group .prefix {
  padding: 9px 11px;
  background: var(--bone);
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
  display: grid; place-items: center;
}
.input-group input {
  flex: 1; border: 0; padding: 9px 11px; outline: none; background: transparent;
}

/* Toggle */
.toggle {
  width: 36px; height: 20px;
  background: var(--line);
  border-radius: 99px;
  position: relative;
  cursor: pointer;
  transition: background 120ms;
}
.toggle.on { background: var(--ink); }
.toggle::after {
  content: ""; position: absolute;
  width: 14px; height: 14px;
  background: var(--paper);
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: left 140ms;
}
.toggle.on::after { left: 19px; }
.toggle.on.yellow { background: var(--yellow); }
.toggle.on.yellow::after { background: var(--ink); }

/* ============================================
   ALERTS
   ============================================ */
.alert {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-left-width: 3px;
  border-radius: var(--r-sm);
}
.alert.warn { border-left-color: var(--warn); background: var(--warn-tint); }
.alert.err { border-left-color: var(--err); background: var(--err-tint); }
.alert.info { border-left-color: var(--info); background: var(--info-tint); }
.alert.ok { border-left-color: var(--ok); background: var(--ok-tint); }
.alert .ico { flex-shrink: 0; margin-top: 1px; }
.alert .title { font-weight: 900; font-size: 13px; }
.alert .body { color: var(--mute); font-size: 12.5px; margin-top: 2px; }

/* ============================================
   EDITORIAL TYPE
   ============================================ */
.edit-quote {
  font-family: var(--serif);
  font-weight: 900;
  letter-spacing: -0.01em;
  font-size: 22px;
  line-height: 1.25;
  color: var(--ink);
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 14px;
  height: 2px;
  background: var(--yellow);
}

/* ============================================
   CHATBOT PANEL
   ============================================ */
.bot {
  background: var(--paper);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  grid-row: 2 / -1;
  grid-column: 3;
}
.app[data-nav="top"] .bot { grid-row: 2 / -1; grid-column: 2; }
.app[data-bot="left"] .bot {
  grid-column: 1;
  grid-row: 2 / -1;
  border-left: 0;
  border-right: 1px solid var(--line);
}

.bot-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 3px solid var(--yellow);
}
.bot-head .av {
  width: 28px; height: 28px;
  background: var(--yellow);
  border-radius: 4px;
  display: grid; place-items: center;
  color: var(--ink);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.06em;
}
.bot-head .tt { display: flex; flex-direction: column; line-height: 1.1; }
.bot-head .tt .name { font-weight: 900; font-size: 13px; }
.bot-head .tt .status {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.bot-head .tt .status .ind {
  display: inline-block;
  width: 6px; height: 6px;
  background: #4ADE80;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: 1px;
}
.bot-head .x {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.7);
  padding: 4px;
}
.bot-head .x:hover { color: #fff; }

.bot-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background:
    radial-gradient(circle, var(--line-soft) 1px, transparent 1px) 0 0 / 18px 18px,
    var(--paper);
}

.msg { display: flex; gap: 8px; max-width: 92%; }
.msg.bot-msg { align-self: flex-start; }
.msg.user-msg { align-self: flex-end; flex-direction: row-reverse; }
.msg .av {
  width: 24px; height: 24px;
  border-radius: 4px;
  display: grid; place-items: center;
  font-size: 10px;
  font-weight: 900;
  flex-shrink: 0;
}
.msg.bot-msg .av { background: var(--ink); color: var(--yellow); }
.msg.user-msg .av { background: var(--yellow); color: var(--ink); }
.msg .bubble {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink);
}
.msg.user-msg .bubble {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.msg .bubble .who {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--mute);
  margin-bottom: 2px;
}
.msg .bubble strong { font-weight: 900; }
.msg .data-block {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bone);
  font-size: 11.5px;
}
.msg .data-block .dh {
  background: var(--ink);
  color: var(--yellow);
  padding: 5px 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  display: flex;
  justify-content: space-between;
}
.msg .data-block .row {
  display: flex;
  justify-content: space-between;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono);
}
.msg .data-block .row:last-child { border-bottom: 0; }
.msg .data-block .row .v { font-weight: 700; color: var(--ink); }
.msg .quickreplies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.msg .quickreplies button {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  color: var(--ink);
}
.msg .quickreplies button:hover {
  border-color: var(--yellow);
  background: var(--yellow-soft);
}

.bot-footer {
  border-top: 1px solid var(--line);
  padding: 10px 12px 12px;
  background: var(--paper);
}
.bot-footer .suggests {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.bot-footer .suggests button {
  background: var(--mist);
  border: 1px solid var(--line);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--r-xs);
  color: var(--ink);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.bot-footer .suggests button:hover { background: var(--yellow-soft); border-color: var(--yellow); }
.bot-footer .input-row {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.bot-footer .input-row:focus-within {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px var(--yellow-soft);
}
.bot-footer input {
  flex: 1;
  border: 0; outline: 0;
  padding: 9px 11px;
  font-size: 12.5px;
}
.bot-footer .send {
  background: var(--ink);
  color: var(--paper);
  border: 0;
  width: 38px;
  display: grid; place-items: center;
}
.bot-footer .send:hover { background: var(--yellow); color: var(--ink); }
.bot-footer .meta {
  margin-top: 8px;
  font-size: 10px;
  color: var(--mute-2);
  font-family: var(--mono);
  display: flex;
  justify-content: space-between;
}

/* Floating chatbot open button */
.bot-fab {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 99px;
  padding: 12px 16px 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  z-index: 50;
}
.bot-fab .ico {
  width: 24px; height: 24px;
  background: var(--yellow);
  color: var(--ink);
  border-radius: 6px;
  display: grid; place-items: center;
  font-weight: 900;
  font-size: 11px;
}
.bot-fab .tt { font-weight: 900; font-size: 12px; letter-spacing: 0.02em; }
.bot-fab .tt .sub {
  display: block;
  font-weight: 700;
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.app[data-bot="left"] .bot-fab { right: auto; left: 18px; }

/* ============================================
   MODAL / OVERLAY
   ============================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,0.6);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 40px;
}
.modal {
  background: var(--paper);
  width: 100%;
  max-width: 880px;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  overflow: hidden;
  border-top: 4px solid var(--yellow);
}
.modal-head {
  display: flex;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
}
.modal-head .tt {
  font-weight: 900;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-head .tt .ix {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  background: var(--mist);
  padding: 2px 6px;
  border-radius: var(--r-xs);
}
.modal-body { flex: 1; overflow-y: auto; padding: 22px; }
.modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--bone);
}

/* Wizard stepper */
.stepper {
  display: flex;
  align-items: center;
  margin-bottom: 22px;
  gap: 0;
}
.stepper .step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--mute);
  font-weight: 700;
  flex: 1;
}
.stepper .step .num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--mist);
  color: var(--mute);
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 900;
  flex-shrink: 0;
}
.stepper .step.active .num {
  background: var(--ink);
  color: var(--yellow);
}
.stepper .step.done .num {
  background: var(--yellow);
  color: var(--ink);
}
.stepper .step.active { color: var(--ink); }
.stepper .step.done { color: var(--ink); }
.stepper .step .conn {
  flex: 1;
  height: 1px;
  background: var(--line);
}
.stepper .step.done .conn { background: var(--yellow); }
.stepper .step:last-child .conn { display: none; }

/* ============================================
   TIMELINE
   ============================================ */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--line);
}
.timeline .ev {
  position: relative;
  padding: 0 0 14px;
}
.timeline .ev::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink);
}
.timeline .ev.yellow::before { border-color: var(--yellow); background: var(--yellow); }
.timeline .ev.area::before { border-color: var(--area); background: var(--area); }
.timeline .ev .when {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--mute);
  letter-spacing: 0.04em;
}
.timeline .ev .what { font-weight: 700; font-size: 13px; }
.timeline .ev .who { font-size: 11.5px; color: var(--mute); }

/* ============================================
   MISC / UTILS
   ============================================ */
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.row-flex { display: flex; align-items: center; gap: 12px; }
.row-flex.between { justify-content: space-between; }
.hint {
  font-size: 11px;
  color: var(--mute);
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

.dot-sep {
  display: inline-block;
  width: 3px; height: 3px;
  background: var(--mute-2);
  border-radius: 50%;
  margin: 0 8px;
  vertical-align: 3px;
}

.scope-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: var(--r-xs);
  font-weight: 700;
}
.scope-tag .sq {
  width: 8px;
  height: 8px;
  background: var(--area);
  border-radius: 2px;
}

/* Decorative section ribbon */
.section-ribbon {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.section-ribbon .ix {
  font-family: var(--mono);
  font-weight: 900;
  font-size: 11px;
  color: var(--mute);
  letter-spacing: 0.06em;
}
.section-ribbon .tt {
  font-weight: 900;
  font-size: 13px;
  letter-spacing: -0.005em;
}
.section-ribbon .rl { flex: 1; }
.section-ribbon .meta { font-size: 11px; color: var(--mute); font-family: var(--mono); }

/* Hover row reveal helper */
tr.reveal-host .reveal { opacity: 0; transition: opacity 120ms; }
tr.reveal-host:hover .reveal { opacity: 1; }

/* Scrollbar */
.main::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.bot-body::-webkit-scrollbar { width: 10px; height: 10px; }
.main::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.bot-body::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 99px;
  border: 2px solid var(--bone);
}
.main::-webkit-scrollbar-track { background: transparent; }

/* Compact ticker bar at top of dashboard */
.ticker {
  background: var(--ink);
  color: rgba(255,255,255,0.85);
  border-bottom: 1px solid #000;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 6px 32px;
  display: flex;
  gap: 28px;
  overflow: hidden;
  white-space: nowrap;
}
.ticker .label { color: var(--yellow); font-weight: 700; }
.ticker .pos { color: #4ADE80; }
.ticker .neg { color: #F87171; }

/* IA-NET hero rule */
.identity-rule {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 6px 0 14px;
}
.identity-rule .ix {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--mute);
  letter-spacing: 0.06em;
  font-weight: 700;
}
.identity-rule .ln {
  height: 1px;
  background: var(--line);
  position: relative;
}
.identity-rule .ln::after {
  content: "";
  position: absolute;
  left: 0; top: -1px;
  width: 40px;
  height: 3px;
  background: var(--yellow);
}
.identity-rule .tag {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.22em;
  color: var(--ink);
}

/* Approval queue card */
.approve-card {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 14px 16px;
  border-left: 3px solid var(--yellow);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
}
.approve-card .meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--mute);
  letter-spacing: 0.04em;
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
}
.approve-card .tt {
  font-weight: 900;
  font-size: 14px;
}
.approve-card .sub {
  font-size: 12px;
  color: var(--mute);
  margin-top: 3px;
}
.approve-card .amt {
  font-family: var(--mono);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.approve-card .amt small {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--mute);
  font-weight: 700;
  display: block;
  letter-spacing: 0.06em;
  text-align: right;
}
.approve-card .actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  align-items: center;
}

/* Donut */
.donut-wrap {
  display: flex;
  gap: 20px;
  align-items: center;
}
.donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.donut-legend .l {
  display: grid;
  grid-template-columns: 8px 1fr auto auto;
  gap: 10px;
  align-items: center;
}
.donut-legend .l .sq { width: 8px; height: 8px; border-radius: 2px; }
.donut-legend .l .v { font-family: var(--mono); font-weight: 700; }
.donut-legend .l .p { font-family: var(--mono); font-size: 11px; color: var(--mute); min-width: 38px; text-align: right; }

/* Print friendly */
@media (max-width: 1280px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
}
