/* Malaysia Memilih — page-specific styles for report.html.
   Linked after the shared sheets (shell.css + component sheet) so these rules
   still override them, exactly as the previous inline <style> block did. */

:root {
  color-scheme: dark;
  --page: #080d16;
  --panel: #0e1523;
  --line: #202a3c;
  --muted: #8190a7;
  --red: #dc172b;
  --sky: #38bdf8;
  --teal: #166b68;
  --orange: #b96732;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: #e5eaf2;
  font-family: "Plus Jakarta Sans", sans-serif;
}

button, input, select { font: inherit; }
button, summary { cursor: pointer; }
button { touch-action: manipulation; }
.hidden { display: none !important; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 3px;
}

/* ---------- Application frame ---------- */
.app {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.header-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 29px;
  padding: 7px 12px;
  border: 1px solid #18202d;
  border-radius: 0;
  background: white;
  color: #18202d;
  text-decoration: none;
  font: 700 9px "JetBrains Mono", monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.header-button.active { background: #080d16; color: white; }
.header-button:hover { background: #eef2f6; color: #080d16; }
.header-button.active:hover { background: #182335; color: white; }

/* ---------- Overview strip ---------- */
.overview-strip {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  background: #0e1422;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.overview-strip::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  width: 130px;
  height: 2px;
  background: var(--red);
}

.heading-accent {
  width: 7px;
  height: 34px;
  border-radius: 8px;
  background: var(--red);
  flex-shrink: 0;
}

.main-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.layer-switch {
  display: flex;
  padding: 3px;
  gap: 3px;
  background: #080d16;
  border: 1px solid #283248;
  border-radius: 6px;
  flex-shrink: 0;
}

.layer-button {
  border: none;
  background: transparent;
  color: #a3afc1;
  padding: 9px 14px;
  border-radius: 3px;
  font: 700 10px "JetBrains Mono", monospace;
  text-transform: uppercase;
  white-space: nowrap;
}

.layer-button[aria-pressed="true"] {
  background: var(--red);
  color: white;
}

/* ---------- Status bar ---------- */
.status-bar {
  flex: none;
  min-height: 31px;
  display: flex;
  align-items: stretch;
  gap: 12px;
  border-top: 1px solid #253044;
  background: #060a11;
  font: 9px "JetBrains Mono", monospace;
}

#statusText {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-poll {
  margin-left: auto;
  color: #7f93ad;
  white-space: nowrap;
}

.status-poll:empty {
  display: none;
}

.status-count {
  margin-left: 12px;
  color: #bccbdd;
  white-space: nowrap;
}

/* ---------- Report surface ---------- */
.report-main { flex: 1; min-height: 0; }

.report-wrap {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.coverage-notice {
  margin: 0 0 18px;
  padding: 11px 13px;
  border: 1px solid #6f4c27;
  background: #33250f55;
  color: #d8bc87;
  border-radius: 6px;
  font-size: 10px;
  line-height: 1.8;
}

.coverage-notice a {
  color: #7dd3fc;
  text-decoration: none;
  border-bottom: 1px dotted #7dd3fc;
}

/* ---------- Control deck ---------- */
.control-deck {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 18px;
  padding: 16px 18px;
  background: #0e1422;
  border: 1px solid var(--line);
  border-radius: 8px;
  position: relative;
  margin-bottom: 20px;
}

.control-deck::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  width: 110px;
  height: 2px;
  background: var(--red);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.control-label {
  font: 600 8px "JetBrains Mono", monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #8a9ab2;
}

.control-select,
.control-deck input[type="search"] {
  color: #becadd;
  background: #111a2a;
  border: 1px solid #2a354c;
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 11px;
  min-width: 170px;
  max-width: 300px;
}

.control-deck input[type="search"] { min-width: 210px; }

.control-select:disabled { opacity: .45; }

.control-spacer { flex: 1 1 40px; }

.control-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Document chip ---------- */
.doc-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border: 1px solid #283248;
  border-radius: 6px;
  background: #080d16;
  font: 600 9px "JetBrains Mono", monospace;
  color: #9fb0c8;
  white-space: nowrap;
  flex-shrink: 0;
}

.doc-chip b { color: #cdd7e5; font-weight: 700; }

/* ---------- Metrics ---------- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 11px;
  margin-bottom: 22px;
}

.metric {
  border: 1px solid #253149;
  border-radius: 7px;
  background: #111b2c;
  padding: 13px;
}

.metric-label {
  font: 8px "JetBrains Mono", monospace;
  color: #8a9ab2;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.metric-value {
  margin-top: 8px;
  font-size: 19px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.metric-value.idle { color: #4b5a72; }

.metric-note {
  margin-top: 4px;
  font-size: 9px;
  color: #71839e;
  line-height: 1.5;
}

/* ---------- Panels ---------- */
.panel {
  margin-bottom: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 110px;
  height: 2px;
  background: var(--red);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.panel-head p {
  margin: 5px 0 0;
  font-size: 10px;
  color: #74859f;
  line-height: 1.6;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  max-height: 640px;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 11px;
}

th {
  padding: 10px 12px;
  background: #080f1b;
  color: #8596af;
  font: 9px "JetBrains Mono", monospace;
  text-transform: uppercase;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 3;
}

td {
  padding: 9px 12px;
  border-bottom: 1px solid #202b3f;
  color: #a7b6cd;
  white-space: nowrap;
}

td.wrap { white-space: normal; min-width: 160px; }
td.right, th.right { text-align: right; }
td.dim { color: #4b5a72; }

.seat-table th:first-child,
.seat-table td:first-child {
  position: sticky;
  left: 0;
  background: #0b1220;
  z-index: 4;
}

.seat-table th:first-child { z-index: 5; }
.seat-table tbody tr:hover td { background: #111c2e; }
.seat-table tbody tr:hover td:first-child { background: #111c2e; }

.seat-code {
  font-family: "JetBrains Mono", monospace;
  color: #7dd3fc;
  font-weight: 600;
}

.seat-name {
  color: #cdd7e5;
}

.seat-name.unloaded {
  color: #4b5a72;
  font-style: italic;
}

.party-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 7px;
  vertical-align: middle;
}

/* ---------- Pills ---------- */
.pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 3px;
  font: 600 9px "JetBrains Mono", monospace;
  background: #1b2434;
  color: #b8c4d7;
  border: 1px solid #2a354c;
  white-space: nowrap;
}

.pill.good { background: #0f2a20; border-color: #1f5e42; color: #6ee7b7; }
.pill.bad { background: #3b1418; border-color: #7f2030; color: #fda4af; }
.pill.warn { background: #3a2a12; border-color: #7a5520; color: #fcd34d; }

/* ---------- Empty / pending rows ---------- */
.empty-row {
  padding: 26px 18px;
  text-align: center;
  color: #71839e;
  font-size: 11px;
  line-height: 1.9;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 8px 14px;
  border: 1px solid #33425b;
  border-radius: 5px;
  background: #172237;
  color: #b5dff4;
  font: 700 9px "JetBrains Mono", monospace;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.btn:hover:not(:disabled) { background: #1e2c46; color: white; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn.primary {
  background: var(--red);
  border-color: #b21123;
  color: white;
}

.btn.primary:hover:not(:disabled) { background: #b21123; }

.disclaimer {
  margin-top: 24px;
  font-size: 10px;
  line-height: 1.9;
  color: #62758f;
}

/* ---------- Responsive ---------- */
@media (min-width: 1600px) {
  .masthead { padding-inline: 36px; }
  .overview-strip { padding-inline: 34px; }
  .report-wrap { padding-inline: 34px; }
}

@media (max-width: 1200px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 700px) {
  .masthead {
    padding: 12px 14px;
    min-height: 60px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .brand-name { font-size: 13px; }
  .brand-note { font-size: 7px; letter-spacing: .04em; }
  .brand-bars { height: 24px; }

  .header-button { padding: 7px 8px; font-size: 8px; flex-shrink: 0; }

  .overview-strip { padding: 12px 14px; flex-wrap: wrap; gap: 12px; }
  .overview-strip::before { left: 14px; }
  .main-title { font-size: 13px; }
  .layer-switch { margin-left: 0; }
  .layer-button { padding: 7px 10px; font-size: 9px; }
  .doc-chip { width: 100%; justify-content: space-between; }

  .report-wrap { padding: 14px 12px 28px; }
  .control-deck { padding: 14px; gap: 12px; }
  .control-group { flex: 1 1 140px; }
  .control-select,
  .control-deck input[type="search"] {
    min-width: 0;
    width: 100%;
    max-width: none;
  }
  .control-actions { width: 100%; }
  .control-actions .btn { flex: 1; }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 10px;
  }

  .metric { padding: 12px; }
  .metric-value { font-size: 17px; }

  .table-wrap { max-height: 520px; }

  .status-tag { padding: 8px; font-size: 7px; }
  .status-count,
  .status-poll { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .no-print { display: none !important; }
  .masthead { border-bottom: 1px solid #999; }
  .report-wrap { max-width: none; }
  .table-wrap { max-height: none; overflow: visible; }
  .panel { break-inside: avoid; }
  td, th { padding: 5px 7px; font-size: 8px; }
  .seat-table th:first-child,
  .seat-table td:first-child { position: static; }
  th { position: static; }
}
