:root {
  color-scheme: light;
  --ink: #173330;
  --ink-strong: #102724;
  --ink-muted: #6d7d79;
  --surface: #fffefb;
  --surface-soft: #f3f5f1;
  --surface-raised: #ffffff;
  --canvas: #e9eeea;
  --grid-line: rgba(42, 67, 64, 0.11);
  --booking-unmarked: #afbfbb;
  --booking-unmarked-active: #9dadaa;
  --booking-prepaid: #13816c;
  --booking-prepaid-active: #0d6d5c;
  --booking-ostrovok: #1c3f70;
  --booking-ostrovok-active: #16345e;
  --selection: #d5a13e;
  --today: #e16f4c;
  --weekend: rgba(223, 102, 92, 0.115);
  --weekend-ink: #c75f58;
  --double: #f1f6ec;
  --triple: #edf4f3;
  --two-room: #f6f1e8;
  --hall: #f6f4f0;
  --focus: #19776c;
  --cell-size: 52px;
  --label-width: 52px;
  --row-height: 45.76px;
  --month-band-height: 19.22px;
  --header-height: 64.98px;
  --booking-height: 31.2px;
  --category-gap: 9px;
  --calendar-height: 761.58px;
  --day-count: 31;
  --room-count: 15;
  --category-gap-count: 3;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  font-family: "Avenir Next", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--surface);
  color: var(--ink);
}

body {
  min-height: 100svh;
  font-size: 0.9375rem;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 72%, white);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  background: var(--ink);
  color: white;
  border-radius: 8px;
  transform: translateY(-160%);
  transition: transform 160ms ease-out;
}

.skip-link:focus {
  transform: translateY(0);
}

.auth-dialog {
  width: min(88vw, 390px);
  max-width: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 26px 80px rgba(12, 35, 31, 0.3);
}

.auth-dialog::backdrop {
  background:
    linear-gradient(145deg, rgba(15, 39, 35, 0.84), rgba(53, 83, 77, 0.72));
  backdrop-filter: blur(7px);
}

.auth-form {
  display: grid;
  gap: 17px;
  padding: 25px 22px 22px;
}

.auth-brand {
  width: max-content;
  padding: 6px 9px 5px;
  border-radius: 7px;
  background: var(--ink-strong);
  color: white;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.17em;
}

.auth-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--today);
  font-size: 0.64rem;
  font-weight: 760;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-form h1 {
  margin: 0;
  font-family: "Avenir Next", "SF Pro Display", sans-serif;
  font-size: 1.52rem;
  letter-spacing: -0.035em;
}

.auth-form > p {
  margin: -5px 0 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
  line-height: 1.48;
}

.auth-password-field {
  display: grid;
  gap: 7px;
}

.auth-password-field > span {
  padding-left: 3px;
  color: var(--ink-muted);
  font-size: 0.65rem;
  font-weight: 720;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.auth-password-field input {
  width: 100%;
  height: 50px;
  padding: 0 13px;
  border: 1px solid rgba(42, 67, 64, 0.16);
  border-radius: 14px;
  background: #f7f9f6;
  color: var(--ink);
}

.auth-error {
  margin: -7px 0 0 !important;
  color: #a44149 !important;
  font-size: 0.76rem !important;
}

.sync-status {
  position: fixed;
  top: max(10px, calc(var(--safe-top) + 8px));
  left: 50%;
  z-index: 180;
  width: max-content;
  max-width: calc(100% - 28px);
  padding: 9px 12px;
  border: 1px solid rgba(164, 65, 73, 0.22);
  border-radius: 11px;
  background: rgba(255, 245, 245, 0.98);
  box-shadow: 0 8px 24px rgba(42, 25, 28, 0.14);
  color: #923740;
  font-size: 0.75rem;
  font-weight: 680;
  text-align: center;
  transform: translateX(-50%);
}

.sync-status.is-offline {
  border-color: rgba(93, 111, 92, 0.24);
  background: rgba(247, 249, 240, 0.98);
  color: #53624f;
}

.app-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  isolation: isolate;
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  .app-shell {
    height: 100dvh;
    padding-bottom: 0;
  }

  .calendar-scroll {
    padding-bottom: var(--safe-bottom);
  }
}

.app-header {
  flex: 0 0 auto;
  border-bottom: 1px solid rgba(42, 67, 64, 0.08);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 4px 18px rgba(26, 55, 50, 0.035);
  backdrop-filter: blur(18px) saturate(1.08);
  z-index: 60;
}

.object-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  padding: 5px 8px 0 14px;
}

.object-switcher,
.text-button,
.icon-button,
.summary-strip,
.zoom-button,
.view-switch button,
.toolbar-today-button,
.dialog-close,
.primary-action,
.secondary-action,
.text-action {
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.object-switcher {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 42px;
  padding: 0 7px 0 0;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 690;
  letter-spacing: -0.02em;
}

.object-copy {
  display: grid;
  gap: 0;
  text-align: left;
}

.object-copy small {
  color: var(--today);
  font-size: 0.49rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  line-height: 1;
}

.object-copy > span {
  line-height: 1.25;
}

.object-switcher svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.object-switcher.is-refreshing {
  pointer-events: none;
}

.object-switcher.is-refreshing svg {
  animation: refresh-spin 0.8s linear infinite;
}

.object-switcher.is-refreshing .object-copy small {
  color: var(--ink-muted);
}

@keyframes refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .object-switcher.is-refreshing svg {
    animation: none;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1px;
}

.text-button,
.icon-button {
  min-width: 42px;
  min-height: 42px;
  border-radius: 12px;
}

.edit-mode-button[aria-pressed="true"] {
  background: var(--ink-strong);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 39, 36, 0.2);
}

.text-button {
  padding-inline: 8px;
  color: var(--ink-muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.icon-button {
  display: grid;
  place-items: center;
  padding: 11px;
}

.icon-button svg,
.zoom-button svg,
.dialog-close svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) {
  .object-switcher:hover,
  .text-button:hover,
  .icon-button:hover,
  .zoom-button:hover,
  .toolbar-today-button:hover,
  .view-switch button:hover {
    background: var(--surface-soft);
  }
}

.object-switcher:active,
.text-button:active,
.icon-button:active,
.zoom-button:active,
.toolbar-today-button:active,
.view-switch button:active {
  background: #edf2ee;
  transform: scale(0.97);
}

.summary-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  max-width: 100%;
  padding: 0 14px 6px;
  color: var(--ink-muted);
  font-size: 0.7rem;
  text-align: left;
}

.summary-strip strong {
  color: var(--ink-strong);
  font-size: 0.82rem;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.summary-strip i {
  width: 2px;
  height: 2px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--today);
}

.calendar-toolbar {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 56px;
  padding: 6px;
  border-bottom: 1px solid rgba(42, 67, 64, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 254, 251, 0.98), rgba(248, 249, 245, 0.96));
  z-index: 55;
}

.period-heading {
  min-width: 0;
  grid-column: 1;
  justify-self: start;
}

.period-navigation {
  display: flex;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  align-items: center;
  gap: 4px;
}

.period-button {
  display: grid;
  flex: 0 0 auto;
  width: 32px;
  height: 40px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(42, 67, 64, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink-muted);
  box-shadow: 0 2px 7px rgba(28, 57, 52, 0.045);
}

.period-button:first-child {
  margin-left: 0;
}

.period-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.period-button:active {
  background: #e9efeb;
  box-shadow: none;
  transform: scale(0.96);
}

.period-date-control {
  position: relative;
  display: flex;
  width: clamp(104px, 29vw, 120px);
  min-width: 0;
  height: 42px;
  flex: 0 1 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 5px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.period-date-control:active {
  background: rgba(226, 234, 228, 0.72);
}

.period-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
  text-align: center;
}

.period-date-control > svg {
  display: none;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--today);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.period-kicker {
  display: block;
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.53rem;
  font-weight: 720;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}

.range-dialog,
.settings-dialog,
.history-dialog {
  width: min(90vw, 400px);
  max-width: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(21, 45, 41, 0.24);
}

.range-dialog:focus,
.settings-dialog:focus,
.history-dialog:focus {
  outline: none;
}

.range-dialog::backdrop,
.settings-dialog::backdrop,
.history-dialog::backdrop {
  background: rgba(22, 39, 36, 0.34);
  backdrop-filter: blur(4px);
}

.range-form,
.settings-form,
.history-form {
  display: grid;
  gap: 15px;
  padding: 20px;
}

.range-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.range-dialog-heading span {
  display: block;
  margin-bottom: 4px;
  color: var(--today);
  font-size: 0.64rem;
  font-weight: 760;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.range-dialog-heading h2 {
  margin: 0;
  font-family: "Avenir Next", "SF Pro Display", sans-serif;
  font-size: 1.36rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.range-dialog-close {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(42, 67, 64, 0.1);
  border-radius: 12px;
  background: #f5f7f3;
  color: var(--ink-muted);
}

.range-dialog-close svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.range-form > p {
  margin: -6px 0 1px;
  color: var(--ink-muted);
  font-size: 0.79rem;
  line-height: 1.45;
}

.range-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}

.range-fields label {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.range-fields label > span {
  padding-left: 3px;
  color: var(--ink-muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.range-fields input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 9px;
  border: 1px solid rgba(42, 67, 64, 0.12);
  border-radius: 13px;
  background: #f7f9f6;
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
}

.range-presets {
  display: flex;
  gap: 7px;
}

.range-presets button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(42, 67, 64, 0.1);
  border-radius: 999px;
  background: #f5f7f3;
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 680;
}

.range-actions {
  display: grid;
  grid-template-columns: minmax(94px, 0.7fr) 1.3fr;
  gap: 9px;
}

.period-heading h1 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: "Avenir Next", "SF Pro Display", sans-serif;
  font-size: 0.82rem;
  font-weight: 690;
  line-height: 1.15;
  letter-spacing: -0.018em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zoom-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.zoom-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 9px;
  border: 1px solid rgba(42, 67, 64, 0.11);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink-muted);
}

.zoom-slider-wrap {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  width: auto;
  min-height: 36px;
  padding-inline: 3px;
}

#zoomSlider {
  width: 100%;
  height: 36px;
  margin: 0;
  accent-color: var(--today);
  cursor: ew-resize;
}

.view-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid rgba(42, 67, 64, 0.08);
  border-radius: 13px;
  background: #edf1ed;
}

.view-controls {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar-today-button {
  position: relative;
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid rgba(42, 67, 64, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 2px 7px rgba(28, 57, 52, 0.045);
  color: var(--ink);
  font-size: 0.69rem;
  font-weight: 720;
  white-space: nowrap;
}

.toolbar-today-button span {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border: 2px solid color-mix(in srgb, var(--today) 70%, white);
  border-radius: 50%;
  background: var(--today);
  box-shadow: 0 0 0 3px rgba(225, 111, 76, 0.1);
}

.view-switch button {
  min-width: 44px;
  min-height: 36px;
  padding: 0 4px;
  border-radius: 10px;
  color: var(--ink-muted);
  font-size: 0.69rem;
  font-weight: 700;
}

.view-switch button[aria-pressed="true"] {
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow:
    0 1px 2px rgba(24, 53, 48, 0.08),
    0 4px 10px rgba(24, 53, 48, 0.05);
}

.zoom-status {
  display: block;
  min-height: 14px;
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.settings-zoom-card {
  display: grid;
  gap: 14px;
  padding: 15px;
  border: 1px solid rgba(42, 67, 64, 0.1);
  border-radius: 17px;
  background:
    linear-gradient(145deg, rgba(247, 249, 246, 0.98), rgba(238, 243, 239, 0.9));
}

.settings-zoom-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.settings-zoom-copy > span {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 720;
}

.settings-done {
  width: 100%;
}

.settings-actions {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 9px;
}

.settings-link {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid rgba(42, 67, 64, 0.1);
  border-radius: 15px;
  background: #f7f9f6;
  color: var(--ink);
  text-align: left;
}

.settings-link-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  background: rgba(213, 161, 62, 0.13);
  color: #9b6a13;
}

.settings-link-icon svg,
.settings-link-arrow {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-link-copy {
  display: grid;
  gap: 2px;
}

.settings-link-copy strong {
  font-size: 0.84rem;
}

.settings-link-copy small {
  color: var(--ink-muted);
  font-size: 0.7rem;
}

.settings-link-arrow {
  width: 17px;
  color: var(--ink-muted);
}

.history-dialog {
  max-height: min(84dvh, 680px);
}

.history-form {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  max-height: min(84dvh, 680px);
}

.history-state {
  margin: 2px 0;
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.history-list {
  display: grid;
  gap: 9px;
  min-height: 0;
  margin: 0;
  padding: 0 2px 0 0;
  overflow-y: auto;
  list-style: none;
}

.history-entry {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(42, 67, 64, 0.09);
  border-radius: 14px;
  background: #f7f9f6;
}

.history-entry-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.history-entry-heading strong {
  font-size: 0.79rem;
}

.history-entry-heading time {
  flex: 0 0 auto;
  color: var(--ink-muted);
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
}

.history-entry p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.71rem;
  line-height: 1.38;
}

.calendar-section {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.overview-axis {
  position: relative;
  flex: 0 0 0;
  height: 0;
  overflow: hidden;
  border-bottom: 0 solid rgba(42, 67, 64, 0.08);
  background: #f8f9f5;
  transition: height 180ms ease-out;
}

.app-shell.is-month .overview-axis {
  flex-basis: 28px;
  height: 28px;
  border-bottom-width: 1px;
}

.overview-axis span {
  position: absolute;
  top: 7px;
  color: var(--ink-muted);
  font-size: 0.58rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  transform: translateX(-50%);
}

.calendar-scroll {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(69, 96, 91, 0.24) transparent;
  scrollbar-width: thin;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

.calendar-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.calendar-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: calc(var(--label-width) + var(--day-count) * var(--cell-size));
  min-width: 100%;
  min-height: max(100%, var(--calendar-height));
  background: var(--surface);
  contain: layout paint style;
}

.calendar-grid-tail {
  display: flex;
  flex: 1 0 0;
  width: max-content;
  min-height: 0;
  pointer-events: none;
}

.calendar-grid-tail-label {
  position: sticky;
  left: 0;
  z-index: 26;
  flex: 0 0 var(--label-width);
  width: var(--label-width);
  background-color: color-mix(in srgb, var(--surface) 94%, transparent);
  background-image: linear-gradient(
    to bottom,
    transparent calc(100% - 1px),
    var(--grid-line) calc(100% - 1px)
  );
  background-size: 100% var(--row-height);
  box-shadow:
    inset -1px 0 var(--grid-line),
    7px 0 16px rgba(25, 54, 49, 0.025);
  backdrop-filter: blur(14px);
  transition:
    width 180ms ease-out,
    flex-basis 180ms ease-out,
    opacity 140ms ease-out,
    transform 180ms ease-out;
}

.calendar-grid-tail-track {
  display: grid;
  grid-template-columns: repeat(var(--day-count), var(--cell-size));
  width: calc(var(--day-count) * var(--cell-size));
}

.calendar-grid-tail-cell {
  min-width: 0;
  background-color: color-mix(in srgb, var(--surface) 96%, var(--canvas));
  background-image: linear-gradient(
    to bottom,
    transparent calc(100% - 1px),
    var(--grid-line) calc(100% - 1px)
  );
  background-size: 100% var(--row-height);
  box-shadow: inset -1px 0 var(--grid-line);
}

.calendar-grid-tail-cell.is-weekend {
  background-color: color-mix(in srgb, var(--surface) 88%, #df665c 12%);
}

.calendar-grid-tail-cell.is-month-start {
  box-shadow:
    inset 2px 0 rgba(42, 67, 64, 0.13),
    inset -1px 0 var(--grid-line);
}

.calendar-header-row,
.room-row {
  display: flex;
  width: max-content;
}

.calendar-header-row {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-height);
}

.room-row {
  height: var(--row-height);
}

.room-row.starts-category {
  margin-top: var(--category-gap);
  box-shadow:
    0 calc(-1 * var(--category-gap)) 0 var(--surface),
    0 calc(-1 * var(--category-gap) + 1px) 0 rgba(42, 67, 64, 0.055);
}

.corner-cell,
.room-label {
  position: sticky;
  left: 0;
  z-index: 26;
  flex: 0 0 var(--label-width);
  width: var(--label-width);
  border: 0;
  box-shadow:
    inset -1px -1px var(--grid-line),
    7px 0 16px rgba(25, 54, 49, 0.025);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  transition:
    width 180ms ease-out,
    flex-basis 180ms ease-out,
    opacity 140ms ease-out,
    transform 180ms ease-out;
}

.corner-cell {
  position: sticky;
  z-index: 34;
  height: var(--header-height);
  overflow: visible;
}

.room-rail-toggle {
  position: absolute;
  top: 50%;
  right: -25px;
  z-index: 40;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transform: translateY(-50%);
  -webkit-tap-highlight-color: transparent;
}

.room-rail-toggle::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 36px;
  border: 1px solid rgba(42, 67, 64, 0.1);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 12px rgba(24, 54, 49, 0.08);
  content: "";
  transform: translate(-50%, -50%);
}

.room-rail-toggle svg {
  position: relative;
  z-index: 1;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 180ms ease-out;
}

.room-rail-toggle:active::before {
  background: #e8efea;
}

.room-rail-toggle:focus-visible {
  outline-offset: -5px;
}

.date-header-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--day-count), var(--cell-size));
  grid-template-rows: var(--month-band-height) calc(var(--header-height) - var(--month-band-height));
  width: calc(var(--day-count) * var(--cell-size));
  height: var(--header-height);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
}

.month-cell {
  grid-row: 1;
  min-width: 0;
  overflow: visible;
  border-bottom: 1px solid rgba(42, 67, 64, 0.08);
  background: color-mix(in srgb, var(--surface-soft) 68%, white);
  color: var(--ink-muted);
  font-size: 0.58rem;
  font-weight: 760;
  letter-spacing: 0.075em;
  line-height: var(--month-band-height);
  text-align: left;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.month-label {
  position: sticky;
  left: calc(var(--label-width) + 9px);
  display: inline-block;
  max-width: calc(100% - 18px);
  overflow: hidden;
  padding-inline: 9px;
  text-overflow: ellipsis;
  vertical-align: top;
}

.month-cell + .month-cell {
  box-shadow: inset 2px 0 rgba(42, 67, 64, 0.13);
}

.date-cell,
.day-cell {
  position: relative;
  width: var(--cell-size);
  box-shadow: inset -1px -1px var(--grid-line);
}

.date-cell {
  grid-row: 2;
  display: grid;
  place-content: center;
  height: calc(var(--header-height) - var(--month-band-height));
  gap: 1px;
  background: rgba(255, 254, 251, 0.965);
  color: var(--ink);
  text-align: center;
}

.date-cell.is-weekend {
  background: color-mix(in srgb, var(--surface) 87%, #df665c 13%);
  color: var(--weekend-ink);
}

.date-cell.is-month-start,
.day-cell.is-month-start {
  box-shadow:
    inset 2px 0 rgba(42, 67, 64, 0.13),
    inset -1px -1px var(--grid-line);
}

.date-cell.is-today .date-number {
  display: grid;
  width: calc(var(--cell-size) * 0.48);
  height: calc(var(--cell-size) * 0.48);
  place-items: center;
  margin: -2px auto -3px;
  border-radius: 50%;
  background: var(--today);
  color: white;
  box-shadow: 0 4px 10px rgba(225, 111, 76, 0.2);
}

.date-weekday {
  font-size: max(0.46rem, calc(var(--cell-size) * 0.17));
  font-weight: 720;
  letter-spacing: 0.04em;
  line-height: 1;
}

.date-number {
  font-family: "Avenir Next", "SF Pro Display", sans-serif;
  font-size: max(0.62rem, calc(var(--cell-size) * 0.33));
  font-weight: 650;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.room-label {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--row-height);
  padding: 0;
  color: var(--ink-strong);
  text-align: center;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
}

.room-label strong {
  font-family: "Avenir Next", "SF Pro Display", sans-serif;
  font-size: max(0.58rem, calc(var(--cell-size) * 0.28));
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.room-track {
  position: relative;
  flex: 0 0 calc(var(--day-count) * var(--cell-size));
  width: calc(var(--day-count) * var(--cell-size));
  height: var(--row-height);
  overflow: hidden;
  cursor: cell;
  -webkit-tap-highlight-color: transparent;
}

.day-cells {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--day-count), var(--cell-size));
  pointer-events: none;
}

.day-cell {
  height: var(--row-height);
  background: var(--category-bg);
}

.day-cell.is-weekend {
  background:
    linear-gradient(var(--weekend), var(--weekend)),
    var(--category-bg);
}

.booking {
  position: absolute;
  z-index: 8;
  top: 0;
  left: calc(var(--start-unit) * var(--cell-size) / 2);
  width: calc(var(--span-unit) * var(--cell-size) / 2);
  height: 100%;
  min-width: 3px;
  overflow: visible;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-x pan-y;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  --booking-fill: var(--booking-unmarked);
  --booking-fill-active: var(--booking-unmarked-active);
  --booking-ink: var(--ink-strong);
}

.booking.is-prepaid {
  --booking-fill: var(--booking-prepaid);
  --booking-fill-active: var(--booking-prepaid-active);
  --booking-ink: #f7fffc;
}

.booking.is-ostrovok {
  --booking-fill: var(--booking-ostrovok);
  --booking-fill-active: var(--booking-ostrovok-active);
  --booking-ink: #f7faff;
}

.booking.is-move-armed {
  z-index: 15;
  touch-action: none;
}

.booking.is-move-armed .booking-bar {
  outline: 1px solid var(--selection);
  outline-offset: 1px;
  box-shadow: 0 3px 9px rgba(23, 51, 48, 0.14);
}

.booking.is-drag-source {
  opacity: 0.28;
}

.booking-bar {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: var(--booking-height);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: clamp(5px, calc(var(--cell-size) * 0.13), 9px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 72%),
    var(--booking-fill);
  box-shadow:
    0 1px 1px rgba(20, 48, 44, 0.1),
    0 3px 8px rgba(20, 48, 44, 0.055);
  color: var(--booking-ink);
  transition:
    background-color 140ms ease-out,
    filter 140ms ease-out;
  transform: translateY(-50%);
}

.booking:hover .booking-bar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 72%),
    var(--booking-fill-active);
  box-shadow: 0 5px 13px rgba(20, 48, 44, 0.13);
}

.booking.is-prepaid.is-ostrovok .booking-bar::after {
  position: absolute;
  inset: 3px auto 3px 3px;
  width: 3px;
  border-radius: 999px;
  background: #45c7a6;
  content: "";
}

.booking:active .booking-bar {
  filter: brightness(0.92);
}

.booking:focus-visible {
  z-index: 16;
  outline: 0;
}

.booking:focus-visible .booking-bar {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.booking-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 clamp(3px, calc(var(--cell-size) * 0.1), 6px);
  overflow: hidden;
  font-size: clamp(0.84rem, calc(var(--cell-size) * 0.29), 1.08rem);
  font-weight: 500;
  letter-spacing: -0.016em;
  line-height: 0.88;
  white-space: nowrap;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.booking-guest {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.booking-guest::before {
  content: attr(data-label);
}

.resize-handle {
  position: absolute;
  z-index: 19;
  top: 50%;
  left: calc(var(--handle-unit) * var(--cell-size) / 2 - 22px);
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: ew-resize;
  touch-action: none;
  transform: translateY(-50%);
  -webkit-tap-highlight-color: transparent;
}

.resize-handle::before {
  width: 7px;
  height: calc(var(--booking-height) + 8px);
  border: 1px solid white;
  border-radius: 999px;
  background: var(--selection);
  box-shadow: 0 2px 7px rgba(20, 48, 44, 0.24);
  content: "";
}

.resize-handle:focus-visible {
  outline-offset: -5px;
}

.drag-preview {
  position: absolute;
  z-index: 20;
  min-width: 3px;
  pointer-events: none;
  transition:
    top 70ms linear,
    left 70ms linear,
    width 70ms linear;
  --booking-preview: var(--booking-unmarked-active);
}

.drag-preview.is-prepaid {
  --booking-preview: var(--booking-prepaid-active);
}

.drag-preview.is-ostrovok {
  --booking-preview: var(--booking-ostrovok-active);
}

.drag-preview-bar {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  display: flex;
  height: var(--booking-height);
  align-items: center;
  padding-inline: clamp(5px, calc(var(--cell-size) * 0.32), 14px);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: clamp(2px, calc(var(--cell-size) * 0.12), 7px);
  background: var(--booking-preview);
  box-shadow: 0 7px 16px rgba(20, 48, 44, 0.24);
  color: white;
  font-size: clamp(0.68rem, calc(var(--cell-size) * 0.25), 0.9rem);
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateY(-50%);
}

.drag-preview.is-invalid .drag-preview-bar {
  border-color: rgba(255, 255, 255, 0.92);
  background: #c65b63;
  box-shadow: 0 7px 16px rgba(139, 44, 53, 0.22);
}

.turnover-seam {
  position: absolute;
  z-index: 12;
  top: 50%;
  left: calc(var(--seam-unit) * var(--cell-size) / 2);
  width: 2px;
  height: var(--booking-height);
  background: rgba(255, 255, 255, 0.92);
  pointer-events: none;
  transform: translateY(-50%);
}

.turnover-seam::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(4px, calc(var(--cell-size) * 0.16), 9px);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-width: 2px 2px 0 0;
  content: "";
  transform: translate(-50%, -50%) rotate(45deg);
}

.today-line {
  position: absolute;
  z-index: 22;
  top: 0;
  bottom: 0;
  left: calc(var(--label-width) + var(--today-unit) * var(--cell-size) / 2);
  width: clamp(1px, calc(var(--cell-size) * 0.035), 2px);
  background: var(--today);
  pointer-events: none;
}

.today-line span {
  position: absolute;
  top: max(1px, calc(var(--header-height) * 0.05));
  left: 50%;
  width: clamp(5px, calc(var(--cell-size) * 0.18), 9px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--today);
  transform: translateX(-50%);
}

.app-shell.is-overview .date-weekday {
  display: none;
}

.app-shell:is(.is-overview, .is-month) .booking-label {
  display: flex;
  padding-inline: 1px;
  font-size: clamp(0.58rem, calc(var(--cell-size) * 0.48), 0.86rem);
  font-weight: 500;
  letter-spacing: -0.018em;
  line-height: 0.84;
}

.app-shell.is-month .booking-label {
  padding-inline: 1px;
  font-size: clamp(0.45rem, calc(var(--cell-size) * 0.3), 0.62rem);
  font-weight: 520;
  letter-spacing: -0.01em;
}

.app-shell.is-month .date-number {
  font-size: clamp(0.48rem, calc(var(--cell-size) * 0.25), 0.58rem);
}

.app-shell.is-month .month-cell {
  font-size: 0.5rem;
  letter-spacing: 0.055em;
}

.app-shell.is-month .room-label strong {
  font-size: clamp(0.48rem, calc(var(--cell-size) * 0.2), 0.55rem);
}

.app-shell.is-overview .turnover-seam::after {
  display: none;
}

.app-shell.is-noneditable .resize-handle {
  display: none;
}

.app-shell.is-overview .room-label {
  align-items: center;
  padding: 0;
}

.app-shell.is-overview .room-label strong {
  font-size: max(0.38rem, calc(var(--cell-size) * 0.42));
}

.app-shell.is-month .room-label strong {
  font-size: clamp(0.48rem, calc(var(--cell-size) * 0.2), 0.55rem);
}

.app-shell.is-month .calendar-header-row {
  position: relative;
}

.app-shell.is-month .date-cell {
  color: transparent;
}

.app-shell.is-rail-collapsed .corner-cell,
.app-shell.is-rail-collapsed .room-label,
.app-shell.is-rail-collapsed .calendar-grid-tail-label {
  box-shadow: none;
}

.app-shell.is-rail-collapsed .room-label,
.app-shell.is-rail-collapsed .calendar-grid-tail-label {
  opacity: 0;
  transform: translateX(-100%);
}

.app-shell.is-rail-collapsed .room-rail-toggle {
  right: auto;
  left: 0;
}

.app-shell.is-rail-collapsed .room-rail-toggle svg {
  position: absolute;
  top: 50%;
  left: 2px;
  transform: translateY(-50%) rotate(180deg);
}

.app-shell.is-rail-collapsed .room-rail-toggle::before {
  top: 50%;
  left: 0;
  width: 26px;
  height: 36px;
  border-left: 0;
  border-radius: 0 10px 10px 0;
  transform: translateY(-50%);
}

.selection-chip {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 80;
  max-width: calc(100% - 32px);
  padding: 8px 12px;
  overflow: hidden;
  border: 1px solid rgba(42, 67, 64, 0.09);
  border-radius: 12px;
  background: rgba(255, 254, 251, 0.96);
  box-shadow: 0 7px 18px rgba(24, 54, 49, 0.12);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.selection-chip.is-invalid {
  border-color: rgba(198, 91, 99, 0.3);
  background: rgba(255, 244, 245, 0.97);
  color: #9f3540;
}

.booking-dialog {
  width: min(100%, 520px);
  max-width: none;
  max-height: calc(100dvh - max(8px, var(--safe-top)));
  margin: auto 0 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 -12px 38px rgba(16, 45, 40, 0.16);
}

.booking-dialog::backdrop {
  background: rgba(14, 39, 35, 0.26);
  backdrop-filter: blur(5px);
}

.booking-dialog form {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: calc(100dvh - max(8px, var(--safe-top)));
  padding: 20px 18px max(20px, calc(var(--safe-bottom) + 12px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.booking-dialog form::-webkit-scrollbar {
  display: none;
}

.dialog-handle {
  width: 38px;
  height: 4px;
  margin: -7px auto 18px;
  border-radius: 999px;
  background: #d8dfd9;
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  border-radius: 10px;
}

.dialog-status {
  margin: 0 52px 4px 0;
  color: var(--today);
  font-size: 0.75rem;
  font-weight: 760;
  letter-spacing: 0.02em;
}

.booking-dialog h2 {
  margin: 0;
  font-family: "Avenir Next", "SF Pro Display", sans-serif;
  font-size: 1.42rem;
  font-weight: 690;
  letter-spacing: -0.025em;
}

.dialog-meta {
  margin: 6px 0 18px;
  color: var(--ink-muted);
}

.booking-badges {
  display: flex;
  min-height: 24px;
  flex-wrap: wrap;
  gap: 6px;
  margin: -11px 0 13px;
}

.booking-badges:empty {
  display: none;
}

.booking-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 720;
}

.booking-badge.is-unmarked {
  background: #e5ebe8;
  color: #61736f;
}

.booking-badge.is-prepaid {
  background: rgba(19, 129, 108, 0.12);
  color: #0b6d5b;
}

.booking-badge.is-ostrovok {
  background: rgba(28, 63, 112, 0.11);
  color: #1c3f70;
}

.booking-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 0 20px;
  padding: 13px 0;
  border-block: 1px solid rgba(42, 67, 64, 0.11);
}

.booking-facts div {
  min-width: 0;
  padding-inline: 10px;
}

.booking-facts div + div {
  border-left: 1px solid rgba(42, 67, 64, 0.11);
}

.booking-facts dt {
  color: var(--ink-muted);
  font-size: 0.7rem;
}

.booking-facts dd {
  margin: 4px 0 0;
  overflow: hidden;
  font-size: 0.91rem;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px;
  min-width: 0;
}

.dialog-edit-action {
  grid-column: 1 / -1;
  min-height: 42px;
  border-radius: 9px;
  color: var(--ink-muted);
  font-size: 0.8rem;
  font-weight: 680;
}

.edit-panel {
  display: grid;
  gap: 13px;
  min-width: 0;
}

.edit-panel[hidden] {
  display: none;
}

.edit-panel label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.edit-panel label > span {
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.edit-panel input,
.edit-panel select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 46px;
  padding: 0 11px;
  border: 1px solid rgba(42, 67, 64, 0.14);
  border-radius: 12px;
  background: #fbfcf9;
  color: var(--ink);
  font-size: 16px;
}

.booking-flags {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.edit-panel .booking-flag {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border: 1px solid rgba(42, 67, 64, 0.11);
  border-radius: 14px;
  background: #f7f9f6;
  cursor: pointer;
}

.edit-panel .booking-flag input {
  width: 21px;
  height: 21px;
  min-height: 0;
  flex: 0 0 21px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
}

.booking-flag-prepaid input {
  accent-color: var(--booking-prepaid);
}

.booking-flag-ostrovok input {
  accent-color: var(--booking-ostrovok);
}

.edit-panel .booking-flag > span {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: var(--ink);
  font-size: inherit;
  font-weight: inherit;
}

.booking-flag strong {
  font-size: 0.78rem;
  font-weight: 720;
  overflow-wrap: anywhere;
}

.booking-flag small {
  color: var(--ink-muted);
  font-size: 0.66rem;
  overflow-wrap: anywhere;
}

.booking-flag:has(input:checked) {
  border-color: color-mix(in srgb, var(--flag-color, var(--focus)) 36%, transparent);
  background: color-mix(in srgb, var(--flag-color, var(--focus)) 8%, white);
}

.booking-flag-prepaid {
  --flag-color: var(--booking-prepaid);
}

.booking-flag-ostrovok {
  --flag-color: var(--booking-ostrovok);
}

.edit-dates {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px;
  min-width: 0;
}

.edit-meta-fields {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.primary-action,
.secondary-action {
  min-height: 48px;
  border-radius: 13px;
  font-size: 0.9rem;
  font-weight: 700;
}

.primary-action {
  background: var(--ink-strong);
  color: white;
}

.secondary-action {
  border: 1px solid rgba(42, 67, 64, 0.13);
  background: #f5f7f3;
}

@media (min-width: 700px) {
  .app-shell {
    border-inline: 0;
  }

  .app-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    min-height: 64px;
    padding-inline: 18px;
  }

  .object-row {
    grid-column: 1 / -1;
    width: 100%;
    padding: 0;
  }

  .summary-strip {
    padding: 0;
  }

  .header-actions {
    margin-left: 28px;
  }

  .calendar-toolbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 62px;
    padding-inline: 18px;
  }

  .period-heading {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  .period-button {
    width: 38px;
    height: 38px;
  }

  .period-date-control {
    width: 190px;
  }

  .period-date-control > svg {
    display: block;
  }

  .period-heading h1 {
    font-size: 0.98rem;
  }

  .view-controls {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
  }

  .booking-dialog {
    margin-inline: auto;
  }
}

@media (orientation: portrait) and (max-width: 699px) {
  .object-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 3px;
    min-height: 48px;
    padding: 2px 6px 1px 12px;
  }

  .object-switcher {
    min-width: 0;
    min-height: 42px;
    overflow: hidden;
    font-size: 0.94rem;
  }

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

  .object-copy > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .summary-strip {
    min-height: 40px;
    gap: 5px;
    padding: 0 2px;
    font-size: 0.62rem;
    white-space: nowrap;
  }

  .summary-strip strong {
    font-size: 0.72rem;
  }

  .summary-strip span:first-child,
  .summary-strip span:first-child + i {
    display: none;
  }

  .header-actions {
    gap: 0;
  }

  .icon-button {
    min-width: 38px;
    min-height: 38px;
    padding: 9px;
  }
}

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

  .period-heading {
    display: block;
  }

  .period-button {
    width: 30px;
    height: 38px;
  }

  .period-heading h1 {
    font-size: 0.86rem;
  }

  .period-date-control {
    width: 102px;
  }

  .view-controls {
    grid-column: 2;
    gap: 4px;
  }

  .toolbar-today-button {
    min-height: 38px;
    padding-inline: 6px;
    font-size: 0.62rem;
  }

  .view-switch button {
    min-width: 41px;
    min-height: 34px;
    padding-inline: 5px;
  }

}

@media (orientation: landscape) and (max-height: 600px) {
  .app-shell {
    --month-band-height: 14px;
    --header-height: clamp(36px, calc(var(--cell-size) * 0.42 + 14px), 50px);
    --calendar-height: calc(
      var(--header-height) + var(--room-count) * var(--row-height) +
        var(--category-gap-count) * var(--category-gap)
    );
  }

  .app-header {
    position: absolute;
    top: 0;
    right: max(4px, var(--safe-right));
    z-index: 70;
    display: block;
    width: auto;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    pointer-events: none;
  }

  .object-row {
    display: block;
    min-height: 0;
    padding: 1px 0;
  }

  .object-switcher,
  .summary-strip {
    display: none;
  }

  .header-actions {
    margin-left: auto;
    pointer-events: auto;
  }

  .icon-button {
    min-width: 32px;
    min-height: 32px;
    padding: 7px;
    border-radius: 9px;
  }

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

  .calendar-toolbar {
    min-height: 34px;
    padding: 1px calc(max(6px, var(--safe-right)) + 70px) 1px max(6px, var(--safe-left));
  }

  .period-navigation {
    gap: 2px;
  }

  .period-button {
    width: 28px;
    height: 30px;
    border-radius: 8px;
  }

  .period-date-control {
    width: clamp(120px, 24vw, 176px);
    height: 30px;
  }

  .period-kicker {
    display: none;
  }

  .period-heading h1 {
    font-size: 0.78rem;
  }

  .toolbar-today-button {
    display: none;
  }

  .view-switch {
    padding: 2px;
    border-radius: 10px;
  }

  .view-switch button {
    min-width: 46px;
    min-height: 26px;
    border-radius: 7px;
    font-size: 0.62rem;
  }

  .app-shell.is-month .overview-axis {
    flex-basis: 0;
    height: 0;
    border-bottom-width: 0;
  }

  .app-shell.is-month .date-cell {
    color: var(--ink-muted);
  }

  .date-weekday {
    font-size: clamp(0.42rem, calc(var(--cell-size) * 0.1), 0.62rem);
  }

  .date-number {
    font-size: clamp(0.56rem, calc(var(--cell-size) * 0.16), 0.82rem);
  }

  .month-cell {
    font-size: 0.48rem;
  }

  .date-cell.is-today .date-number {
    width: min(calc(var(--cell-size) * 0.48), 28px);
    height: min(calc(var(--cell-size) * 0.48), 28px);
  }
}

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