:root {
  color-scheme: dark;
  --background: #14161c;
  --surface: #1c1f27;
  --border: #2a2e38;
  --text: #e7e9ee;
  --text-muted: #9aa4b2;
  --orange: #ff7a18;
  --green: #37c889;
  --red: #e5484d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 320px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.login-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  margin-bottom: 4px;
}

.login-card h1 {
  margin: 0;
  font-size: 19px;
}

.login-subtitle {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.login-card label {
  align-self: flex-start;
  font-size: 12px;
  color: var(--text-muted);
}

.login-card input {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--text);
}

.login-card button,
.filters button {
  margin-top: 8px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--orange);
  color: #1a1200;
  font-weight: 600;
  cursor: pointer;
}

.login-card button {
  width: 100%;
}

.login-error {
  min-height: 16px;
  color: var(--red);
  font-size: 11.5px;
  margin: 4px 0 0;
}

.dashboard-view {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

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

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.dashboard-header h1 {
  font-size: 19px;
  margin: 0;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.link-button {
  background: none;
  border: none;
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 12.5px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  margin: 0 0 22px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.filters input,
.filters select {
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--text);
  font-family: inherit;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tile-label {
  font-size: 11.5px;
  color: var(--text-muted);
}

.tile-value {
  font-size: 26px;
  font-weight: 700;
}

.tile-value-success {
  color: var(--green);
}

.tile-value-danger {
  color: var(--red);
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.chart-card h3 {
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 600;
}

.chart-card canvas {
  width: 100%;
  height: 160px;
  display: block;
}

.csv-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--text-muted);
  text-decoration: underline;
}

.recent-failures-card {
  margin-bottom: 24px;
}

.recent-failures-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.recent-failures-header h3 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
}

.recent-failures-header .csv-link {
  margin-top: 0;
}

.table-scroll {
  overflow-x: auto;
}

.recent-failures-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  white-space: nowrap;
}

.recent-failures-table th,
.recent-failures-table td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.recent-failures-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.recent-failures-table td.error-category {
  color: var(--red);
  font-weight: 600;
}

.recent-failures-table .empty-row {
  color: var(--text-muted);
  text-align: center;
  white-space: normal;
}

.dashboard-footnote {
  margin-top: 24px;
  font-size: 10.5px;
  color: var(--text-muted);
}
