:root {
  --bg: #151023;
  --panel: rgba(28, 24, 42, 0.94);
  --ink: #f5f5f7;
  --muted: #b8bac4;
  --line: rgba(245, 245, 247, 0.14);
  --navy: #23165f;
  --navy-strong: #170f40;
  --red: #d3184a;
  --gold: #f1bd3d;
  --plum: #642174;
  --magenta: #a3195f;
  --charcoal: #3d434d;
  --surface: rgba(39, 35, 53, 0.92);
  --surface-soft: rgba(255, 255, 255, 0.06);
  --purple-soft: rgba(100, 33, 116, 0.34);
  --grey-soft: rgba(255, 255, 255, 0.08);
  --gold-soft: rgba(241, 189, 61, 0.16);
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.38);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-sm: 999px;
  --heading-font: "Georgia", "Times New Roman", serif;
  --body-font: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  color-scheme: dark;
}

body {
  font-family: var(--body-font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(35, 22, 95, 0.78), transparent 34%),
    radial-gradient(circle at top right, rgba(211, 24, 74, 0.28), transparent 28%),
    radial-gradient(circle at 55% 0%, rgba(241, 189, 61, 0.13), transparent 28%),
    linear-gradient(180deg, #11101b 0%, var(--bg) 48%, #24212e 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  z-index: -1;
  border-radius: 999px;
  filter: blur(10px);
  opacity: 0.6;
}

body::before {
  width: 320px;
  height: 320px;
  right: -80px;
  top: 80px;
  background: rgba(211, 24, 74, 0.26);
}

body::after {
  width: 260px;
  height: 260px;
  left: -60px;
  bottom: 80px;
  background: rgba(100, 33, 116, 0.34);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 18px auto 40px;
}

.layout {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  grid-template-areas:
    "controls"
    "results";
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.subtle-label,
.stat-label,
.field span,
.label-row span {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.subtle-label,
.stat-label {
  color: var(--muted);
}

.section-heading > *,
.results-heading > * {
  min-width: 0;
}

.rate-card h3,
.section-heading h2,
.empty-state h3 {
  margin: 0;
  font-family: var(--heading-font);
  line-height: 0.96;
}

.section-copy,
.empty-state p {
  color: var(--muted);
  line-height: 1.5;
}

.controls-panel,
.results-panel {
  padding: 24px;
}

.controls-panel {
  grid-area: controls;
  display: grid;
  gap: 14px;
  align-self: start;
}

.controls-panel.is-collapsed {
  padding-block: 18px;
}

.controls-panel.is-collapsed > :not(.section-heading) {
  display: none;
}

.exclude-list::-webkit-scrollbar {
  width: 10px;
}

.exclude-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
}

.exclude-list::-webkit-scrollbar-thumb {
  background: rgba(241, 189, 61, 0.34);
  border-radius: var(--radius-sm);
  border: 2px solid rgba(28, 24, 42, 0.9);
}

.exclude-list::-webkit-scrollbar-thumb:hover {
  background: rgba(211, 24, 74, 0.58);
}

.results-panel {
  grid-area: results;
  display: grid;
  gap: 18px;
  min-height: 420px;
}

.controls-panel > .section-heading {
  grid-column: 1 / -1;
}

.filter-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  align-items: start;
}

.exclude-filter {
  grid-column: 1 / -1;
}

.filters-active-wrap {
  grid-column: 1 / -1;
  align-self: center;
}

.section-heading,
.label-row,
.results-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h2 {
  font-size: 1.6rem;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 10px;
}

.section-copy {
  margin: 6px 0 0;
  font-size: 0.94rem;
}

.field,
.inline-field {
  display: grid;
  gap: 8px;
  align-content: start;
}

.field-row,
.input-strip {
  display: grid;
  gap: 10px;
  align-content: start;
}

.input-strip {
  grid-template-columns: minmax(190px, 1.15fr) repeat(3, minmax(150px, 1fr));
}

.filter-grid > .field,
.filter-grid > .field-row,
.filter-grid > .input-strip,
.filter-grid > .days-block,
.filter-grid > .exclude-panel {
  align-self: start;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: rgba(12, 10, 20, 0.68);
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input::placeholder {
  color: #9fa1ad;
  opacity: 1;
}

option {
  background: #151023;
  color: var(--ink);
}

input:focus,
select:focus,
button:focus-visible {
  outline: none;
  border-color: rgba(211, 24, 74, 0.46);
  box-shadow: 0 0 0 4px rgba(211, 24, 74, 0.15);
}

.secondary-button,
.mode-button,
.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.secondary-button,
.mode-button {
  padding: 10px 13px;
  border-radius: 12px;
  cursor: pointer;
}

.secondary-button:hover,
.mode-button:hover,
.chip:hover {
  transform: translateY(-1px);
}

.secondary-button {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.compact-button {
  width: 100%;
  padding-block: 10px;
}

.days-block {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.035);
}

.days-block .label-row {
  align-items: center;
}

.mode-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(62, 67, 77, 0.09), rgba(100, 33, 116, 0.08));
  gap: 4px;
}

.mode-button {
  border: 0;
  background: transparent;
  padding-inline: 14px;
  border-radius: 11px;
}

.mode-button.is-active {
  background: var(--red);
  color: #fff;
}

.chip-grid,
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.days-block .chip-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(78px, 1fr));
}

.chip,
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
}

.chip {
  justify-content: center;
  padding: 8px 12px;
  cursor: pointer;
}

.chip-count {
  color: var(--muted);
  font-size: 0.88rem;
}

.chip.is-selected {
  background: var(--navy);
  color: #fff;
  border-color: transparent;
}

.chip.is-selected .chip-count {
  color: rgba(255, 255, 255, 0.72);
}

.exclude-panel {
  border: 1px solid rgba(100, 33, 116, 0.15);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.055);
  overflow: hidden;
  align-self: start;
}

.exclude-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
}

.exclude-panel summary span {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.exclude-panel summary strong {
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  color: #ffe4a1;
  font-size: 0.78rem;
  white-space: nowrap;
}

.exclude-controls {
  display: grid;
  gap: 10px;
  padding: 0 14px 12px;
}

.exclude-list {
  max-height: 220px;
  overflow: auto;
  border-top: 1px solid rgba(100, 33, 116, 0.1);
}

.exclude-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 14px;
  border-top: 1px solid rgba(100, 33, 116, 0.07);
  cursor: pointer;
}

.exclude-option:first-child {
  border-top: 0;
}

.exclude-option:hover {
  background: rgba(211, 24, 74, 0.07);
}

.exclude-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
}

.exclude-option span {
  display: grid;
  gap: 3px;
}

.exclude-option small,
.exclude-empty {
  color: var(--muted);
}

.exclude-empty {
  margin: 0;
  padding: 14px 18px 18px;
}

.filter-pill {
  padding: 5px 9px;
  font-size: 0.92rem;
  background: linear-gradient(135deg, var(--purple-soft), var(--gold-soft));
  color: #fff2c9;
}

.active-filter-wrap {
  display: grid;
  gap: 10px;
}

.filter-pill.is-empty {
  background: var(--grey-soft);
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(100, 33, 116, 0.1);
  background: rgba(11, 10, 18, 0.66);
}

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

thead th {
  text-align: left;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(35, 22, 95, 0.98), rgba(100, 33, 116, 0.98) 55%, rgba(163, 25, 95, 0.96));
  color: #ffffff;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody td {
  padding: 16px 18px;
  border-top: 1px solid rgba(100, 33, 116, 0.08);
}

tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.055);
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.025);
}

tbody tr:hover {
  background: rgba(241, 189, 61, 0.18);
}

.run-cell {
  font-weight: 700;
}

.run-link {
  color: #ffffff;
  font-weight: 800;
  text-decoration-color: rgba(211, 24, 74, 0.55);
  text-underline-offset: 4px;
}

.run-link:hover {
  color: #ff6d93;
}

.pay-cell {
  white-space: nowrap;
}

.money-cell {
  white-space: nowrap;
  font-weight: 700;
  color: #ffd56f;
}

.money-placeholder {
  color: var(--muted);
  font-weight: 500;
}

.empty-state {
  padding: 32px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035));
  border: 1px dashed rgba(100, 33, 116, 0.22);
  text-align: center;
}

.detail-shell {
  width: min(980px, 100%);
  margin: 0 auto;
}

.detail-panel {
  padding: 28px;
}

.detail-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
}

.detail-header h1 {
  margin: 12px 0 0;
  font-family: var(--heading-font);
  font-size: 2.4rem;
  line-height: 1;
}

.back-link {
  color: #ff6d93;
  font-weight: 800;
  text-decoration-color: rgba(211, 24, 74, 0.4);
  text-underline-offset: 4px;
}

.detail-summary {
  min-width: 220px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(241, 189, 61, 0.14), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(241, 189, 61, 0.3);
  display: grid;
  gap: 8px;
}

.detail-summary span {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-summary strong {
  font-size: 2rem;
}

.detail-summary small {
  color: var(--muted);
}

.detail-meta {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-meta span {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--purple-soft), var(--gold-soft));
  color: #fff2c9;
  font-weight: 700;
}

.detail-table-wrap {
  margin-top: 22px;
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(100, 33, 116, 0.1);
}

.detail-table {
  min-width: 720px;
}

.detail-table .is-off-day {
  color: var(--muted);
}

.detail-day-cell {
  font-weight: 800;
}

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

  .days-block .chip-grid {
    grid-template-columns: repeat(4, minmax(78px, 1fr));
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: calc(100% - 20px);
    margin-top: 16px;
  }

  .controls-panel,
  .results-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .field-row,
  .input-strip {
    grid-template-columns: 1fr;
  }

  .days-block .chip-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-heading,
  .results-heading,
  .label-row {
    display: grid;
  }

  table {
    min-width: 480px;
  }

  .detail-header {
    display: grid;
  }

  .detail-summary {
    min-width: 0;
  }
}
