:root {
  color-scheme: dark;
  --forest: #10270d;
  --forest-light: #24441e;
  --cream: #f3f2ed;
  --row-alt: #dedfdc;
  --charcoal: #2e302f;
  --gold: #d7aa52;
  --green: #77cb89;
  --yellow: #f1c75b;
  --red: #ee7770;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #e6e9e7; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: 18px;
  color: white;
  background: #e6e9e7;
}

button, input, select { font: inherit; }

.report-shell {
  position: relative;
  width: min(1780px, 100%);
  min-height: calc(100vh - 36px);
  margin: 0 auto;
  padding: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(4, 11, 5, 0.7), rgba(4, 10, 6, 0.18) 65%, rgba(4, 9, 5, 0.25)), url("/assets/mine-tunnel-background.png") center / cover fixed;
  box-shadow: 0 8px 30px rgba(21, 33, 26, 0.24);
}

.report-shell::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  background: linear-gradient(180deg, rgba(5, 15, 6, 0.1), rgba(2, 7, 3, 0.34));
  pointer-events: none;
}

.report-header, .toolbar, .report-grid, footer { position: relative; z-index: 1; }

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 100px;
  padding: 18px 26px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 5px;
  background: linear-gradient(90deg, rgba(11, 43, 7, 0.94), rgba(8, 31, 6, 0.83) 78%, rgba(7, 24, 5, 0.7));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08), 0 10px 28px rgba(0, 0, 0, 0.24);
}

.header-brand { display: flex; align-items: center; gap: 17px; }

.mine-symbol {
  display: grid;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.18);
}

.mine-symbol svg { width: 37px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }

.header-kicker {
  display: block;
  margin-bottom: 3px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(1.85rem, 3.2vw, 3.4rem); line-height: 1.03; letter-spacing: -0.035em; }

.connection-pill, .source-state { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 750; }

.connection-pill { flex: 0 0 auto; padding: 9px 13px; border: 1px solid rgba(255, 255, 255, 0.28); background: rgba(0, 0, 0, 0.22); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 4px rgba(241, 199, 91, 0.13); }
.connection-pill[data-state="online"] .status-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(119, 203, 137, 0.13), 0 0 12px rgba(119, 203, 137, 0.68); }
.connection-pill[data-state="offline"] .status-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(238, 119, 112, 0.13); }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 9px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 4px;
  background: rgba(20, 27, 22, 0.88);
  backdrop-filter: blur(10px);
}

.mine-tabs { display: flex; gap: 5px; }

.mine-tab {
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.67);
  background: transparent;
  cursor: pointer;
  font-size: 0.73rem;
  font-weight: 750;
  transition: 150ms ease;
}

.mine-tab:hover { color: white; background: rgba(255, 255, 255, 0.08); }
.mine-tab[aria-selected="true"] { border-color: rgba(255, 255, 255, 0.24); color: white; background: var(--forest-light); box-shadow: inset 3px 0 var(--gold); }

.toolbar-right { display: flex; align-items: center; gap: 8px; }

.search-field, .select-field {
  display: flex;
  align-items: center;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.58);
  background: rgba(0, 0, 0, 0.25);
}

.search-field:focus-within, .select-field:focus-within { border-color: rgba(215, 170, 82, 0.72); }
.search-field { width: min(280px, 24vw); padding: 0 10px; }
.search-field svg { width: 16px; margin-right: 8px; fill: none; stroke: currentColor; stroke-width: 1.8; }
input, select { width: 100%; border: 0; outline: 0; color: white; background: transparent; font-size: 0.74rem; }
input::placeholder { color: rgba(255, 255, 255, 0.45); }
.select-field { width: 190px; padding: 0 9px; }
select option { color: white; background: #202722; }
.result-count { min-width: 78px; color: rgba(255, 255, 255, 0.66); font-size: 0.7rem; text-align: right; }

.report-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; margin-top: 9px; }

.simple-grid .table-shell { height: calc(100vh - 190px); }

.table-panel {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 4px;
  background: rgba(9, 13, 10, 0.62);
  backdrop-filter: blur(5px);
}

.table-shell {
  position: relative;
  height: calc(100vh - 250px);
  min-height: 460px;
  overflow: auto;
  border: 1px solid rgba(0, 0, 0, 0.9);
  background: var(--cream);
  scrollbar-color: #7d827e #d8d9d6;
  scrollbar-width: thin;
}

table { width: 100%; border-collapse: separate; border-spacing: 0; white-space: nowrap; }
th, td { padding: 6px 10px; border-right: 2px solid #191b1a; border-bottom: 2px solid #191b1a; text-align: left; }
th:last-child, td:last-child { border-right: 0; }

th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 58px;
  color: #f5f5f3;
  background: var(--charcoal);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  text-align: center;
  text-transform: uppercase;
}

td { height: 30px; padding-top: 4px; padding-bottom: 4px; color: #181a19; background: #f1f1ef; font-size: 0.72rem; font-weight: 620; }
tbody tr:nth-child(odd) td { background: var(--row-alt); }
tbody tr:hover td { background: #fff1c9; }
td:first-child { font-weight: 790; text-align: center; }
.company-cell { font-weight: 700; }
.date-cell { font-variant-numeric: tabular-nums; }
.mine-badge { display: inline-flex; padding: 3px 6px; border-radius: 3px; color: #fff; background: #35562f; font-size: 0.63rem; font-weight: 800; }
.duration-cell { color: #173b13; font-variant-numeric: tabular-nums; font-weight: 850; }

.empty-state { position: absolute; inset: 58px 0 0; display: grid; place-content: center; color: #414642; text-align: center; }
.empty-state[hidden] { display: none; }
.empty-state > span { color: #43663d; font-size: 2.6rem; }
.empty-state strong { margin-top: 5px; }
.empty-state p { margin: 5px 0 0; color: #777e78; font-size: 0.75rem; }

.summary-panel { display: flex; flex-direction: column; justify-content: center; gap: 15px; min-width: 0; padding: 10px 0; }

.summary-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  background: rgba(8, 30, 6, 0.82);
  box-shadow: 0 7px 22px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(7px);
}

.query-card { display: flex; flex-direction: column; align-items: center; padding: 19px 15px 16px; text-align: center; }
.summary-label { font-size: 1.05rem; font-weight: 750; }
.query-card > strong { margin-top: 9px; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.query-age { margin-top: 4px; color: rgba(255, 255, 255, 0.66); font-size: 0.7rem; }
.source-state { margin-top: 12px; padding: 5px 9px; color: var(--green); background: rgba(119, 203, 137, 0.12); }
.source-state[data-state="delayed"] { color: var(--yellow); background: rgba(241, 199, 91, 0.13); }
.source-state[data-state="offline"] { color: var(--red); background: rgba(238, 119, 112, 0.13); }

.important-time { padding: 27px 14px 23px; }
.important-time .summary-label { font-size: 1.25rem; }
.important-time > strong { margin-top: 13px; font-size: 1.82rem; line-height: 1; letter-spacing: -0.035em; white-space: nowrap; }
.important-time .query-age { margin-top: 9px; }

.count-card { text-align: center; }
.count-heading { padding: 12px; background: rgba(19, 64, 13, 0.84); font-size: 1.45rem; line-height: 1.02; }
.count-heading span, .count-heading strong { display: block; }
.count-heading strong { margin-top: 3px; font-weight: 780; }
.total-number { padding: 22px 12px 10px; color: white; font-size: 4.7rem; font-weight: 600; line-height: 1; letter-spacing: -0.06em; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.34); }
.count-caption { display: block; padding: 0 12px 17px; color: rgba(255, 255, 255, 0.6); font-size: 0.69rem; letter-spacing: 0.08em; text-transform: uppercase; }

.mines-card { padding: 3px 15px; background: rgba(15, 23, 17, 0.88); }
.mine-summary-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 65px; border-bottom: 1px solid rgba(255, 255, 255, 0.13); }
.mine-summary-row:last-child { border-bottom: 0; }
.mine-summary-row span, .mine-summary-row strong { display: block; }
.mine-summary-row span { margin-bottom: 3px; color: var(--gold); font-size: 0.58rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.mine-summary-row strong { overflow: hidden; font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.mine-summary-row b { min-width: 45px; color: white; font-size: 1.8rem; text-align: right; }

.simple-mines .mine-summary-row strong { font-size: 0.98rem; }
.simple-mines[hidden] { display: none; }
body[data-single-mine="true"] .mine-column { display: none; }

.safety-note { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 4px; color: rgba(255, 255, 255, 0.7); background: rgba(0, 0, 0, 0.32); font-size: 0.65rem; line-height: 1.35; }
.safety-note svg { flex: 0 0 auto; width: 23px; fill: none; stroke: var(--green); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

footer { display: flex; justify-content: space-between; padding: 10px 5px 0; color: rgba(255, 255, 255, 0.63); font-size: 0.64rem; letter-spacing: 0.04em; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1100px) {
  .report-grid { grid-template-columns: minmax(0, 1fr) 260px; }
  .important-time > strong { font-size: 1.3rem; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-right { width: 100%; }
  .search-field { width: 100%; }
}

@media (max-width: 780px) {
  body { padding: 0; background: #081108; }
  .report-shell { min-height: 100vh; padding: 9px; border: 0; border-radius: 0; }
  .report-header { min-height: 86px; padding: 14px; }
  .mine-symbol { width: 44px; height: 44px; }
  .header-kicker { display: none; }
  h1 { font-size: 1.35rem; }
  .connection-pill { display: none; }
  .mine-tabs { width: 100%; overflow-x: auto; }
  .mine-tab { flex: 1 0 auto; }
  .toolbar-right { align-items: stretch; flex-wrap: wrap; }
  .search-field, .select-field { flex: 1 1 200px; width: auto; }
  .result-count { align-self: center; }
  .report-grid { grid-template-columns: 1fr; }
  .summary-panel { display: grid; grid-template-columns: 1fr 1fr; order: -1; padding: 0; }
  .mines-card, .safety-note { display: none; }
  .simple-grid .table-shell { height: 58vh; min-height: 420px; }
  .total-number { font-size: 3.6rem; }
}

@media (max-width: 520px) {
  .mine-symbol { display: none; }
  .summary-panel { width: calc(100vw - 18px); max-width: 100%; grid-template-columns: 1fr; overflow: hidden; }
  .query-card { padding: 18px 10px; }
  .important-time > strong { font-size: 1.55rem; }
  .count-card { position: relative; display: block; min-height: 70px; }
  .count-heading { display: grid; min-height: 70px; padding-right: 100px; place-content: center; font-size: 1rem; }
  .total-number { position: absolute; top: 0; right: 0; bottom: 0; display: grid; width: 92px; padding: 0; place-content: center; font-size: 3rem; }
  .count-caption { display: none; }
  footer { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
