:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #182230;
  --muted: #5c6b7a;
  --border: #d9e1ea;
  --primary: #2363eb;
  --primary-dark: #174cc0;
  --success-bg: #9ef0bc;
  --success-text: #075c31;
  --holiday-bg: #ffb894;
  --holiday-text: #8f250a;
  --weekend-bg: #cfd8e6;
  --weekend-text: #243041;
  --shadow: 0 14px 40px rgba(18, 38, 63, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--text);
}

.page {
  min-height: 100vh;
  padding: 22px 20px 48px;
}

.hero,
.calculator-card {
  width: min(100%, 980px);
  margin: 0 auto;
}

.hero {
  margin-bottom: 14px;
}

.hero-copy {
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  line-height: 1.08;
}

.subcopy {
  margin: 8px auto 0;
  max-width: 500px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.calculator-card {
  background: var(--card);
  border: 1px solid rgba(217, 225, 234, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.card-header h2,
.detail-card-header h4 {
  margin: 0 0 8px;
}

.card-header p,
.detail-card-header p {
  margin: 0;
  color: var(--muted);
}

.calculator-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  font-weight: 600;
  font-size: 0.95rem;
}

.field-compact {
  justify-content: flex-end;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus {
  outline: 2px solid rgba(35, 99, 235, 0.15);
  border-color: var(--primary);
}

.toggle-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 500;
  min-height: 44px;
}

.toggle-option input {
  width: 18px;
  height: 18px;
}

.actions {
  display: flex;
  gap: 12px;
}

.primary-btn,
.secondary-btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn {
  background: var(--primary);
  color: white;
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.secondary-btn {
  background: #eef3f8;
  color: var(--text);
}

.result-card,
.detail-card {
  border: 1px solid var(--border);
  background: #fbfdff;
  border-radius: 18px;
  padding: 18px;
}

.result-card {
  margin-top: 18px;
}

.result-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 700;
}

.result-card h3 {
  margin: 0;
  font-size: 1.3rem;
}

.result-summary {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.result-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
}

.result-pill.pill-total {
  background: #dbe8ff;
  color: #1f4aa8;
}

.result-pill.pill-working,
.legend-working .legend-swatch {
  background: var(--success-bg);
  color: var(--success-text);
}

.result-pill.pill-weekend,
.legend-weekend .legend-swatch {
  background: var(--weekend-bg);
  color: var(--weekend-text);
}

.result-pill.pill-holiday,
.legend-holiday .legend-swatch {
  background: var(--holiday-bg);
  color: var(--holiday-text);
}

.detail-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.detail-card {
  min-height: 220px;
}

.detail-card-header {
  margin-bottom: 12px;
}

.holiday-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.month-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: white;
  padding: 12px;
}

.month-card-header {
  margin-bottom: 10px;
}

.month-card-header h5 {
  margin: 0;
  font-size: 0.96rem;
}

.month-weekdays,
.month-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.month-weekdays {
  margin-bottom: 6px;
}

.month-weekdays span {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.calendar-cell {
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.calendar-cell.spacer {
  min-height: 48px;
  border: 0;
  background: transparent;
}

.calendar-cell.weekday {
  background: var(--success-bg);
  border-color: #46cf79;
  color: var(--success-text);
}

.calendar-cell.weekend {
  background: var(--weekend-bg);
  border-color: #94a5bd;
  color: var(--weekend-text);
}

.calendar-cell.holiday {
  background: var(--holiday-bg);
  border-color: #ff7e45;
  color: var(--holiday-text);
}

.calendar-cell.out-of-range {
  background: #f8fafc;
  color: #b1bac5;
  border-style: dashed;
  opacity: 0.75;
}

.calendar-cell.boundary {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: white;
  box-shadow: 0 6px 14px rgba(35, 99, 235, 0.22);
}

.calendar-cell.boundary.weekday,
.calendar-cell.boundary.weekend,
.calendar-cell.boundary.holiday {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: white;
}

.calendar-date {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
}

.empty-state {
  color: var(--muted);
  line-height: 1.6;
}

.holiday-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--holiday-bg);
  border-color: #ff7e45;
}

.holiday-item strong {
  display: block;
  margin-bottom: 4px;
}

.holiday-item span {
  color: var(--muted);
  font-size: 0.92rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  margin-bottom: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
  border: 1px solid transparent;
}

.legend-working .legend-swatch {
  border-color: #46cf79;
}

.legend-weekend .legend-swatch {
  border-color: #94a5bd;
}

.legend-holiday .legend-swatch {
  border-color: #ff7e45;
}

.legend-boundary .legend-swatch {
  background: var(--primary);
  border-color: var(--primary-dark);
}

@media (max-width: 860px) {
  .detail-grid,
  .calendar-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page {
    padding: 18px 14px 36px;
  }

  .calculator-card {
    padding: 18px;
    border-radius: 20px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
  }
}
