:root {
  color-scheme: light;
  /* Classic Volvo blue palette (heritage emblem / Pantone 295 family). */
  --bg: #eef2f8;
  --panel: #ffffff;
  --ink: #10243f;
  --muted: #5b6b80;
  --line: #d4ddeb;
  --accent: #1b54a8;
  --accent-strong: #0b2f66;
  --warn: #9b4d00;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 86px;
  padding: 18px 24px;
  border-bottom: 3px solid var(--accent);
  background: var(--accent-strong);
}

.topbar h1 {
  color: #ffffff;
  letter-spacing: 0.06em;
}

.topbar p {
  color: #b9cae6;
}

.topbar #userLabel {
  color: #cdd9ee;
}

.sessionActions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

h1,
h2 {
  margin: 0;
  font-weight: 650;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 18px;
}

p {
  margin: 6px 0 0;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 18px 18px;
}

.results {
  min-height: auto;
}

.downloadDashboard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.dashboardHeader,
.dashboardActivity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.dashboardActivity {
  grid-template-columns: minmax(240px, .8fr) minmax(280px, 1.2fr);
  margin-top: 12px;
}

.statusPill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 650;
}

.statusPill[data-status="running"] {
  border-color: #93b4e0;
  color: var(--accent-strong);
  background: #e9f0fb;
}

.statusPill[data-status="stalled"] {
  border-color: #d9a35f;
  color: var(--warn);
  background: #fff7eb;
}

.progressTrack {
  height: 10px;
  overflow: hidden;
  margin-top: 12px;
  border-radius: 999px;
  background: #e4ecf8;
}

.progressFill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 240ms ease;
}

.dashboardGrid {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfdfc;
}

.metric strong {
  display: block;
  font-size: 18px;
}

.metric span,
.eventRow span {
  color: var(--muted);
  font-size: 12px;
}

.eventList {
  display: grid;
  gap: 6px;
  max-height: 152px;
  overflow: auto;
}

.eventRow {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  font-size: 13px;
}

.eventRow strong {
  overflow-wrap: anywhere;
  font-weight: 550;
}

.filters {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(280px, 1.6fr) minmax(180px, .95fr) minmax(180px, .95fr) minmax(160px, .85fr) auto auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.navButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--ink);
  background: #fff;
  font-weight: 650;
  text-decoration: none;
}

.navButton:hover {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.smallButton {
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.openPdfButton {
  margin-top: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.stat strong {
  display: block;
  font-size: 22px;
}

.tableWrap {
  overflow: auto;
  max-height: calc(100vh - 238px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  background: #e8eef9;
  color: #2b3d57;
  font-size: 12px;
  text-transform: uppercase;
}

.sortHeader {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  text-transform: inherit;
}

.sortHeader:hover,
.sortHeader.active {
  background: transparent;
  color: var(--accent-strong);
}

.sortIndicator {
  display: inline-block;
  min-width: 8px;
  color: var(--accent-strong);
}

tr {
  cursor: pointer;
}

tr:hover td {
  background: #eef3fc;
}

.muted {
  color: var(--muted);
}

.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.detailBlock {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.path {
  overflow-wrap: anywhere;
  color: var(--accent-strong);
}

.authPage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.authShell {
  width: min(430px, 100%);
}

.authPanel,
.adminSection {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.authForm {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.authFooter {
  margin-top: 16px;
  color: var(--muted);
}

.authFooter a {
  color: var(--accent-strong);
  font-weight: 650;
}

.formMessage {
  min-height: 22px;
  color: var(--muted);
}

.formMessage[data-kind="error"] {
  color: #8a1f11;
}

.formMessage[data-kind="success"] {
  color: var(--accent-strong);
}

.adminWorkspace {
  gap: 16px;
}

.sectionHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.adminTableWrap {
  max-height: 360px;
}

.compactTable table {
  min-width: 760px;
}

.actionCell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.modalBackdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  background: rgba(15, 24, 21, 0.34);
  padding: 18px;
}

.modalBackdrop[hidden] {
  display: none;
}

.modal {
  position: relative;
  width: min(1480px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(11, 31, 26, 0.22);
  padding: 18px;
}

.passwordModal {
  align-self: flex-start;
  width: min(460px, 100%);
}

.modalOpen {
  overflow: hidden;
}

.iconButton {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  line-height: 1;
}

.iconButton:hover {
  background: #e8eef9;
}

.closeButton {
  position: sticky;
  top: 0;
  float: right;
  margin-left: 12px;
  z-index: 1;
}

.matches {
  display: grid;
  gap: 10px;
}

.matchSummary {
  color: var(--muted);
  margin: 0 0 10px;
}

.match {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfdfc;
}

.matchHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.matchCount {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.pageLink {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 9px;
  color: var(--accent-strong);
  background: #fff;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.pageLink:hover {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.match p {
  margin-top: 6px;
}

mark {
  background: #fff1a8;
  color: var(--ink);
  padding: 0 2px;
}

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

  .dashboardGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .filters,
  .stats,
  .dashboardGrid,
  .dashboardActivity {
    grid-template-columns: 1fr;
  }

  .tableWrap {
    max-height: calc(100vh - 430px);
  }

  .modalBackdrop {
    padding: 8px;
  }

  .modal {
    max-height: calc(100vh - 16px);
  }
}
