:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-soft: #eef3f2;
  --text: #202827;
  --muted: #6b7674;
  --line: #dce3e1;
  --line-strong: #c9d3d1;
  --accent: #087f79;
  --accent-dark: #05635f;
  --accent-soft: #dff2ef;
  --danger: #b5473d;
  --danger-soft: #f9e8e5;
  --shadow: 0 18px 50px rgba(28, 45, 42, 0.14);
  --radius: 12px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); }
body.overlay-open { overflow: hidden; }
button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid rgba(8, 127, 121, 0.28);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 16px;
  top: -60px;
  padding: 10px 14px;
  background: var(--text);
  color: #fff;
  border-radius: 8px;
  transition: top 160ms var(--ease);
}
.skip-link:focus { top: 12px; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  min-height: 72px;
  padding: 0 30px;
  border-bottom: 1px solid rgba(201, 211, 209, 0.8);
  background: rgba(245, 247, 246, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: max-content;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--text);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.brand-mark-large { width: 42px; height: 42px; font-size: 21px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: -0.015em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.main-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.68);
}
.main-nav a {
  position: relative;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
}
.main-nav a:hover { color: var(--text); }
.main-nav a[aria-current="page"] { color: var(--text); background: var(--surface); box-shadow: 0 1px 2px rgba(20, 35, 32, 0.09); }

.user-area { justify-self: end; display: flex; align-items: center; gap: 8px; }
.user-menu {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  text-align: left;
}
.avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}
.user-copy { max-width: 148px; min-width: 0; }
.user-copy strong, .user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: 12px; }
.user-copy small { margin-top: 2px; color: var(--muted); font-size: 10px; text-transform: capitalize; }

.workspace { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 46px 0 80px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 34px; }
.page-heading h1 { margin: 3px 0 8px; font-size: clamp(34px, 4vw, 54px); line-height: 1; letter-spacing: -0.05em; }
.page-heading .muted { max-width: 580px; }
.heading-actions { display: flex; align-items: flex-end; gap: 10px; }
.eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }
.muted { margin: 0; color: var(--muted); line-height: 1.55; }
.muted.compact { font-size: 12px; }

.button, .icon-button {
  border: 0;
  cursor: pointer;
  transition: transform 130ms var(--ease), color 160ms var(--ease), background-color 160ms var(--ease), border-color 160ms var(--ease), opacity 160ms var(--ease);
}
.button:active, .icon-button:active { transform: scale(0.97); }
.button:disabled, .icon-button:disabled { cursor: not-allowed; opacity: 0.46; }
.button { min-height: 40px; padding: 9px 14px; border-radius: 9px; font-size: 13px; font-weight: 750; }
.button-primary { background: var(--accent); color: #fff; box-shadow: 0 5px 15px rgba(8, 127, 121, 0.18); }
.button-primary:hover { background: var(--accent-dark); }
.button-quiet { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.button-quiet:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.button-danger { background: var(--danger-soft); color: var(--danger); }
.button-wide { width: 100%; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 18px; }
.icon-button:hover { background: var(--surface-soft); }

label > span, legend { display: block; margin-bottom: 7px; color: #44504e; font-size: 12px; font-weight: 700; }
label > span small { color: var(--muted); font-weight: 500; }
input, select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
input:hover, select:hover { border-color: #adbcb9; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 127, 121, 0.12); }
.compact-field { min-width: 156px; }
.compact-field span { margin-bottom: 5px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.compact-field input, .compact-field select { min-height: 40px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 0 22px; }
.freshness { margin: 0; color: var(--muted); font-size: 11px; white-space: nowrap; }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.section-heading h2 { margin: 0; font-size: 17px; letter-spacing: -0.02em; }
.count-label, .permission-note { color: var(--muted); font-size: 11px; }
.text-button { padding: 6px 0; border: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: 12px; font-weight: 750; }
.text-button:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }

.status-badge {
  --status-color: #667573;
  --status-bg: #edf1f0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: max-content;
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--status-bg);
  color: var(--status-color);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
[data-status="office"] { --status-color: #1b6c48; --status-bg: #e5f3ea; }
[data-status="remote"] { --status-color: #3569a8; --status-bg: #e7eef8; }
[data-status="vacation"] { --status-color: #875000; --status-bg: #f6d99b; }
[data-status="sick"] { --status-color: #9d2042; --status-bg: #efbec9; }
[data-status="business_trip"] { --status-color: #6d4ba1; --status-bg: #eee8f7; }
[data-status="field_work"] { --status-color: #8d3d1f; --status-bg: #eec4a8; }

.planning-controls { align-items: center; margin-bottom: 12px; padding: 8px 0 12px; border-bottom: 1px solid var(--line); }
.date-nav { display: flex; align-items: center; gap: 7px; }
.schedule-panel { margin-top: 0; }
.schedule-scroll {
  --person-column-width: 190px;
  --day-cell-width: 54px;
  --day-cell-height: 36px;
  --today-outline: #3e5bd9;
  position: relative;
  width: max-content;
  max-width: 100%;
  overflow: auto;
  max-height: 520px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  scrollbar-color: var(--line-strong) transparent;
}
.team-schedule-table {
  width: calc(var(--person-column-width) + var(--day-cell-width) * var(--day-count));
  min-width: calc(var(--person-column-width) + var(--day-cell-width) * var(--day-count));
  max-width: none;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.team-schedule-table th, .team-schedule-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.team-schedule-table tr > :last-child { border-right: 0; }
.team-schedule-table tbody tr:last-child > * { border-bottom: 0; }
.team-schedule-table thead th { position: sticky; z-index: 3; top: 0; height: var(--day-cell-height); background: #f8faf9; }
.team-person-heading, .team-person { position: sticky; z-index: 2; left: 0; width: var(--person-column-width); min-width: var(--person-column-width); max-width: var(--person-column-width); background: var(--surface); }
.team-person-heading { z-index: 4 !important; height: var(--day-cell-height); padding: 0 14px; color: var(--muted); font-size: 10px; letter-spacing: .07em; text-align: left; text-transform: uppercase; vertical-align: middle; }
.team-date { position: relative; width: var(--day-cell-width); min-width: var(--day-cell-width); max-width: var(--day-cell-width); height: var(--day-cell-height); padding: 2px 4px; text-align: center; vertical-align: middle; }
.team-date span, .team-date strong { display: block; }
.team-date span { color: var(--muted); font-size: 9px; font-weight: 750; line-height: 1; text-transform: uppercase; }
.team-date strong { margin-top: 1px; font-size: 14px; line-height: 1; font-variant-numeric: tabular-nums; }
.team-date.is-non-working, .team-schedule-cell.is-non-working {
  --status-color: #b5473d;
  --status-bg: rgba(181, 71, 61, .12);
  background: var(--status-bg);
}
.team-date.is-non-working span, .team-date.is-non-working strong { color: #9f4c45; }
.team-date.is-today { background: #e9edff; box-shadow: inset 0 0 0 2px var(--today-outline); }
.team-date.is-today span, .team-date.is-today strong { color: #3047b9; }
.team-person { height: var(--day-cell-height); padding: 3px 12px; text-align: left; vertical-align: middle; }
.team-person-copy { min-width: 0; }
.team-person-copy strong, .team-person-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-person-copy strong { font-size: 12px; font-weight: 600; line-height: 1.05; }
.team-person-copy small { margin-top: 1px; color: var(--muted); font-size: 8px; font-weight: 500; line-height: 1.05; }
.team-schedule-cell { width: var(--day-cell-width); min-width: var(--day-cell-width); max-width: var(--day-cell-width); height: var(--day-cell-height); padding: 1px 2px; background: var(--surface); text-align: center; }
.team-schedule-cell[data-status] { background: var(--status-bg); }
.team-cell-action { display: grid; place-items: center; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 5px; background: transparent; cursor: pointer; transition: background-color 150ms var(--ease), transform 130ms var(--ease), box-shadow 150ms var(--ease); }
.team-cell-action:active { transform: scale(.97); }
.team-cell-action:hover, .team-cell-action:focus-visible { background: rgba(255, 255, 255, .24); box-shadow: inset 0 0 0 2px var(--status-color); }
.team-status { display: grid; place-items: center; color: var(--status-color); }
.status-icon { display: grid; place-items: center; width: 27px; height: 27px; color: inherit; }
.status-icon svg { width: 100%; height: 100%; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.status-icon svg .icon-fill { fill: currentColor; stroke: none; }
.team-schedule-table tbody tr { animation: row-in 280ms var(--ease) both; animation-delay: var(--delay); }
.team-schedule-table tbody tr:hover .team-person { background: #f8faf9; }
.status-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 13px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.legend-swatch { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 5px; background: var(--status-bg); color: var(--status-color); }
.legend-swatch .status-icon { width: 18px; height: 18px; }
.legend-day-off .legend-swatch { background: rgba(181, 71, 61, .12); }
.team-schedule-loading { display: grid; gap: 1px; min-height: 216px; padding: 36px 0 0 190px; background: var(--line); }
.team-row-skeleton { min-height: 35px; border-radius: 0; }
.planning-error { width: min(720px, 100vw); min-height: 330px; border: 0; background: var(--surface); }

body.is-embedded { min-height: 0; background: var(--surface); }
.is-embedded .workspace { width: 100%; padding: 14px; }
.is-embedded .page-heading { display: none; }
.is-embedded .planning-controls { margin-bottom: 13px; padding-bottom: 12px; }
.is-embedded .schedule-panel { margin-top: 0; }
.is-embedded .section-heading { margin-bottom: 9px; }
.is-embedded .schedule-scroll { max-height: 420px; }
.is-embedded .team-person { padding-inline: 10px; }

.rules-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr); gap: 54px; align-items: start; }
.rules-main { display: grid; gap: 42px; }
.rule-list { border-top: 1px solid var(--line-strong); }
.rule-row { display: grid; grid-template-columns: minmax(130px, .7fr) minmax(210px, 1.25fr) minmax(130px, .7fr) auto; align-items: center; gap: 18px; min-height: 78px; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.rule-period strong, .rule-period span { display: block; }
.rule-period strong { font-size: 12px; }
.rule-period span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.rule-note { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-actions .icon-button { width: 34px; height: 34px; font-size: 14px; }
.vacations-section { padding-top: 4px; }
.vacation-list { border-top: 1px solid var(--line-strong); }
.vacation-row { display: grid; grid-template-columns: minmax(160px, .8fr) minmax(220px, 1.3fr) auto; align-items: center; gap: 18px; min-height: 72px; padding: 11px 6px; border-bottom: 1px solid var(--line); }
.vacation-person strong, .vacation-person span, .vacation-period strong, .vacation-period span { display: block; }
.vacation-person strong, .vacation-period strong { font-size: 12px; }
.vacation-person span, .vacation-period span { margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.templates-panel { padding-left: 28px; border-left: 1px solid var(--line); }
.template-list { border-top: 1px solid var(--line-strong); }
.template-item { padding: 17px 2px; border-bottom: 1px solid var(--line); }
.template-item-header { display: flex; justify-content: space-between; gap: 12px; }
.template-item h3 { margin: 0; font-size: 13px; }
.template-pattern { display: flex; flex-wrap: wrap; gap: 5px; margin: 12px 0 14px; }
.day-token { padding: 4px 6px; border-radius: 5px; background: var(--surface-soft); color: var(--muted); font-size: 9px; font-weight: 750; }
.template-actions { display: flex; gap: 7px; }

.settings-general { padding-bottom: 34px; border-bottom: 1px solid var(--line-strong); }
.settings-users { margin-top: 34px; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; align-items: end; gap: 12px; }
.table-wrap { overflow-x: auto; }
.people-table { width: 100%; min-width: 720px; border-collapse: collapse; border-top: 1px solid var(--line-strong); }
.people-table th, .people-table td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.people-table th { color: var(--muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.people-table td { font-size: 12px; }
.people-table td:last-child, .people-table th:last-child { width: 250px; text-align: right; }
.user-actions { display: flex; justify-content: flex-end; gap: 12px; white-space: nowrap; }
.text-button-danger { color: var(--danger); }
.text-button-danger:hover { color: #8f302a; }
.role-badge { display: inline-flex; padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }

.overlay {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 33, 31, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease);
}
.overlay.is-open { opacity: 1; pointer-events: auto; }
.auth-panel {
  display: grid;
  gap: 28px;
  width: min(430px, 100%);
  padding: 36px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateY(10px) scale(.98);
  transition: transform 240ms var(--ease);
}
.overlay.is-open .auth-panel { transform: translateY(0) scale(1); }
.auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.auth-panel h1 { margin: 5px 0 8px; font-size: 27px; line-height: 1.12; letter-spacing: -0.04em; }
.auth-hint { margin: -10px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
code { padding: 2px 4px; border-radius: 4px; background: var(--surface-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.drawer-overlay { place-items: stretch end; padding: 0; }
.drawer {
  width: min(510px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 30px;
  background: var(--surface);
  box-shadow: -22px 0 50px rgba(28, 45, 42, 0.16);
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(0.32, 0.72, 0, 1);
}
.drawer-compact { width: min(430px, 100%); }
.overlay.is-open .drawer { transform: translateX(0); }
.drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.drawer-header h2 { margin: 4px 0 0; font-size: 25px; letter-spacing: -0.04em; }
.drawer-header .icon-button { border: 0; background: var(--surface-soft); }
.form-stack { display: grid; gap: 17px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.segmented label { margin: 0; }
.segmented input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.segmented span { display: grid; place-items: center; min-height: 34px; margin: 0; border-radius: 7px; color: var(--muted); cursor: pointer; font-size: 11px; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(20, 35, 32, .1); }
.segmented input:focus-visible + span { outline: 3px solid rgba(8, 127, 121, .25); }
.weekday-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.weekday-picker label { margin: 0; }
.weekday-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.weekday-picker span { display: grid; place-items: center; aspect-ratio: 1; margin: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); cursor: pointer; font-size: 11px; }
.weekday-picker input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.drawer-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }
.form-error { min-height: 17px; margin: 0; color: var(--danger); font-size: 11px; }

.template-days { border-top: 1px solid var(--line); }
.template-day-row { display: grid; grid-template-columns: 1fr 150px; align-items: center; gap: 16px; min-height: 56px; border-bottom: 1px solid var(--line); }
.template-day-row select { min-height: 36px; padding-block: 6px; }
.toggle-label { display: flex; align-items: center; gap: 9px; }
.toggle-label input { width: 16px; min-height: 16px; margin: 0; accent-color: var(--accent); }
.toggle-label > span { margin: 0; }

.toast-region { position: fixed; z-index: 80; right: 22px; bottom: 22px; display: grid; gap: 8px; width: min(350px, calc(100% - 44px)); pointer-events: none; }
.toast { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--text); color: #fff; box-shadow: var(--shadow); font-size: 12px; animation: toast-in 220ms var(--ease) both; }
.toast.is-error { background: #762f2b; }

.empty-state { display: grid; justify-items: center; padding: 80px 20px; border-block: 1px solid var(--line); text-align: center; }
.empty-state-compact { padding: 34px 18px; border-top: 0; }
.empty-state-compact h2 { margin-top: 0; font-size: 16px; }
.empty-state-compact p { font-size: 12px; }
.empty-state h2 { margin: 14px 0 7px; font-size: 20px; }
.empty-state p { margin: 0; color: var(--muted); }
.empty-mark { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: var(--surface-soft); color: var(--muted); font-size: 11px; font-weight: 800; }

.skeleton { position: relative; overflow: hidden; border-radius: 7px; background: #e7ecea; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.58), transparent); transform: translateX(-100%); animation: shimmer 1.4s infinite; }
.metric-skeleton { height: 75px; margin: 12px; }
.skeleton-row { grid-template-columns: 42px 1fr; }
.skeleton-avatar { width: 38px; height: 38px; border-radius: 50%; }
.skeleton-line { width: 48%; height: 13px; }
.skeleton-rule { min-height: 70px; margin: 6px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes row-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (hover: hover) and (pointer: fine) {
  .button-primary:hover { box-shadow: 0 8px 20px rgba(8, 127, 121, .24); }
}

@media (max-width: 980px) {
  .topbar { grid-template-columns: auto 1fr auto; padding-inline: 20px; backdrop-filter: none; }
  .main-nav { position: fixed; z-index: 30; left: 16px; right: 16px; bottom: 14px; justify-content: space-around; padding: 5px; box-shadow: 0 12px 40px rgba(20, 35, 32, .18); }
  .main-nav a { flex: 1; padding-inline: 7px; text-align: center; }
  .user-area { grid-column: 3; }
  .workspace { width: min(100% - 36px, 900px); padding-bottom: 110px; }
  .rules-layout { grid-template-columns: 1fr; gap: 40px; }
  .templates-panel { padding: 0; border-left: 0; }
  .inline-form { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .topbar { min-height: 62px; padding-inline: 14px; }
  .brand small, .user-copy { display: none; }
  .main-nav { left: 8px; right: 8px; bottom: 8px; }
  .main-nav a { font-size: 10px; }
  .workspace { width: calc(100% - 28px); padding-top: 28px; }
  .page-heading { align-items: flex-start; margin-bottom: 27px; }
  .page-heading h1 { font-size: 38px; }
  .page-heading .muted { font-size: 13px; }
  .heading-actions { flex-direction: column; align-items: stretch; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .freshness { white-space: normal; }
  .planning-controls { align-items: stretch; }
  .user-select-field { width: 100%; }
  .planning-controls .freshness { order: -1; }
  .rule-row { grid-template-columns: 1fr auto; gap: 12px; padding-block: 16px; }
  .rule-period, .rule-note { grid-column: 1; }
  .rule-row > .status-badge { grid-row: 1; grid-column: 1; }
  .row-actions { grid-row: 1 / span 3; grid-column: 2; flex-direction: column; }
  .vacation-row { grid-template-columns: 1fr auto; gap: 10px 14px; }
  .vacation-period { grid-column: 1; }
  .vacation-row .row-actions { grid-column: 2; grid-row: 1 / span 2; }
  .inline-form { grid-template-columns: 1fr; }
  .drawer { padding: 24px 18px; }
  .auth-panel { padding: 28px 22px; }
  .is-embedded .workspace { width: 100%; padding: 10px; }
  .is-embedded .page-heading { flex-direction: row; margin-bottom: 10px; }
  .is-embedded .planning-controls { flex-direction: row; align-items: center; gap: 10px; }
  .is-embedded .planning-controls .freshness { order: 0; }
  .team-schedule-loading { padding-left: 190px; }
}

@media (max-width: 480px) {
  .page-heading { flex-direction: column; gap: 17px; }
  .heading-actions { width: 100%; }
  .heading-actions .button { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .segmented span { font-size: 10px; }
  .weekday-picker { gap: 3px; }
  .template-day-row { grid-template-columns: 1fr 130px; }
  .date-nav { width: 100%; }
  .date-nav .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
