:root {
  color-scheme: light;
  --paper: #f7f3ed;
  --panel: #fffdf9;
  --line: #e9dfd3;
  --ink: #272622;
  --muted: #625e55;
  --forest: #263a30;
  --forest-dark: #192b22;
  --focus: #3a6e53;
  --serif: Georgia, 'Times New Roman', serif;
  font: 15px/1.45 system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }

select {
  min-inline-size: 0;
  max-inline-size: 100%;
  min-block-size: 38px;
  padding: 6px 12px;
  border: 1px solid #d7cbbb;
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
select:hover:not(:disabled) { border-color: #a99c8a; background: #fbf7ef; }
select:invalid, select:disabled { color: var(--muted); }
select:disabled { background: #f2ede5; cursor: default; }

@supports (appearance: base-select) and selector(select::picker(select)) {
  select, select::picker(select) { appearance: base-select; }
  select {
    align-items: center;
    column-gap: 14px;
    padding-inline-end: 14px;
  }
  select::picker-icon {
    content: '';
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    margin-inline-start: auto;
    margin-block-start: -3px;
    border-inline-end: 1.5px solid currentColor;
    border-block-end: 1.5px solid currentColor;
    color: var(--forest);
    transform: rotate(45deg);
  }
  select:open { border-color: var(--focus); background: #fbf7ef; }
  select:open::picker-icon { margin-block-start: 3px; transform: rotate(225deg); }
  select::picker(select) {
    max-inline-size: calc(100vw - 28px);
    max-block-size: min(310px, 50vh);
    margin-block: 5px;
    padding: 4px;
    overflow: auto;
    border: 1px solid #d7cbbb;
    border-radius: 9px;
    background: var(--panel);
    color: var(--ink);
    box-shadow: 0 8px 24px #263a3026;
  }
  select option {
    min-block-size: 34px;
    gap: 12px;
    padding: 5px 9px;
    border-radius: 5px;
    font-weight: 500;
    white-space: normal;
  }
  select option:not(:disabled):hover, select option:focus-visible {
    background: #f3ede2;
    outline-offset: -2px;
  }
  select option:checked { background: #e7eee0; color: var(--forest-dark); font-weight: 650; }
  select option::checkmark { order: 1; margin-inline-start: auto; color: var(--focus); }
}

.page-width { width: min(100% - 88px, 1000px); margin-inline: auto; }
.brand-bar { background: var(--forest-dark); color: #fff7e9; }
.brand-inner { min-height: 68px; display: flex; align-items: center; gap: 13px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px 8px 16px 16px;
  background: #f1d5a7;
  color: var(--forest-dark);
  font: 600 22px/1 var(--serif);
}
.brand-name { font: 600 23px/1 var(--serif); letter-spacing: -.02em; }
.brand-divider { width: 1px; height: 18px; background: #5a6b60; margin-inline: 1px; }
.brand-product { color: #d9e2d8; font-size: 12px; }
.app-nav { display: flex; align-self: stretch; gap: 4px; margin-left: auto; }
.app-nav button {
  padding: 0 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #d9e2d8;
  font-size: 13px;
}
.app-nav button:hover { background: #253c2f; }
.app-nav button[aria-current="page"] { border-color: #f1d5a7; color: #fff7e9; font-weight: 650; }
.app-nav button:focus-visible { outline-color: #f1d5a7; outline-offset: -4px; }

main { padding-block: 32px 34px; }
.page-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.page-heading h1 { font: 600 clamp(42px, 5vw, 56px)/1.03 var(--serif); letter-spacing: -.05em; }
.team-count { margin-top: 7px; color: var(--muted); font-size: 13px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--forest);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}
.button-primary { padding-inline: 15px; min-height: 42px; background: var(--forest); color: #fefcf7; }
.button-primary:hover:not(:disabled) { background: var(--forest-dark); }
.button-primary:disabled { opacity: .55; }
.button-secondary { border-color: var(--line); background: var(--panel); }
.button-secondary:hover, .button-text:hover:not(:disabled) { background: #ede8df; }
.button-text { min-height: 34px; padding-inline: 8px; }
.button-text:disabled { color: #746f65; }
.plus { font-size: 19px; line-height: 1; font-weight: 400; }

.section-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-block: 17px 10px;
}
.section-toolbar h2 { font-size: 15px; font-weight: 680; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.role-groups { display: grid; gap: 6px; }
.role-group {
  --role-color: #687888;
  --role-tint: #e7edf3;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}
.role-group[data-color="plum"] { --role-color: #7c587f; --role-tint: #f0e7f1; }
.role-group[data-color="blue"] { --role-color: #4b6d9e; --role-tint: #e6edf6; }
.role-group[data-color="copper"] { --role-color: #965339; --role-tint: #f4e5dc; }
.role-group[data-color="amber"] { --role-color: #955f21; --role-tint: #f8edda; }
.role-group[data-color="sand"] { --role-color: #897040; --role-tint: #f1eade; }
.role-group[data-color="slate"] { --role-color: #536373; --role-tint: #e9edf0; }
.role-group[data-color="sage"] { --role-color: #4f6e43; --role-tint: #e7eee0; }
.role-group[data-color="red"] { --role-color: #a64e49; --role-tint: #f7e7e4; }
.role-group[data-color="teal"] { --role-color: #3b716c; --role-tint: #e5efed; }
.role-group[data-color="olive"] { --role-color: #746b36; --role-tint: #f0edda; }

.role-group summary {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto 12px;
  gap: 13px;
  align-items: center;
  min-height: 47px;
  padding: 8px 16px 8px 13px;
  list-style: none;
  border-radius: 9px;
  cursor: pointer;
}
.role-group summary::-webkit-details-marker { display: none; }
.role-group summary:hover { background: #f9f4ec; }
.role-group[open] summary { border-radius: 9px 9px 0 0; }
.role-marker { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--role-tint); }
.role-marker::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--role-color); }
.role-title { font-weight: 620; overflow-wrap: anywhere; }
.role-count {
  min-width: 28px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--role-tint);
  color: var(--ink);
  font-size: 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.chevron { width: 7px; height: 7px; margin-left: 1px; border-bottom: 1.5px solid var(--muted); border-right: 1.5px solid var(--muted); transform: rotate(45deg) translateY(-2px); }
.role-group[open] .chevron { transform: rotate(225deg) translateY(-2px); }
.employee-list { list-style: none; margin: 0; padding: 0; }
.employee-row, .role-empty {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 4px 15px 4px 48px;
  border-top: 1px solid var(--line);
}
.employee-name { min-width: 0; overflow-wrap: anywhere; }
.employee-end-date, .field-help { display: block; color: var(--muted); font-size: 12px; }
.field-help { margin-top: -8px; }
.role-empty p { color: var(--muted); font-size: 13px; }

dialog {
  width: min(460px, calc(100% - 36px));
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 85px #14231933;
}
dialog::backdrop { background: #12201870; }
dialog h2 { font: 600 28px/1.15 var(--serif); letter-spacing: -.035em; }
.form-fields { display: grid; gap: 7px; margin-top: 22px; }
.form-fields label { font-size: 13px; font-weight: 630; }
.form-fields :is(input, select) {
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
}
.form-fields input {
  padding: 7px 9px;
  border: 1px solid #d7cbbb;
  border-radius: 6px;
  background: #fffefc;
  color: var(--ink);
}
.shift-time { min-width: 0; margin: 0; padding: 0; border: 0; }
.shift-time legend { margin-bottom: 6px; padding: 0; font-size: 13px; font-weight: 650; }
.shift-time-pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shift-time-pickers label { display: grid; gap: 5px; }
.shift-time-pickers input { min-width: 0; }
.shift-time .field-help { margin-top: 0; }
.shift-time .shift-range-choice { display: flex; align-items: center; gap: 7px; margin-bottom: 9px; font-weight: 500; }
.shift-range-choice #shift-use-range { width: auto; min-height: 0; margin: 0; accent-color: var(--forest); }
.shift-note-entry { margin-top: 12px; color: var(--muted); font-size: 13px; }
.shift-note-entry summary { width: fit-content; color: var(--forest); cursor: pointer; }
.shift-note-entry input {
  width: 100%;
  margin-top: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffefc;
  color: var(--ink);
}
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; margin-top: 17px; }
.employee-cover { min-width: 0; margin: 16px 0 0; padding: 8px 12px 11px; border: 1px solid var(--line); border-radius: 8px; }
.employee-cover legend { padding-inline: 4px; font-size: 13px; font-weight: 650; }
.employee-cover .field-help { margin-top: 7px; }
.cover-option { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; cursor: pointer; }
.cover-option input { flex: none; margin: 2px 0 0; accent-color: var(--forest); }
.cover-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; padding-top: 10px; }
.team-error, .form-error { padding: 9px 12px; border-radius: 6px; background: #f8e8e5; color: #8c3128; font-size: 13px; }
.team-error { margin-top: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.schedule-page { width: calc(100% - 56px); }
.schedule-toolbar { align-items: center; }
.schedule-actions { justify-content: flex-end; align-items: center; }
#import-csv-dialog :is(#import-csv-summary, #import-csv-replacement, .form-error) { margin-top: 10px; }
#import-csv-summary { overflow-wrap: anywhere; }
#schedule-status[data-kind="draft"], #schedule-status[data-kind="final"] {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 5px;
  background: #f1e4d1;
  color: #5c411e;
  font-weight: 650;
}
#schedule-status[data-kind="final"] { background: #e7eee0; color: #284731; }
.schedule-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; font-size: 13px; }
.schedule-filters label { color: var(--muted); }
.schedule-filters .counts-toggle { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.counts-toggle input { accent-color: var(--forest); }
.schedule-filters select { font-weight: 600; }
.leave-row input {
  min-height: 35px;
  padding: 5px 7px;
  border: 1px solid #d7cbbb;
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}
.calendar-scroll {
  max-height: max(235px, calc(100vh - 344px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}
.schedule-version-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  padding: 11px 0 0;
}
.version-label { font-size: 13px; font-weight: 650; }
.schedule-version-bar .team-count { margin-top: 2px; }
.schedule-version-bar button:disabled, .history-actions button:disabled { opacity: .55; }
#local-history-dialog h3 { margin: 18px 0 6px; font-size: 14px; }
#local-history-dialog :is(.form-error, .dialog-copy) { margin-top: 9px; }
.history-list { margin: 8px 0 0; padding: 0; list-style: none; }
.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.history-row small { display: block; color: var(--muted); }
.history-row button:disabled { color: var(--muted); }
.button.history-delete { color: #8c3128; }
.calendar-grid { --date-header-height: 59px; width: max-content; min-width: 100%; border-spacing: 0; text-align: center; font-size: 12px; }
.calendar-grid th, .calendar-grid td { height: 37px; min-width: 53px; padding: 2px 3px; border-bottom: 1px solid var(--line); }
.calendar-grid thead th { position: sticky; z-index: 4; top: 0; height: var(--date-header-height); background: #efe8dc; }
.calendar-grid thead th.weekend { background: #dfeaf3; color: #314c61; }
.calendar-grid thead th.holiday { background: #f5dfad; color: #654318; }
.calendar-date {
  position: relative;
  display: grid;
  align-content: start;
  justify-items: center;
  width: 100%;
  height: 54px;
  padding: 5px 1px 2px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font-variant-numeric: tabular-nums;
}
.date-number { font-size: 15px; line-height: 17px; font-weight: 720; }
.calendar-date:hover { background: #fffcf4; }
.calendar-date.custom-norm::after { content: ''; position: absolute; top: 3px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--focus); }
.calendar-grid small { display: block; color: var(--muted); font-size: 10px; font-weight: 450; }
.calendar-grid .calendar-date small { color: inherit; font-weight: 560; }
.holiday-label { font-size: 9px; line-height: 13px; font-weight: 650; }
.calendar-grid tr > th:first-child { position: sticky; z-index: 1; left: 0; }
.calendar-grid thead tr > th:first-child { z-index: 5; }
.calendar-grid tr > th:first-child:not([colspan]) { width: 185px; min-width: 185px; padding-inline: 10px; text-align: left; }
.day-totals th, .day-totals td { background: #f3eee4; font-weight: 650; }
.calendar-grid .calendar-name { background: var(--panel); font-weight: 570; }
.calendar-grid .schedule-group :is(th, td) { background: var(--role-tint); }
.calendar-grid .schedule-group { position: sticky; top: var(--date-header-height); z-index: 2; }
.calendar-grid .schedule-group th { height: 40px; padding-inline: 8px; text-align: left; }
.calendar-grid .schedule-group small { margin-left: 25px; }
.role-schedule-button {
  display: block;
  width: 100%;
  padding: 2px 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--ink);
  text-align: left;
  font-size: inherit;
  font-weight: 680;
}
.role-schedule-button:hover small { text-decoration: underline; }
.calendar-grid .role-schedule-button small { color: var(--forest); font-weight: 600; }
.coverage-count { font-variant-numeric: tabular-nums; color: var(--muted); }
.calendar-grid tbody td.weekend { background: #edf3f7; }
.calendar-grid tbody td.holiday { background: #fbefd3; }
.calendar-grid .role-gap-day { background: #fbf0e8; }
.calendar-grid tbody td.past-employment { background-image: repeating-linear-gradient(135deg, transparent 0 5px, #80766b30 5px 6px); }
.schedule-group .role-marker { display: inline-grid; width: 20px; height: 20px; margin-right: 5px; vertical-align: middle; }
.work-total { color: var(--muted); font-weight: 650; }
.calendar-grid :is(span, button)[class^="day-"] {
  display: inline-grid;
  place-items: center;
  min-width: 27px;
  min-height: 26px;
  padding: 2px 4px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 11px;
  line-height: 1.18;
}
.calendar-grid button[class^="day-"] { width: 100%; }
.calendar-grid button[class^="day-"]:hover { border-color: var(--focus); }
.day-work { background: #e7eee0; color: #284731; }
.day-extra { background: #e2edf4; color: #294d65; font-weight: 650; }
.calendar-grid .has-shift-time { align-content: center; gap: 1px; white-space: nowrap; }
.shift-mark-time { font-size: 10px; font-weight: 500; font-variant-numeric: tabular-nums; }
.extra-total, .calendar-grid .extra-total { display: block; color: #315771; font-size: 11px; font-weight: 650; }
.day-leave { background: #f1e4d1; color: #5c411e; }
.day-note { background: #eee8ef; color: #58475d; }
.day-off { background: transparent; color: var(--muted); }
.calendar-grid :is(span, button).long-streak { box-shadow: inset 0 0 0 1px #a65142; background: #fae7df; color: #7e3026; }
.calendar-grid :is(span, button).streak-warning, .streak-pill {
  background: #f9dfbf;
  color: #76400e;
}
.calendar-grid :is(span, button).streak-warning { box-shadow: inset 0 0 0 1px #d69a60; }
.calendar-grid .streak-label { color: #8d4c10; font-weight: 650; }
.calendar-grid .streak-label.long-streak-label { color: #8c3128; }
.streak-pill { display: inline-block; border-radius: 5px; padding: 2px 5px; font-weight: 650; }
.streak-pill.blocked { background: #fae7df; color: #8c3128; }
.calendar-grid :is(span, button)[class^="day-"] { max-width: 61px; overflow-wrap: anywhere; }
.calendar-grid :is(span, button).shift-clock-range {
  width: max-content;
  min-width: 100%;
  max-width: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.dialog-copy { margin-top: 10px; color: var(--muted); font-size: 13px; }
.forecast-staffing { padding: 9px 11px; border-left: 2px solid var(--focus); background: #edf0e7; }
.forecast-staffing + .toolbar-actions { margin-top: 8px; }
.generation-preview { margin-top: 5px; }
.wide-dialog:is(.generation-dialog, .planner-dialog) {
  width: min(710px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 0;
  overflow: hidden;
}
:is(.generation-dialog, .planner-dialog) > form {
  display: flex;
  flex-direction: column;
  max-height: min(86vh, calc(100dvh - 36px));
}
.planner-body { padding: 24px 26px 18px; overflow: auto; min-height: 0; }
.planner-body .dialog-copy { margin-top: 7px; }
.planner-body .field-help { margin: 5px 0 8px; line-height: 1.45; }
.planner-body h3 { margin: 0; font-size: 15px; }
.planner-footer { padding: 12px 26px; border-top: 1px solid var(--line); background: var(--panel); }
.planner-footer .form-actions { margin: 0; }
.planner-footer .form-error { margin-bottom: 8px; }
.standard-overview { margin-top: 17px; padding: 14px 16px; border: 1px solid #cbd7c8; border-radius: 9px; background: #f1f5ee; }
.planner-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.planner-section-head .button { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.standard-overview dl { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 14px; margin: 13px 0 0; }
.standard-overview dt, .standard-overview .summary-detail { color: var(--muted); font-size: 12px; }
.standard-overview dd { margin: 2px 0 0; font-size: 16px; font-weight: 650; }
.standard-overview .summary-detail { margin-top: 3px; font-weight: 400; }
.planner-period { margin: 17px 0; }
.planner-period > label, .planner-fields > label, .planner-dates > label {
  display: grid; gap: 5px; color: var(--ink); font-size: 13px; font-weight: 650;
}
.planner-period > select { margin-top: 5px; }
.planner-fields { display: grid; gap: 12px; margin-top: 15px; }
.planner-fields > .field-help { margin: -8px 0 0; }
.rotation-setting label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; }
.rotation-setting input { margin: 0; accent-color: var(--forest); }
.standard-overview #role-rotation-summary { margin: 12px 0 0; padding-top: 8px; border-top: 1px solid #cbd7c8; }
#rotation-result { margin: 15px 0 9px; padding: 12px 14px; border-radius: 7px; background: #f6eddf; font-weight: 630; }
#rotation-result[data-met="true"] { background: #e9f1e5; color: var(--forest); }
#rotation-by-person { padding: 0; margin: 0; list-style: none; font-size: 13px; }
#rotation-by-person li { padding-block: 6px; border-top: 1px solid var(--line); }
#rotation-by-person small { display: block; color: var(--muted); }
.planner-fields input, .planner-fields select, .planner-dates input { font-weight: 400; }
.planner-fields > label > :is(input, select) { width: min(100%, 310px); }
.planner-dates, .role-cycle-batch, .generation-setting, .generation-batch {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
}
.planner-dates { margin: 10px 0; gap: 14px; }
.planner-details, .generation-role { margin-top: 7px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }
.planner-details { padding: 0 12px; }
.planner-details[open] { padding-bottom: 10px; }
.planner-details > summary, .generation-role > summary { padding: 10px 0; color: var(--forest); font-weight: 650; cursor: pointer; }
.generation-role > summary { padding-inline: 12px; }
.generation-role-summary { margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 450; }
.generation-options { padding: 0 12px 10px; }
.generation-options .field-help { margin-top: 0; }
.generation-setting, .generation-batch, .role-cycle-batch { margin-block: 5px 8px; }
.role-day-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(82px, 1fr)); gap: 7px; }
.role-day-fields label { display: grid; gap: 4px; }
:is(.planner-dialog, .generation-dialog) input:not([type="checkbox"]) {
  min-width: 0;
  min-height: 35px;
  padding: 4px 8px;
  border: 1px solid #d7cbbb;
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
}
.role-day-fields input { width: 100%; }
.role-cycle-batch input { width: 65px; }
.roster-scroll { overflow-x: auto; }
.generation-roster { width: 100%; border-collapse: collapse; }
.generation-roster th, .generation-roster td { padding: 6px 4px; border-top: 1px solid var(--line); text-align: left; }
.generation-roster thead th { color: var(--muted); font-size: 12px; }
.generation-roster tbody th { font-weight: 550; }
.generation-roster input[type="number"] { width: 90px; }
.generation-options input[type="checkbox"] { accent-color: var(--forest); }
@media (max-width: 560px) {
  .planner-body { padding: 18px 16px 12px; }
  .planner-footer { padding: 10px 16px; }
  .standard-overview dl { grid-template-columns: 1fr 1fr; }
  .standard-overview dl > div:first-child { grid-column: 1 / -1; }
}
.calendar-grid .shift-target-mismatch { color: #8c3128; }
.forecast-toolbar h3 { margin: 0; font-size: 14px; }
.leave-row { display: grid; grid-template-columns: minmax(0, 1fr) 62px 62px auto; gap: 5px; margin-bottom: 6px; }
.leave-row input { min-width: 0; }
.leave-row button { font-size: 18px; }

.work-hours { min-width: 66px !important; color: var(--muted); white-space: nowrap; }
.coverage-alert {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 27px;
  min-width: 29px;
  margin: 2px auto 1px;
  padding: 1px 4px;
  border: 1px solid #e8b8a4;
  border-radius: 4px;
  background: #fae7df;
  color: #8c3128;
  font-size: 11px;
  font-weight: 700;
}
.coverage-ratio { font-weight: 480; }
.coverage-alert:hover { border-color: #9b4b3f; }
.coverage-alert[disabled]:hover { border-color: #e8b8a4; }
.wide-dialog { width: min(650px, calc(100% - 36px)); max-height: calc(100% - 36px); }
.staffing-total { display: flex; align-items: center; gap: 12px; margin-block: 15px 10px; font-weight: 600; }
.staffing-total input, .staffing-table input {
  min-width: 0;
  min-height: 32px;
  padding: 4px 6px;
  border: 1px solid #d7cbbb;
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
}
.staffing-total input, .staffing-table input[type="number"] { width: min(100%, 66px); }
.staffing-table { width: 100%; border-collapse: collapse; }
.staffing-table th, .staffing-table td { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; }
.staffing-day-count { display: block; color: var(--muted); font-weight: 400; }
.staffing-table input[type="time"] { width: 100%; }
.staffing-table input[name="duration"] { width: 63px; }
.replacement-list { display: grid; gap: 12px; }
.replacement-group { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 11px; }
.replacement-group h3 { margin: 0; font-size: 15px; }
.replacement-shift { margin-top: 3px; color: var(--muted); font-size: 13px; }
.replacement-candidates { margin: 8px 0 0; padding: 0; list-style: none; }
.replacement-candidate {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding-block: 7px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.replacement-candidate small { display: block; color: var(--muted); font-size: 11px; }
.replacement-candidate strong { overflow-wrap: anywhere; }

@media (max-width: 620px) {
  .page-width { width: calc(100% - 32px); }
  main { padding-top: 24px; }
  .employee-row, .role-empty { padding-left: 30px; }
  .brand-product, .brand-divider { display: none; }
  .app-nav button { padding-inline: 8px; }
  .replacement-candidate { grid-template-columns: minmax(0, 1fr) auto; }
  .replacement-candidate .button { justify-self: end; }
}

body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.brand-bar { padding-top: env(safe-area-inset-top); }
.page-width { max-width: 1040px; }
.brand-inner { min-height: 52px; }
.schedule-page .page-heading { position: relative; padding-bottom: 14px; }
#month-actions { position: relative; margin-left: auto; }
#month-actions > summary, .phone-arrow, .phone-link {
  color: var(--forest); font-weight: 650; font-size: 14px; cursor: pointer;
}
#month-actions > summary { border: 1px solid #d5cbbd; border-radius: 9px; padding: 10px 14px; background: var(--panel); }
#month-actions[open] .schedule-actions {
  position: absolute; z-index: 4; right: 0; top: calc(100% + 6px); min-width: 220px;
  display: grid; gap: 5px; padding: 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 8px 25px #263a3025;
}
#month-actions .button { justify-content: flex-start; }
#schedule-empty { margin-top: 20px; }
#schedule-empty .button { display: block; margin-top: 12px; }
#offline-state, #update-state { text-align: center; padding: 8px; font-size: 13px; background: #e4eddc; }
#phone-tabs {
  position: fixed; z-index: 5; bottom: 0; inset-inline: 0; display: flex; justify-content: center;
  padding: 7px 12px calc(7px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line);
}
#phone-tabs button { flex: 1; max-width: 200px; margin-inline: 3px; border: 0; border-radius: 9px;
  min-height: 45px; background: transparent; color: var(--muted); font-weight: 600; }
#phone-tabs [aria-current] { background: var(--forest); color: white; }
.phone-period { display: flex; align-items: end; gap: 10px; margin: 16px 0; }
.phone-arrow { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; min-width: 44px; min-height: 44px; font-size: 24px; }
.phone-arrow:disabled { opacity: .35; }
.phone-date { flex: 1; min-width: 0; }
.phone-date span { display: block; margin: 0 0 3px; font-size: 12px; color: var(--muted); }
.phone-date select { min-height: 44px; width: 100%; }
.phone-summary, .phone-card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.phone-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
.phone-summary .phone-link { margin-left: auto; }
.phone-link { border: 0; background: transparent; min-height: 44px; padding: 5px 8px; }
.phone-card { margin-block: 10px; padding: 8px 12px; }
.phone-card-heading { display: flex; align-items: center; gap: 8px; }
.phone-card-heading h3 { margin: 0; flex: 1; font-size: 17px; }
.phone-card-heading .phone-link { font-size: 12px; }
.phone-coverage { color: var(--muted); font-size: 13px; padding-bottom: 7px; }
.phone-shift { display: flex; align-items: center; gap: 7px; width: 100%; min-height: 48px; padding: 6px 0; border: 0;
  border-top: 1px solid var(--line); text-align: left; background: transparent; color: var(--ink); font-size: 14px; }
.phone-person { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.phone-person small, .phone-week th small { display: block; font-size: 11px; font-weight: 450; color: var(--muted); }
.phone-mark { padding: 4px 8px; border-radius: 6px; background: #f1ece4; text-align: center; }
.phone-mark.day-work { background: #e2eddd; color: #264b2e; }
.phone-mark.day-extra { background: #e0edf5; color: #20425a; }
.phone-streak > small { color: #8a450c; background: #ffe1b8; border-radius: 5px; padding: 3px; font-size: 10px; }
.phone-away summary { min-height: 44px; padding: 12px 0; color: var(--muted); cursor: pointer; font-size: 13px; }
.phone-gap { display: block; min-height: 44px; margin-block: 5px; padding: 7px 12px; border: 1px solid #e3beb1;
  border-radius: 8px; background: #fbeae1; color: #783a26; text-align: left; font-weight: 600; }
#phone-tools:not(:empty) { margin-block: 6px; }
.phone-week-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.phone-week { border-spacing: 0; width: 100%; font-size: 13px; }
.phone-week th, .phone-week td { padding: 4px; text-align: center; border-bottom: 1px solid var(--line); min-width: 57px; }
.phone-week tr > :first-child { position: sticky; left: 0; z-index: 1; min-width: 104px; max-width: 140px; text-align: left; background: var(--panel); }
.phone-week .phone-shift { justify-content: center; flex-direction: column; gap: 2px; min-height: 44px; border: 0; }
.phone-week .phone-mark { font-size: 12px; }
.phone-week-count > *, .phone-week-count > :first-child { background: #f0ebe3; }
.phone-week .phone-link, .phone-week .phone-gap { font-size: 12px; white-space: normal; }
:is(.phone-summary, .phone-week th, .phone-week td).holiday { background: #f8e5b8; }
:is(.phone-summary, .phone-week th, .phone-week td).weekend { background: #e8eff4; }
#find-gap { display: none; }
@media (max-width: 620px) {
  .schedule-toolbar .schedule-filters { display: grid; width: 100%; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 4px 10px; }
  .schedule-filters label[for="role-filter"] { grid-row: 1; grid-column: 2; }
  #month-select, #role-filter { grid-row: 2; width: 100%; }
  #open-staffing, .counts-toggle { margin-top: 5px; }
  #edit-forecast-generation, .button { white-space: normal; }
  .button, select { min-height: 44px; }
  dialog { padding: 18px; }
  dialog, dialog.wide-dialog { width: calc(100% - 16px); max-width: 100%; max-height: calc(100dvh - 24px); }
  .wide-dialog.generation-dialog, .wide-dialog.planner-dialog { padding: 0; }
  dialog input:not([type="checkbox"]), dialog select, .schedule-filters select, .phone-date select { font-size: 16px; }
  .staffing-table thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  .staffing-table tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .staffing-table td, .staffing-table th { border: 0; }
  .staffing-table th { grid-column: 1/-1; font-size: 14px; }
  .staffing-table td::before { display: block; font-size: 12px; color: var(--muted); }
  .staffing-table td:nth-child(2)::before { content: "Мінімум людей"; }
  .staffing-table td:nth-child(3)::before { content: "Тривалість, год"; }
  .staffing-table td:nth-child(4)::before { content: "Початок"; }
  .staffing-table td:nth-child(5)::before { content: "Кінець"; }
  .staffing-table td input { width: 100% !important; }
  .leave-row { grid-template-columns: 1fr 1fr auto; }
  .leave-row select { grid-column: 1/-1; }
  .form-actions, .toolbar-actions { flex-wrap: wrap; }
}
.gap-calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; margin: 8px 0 16px; }
.gap-calendar > small { text-align: center; padding-block: 4px; color: var(--muted); }
.gap-date { display: grid; align-content: center; justify-items: center; min-height: 44px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); }
.gap-date.weekend { background: #e8eff4; }
.gap-date.holiday { background: #f8e5b8; }
.gap-date small { color: #833c26; font-weight: 700; line-height: 1; }
.gap-date:has(small) { border-color: #d3a48f; }
