/* ─── HR Platform — Component Library ──────────────────────────────── */
/* Requires: Bootstrap 5.3.2, theme.css                                      */
/* Body must have class="app theme-dark" (or theme-light)                    */

/* ── Reset extras ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; }
button { font-family: var(--font-sans); }
input, select, textarea { font-family: var(--font-sans); }

/* ── App shell layout ───────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 28px 1fr;
  min-height: 100vh;
  grid-template-areas: "sidebar topbar" "sidebar ticker" "sidebar main";
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.app-sidebar {
  grid-area: sidebar;
  background: var(--panel);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }

.brand-mark {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -.5px;
}

.brand-text { line-height: 1.2; }
.brand-name { font-size: 12px; font-weight: 600; color: var(--text-heading); text-transform: uppercase; letter-spacing: .04em; }
.brand-sub  { font-size: 10px; color: var(--text-faint); }

.sidebar-section { padding: 18px 0 6px; }
.sidebar-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 20px;
  margin-bottom: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
  text-decoration: none;
  min-height: 44px;
}
.nav-item:hover { color: var(--text-primary); background: var(--row-hover); text-decoration: none; }
.nav-item.active,
.nav-item[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-bg);
  border-left-color: var(--accent);
}
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .7; }
.nav-item.active svg, .nav-item:hover svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  font-family: var(--font-mono);
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
}
.user-pill { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 30px; height: 30px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 12px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role  { font-size: 10px; color: var(--text-faint); }
.btn-signout {
  display: block; width: 100%;
  text-align: left;
  background: none; border: none;
  color: var(--text-faint); font-size: 11px;
  padding: 6px 0; margin-top: 6px;
  cursor: pointer;
  transition: color .15s;
  text-decoration: none;
  min-height: 44px;
  display: flex; align-items: center;
}
.btn-signout:hover { color: var(--danger); }

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.app-topbar {
  grid-area: topbar;
  background: var(--panel);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky; top: 0; z-index: 90;
  box-shadow: var(--shadow-sm);
}
.topbar-crumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-faint); }
.topbar-crumb svg { width: 12px; height: 12px; opacity: .5; }
.topbar-crumb .current { color: var(--text-primary); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-clock {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  background: var(--surface-elev);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  display: flex; align-items: center; gap: 6px;
}
.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Main content ───────────────────────────────────────────────────────── */
.app-main {
  grid-area: main;
  margin-left: var(--sidebar-w);
  padding: 28px;
  min-height: calc(100vh - var(--topbar-h));
  background: var(--bg);
}

.page-header { margin-bottom: 24px; }
.page-title  { font-size: 22px; font-weight: 700; color: var(--text-heading); letter-spacing: -.3px; line-height: 1.2; }
.page-sub    { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.app-card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.app-card:hover { border-color: var(--border); }
.app-card-padded { padding: 20px; }

.app-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.app-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-section-count {
  background: var(--surface-elev);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
}
.app-section-count.danger  { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger); }
.app-section-count.warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }

/* ── Launch / module cards ──────────────────────────────────────────────── */
.launch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 28px; }

.launch-card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  transition: all .2s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.launch-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--lc-accent, var(--accent));
  opacity: 0; transition: opacity .2s;
}
.launch-card:hover {
  background: var(--card-hover);
  border-color: var(--lc-accent, var(--accent));
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
}
.launch-card:hover::before { opacity: 1; }
.launch-card:active { transform: scale(.97); }
.launch-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.lc-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  background: var(--lc-icon-bg, var(--accent-bg));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lc-icon svg { width: 20px; height: 20px; color: var(--lc-accent, var(--accent)); }
.lc-label { font-size: 13px; font-weight: 600; color: var(--text-heading); }
.lc-desc  { font-size: 11px; color: var(--text-muted); line-height: 1.55; }
.lc-meta  { margin-top: auto; font-size: 10px; font-family: var(--font-mono); color: var(--text-faint); }

/* ── KPI Strip ──────────────────────────────────────────────────────────── */
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 24px; }

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color .15s;
}
.kpi-card.clickable, a.kpi-card { cursor: pointer; text-decoration: none; color: inherit; }
.kpi-card.clickable:hover, a.kpi-card:hover { border-color: var(--border); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.kpi-label   { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.kpi-primary { font-size: 28px; font-weight: 700; line-height: 1; font-family: var(--font-mono); color: var(--text-heading); font-variant-numeric: tabular-nums; }
.kpi-num     { font-size: 22px; font-weight: 700; font-family: var(--font-mono); color: var(--text-heading); font-variant-numeric: tabular-nums; }
.kpi-sub     { font-size: 11px; color: var(--text-muted); }
.kpi-delta   { font-size: 11px; color: var(--text-muted); }
.kpi-delta.up   { color: var(--success); }
.kpi-delta.down { color: var(--danger); }
.kpi-split   { display: flex; align-items: center; gap: 6px; }
.kpi-split .sep { color: var(--text-faint); font-size: 16px; }

/* KPI colour accents (left border + label tint) */
.kpi-green { border-left: 3px solid var(--success); }
.kpi-amber { border-left: 3px solid var(--warning); }
.kpi-red   { border-left: 3px solid var(--danger); }
.kpi-blue  { border-left: 3px solid var(--accent); }
.kpi-green .kpi-label { color: var(--success); }
.kpi-amber .kpi-label { color: var(--warning); }
.kpi-red   .kpi-label { color: var(--danger); }
.kpi-blue  .kpi-label { color: var(--accent); }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.app-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
  background: var(--surface-elev);
  color: var(--text-muted);
  white-space: nowrap;
}
.app-badge.success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.app-badge.warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.app-badge.danger  { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger); }
.app-badge.info    { background: var(--accent-bg);  border-color: var(--accent-border);  color: var(--accent); }
.app-badge.muted   { background: var(--surface-elev); border-color: var(--border-subtle); color: var(--text-faint); }

/* Countdown badges */
.countdown-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--radius-md);
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted); background: var(--surface-elev);
}
.countdown-badge .num { font-family: var(--font-mono); font-weight: 700; }
.countdown-badge.success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.countdown-badge.warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.countdown-badge.danger  { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger); }

/* Small inline tag */
.app-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  color: var(--text-faint);
  background: var(--surface-elev);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.app-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  min-height: 36px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  border: 1px solid var(--border);
  background: var(--surface-elev);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  line-height: 1;
  white-space: nowrap;
}
.app-btn:hover { background: var(--card-hover); border-color: var(--border-hover); color: var(--text-primary); text-decoration: none; }
.app-btn:active { transform: scale(.97); }
.app-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.app-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.app-btn.danger-outline {
  border-color: var(--danger-border);
  color: var(--danger);
  background: var(--danger-bg);
}
.app-btn.danger-outline:hover { background: var(--danger-bg); border-color: var(--danger); }

.app-btn.ghost { background: transparent; border-color: transparent; }
.app-btn.ghost:hover { background: var(--row-hover); border-color: var(--border-subtle); }

.app-btn svg { width: 14px; height: 14px; }
.app-btn.sm  { padding: 4px 10px; font-size: 11px; min-height: 30px; }
.app-btn.lg  { padding: 10px 20px; font-size: 14px; min-height: 44px; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.form-hint { font-size: 11px; color: var(--text-faint); margin-top: 4px; }

.app-input,
.app-select,
.app-textarea {
  width: 100%;
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  min-height: 36px;
}
.app-input:focus,
.app-select:focus,
.app-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.app-input::placeholder { color: var(--text-faint); }
.app-textarea { resize: vertical; min-height: 80px; }

.app-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8f96' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.app-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.app-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  background: var(--surface-elev);
  white-space: nowrap;
}
.app-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: top;
}
.app-table tr:last-child td { border-bottom: none; }
.app-table tbody tr { transition: background .1s; }
.app-table tbody tr:hover { background: var(--row-hover); }
.app-table td.td-primary { color: var(--text-primary); font-weight: 500; }
.app-table td.td-muted   { color: var(--text-faint); }
.app-table td.td-num     { text-align: right; font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.app-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  background: var(--surface-elev);
  color: var(--text-secondary);
}
.app-alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.app-alert.success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.app-alert.warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.app-alert.danger  { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger); }
.app-alert.info    { background: var(--accent-bg);  border-color: var(--accent-border);  color: var(--accent); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.app-tabs-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.app-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 14px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  letter-spacing: .04em;
  text-transform: uppercase;
  min-height: 44px;
}
.app-tab:hover { color: var(--text-primary); text-decoration: none; }
.app-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.app-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Accordion ───────────────────────────────────────────────────────────── */
.accordion-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  overflow: hidden;
}
.accordion-trigger {
  width: 100%;
  background: var(--card);
  border: none;
  color: var(--text-primary);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background .15s;
  min-height: 44px;
}
.accordion-trigger:hover { background: var(--card-hover); }
.accordion-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.accordion-trigger svg.chevron { width: 14px; height: 14px; color: var(--text-faint); transition: transform .2s; flex-shrink: 0; }
.accordion-item.open .accordion-trigger svg.chevron { transform: rotate(180deg); }
.accordion-body {
  display: none;
  padding: 18px;
  background: var(--bg);
  border-top: 1px solid var(--border-subtle);
}
.accordion-item.open .accordion-body { display: block; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title  { font-size: 16px; font-weight: 700; color: var(--text-heading); }
.modal-close  {
  background: none; border: none;
  color: var(--text-faint); font-size: 20px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer; transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--surface-elev); color: var(--text-primary); }

/* ── Timeline ────────────────────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: ''; position: absolute;
  left: 6px; top: 0; bottom: 0;
  width: 1px; background: var(--border-subtle);
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before {
  content: ''; position: absolute;
  left: -17px; top: 5px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.timeline-date  { font-size: 10px; font-family: var(--font-mono); color: var(--text-faint); margin-bottom: 2px; }
.timeline-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.timeline-body  { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

/* ── Section divider ─────────────────────────────────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-subtle); }

/* ── KPI progress bar ────────────────────────────────────────────────────── */
.kpi-bar { margin-bottom: 14px; }
.kpi-bar-header { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 12px; }
.kpi-bar-label  { color: var(--text-secondary); }
.kpi-bar-value  { color: var(--text-primary); font-family: var(--font-mono); font-weight: 600; }
.kpi-track { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.kpi-fill  { height: 100%; border-radius: 2px; background: var(--accent); transition: width .6s ease; }
.kpi-fill.good { background: var(--success); }
.kpi-fill.warn { background: var(--warning); }
.kpi-fill.bad  { background: var(--danger); }

/* ── Project cards ───────────────────────────────────────────────────────── */
.project-card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.project-card:hover { border-color: var(--border); box-shadow: var(--shadow-md); }
.project-year  { font-size: 11px; font-family: var(--font-mono); color: var(--accent); font-weight: 700; }
.project-name  { font-size: 15px; font-weight: 700; color: var(--text-heading); margin: 4px 0 2px; }
.project-loc   { font-size: 11px; color: var(--text-faint); margin-bottom: 10px; }
.project-desc  { font-size: 12px; color: var(--text-secondary); line-height: 1.65; margin-bottom: 12px; }

/* ── Case law cards ──────────────────────────────────────────────────────── */
.case-card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s;
}
.case-card:hover { border-color: var(--border); }
.case-citation { font-size: 13px; font-weight: 700; color: var(--text-heading); margin-bottom: 4px; }
.case-meta     { font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); margin-bottom: 10px; }
.case-principle {
  background: var(--accent-bg);
  border-left: 2px solid var(--accent);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 10px 0;
  font-style: italic;
}

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border-subtle) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: .5;
  pointer-events: none;
}
.login-glow {
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent-bg) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  pointer-events: none;
}
.login-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg);
}
.login-header  { text-align: center; margin-bottom: 28px; }
.login-logo    {
  width: 52px; height: 52px;
  background: var(--accent);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900; color: #fff;
  margin: 0 auto 14px;
}
.login-title   { font-size: 20px; font-weight: 700; color: var(--text-heading); margin-bottom: 4px; }
.login-sub     { font-size: 12px; color: var(--text-muted); }
.login-footer  { text-align: center; margin-top: 20px; font-size: 11px; color: var(--text-faint); }

/* ── Hero banner ─────────────────────────────────────────────────────────── */
.hero-banner {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.hero-banner h1 { font-size: 24px; font-weight: 700; color: var(--text-heading); margin: 0 0 4px; }
.hero-meta      { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.hero-badges    { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Divider ─────────────────────────────────────────────────────────────── */
.app-divider { height: 1px; background: var(--border-subtle); margin: 18px 0; }

/* ── Mono utility ────────────────────────────────────────────────────────── */
.mono { font-family: var(--font-mono); }
.text-muted   { color: var(--text-muted) !important; }
.text-faint   { color: var(--text-faint) !important; }
.text-accent  { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger  { color: var(--danger) !important; }
.text-heading { color: var(--text-heading) !important; }

/* ── Grid helpers ────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 900px)  { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── Responsive sidebar ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: var(--topbar-h) 28px 1fr; grid-template-areas: "topbar" "ticker" "main"; }
  .app-sidebar { display: none; }
  .app-main { margin-left: 0; padding: 16px; }
  .launch-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ── Spacing helpers ─────────────────────────────────────────────────────── */
.mt-1{margin-top:4px} .mt-2{margin-top:8px} .mt-3{margin-top:16px} .mt-4{margin-top:24px} .mt-5{margin-top:32px}
.mb-1{margin-bottom:4px} .mb-2{margin-bottom:8px} .mb-3{margin-bottom:16px} .mb-4{margin-bottom:24px} .mb-5{margin-bottom:32px}
.gap-2{gap:8px} .gap-3{gap:16px}
.w-full{width:100%}
.flex{display:flex} .items-center{align-items:center} .justify-between{justify-content:space-between} .flex-wrap{flex-wrap:wrap}
.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ── Flash toasts ────────────────────────────────────────────────────────── */
.toast-stack {
  position: fixed; top: 16px; right: 16px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px; max-width: 360px;
}

/* ── News Ticker ─────────────────────────────────────────────────────────── */
.news-ticker {
  grid-area: ticker;
  margin-left: var(--sidebar-w);
  height: 28px;
  display: flex;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
  flex-shrink: 0;
}
.ticker-label {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--surface-elev);
  border-right: 1px solid var(--border);
  padding: 0 10px;
  height: 100%;
  display: flex;
  align-items: center;
  text-decoration: none;
  white-space: nowrap;
}
.ticker-label:hover { color: var(--accent-hover); text-decoration: none; }
.ticker-track {
  flex: 1;
  overflow: hidden;
  height: 100%;
  display: flex;
  align-items: center;
}
.ticker-inner {
  display: inline-block;
  white-space: nowrap;
  animation: ticker-scroll 180s linear infinite;
  font-size: 11px;
  color: var(--text-secondary);
  padding-left: 100%;
}
.ticker-inner:hover { animation-play-state: paused; }
.ticker-item { padding: 0 20px; }
.ticker-item a { color: var(--text-secondary); text-decoration: none; }
.ticker-item a:hover { color: var(--text-primary); }
.ticker-sep { color: var(--text-muted); opacity: .4; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── News cards ──────────────────────────────────────────────────────────── */
.news-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background .1s;
}
.news-card:hover { background: var(--row-hover); }
.news-card:last-child { border-bottom: none; }
.news-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  text-decoration: none;
}
.news-card-title:hover { color: var(--accent); text-decoration: none; }
.news-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}
.news-card-actions { display: flex; align-items: center; gap: 8px; }
.btn-save-news {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  letter-spacing: .04em;
}
.btn-save-news:hover { border-color: var(--accent); color: var(--accent); }
.btn-save-news.saved { border-color: var(--success); color: var(--success); background: var(--success-bg); }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
/* Page fade uses opacity only — transform-based animations on parent elements
   create a new containing block for position:fixed children (modal overlays),
   trapping them inside the page rather than the viewport. */
.fade-in { animation: fadeIn .25s ease forwards; }

/* Modal box animates on open, not on page load */
.modal-box { animation: none; }
.modal-overlay.active .modal-box { animation: fadeUp .18s ease; }
