:root {
  --emerald-900: #0c3d20;
  --emerald-800: #13542d;
  --emerald-700: #1b6b3a;
  --emerald-600: #228247;
  --emerald-100: #e7f4ec;
  --emerald-50: #f2f9f4;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --ink: #14241b;
  --muted: #52665a;
  --border: #d5e0d9;
  --danger: #c62828;
  --danger-bg: #fdecea;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 45, 25, 0.06);
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

h1, h2, h3, h4, p {
  margin-top: 0;
}

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(135deg, var(--emerald-900), var(--emerald-700));
  color: #fff;
  box-shadow: 0 4px 16px rgba(10, 40, 20, 0.16);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 0.85rem;
}

.brand-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.brand-sub {
  margin: 0;
  font-size: 0.78rem;
  opacity: 0.86;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.pill-live .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
}

.pill-live.is-offline .dot {
  background: #fbbf24;
}

.mode-nav {
  display: flex;
  background: rgba(0, 0, 0, 0.22);
  padding: 0.25rem;
  border-radius: 10px;
  gap: 0.25rem;
}

.mode-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  padding: 0.42rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.mode-btn.is-active {
  background: #fff;
  color: var(--emerald-900);
}

/* Layout & Cards */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem;
}

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

.card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--emerald-700);
  margin-bottom: 0.25rem;
}

.step-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--emerald-700);
  background: var(--emerald-100);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-bottom: 0.35rem;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.subhead {
  margin: 1.1rem 0 0.55rem;
  font-size: 0.95rem;
  color: var(--emerald-900);
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

.portal-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.15rem;
  background: linear-gradient(to right, #ffffff, var(--emerald-50));
}

.portal-hero h2 {
  margin-bottom: 0.25rem;
  font-size: 1.28rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.portal-grid,
.urusetia-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
}

.full-span {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .portal-grid,
  .urusetia-grid {
    grid-template-columns: 1fr;
  }
}

/* Badges & Buttons */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: #edf2ef;
  color: var(--ink);
}

.badge-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.08s, background-color 0.15s, border-color 0.15s;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--emerald-700);
  color: #fff;
}

.btn-primary:hover {
  background: var(--emerald-800);
}

.btn-outline {
  background: #fff;
  color: var(--emerald-800);
  border-color: var(--emerald-700);
}

.btn-outline:hover {
  background: var(--emerald-50);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: #eef3f0;
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 0.36rem 0.72rem;
  font-size: 0.82rem;
}

.btn-xs {
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.btn-row-tight {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

/* Forms & Validation (validate-input-after-interaction) */
.field {
  margin-bottom: 0.85rem;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (max-width: 600px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.field label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.req {
  color: var(--danger);
}

.hint {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="search"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.52rem 0.7rem;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid #b9c9bf;
  border-radius: 8px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(27, 107, 58, 0.28);
  border-color: var(--emerald-700);
}

.error-msg {
  display: none;
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 0.25rem;
  font-weight: 500;
}

:is(input, select, textarea):is(:user-invalid, .user-invalid-fallback) {
  border-color: var(--danger);
  background-color: var(--danger-bg);
}

:is(input, select, textarea):is(:user-invalid, .user-invalid-fallback) + .error-msg {
  display: block;
}

:is(input, select, textarea):is(:user-valid, .user-valid-fallback) {
  border-color: var(--ok);
}

/* Pass Card */
.pass-card {
  margin-top: 0.5rem;
  padding: 1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--emerald-50), #ffffff);
  border: 1.5px solid var(--emerald-700);
}

.pass-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.pass-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ok);
  letter-spacing: 0.05em;
}

.pass-top h4 {
  margin: 0.15rem 0;
  font-size: 1.05rem;
}

.pin-box {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: #fff;
  border: 1px dashed var(--emerald-700);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.pin-label {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
}

.pin-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.35rem;
  letter-spacing: 0.16em;
  color: var(--emerald-900);
}

.prereg-details {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  font-size: 0.88rem;
}

.prereg-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--emerald-800);
}

.prereg-body {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 0.65rem;
}

.prereg-body img {
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Stacks & Lists */
.stack-md {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.active-agenda-box {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: var(--emerald-100);
  border-left: 4px solid var(--emerald-700);
  margin-bottom: 0.75rem;
}

.agenda-mini-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.agenda-mini-list li.is-done {
  color: var(--muted);
  text-decoration: line-through;
}

.agenda-mini-list li.is-active {
  font-weight: 700;
  color: var(--emerald-900);
}

.docs-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.doc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfdfb;
}

.doc-item strong {
  display: block;
  font-size: 0.9rem;
}

.doc-item small {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Polls & Usul Cards */
.poll-card,
.usul-card,
.qa-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  background: #fcfdfc;
}

.poll-card.is-open {
  border-color: var(--emerald-700);
  background: var(--emerald-50);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.65rem 0;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 0.92rem;
}

.radio-option input {
  width: auto;
}

.bar-row {
  margin-top: 0.45rem;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e2eae5;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--emerald-700), var(--emerald-600));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.amendment-box {
  margin-top: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: #fffbeb;
  border-left: 4px solid #d97706;
  font-size: 0.88rem;
}

/* Projector Mode */
.projector-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.proj-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.proj-clock {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  background: var(--emerald-100);
  color: var(--emerald-900);
}

.proj-tab-btn.is-active {
  background: var(--emerald-700);
  color: #fff;
  border-color: var(--emerald-700);
}

.quorum-hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 1.15rem;
}

@media (max-width: 820px) {
  .quorum-hero {
    grid-template-columns: 1fr;
  }
}

.quorum-numbers {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0.35rem 0 0.85rem;
}

.big-num {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  font-weight: 800;
  color: var(--emerald-800);
  line-height: 1;
}

.big-sep,
.big-total {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  color: var(--muted);
  font-weight: 600;
}

.big-pct {
  margin-left: 0.75rem;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--emerald-700);
}

.progress-track {
  position: relative;
  height: 28px;
  border-radius: 999px;
  background: #e4ece7;
  overflow: visible;
  margin-bottom: 1.5rem;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--emerald-700), #22c55e);
  transition: width 0.35s ease;
}

.threshold-line {
  position: absolute;
  left: 50%;
  top: -6px;
  bottom: -6px;
  width: 3px;
  background: #b91c1c;
}

.threshold-line > span {
  position: absolute;
  top: 34px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.76rem;
  font-weight: 700;
  color: #991b1b;
}

.quorum-status-box {
  text-align: center;
  padding: 1rem;
  border-radius: 12px;
  background: var(--emerald-50);
  border: 1px solid var(--border);
}

.verdict-pill {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 0.45rem;
}

.verdict-ok {
  background: var(--ok);
  color: #fff;
}

.verdict-wait {
  background: var(--warn-bg);
  color: var(--warn);
}

.kawasan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 0.6rem;
}

.kawasan-tile {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfdfb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
}

.proj-split {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 1.15rem;
}

@media (max-width: 820px) {
  .proj-split {
    grid-template-columns: 1fr;
  }
}

.timer-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 290px;
}

.timer-digits {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(4rem, 10vw, 6.2rem);
  font-weight: 800;
  color: var(--emerald-900);
  line-height: 1.05;
  margin: 0.5rem 0;
}

.timer-digits.is-urgent {
  color: var(--danger);
}

.proj-agenda-ol {
  margin: 0;
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 1.02rem;
}

.proj-agenda-ol li.is-active {
  font-weight: 800;
  color: var(--emerald-800);
  background: var(--emerald-100);
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
}

.proj-agenda-ol li.is-done {
  color: var(--muted);
}

.usul-board h2 {
  font-size: 1.5rem;
  margin-bottom: 0.6rem;
}

/* Urusetia Controls */
.timer-control-box {
  padding: 0.85rem;
  border-radius: 10px;
  background: var(--emerald-50);
  border: 1px solid var(--border);
}

.timer-inline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.timer-inline strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.6rem;
  color: var(--emerald-900);
}

.filter-bar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 720px) {
  .filter-bar {
    grid-template-columns: 1fr;
  }
}

/* Pre-Registration KPI & Dashboard */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.15rem;
}

@media (max-width: 820px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem 1.1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.kpi-card.kpi-ok {
  border-left: 4px solid var(--ok);
}

.kpi-card.kpi-warn {
  border-left: 4px solid var(--warn);
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--emerald-900);
  line-height: 1.15;
}

.countdown-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.84rem;
}

.code-snippet {
  margin: 0.5rem 0 0;
  padding: 0.65rem;
  background: #102117;
  color: #e2f2e7;
  border-radius: 8px;
  font-size: 0.75rem;
  overflow-x: auto;
  max-height: 180px;
}

/* Responsive Data Table (modern-web-guidance: responsive-table) */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(560px, 75vh);
  container-type: inline-size;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

#roster-table,
#usul-table,
#prereg-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
}

#roster-table {
  --label-2: "Kawasan";
  --label-3: "Perwakilan";
  --label-4: "Bil 1";
  --label-5: "Kod PIN";
  --label-6: "Status Bil 2";
  --label-7: "Tindakan";
}

#usul-table {
  --label-2: "Cadangan";
  --label-3: "Rasional";
  --label-4: "Pencadang";
  --label-5: "Penyokong";
  --label-6: "Status & Pindaan";
}

#prereg-table {
  --label-2: "Kawasan";
  --label-3: "Perwakilan";
  --label-4: "Status Pra-Daftar";
  --label-5: "Sebab / Usul";
  --label-6: "Kemaskini Pantas";
}

:is(#roster-table, #usul-table, #prereg-table) thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
}

:is(#roster-table, #usul-table, #prereg-table) thead th {
  background: var(--emerald-800);
  color: #fff;
  text-align: left;
  padding: 0.65rem 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

:is(#roster-table, #usul-table, #prereg-table) tbody th,
:is(#roster-table, #usul-table, #prereg-table) tbody td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #e7eeea;
  vertical-align: top;
}

:is(#roster-table, #usul-table, #prereg-table) tbody th {
  position: sticky;
  inset-inline-start: 0;
  background: #fff;
  text-align: left;
  font-weight: 600;
}

:is(#roster-table, #usul-table, #prereg-table) tbody tr:hover th,
:is(#roster-table, #usul-table, #prereg-table) tbody tr:hover td {
  background: #f6fbf7;
}

@container (width < 600px) {
  :is(#roster-table, #usul-table, #prereg-table),
  :is(#roster-table, #usul-table, #prereg-table) thead,
  :is(#roster-table, #usul-table, #prereg-table) tbody,
  :is(#roster-table, #usul-table, #prereg-table) tr,
  :is(#roster-table, #usul-table, #prereg-table) th,
  :is(#roster-table, #usul-table, #prereg-table) td {
    display: block;
  }

  :is(#roster-table, #usul-table, #prereg-table) thead {
    display: none;
  }

  :is(#roster-table, #usul-table, #prereg-table) tr {
    margin-block-end: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
  }

  :is(#roster-table, #usul-table, #prereg-table) tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: var(--emerald-100);
    color: var(--emerald-900);
    border-bottom: 1px solid var(--border);
  }

  :is(#roster-table, #usul-table, #prereg-table) td:nth-child(2)::before { content: var(--label-2) ": "; font-weight: 600; color: var(--muted); }
  :is(#roster-table, #usul-table, #prereg-table) td:nth-child(3)::before { content: var(--label-3) ": "; font-weight: 600; color: var(--muted); }
  :is(#roster-table, #usul-table, #prereg-table) td:nth-child(4)::before { content: var(--label-4) ": "; font-weight: 600; color: var(--muted); }
  :is(#roster-table, #usul-table, #prereg-table) td:nth-child(5)::before { content: var(--label-5) ": "; font-weight: 600; color: var(--muted); }
  :is(#roster-table, #usul-table, #prereg-table) td:nth-child(6)::before { content: var(--label-6) ": "; font-weight: 600; color: var(--muted); }
  #roster-table td:nth-child(7)::before { content: var(--label-7) ": "; font-weight: 600; color: var(--muted); }
}

/* Native Modal Dialogs (dialog + light-dismiss-a-dialog + prevent-page-scroll-under-modal-dialog) */
dialog {
  width: min(560px, calc(100vw - 2rem));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 20px 48px rgba(10, 30, 18, 0.25);
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(10, 30, 18, 0.5);
  backdrop-filter: blur(2px);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--emerald-900);
}

.btn-close {
  border: 0;
  background: #edf3ef;
  color: var(--ink);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.clause-list p {
  font-size: 0.9rem;
  margin-bottom: 0.45rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 60;
  background: var(--emerald-900);
  color: #fff;
  padding: 0.75rem 1.05rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

.toast.is-error {
  background: var(--danger);
}
