:root {
  color-scheme: light;
  --bg: #f3f7fb;
  --surface: #ffffff;
  --surface-2: #ecf5fb;
  --line: #d7e3ee;
  --line-strong: #bdccdb;
  --text: #142130;
  --muted: #5d6e82;
  --blue: #1769cf;
  --blue-soft: #e4f0ff;
  --green: #078566;
  --green-soft: #dff7ef;
  --violet: #6853d7;
  --violet-soft: #eeeafd;
  --cyan: #057990;
  --cyan-soft: #ddf6fb;
  --pink: #b22e6b;
  --pink-soft: #fde7f1;
  --orange: #c85600;
  --orange-soft: #fff0d9;
  --duty: #4f46e5;
  --duty-soft: #edf0ff;
  --amber: #9d6500;
  --amber-soft: #fff4dc;
  --red: #b92d3a;
  --red-soft: #ffe8eb;
  --gray-chip: #edf2f6;
  --off-bg: #dde5ed;
  --shadow: 0 14px 34px rgba(31, 48, 68, 0.09);
  --shadow-hover: 0 18px 42px rgba(31, 48, 68, 0.14);
  --focus-ring: 0 0 0 4px rgba(23, 105, 207, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  background:
    linear-gradient(180deg, #ffffff 0, #f5fbff 230px, var(--bg) 560px),
    repeating-linear-gradient(90deg, rgba(23, 105, 207, 0.035) 0 1px, transparent 1px 92px);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: geometricPrecision;
}

button,
select,
input {
  font: inherit;
}

input:not([type="checkbox"]) {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

a {
  color: inherit;
}

.app-shell {
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 20px 16px 46px;
}

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px 0 17px;
  border-bottom: 1px solid rgba(189, 204, 219, 0.7);
}

.topbar::after {
  position: absolute;
  right: 0;
  bottom: -2px;
  left: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--blue) 42%, var(--violet) 72%, var(--orange));
  content: "";
}

.brand-block {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 20px;
}

.brand-logo-link {
  display: inline-flex;
  flex: 0 0 auto;
  width: clamp(160px, 18vw, 245px);
  height: clamp(92px, 10vw, 136px);
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  text-decoration: none;
}

.brand-logo-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 13px 22px rgba(20, 44, 65, 0.14));
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3.5vw, 2.55rem);
  line-height: 1.03;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 14px;
  font-size: 1.12rem;
}

h3 {
  margin: 0;
  font-size: 1rem;
}

.muted {
  color: var(--muted);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.header-actions select,
.header-actions .button {
  width: 176px;
  min-width: 176px;
}

.header-actions .button {
  height: 42px;
  min-height: 42px;
}

.select-label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

select {
  min-width: 170px;
  height: 42px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 18px) 18px / 6px 6px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 12px) 18px / 6px 6px no-repeat,
    var(--surface);
  color: var(--text);
  appearance: none;
}

.button,
.chip-button,
.tab-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-weight: 800;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.button-primary {
  border-color: var(--blue);
  background: linear-gradient(135deg, var(--blue), #0f7a8f);
  box-shadow: 0 10px 22px rgba(23, 105, 207, 0.2);
  color: white;
}

.button:hover,
.person-chip:hover {
  transform: translateY(-1px);
}

.button:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 18px rgba(31, 48, 68, 0.1);
}

.button-primary:hover {
  border-color: #0f7a8f;
  box-shadow: 0 12px 25px rgba(23, 105, 207, 0.24);
}

.button:focus-visible,
.person-chip:focus-visible,
.sort-button:focus-visible,
select:focus-visible,
input:focus-visible,
.brand-logo-link:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring);
}

.control-band,
.stats-panel,
.summary-grid,
.view-content {
  margin-top: 14px;
}

.control-band {
  display: grid;
  gap: 12px;
  align-self: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 253, 0.94)),
    var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.control-title {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.people-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-button,
.person-chip,
.tab-button {
  flex: 0 0 auto;
}

.chip-button,
.tab-button {
  padding: 0 12px;
  color: var(--muted);
  font-weight: 800;
}

.chip-button.active,
.tab-button.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.84) inset;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.all-chip {
  justify-content: center;
  width: 100%;
  color: var(--blue);
}

.none-chip {
  justify-content: center;
  width: 100%;
}

.procedure-chip {
  justify-content: center;
  width: 100%;
  border-color: rgba(201, 92, 0, 0.28);
  color: var(--orange);
}

.procedure-chip.selected {
  border-color: rgba(201, 92, 0, 0.52);
  background: var(--orange-soft);
  color: var(--orange);
}

.person-chip input {
  accent-color: var(--blue);
}

.person-chip.selected {
  border-color: rgba(11, 143, 106, 0.55);
  background: var(--green-soft);
  color: #075e48;
  box-shadow: 0 7px 16px rgba(7, 133, 102, 0.12);
}

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

.metric-card,
.stats-panel,
.panel,
.day-card,
.month-cell,
.person-row,
.download-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(31, 48, 68, 0.055);
}

.metric-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  content: "";
}

.stats-panel {
  padding: 14px;
  box-shadow: var(--shadow);
}

.stats-head {
  display: grid;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.stats-head h2,
.stats-head p {
  margin: 0;
}

.stats-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.metric-value {
  display: block;
  margin-bottom: 4px;
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 850;
}

.metric-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.metric-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
}

.view-content {
  display: grid;
  gap: 12px;
  margin-top: 0;
}

.panel {
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 252, 254, 0.92)),
    var(--surface);
  box-shadow: var(--shadow);
}

.month-panel {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.day-list,
.people-list,
.download-grid {
  display: grid;
  gap: 10px;
}

.day-card {
  display: grid;
  gap: 12px;
  padding: 13px;
  box-shadow: 0 8px 20px rgba(31, 48, 68, 0.045);
}

.day-card.non-working {
  background: linear-gradient(180deg, #e8eef4, var(--off-bg));
}

.day-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.date-title {
  display: grid;
  gap: 2px;
}

.date-number {
  font-size: 1.04rem;
  font-weight: 850;
}

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

.entry-row {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.entry-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 850;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--gray-chip);
  color: #445163;
  font-size: 0.76rem;
  font-weight: 800;
}

.pill.brunico {
  background: var(--blue-soft);
  color: #1454a5;
}

.pill.bressanone {
  background: var(--green-soft);
  color: #086b50;
}

.pill.bd {
  background: var(--duty-soft);
  color: var(--duty);
}

.pill.absence {
  background: var(--red-soft);
  color: var(--red);
}

.pill.note {
  background: #edf1f5;
  color: #435365;
}

.detail-text,
.note-text {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(126px, 1fr));
  gap: 11px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.weekday-label {
  padding: 5px 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-align: center;
}

.month-cell {
  position: relative;
  min-height: 154px;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 252, 254, 0.94)),
    var(--surface);
  box-shadow: 0 8px 20px rgba(31, 48, 68, 0.045);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  overflow: visible;
}

.month-cell:not(.empty):hover {
  border-color: rgba(30, 111, 217, 0.32);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.month-cell.non-working {
  background: linear-gradient(180deg, #e8eef4, var(--off-bg));
}

.month-cell.single-absence-day {
  background: linear-gradient(180deg, #e8eef4, var(--off-bg));
}

.month-cell.empty {
  visibility: hidden;
}

.month-cell.today {
  border-color: var(--blue);
  box-shadow:
    inset 0 0 0 1px var(--blue),
    0 12px 28px rgba(23, 105, 207, 0.15);
}

.month-cell.today::before {
  position: absolute;
  top: 0;
  right: 10px;
  left: 10px;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  content: "";
}

.month-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.month-title h2,
.month-title p {
  margin: 0;
}

.month-entry {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #445163;
  background: var(--gray-chip);
  font-size: 0.76rem;
  font-weight: 850;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
  cursor: default;
}

.month-entry[data-tooltip] {
  cursor: pointer;
}

.floating-tooltip {
  position: fixed;
  z-index: 100000;
  max-width: min(280px, calc(100vw - 16px));
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.28);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
  pointer-events: none;
}

.month-entry.brunico {
  color: #1454a5;
  background: var(--blue-soft);
  border-color: rgba(23, 105, 207, 0.13);
}

.month-entry.bressanone {
  color: #086b50;
  background: var(--green-soft);
  border-color: rgba(7, 133, 102, 0.13);
}

.month-entry.reperibilita {
  color: var(--duty);
  background: var(--duty-soft);
  border-color: rgba(79, 70, 229, 0.13);
}

.month-entry.time,
.month-entry.extra {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(157, 101, 0, 0.14);
}

.month-entry.innichen {
  color: var(--violet);
  background: var(--violet-soft);
  border-color: rgba(104, 83, 215, 0.13);
}

.month-entry.sterzing {
  color: var(--cyan);
  background: var(--cyan-soft);
  border-color: rgba(5, 121, 144, 0.13);
}

.month-entry.absence {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(185, 45, 58, 0.13);
}

.month-entry.group {
  display: grid;
  gap: 3px;
  justify-items: start;
  font-size: 0.78rem;
  text-align: left;
  white-space: normal;
}

.month-entry.group strong {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
}

.capacity-warning {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 16px;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1;
  transform: translateY(-1px);
}

.capacity-warning::before {
  position: absolute;
  inset: 0;
  background: #dc2626;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  content: "";
}

.capacity-warning span {
  position: relative;
  z-index: 1;
  padding-top: 4px;
}

.month-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
}

.month-day-head strong {
  color: var(--text);
  font-size: 1.05rem;
}

.month-lines {
  display: grid;
  gap: 1px;
}

.note-pill {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 7px;
  background: #eef1f5;
  color: #435365;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.25;
}

.note-pill.meeting {
  background: var(--violet-soft);
  color: var(--violet);
}

.note-pill.ivf_fag {
  background: var(--orange-soft);
  color: var(--orange);
}

.note-pill.fam {
  background: var(--cyan-soft);
  color: var(--cyan);
}

.note-pill.famulatur_start,
.note-pill.famulatur_end {
  background: var(--pink-soft);
  color: var(--pink);
}

.stats-chart {
  display: grid;
  gap: 9px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.chart-row {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.chart-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eef5;
  box-shadow: inset 0 1px 2px rgba(31, 48, 68, 0.08);
}

.chart-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gray-chip);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transition: width 180ms ease;
}

.chart-bar.brunico {
  background: var(--blue);
}

.chart-bar.bressanone {
  background: var(--green);
}

.chart-bar.innichen {
  background: var(--violet);
}

.chart-bar.sterzing {
  background: var(--cyan);
}

.chart-bar.reperibilita {
  background: var(--duty);
}

.chart-bar.extra {
  background: var(--amber);
}

.chart-bar.absence {
  background: var(--red);
}

.chart-bar.violet {
  background: var(--violet);
}

.dashboard-layout {
  display: grid;
  gap: 14px;
  align-items: start;
}

body[data-page="stats"] .dashboard-layout {
  grid-template-columns: minmax(0, 1fr);
}

body[data-page="stats"] .control-band {
  display: none;
}

.main-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.stats-page-panel {
  display: grid;
  gap: 18px;
}

.page-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.page-title-row h2,
.page-title-row p {
  margin: 0;
}

.stats-subsection {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(241, 247, 251, 0.78)),
    rgba(246, 248, 251, 0.72);
}

.annual-summary {
  margin-top: 0;
}

.annual-chart-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.annual-chart-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 252, 254, 0.94)),
    var(--surface);
  box-shadow: 0 9px 22px rgba(30, 45, 62, 0.065);
}

.annual-chart-card h3 {
  margin-bottom: 10px;
}

.annual-chart {
  display: grid;
  gap: 8px;
}

.chart-row.annual {
  grid-template-columns: 96px minmax(0, 1fr) 38px;
}

.annual-table {
  margin-top: 14px;
}

.export-section {
  display: grid;
  gap: 12px;
}

.export-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.export-compact h2 {
  margin: 0;
}

.export-actions {
  display: flex;
  gap: 8px;
}

.export-all {
  flex-basis: 100%;
  margin-top: 0;
}

.export-all[hidden] {
  display: none;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.rank-cell {
  color: var(--muted);
  font-weight: 850;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.sort-button.active {
  color: var(--blue);
}

.person-row,
.download-card {
  display: grid;
  gap: 8px;
  padding: 12px;
}

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

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 759px) {
  html,
  body {
    background: var(--bg);
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .app-shell {
    width: 100%;
    margin: 0 auto;
    padding: 10px 8px 34px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px 0 10px;
  }

  .brand-block {
    align-items: flex-start;
    gap: 10px;
  }

  .brand-logo-link {
    width: min(42vw, 156px);
    height: 104px;
  }

  .eyebrow {
    margin-bottom: 5px;
    font-size: 0.76rem;
  }

  h1 {
    font-size: 1.45rem;
    line-height: 1.08;
  }

  h2 {
    font-size: 1.04rem;
  }

  .muted {
    font-size: 0.78rem;
  }

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

  .header-actions .select-label,
  .header-actions select,
  .header-actions .button {
    min-width: 0;
    width: 100%;
  }

  .button,
  .person-chip {
    min-height: 38px;
  }

  .control-band {
    position: sticky;
    z-index: 30;
    top: 0;
    gap: 10px;
    margin-top: 14px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
  }

  .control-title {
    display: block;
  }

  .people-picker {
    display: flex;
    flex-wrap: nowrap;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .all-chip,
  .none-chip,
  .person-chip {
    width: auto;
    white-space: nowrap;
  }

  .person-chip {
    padding: 0 9px;
    font-size: 0.76rem;
  }

  .person-chip input {
    width: 13px;
    height: 13px;
  }

  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .main-column {
    gap: 12px;
  }

  .panel {
    padding: 12px;
    box-shadow: var(--shadow);
  }

  .month-panel,
  .stats-subsection,
  .annual-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .month-title {
    position: static;
    margin-bottom: 12px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .month-title h2 {
    width: auto;
    margin-bottom: 2px;
  }

  .month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(136px, 1fr));
    min-width: 980px;
    gap: 7px;
    overflow: visible;
    padding-bottom: 0;
  }

  .weekday-label {
    display: block;
  }

  .month-cell {
    min-height: 136px;
    padding: 7px;
    border-radius: 8px;
  }

  .month-cell.empty {
    display: block;
    visibility: hidden;
  }

  .month-cell.non-working {
    background: var(--off-bg);
  }

  .month-cell.single-absence-day {
    background: var(--off-bg);
  }

  .month-day-head {
    margin-bottom: 4px;
  }

  .month-day-head strong {
    font-size: 1rem;
  }

  .month-day-head span {
    font-size: 0.78rem;
  }

  .month-lines {
    gap: 0;
  }

  .month-entry,
  .note-pill {
    margin-top: 5px;
    padding: 6px 7px;
    font-size: 0.7rem;
    line-height: 1.2;
  }

  .month-entry.group {
    gap: 2px;
    font-size: 0.7rem;
  }

  .month-entry.group strong {
    font-size: 0.68rem;
  }

  .export-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
  }

  .export-actions {
    gap: 8px;
  }

  .export-actions .button {
    padding: 0 14px;
  }

  .export-all {
    flex-basis: 100%;
  }

  .export-all .button {
    min-height: 36px;
    padding: 0 11px;
    font-size: 0.76rem;
  }

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

  .metric-card,
  .stats-subsection,
  .annual-chart-card {
    padding: 10px;
  }

  .metric-value {
    font-size: 1.22rem;
  }

  .metric-label,
  .metric-hint {
    font-size: 0.74rem;
  }

  .chart-row,
  .chart-row.annual {
    grid-template-columns: 82px minmax(0, 1fr) 28px;
    gap: 8px;
    font-size: 0.74rem;
  }

  .annual-chart-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-width: 980px;
    gap: 8px;
  }

  table {
    min-width: 980px;
  }

  th,
  td {
    padding: 8px 7px;
  }
}

@media (min-width: 760px) {
  .app-shell {
    padding: 26px 24px 56px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .dashboard-layout {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .control-band {
    position: sticky;
    top: 16px;
  }

  .people-picker {
    display: grid;
    grid-template-columns: 1fr;
  }

  .person-chip {
    width: 100%;
  }

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

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

  .download-grid,
  .export-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (min-width: 760px) and (max-width: 1039px) {
  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .control-band {
    position: sticky;
    z-index: 30;
    top: 0;
    background: rgba(255, 255, 255, 0.94);
  }

  .people-picker {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .person-chip,
  .all-chip,
  .none-chip,
  .procedure-chip {
    width: auto;
    white-space: nowrap;
  }

  .month-panel,
  .stats-subsection,
  .annual-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .month-grid {
    min-width: 980px;
    overflow: visible;
  }

  .annual-chart-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-width: 980px;
  }

  table {
    min-width: 980px;
  }
}

@media (min-width: 1040px) {
  .summary-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .annual-chart-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@page {
  size: A4 landscape;
  margin: 5mm;
}

@media print {
  html,
  body {
    width: 270mm;
    max-width: 270mm;
    height: 185mm;
    background: white;
    margin: 0 auto;
    overflow: hidden;
  }

  .control-band,
  .header-actions,
  .topbar,
  #exportSection,
  .stats-panel,
  .floating-tooltip {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .dashboard-layout,
  body[data-page="stats"] .dashboard-layout {
    display: block;
  }

  .main-column {
    display: block;
  }

  .panel,
  .month-panel {
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .month-title {
    position: static;
    margin: 0 0 1mm;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .month-title h2 {
    font-size: 9pt;
    line-height: 1;
  }

  .month-title .muted {
    display: none;
  }

  .month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: 4mm repeat(6, minmax(0, 28mm));
    gap: 0.75mm;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding-bottom: 0;
  }

  .month-grid.weeks-4 {
    grid-template-rows: 4mm repeat(4, minmax(0, 42mm));
  }

  .month-grid.weeks-5 {
    grid-template-rows: 4mm repeat(5, minmax(0, 34mm));
  }

  .month-grid.weeks-6 {
    grid-template-rows: 4mm repeat(6, minmax(0, 28mm));
  }

  .weekday-label {
    display: block;
    color: #4b5563;
    font-size: 6.2pt;
    line-height: 1;
  }

  .month-cell {
    min-height: 0;
    height: auto;
    min-width: 0;
    overflow: hidden;
    padding: 0.75mm;
    border-radius: 1.5mm;
  }

  .month-cell.empty {
    display: block;
    visibility: hidden;
  }

  .month-entry,
  .note-pill {
    margin-top: 0.45mm;
    padding: 0.45mm 0.65mm;
    border-radius: 1mm;
    font-size: 4.7pt;
    line-height: 1.02;
  }

  .month-entry.group {
    gap: 0.2mm;
    font-size: 4.45pt;
  }

  .month-entry.group strong {
    font-size: 4.35pt;
  }

  .month-grid.all-selected .month-entry.group {
    display: block;
    white-space: normal;
  }

  .month-grid.all-selected .month-entry.group > strong,
  .month-grid.all-selected .month-entry.group > span {
    display: inline;
  }

  .month-grid.all-selected .month-entry.group strong::after {
    content: " ";
  }

  .month-grid.all-selected .month-entry.group > span:not(:last-child)::after {
    content: ", ";
  }

  .month-grid.all-selected .month-entry.group .capacity-warning {
    display: inline-flex;
    width: 8pt;
    height: 7pt;
    font-size: 4pt;
  }

  .month-day-head {
    margin-bottom: 0.45mm;
  }

  .month-day-head strong {
    font-size: 7pt;
  }

  .month-day-head span {
    font-size: 6.2pt;
  }

  .panel,
  .day-card,
  .month-cell {
    box-shadow: none;
    break-inside: avoid;
  }
}
