: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; }
}

#sheet-select-fields:not([hidden]) { display: grid; gap: 6px; margin: 6px 0; padding: 12px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; }
#sheet-differences { max-height: 32vh; overflow-y: auto; }
.sheet-change { display: grid; gap: 3px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sheet-change small { color: var(--muted); }

:root {
  color-scheme: dark;
  --paper: #232820;
  --panel: #2c322b;
  --line: #455045;
  --ink: #f2f0e9;
  --muted: #b7c1b7;
  --forest: #b6d2b8;
  --forest-dark: #203428;
  --focus: #c5dec5;
  --sage: #323e32;
  --active-ink: #1b2f20;
  --alert: #f4bd8d;
  --alert-bg: #48392d;
}
body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
.page-width { width: min(calc(100% - 32px), 880px); }
.brand-bar { padding-top: env(safe-area-inset-top); }
.brand-inner { min-height: 52px; gap: 8px; }
.brand-mark { flex: none; width: 27px; height: 25px; border-radius: 6px 6px 3px 3px; font-size: 18px; }
.brand-name { font-size: 23px; }
.brand-product { display: none; }
.brand-divider { display: block; height: 16px; background: #748575; }
.app-nav { margin-left: 0; gap: 1px; align-items: center; }
.app-nav button { border: 0; color: var(--muted); padding: 0 5px; min-height: 44px; }
.app-nav button[aria-current] { color: #f8f3e6; font-weight: 600; }
#month-actions { position: relative; margin-left: auto; }
#month-actions > summary { display: flex; min-height: 44px; align-items: center; list-style: none; cursor: pointer; }
#month-actions > summary::-webkit-details-marker { display: none; }
#phone-kind { padding: 2px 7px; color: #f8f3e6; border: 1px solid #879986; border-radius: 4px; font-size: 12px; }
#phone-kind:empty, #month-actions:has(#schedule-status:empty) #phone-kind { display: none; }
.menu-dots { padding: 0 3px 0 6px; color: var(--muted); font-size: 10px; letter-spacing: 1px; }
#month-actions:not(:has(#schedule-status[data-kind])) .counts-toggle, body:has(#schedule-page[hidden]) #month-actions { display: none; }
#month-actions:not([open]) .schedule-actions { display: none; }
#month-actions[open] .schedule-actions {
  position: absolute; z-index: 8; right: 0; top: 100%; min-width: 225px; max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 122px); overflow: auto; display: grid; justify-content: stretch; gap: 3px;
  padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 10px 26px #1119;
}
#month-actions .button, #month-actions .counts-toggle { min-height: 43px; justify-content: flex-start; text-align: left; }
#month-actions .counts-toggle { display: flex; align-items: center; gap: 6px; padding-inline: 8px; color: var(--muted); font-size: 13px; }
#month-actions #schedule-status { order: -1; margin: 0; padding: 5px 8px; color: var(--muted); background: none; font-size: 12px; font-weight: 500; }
#month-actions #schedule-status:empty { display: none; }
#find-gap { display: none; }
.schedule-page { padding-top: 0; }
.schedule-page .page-heading { border: 0; padding: 0; }
.schedule-page .page-heading h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.schedule-toolbar { padding: 8px 0 3px; }
.schedule-toolbar .schedule-filters { display: grid; width: 100%; grid-template-columns: auto minmax(0,144px) 1fr auto minmax(0,140px); gap: 6px; align-items: center; }
.schedule-filters label { font-size: 12px; }
.schedule-filters label[for="role-filter"] { grid-column: 4; }
.schedule-filters select { white-space: nowrap; width: 100%; font-size: 14px; min-height: 38px; padding-inline: 8px; }
select, .staffing-total input, .staffing-table input { border-color: var(--line); }
select:hover:not(:disabled), select:open { background: var(--sage); }
select:disabled { background: var(--paper); }
select::picker(select) { border-color: var(--line); }
select option:not(:disabled):hover, select option:focus-visible { background: var(--sage); }
select option:checked { background: var(--forest); color: var(--active-ink); }
#schedule-empty { margin-top: 26px; }
#schedule-empty .button { display: block; margin-top: 12px; }
#offline-state, #update-state { margin: 0; padding: 8px 16px; text-align: center; font-size: 13px; background: var(--sage); color: var(--ink); }

.phone-period { margin: 16px 0 0; }
.period-label { margin: 0 0 3px; font-size: 12px; color: var(--muted); }
.period-label::first-letter, #phone-date-title::first-letter { text-transform: uppercase; }
.period-line { display: flex; align-items: center; gap: 8px; }
.phone-date { position: relative; flex: 1; min-width: 0; }
.phone-date:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
#phone-date-title { font: 600 clamp(30px, 5vw, 36px)/1.15 var(--serif); letter-spacing: -.025em; }
.phone-date select { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; min-height: 40px; }
#phone-arrows { display: flex; }
.phone-arrow { width: 40px; min-height: 44px; border: 0; border-radius: 6px; color: var(--ink); background: transparent; font-size: 24px; }
.phone-arrow:disabled { opacity: .28; }
#phone-week-strip { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); margin: 16px 0 19px; }
.strip-day { display: grid; place-content: center; gap: 1px; min-height: 52px; text-align: center; color: var(--ink); border: 0; border-radius: 9px; background: transparent; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.strip-day small { font-size: 12px; font-weight: 450; color: var(--muted); }
.strip-day.weekend:not([aria-pressed="true"]) small { color: #c0d3d8; }
.strip-day.holiday small { color: var(--alert); }
.strip-day[aria-pressed="true"] { background: var(--forest); color: var(--active-ink); }
.strip-day[aria-pressed="true"] small { color: inherit; }
.outside-month { opacity: .35; }
.phone-arrow:hover:enabled, .strip-day[aria-pressed="false"]:hover, .phone-shift:is(button):hover { background: var(--panel); }
.phone-summary { display: flex; align-items: center; width: 100%; justify-content: space-between; gap: 9px; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 9px; background: var(--sage); color: var(--ink); text-align: left; font-size: 14px; }
.phone-summary span { white-space: nowrap; font-variant-numeric: tabular-nums; }
.phone-summary.has-gap, .phone-gap { background: var(--alert-bg); color: var(--alert); }
.phone-link { min-height: 44px; border: 0; border-radius: 5px; padding: 4px 6px; background: transparent; color: var(--forest); font-size: 13px; font-weight: 550; }
.phone-link:hover { text-decoration: underline; }
.phone-card { margin: 10px 0; }
.phone-card-heading { display: flex; align-items: center; gap: 8px; min-height: 40px; border: 0; background: none; }
.phone-card-heading h3, .roster-title { flex: 1; margin: 0; font: 650 16px/1.35 system-ui,sans-serif; }
.roster-title { margin-top: 16px; }
#phone-content > .phone-card-heading { margin-top: 8px; }
.phone-card-heading .phone-link { font-size: 12px; }
.phone-card .phone-card-heading h3, .phone-away .phone-card-heading h3 { color: var(--muted); font-size: 13px; }
.phone-coverage { padding: 8px 0; color: var(--muted); font-size: 13px; }
.phone-shift { display: flex; align-items: center; width: 100%; min-height: 49px; gap: 8px; padding: 7px 0; border: 0; border-bottom: 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; color: var(--muted); font-size: 11px; font-weight: 450; }
.shift-info { display: grid; justify-items: end; min-width: 0; text-align: end; }
.phone-mark { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.phone-shift .phone-mark { background: transparent; color: var(--ink); }
.phone-shift .day-off, .shift-chevron { color: var(--muted); }
.phone-shift .day-extra { color: #c2dae6; }
.phone-streak { font-size: 11px; color: var(--alert); }
.shift-chevron { font-size: 17px; }
.phone-away { border-block: 1px solid var(--line); margin-top: 6px; }
.phone-away summary { padding: 13px 0; min-height: 44px; color: var(--muted); cursor: pointer; font-size: 14px; }
.phone-card:has(+ .phone-away) .phone-shift:last-child { border-bottom: 0; }
.phone-gap { min-height: 44px; margin: 5px 4px 0 0; padding: 7px 12px; border: 1px solid #77604e; border-radius: 7px; text-align: left; font-size: 13px; font-weight: 600; }
#phone-tools:not(:empty) { margin: 6px 0; }
.phone-week-scroll { max-width: 100%; overflow-x: auto; }
.phone-week { border-spacing: 0; width: 100%; font-size: 13px; }
.phone-week th, .phone-week td { padding: 3px; text-align: center; border-bottom: 1px solid var(--line); min-width: 46px; }
.phone-week tr > :first-child { position: sticky; left: 0; z-index: 1; min-width: 98px; max-width: 140px; text-align: left; background: var(--paper); }
.phone-week .phone-shift { justify-content: center; min-height: 44px; border: 0; }
.phone-week .shift-info { justify-items: center; text-align: center; }
.phone-week .phone-mark { font-size: 12px; }
.phone-week-count > *, .phone-week-count > :first-child { background: var(--panel); }
.phone-week .phone-link, .phone-week .phone-gap { font-size: 12px; white-space: normal; padding-inline: 3px; }
:is(.phone-week th, .phone-week td, .gap-date).weekend { background: #2b3635; }
:is(.phone-week th, .phone-week td, .gap-date).holiday { background: #423a2d; }
.gap-calendar { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 3px; margin: 10px 0 16px; }
.gap-calendar > small { padding: 4px 0; text-align: center; color: var(--muted); }
.gap-date { display: grid; align-content: center; justify-items: center; min-height: 46px; border: 0; border-radius: 7px; background: var(--panel); color: var(--ink); }
.gap-date:has(small) { background: var(--alert-bg); color: var(--alert); }
.gap-date small { font-weight: 650; line-height: 1.2; }
.schedule-version-bar { margin-top: 22px; border-top: 1px solid var(--line); }
#phone-tabs { position: fixed; z-index: 5; bottom: 0; inset-inline: 0; display: flex; justify-content: center; padding: 4px 6px calc(5px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); }
#phone-tabs button { flex: 1; max-width: 220px; display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 48px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: 550 14px/1.2 system-ui,sans-serif; }
#phone-tabs [aria-current] { background: var(--sage); color: var(--forest); font-weight: 700; }
.tab-icon { display: inline-block; position: relative; width: 15px; height: 14px; }
.icon-day { background: repeating-linear-gradient(to bottom, currentColor 0 1.3px, transparent 1.3px 5px) right center / 11px 12px no-repeat, repeating-linear-gradient(to bottom,currentColor 0 1.3px,transparent 1.3px 5px) left center / 1.5px 12px no-repeat; }
.icon-week, .icon-gaps { border: 1.4px solid currentColor; border-radius: 2px; }
.icon-week::before { content: ''; position: absolute; inset: 0 3px; border-inline: 1px solid currentColor; }
.icon-gaps { margin-top: 1px; height: 13px; background: linear-gradient(currentColor,currentColor) 0 3px / 100% 1px no-repeat; }
.icon-gaps::before { content: ''; position: absolute; inset: -3px 3px auto; height: 4px; border-inline: 1px solid currentColor; }
.icon-gaps::after { content: ''; position: absolute; inset: 6px 2px 1px; background: radial-gradient(currentColor .8px,transparent 1px) 0 0 / 4px 3px; }
.button-primary { background: var(--forest); color: var(--active-ink); }
.button-primary:hover:not(:disabled) { background: #cae0cb; }
.button-secondary:hover, .button-text:hover:not(:disabled), .role-group summary:hover { background: var(--sage); }
.role-count { background: var(--sage); }
#team-page .role-marker { background: var(--role-tint); }
dialog::backdrop { background: #0c140dd1; }
.form-fields input, .shift-note-entry input { background: var(--paper); border-color: var(--line); }
dialog :is(input,select):not([type="checkbox"]), .standard-overview { border-color: var(--line); }
.standard-overview, .forecast-staffing, #rotation-result[data-met="true"] { color: var(--ink); background: var(--sage); }
#rotation-result, .form-error, .team-error { color: var(--alert); background: var(--alert-bg); }
.button.history-delete { color: var(--alert); }
.calendar-grid { --muted: #b7c1b7; }
.calendar-grid thead th, .day-totals :is(th,td) { background: var(--panel); }
.calendar-grid .schedule-group :is(th,td) { background: var(--sage); }
.calendar-grid tbody td.weekend { background: #2b3635; }
.calendar-grid tbody td.holiday, .calendar-grid .role-gap-day { background: var(--alert-bg); }
.calendar-grid .calendar-date:hover { background: var(--sage); color: var(--ink); }
.calendar-grid .extra-total { color: #c2dae6; }
.calendar-grid .shift-target-mismatch, .calendar-grid .streak-label { color: var(--alert); }

@media (max-width: 620px) {
  .schedule-toolbar .schedule-filters { grid-template-columns: auto minmax(0,1.2fr) auto minmax(0,1fr); }
  .schedule-filters label[for="role-filter"] { grid-column: auto; padding-left: 3px; }
  .schedule-filters select { min-height: 40px; }
  .button, dialog select { min-height: 44px; white-space: normal; }
  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 { 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; }
}
@media (max-width: 360px) {
  .brand-inner { width: calc(100% - 20px); gap: 4px; }
  .brand-name { font-size: 20px; }
  .brand-mark { width: 23px; }
  .brand-divider { display: none; }
  #phone-kind { padding-inline: 4px; }
  .menu-dots { padding-left: 4px; letter-spacing: 0; }
  .app-nav button { font-size: 12px; padding-inline: 2px; }
  .schedule-toolbar .schedule-filters { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 3px 8px; }
  .schedule-filters label[for="role-filter"] { grid-column: 2; grid-row: 1; padding: 0; }
  .schedule-filters select { grid-row: 2; }
}
