/* Staff Schedule Generator — self-contained tool styles */

:root {
  color-scheme: light;
  --bg: #eef1f6;
  --surface: #ffffff;
  --text: #141824;
  --muted: #5b6478;
  --border: #d9dee8;
  --shadow: 0 8px 24px rgba(20, 24, 36, 0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --accent: #1f4fa3;
  --accent-soft: #e8eef9;
  --warn-bg: #fff8e6;
  --warn-border: #e8c96a;
  --danger: #b42318;
  --danger-soft: #fde8e8;
  --focus: #2563eb;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", Arial, sans-serif;
  --max: 1180px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  z-index: 1000;
  outline: 2px solid var(--focus);
}

.wrap {
  width: min(100% - 24px, var(--max));
  margin-inline: auto;
}

.site-header {
  padding: 24px 0 8px;
}

.site-header h1 {
  margin: 0 0 10px;
  font-size: clamp(1.55rem, 4vw, 2rem);
  letter-spacing: -0.02em;
}

.lead {
  margin: 0;
  max-width: 70ch;
  color: var(--muted);
  font-size: 1.02rem;
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px 0 40px;
}

@media (min-width: 1024px) {
  .layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
  }

  .layout-primary {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .layout-side {
    width: 340px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 12px;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  box-shadow: var(--shadow);
}

.card-title {
  margin: 0 0 12px;
  font-size: 1.12rem;
  font-weight: 700;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.card-head .card-title {
  margin: 0;
}

.card-warnings {
  border-color: var(--warn-border);
  background: var(--warn-bg);
}

.field {
  margin-bottom: 14px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 6px;
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
  color: var(--text);
}

.input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
  background: #fff;
}

.input-select {
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% - 3px), calc(100% - 14px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.textarea {
  min-height: 72px;
  resize: vertical;
}

.hint {
  margin: 0 0 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

.btn {
  min-height: 48px;
  padding: 0 16px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}

.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #c9d6f2;
}

.btn-secondary:hover {
  filter: brightness(0.98);
}

.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: #f1c0bc;
}

.btn-danger:hover {
  background: var(--danger-soft);
}

.btn-compact {
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.88rem;
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-status {
  margin: 10px 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.staff-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.staff-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: #fafbff;
}

.staff-row-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

@media (min-width: 560px) {
  .staff-row-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.staff-row-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.day-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.day-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: #fafbff;
}

.day-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.day-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.shift-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shift-row {
  border: 1px solid #e2e6ef;
  border-radius: var(--radius-sm);
  padding: 10px;
  background: #fff;
}

.shift-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .shift-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr) repeat(2, minmax(0, 0.75fr)) minmax(0, 0.7fr) minmax(0, 0.55fr) auto auto;
    align-items: end;
  }
}

.shift-cell label,
.shift-cell .cell-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}

.shift-hours {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 4px;
}

.shift-row-invalid {
  border-color: #f0a8a8;
  background: #fffafa;
}

.btn-icon {
  min-height: 48px;
  min-width: 48px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-icon:hover {
  background: var(--danger-soft);
  border-color: #e8a4a4;
}

.totals-block {
  font-size: 0.92rem;
}

.totals-empty {
  margin: 0;
  color: var(--muted);
}

.totals-table {
  width: 100%;
  border-collapse: collapse;
}

.totals-table th,
.totals-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}

.totals-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.warnings-list ul {
  margin: 0;
  padding-left: 1.2rem;
}

.warnings-list li {
  margin-bottom: 6px;
}

.warnings-ok {
  margin: 0;
  color: var(--muted);
}

.prose {
  padding-bottom: 48px;
}

.prose .card {
  margin-bottom: 20px;
}

.prose h2 {
  margin-top: 0;
}

.faq-dl dt {
  font-weight: 700;
  margin-top: 12px;
}

.faq-dl dt:first-child {
  margin-top: 0;
}

.faq-dl dd {
  margin: 4px 0 0;
  color: var(--muted);
}

.site-footer {
  padding: 20px 0 36px;
  border-top: 1px solid var(--border);
  background: #e7ebf3;
}

.footer-note {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

/* Print */
.print-area {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

@media print {
  body * {
    visibility: hidden;
  }

  .print-area,
  .print-area * {
    visibility: visible;
  }

  .print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    overflow: visible;
    opacity: 1;
    pointer-events: auto;
    background: #fff;
    color: #000;
    padding: 12mm;
  }

  .print-inner {
    font-size: 10pt;
  }

  .print-inner h1 {
    font-size: 16pt;
    margin: 0 0 8pt;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10pt;
  }

  .print-table th,
  .print-table td {
    border: 1px solid #ccc;
    padding: 4pt 6pt;
    text-align: left;
  }
}

/* Export fallback */
.export-fallback {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 24, 36, 0.45);
}

.export-fallback[hidden] {
  display: none !important;
}

.export-fallback-panel {
  width: min(100%, 520px);
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.export-fallback-title {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.export-fallback-hint {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.export-fallback-textarea {
  width: 100%;
  min-height: 200px;
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
