.schedule-filters,
.schedule-nav,
.schedule-period,
.schedule-stat-top,
.schedule-legend-types,
.schedule-legend-item {
  display: flex;
  align-items: center;
}

.schedule-primary,
.schedule-secondary,
.schedule-icon-button,
.schedule-today-button,
.schedule-select,
.schedule-mode button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background-color: var(--surface);
  font: inherit;
  font-size: .875rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.schedule-secondary:hover,
.schedule-icon-button:hover,
.schedule-today-button:hover,
.schedule-mode button:hover {
  background: var(--soft);
}

.schedule-primary,
.view-heading-actions .schedule-secondary {
  min-height: 42px;
  padding: 8px 14px;
  border-color: transparent;
  background: #d9ff48;
  color: #17200c;
}

.schedule-primary:hover,
.view-heading-actions .schedule-secondary:hover {
  background: #c9ef3a;
}

.view-heading-actions .schedule-catalog-trigger {
  border-color: var(--line);
  color: var(--text);
  background: var(--surface);
}

.view-heading-actions .schedule-catalog-trigger:hover {
  background: var(--soft);
}

.schedule-primary:disabled,
.schedule-secondary:disabled {
  opacity: .55;
  cursor: wait;
}

.schedule-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 22px;
}

.schedule-today-stats {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.schedule-stat,
.schedule-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.schedule-stat {
  padding: 16px 18px;
}

.schedule-stat-top {
  gap: 10px;
  color: var(--text);
  font-size: .875rem;
  font-weight: 650;
}

.schedule-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 10px;
  color: var(--shift-ink, var(--text));
  background: var(--shift-bg, var(--soft));
}

.schedule-stat-value {
  margin-top: 11px;
  color: var(--text);
  font-size: clamp(1.7rem, 3vw, 2.15rem);
  font-weight: 760;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.05em;
}

.schedule-stat-subtitle {
  margin-top: 7px;
  color: var(--muted);
  font-size: .8rem;
}

[data-shift="office"] { --shift-bg: #e8f4cb; --shift-ink: #3d5722; --shift-dot: #77a13e; }
[data-shift="remote"] { --shift-bg: #eee7fb; --shift-ink: #644583; --shift-dot: #9272bc; }
[data-shift="field"] { --shift-bg: #e4effb; --shift-ink: #355a81; --shift-dot: #5e8bc0; }
[data-shift="fixed"] { --shift-bg: #f9edd7; --shift-ink: #764e1c; --shift-dot: #bd8841; }
[data-shift="training"] { --shift-bg: #f9e6f4; --shift-ink: #80396e; --shift-dot: #b567a5; }
[data-shift="vacation"] { --shift-bg: #e1f3ed; --shift-ink: #376757; --shift-dot: #589781; }
[data-shift="sick"] { --shift-bg: #fbe6e7; --shift-ink: #8d4148; --shift-dot: #bd747d; }
[data-shift="off"] { --shift-bg: var(--soft); --shift-ink: var(--muted); --shift-dot: var(--muted); }

:is([data-theme="dark"], .dark) [data-shift="office"] { --shift-bg: #34442b; --shift-ink: #d8ecb3; --shift-dot: #9dc267; }
:is([data-theme="dark"], .dark) [data-shift="remote"] { --shift-bg: #3e324f; --shift-ink: #e8d4ff; --shift-dot: #b291da; }
:is([data-theme="dark"], .dark) [data-shift="field"] { --shift-bg: #2a4057; --shift-ink: #c9e6ff; --shift-dot: #92bdee; }
:is([data-theme="dark"], .dark) [data-shift="fixed"] { --shift-bg: #493b28; --shift-ink: #ffdfa8; --shift-dot: #d9a660; }
:is([data-theme="dark"], .dark) [data-shift="training"] { --shift-bg: #4a2d49; --shift-ink: #faccee; --shift-dot: #d799ca; }
:is([data-theme="dark"], .dark) [data-shift="vacation"] { --shift-bg: #294239; --shift-ink: #baecdb; --shift-dot: #81b9a7; }
:is([data-theme="dark"], .dark) [data-shift="sick"] { --shift-bg: #4a2d37; --shift-ink: #ffd3d9; --shift-dot: #e492a0; }

.schedule-toolbar,
.schedule-legend,
.schedule-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 17px;
}

.schedule-toolbar {
  flex-wrap: wrap;
}

.schedule-calendar-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) fit-content(50%);
  align-items: start;
}

.schedule-calendar-period {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: start;
}

.schedule-calendar-toolbar .schedule-filters {
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.schedule-period,
.schedule-filters,
.schedule-nav {
  gap: 8px;
}

.schedule-period h2 {
  margin: 0 5px 0 2px;
  font-size: 1rem;
  color: var(--text);
}

.schedule-calendar-period h2 {
  margin: 0;
  padding-block: 8px;
  overflow-wrap: anywhere;
}

.schedule-icon-button {
  min-width: 34px;
  padding: 0;
}

.schedule-select,
.schedule-form select {
  padding-right: 28px;
}

.schedule-select {
  min-width: 0;
  text-overflow: ellipsis;
}

.schedule-icon-button svg {
  width: 16px;
  height: 16px;
}

.schedule-mode {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--soft);
}

.schedule-mode button {
  min-height: 30px;
  padding-block: 4px;
  border-color: transparent;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
}

.schedule-mode .selected {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.schedule-legend {
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
}

.schedule-legend-types {
  flex-wrap: wrap;
  gap: 8px 15px;
}

.schedule-legend-item {
  gap: 6px;
  color: var(--muted);
  font-size: .81rem;
  white-space: nowrap;
}

.shift-dot {
  display: inline-block;
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--shift-dot);
}

.schedule-search {
  display: flex;
  gap: 4px;
}

.schedule-search input,
.schedule-form input,
.schedule-form textarea,
.schedule-form select,
.schedule-comment-form input {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background-color: var(--surface);
  font: inherit;
}

.schedule-search input {
  width: min(185px, 100%);
  font-size: .84rem;
}

.schedule-scroll {
  max-width: 100%;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.schedule-table {
  width: 100%;
  min-width: 820px;
  border-spacing: 0;
  font-size: .84rem;
}

.schedule-table.schedule-month {
  min-width: max(100%, 2880px);
}

.schedule-table th,
.schedule-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.schedule-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 186px;
  box-sizing: border-box;
  padding-inline: 13px;
  background: var(--surface);
  text-align: left;
}

.schedule-table thead th {
  padding: 7px 3px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 600;
}

.schedule-table thead th:first-child {
  background: var(--soft);
}

.schedule-table :is(th, td):last-child {
  border-right: 0;
}

.schedule-day-name,
.schedule-day-number {
  display: block;
}

.schedule-day-name {
  text-transform: uppercase;
  font-size: .69rem;
  letter-spacing: .03em;
}

.schedule-day-number {
  margin-top: 3px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 730;
}

.schedule-table :is(th, td).schedule-weekend {
  background: var(--soft);
}

.schedule-table :is(th, td).schedule-today {
  background: color-mix(in srgb, #d9ff48 12%, var(--surface));
}

.schedule-today .schedule-day-number {
  display: inline-grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 8px;
  color: #17200c;
  background: #d9ff48;
}

.schedule-person {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 0;
  border: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.schedule-person > span:last-child {
  min-width: 0;
  overflow: hidden;
}

.schedule-person strong,
.schedule-person small,
.schedule-dialog-person strong,
.schedule-dialog-person small {
  display: block;
}

.schedule-person strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-person:hover strong {
  text-decoration: underline;
}

.schedule-person small,
.schedule-dialog-person small {
  margin-top: 2px;
  color: var(--muted);
  font-size: .73rem;
  font-weight: 500;
}

.schedule-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 24px 16px;
  align-content: center;
  width: 100%;
  min-width: 83px;
  min-height: 55px;
  padding: 6px 5px;
  gap: 2px;
  place-items: center;
  border: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.schedule-cell:hover {
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.schedule-cell-activity {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: .74rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-cell-detail {
  display: flex;
  min-width: 0;
  max-width: min(100%, 112px);
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.schedule-cell > .shift-badge {
  line-height: 1.2;
  padding-block: 4px;
}

.schedule-cell > .schedule-empty + .schedule-cell-detail:empty { display: none; }
.schedule-cell:has(.schedule-empty + .schedule-cell-detail:empty) > .schedule-empty {
  grid-row: 1 / -1;
}

.schedule-cell:focus-visible {
  outline-offset: -2px;
}

.shift-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 7px;
  color: var(--shift-ink);
  background: var(--shift-bg);
  font-size: .75rem;
  font-weight: 650;
  white-space: nowrap;
}

.shift-badge .shift-dot {
  flex-basis: 5px;
  width: 5px;
  height: 5px;
}

.schedule-cell-mark {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: .65rem;
}

.schedule-cell-mark svg {
  width: 12px;
  height: 12px;
}

.schedule-empty,
.schedule-no-people,
.schedule-card-footer,
.schedule-comment-empty {
  color: var(--muted);
}

.schedule-no-people {
  height: 84px;
}

.schedule-card-footer {
  font-size: .78rem;
}

.schedule-dialog,
.schedule-form {
  display: grid;
  gap: 13px;
}

.schedule-dialog-person {
  display: flex;
  align-items: center;
  gap: 10px;
}

.schedule-dialog-person :is(.shift-badge, .schedule-empty) {
  margin-inline-start: auto;
}

.schedule-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
  font-size: .875rem;
  font-weight: 600;
}

.schedule-form textarea {
  resize: vertical;
}

.schedule-form-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.schedule-dialog-actions {
  display: flex;
  justify-content: flex-end;
}

.schedule-form .schedule-form-check,
.schedule-activity-actions,
.schedule-shift-activity-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.schedule-form-check input {
  accent-color: var(--accent);
}

.schedule-form[data-custom-activity] {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--soft);
}

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

.schedule-activity-detail,
.schedule-activity-list li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.schedule-activity-detail p,
.schedule-activity-list p {
  color: var(--muted);
  font-size: .875rem;
  overflow-wrap: anywhere;
}

.schedule-activity-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.schedule-activity-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.schedule-activity-list strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.schedule-reactions,
.schedule-comment-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.schedule-reactions {
  flex-wrap: wrap;
}

.schedule-reactions button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.schedule-reactions button[data-locked] {
  cursor: default;
}

.schedule-task-link {
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  color: var(--text);
  font-size: .875rem;
}

.schedule-comments h3 {
  margin: 0 0 8px;
  font-size: .94rem;
}

.schedule-comments p,
.schedule-shift-note p {
  margin: 0 0 7px;
}

.schedule-comment {
  margin-bottom: 7px;
  padding: 9px;
  border-radius: 8px;
  background: var(--soft);
}

.schedule-comment > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
}

.schedule-comment p,
.schedule-shift-note p {
  margin-top: 5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.schedule-comment small {
  color: var(--muted);
}

.schedule-comment-form input {
  flex: 1;
}

.schedule-swap-box,
.schedule-swap-note {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--soft);
}

.schedule-swap-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}

.schedule-swap-box p,
.schedule-swap-note {
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
}

.schedule-form-error {
  margin: 0;
  color: var(--danger, #cc4b61);
  font-size: .85rem;
}

.schedule-form-error:empty,
.schedule-shift-note:empty {
  display: none;
}

.stats-toolbar {
  margin-bottom: 16px;
}

.stats-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.stats-layout > section {
  padding: 16px;
}

.stats-layout h2 {
  margin: 0 0 13px;
  font-size: 1.05rem;
}

.stats-line + .stats-line {
  margin-top: 10px;
}

.stats-line > div:first-child {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .85rem;
}

.stats-track {
  height: 7px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--soft);
}

.stats-fill {
  display: block;
  height: 100%;
  border-radius: 8px;
  background: var(--shift-dot);
}

.stats-people article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  border-bottom: 1px solid var(--line);
  font-size: .87rem;
}

.stats-people article > strong {
  white-space: nowrap;
}

@media (max-width: 850px) {
  .schedule-calendar-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .schedule-calendar-toolbar .schedule-filters {
    justify-content: flex-start;
  }

  .schedule-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .schedule-today-stats .schedule-stat:last-child {
    grid-column: span 2;
  }
}

@media (max-width: 620px) {
  .schedule-view-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .schedule-stat {
    padding: 12px 10px;
  }

  .schedule-stat-top {
    gap: 6px;
    font-size: .8rem;
  }

  .schedule-stat .schedule-icon {
    width: 28px;
    height: 28px;
  }

  .schedule-toolbar,
  .schedule-legend,
  .schedule-card-footer {
    padding-inline: 10px;
  }

  .schedule-period {
    flex-wrap: wrap;
  }

  .schedule-filters {
    max-width: 100%;
  }

  .schedule-icon-button,
  .schedule-today-button {
    min-width: 40px;
    min-height: 40px;
  }

  .schedule-period h2 {
    flex: 1;
  }

  .schedule-legend-types {
    gap: 6px 9px;
  }

  .schedule-table {
    min-width: 710px;
  }

  .schedule-table th:first-child {
    width: 129px;
    padding-inline: 7px;
  }

  .schedule-person {
    gap: 5px;
  }

  .schedule-person strong {
    max-width: 84px;
  }

  .stats-layout {
    grid-template-columns: 1fr;
  }

  .stats-people .schedule-person strong {
    max-width: none;
  }

  .schedule-activity-list li {
    grid-template-columns: 1fr;
  }
}

.schedule-role {
  display: inline-flex; width: fit-content; max-width: 100%; padding: 2px 6px;
  border-radius: 6px; background: var(--soft); color: var(--muted);
  font-size: .73rem; font-weight: 700; line-height: 1.3; white-space: normal; overflow-wrap: anywhere;
}
.schedule-role[data-role="lead"] { background: color-mix(in srgb, #a685ff 24%, var(--surface)); color: var(--text); }
.schedule-role[data-role="senior"] { background: color-mix(in srgb, #4bc7ea 23%, var(--surface)); color: var(--text); }
.stats-denominator { color: var(--muted); font-size: .84rem; margin-bottom: 7px; }
.stats-people article.stats-person-breakdown { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding-block: 12px; }
.stats-person-bar { display: flex; height: 8px; overflow: hidden; border-radius: 8px; background: var(--soft); }
.stats-person-bar .stats-fill { height: 100%; border-radius: 0; }
.stats-person-labels { display: flex; flex-wrap: wrap; gap: 4px 11px; }
.stats-person-labels .schedule-legend-item { font-size: .78rem; }

.schedule-table .schedule-team th {
  position: static;
  width: auto;
  padding: 8px 13px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 750;
}
.schedule-team th > span { position: sticky; left: 13px; }
.schedule-table .schedule-own > :is(th, td) {
  background: color-mix(in srgb, #a5ce48 18%, var(--surface));
  border-bottom-color: color-mix(in srgb, #79a63b 35%, var(--line));
}
.schedule-table .schedule-own > .schedule-today {
  background: color-mix(in srgb, #a5ce48 30%, var(--surface));
}
.schedule-own > th[scope="row"] { box-shadow: inset 4px 0 #83ad30; }
.schedule-self-label {
  display: inline-block;
  margin-right: 5px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--accent);
  color: #233015;
  font-size: .73rem;
  font-weight: 750;
}

.stats-toolbar :is(.schedule-filters, .schedule-mode) {
  max-width: 100%;
  flex-wrap: wrap;
}

.stats-toolbar .schedule-toolbar { align-items: flex-start; }
.stats-toolbar .stats-period {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: start;
  width: 100%;
  gap: 12px;
}
.stats-period .schedule-nav { justify-content: start; }
.stats-period h2 {
  align-self: start;
  margin: 0;
  padding-block: 8px;
  overflow-wrap: anywhere;
}
.stats-metric-title { color: var(--muted); font-size: .79rem; letter-spacing: 0; }
.stats-person-labels + .stats-metric-title { margin-top: 5px; }
.stats-contribution {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 6px;
  margin: 0;
}
.stats-contribution > div { padding: 6px 8px; border-radius: 8px; background: var(--soft); }
.stats-contribution dt,
.stats-contribution small { color: var(--muted); font-size: .76rem; }
.stats-contribution dd { display: grid; margin: 0; font-variant-numeric: tabular-nums; }
.stats-contribution strong { font-size: .97rem; }
