/* ==========================================================================
   Atlas BI · Enterprise SaaS Design System (Atlas Enterprise)
   Modern, information-dense, highly readable UI for Spanish public procurement
   Zero Node dependencies · Vanilla CSS with native variables and micro-interactions
   ========================================================================== */

:root {
  /* Color Palette - Light Mode (Default) */
  --surface-canvas: #f8fafc;
  --surface-card: #ffffff;
  --surface-subtle: #f1f5f9;
  --surface-hover: #f8fafc;
  --surface-active: #e2e8f0;
  --surface-elevated: #ffffff;

  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-default: rgba(15, 23, 42, 0.14);
  --border-strong: rgba(15, 23, 42, 0.24);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Brand Accents (Deep Corporate Indigo) */
  --brand: #4338ca;
  --brand-hover: #3730a3;
  --brand-light: #eef2ff;
  --brand-border: #c7d2fe;

  /* Semantic Status Colors */
  --emerald: #059669;
  --emerald-bg: #ecfdf5;
  --emerald-border: #a7f3d0;

  --amber: #d97706;
  --amber-bg: #fffbeb;
  --amber-border: #fde68a;

  --rose: #e11d48;
  --rose-bg: #fff1f2;
  --rose-border: #fecdd3;

  --sky: #0284c7;
  --sky-bg: #f0f9ff;
  --sky-border: #bae6fd;

  --violet: #7c3aed;
  --violet-bg: #f5f3ff;
  --violet-border: #ddd6fe;

  --slate: #475569;
  --slate-bg: #f8fafc;
  --slate-border: #e2e8f0;

  /* Typography & Layout Metrics */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

  --sidebar-width: 250px;
  --sidebar-collapsed-width: 68px;
  --header-height: 56px;

  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  /* TRUE PURE JET BLACK / OBSIDIAN DARK (0% Blue Tint) */
  --surface-canvas: #000000;
  --surface-card: #0d0d0d;
  --surface-subtle: #141414;
  --surface-hover: #1c1c1c;
  --surface-active: #242424;
  --surface-elevated: #111111;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-default: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.25);

  --text-primary: #ffffff;
  --text-secondary: #d4d4d8;
  --text-muted: #a1a1aa;
  --text-inverse: #000000;

  /* Electric Violet Accent (Strictly Non-Blue) */
  --brand: #8b5cf6;
  --brand-hover: #a78bfa;
  --brand-light: rgba(139, 92, 246, 0.15);
  --brand-border: rgba(139, 92, 246, 0.38);

  --emerald: #10b981;
  --emerald-bg: rgba(16, 185, 129, 0.12);
  --emerald-border: rgba(16, 185, 129, 0.3);

  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --amber-border: rgba(245, 158, 11, 0.3);

  --rose: #f43f5e;
  --rose-bg: rgba(244, 63, 94, 0.12);
  --rose-border: rgba(244, 63, 94, 0.3);

  --sky: #38bdf8;
  --sky-bg: rgba(56, 189, 248, 0.12);
  --sky-border: rgba(56, 189, 248, 0.3);

  --violet: #a78bfa;
  --violet-bg: rgba(167, 139, 250, 0.12);
  --violet-border: rgba(167, 139, 250, 0.3);

  --slate: #a1a1aa;
  --slate-bg: rgba(161, 161, 170, 0.1);
  --slate-border: rgba(161, 161, 170, 0.25);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.6);
  --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.75), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 20px -3px rgba(0, 0, 0, 0.85), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 24px 32px -5px rgba(0, 0, 0, 0.95), 0 8px 12px -6px rgba(0, 0, 0, 0.6);
}

/* Reset & Global Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--surface-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* HTMX Top Progress Bar */
#htmx-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2.5px;
  width: 0;
  background: linear-gradient(90deg, var(--brand), #a855f7);
  z-index: 9999;
  transition: width 180ms ease, opacity 200ms ease;
  pointer-events: none;
  box-shadow: 0 0 10px var(--brand);
}

/* Application Shell Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
}

/* Sidebar */
.app-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  background-color: var(--surface-card);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: width var(--transition-normal), transform var(--transition-normal);
}

.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.brand-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-info strong {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-info small {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-collapsed .brand-info {
  display: none;
}

.sidebar-collapse {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition-fast);
}

.sidebar-collapse:hover {
  background: var(--surface-active);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.sidebar-collapsed .sidebar-collapse {
  position: absolute;
  right: -13px;
  top: 15px;
  background: var(--surface-card);
  box-shadow: var(--shadow-md);
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-title {
  padding: 12px 10px 4px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.sidebar-collapsed .nav-section-title {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-item:hover {
  background-color: var(--surface-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background-color: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}


/* Modern SVG Iconography System */
.nav-svg,
.btn-svg,
.icon-svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  stroke: currentColor;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  color: var(--brand);
}

.theme-icon-dark {
  display: none;
}
.theme-icon-light {
  display: inline-block;
}

[data-theme="dark"] .theme-icon-dark {
  display: inline-block;
}
[data-theme="dark"] .theme-icon-light {
  display: none;
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.sidebar-collapsed .nav-label {
  display: none;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border-subtle);
}

.system-status-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--emerald);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  flex-shrink: 0;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.status-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.status-copy strong {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.status-copy small {
  font-size: 9.5px;
  color: var(--text-muted);
}

.sidebar-collapsed .status-copy {
  display: none;
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-normal);
}

.sidebar-collapsed .app-main {
  margin-left: var(--sidebar-collapsed-width);
}

/* Top App Header */
.app-header {
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

[data-theme="dark"] .app-header {
  background-color: rgba(10, 10, 10, 0.88);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-icon.mobile-menu-btn,
.mobile-menu-btn {
  display: none !important;
}

.omnisearch-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--surface-canvas);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition-fast);
}

.omnisearch-trigger:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--surface-card);
}

.omnisearch-trigger kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 600;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
}

.header-product {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--surface-subtle);
  color: var(--text-primary);
  border-color: var(--border-default);
}

/* App Content Area */
.app-content {
  flex: 1;
  padding: 28px 32px 64px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

/* Page Intro & Headings */
.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand);
  margin-bottom: 4px;
}

.page-heading h1 {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-heading p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  max-width: 760px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-kicker {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.section-heading h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.section-heading p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand);
  color: #ffffff !important;
  box-shadow: var(--shadow-sm);
}

.btn-primary span,
.btn-primary svg {
  color: #ffffff !important;
}

.btn-primary:hover {
  background: var(--brand-hover);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--surface-card);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--surface-subtle);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--surface-subtle);
  color: var(--text-primary);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.text-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.text-link:hover {
  text-decoration: underline;
}

/* Cards & Surfaces */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.card-title {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

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

/* KPI Strip & Metric Cards */
.kpi-strip {
  margin-bottom: 20px;
}

.metric-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.metric-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border-strong);
}

.metric-card.accent-violet::before { background: var(--violet); }
.metric-card.accent-rose::before { background: var(--rose); }
.metric-card.accent-cyan::before { background: var(--sky); }
.metric-card.accent-amber::before { background: var(--amber); }
.metric-card.accent-emerald::before { background: var(--emerald); }

.metric-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: none;
}

.metric-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin: 6px 0 4px;
  font-feature-settings: "tnum";
}

.metric-footer {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Narrative Urgency Strip */
.narrative-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.insight-card {
  padding: 16px 20px;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.insight-card:last-child {
  border-right: none;
}

.insight-card > span {
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.insight-danger > span { color: var(--rose); }
.insight-warning > span { color: var(--amber); }
.insight-info > span { color: var(--sky); }
.insight-primary > span { color: var(--brand); }

.insight-card h3 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.insight-card p {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Content Layout (Main + Aside) */
.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  margin-bottom: 28px;
}

.content-aside {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-block {
  margin-top: 32px;
}

/* Tender Cards */
.results-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.results-grid.two-columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.tender-card {
  display: block;
  min-width: 0;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.tender-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  background: var(--surface-hover);
}

.tender-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.tender-folder {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.tender-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.tender-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tender-authority {
  font-size: 11.5px;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  word-break: break-word;
}

.tender-authority span {
  color: var(--text-muted);
}

.tender-card-insights {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  gap: 12px;
}

.tender-card-insights > div {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.tender-card-insights small {
  font-size: 9.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tender-card-insights strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  font-feature-settings: "tnum";
}

.tender-card-action {
  margin-left: auto;
  font-size: 11px;
  font-weight: 650;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 4px;
}

.tender-card-tags {
  margin-top: 10px;
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-cyan { background: var(--sky-bg); color: var(--sky); border: 1px solid var(--sky-border); }
.badge-emerald { background: var(--emerald-bg); color: var(--emerald); border: 1px solid var(--emerald-border); }
.badge-amber { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.badge-rose { background: var(--rose-bg); color: var(--rose); border: 1px solid var(--rose-border); }
.badge-violet { background: var(--violet-bg); color: var(--violet); border: 1px solid var(--violet-border); }
.badge-slate { background: var(--slate-bg); color: var(--slate); border: 1px solid var(--slate-border); }

.count-pill {
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.positive-pill {
  background: var(--emerald-bg);
  border-color: var(--emerald-border);
  color: var(--emerald);
}

.tender-score-pill {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 750;
  background: var(--brand-light);
  color: var(--brand);
  border: 1px solid var(--brand-border);
}

/* Ranked Lists (Aside) */
.rank-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.rank-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.rank-list li:last-child a {
  border-bottom: none;
}

.rank-list li a:hover {
  background: var(--surface-hover);
}

.rank-list li a > span {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  max-width: 220px;
}

.rank-list b {
  display: block;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.rank-list small {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-list strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  font-feature-settings: "tnum";
}

.empty-copy {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* Search Workspace */
.search-workspace {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.search-primary {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.search-leading {
  font-size: 18px;
  color: var(--text-muted);
  margin-left: 6px;
}

.search-primary input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: none;
  background: transparent;
  font-size: 14.5px;
  color: var(--text-primary);
  outline: none;
}

.search-primary input::placeholder {
  color: var(--text-muted);
}

.search-button {
  min-width: 100px;
}

.search-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border-subtle);
  gap: 16px;
  flex-wrap: wrap;
}

.weight-control {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
}

.weight-control b {
  font-weight: 650;
  color: var(--text-secondary);
}

.weight-control small {
  color: var(--text-muted);
  margin-left: 4px;
}

.weight-control input[type="range"] {
  width: 130px;
  accent-color: var(--brand);
}

.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.switch-control input {
  accent-color: var(--brand);
  width: 14px;
  height: 14px;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-toggle:hover {
  background: var(--surface-active);
  color: var(--text-primary);
}

.filter-toggle b {
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--surface-subtle);
  font-size: 10px;
}

.filter-toggle b.has-filters {
  background: var(--brand);
  color: #ffffff;
}

.advanced-filter-panel {
  padding: 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-canvas);
}

.filter-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.filter-panel-head h2 {
  font-size: 14px;
  font-weight: 700;
}

.filter-panel-head p {
  font-size: 11px;
  color: var(--text-muted);
}

.text-button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.text-button:hover {
  color: var(--rose);
}

.filter-fields {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.filter-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.filter-fields input,
.filter-fields select {
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--surface-card);
  padding: 0 10px;
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
}

.filter-fields input:focus,
.filter-fields select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-light);
}

.search-presets {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.search-presets button {
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.search-presets button:hover,
.search-presets button.active {
  background: var(--brand-light);
  color: var(--brand);
  border-color: var(--brand-border);
}

/* Search Results Layout */
.search-results-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 20px;
}

.facet-panel {
  position: sticky;
  top: calc(var(--header-height) + 20px);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-sm);
}

.facet-panel-head h3 {
  font-size: 13.5px;
  font-weight: 700;
}

.facet-panel-head p {
  font-size: 10.5px;
  color: var(--text-muted);
}

.facet-section h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.facet-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
  font-size: 11.5px;
}

.facet-row > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.facet-row span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
  color: var(--text-secondary);
}

.facet-row b {
  font-size: 11px;
  color: var(--text-primary);
}

.facet-row i {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-subtle);
  overflow: hidden;
}

.facet-row em {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 2px;
}

.facet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.facet-chips a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  font-size: 10.5px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.facet-chips a:hover {
  background: var(--brand-light);
  color: var(--brand);
  border-color: var(--brand-border);
}

.facet-chips b {
  font-weight: 700;
  color: var(--text-primary);
}

/* Dossier 360º Styles */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb a:hover {
  color: var(--brand);
}

.dossier-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.dossier-heading h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.3;
  margin-top: 6px;
}

.dossier-heading p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  max-width: 880px;
}

.dossier-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.entity-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.entity-links a {
  display: flex;
  flex-direction: column;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  min-width: 220px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.entity-links a:hover {
  border-color: var(--brand-border);
  background: var(--brand-light);
}

.entity-links small {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.entity-links strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 2px 0;
}

.entity-links span {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--brand);
}

.dossier-facts {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.dossier-facts > div {
  padding: 14px 16px;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dossier-facts > div:last-child {
  border-right: none;
}

.dossier-facts small {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dossier-facts b {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.dossier-facts.financial {
  grid-template-columns: repeat(4, 1fr);
}

/* Decision Hero */
.decision-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 22px 28px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid transparent;
}

.decision-go {
  background: linear-gradient(135deg, var(--emerald-bg), var(--surface-card));
  border-color: var(--emerald-border);
}

.decision-review {
  background: linear-gradient(135deg, var(--amber-bg), var(--surface-card));
  border-color: var(--amber-border);
}

.decision-stop {
  background: linear-gradient(135deg, var(--rose-bg), var(--surface-card));
  border-color: var(--rose-border);
}

.decision-score {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.decision-score span {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: -0.04em;
  font-feature-settings: "tnum";
}

.decision-go .decision-score span { color: var(--emerald); }
.decision-review .decision-score span { color: var(--amber); }
.decision-stop .decision-score span { color: var(--rose); }

.decision-score small {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.decision-copy h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.decision-copy p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.45;
}

.decision-deadline {
  text-align: right;
  display: flex;
  flex-direction: column;
}

.decision-deadline small {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.decision-deadline strong {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

.decision-deadline span {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Decision Overview (Radar + Pricing Band) */
.decision-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.radar-chart {
  height: 320px;
  padding: 10px;
}

.price-spectrum {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 20px;
}

.price-option {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.price-option span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.price-option b {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  font-feature-settings: "tnum";
}

.price-option small {
  font-size: 11px;
  color: var(--text-secondary);
}

.price-option.recommended {
  border-color: var(--emerald-border);
  background: var(--emerald-bg);
}

.price-option.recommended span { color: var(--emerald); }

.price-option.danger {
  border-color: var(--rose-border);
  background: var(--rose-bg);
}

.price-option.danger span { color: var(--rose); }

.method-callout {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-subtle);
  font-size: 11.5px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.method-callout b {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.chart-footnote {
  padding: 10px 20px 14px;
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Signals & Flags */
.signal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.signal-panel {
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  box-shadow: var(--shadow-sm);
}

.signal-panel header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.signal-panel header span {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
}

.signal-panel.positive header span { background: var(--emerald-bg); color: var(--emerald); }
.signal-panel.negative header span { background: var(--rose-bg); color: var(--rose); }

.signal-panel h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.signal-panel ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.signal-panel li {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.signal-panel.positive li::before { content: "✓"; color: var(--emerald); font-weight: 800; }
.signal-panel.negative li::before { content: "!"; color: var(--rose); font-weight: 800; }

/* Effort & Criteria */
.effort-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 18px;
}

.effort-grid > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.effort-grid small {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.effort-grid b {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.score-split {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.score-split > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.score-split span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.score-split i {
  display: block;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--surface-subtle);
  overflow: hidden;
}

.score-split em {
  display: block;
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--brand), #a855f7);
  width: calc(var(--score) * 1%);
}

.method-note {
  padding: 10px 18px 14px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Tables */
.table-card {
  margin-top: 16px;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.data-table th {
  padding: 12px 16px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-feature-settings: "tnum";
}

.data-table tr:hover td {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.cell-mono {
  font-family: var(--font-mono);
  font-weight: 600;
}

.cell-title {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 380px;
}

.row-action {
  font-size: 14px;
  color: var(--brand);
  font-weight: 700;
}

/* Analytics Tabs (Market & Competitor) */
.analysis-tabs {
  margin-top: 20px;
}

.tab-list {
  display: inline-flex;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
  margin-bottom: 18px;
}

.tab-list button {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-list button:hover {
  color: var(--text-primary);
}

.tab-list button.active {
  background: var(--surface-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.atlas-chart {
  width: 100%;
  height: 320px;
}

.chart-card-large .atlas-chart {
  height: 360px;
}

.chart-short {
  height: 240px;
}

/* CPV Ranking Bar List Component */
.cpv-ranking-card .cpv-ranking-list {
  height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}

.cpv-ranking-list::-webkit-scrollbar {
  width: 4px;
}
.cpv-ranking-list::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

.cpv-ranking-item {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  transition: background 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cpv-ranking-item:hover {
  background: var(--surface-subtle);
}

.cpv-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cpv-item-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.cpv-code-badge {
  font-size: 10px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.cpv-name-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cpv-item-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cpv-contracts-count {
  font-size: 11px;
  color: var(--text-muted);
}

.cpv-amount {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.cpv-share-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--brand-light);
  color: var(--brand);
}

[data-theme="dark"] .cpv-share-badge {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
}

.cpv-progress-track {
  width: 100%;
  height: 5px;
  background: var(--surface-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.cpv-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cpv-fill-0 { background: #4338ca; }
.cpv-fill-1 { background: #0284c7; }
.cpv-fill-2 { background: #059669; }
.cpv-fill-3 { background: #d97706; }
.cpv-fill-4 { background: #7c3aed; }
.cpv-fill-5 { background: #e11d48; }

[data-theme="dark"] .cpv-fill-0 { background: #8b5cf6; }
[data-theme="dark"] .cpv-fill-1 { background: #38bdf8; }
[data-theme="dark"] .cpv-fill-2 { background: #34d399; }
[data-theme="dark"] .cpv-fill-3 { background: #fbbf24; }
[data-theme="dark"] .cpv-fill-4 { background: #a78bfa; }
[data-theme="dark"] .cpv-fill-5 { background: #fb7185; }

/* Institutional Distribution Cards & Segment Bar Component */
.admin-level-card-wrap .admin-distribution-container {
  height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
}

.admin-segmented-bar {
  display: flex;
  width: 100%;
  height: 10px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--surface-subtle);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
  gap: 2px;
  flex-shrink: 0;
}

.admin-segment-item {
  height: 100%;
  transition: width 0.4s ease;
}

.admin-segment-0 { background: #4338ca; }
.admin-segment-1 { background: #0284c7; }
.admin-segment-2 { background: #059669; }
.admin-segment-3 { background: #d97706; }

[data-theme="dark"] .admin-segment-0 { background: #8b5cf6; }
[data-theme="dark"] .admin-segment-1 { background: #38bdf8; }
[data-theme="dark"] .admin-segment-2 { background: #34d399; }
[data-theme="dark"] .admin-segment-3 { background: #fbbf24; }

.admin-levels-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}

.admin-level-card {
  padding: 12px 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-level-card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .admin-level-card {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

.admin-level-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.admin-level-badge-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.admin-level-icon {
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

[data-theme="dark"] .admin-level-icon {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.admin-level-text {
  min-width: 0;
}

.admin-level-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-level-contracts {
  font-size: 11px;
  color: var(--text-muted);
}

.admin-level-share {
  text-align: right;
  flex-shrink: 0;
}

.admin-share-pct {
  display: block;
  font-size: 17px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1.1;
}

[data-theme="dark"] .admin-share-pct {
  color: #a78bfa;
}

.admin-share-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-level-metrics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-subtle);
}

.admin-metric-pill {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-pill-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.metric-pill-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Command Palette Overlay */
.cmd-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
}

.cmd-modal-backdrop.active {
  display: flex;
}

.cmd-palette {
  width: min(580px, calc(100% - 32px));
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.cmd-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 16px;
  color: var(--brand);
}

.cmd-input-row input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
}

.cmd-results {
  padding: 8px;
  max-height: 340px;
  overflow-y: auto;
}

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.cmd-item:hover, .cmd-item:focus, .cmd-item.is-selected {
  background: var(--surface-subtle);
  color: var(--text-primary);
}

.cmd-item span {
  color: var(--text-muted);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.toast-error {
  border-color: var(--rose-border);
  background: var(--rose-bg);
  color: var(--rose);
}

.toast-success {
  border-color: var(--emerald-border);
  background: var(--emerald-bg);
  color: var(--emerald);
}

/* Responsive Breakpoints */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .filter-fields { grid-template-columns: repeat(2, 1fr); }
  .content-layout { grid-template-columns: 1fr; }
  .search-results-layout { grid-template-columns: 1fr; }
  .decision-overview { grid-template-columns: 1fr; }
  .dossier-facts { grid-template-columns: repeat(3, 1fr); }
  .dossier-facts.financial { grid-template-columns: repeat(2, 1fr); }
}

/* Defensive Text & Overflow Hardening */
h1, h2, h3, h4, h5, h6,
.tender-title,
.tender-authority,
.results-heading h2,
.authority-name,
.insight-content,
.term-tip,
.empty-state p,
.cmd-item,
.system-status-box {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Double-Click & Spam Prevention */
.htmx-request,
form.htmx-request button[type="submit"],
button.htmx-request {
  pointer-events: none !important;
  opacity: 0.72;
  cursor: wait !important;
}

@media (max-width: 800px) {
  .app-header {
    padding: 0 14px !important;
  }
  .app-content {
    padding: 16px 14px 48px !important;
  }
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-main {
    margin-left: 0 !important;
  }
  .btn-icon.mobile-menu-btn,
  .mobile-menu-btn {
    display: grid !important;
  }
  .mobile-nav-open .app-sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }
  .mobile-nav-open .mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(0, 0, 0, 0.80);
    backdrop-filter: blur(4px);
  }
  .app-header .header-right span {
    display: none;
  }
  .page-heading {
    flex-wrap: wrap;
    gap: 14px;
  }
  .page-heading > div {
    min-width: 0;
    flex: 1 1 100%;
  }
  .narrative-strip {
    grid-template-columns: 1fr;
  }
  .insight-card {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .insight-card:last-child {
    border-bottom: none;
  }
  .decision-hero {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .decision-deadline {
    text-align: left;
  }
  .signal-grid {
    grid-template-columns: 1fr;
  }
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .search-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .weight-control {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 600px) {
  .omnisearch-trigger kbd {
    display: none;
  }
  .omnisearch-trigger span:nth-child(2) {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .view-container {
    padding: 14px 10px;
  }
  .metric-card {
    padding: 14px;
  }
  .decision-hero {
    padding: 16px 14px;
  }
  .search-primary {
    padding: 6px 10px;
  }
  .search-button {
    min-width: 80px;
    padding: 0 12px;
  }
}

/* Featured Competitor Presets */
.featured-companies {
  margin-top: 20px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.featured-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.featured-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--surface-subtle);
  color: var(--text-primary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.featured-list button:hover {
  background: var(--surface-hover);
  border-color: var(--brand-border);
  transform: translateX(2px);
}

.featured-list button span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.featured-list button span b {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-primary);
}

.featured-list button span small {
  font-size: 11px;
  color: var(--text-muted);
}

.featured-list button strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--emerald);
  font-feature-settings: "tnum";
}

/* Interactive Card Elements & Entity Linking */
.badge-clickable {
  cursor: pointer;
  transition: all var(--transition-fast);
}

.badge-clickable:hover {
  background: var(--surface-hover) !important;
  border-color: var(--brand-border) !important;
  color: var(--brand) !important;
  transform: translateY(-1px);
}

.authority-link {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.authority-link:hover {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.clickable-card {
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.clickable-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-border);
  box-shadow: var(--shadow-md);
}


/* -------------------------------------------------------------
 * POLISHED COMPONENTS & LAYOUTS (Empty States, Analytics, Grids)
 * ------------------------------------------------------------- */

/* Competitor Starting State & Capability Overview */
.competitor-start {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 12px;
}

.competitor-start .featured-companies {
  margin-top: 0;
}

.competitor-start-main {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.competitor-start-main h2 {
  font-size: 20px;
  font-weight: 750;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 8px 0 10px;
  line-height: 1.3;
}

.competitor-start-main p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 20px;
}

.capability-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.capability-grid article {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: all var(--transition-fast);
}

.capability-grid article:hover {
  border-color: var(--brand-border);
  background: var(--surface-hover);
}

.capability-grid article span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--brand);
  background: var(--brand-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
  margin-top: 2px;
}

.capability-grid article h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.capability-grid article p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.45;
}

/* Search Empty State Grid */
.search-empty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 14px;
}

.search-empty-grid article {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.search-empty-grid article:hover {
  border-color: var(--brand-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.search-empty-grid article span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--brand);
  background: var(--brand-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  margin-bottom: 12px;
  width: fit-content;
}

.search-empty-grid article h3 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.search-empty-grid article p {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Market Analysis Layouts & Context */
.analysis-context {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.analysis-context span {
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
}

.analysis-context b {
  color: var(--text-primary);
  font-weight: 650;
}

.analysis-context small {
  color: var(--text-muted);
}

.analysis-layout {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}

.tab-panel[data-panel="competition"] .analysis-layout {
  grid-template-columns: 1fr 1fr;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.rank-list.expanded li a > span {
  max-width: none;
  flex: 1;
  min-width: 0;
}

.rank-list.expanded li a > span b {
  font-size: 12.5px;
}

.rank-list.expanded li a > span small {
  font-size: 11px;
}

.profile-empty {
  padding: 40px 20px;
  text-align: center;
}

.audit-section {
  margin-bottom: 28px;
}

.dossier-heading-main {
  flex: 1;
  min-width: 0;
}

.arrow-svg {
  display: inline-block;
  vertical-align: middle;
  margin-left: 3px;
}

@media (max-width: 960px) {
  .competitor-start {
    grid-template-columns: 1fr;
  }
  .analysis-layout,
  .tab-panel[data-panel="competition"] .analysis-layout,
  .analysis-grid {
    grid-template-columns: 1fr;
  }
  .search-empty-grid {
    grid-template-columns: 1fr;
  }
}


/* -------------------------------------------------------------
 * MOBILE RESPONSIVE HARDENING (< 768px & < 640px)
 * ------------------------------------------------------------- */
@media (max-width: 768px) {
  .dossier-heading {
    flex-direction: column;
    gap: 14px;
  }
  .dossier-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .analytics-controls {
    grid-template-columns: 1fr !important;
  }
  .analytics-controls button {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .competitor-input {
    flex-wrap: wrap !important;
  }
  .competitor-input input {
    min-width: 0 !important;
    width: 100% !important;
  }
  .competitor-input button {
    width: 100% !important;
    justify-content: center !important;
    margin-top: 6px;
  }
  .competitor-toolbar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  .dossier-facts {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .dossier-facts.financial {
    grid-template-columns: 1fr !important;
  }
  .signal-grid {
    grid-template-columns: 1fr !important;
  }
  .price-spectrum {
    grid-template-columns: 1fr !important;
  }
  .effort-grid {
    grid-template-columns: 1fr !important;
  }
  .entity-links a {
    min-width: 100% !important;
  }
}


@media (max-width: 800px) {
  .weight-control {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .weight-control input[type="range"] {
    width: 100% !important;
  }
  .weight-control span {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .search-primary input {
    min-width: 0 !important;
  }
  .search-button {
    min-width: 72px !important;
    padding: 0 10px !important;
  }
}


@media (max-width: 800px) {
  .results-grid.two-columns {
    grid-template-columns: 1fr !important;
  }
  .tender-card-insights {
    flex-wrap: wrap;
    gap: 8px;
  }
}
