:root {
  --ui-cobalt: #2458c8;
  --ui-cobalt-dark: #1945a9;
  --ui-emerald: #087f5b;
  --ui-orange: #c2410c;
  --ui-border: #dce5ef;
  --ui-muted: #607187;
  --ui-surface: #ffffff;
  --ui-surface-alt: #f5f8fc;
  --ui-row-hover: #eef4ff;
}

html[data-theme="dark"] {
  --ui-cobalt: #9bbcff;
  --ui-cobalt-dark: #c0d3ff;
  --ui-emerald: #78ddb5;
  --ui-orange: #ffc078;
  --ui-border: #344257;
  --ui-muted: #a8b6c8;
  --ui-surface: #111d31;
  --ui-surface-alt: #17253a;
  --ui-row-hover: #1a2a41;
}

html[data-theme="light"] .sidebar {
  width: 252px;
  border-color: #e2e8f0;
  background: #ffffff;
  box-shadow: 10px 0 28px #19314c0a;
}

html[data-theme="light"] .brand b { color: #14233a; }
html[data-theme="light"] .brand-light { color: #607187; }
html[data-theme="light"] .brand-mark i { border-color: var(--ui-cobalt); box-shadow: 0 0 10px #2458c828; }
html[data-theme="light"] .side-label { color: #738198; }

html[data-theme="light"] .nav-item {
  border-radius: 8px;
  color: #586a81;
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}

html[data-theme="light"] .nav-item:hover {
  color: var(--ui-cobalt-dark);
  background: #f1f5fc;
  transform: translateX(2px);
}

html[data-theme="light"] .nav-item.active {
  border-color: #d6e2fa;
  color: var(--ui-cobalt-dark);
  background: #edf3ff;
}

html[data-theme="light"] .nav-icon,
html[data-theme="light"] .nav-lock { color: var(--ui-cobalt); }
html[data-theme="light"] .network { border-color: #e4eaf1; }
html[data-theme="light"] .network b { color: #26374d; }
html[data-theme="light"] .network small { color: var(--ui-muted); }

html[data-theme="light"] .topbar {
  border-color: #e1e8f0;
  background: #ffffffed;
  box-shadow: 0 4px 16px #19314c08;
}

html[data-theme="light"] .breadcrumbs,
html[data-theme="light"] .sync,
html[data-theme="light"] .date-label { color: var(--ui-muted); }
html[data-theme="light"] .breadcrumbs b { color: #203149; }
html[data-theme="light"] .top-divider { background: #dce4ee; }
html[data-theme="light"] h1 { color: #17263d; }
html[data-theme="light"] h1 span { color: var(--ui-cobalt); }
html[data-theme="light"] .subheading { color: #5c6d83; }

.role-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 700 9px/1 "JetBrains Mono", Consolas, monospace;
  letter-spacing: 0;
}

.role-badge[data-role="citizen"] { color: #1d4ed8; border-color: #c9d9ff; background: #edf3ff; }
.role-badge[data-role="agent"] { color: #087f5b; border-color: #b6e5d2; background: #eaf8f1; }
.role-badge[data-role="admin"] { color: #a8460a; border-color: #f4d1a6; background: #fff4e5; }

html[data-theme="dark"] .role-badge[data-role="citizen"] { color: #bfd2ff; border-color: #3b5685; background: #1c2d4c; }
html[data-theme="dark"] .role-badge[data-role="agent"] { color: #a6efd0; border-color: #285c4b; background: #17372f; }
html[data-theme="dark"] .role-badge[data-role="admin"] { color: #ffd29d; border-color: #70502a; background: #3a2b19; }

.top-actions .notification[hidden],
.alert-center[hidden] { display: none !important; }

.top-actions .notification {
  color: var(--ui-cobalt);
  border-color: var(--ui-border);
  background: var(--ui-surface);
}

.top-actions .notification:hover {
  color: var(--ui-cobalt-dark);
  border-color: #a9c2ef;
  background: var(--ui-surface-alt);
}

.top-actions .notification svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.notification-count {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  place-items: center;
  border: 2px solid var(--ui-surface);
  border-radius: 999px;
  color: #ffffff;
  background: #c2410c;
  font: 700 8px/1 "JetBrains Mono", Consolas, monospace;
}

.notification-count[hidden] { display: none !important; }

.alert-center {
  width: min(720px, calc(100% - 28px));
  max-height: min(82vh, 760px);
}

.alert-center-summary {
  margin: 12px 0 16px;
  color: var(--ui-muted);
  font-size: 11px;
}

.alert-filters {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 4px;
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  background: var(--ui-surface-alt);
}

.alert-filter {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ui-muted);
  background: transparent;
  font-size: 10px;
  transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}

.alert-filter:hover { color: var(--ui-cobalt-dark); background: var(--ui-surface); }
.alert-filter.active { border-color: var(--ui-border); color: var(--ui-cobalt-dark); background: var(--ui-surface); box-shadow: 0 2px 5px #19314c0b; }
.admin-alert-list { display: grid; gap: 8px; margin-top: 13px; }

.admin-alert-card {
  padding: 12px 13px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
  transition: border-color .16s ease, background-color .16s ease;
}

.admin-alert-card:hover { border-color: #a9c2ef; background: var(--ui-row-hover); }
.admin-alert-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.admin-alert-reference { color: var(--ui-muted); font: 9px/1.4 "JetBrains Mono", Consolas, monospace; }
.alert-status { padding: 4px 7px; border: 1px solid transparent; border-radius: 999px; font-size: 8px; font-weight: 700; white-space: nowrap; }
.alert-status.status-urgent { border-color: #f4c89c; color: #a8460a; background: #fff2e4; }
.alert-status.status-progress { border-color: #c9d9ff; color: #214ca8; background: #edf3ff; }
.alert-status.status-todo { border-color: #b7dfe4; color: #08717a; background: #eaf8fa; }
.alert-status.status-resolved { border-color: #b8e2ce; color: #08734f; background: #eaf8f1; }

html[data-theme="dark"] .alert-status.status-urgent { border-color: #77502b; color: #ffd29d; background: #3a2b19; }
html[data-theme="dark"] .alert-status.status-progress { border-color: #3b5685; color: #c4d5ff; background: #1c2d4c; }
html[data-theme="dark"] .alert-status.status-todo { border-color: #285e65; color: #a9e6eb; background: #19373c; }
html[data-theme="dark"] .alert-status.status-resolved { border-color: #285c4b; color: #a6efd0; background: #17372f; }

.admin-alert-title { margin: 7px 0 3px; color: var(--text); font-size: 12px; font-weight: 650; line-height: 1.4; }
.admin-alert-meta { margin: 0; color: var(--ui-muted); font-size: 10px; line-height: 1.5; }
.admin-alert-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; }
.alert-priority-high { color: var(--ui-orange); font-size: 9px; font-weight: 650; }
.alert-open-button { padding: 6px 8px; border: 1px solid transparent; border-radius: 6px; color: var(--ui-cobalt); background: transparent; font-size: 10px; }
.alert-open-button:hover { border-color: var(--ui-border); background: var(--ui-surface-alt); }
.admin-alert-empty { padding: 22px 12px; margin: 12px 0 0; border: 1px dashed var(--ui-border); border-radius: 8px; color: var(--ui-muted); font-size: 11px; text-align: center; }

html[data-theme="light"] .alert-center { color: #1b2b42; background: linear-gradient(145deg, #ffffff, #f7f9fc); }
html[data-theme="light"] .alert-center .profile-dialog-heading h2 { color: #1b2b42; }

html[data-theme="dark"] .admin-alert-card { background: #111d31; }
html[data-theme="dark"] .admin-alert-card:hover { border-color: #4a6285; background: #17253a; }

html[data-theme="light"] .metric-card,
html[data-theme="light"] .panel {
  border: 1px solid #e0e7ef;
  border-radius: 10px;
  background: var(--ui-surface);
  box-shadow: 0 8px 24px #19314c0b;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

html[data-theme="light"] .metric-card:hover {
  transform: translateY(-2px);
  border-color: #cbd9ef;
  box-shadow: 0 14px 30px #19314c12;
}

html[data-theme="light"] .metric-top,
html[data-theme="light"] .panel-kicker,
html[data-theme="light"] .weather-stats span,
html[data-theme="light"] .vote-label,
html[data-theme="light"] .alert-label { color: #718197; }
html[data-theme="light"] .metric-value,
html[data-theme="light"] .panel h2,
html[data-theme="light"] .weather-stats b,
html[data-theme="light"] .forecast b { color: #1b2b42; }
html[data-theme="light"] .metric-foot,
html[data-theme="light"] .weather-state,
html[data-theme="light"] .weather-place { color: #607187; }

html[data-theme="light"] .metric-symbol {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
}

html[data-theme="light"] .metric-symbol.violet { color: #2458c8; background: #edf3ff; }
html[data-theme="light"] .metric-symbol.cyan { color: #087f8c; background: #e8f8fa; }
html[data-theme="light"] .metric-symbol.pink { color: #c2410c; background: #fff1e7; }
html[data-theme="light"] .metric-symbol.mint { color: #087f5b; background: #eaf8f1; }
html[data-theme="light"] .trend.up,
html[data-theme="light"] .trend.stable { color: var(--ui-emerald); }
html[data-theme="light"] .progress-mini { background: #e8eef6; }
html[data-theme="light"] .progress-mini i { background: var(--ui-cobalt); }
html[data-theme="light"] .mint-progress i { background: var(--ui-emerald); }

html[data-theme="light"] .view-switch { border-color: #e0e7ef; background: #f3f6fa; }
html[data-theme="light"] .view-btn { color: #5e6f84; }
html[data-theme="light"] .view-btn.selected { color: #ffffff; background: var(--ui-cobalt); }
html[data-theme="light"] .filter { color: #5e6f84; }
html[data-theme="light"] .filter:hover { color: var(--ui-cobalt-dark); background: #f1f5fc; }
html[data-theme="light"] .filter.active { border-color: #cbd9f2; color: var(--ui-cobalt-dark); background: #edf3ff; }

.report-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  background: var(--ui-surface);
}

.report-table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  text-align: left;
}

.report-table thead { background: var(--ui-surface-alt); }
.report-table thead th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--ui-border);
  color: var(--ui-muted);
  font: 700 9px/1.3 "JetBrains Mono", Consolas, monospace;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.report-table tbody .report-row { transition: background-color .16s ease; }
.report-table tbody .report-row:nth-child(even) { background: var(--ui-surface-alt); }
.report-table tbody .report-row:hover { background: var(--ui-row-hover); }
.report-table .report-row > th,
.report-table .report-row > td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--ui-border);
  color: var(--ui-muted);
  font-size: 10px;
  vertical-align: middle;
}

.report-table .report-row:last-child > th,
.report-table .report-row:last-child > td { border-bottom: 0; }
.report-table .report-subject-cell { width: 48%; text-align: left; }
.report-subject { display: flex; min-width: 220px; align-items: center; gap: 10px; }
.report-subject .report-icon { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; }
.report-subject .report-info { display: grid; min-width: 0; gap: 3px; }
.report-subject .report-info b { color: var(--text); font-size: 10px; font-weight: 650; white-space: normal; }
.report-subject .report-info span { color: var(--ui-muted); font: 8px/1.4 "JetBrains Mono", Consolas, monospace; }
.report-table .report-district { min-width: 130px; }
.report-table .report-status-cell { white-space: nowrap; }

.report-table .status {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .025em;
}

.report-table .status-urgent { border-color: #f4c89c; color: #a8460a; background: #fff2e4; }
.report-table .status-progress { border-color: #c9d9ff; color: #214ca8; background: #edf3ff; }
.report-table .status-todo { border-color: #b7dfe4; color: #08717a; background: #eaf8fa; }
.report-table .status-resolved { border-color: #b8e2ce; color: #08734f; background: #eaf8f1; }

html[data-theme="dark"] .report-table .status-urgent { border-color: #77502b; color: #ffd29d; background: #3a2b19; }
html[data-theme="dark"] .report-table .status-progress { border-color: #3b5685; color: #c4d5ff; background: #1c2d4c; }
html[data-theme="dark"] .report-table .status-todo { border-color: #285e65; color: #a9e6eb; background: #19373c; }
html[data-theme="dark"] .report-table .status-resolved { border-color: #285c4b; color: #a6efd0; background: #17372f; }

.report-action-cell { width: 52px; text-align: right; }
.report-table .row-arrow {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ui-cobalt);
  background: transparent;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}

.report-table .row-arrow:hover { background: #dfeaff; transform: translateX(2px); }
html[data-theme="dark"] .report-table .row-arrow:hover { background: #263a58; }

html[data-theme="light"] .live-pill { border-color: #b8e2ce; color: #08734f; background: #eaf8f1; }
html[data-theme="light"] .council-panel:after { display: none; }
html[data-theme="light"] .council-alert { border-color: #f2d2af; background: #fff7ed; }
html[data-theme="light"] .council-alert b { color: #26374d; }
html[data-theme="light"] .council-alert p { color: #607187; }
html[data-theme="light"] .vote-track { background: #e7edf5; }
html[data-theme="light"] .vote-track i { background: linear-gradient(90deg, var(--ui-cobalt), #078c91); }
html[data-theme="light"] .vote-label b { color: var(--ui-emerald); }

html[data-theme="light"] .btn-primary,
html[data-theme="light"] .vote-button {
  border: 1px solid var(--ui-cobalt);
  border-radius: 8px;
  color: #ffffff;
  background: var(--ui-cobalt);
  box-shadow: 0 5px 12px #2458c826;
  transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

html[data-theme="light"] .btn-primary:hover,
html[data-theme="light"] .vote-button:hover {
  border-color: var(--ui-cobalt-dark);
  background: var(--ui-cobalt-dark);
  box-shadow: 0 8px 18px #2458c833;
  transform: translateY(-1px);
}

html[data-theme="light"] .text-button { color: var(--ui-cobalt); transition: color .18s ease, background-color .18s ease; }
html[data-theme="light"] .text-button:hover { color: var(--ui-cobalt-dark); background: #edf3ff; }
html[data-theme="light"] .map-footer button { color: var(--ui-cobalt); }
html[data-theme="light"] .toast { border-color: #d7e1ef; color: #1b2b42; background: #ffffff; }
html[data-theme="light"] footer { color: #718197; }
html[data-theme="light"] footer a { color: var(--ui-cobalt); }

@media (max-width: 900px) {
  html[data-theme="light"] .sidebar { width: 252px; }
  .main-grid,
  .bottom-grid { grid-template-columns: minmax(0, 1fr); min-width: 0; }
  .main-grid > *,
  .bottom-grid > *,
  .content,
  .reports-panel,
  .report-table-wrap { min-width: 0; max-width: 100%; }
  .reports-panel { overflow: hidden; }
  .report-table-wrap { width: 100%; overflow-x: auto; }
  .report-table { min-width: 610px; }
}

@media (max-width: 600px) {
  .role-badge { min-height: 24px; padding: 0 7px; font-size: 8px; }
  .alert-center { padding: 17px; }
  .report-table-wrap { margin-right: -4px; }
  .report-table { min-width: 590px; }
  .report-table thead th,
  .report-table .report-row > th,
  .report-table .report-row > td { padding-right: 10px; padding-left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
.appointment-staff-note { display: grid; gap: 6px; margin-top: 10px; font-size: .85rem; }
.appointment-staff-note textarea { width: 100%; min-height: 60px; resize: vertical; }
.appointment-purpose-copy { margin: 8px 0 0; color: var(--text); font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere; }
.citizen-services-panel { margin-bottom: 15px; }
.citizen-services-panel .panel-heading { align-items: center; flex-wrap: wrap; }
.citizen-services-links { display: flex; flex-wrap: wrap; gap: 8px; }
.citizen-services-links a { text-decoration: none; }
.citizen-services-intro { margin: 12px 0; color: var(--ui-muted); font-size: 12px; line-height: 1.6; }
.citizen-service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr)); gap: 11px; }
.citizen-service-card { min-height: 158px; padding: 15px; border: 1px solid var(--ui-border); border-radius: 12px; background: var(--ui-surface); }
.citizen-service-code { color: var(--ui-cobalt); font: 700 8px/1.4 Consolas, monospace; letter-spacing: .5px; }
.citizen-service-card h3 { margin: 9px 0 5px; color: #1e2d3d; font-size: 14px; }
.citizen-service-card p { margin: 0; color: var(--ui-muted); font-size: 11px; line-height: 1.5; }
.citizen-service-card .service-info { margin-top: 11px; color: var(--ui-muted); font-size: 9px; }
html[data-theme="dark"] .citizen-service-card h3 { color: #edf3fa; }
html[data-theme="dark"] .citizen-service-card { background: var(--ui-surface-alt); }
@media (max-width: 620px) {
  .citizen-services-panel .panel-heading { align-items: flex-start; }
  .citizen-services-links { width: 100%; flex-direction: column; }
  .citizen-services-links a { justify-content: center; }
}
