:root {
  --ink: #1a1b1f;
  --muted: #5a5f6a;
  --paper: #f7f2ea;
  --sand: #f0e6d7;
  --sun: #f4b469;
  --clay: #d97b4e;
  --sea: #2f6f6f;
  --sky: #a8d0c8;
  --white: #ffffff;
  --shadow: 0 20px 40px rgba(26, 27, 31, 0.12);
  --bg-start: #fff4e2;
  --bg-mid: #f5efe7;
  --bg-end: #e5ecea;
  --card-weekday-bg: #fff8ee;
  --card-weekday-border: #ead7c1;
  --card-weekend-bg: #eef6f5;
  --card-weekend-border: rgba(47, 111, 111, 0.25);
  --bg-art: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, var(--bg-start) 0%, var(--bg-mid) 40%, var(--bg-end) 100%);
  position: relative;
  min-height: 100vh;
}

.page {
  position: relative;
  z-index: 1;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--bg-art);
  background-size: cover;
  background-position: center;
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
}

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

@media (min-width: 1500px) {
  .page {
    max-width: 1560px;
    padding-left: 28px;
    padding-right: 28px;
  }
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  align-items: center;
  padding: 32px;
  background: linear-gradient(120deg, #fff8ef, #f9e7d0 55%, #e7f0ef 100%);
  border-radius: 28px;
  box-shadow: var(--shadow);
  animation: rise 0.8s ease-out;
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--sea);
  margin: 0 0 12px;
}

h1 {
  font-family: "Fraunces", "Georgia", serif;
  font-size: clamp(32px, 4vw, 48px);
  margin: 0 0 12px;
}

.subhead {
  font-size: 16px;
  color: var(--muted);
  max-width: 460px;
}

.hero-card {
  background: var(--white);
  border-radius: 20px;
  padding: 20px;
  display: grid;
  gap: 16px;
  border: 1px solid rgba(47, 111, 111, 0.1);
}

.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.stat strong {
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(4, minmax(240px, 1fr));
  }
}

.panel {
  background: var(--white);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  animation: fadeIn 0.6s ease-out;
}

.panel.wide {
  grid-column: 1 / -1;
}

h2 {
  font-family: "Fraunces", "Georgia", serif;
  margin: 0;
  font-size: 24px;
}

.section-title {
  font-family: "Fraunces", "Georgia", serif;
  margin: 12px 0 0;
  font-size: 18px;
}

.hidden {
  display: none;
}

.stack {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

input,
select,
textarea,
button {
  font-family: inherit;
  font-size: 14px;
}

input,
select,
textarea {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #d8d1c4;
  background: #fffaf4;
}

.checks {
  display: grid;
  gap: 8px;
}

.calendar {
  display: grid;
  gap: 8px;
}

.calendar-header,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(32px, 1fr));
  gap: 6px;
  text-align: center;
  font-size: 12px;
}

.calendar-header span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.calendar-day {
  border: 1px solid #e3d5c2;
  background: #fffdf9;
  padding: 8px 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
}

.calendar-day.empty {
  border: none;
  background: transparent;
  cursor: default;
}

.calendar-day.selected {
  background: #fde6c9;
  border-color: #e9b98a;
}

.calendar-day.blocked {
  background: #dfecea;
  border-color: rgba(47, 111, 111, 0.35);
  cursor: not-allowed;
  color: var(--muted);
}

.rule-employee-list {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: #fffaf4;
  border: 1px solid #e2d2bf;
}

.rule-employee-list .check {
  margin: 0;
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}

.primary {
  background: linear-gradient(135deg, var(--clay), var(--sun));
  border: none;
  padding: 10px 16px;
  border-radius: 14px;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 20px rgba(217, 123, 78, 0.2);
}

.primary:hover {
  filter: brightness(1.02);
}

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

.list-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  background: var(--paper);
  border: 1px solid #e5dacb;
}

.list-item .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: #fff3e3;
  border: 1px solid #e9c7a4;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.danger {
  background: transparent;
  border: 1px solid #d4b1a7;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.ghost {
  background: transparent;
  border: 1px solid #ccd7d4;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.pill {
  background: #e9f2f1;
  border: 1px solid #c4d7d3;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  color: #2b4b4a;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.actions {
  justify-content: flex-end;
}

.actions .danger {
  border-color: #d4b1a7;
  background: #fff5f2;
}

.actions button {
  min-width: 42px;
}

.month input {
  min-width: 160px;
}

.schedule-calendar {
  display: grid;
  gap: 10px;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
}

.schedule-day {
  background: var(--card-weekday-bg);
  border: 1px solid var(--card-weekday-border);
  border-radius: 16px;
  padding: 10px;
  display: grid;
  gap: 8px;
  position: relative;
}

.schedule-day.weekend {
  border-color: var(--card-weekend-border);
  background: var(--card-weekend-bg);
}

.schedule-day.empty {
  background: transparent;
  border: none;
  padding: 0;
}

.schedule-day select {
  background: #fff;
}

.schedule-date {
  font-weight: 600;
  font-size: 14px;
}

.schedule-date-day {
  display: none;
}

.schedule-shift {
  font-size: 12px;
  color: var(--muted);
}

.schedule-fd {
  display: grid;
  gap: 4px;
  justify-items: end;
  align-self: end;
  justify-self: end;
}

.schedule-fd .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}


.schedule-assignee-text,
.schedule-fd-text {
  display: none;
  font-size: 12px;
  color: var(--ink);
}

.pdf-header {
  display: none;
  font-family: "Fraunces", "Georgia", serif;
  font-size: 24px;
  text-align: center;
  margin-top: 10px;
}

.pdf-footer {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.pdf-footer h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.pdf-list {
  display: grid;
  gap: 6px;
  font-size: 12px;
}

.pdf-other {
  font-size: 12px;
  white-space: pre-wrap;
}

.tooltip {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 100%;
  margin-top: 8px;
  background: #1f2a2a;
  color: #f9f3eb;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 2;
}

.schedule-day:hover .tooltip {
  opacity: 1;
  transform: translateY(0);
}

@keyframes rise {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .hero {
    padding: 24px;
  }

  .schedule-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 520px) {
  .schedule-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: letter landscape;
    margin: 0;
  }

  html,
  body {
    height: auto;
  }

  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body::before {
    opacity: 0.18;
  }

  .hero,
  .schedule-title,
  .panel:not(.wide) {
    display: none;
  }

  .actions,
  form,
  button,
  select {
    display: none !important;
  }

  .schedule-assignee-text,
  .schedule-fd-text {
    display: block;
  }

  .schedule-assignee-text {
    font-size: 28px;
    font-weight: 600;
    text-align: center;
  }

  .pdf-header,
  .pdf-footer {
    display: grid;
    gap: 12px;
  }

  .pdf-list {
    display: block;
    column-count: 2;
    column-gap: 12px;
  }

  .schedule-calendar {
    page-break-inside: avoid;
  }

  .panel.wide {
    padding-top: 0;
    padding-bottom: 0;
    margin-left: auto;
    margin-right: auto;
  }

  .schedule-grid {
    transform: scale(1);
    transform-origin: top left;
  }

  html.print-compact .schedule-grid {
    transform: scale(0.95);
  }

  .pdf-header {
    margin-top: 0;
  }

  .page {
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    break-after: avoid-page;
    page-break-after: avoid;
  }

  .schedule-calendar {
    margin-top: 0;
    break-after: avoid-page;
    page-break-after: avoid;
  }

  .pdf-footer {
    margin-top: 8px;
    break-after: avoid-page;
    page-break-after: avoid;
  }

  html.print-compact .schedule-grid {
    gap: 6px;
  }

  html.print-compact .schedule-day {
    padding: 6px;
  }

  html.print-compact .schedule-assignee-text {
    font-size: 24px;
  }

  html.print-compact .pdf-footer {
    margin-top: 4px;
  }

  html.print-compact .pdf-footer h3 {
    font-size: 14px;
  }

  html.print-compact .pdf-list,
  html.print-compact .pdf-other {
    font-size: 11px;
  }

  html.print-ultra-compact .schedule-grid {
    transform: scale(0.9);
    gap: 4px;
  }

  html.print-ultra-compact .schedule-day {
    padding: 5px;
  }

  html.print-ultra-compact .schedule-assignee-text {
    font-size: 22px;
  }

  html.print-ultra-compact .pdf-footer {
    margin-top: 2px;
  }

  html.print-ultra-compact .pdf-footer h3 {
    font-size: 12px;
  }

  html.print-ultra-compact .pdf-list,
  html.print-ultra-compact .pdf-other {
    font-size: 10px;
  }

  .schedule-day {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .schedule-date-full,
  .schedule-shift {
    display: none;
  }

  .schedule-date-day {
    display: inline;
    font-size: 12px;
  }
}
