:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #10132f;
  --muted: #5e6673;
  --line: #dfe4e8;
  --ruter: #e60000;
  --green: #087f5b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(16, 19, 47, 0.08);
}

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

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

.topline #refresh {
  margin-left: auto;
}

.back {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.5rem;
  line-height: 1;
  background: white;
}

.back:hover,
.back:focus {
  border-color: var(--ruter);
  outline: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  margin: 0;
  color: var(--ruter);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  line-height: 1;
}

.eyebrow img {
  display: block;
  width: auto;
  max-width: 24px;
  height: 18px;
  max-height: 18px;
  object-fit: contain;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.05;
}

button,
select,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--ruter);
  color: white;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 700;
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 18px 0 26px;
  color: var(--muted);
}

.meta a {
  color: var(--ink);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.mode-switch {
  grid-column: 1 / -1;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  justify-self: start;
  gap: 4px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8fa;
}

.mode-switch label {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 6px;
  padding: 0 18px;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
}

.mode-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.mode-switch span {
  position: relative;
  z-index: 1;
  font-weight: 700;
  transition: color 140ms ease;
}

.mode-switch label:has(input:checked) {
  background: var(--ruter);
  box-shadow: 0 6px 14px rgba(230, 0, 0, 0.2);
}

.mode-switch label:has(input:checked) span {
  color: white;
}

.mode-switch label:has(input:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

@supports not selector(:has(*)) {
  .mode-switch input:checked + span {
    color: var(--ruter);
  }
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
}

select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--ink);
  background: white;
}

.advanced {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.advanced-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.advanced-controls button {
  min-height: 43px;
}

.calendar-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 12px;
  color: var(--muted);
}

.calendar-head strong {
  color: var(--ink);
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(80px, 1fr));
  gap: 8px;
}

.day {
  min-height: 106px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  background: white;
}

.day span,
.day strong {
  display: block;
}

.day strong {
  margin: 2px 0 10px;
  color: var(--ink);
  font-size: 1.2rem;
}

.day input {
  min-height: 36px;
  padding: 8px;
}

.offday {
  background: #f7f8fa;
}

.holiday {
  border-color: #f2a6a6;
  background: #fff5f5;
}

.result {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.result div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.result span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
}

.result strong {
  display: block;
  font-size: 1.4rem;
}

.details {
  min-height: 1.5em;
  margin: 20px 0 0;
  color: var(--muted);
}

.win {
  color: var(--green);
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 980px);
    padding: 20px 0;
  }

  .panel {
    padding: 20px;
  }

  .grid,
  .result,
  .advanced-controls {
    grid-template-columns: 1fr;
  }

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