/* Professional blue theme override — flat, restrained, institutional */
:root {
  --emerald-900: #0b2545;
  --emerald-800: #13315c;
  --emerald-700: #1d4ed8;
  --emerald-600: #2563eb;
  --emerald-100: #e8eefb;
  --emerald-50: #f5f8fd;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1f2933;
  --muted: #5f6b7a;
  --border: #dde1e6;
  --ok: #1e7a46;
  --ok-bg: #e6f2eb;
  --warn: #9a5b00;
  --warn-bg: #fdf3e1;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --radius: 6px;
  --shadow: none;
}

body {
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  font-size: 14px;
  letter-spacing: -0.005em;
}

/* Top bar: solid navy, no gradient */
.topbar {
  background: var(--emerald-900);
  box-shadow: none;
  border-bottom: 3px solid var(--emerald-700);
}
.brand-badge {
  border-radius: 4px;
  background: var(--emerald-700);
  border: 0;
  font-size: 0.78rem;
}
.brand-title { font-weight: 600; letter-spacing: 0; }
.pill {
  border-radius: 4px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-weight: 500;
}
.mode-nav { background: transparent; padding: 0; gap: 0; border: 1px solid rgba(255,255,255,0.2); border-radius: 4px; }
.mode-btn { border-radius: 0; font-weight: 500; padding: 0.45rem 0.9rem; }
.mode-btn + .mode-btn { border-left: 1px solid rgba(255,255,255,0.2); }
.mode-btn.is-active { background: #fff; color: var(--emerald-900); }

/* Cards & surfaces: flat with hairline borders */
.card, .kpi-card {
  border-radius: var(--radius);
  box-shadow: none;
}
.portal-hero {
  background: var(--surface);
  border-left: 4px solid var(--emerald-700);
}
.portal-hero h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; color: var(--emerald-900); }

.eyebrow, .step-tag, .kpi-label {
  letter-spacing: 0.06em;
  font-weight: 600;
}
.step-tag {
  border-radius: 3px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.kpi-card { border-top: 3px solid var(--border); }
.kpi-card.kpi-ok { border-left: 1px solid var(--border); border-top-color: var(--ok); }
.kpi-card.kpi-warn { border-left: 1px solid var(--border); border-top-color: var(--warn); }
.kpi-value { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Buttons */
.btn { border-radius: 4px; font-weight: 500; }
.btn-primary { background: var(--emerald-700); }
.btn-primary:hover { background: var(--emerald-800); }
.btn-outline { border-color: #b9c3d3; color: var(--emerald-800); }
.btn-outline:hover { background: var(--emerald-50); border-color: var(--emerald-700); }
.btn-ghost { border-color: transparent; }

/* Badges: squared, muted, with preserved semantic colors */
.badge, .countdown-pill, .verdict-pill {
  border-radius: 3px;
  font-weight: 600;
}
.badge { background: #eef0f3; color: #3e4c59; }
.badge.badge-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #b7dfc7; }
.badge.badge-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0d399; }
.badge.badge-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #f3c1bd; }

/* Uniform 17-Kawasan Grid & Top Statewide Row */
.kawasan-top-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}
@media (max-width: 720px) {
  .kawasan-top-row {
    grid-template-columns: 1fr;
  }
}
.kawasan-grid {
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 0.6rem;
}
.kawasan-tile {
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  gap: 0.5rem;
  align-items: center;
}
.kawasan-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}
.kawasan-counts {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.kawasan-counts .badge {
  min-width: 24px;
  justify-content: center;
  padding: 0.18rem 0.35rem;
  font-variant-numeric: tabular-nums;
}

/* Forms */
input[type="text"], input[type="search"], input[type="url"], input[type="number"], select, textarea {
  border-radius: 4px;
  border: 1px solid #c4cbd4;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(29, 78, 216, 0.25);
  border-color: var(--emerald-700);
}

/* Remove decorative gradients */
.pass-card { background: var(--emerald-50); border-radius: var(--radius); border: 1px solid #bfd0f2; }
.progress-fill, .bar-fill { background: var(--emerald-700); }
.progress-track, .bar-track { border-radius: 2px; }
.progress-fill, .bar-fill { border-radius: 2px; }
.active-agenda-box { border-radius: 4px; }
.amendment-box { border-radius: 4px; }
.poll-card, .usul-card, .qa-item, .doc-item, .kawasan-tile { border-radius: 4px; background: #fff; }
.poll-card.is-open { background: var(--emerald-50); }
.quorum-status-box { border-radius: 4px; background: #fafbfc; }
.code-snippet { background: #111827; border-radius: 4px; }

/* Tables */
.table-wrapper { border-radius: 4px; }
:is(#roster-table, #usul-table, #prereg-table) thead th {
  background: #f0f2f5;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
:is(#roster-table, #usul-table, #prereg-table) tbody tr:hover th,
:is(#roster-table, #usul-table, #prereg-table) tbody tr:hover td { background: #f7f9fc; }

/* Dialogs & toast */
dialog { border-radius: 6px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18); }
dialog::backdrop { background-color: rgba(15, 23, 42, 0.45); backdrop-filter: none; }
.btn-close { border-radius: 4px; background: transparent; border: 1px solid var(--border); }
.toast { border-radius: 4px; background: var(--emerald-900); }

/* Standalone Projector Window (Extend Screen Mode) */
body.is-standalone-projector .topbar { display: none; }
body.is-standalone-projector .container { max-width: 1440px; padding-top: 1rem; }
.voting-proj-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.voting-qr-card {
  text-align: center;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  flex-shrink: 0;
}
.voting-qr-card img {
  display: block;
  width: 170px;
  height: 170px;
  margin: 0 auto 0.4rem;
}

.quorum-hero {
  grid-template-columns: 1.6fr 1fr auto;
}
@media (max-width: 960px) {
  .quorum-hero {
    grid-template-columns: 1fr;
  }
}
.quorum-qr-box {
  text-align: center;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.quorum-qr-box img {
  display: block;
  width: 156px;
  height: 156px;
  margin: 0 auto 0.35rem;
}
.quorum-qr-box strong {
  display: block;
  font-size: 0.84rem;
  color: var(--emerald-900);
}
.quorum-qr-box small {
  font-size: 0.74rem;
}

/* Projector Welcome / Main Screen */
.welcome-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 68vh;
  padding: 3rem 2rem;
  border-top: 4px solid var(--emerald-700);
}
.welcome-logo {
  width: min(260px, 55vw);
  height: auto;
  margin-bottom: 1.75rem;
}
.welcome-title {
  margin: 0;
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  font-weight: 700;
  color: var(--emerald-900);
  letter-spacing: -0.01em;
}
.welcome-org {
  margin: 0.35rem 0 1.25rem;
  font-size: clamp(1.25rem, 2.6vw, 1.75rem);
  font-weight: 600;
  color: var(--emerald-700);
}
.welcome-meta {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.55rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--emerald-50);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

.error-msg span[role="img"]{display:inline-grid;place-items:center;width:15px;height:15px;border-radius:50%;background:var(--danger);color:#fff;font-size:10px;font-weight:700;margin-right:4px;}
