/* NorthHaven Election Aggregation and Monitoring System
 * Government-Grade Light Theme, Formal Typography & Multi-Select Dropdowns
 */

:root {
  --font-sans: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --bg-canvas: #f5f7f6;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-subtle: #f8faf9;
  --border: #dfe5e1;
  --border-strong: #c6d1ca;
  --text-main: #0f1f17;
  --text-muted: #47584f;
  --text-light: #64746b;
  --primary: #17492f;
  --primary-hover: #113824;
  --primary-soft: #ecf5f0;
  --primary-border: #c5dfd0;
  --accent: #b45309;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --info: #0369a1;
  --info-soft: #f0f9ff;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 31, 23, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 31, 23, 0.08);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-main);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.015em;
  line-height: 1.3;
  margin-top: 0;
}

p { margin-top: 0; }

a { color: var(--primary); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }

.nh-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ---------------- Public Welcome Page ---------------- */
.welcome-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 1px 3px rgba(15, 31, 23, 0.04);
}

.welcome-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.welcome-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 76px;
  padding: 0.75rem 0;
}

.welcome-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--text-main);
  text-decoration: none;
  min-width: 0;
}
.welcome-brand:hover { text-decoration: none; }
.welcome-brand img {
  height: 52px;
  width: 52px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}
.welcome-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.welcome-brand-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.welcome-brand-sub {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.welcome-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-shrink: 0;
}
.welcome-links a.nav-item {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0.35rem 0;
  transition: color 0.15s ease;
}
.welcome-links a.nav-item:hover {
  color: var(--primary);
  text-decoration: none;
}

.welcome-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 20%, rgba(23, 73, 47, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 10% 80%, rgba(23, 73, 47, 0.05) 0%, transparent 40%),
    linear-gradient(155deg, #ffffff 0%, #eef5f1 100%);
  border-bottom: 1px solid var(--border);
  padding: 4.5rem 0;
}

.welcome-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(23, 73, 47, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(23, 73, 47, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.welcome-hero > .welcome-container {
  position: relative;
  z-index: 1;
}

@keyframes nhFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.welcome-fade-in {
  animation: nhFadeUp 0.45s ease-out both;
}

.welcome-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
  gap: 3rem;
  align-items: center;
}

.welcome-hero-inner {
  max-width: 660px;
}

.welcome-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-bottom: 1.25rem;
}

.welcome-hero h1 {
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.025em;
  margin-bottom: 1.1rem;
  color: var(--text-main);
}

.welcome-hero p {
  font-size: 1.03rem;
  line-height: 1.68;
  color: var(--text-muted);
  max-width: 58ch;
  margin-bottom: 2rem;
}

.welcome-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.welcome-hero-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
}

.welcome-crest-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.1rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}

.welcome-crest-top img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--primary-border);
  padding: 3px;
  background: #ffffff;
  flex-shrink: 0;
}

.welcome-crest-quote {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 1.15rem;
}

.welcome-pillar-list {
  display: grid;
  gap: 0.6rem;
}

.welcome-pillar-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
}

.welcome-pillar-item svg {
  color: var(--primary);
  flex-shrink: 0;
}

.welcome-commitment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.welcome-commitment-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.welcome-commitment-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.welcome-commitment-card p {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text-muted);
  margin: 0;
}

.welcome-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.9rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.welcome-panel-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.welcome-tier-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.welcome-tier-item {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.75rem 0.85rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.welcome-tier-step {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.welcome-tier-body strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

.welcome-tier-body span {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  line-height: 1.45;
}

.welcome-section {
  padding: 4rem 0;
}

.welcome-section-alt {
  background: #ffffff;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-heading {
  max-width: 680px;
  margin-bottom: 2.25rem;
}
.section-heading h2 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.section-heading p {
  font-size: 0.96rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.feature-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.feature-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
}
.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}
.feature-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.58;
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.role-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.role-card:hover {
  background: #ffffff;
  border-color: var(--primary-border);
}
.role-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.role-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.role-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
  line-height: 1.3;
}
.role-card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.58;
  margin: 0;
}
.role-card-action {
  padding-top: 0.25rem;
}

.welcome-footer {
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.welcome-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.welcome-footer-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.welcome-footer-brand img {
  height: 40px;
  width: 40px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

.welcome-footer-title {
  display: block;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.9rem;
}

.welcome-footer-copy {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* ---------------- Auth / Public Forms ---------------- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: linear-gradient(155deg, #eef4f0 0%, #f7f9f8 55%, #ffffff 100%);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 12px;
  padding: 2.1rem 2rem;
  box-shadow: var(--shadow-md);
}

.auth-header { text-align: center; margin-bottom: 1.5rem; }
.auth-header img { max-height: 88px; width: auto; object-fit: contain; margin-bottom: 0.85rem; }
.auth-header h1 { font-size: 1.2rem; font-weight: 600; margin: 0 0 0.25rem; }
.auth-header p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

/* ---------------- App Shell ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 268px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  padding: 0.8rem 0.75rem 0.35rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.58rem 0.85rem;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--bg-subtle); color: var(--text-main); text-decoration: none; }
.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--primary);
}

.sidebar-footer {
  padding: 0.95rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.main-wrap {
  flex: 1;
  margin-left: 268px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left { display: flex; align-items: center; gap: 0.85rem; }
.topbar-title { font-size: 1.1rem; font-weight: 600; margin: 0; }
.topbar-subtitle { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.1rem; }

.topbar-right { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
}

.content { padding: 1.5rem; flex: 1; }

/* ---------------- Cards & Grid ---------------- */
.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 0.96rem; font-weight: 600; margin: 0; }

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.kpi-label { font-size: 0.72rem; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-value { font-size: 1.65rem; font-weight: 700; color: var(--text-main); margin: 0.3rem 0 0.15rem; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 0.78rem; color: var(--text-muted); }

/* ---------------- Forms & Multi-Select Dropdown ---------------- */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--text-main); margin-bottom: 0.35rem; }
.form-control, .form-select {
  width: 100%;
  font-family: var(--font-sans);
  padding: 0.56rem 0.78rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-main);
  background: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 73, 47, 0.14);
}
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.85rem; }

/* Searchable Multi-Select Dropdown */
select[data-nh-multiselect] {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  height: 1px !important;
  width: 1px !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
.nh-ms {
  position: relative;
  width: 100%;
}
.nh-ms-trigger {
  width: 100%;
  min-height: 40px;
  padding: 0.42rem 0.78rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.nh-ms-trigger:focus,
.nh-ms.open .nh-ms-trigger {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 73, 47, 0.14);
}
.nh-ms-placeholder { color: var(--text-light); }
.nh-ms-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
  align-items: center;
  max-height: 108px;
  overflow-y: auto;
}
.nh-ms-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.5rem;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
}
.nh-ms-chip-remove {
  border: none;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 0.95rem;
  font-weight: 600;
}
.nh-ms-caret {
  color: var(--text-muted);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.nh-ms.open .nh-ms-caret { transform: rotate(180deg); }

.nh-ms-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  z-index: 60;
  overflow: hidden;
}
.nh-ms.open .nh-ms-menu { display: block; }

.nh-ms-search-wrap {
  padding: 0.55rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}
.nh-ms-search {
  width: 100%;
  padding: 0.42rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.84rem;
}
.nh-ms-search:focus {
  outline: none;
  border-color: var(--primary);
}
.nh-ms-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.38rem 0.78rem;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.nh-ms-clear {
  border: none;
  background: transparent;
  color: var(--primary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.1rem 0.25rem;
}
.nh-ms-clear:hover { text-decoration: underline; }
.nh-ms-clear:disabled {
  color: var(--text-light);
  cursor: default;
  text-decoration: none;
}
.nh-ms-list {
  max-height: 230px;
  overflow-y: auto;
  padding: 0.3rem 0;
}
.nh-ms-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.48rem 0.78rem;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
}
.nh-ms-option input[type="checkbox"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  cursor: pointer;
}
.nh-ms-option:hover { background: var(--bg-subtle); }
.nh-ms-option.selected { background: var(--primary-soft); font-weight: 500; }
.nh-ms-option.disabled {
  opacity: 0.62;
  cursor: not-allowed;
  background: var(--bg-subtle);
  color: var(--text-light);
}
.nh-ms-option.disabled:hover { background: var(--bg-subtle); }
.nh-ms-empty {
  padding: 0.75rem;
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-light);
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-sans);
  padding: 0.56rem 1.05rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: #ffffff; color: var(--text-main); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--bg-subtle); }
.btn-danger { background: var(--danger); color: #ffffff; }
.btn-danger:hover { opacity: 0.92; }
.btn-sm { padding: 0.36rem 0.72rem; font-size: 0.8rem; }

/* ---------------- Badges & Alerts ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.62rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-info    { background: var(--info-soft); color: var(--info); }
.badge-muted   { background: #eef2f0; color: var(--text-muted); }

.alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); color: #14532d; border-color: #bbf7d0; }
.alert-danger  { background: var(--danger-soft); color: #7f1d1d; border-color: #fecaca; }
.alert-warning { background: var(--warning-soft); color: #78350f; border-color: #fde68a; }
.alert-info    { background: var(--info-soft); color: #0c4a6e; border-color: #bae6fd; }

/* ---------------- Tables ---------------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
table.data-table th, table.data-table td {
  padding: 0.68rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
table.data-table th {
  background: var(--bg-subtle);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
table.data-table tbody tr:hover { background: var(--bg-subtle); }

/* Live indicator */
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: pulseDot 1.6s infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.25); }
}

.progress-bar-bg {
  width: 100%;
  height: 7px;
  background: #e2e8e4;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* ---------------- Profile & Avatars ---------------- */
.nh-avatar {
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--primary-border);
  background: var(--primary-soft);
  flex-shrink: 0;
  display: inline-block;
}
.nh-avatar-xs { width: 26px; height: 26px; }
.nh-avatar-sm { width: 38px; height: 38px; }
.nh-avatar-lg { width: 88px; height: 88px; border-width: 2px; }

.sidebar-profile-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
}
.sidebar-profile-link:hover { text-decoration: none; }
.sidebar-profile-meta { min-width: 0; }
.sidebar-profile-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-profile-scope {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-profile {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  padding: 0.25rem 0.65rem 0.25rem 0.3rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-main);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.topbar-profile:hover {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  text-decoration: none;
}

.profile-summary-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.profile-scope-list {
  display: grid;
  gap: 0.65rem;
  font-size: 0.875rem;
}
.profile-scope-item {
  padding: 0.65rem 0.85rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.profile-scope-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  margin-bottom: 0.2rem;
}
.profile-scope-value {
  color: var(--text-main);
  font-weight: 500;
}

/* ---------------- Official Result Forms ---------------- */
.inec-sheet {
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: 10px;
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
}
.inec-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--primary);
}
.inec-banner-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0 0 0.2rem;
}
.inec-banner-sub {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  text-transform: uppercase;
}
.inec-sn-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
}
.inec-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1.15rem;
  font-size: 0.85rem;
}
.inec-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 0.35rem;
}
.inec-meta-label {
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.inec-meta-val {
  font-weight: 600;
  color: var(--text-main);
  text-align: right;
}
table.inec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
table.inec-table th,
table.inec-table td {
  border: 1px solid var(--border-strong);
  padding: 0.45rem 0.55rem;
  vertical-align: middle;
}
table.inec-table thead th {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  text-align: center;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
table.inec-table tbody td.num-col {
  text-align: right;
  font-weight: 500;
}
table.inec-table tr.inec-total-row td {
  background: #edf4f0;
  font-weight: 700;
  color: var(--text-main);
  border-top: 2px solid var(--primary);
}
.inec-matrix-input {
  width: 72px;
  padding: 0.3rem 0.4rem;
  font-size: 0.8125rem;
  text-align: right;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  font-family: var(--font-sans);
}
.inec-cert-box {
  margin-top: 1.15rem;
  padding: 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .roles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .welcome-hero-grid { grid-template-columns: 1fr; gap: 2rem; }
  .welcome-hero { padding: 3.5rem 0; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }
  .main-wrap { margin-left: 0; }
  .mobile-menu-btn { display: inline-flex; }
  .grid-4, .grid-3, .grid-2, .roles-grid, .welcome-commitment-grid, .inec-meta-grid, .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
  .topbar { padding: 0.75rem 1rem; }
  .welcome-container { padding: 0 1rem; }
  .welcome-nav { min-height: 64px; gap: 0.75rem; }
  .welcome-brand img { height: 42px; width: 42px; }
  .welcome-brand-title { font-size: 0.85rem; }
  .welcome-brand-sub { display: none; }
  .welcome-links { gap: 0.75rem; }
  .welcome-links a.nav-item { display: none; }
  .welcome-hero { padding: 2.75rem 0; }
  .welcome-hero h1 { font-size: 1.7rem; }
  .welcome-hero p { font-size: 0.95rem; }
  .welcome-section { padding: 2.75rem 0; }
  .section-heading h2 { font-size: 1.38rem; }
}
