:root {
  --page: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #eef3f8;
  --ink: #17202a;
  --muted: #64748b;
  --line: #d8e1ea;
  --line-strong: #b8c7d6;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --secondary: #1d4ed8;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --warning: #92400e;
  --warning-bg: #fff7d6;
  --success: #17613a;
  --success-bg: #e8f6ee;
  --holiday: #f8e8ea;
  --weekend: #eef4ff;
  --shadow: 0 10px 24px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 12px;
  cursor: pointer;
  white-space: normal;
}

button:hover {
  border-color: var(--secondary);
}

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

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

button.secondary {
  background: #e9f2ff;
  border-color: #a8c7f4;
  color: #173b7a;
}

button.danger,
button.small.danger {
  background: var(--danger-bg);
  border-color: #f0b8b0;
  color: var(--danger);
}

button.small {
  min-height: 32px;
  padding: 5px 9px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 7px 9px;
}

input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  accent-color: var(--primary);
}

input:disabled {
  background: #edf1f5;
  color: #758195;
}

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

.app-header {
  background: #17202a;
  color: #ffffff;
  border-bottom: 5px solid var(--primary);
}

.header-grid {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0;
}

.app-header h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: #a8d7cf;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0;
}

.print-title {
  color: #d8e1ea;
  font-size: 18px;
  font-weight: 700;
  text-align: right;
}

.section {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
}

.section:nth-of-type(2n) {
  background: #fbfcfe;
}

.section-settings {
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

.section-alerts {
  background: #fffaf1;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h2,
.supplements-block h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  letter-spacing: 0;
}

.supplements-block {
  margin-top: 22px;
}

.supplements-block h3 {
  margin-bottom: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(100px, 0.7fr) minmax(140px, 1fr) minmax(250px, 2fr) minmax(170px, 1fr) minmax(150px, 1fr);
  gap: 12px;
}

.norm-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.norm-strip > div {
  min-height: 70px;
  border: 1px solid #b9d7d3;
  border-radius: 8px;
  background: #e8f6f3;
  padding: 11px 12px;
}

.norm-strip strong {
  display: block;
  margin-top: 4px;
  color: #0d4f49;
  font-size: 22px;
  line-height: 1.2;
}

.norm-label {
  display: block;
  color: #355b66;
  font-size: 13px;
  font-weight: 700;
}

label {
  display: grid;
  gap: 5px;
  color: #334155;
  font-weight: 700;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 9px;
  text-align: left;
  vertical-align: top;
}

.data-table th:last-child,
.data-table td:last-child {
  border-right: 0;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e6edf5;
  color: #243447;
  font-size: 13px;
  line-height: 1.25;
}

.data-table tbody tr:hover {
  background: #f7fbff;
}

.schedule-table {
  min-width: 760px;
  table-layout: fixed;
  border-collapse: collapse;
}

.schedule-wrap {
  max-height: 70vh;
}

.schedule-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  color: #334155;
  font-size: 13px;
}

.schedule-legend span {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 5px 8px;
}

.schedule-legend strong {
  color: #111111;
}

.schedule-table th,
.schedule-table td {
  border: 1px solid #000000;
}

.schedule-table th {
  background: #ffffff;
  color: #111111;
  font-weight: 400;
  text-align: center;
}

.schedule-table .schedule-day-header {
  width: 110px;
  background: #f5cda8;
  font-weight: 700;
}

.schedule-day-cell,
.schedule-code-cell {
  text-align: center;
  vertical-align: middle;
}

.schedule-day-cell {
  width: 110px;
  font-weight: 500;
}

.schedule-code-cell {
  height: 26px;
  font-weight: 700;
}

.schedule-table .weekend-row,
.schedule-table .holiday-row {
  background: #cfcfcf;
}

.schedule-table .saturday-row {
  background: #e2e2e2;
}

.schedule-table .sunday-row {
  background: #b9b9b9;
}

.schedule-table .absence-code-cell {
  background: #d8d8d8;
}

.schedule-table .warning-code-cell {
  outline: 2px solid var(--warning);
  outline-offset: -2px;
}

.schedule-sum-row td {
  background: #ffffff;
  font-weight: 800;
  text-align: center;
}

.wide-input {
  min-width: 240px;
}

.center-cell {
  text-align: center;
}

.time-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.muted-row {
  color: #7d8795;
  background: #f4f6f8;
}

.invalid-row {
  background: var(--danger-bg);
}

.weekend-row {
  background: var(--weekend);
}

.holiday-row {
  background: var(--holiday);
}

.weekend-row.holiday-row {
  background: #f4e5f5;
}

.schedule-table .saturday-row,
.schedule-table .saturday-row.holiday-row {
  background: #e2e2e2;
}

.schedule-table .sunday-row,
.schedule-table .sunday-row.holiday-row {
  background: #b9b9b9;
}

.schedule-select {
  min-width: 190px;
}

.missing-label {
  margin-top: 5px;
  color: var(--danger);
  font-weight: 700;
  font-size: 13px;
}

.covered-label {
  margin-top: 5px;
  color: var(--success);
  font-weight: 700;
  font-size: 13px;
}

.supplement-pill {
  display: inline-block;
  margin: 0 5px 5px 0;
  border: 1px solid #9ec6c1;
  border-radius: 6px;
  background: #e7f5f2;
  color: #0d4f49;
  padding: 4px 7px;
  font-size: 13px;
}

.note-line {
  margin-bottom: 5px;
  color: var(--warning);
}

.note-line:last-child {
  margin-bottom: 0;
}

.warnings-list {
  display: grid;
  gap: 8px;
}

.warning-count {
  min-width: 34px;
  border-radius: 999px;
  background: var(--warning);
  color: #ffffff;
  padding: 4px 9px;
  text-align: center;
  font-weight: 700;
}

.warning-item,
.success-box {
  border-radius: 8px;
  padding: 10px 12px;
}

.warning-item {
  border: 1px solid #f0d08a;
  background: var(--warning-bg);
  color: var(--warning);
}

.success-box {
  border: 1px solid #b6dec5;
  background: var(--success-bg);
  color: var(--success);
  font-weight: 700;
}

.ok-text {
  color: var(--success);
  font-weight: 700;
}

.warn-text {
  color: var(--warning);
  font-weight: 700;
}

.danger-text {
  color: var(--danger);
  font-weight: 700;
}

.print-value {
  display: none;
}

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

  .header-grid,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .print-title {
    text-align: left;
  }

  .button-row {
    justify-content: flex-start;
  }

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

  .norm-strip {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 620px) {
  body {
    font-size: 14px;
  }

  .app-header h1 {
    font-size: 23px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .button-row button,
  .section-heading > button {
    width: 100%;
  }

  .section {
    padding: 18px 0;
  }
}

@media print {
  :root {
    --line: #bfc7d1;
    --ink: #000000;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 11px;
  }

  .app-header {
    background: #ffffff;
    color: #000000;
    border-bottom: 1px solid #000000;
  }

  .header-grid {
    padding: 10px 0;
  }

  .eyebrow,
  .no-print,
  .section-alerts,
  button,
  input,
  select {
    display: none !important;
  }

  .page-shell {
    width: 100%;
  }

  .section {
    border-bottom: 0;
    padding: 8px 0;
  }

  .section:nth-of-type(2n),
  .section-settings {
    background: #ffffff;
    box-shadow: none;
  }

  .section-heading {
    margin-bottom: 6px;
  }

  .section-heading h2,
  .supplements-block h3 {
    font-size: 14px;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
  }

  .data-table {
    min-width: 0;
    font-size: 10px;
    page-break-inside: auto;
  }

  .data-table th,
  .data-table td {
    border: 1px solid #8b95a1;
    padding: 4px;
  }

  .data-table th {
    position: static;
    background: #e8e8e8;
  }

  .schedule-wrap {
    max-height: none;
  }

  .missing-label,
  .danger-text {
    color: #000000;
    font-weight: 700;
  }

  .print-value {
    display: inline !important;
  }

  .weekend-row,
  .holiday-row,
  .weekend-row.holiday-row {
    background: #f0f0f0;
  }

  .schedule-table .saturday-row {
    background: #eeeeee;
  }

  .schedule-table .sunday-row {
    background: #d4d4d4;
  }

  .supplement-pill {
    border: 0;
    padding: 0;
    margin: 0 0 2px;
    background: transparent;
    color: #000000;
    display: block;
  }
}
