/* ============================================================
   KRAJ.OS — TrueNAS SCALE inspired dark theme
   ============================================================ */

:root {
  /* Surfaces — TrueNAS SCALE 24 palette */
  --bg-app: #0F1822;
  --bg-sidebar: #0A111A;
  --bg-topbar: #131C28;
  --bg-card: #15202E;
  --bg-card-header: #1A2535;
  --bg-elevated: #1F2D3F;
  --bg-hover: #1B2839;
  --border: #1F2A3A;
  --border-strong: #2D3D52;
  --divider: #1A2331;

  /* Text */
  --text: #E8ECF1;
  --text-dim: #94A3B8;
  --text-faint: #64748B;

  /* Brand — iX cyan-blue (TrueNAS primary) */
  --primary: #00A6CE;
  --primary-hover: #00BEEF;
  --primary-soft: rgba(0, 166, 206, 0.12);
  --primary-glow: rgba(0, 166, 206, 0.35);

  /* Status */
  --ok: #14B789;
  --warn: #F0A028;
  --crit: #E2374C;
  --info: #4A8FE7;
  --purple: #9D6BD9;

  /* Roles (separate hue per persona) */
  --role-officer: #00A6CE;
  --role-mayor:   #F0A028;
  --role-citizen: #14B789;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --radius: 4px;
  --radius-lg: 8px;
  --pill: 999px;
  --sidebar-w: 260px;
  --topbar-h: 56px;
  --t-fast: 0.12s;
  --t-mid: 0.2s;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-app);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

code, .mono {
  font-family: 'Roboto Mono', 'JetBrains Mono', 'Courier New', monospace;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
  user-select: none;
}

/* ============================================================
   SIDEBAR — TrueNAS-style with expandable groups
   ============================================================ */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 10;
}

.sidebar-header {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.logo-icon {
  width: 32px; height: 32px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--info) 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px var(--primary-glow);
}
.logo-icon .material-symbols-outlined {
  font-size: 20px;
  color: white;
}
.logo-text {
  font-family: 'Roboto', sans-serif;
  letter-spacing: 0.5px;
}
.logo-version {
  display: inline-block;
  font-size: 9px;
  background: var(--bg-elevated);
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 1px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}
.logo-sub {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
  padding-left: 42px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
}

.nav-group {
  margin-top: 4px;
}
.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-faint);
  cursor: pointer;
  user-select: none;
  transition: color var(--t-fast);
}
.nav-group-header:hover {
  color: var(--text-dim);
}
.nav-group-header .chev {
  font-size: 16px;
  transition: transform var(--t-fast);
}
.nav-group.collapsed .chev {
  transform: rotate(-90deg);
}
.nav-group.collapsed .nav-items {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px 9px 22px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--t-fast);
  position: relative;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-hover);
  border-left-color: var(--primary);
}
.nav-item .material-symbols-outlined {
  font-size: 20px;
  flex-shrink: 0;
}
.nav-item-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--pill);
  min-width: 18px;
  text-align: center;
}
.nav-item-badge.warn { background: var(--warn); }
.nav-item-badge.crit { background: var(--crit); }

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
}
.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  color: var(--text-dim);
}
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.status-dot.ok { background: var(--ok); box-shadow: 0 0 4px var(--ok); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 4px var(--warn); }
.status-dot.crit { background: var(--crit); box-shadow: 0 0 4px var(--crit); }

/* ============================================================
   MAIN
   ============================================================ */
.main {
  margin-left: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 13px;
}
.breadcrumb .chev {
  font-size: 14px;
  color: var(--text-faint);
}
.breadcrumb-current {
  color: var(--text);
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: all var(--t-fast);
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-dim);
}
.user-chip .role-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
}
.user-chip.mayor .role-dot { background: var(--role-mayor); }
.user-chip.citizen .role-dot { background: var(--role-citizen); }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  padding: 60px;
  justify-content: center;
}
.spin { animation: spin 1.5s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.pulse { animation: pulse 1.5s ease-in-out infinite; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.2px;
  color: var(--text);
}
.page-header p {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 2px;
}
.page-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ============================================================
   CARDS — TrueNAS widget style
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card-header);
}
.card-header h3 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header h3 .material-symbols-outlined {
  font-size: 16px;
  color: var(--primary);
}
.card-header-action {
  display: flex;
  gap: 4px;
}
.card-header-action a {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.card-header-action a:hover { color: var(--primary); }
.card-header-action a .material-symbols-outlined { font-size: 14px; }

.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

/* ============================================================
   STAT GRID — widget-like
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  transition: all var(--t-fast);
  box-shadow: var(--shadow-sm);
}
.stat-card:hover {
  border-color: var(--border-strong);
}
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
}
.stat-card.ok::before { background: var(--ok); }
.stat-card.warn::before { background: var(--warn); }
.stat-card.crit::before { background: var(--crit); }
.stat-card.info::before { background: var(--info); }
.stat-card.purple::before { background: var(--purple); }
.stat-card.mayor::before { background: var(--role-mayor); }
.stat-card.citizen::before { background: var(--role-citizen); }

.stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-label .material-symbols-outlined {
  font-size: 14px;
}
.stat-value {
  font-size: 28px;
  font-weight: 400;
  margin-top: 4px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  color: var(--text);
}
.stat-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}
.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  margin-top: 6px;
}
.stat-trend.up { background: rgba(20, 183, 137, 0.12); color: var(--ok); }
.stat-trend.down { background: rgba(226, 55, 76, 0.12); color: var(--crit); }

/* ============================================================
   TABLES
   ============================================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.table thead th {
  background: var(--bg-card-header);
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  white-space: nowrap;
}
.table tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--divider);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.table tbody tr {
  transition: background var(--t-fast);
}
.table tbody tr:hover {
  background: var(--bg-hover);
}
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--primary-soft); }
.table td.num { text-align: right; }
.table td.mono { font-family: 'Roboto Mono', monospace; font-size: 11px; color: var(--text-dim); }
.table td strong { color: var(--text); font-weight: 500; }

/* ============================================================
   BADGES / CHIPS — TrueNAS pill style
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--pill);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge.ok    { background: rgba(20, 183, 137, 0.12); color: var(--ok); }
.badge.warn  { background: rgba(240, 160, 40, 0.12); color: var(--warn); }
.badge.crit  { background: rgba(226, 55, 76, 0.12); color: var(--crit); }
.badge.info  { background: rgba(74, 143, 231, 0.12); color: var(--info); }
.badge.purple { background: rgba(157, 107, 217, 0.12); color: var(--purple); }
.badge.accent { background: var(--primary-soft); color: var(--primary); }
.badge.mayor { background: rgba(240, 160, 40, 0.12); color: var(--role-mayor); }
.badge.citizen { background: rgba(20, 183, 137, 0.12); color: var(--role-citizen); }

.badge.structural { background: rgba(226, 55, 76, 0.12); color: var(--crit); }
.badge.seasonal   { background: rgba(240, 160, 40, 0.12); color: var(--warn); }
.badge.event      { background: rgba(157, 107, 217, 0.12); color: var(--purple); }
.badge.watchlist  { background: rgba(100, 116, 139, 0.15); color: var(--text-dim); }

.badge.high   { background: rgba(20, 183, 137, 0.12); color: var(--ok); }
.badge.medium { background: rgba(240, 160, 40, 0.12); color: var(--warn); }
.badge.low    { background: rgba(226, 55, 76, 0.12); color: var(--crit); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border: 1px solid transparent;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.btn .material-symbols-outlined { font-size: 16px; }

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 2px 8px var(--primary-glow); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-ok    { background: rgba(20, 183, 137, 0.12); color: var(--ok); border-color: rgba(20, 183, 137, 0.3); }
.btn-ok:hover { background: rgba(20, 183, 137, 0.22); }
.btn-warn  { background: rgba(240, 160, 40, 0.12); color: var(--warn); border-color: rgba(240, 160, 40, 0.3); }
.btn-warn:hover { background: rgba(240, 160, 40, 0.22); }
.btn-crit  { background: rgba(226, 55, 76, 0.12); color: var(--crit); border-color: rgba(226, 55, 76, 0.3); }
.btn-crit:hover { background: rgba(226, 55, 76, 0.22); }

.btn-mayor { background: rgba(240, 160, 40, 0.85); color: white; }
.btn-mayor:hover { background: var(--role-mayor); }

.btn-citizen { background: rgba(20, 183, 137, 0.85); color: white; }
.btn-citizen:hover { background: var(--role-citizen); }

.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-lg { padding: 10px 22px; font-size: 13px; }

/* ============================================================
   PROGRESS BARS / GAP BARS
   ============================================================ */
.progress {
  height: 5px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.progress-bar {
  height: 100%;
  background: var(--primary);
  transition: width 0.4s ease-out;
  border-radius: 3px;
}
.progress-bar.ok { background: var(--ok); }
.progress-bar.warn { background: var(--warn); }
.progress-bar.crit { background: var(--crit); }
.progress-bar.animated {
  background: linear-gradient(90deg, var(--primary) 0%, var(--info) 100%);
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}

.gap-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}
.gap-bar .progress { flex: 1; height: 4px; }
.gap-bar .gap-num {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
  font-size: 12px;
}

/* ============================================================
   FILTERS
   ============================================================ */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-input, .filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-family: inherit;
  transition: border-color var(--t-fast);
}
.filter-input:focus, .filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}
.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 820px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card-header);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header h3 {
  font-size: 15px;
  font-weight: 500;
}
.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-card-header);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Card detail */
.card-detail-grid {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px 16px;
  margin-bottom: 18px;
  font-size: 13px;
}
.detail-label {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
  padding-top: 2px;
}
.detail-value { font-weight: 400; }

.explanation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.explain-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.explain-pill .lbl { color: var(--text-dim); font-size: 11px; }
.explain-pill .val { color: var(--primary); font-weight: 600; font-variant-numeric: tabular-nums; }

.condition-list { margin: 10px 0; }
.condition-list li {
  list-style: none;
  padding: 5px 0;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.condition-list li::before {
  font-size: 14px;
  font-weight: 700;
  width: 14px;
}
.condition-list li.ok::before { content: '✓'; color: var(--ok); }
.condition-list li.fail::before { content: '✗'; color: var(--crit); }
.condition-list li.note::before { content: '~'; color: var(--warn); }

.citations {
  background: var(--bg-elevated);
  border-left: 3px solid var(--primary);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin: 12px 0;
  font-size: 12px;
}
.citations h4 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.citations ul { list-style: none; }
.citations li {
  padding: 3px 0;
  font-family: 'Roboto Mono', monospace;
  font-size: 11.5px;
  color: var(--text);
}

.ai-disclaimer {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.ai-disclaimer .material-symbols-outlined {
  color: var(--primary);
  flex-shrink: 0;
  font-size: 18px;
}

/* ============================================================
   AUDIT LOG
   ============================================================ */
.audit-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.audit-entry {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 12.5px;
}
.audit-entry .audit-meta {
  display: flex;
  gap: 8px;
  color: var(--text-dim);
  font-size: 11px;
  margin-bottom: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.audit-entry .audit-meta .mono {
  font-family: 'Roboto Mono', monospace;
  font-size: 10.5px;
  background: var(--bg-elevated);
  padding: 1px 7px;
  border-radius: 3px;
  color: var(--text);
}
.audit-entry .audit-title { font-weight: 500; }

/* ============================================================
   PIPELINE VISUALIZATION
   ============================================================ */
.pipeline-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 14px;
}
.pipeline-stages {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.pipeline-stage {
  flex: 1;
  min-width: 130px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  transition: all var(--t-mid);
  position: relative;
}
.pipeline-stage.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 12px var(--primary-glow);
}
.pipeline-stage.done {
  border-color: var(--ok);
  background: rgba(20, 183, 137, 0.06);
}
.pipeline-stage .stage-icon {
  font-size: 22px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.pipeline-stage.active .stage-icon { color: var(--primary); }
.pipeline-stage.done .stage-icon { color: var(--ok); }
.pipeline-stage .stage-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pipeline-stage .stage-detail {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.pipeline-arrow {
  color: var(--text-faint);
  font-size: 20px;
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  background: var(--bg-elevated);
  cursor: pointer;
  transition: all var(--t-fast);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.dropzone .icon {
  font-size: 48px;
  color: var(--primary);
}
.dropzone h3 {
  font-size: 16px;
  margin: 12px 0 6px;
  color: var(--text);
}
.dropzone p {
  font-size: 12px;
  color: var(--text-dim);
}

.file-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.file-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.file-item .material-symbols-outlined { color: var(--ok); }

/* ============================================================
   MAYOR / CITIZEN themed sections
   ============================================================ */
.role-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  border: 1px solid var(--border);
}
.role-banner.mayor {
  background: linear-gradient(135deg, rgba(240, 160, 40, 0.08), transparent);
  border-color: rgba(240, 160, 40, 0.3);
}
.role-banner.citizen {
  background: linear-gradient(135deg, rgba(20, 183, 137, 0.08), transparent);
  border-color: rgba(20, 183, 137, 0.3);
}
.role-banner .avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  color: white;
}
.role-banner.mayor .avatar { background: var(--role-mayor); }
.role-banner.citizen .avatar { background: var(--role-citizen); }
.role-banner .info-name {
  font-size: 15px;
  font-weight: 600;
}
.role-banner .info-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.action-card-large {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.action-card-large .ribbon {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.action-card-large.mayor .ribbon { background: var(--role-mayor); }
.action-card-large h2 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
}

/* ============================================================
   LEAFLET MAP (OSM)
   ============================================================ */
.map-real {
  height: 360px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  background: #0F1822;
  position: relative;
}
.map-real.tall { height: 460px; }
.leaflet-container {
  background: #0F1822 !important;
  font-family: 'Roboto', sans-serif !important;
}
/* Dark mode tile filter (OSM raster → dark) */
.leaflet-tile-pane {
  filter: brightness(0.55) invert(1) contrast(1.05) hue-rotate(190deg) saturate(0.6) brightness(0.95);
}
.leaflet-control-attribution {
  background: rgba(15, 24, 34, 0.75) !important;
  color: var(--text-dim) !important;
  font-size: 10px !important;
  padding: 2px 6px !important;
}
.leaflet-control-attribution a {
  color: var(--primary) !important;
}
.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.leaflet-control-zoom a:hover {
  background: var(--bg-hover) !important;
}
.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
}
.leaflet-popup-content {
  margin: 10px 14px !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
  font-family: 'Roboto', sans-serif !important;
}
.leaflet-popup-tip {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
}
.leaflet-popup-content strong { color: var(--primary); }
.leaflet-popup-close-button {
  color: var(--text-dim) !important;
}

/* Custom service pins */
.svc-pin {
  width: 30px; height: 30px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid white;
  box-shadow: 0 3px 8px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  background: var(--ok);
}
.svc-pin.warn { background: var(--warn); }
.svc-pin.crit { background: var(--crit); }
.svc-pin .material-symbols-outlined {
  transform: rotate(45deg);
  color: white;
  font-size: 16px;
}

.obec-pin {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid white;
  box-shadow: 0 4px 12px var(--primary-glow), 0 2px 6px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 11px;
  font-family: 'Roboto Mono', monospace;
}

/* Officer kraj overview pin (scaled by gap) */
.kraj-pin {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 10px;
  font-weight: 700;
  background: var(--ok);
}
.kraj-pin.warn { background: var(--warn); }
.kraj-pin.crit { background: var(--crit); }

.map-legend {
  display: flex; gap: 14px; margin-top: 12px;
  font-size: 11px; color: var(--text-dim);
}
.map-legend .dot-leg {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
  border: 1px solid white;
}
.map-legend .dot-leg.ok { background: var(--ok); }
.map-legend .dot-leg.warn { background: var(--warn); }
.map-legend .dot-leg.crit { background: var(--crit); }

/* Feedback form */
.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.feedback-form textarea, .feedback-form input, .feedback-form select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--t-fast);
}
.feedback-form textarea {
  min-height: 110px;
  resize: vertical;
}
.feedback-form textarea:focus, .feedback-form input:focus, .feedback-form select:focus {
  outline: none;
  border-color: var(--role-citizen);
}
.feedback-form label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 4px;
  display: block;
}

/* ============================================================
   DEMO MODE OVERLAY
   ============================================================ */
.demo-overlay {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 20px var(--primary-glow);
  z-index: 999;
  width: 360px;
  font-size: 13px;
}
.demo-overlay.hidden { display: none; }
.demo-overlay .demo-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}
.demo-overlay .demo-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}
.demo-overlay .demo-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 12px;
}
.demo-overlay .demo-controls {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  align-items: center;
}
.demo-overlay .demo-progress-mini {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}
.demo-overlay .demo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}
.demo-overlay .demo-dot.active { background: var(--primary); }
.demo-overlay .demo-dot.done { background: var(--ok); }

/* ============================================================
   ABOUT
   ============================================================ */
.about-section { max-width: 880px; }
.about-section h2 {
  font-size: 14px;
  margin: 18px 0 10px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.about-section p {
  color: var(--text-dim);
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.7;
}
.about-section code {
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Roboto Mono', monospace;
  font-size: 11.5px;
  color: var(--text);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1000px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .pipeline-stages { flex-direction: column; align-items: stretch; }
  .pipeline-arrow { transform: rotate(90deg); }
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* Animations */
.fade-in { animation: fadeIn 0.4s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
