:root {
  color-scheme: light;

  --bg: #ffffff;
  --surface: #f6f7f9;
  --border: #e3e6ea;
  --text: #111827;
  --muted: #4b5563;
  --link: #1d4ed8;

  --button-bg: #111827;
  --button-text: #ffffff;
  --button-bg-hover: #0b1220;

  --row-hover: rgba(17, 24, 39, 0.06);

  --badge-fixed-bg: rgba(22, 163, 74, 0.14);
  --badge-fixed-text: #166534;
  --badge-optional-bg: rgba(245, 158, 11, 0.16);
  --badge-optional-text: #92400e;

  --row-accent-fixed: rgba(22, 163, 74, 0.70);
  --row-accent-optional: rgba(245, 158, 11, 0.80);

  --row-bg-fixed-weekend: rgba(245, 158, 11, 0.14);
  --row-bg-fixed-weekend-hover: rgba(245, 158, 11, 0.18);

  --metric-total-bg: rgba(17, 24, 39, 0.03);
  --metric-total-accent: rgba(17, 24, 39, 0.40);
  --metric-fixed-bg: rgba(22, 163, 74, 0.08);
  --metric-fixed-accent: rgba(22, 163, 74, 0.75);
  --metric-optional-bg: rgba(245, 158, 11, 0.10);
  --metric-optional-accent: rgba(245, 158, 11, 0.85);
  --metric-weekend-bg: rgba(147, 197, 253, 0.08);
  --metric-weekend-accent: rgba(147, 197, 253, 0.70);
}

html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0b0f17;
  --surface: #111827;
  --border: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --link: #93c5fd;

  --button-bg: #e5e7eb;
  --button-text: #111827;
  --button-bg-hover: #ffffff;

  --row-hover: rgba(229, 231, 235, 0.08);

  --badge-fixed-bg: rgba(34, 197, 94, 0.16);
  --badge-fixed-text: #bbf7d0;
  --badge-optional-bg: rgba(245, 158, 11, 0.18);
  --badge-optional-text: #fde68a;

  --row-accent-fixed: rgba(34, 197, 94, 0.75);
  --row-accent-optional: rgba(245, 158, 11, 0.85);

  --row-bg-fixed-weekend: rgba(245, 158, 11, 0.16);
  --row-bg-fixed-weekend-hover: rgba(245, 158, 11, 0.22);

  --metric-total-bg: rgba(229, 231, 235, 0.06);
  --metric-total-accent: rgba(229, 231, 235, 0.40);
  --metric-fixed-bg: rgba(34, 197, 94, 0.12);
  --metric-fixed-accent: rgba(34, 197, 94, 0.80);
  --metric-optional-bg: rgba(245, 158, 11, 0.12);
  --metric-optional-accent: rgba(245, 158, 11, 0.85);
  --metric-weekend-bg: rgba(147, 197, 253, 0.10);
  --metric-weekend-accent: rgba(147, 197, 253, 0.75);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.button {
  appearance: none;
  border: 1px solid transparent;
  background: var(--button-bg);
  color: var(--button-text);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.button:hover {
  background: var(--button-bg-hover);
}

.button--secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.button--secondary:hover {
  background: var(--row-hover);
  color: var(--text);
  border-color: var(--border);
}

.main {
  padding: 24px;
}

.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.card__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.meta {
  font-size: 12px;
  color: var(--muted);
}

.status {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.metrics[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .metrics {
    grid-template-columns: 1fr;
  }
}

.metricCard {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.metricCard--total {
  background: var(--metric-total-bg);
  box-shadow: inset 4px 0 0 0 var(--metric-total-accent);
}

.metricCard--fixed {
  background: var(--metric-fixed-bg);
  box-shadow: inset 4px 0 0 0 var(--metric-fixed-accent);
}

.metricCard--optional {
  background: var(--metric-optional-bg);
  box-shadow: inset 4px 0 0 0 var(--metric-optional-accent);
}

.metricCard--weekend {
  background: var(--metric-weekend-bg);
  box-shadow: inset 4px 0 0 0 var(--metric-weekend-accent);
}

.metricCard--fixedWeekend {
  background: var(--metric-fixed-bg);
  box-shadow: inset 4px 0 0 0 var(--metric-fixed-accent);
}

.metricCard--optionalWeekend {
  background: var(--metric-optional-bg);
  box-shadow: inset 4px 0 0 0 var(--metric-optional-accent);
}

.metricLabel {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.metricDesc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.metricValue {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.select {
  min-width: 220px;
  border-radius: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.input {
  min-width: 220px;
  border-radius: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

@media (max-width: 700px) {
  .header {
    flex-direction: column;
    align-items: stretch;
  }

  .header__right {
    display: flex;
  }

  .header__right .button {
    width: 100%;
  }

  .main {
    padding: 16px;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter {
    width: 100%;
  }

  .select,
  .input {
    min-width: 0;
    width: 100%;
  }

  .filters .button {
    width: 100%;
  }

  /* Table -> stacked rows on mobile */
  .tableWrap {
    overflow: visible;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table thead {
    display: none;
  }

  .table tbody tr {
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
  }

  .table tbody td {
    border-bottom: none;
    padding: 8px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }

  .table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 700;
    flex: 0 0 92px;
  }

  .col-date,
  .col-type,
  .col-day,
  .col-regions {
    width: auto;
    min-width: 0;
    white-space: normal;
  }

  .emptyCell {
    padding: 16px 0;
  }
}

.select:focus {
  outline: 2px solid transparent;
}

.tableWrap {
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
}

.table tbody td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  vertical-align: top;
}

.table tbody tr:hover {
  background: var(--row-hover);
}

.table tbody tr.row--fixedWeekend {
  background: var(--row-bg-fixed-weekend);
}

.table tbody tr.row--fixedWeekend:hover {
  background: var(--row-bg-fixed-weekend-hover);
}

.emptyRow:hover {
  background: transparent;
}

.emptyCell {
  padding: 22px 12px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}

.row--fixed td:first-child {
  box-shadow: inset 3px 0 0 0 var(--row-accent-fixed);
}

.row--fixedWeekend td:first-child {
  box-shadow: inset 3px 0 0 0 var(--row-accent-fixed);
}

.row--optional td:first-child {
  box-shadow: inset 3px 0 0 0 var(--row-accent-optional);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.badge--fixed {
  background: var(--badge-fixed-bg);
  color: var(--badge-fixed-text);
}

.badge--optional {
  background: var(--badge-optional-bg);
  color: var(--badge-optional-text);
}

.col-date {
  width: 120px;
  white-space: nowrap;
}

.col-type {
  width: 90px;
  white-space: nowrap;
}

.col-day {
  width: 140px;
  white-space: nowrap;
}

.col-regions {
  min-width: 240px;
}

.muted {
  color: var(--muted);
}
