:root {
  --surface: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --line-soft: #edf1f6;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --accent-soft: #e7f6f4;
  --blue: #1d4ed8;
  --amber: #f6c453;
  --danger-soft: #fff7ed;
  --shadow: 0 18px 48px rgba(23, 32, 51, 0.08);
}

html {
  font-size: 16px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5000;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.app-nav {
  max-width: 1240px;
  min-height: 44px;
  padding: 0 24px;
}

.app-header .navbar {
  padding-top: 0;
  padding-bottom: 0;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: 0;
  min-width: 0;
  padding: 0;
}

.nav-logo {
  display: block;
  width: auto;
  max-width: 164px;
  height: 42px;
  object-fit: contain;
}

.navbar-toggler {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.app-menu {
  gap: 6px;
}

.app-menu .nav-link {
  color: var(--muted);
  border-radius: 8px;
  font-weight: 750;
  padding: 6px 12px;
}

.app-menu .nav-link:hover,
.app-menu .nav-link:focus {
  color: var(--ink);
  background: var(--panel-soft);
}

.app-submenu {
  z-index: 5010;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background:
    radial-gradient(circle at 50% 0, rgba(15, 118, 110, 0.14), transparent 52%),
    #fff;
  box-shadow: 0 18px 48px rgba(23, 32, 51, 0.12);
}

.app-submenu .dropdown-item {
  color: var(--ink);
  font-weight: 750;
  padding: 10px 16px;
}

.app-submenu .dropdown-item:hover,
.app-submenu .dropdown-item:focus {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.nav-account {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.nav-account form {
  margin: 0;
}

.nav-account button {
  height: 30px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

@media (hover: hover) and (pointer: fine) and (min-width: 761px) {
  .app-menu .nav-item.dropdown {
    position: relative;
  }

  .app-menu .nav-item.dropdown > .dropdown-menu {
    display: block;
    left: auto;
    right: 0;
    min-width: 180px;
    margin-top: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
    visibility: hidden;
  }

  .app-menu .nav-item.dropdown:hover > .dropdown-menu,
  .app-menu .nav-item.dropdown:focus-within > .dropdown-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    visibility: visible;
  }

  .app-menu .nav-item.dropdown:hover > .nav-link,
  .app-menu .nav-item.dropdown:focus-within > .nav-link {
    color: var(--ink);
    background: var(--panel-soft);
  }

  .app-menu .nav-item.dropdown > .dropdown-menu::before {
    content: "";
    position: absolute;
    inset: -10px;
    z-index: -1;
    border-radius: 14px;
    background: rgba(15, 118, 110, 0.12);
    filter: blur(14px);
  }
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0 64px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  gap: 28px;
  min-height: 420px;
  align-items: end;
  padding: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(29, 78, 216, 0.08)),
    var(--panel);
  box-shadow: var(--shadow);
}

.home-hero h1,
.page-header h1 {
  margin: 0;
  color: var(--ink);
  font-weight: 850;
  letter-spacing: 0;
}

.home-hero h1 {
  font-size: 4.75rem;
  line-height: 0.98;
}

.home-hero-logo {
  display: block;
  width: clamp(170px, 24vw, 320px);
  max-height: 118px;
  margin: 0 0 28px;
  object-fit: contain;
  object-position: left center;
}

.home-hero p,
.page-subtitle {
  max-width: 620px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.home-actions {
  display: grid;
  gap: 10px;
}

.home-actions a,
.home-action-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.home-action-group {
  position: relative;
}

.home-action-group[open],
.home-action-group:hover,
.home-action-group:focus-within {
  z-index: 12;
}

.home-action-group > summary {
  cursor: pointer;
  list-style: none;
}

.home-action-group > summary::-webkit-details-marker {
  display: none;
}

.home-actions a::after,
.home-action-group > summary::after {
  content: ">";
  color: var(--accent);
}

.home-action-group[open] > summary::after {
  transform: rotate(90deg);
}

.home-actions a:hover,
.home-action-group > summary:hover,
.home-action-group[open] > summary {
  border-color: var(--accent);
  background: #fff;
}

.home-action-submenu {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0, rgba(15, 118, 110, 0.14), transparent 52%),
    rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 38px rgba(23, 32, 51, 0.1);
}

.home-action-submenu a {
  min-height: 48px;
  box-shadow: none;
}

@media (hover: hover) and (pointer: fine) and (min-width: 761px) {
  .home-action-group {
    z-index: 2;
  }

  .home-action-submenu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(100%, 280px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
    visibility: hidden;
  }

  .home-action-group:hover .home-action-submenu,
  .home-action-group:focus-within .home-action-submenu,
  .home-action-group[open] .home-action-submenu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    visibility: visible;
  }

  .home-action-group:hover > summary,
  .home-action-group:focus-within > summary {
    border-color: var(--accent);
    background: #fff;
  }

  .home-action-submenu::before {
    content: "";
    position: absolute;
    inset: -10px;
    z-index: -1;
    border-radius: 14px;
    background: rgba(15, 118, 110, 0.12);
    filter: blur(14px);
  }
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 3.4rem;
  line-height: 1;
}

.search-box {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: min(100%, 540px);
}

.search-box::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 50%;
  width: 13px;
  height: 13px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  transform: translateY(-58%);
  pointer-events: none;
}

.search-box::after {
  content: "";
  position: absolute;
  left: 27px;
  top: 27px;
  width: 8px;
  height: 2px;
  background: var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 180px;
  padding: 12px;
  resize: vertical;
}

.search-box input {
  height: 48px;
  padding-left: 44px;
  box-shadow: 0 10px 30px rgba(23, 32, 51, 0.06);
}

.search-box button {
  height: 48px;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #c7d1df;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

button {
  height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary-action {
  background: var(--accent);
  color: #fff;
}

.primary-action:hover {
  background: var(--accent-dark);
}

.secondary-action {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.secondary-action:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

a.secondary-action,
a.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
  text-decoration: none;
}

.calendar-header {
  align-items: end;
}

.calendar-header-actions {
  display: grid;
  gap: 10px;
  justify-items: end;
  width: min(100%, 640px);
}

.calendar-search-box {
  width: min(100%, 640px);
}

.calendar-controls {
  display: grid;
  grid-template-columns: auto minmax(150px, 180px) auto 42px;
  gap: 10px;
  align-items: center;
  width: min(100%, 640px);
}

.calendar-view-tabs {
  display: inline-flex;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.calendar-view-tabs a,
.calendar-view-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid var(--line-soft);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  text-decoration: none;
}

.calendar-view-tabs a:last-child,
.calendar-view-tabs button:last-child {
  border-right: 0;
}

.calendar-view-tabs a:hover,
.calendar-view-tabs a:focus,
.calendar-view-tabs button:hover,
.calendar-view-tabs button:focus {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.calendar-view-tabs a.is-active,
.calendar-view-tabs button.is-active {
  color: #fff;
  background: var(--accent);
}

.calendar-period-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(15, 23, 42, 0.34);
}

.calendar-period-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1501;
  width: min(360px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.22);
}

.calendar-period-form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.calendar-period-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.calendar-period-header h2 {
  margin: 0;
  font-size: 1rem;
}

.calendar-period-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.calendar-period-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.calendar-period-form input[type="date"] {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
}

.calendar-period-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.calendar-print-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.calendar-print-action:hover,
.calendar-print-action:focus {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--accent-soft);
}

.calendar-print-action img {
  width: 22px;
  height: 22px;
}

.calendar-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fff, var(--panel-soft));
}

.calendar-toolbar > div:first-child {
  flex: 0 0 152px;
  min-width: 152px;
}

.calendar-toolbar h2 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 850;
}

.calendar-toolbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

.calendar-legend {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 2px 3px;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  padding: 0 4px;
}

.calendar-legend-item {
  display: inline-flex;
  align-items: center;
  height: 25px;
  min-height: 15px;
  padding: 0 5px;
  border: 1px solid rgba(23, 32, 51, 0.18);
  border-radius: 3px;
  background: #fff;
  color: #172033;
  font: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.1;
  opacity: 0.42;
  white-space: nowrap;
  cursor: pointer;
}

.calendar-legend-item.is-active {
  border-color: rgba(23, 32, 51, 0.42);
  opacity: 1;
}

.calendar-legend-swatch {
  display: none;
}

.calendar-legend-item.is-reserved,
.calendar-legend-swatch.is-reserved {
  background: #C6FFEC;
}

.calendar-legend-item.is-overlap,
.calendar-legend-swatch.is-overlap {
  background: #FFC3C3;
}

.calendar-legend-item.is-cancelled,
.calendar-legend-swatch.is-cancelled {
  background: #DEDEDE;
}

.calendar-legend-item.is-apartment-changed,
.calendar-legend-swatch.is-apartment-changed {
  background: #71AFFF;
}

.calendar-legend-item.is-cancelled-apartment-changed,
.calendar-legend-swatch.is-cancelled-apartment-changed {
  background: #D280FF;
}

.calendar-legend-item.is-stayed,
.calendar-legend-swatch.is-stayed {
  background: rgba(15, 118, 110, 0.55);;
}

.calendar-legend-item.is-same-day-multi-house,
.calendar-legend-swatch.is-same-day-multi-house {
  background: #FFE746;
}

.calendar-legend-item.is-with-note,
.calendar-legend-swatch.is-with-note {
  background: transparent;
  border-color: #8C1607;
  color: #8C1607;
}

.calendar-nav-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
}

.calendar-nav-actions .secondary-action {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.84rem;
  border-radius: 7px;
}

.calendar-scroll {
  max-height: calc(100vh - 300px);
  min-height: 430px;
  overflow: auto;
}

.calendar-grid {
  --calendar-house-column: clamp(136px, 15vw, 188px);
  --calendar-day-min: 32px;
  --calendar-grid-line: #caccce;
  display: grid;
  grid-template-columns: var(--calendar-house-column) repeat(var(--calendar-day-count), minmax(var(--calendar-day-min), 1fr));
  min-width: 0;
  width: 100%;
}

.calendar-view-week {
  --calendar-day-min: 96px;
}

.calendar-corner,
.calendar-day-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  align-content: center;
  min-height: 58px;
  padding: 8px 5px;
  border-right: 1px solid var(--calendar-grid-line);
  border-bottom: 2px solid var(--calendar-grid-line);
  background: #172033;
  color: #fff;
}

.calendar-house-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: var(--calendar-house-column) repeat(var(--calendar-day-count), minmax(var(--calendar-day-min), 1fr));
  position: relative;
  z-index: 0;
}

.calendar-house-row:has(.calendar-reservation-bar:hover),
.calendar-house-row:has(.calendar-reservation-bar:focus),
.calendar-house-row:has(.calendar-reservation-bar:focus-visible) {
  z-index: 80;
}

.calendar-view-week .calendar-house-row {
  grid-template-columns: var(--calendar-house-column) repeat(var(--calendar-day-count), minmax(var(--calendar-day-min), 1fr));
}

.calendar-corner {
  left: 0;
  z-index: 45;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.calendar-day-header {
  text-align: center;
  gap: 2px;
}

.calendar-day-header span,
.calendar-day-header small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.calendar-day-header strong {
  font-size: 0.98rem;
  line-height: 1;
}

.calendar-day-header.is-today {
  background: var(--accent);
}

.calendar-day-header.is-month-start {
  box-shadow: inset 4px 0 0 var(--amber);
}

.calendar-house-cell,
.calendar-slot {
  min-height: calc((var(--calendar-lane-count, 1) * 20px) + ((var(--calendar-lane-count, 1) - 1) * 2px));
  padding: 0 4px;
  border-right: 1px solid var(--calendar-grid-line);
  border-bottom: 2px solid var(--calendar-grid-line);
  background: #fff;
}

.calendar-house-cell {
  position: sticky;
  left: 0;
  z-index: 4;
  display: grid;
  align-content: center;
  height: calc((var(--calendar-lane-count, 1) * 20px) + ((var(--calendar-lane-count, 1) - 1) * 2px));
  border-right-color: var(--line);
}

.calendar-house-trigger {
  position: relative;
  display: inline-flex;
  width: 100%;
  min-width: 0;
  height: 20px;
  align-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.calendar-house-trigger strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-popover {
  position: absolute;
  z-index: 90;
  display: none;
  width: max-content;
  max-width: min(320px, 82vw);
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  box-shadow: 0 18px 40px rgba(23, 32, 51, 0.18);
  backdrop-filter: blur(10px);
}

.calendar-house-popover {
  left: 4px;
  top: calc(100% + 8px);
  padding: 9px 11px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.calendar-house-trigger:hover .calendar-house-popover,
.calendar-house-trigger:focus .calendar-house-popover,
.calendar-house-trigger:focus-visible .calendar-house-popover,
.calendar-reservation-bar:hover .calendar-reservation-popover,
.calendar-reservation-bar:focus .calendar-reservation-popover,
.calendar-reservation-bar:focus-visible .calendar-reservation-popover {
  display: grid;
  z-index: 100;
}

.calendar-slot {
  display: grid;
  align-content: start;
  height: calc((var(--calendar-lane-count, 1) * 20px) + ((var(--calendar-lane-count, 1) - 1) * 2px));
  gap: 6px;
}

.calendar-slot.is-booked {
  background: #fff;
}

.calendar-slot.is-overlapped {
  background: #fff;
}

.calendar-slot.is-today {
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.26);
}

.reservation-chip {
  display: grid;
  gap: 2px;
  min-height: 36px;
  padding: 7px 8px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.18;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.2);
}

.reservation-chip:hover,
.reservation-chip:focus {
  background: var(--accent-dark);
  color: #fff;
}

.reservation-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reservation-chip small {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.7rem;
}

.calendar-row-bars {
  position: absolute;
  top: 50%;
  right: 0;
  left: var(--calendar-house-column);
  display: grid;
  grid-template-columns: repeat(var(--calendar-day-count), minmax(var(--calendar-day-min), 1fr));
  grid-template-rows: repeat(var(--calendar-lane-count, 1), 20px);
  gap: 2px 0;
  align-items: stretch;
  height: calc((var(--calendar-lane-count, 1) * 20px) + ((var(--calendar-lane-count, 1) - 1) * 2px));
  padding: 0;
  transform: translateY(-50%);
  pointer-events: none;
}

.calendar-reservation-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
  min-height: 0;
  border: 0;
  height: 20px;
  margin: 0 1px;
  padding: 1px 4px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 0;
  background: #C6FFEC;
  color: #064e45;
  font-size: 0.62rem;
  font-weight: 500;
  line-height: 1.1;
  text-align: left;
  box-shadow: none;
  cursor: default;
  pointer-events: auto;
}

.calendar-reservation-bar:hover,
.calendar-reservation-bar:focus {
  z-index: 120;
  color: #064e45;
  filter: brightness(0.96);
}

.calendar-reservation-bar.is-overlapped {
  border-color: rgba(185, 28, 28, 0.26);
  background: #FFC3C3;
  color: #7f1d1d;
}

.calendar-reservation-bar.is-overlapped:hover,
.calendar-reservation-bar.is-overlapped:focus {
  color: #7f1d1d;
}

.calendar-reservation-bar.is-cancelled {
  border-color: rgba(100, 116, 139, 0.35);
  background: #DEDEDE;
  color: #172033;
}

.calendar-reservation-bar.is-cancelled:hover,
.calendar-reservation-bar.is-cancelled:focus {
  color: #172033;
}

.calendar-reservation-bar.is-apartment-changed {
  border-color: rgba(37, 99, 235, 0.34);
  background: #71AFFF;
  color: #09235a;
}

.calendar-reservation-bar.is-apartment-changed:hover,
.calendar-reservation-bar.is-apartment-changed:focus {
  color: #09235a;
}

.calendar-reservation-bar.is-cancelled-apartment-changed {
  border-color: rgba(126, 34, 206, 0.34);
  background: #D280FF;
  color: #2e1057;
}

.calendar-reservation-bar.is-cancelled-apartment-changed:hover,
.calendar-reservation-bar.is-cancelled-apartment-changed:focus {
  color: #2e1057;
}

.calendar-reservation-bar.is-stayed {
  border-color: rgba(21, 128, 61, 0.42);
  background: #029c5c;
  color: #fff;
}

.calendar-reservation-bar.is-stayed:hover,
.calendar-reservation-bar.is-stayed:focus {
  color: #fff;
}

.calendar-reservation-bar.is-same-day-multi-house {
  border-color: rgba(214, 184, 0, 0.55);
  background: #FFE746;
  color: #172033;
}

.calendar-reservation-bar.is-same-day-multi-house:hover,
.calendar-reservation-bar.is-same-day-multi-house:focus {
  color: #172033;
}

.calendar-reservation-bar.has-note,
.calendar-reservation-bar.has-note:hover,
.calendar-reservation-bar.has-note:focus {
  border-color: #8C1607;
  box-shadow: inset 0 0 0 1px #8C1607;
}

.calendar-reservation-bar.is-calendar-filtered-out {
  display: none;
}

.calendar-reservation-bar > span:not(.calendar-popover),
.calendar-reservation-bar > small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-reservation-bar small {
  color: currentColor;
  font-size: 0.56rem;
  font-weight: 500;
  opacity: 0.8;
}

.calendar-reservation-popover {
  left: 50%;
  top: calc(100% + 8px);
  bottom: auto;
  z-index: 130;
  overflow: visible;
  gap: 5px;
  min-width: 250px;
  padding: 12px;
  font-size: 0.78rem;
  line-height: 1.3;
  transform: translateX(-50%);
}

.calendar-reservation-popover strong {
  margin-bottom: 2px;
  color: var(--accent-dark);
  font-size: 0.88rem;
}

.calendar-reservation-popover span {
  display: block;
  overflow-wrap: anywhere;
  white-space: normal;
}

.calendar-reservation-popover b {
  color: var(--muted);
  font-weight: 800;
}

.calendar-reservation-bar .calendar-reservation-popover {
  display: none !important;
}

.calendar-floating-popover.calendar-reservation-popover {
  position: fixed;
  z-index: 3000;
  display: grid;
  max-height: min(72vh, 540px);
  overflow: auto;
  transform: none;
  user-select: text;
  pointer-events: auto;
}

.calendar-popover-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin: 5px -12px -12px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  background: rgba(248, 251, 252, 0.92);
}

.calendar-popover-edit {
  display: inline-flex;
  height: 30px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.calendar-popover-edit:hover,
.calendar-popover-edit:focus-visible {
  background: var(--accent-dark);
  color: #fff;
  outline: none;
}

.calendar-popover-message,
.calendar-popover-contact {
  display: inline-flex;
  width: 30px;
  height: 30px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-dark);
  text-decoration: none;
}

.calendar-popover-message:hover,
.calendar-popover-message:focus-visible,
.calendar-popover-contact:hover,
.calendar-popover-contact:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.calendar-popover-contact {
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
}

.calendar-popover-message img,
.calendar-popover-contact img {
  display: block;
  width: 17px;
  height: 17px;
}

@media (max-width: 980px) {
  .calendar-grid {
    --calendar-house-column: 150px;
    --calendar-day-min: 44px;
    min-width: calc(var(--calendar-house-column) + (var(--calendar-day-count) * var(--calendar-day-min)));
  }

  .calendar-view-week {
    --calendar-day-min: 86px;
  }
}

@media print {
  @page {
    size: landscape;
    margin: 8mm;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    background: #fff;
  }

  .app-header,
  .page-header,
  .notice,
  .calendar-nav-actions {
    display: none !important;
  }

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

  .calendar-panel {
    border: 1px solid #cbd5e1;
    box-shadow: none;
    page-break-inside: avoid;
  }

  .calendar-toolbar {
    gap: 6px;
    padding: 5px 8px;
    background: #fff;
  }

  .calendar-toolbar > div:first-child {
    flex-basis: 128px;
    min-width: 128px;
  }

  .calendar-toolbar h2 {
    font-size: 0.9rem;
  }

  .calendar-toolbar p {
    margin-top: 2px;
    font-size: 0.66rem;
    white-space: nowrap;
  }

  .calendar-legend {
    gap: 1px 2px;
    padding: 0;
  }

  .calendar-legend-item {
    height: 10px;
    min-height: 10px;
    padding: 0 2px;
    border-radius: 2px;
    font-size: 0.45rem;
    line-height: 1;
  }

  .calendar-legend-swatch {
    display: none;
  }

  .calendar-scroll {
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  .calendar-grid {
    min-width: 0;
    width: 100%;
  }

  .calendar-corner,
  .calendar-day-header,
  .calendar-house-cell {
    position: static;
  }
}

.calendar-empty {
  grid-column: 1 / -1;
  padding: 22px;
  color: var(--muted);
  background: #fff;
}

.calendar-no-results {
  border-top: 1px solid var(--line-soft);
}

.grid-panel,
.placeholder-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.compact-page-header {
  align-items: center;
  margin-bottom: 8px;
}

.compact-page-header h1 {
  margin: 5px 0;
}

.compact-toolbar {
  padding: 10px 20px;
}

.compact-toolbar h2,
.compact-toolbar p {
  display: inline-block;
  margin: 0;
}

.compact-toolbar p {
  margin-left: 12px;
}

.tax-table-wrap {
  max-height: calc(100vh - 250px);
  overflow-y: auto;
  overflow-x: auto;
  background: #fff;
}

.incassi-header {
  gap: 18px;
}

.incassi-date-form {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.incassi-date-form input {
  min-width: 180px;
}

.incassi-date-form button {
  min-width: 92px;
}

.incassi-table-wrap {
  max-height: calc(100vh - 260px);
}

.incassi-table {
  table-layout: auto;
}

.incassi-table tbody tr:nth-child(odd) td {
  background: #f3fbfa;
}

.incassi-table tbody tr:nth-child(even) td {
  background: #fff;
}

.incassi-table tbody tr:hover td {
  background: #eef8f6;
}

.incassi-table th:nth-child(1),
.incassi-table td:nth-child(1) {
  width: 140px;
}

.incassi-table th:nth-child(2),
.incassi-table td:nth-child(2),
.incassi-table th:nth-child(3),
.incassi-table td:nth-child(3) {
  width: 190px;
}

.incassi-table input,
.incassi-table textarea {
  display: block;
  width: 100%;
  height: 18px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1.15;
  outline: 0;
}

.incassi-table textarea {
  min-height: 18px;
  overflow: hidden;
  resize: vertical;
}

.incassi-table input:focus,
.incassi-table textarea:focus {
  box-shadow: inset 0 -1px 0 var(--accent);
}

.incassi-table tfoot th,
.incassi-table tfoot td {
  background: #f3fbfa;
  font-weight: 850;
}

.incassi-actions {
  display: flex;
  justify-content: flex-end;
  padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
  background: #fbfdff;
}

.incassi-output {
  display: block;
  width: 70%;
  min-height: 160px;
  margin: 0 16px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
  resize: vertical;
}

.incassi-output[hidden] {
  display: none;
}

.cleaners-planning-header {
  gap: 18px;
}

.cleaners-date-form {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.cleaners-date-form input {
  min-width: 180px;
}

.cleaners-date-form button {
  min-width: 92px;
}

.cleaners-planning-wrap {
  max-height: calc(100vh - 260px);
  overflow: auto;
  background: #fff;
}

.cleaners-planning-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 0.88rem;
  line-height: 1.15;
  table-layout: auto;
}

.cleaners-planning-table th,
.cleaners-planning-table td {
  padding: 3px 7px;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.cleaners-planning-table th:last-child,
.cleaners-planning-table td:last-child {
  border-right: 0;
}

.cleaners-planning-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ink);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.cleaners-planning-table th:nth-child(2),
.cleaners-planning-table td:nth-child(2) {
  width: 260px;
  max-width: 260px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.cleaners-planning-table th:nth-child(n+3),
.cleaners-planning-table td:nth-child(n+3) {
  text-align: center;
  vertical-align: middle;
}

.cleaners-planning-table td.source-non-booking {
  color: #800000;
  font-weight: 800;
}

.cleaner-guest-note {
  color: #FF0000;
}

.cleaner-same-day-multi-house {
  color: #4853EB;
  font-weight: 800;
}

.cleaner-whatsapp-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  vertical-align: -2px;
}

.cleaner-whatsapp-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
}

.cleaner-whatsapp-toggle:hover,
.cleaner-whatsapp-toggle:focus-visible {
  background: rgba(15, 128, 118, 0.12);
  outline: none;
}

.cleaner-whatsapp-toggle img {
  width: 13px;
  height: 13px;
  display: block;
}

.cleaner-whatsapp-options {
  position: fixed;
  z-index: 30;
  min-width: 118px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.cleaner-whatsapp-options button {
  display: block;
  width: 100%;
  padding: 5px 7px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.1;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.cleaner-whatsapp-options button:hover,
.cleaner-whatsapp-options button:focus-visible {
  background: #eaf7f5;
  outline: none;
}

.cleaners-planning-table tr.has-activity td {
  background: #f3fbfa;
}

.cleaners-planning-table tbody tr:hover td {
  background: #eef8f6;
}

.cleaners-plan-actions {
  display: flex;
  justify-content: flex-end;
  padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
  background: #fbfdff;
}

.cleaners-plan-form {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.cleaner-picker {
  position: relative;
}

.cleaner-picker summary {
  min-width: 150px;
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}

.cleaner-picker summary::-webkit-details-marker {
  display: none;
}

.cleaner-picker-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 8;
  display: grid;
  min-width: 220px;
  max-height: 260px;
  overflow-y: auto;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(23, 32, 51, 0.16);
}

.cleaner-picker-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 650;
}

.cleaner-picker-menu label:hover {
  background: var(--accent-soft);
}

.cleaner-picker-menu input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.cleaners-plan-output {
  padding: 0 16px 16px;
  background: #fbfdff;
}

.cleaners-plan-output textarea {
  width: 70%;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
  resize: vertical;
}

.cleaners-plan-editor {
  width: 70%;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  line-height: 1.55;
  white-space: normal;
}

.cleaners-plan-editor div {
  margin: 0;
}

.cleaner-plan-group strong {
  display: block;
  margin: 0 0 8px;
  font-weight: 900;
}

.cleaner-plan-message {
  margin: 0 0 12px;
}

.cleaner-plan-message:last-child {
  margin-bottom: 0;
}

.cleaner-plan-separator {
  margin: 12px 0 0;
  font-weight: 800;
}

.cleaner-priority-panel {
  margin-top: 22px;
}

.cleaner-priority-table-wrap {
  overflow-x: auto;
  background: #fff;
}

.cleaner-priority-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.cleaner-priority-table th,
.cleaner-priority-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  text-align: left;
}

.cleaner-priority-table th {
  background: var(--ink);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.cleaner-priority-table td:first-child {
  font-weight: 800;
}

.cleaner-priority-table select {
  width: 100%;
  min-height: 34px;
}

.cleaner-priority-actions {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px;
  background: #fbfdff;
}

.tax-grid {
  width: 100%;
  min-width: 2500px;
  background: #fff;
}

.tax-grid-row {
  display: grid;
  grid-template-columns:
    minmax(110px, 0.95fr)
    minmax(145px, 1.2fr)
    minmax(118px, 0.95fr)
    minmax(190px, 1.5fr)
    minmax(95px, 0.75fr)
    minmax(100px, 0.75fr)
    minmax(135px, 1fr)
    minmax(125px, 0.95fr)
    minmax(125px, 0.95fr)
    minmax(110px, 0.9fr)
    minmax(130px, 1fr)
    minmax(78px, 0.65fr)
    minmax(180px, 1.35fr)
    minmax(150px, 1.1fr)
    minmax(180px, 1.25fr)
    minmax(105px, 0.8fr)
    minmax(95px, 0.75fr)
    minmax(90px, 0.7fr)
    minmax(74px, 0.55fr);
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
}

.tax-grid-row > div {
  min-width: 0;
  padding: 7px 10px;
  overflow-wrap: anywhere;
  border-right: 1px solid rgba(203, 213, 225, 0.45);
}

.tax-grid-row [data-tax-copy],
.tax-detail-grid [data-tax-copy] {
  cursor: copy;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.tax-grid-row [data-tax-copy].is-copied,
.tax-detail-grid [data-tax-copy].is-copied {
  background: #dffcf1;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.28);
}

.tax-grid-row [data-tax-copy].copy-failed,
.tax-detail-grid [data-tax-copy].copy-failed {
  background: #fff1f2;
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.24);
}

.tax-grid-row > div:last-child {
  border-right: 0;
}

.tax-action-cell {
  text-align: center;
}

.tax-open-guest-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
}

.tax-open-guest-link:hover,
.tax-open-guest-link:focus {
  border-color: rgba(15, 118, 110, 0.5);
  background: #eefaf8;
  color: #0f766e;
}

.tax-grid-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #172033;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.tax-summary-row {
  cursor: pointer;
  background: #fff;
}

.tax-summary-row > div {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 400;
  line-height: 1.3;
}

.tax-summary-row:hover {
  background: #f8fbfc;
}

.tax-summary-row:focus {
  outline: 2px solid rgba(15, 118, 110, 0.35);
  outline-offset: -2px;
}

.tax-summary-row.is-expanded,
.tax-summary-row.is-expanded:hover {
  background: #eefaf8;
}

.tax-detail-row {
  position: sticky;
  left: 0;
  width: min(1240px, calc(100vw - 32px));
  max-width: min(1240px, calc(100vw - 32px));
  background: #eefaf8;
  border-bottom: 1px solid var(--line-soft);
}

.tax-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px 12px;
  padding: 10px 16px 12px;
  border-left: 3px solid var(--accent);
}

.tax-detail-grid div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #fff;
}

.tax-detail-grid span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tax-detail-grid strong {
  min-height: 18px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.tax-detail-grid .tax-detail-action {
  align-content: start;
}

.tax-detail-grid .tax-detail-action .tax-open-guest-link {
  width: max-content;
}

.tax-detail-wide {
  grid-column: 1 / -1;
}

.search-highlight {
  background: #ffe28a;
  border-radius: 3px;
  padding: 0 2px;
}

@media (max-width: 900px) {
  .tax-grid {
    min-width: 0;
  }

  .tax-grid-head {
    display: none;
  }

  .tax-grid-row {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .tax-grid-row > div {
    border-right: 0;
  }

  .tax-grid-row > div::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  .tax-detail-row {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }
}

.backup-content {
  display: grid;
  gap: 18px;
  padding: 22px 20px;
}

.backup-content p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
}

.restore-form {
  display: grid;
  gap: 16px;
  max-width: 640px;
}

.file-field,
.restore-confirm {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.file-field input {
  height: auto;
  padding: 11px;
}

.restore-confirm {
  grid-template-columns: auto 1fr;
  align-items: center;
  font-weight: 700;
}

.restore-confirm input {
  width: 18px;
  height: 18px;
}

.notice-success {
  border-color: rgba(15, 118, 110, 0.28);
  background: var(--accent-soft);
}

.grid-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fff, var(--panel-soft));
}

.grid-toolbar h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 850;
}

.grid-toolbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.grid-scroll {
  overflow-x: auto;
}

.staff-grid,
.record-grid {
  display: grid;
  min-width: var(--grid-min-width, 0);
}

.staff-grid-row,
.record-grid-row {
  display: grid;
  grid-template-columns: var(--grid-columns,
    minmax(130px, 1fr)
    minmax(130px, 1fr)
    minmax(150px, 1fr)
    minmax(150px, 1fr)
    96px);
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.staff-grid-row:last-child,
.record-grid-row:last-child {
  border-bottom: 0;
}

.staff-grid-head,
.record-grid-head {
  min-height: 42px;
  background: #172033;
  color: #fff;
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: auto;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  padding: 4px 6px;
  text-align: left;
  text-transform: inherit;
}

.sort-button::after {
  content: "-";
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.76rem;
  line-height: 1;
}

.sort-button:hover,
.sort-button:focus {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.sort-button.is-active::after {
  content: "^";
  color: #fff;
}

.sort-button.is-active[data-sort-direction="desc"]::after {
  content: "v";
}

.staff-grid-form,
.record-grid-form {
  transition: background-color 160ms ease, box-shadow 160ms ease;
}

.staff-data-row:hover,
.data-grid-data-row:hover {
  background: #fbfdff;
}

.staff-data-row.is-dirty,
.data-grid-data-row.is-dirty {
  background: #f3fbfa;
  box-shadow: inset 4px 0 0 var(--accent);
}

.data-grid-data-row.is-edit-target {
  position: relative;
  z-index: 1;
  background: #e9f7f5;
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.46);
}

.houses-grid {
  --grid-min-width: 1580px;
  --grid-columns:
    minmax(120px, 0.85fr)
    minmax(170px, 1.25fr)
    minmax(220px, 1.5fr)
    minmax(150px, 1fr)
    minmax(150px, 1fr)
    minmax(90px, 0.75fr)
    minmax(82px, 0.65fr)
    minmax(96px, 0.7fr)
    minmax(112px, 0.75fr)
    minmax(108px, 0.75fr)
    minmax(108px, 0.75fr)
    88px;
}

.guests-grid {
  --grid-min-width: 3300px;
  --grid-columns:
    minmax(150px, 1fr)
    minmax(116px, 0.8fr)
    minmax(130px, 0.9fr)
    minmax(130px, 0.9fr)
    minmax(150px, 1fr)
    minmax(220px, 1.2fr)
    minmax(160px, 1fr)
    minmax(160px, 1fr)
    minmax(132px, 0.9fr)
    minmax(132px, 0.9fr)
    minmax(130px, 0.85fr)
    minmax(128px, 0.85fr)
    minmax(112px, 0.72fr)
    minmax(118px, 0.75fr)
    minmax(104px, 0.75fr)
    minmax(130px, 0.85fr)
    minmax(104px, 0.75fr)
    minmax(130px, 0.85fr)
    minmax(110px, 0.75fr)
    minmax(108px, 0.75fr)
    minmax(108px, 0.75fr)
    minmax(240px, 1.5fr)
    minmax(74px, 0.55fr)
    146px;
}

.guests-page,
.guests-page input,
.guests-page select,
.guests-page textarea,
.guests-page button {
  font-weight: 400;
}

.guests-page .page-header h1 {
  margin: 5px 0;
  font-weight: 650;
  line-height: 0.95;
}

.guests-page .page-header {
  align-items: center;
  margin: 0 0 5px;
  padding: 0;
}

.guests-page .search-box {
  align-self: center;
}

.guests-page .grid-toolbar {
  padding: 3px 20px;
}

.guests-page .grid-toolbar-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.guests-page .grid-toolbar-title p {
  margin: 0;
}

.guests-page .eyebrow,
.guests-page .record-grid-head,
.guests-page .sort-button,
.guests-page .grid-toolbar h2 {
  font-weight: 600;
}

.guests-page .grid-field input,
.guests-page .grid-field select,
.guests-page .highlight-layer {
  font-weight: 400;
}

.guests-page .record-grid-form:not(.is-expanded) {
  gap: 8px;
  padding: 2px 16px;
}

.guests-page .record-grid-form:not(.is-expanded) .grid-field input,
.guests-page .record-grid-form:not(.is-expanded) .grid-field select {
  height: 34px;
  padding: 0 8px;
  font-size: 0.95rem;
  line-height: 1.1;
}

.guests-page .record-grid-form:not(.is-expanded) .date-display-input {
  padding-left: 6px;
  padding-right: 24px;
}

.guests-page .record-grid-form:not(.is-expanded) .date-picker-input {
  top: 2px;
  width: 24px;
  height: 30px;
}

.guests-page .record-grid-form:not(.is-expanded) .currency-field input {
  padding-right: 26px;
}

.guests-page .record-grid-form:not(.is-expanded) .currency-field::after {
  right: 8px;
}

.guests-page .record-grid-form:not(.is-expanded) .row-action-buttons {
  gap: 4px;
}

.guests-page .record-grid-form:not(.is-expanded) .icon-action {
  width: 34px;
  height: 34px;
}

.guests-page .record-grid-form:not(.is-expanded) .icon-action img {
  width: 26px;
  height: 26px;
}

.calculated-total-field,
.calculated-nights-field {
  background: var(--panel-soft);
  color: var(--muted);
  cursor: default;
}

.guest-import-panel {
  display: grid;
  gap: 3px;
  padding: 3px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fff, #fbfdff);
  transition: background-color 160ms ease, box-shadow 160ms ease, outline-color 160ms ease;
}

body.is-guest-file-dragging .guest-import-panel {
  outline: 2px dashed var(--accent);
  outline-offset: -8px;
  background: linear-gradient(180deg, #f0fdfa, #fff);
  box-shadow: inset 0 0 0 999px rgba(15, 118, 110, 0.04);
}

.guest-file-import {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px) 120px;
  gap: 8px;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px solid var(--line-soft);
}

.file-import-control {
  display: grid;
  gap: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.file-import-control input {
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 500;
  text-transform: none;
}

.guest-import-panel h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.1;
}

.guest-import-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.guest-import-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 8px;
  align-items: end;
  padding: 3px 0;
}

.guest-import-compose textarea {
  min-height: 118px;
  line-height: 1.45;
}

.guest-import-compose button {
  min-height: 42px;
}

.guest-import-status[data-tone="success"] {
  color: var(--accent-dark);
}

.guest-import-status[data-tone="error"] {
  color: #8a1f11;
}

.accounts-grid {
  --grid-min-width: 700px;
  --grid-columns:
    minmax(170px, 1.2fr)
    minmax(170px, 1.2fr)
    minmax(130px, 0.9fr)
    96px;
}

.access-panel {
  margin-top: 20px;
}

.access-grid {
  display: grid;
  min-width: 720px;
}

.access-grid-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(120px, 0.6fr));
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.access-grid-row:last-child {
  border-bottom: 0;
}

.access-grid-head {
  background: #172033;
  color: #fff;
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.access-page-cell {
  display: grid;
  gap: 3px;
}

.access-page-cell strong {
  font-weight: 850;
}

.access-page-cell span {
  color: var(--muted);
  font-size: 0.82rem;
}

.access-check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-weight: 800;
}

.access-check input {
  width: 20px;
  height: 20px;
  min-width: 20px;
  accent-color: var(--accent);
}

.create-row {
  background: #f1f7f6;
}

.grid-field,
.highlight-field {
  position: relative;
  min-width: 0;
}

.grid-field input,
.grid-field select {
  font-weight: 650;
}

.currency-field input {
  padding-right: 30px;
}

.currency-field::after {
  content: "EUR";
  position: absolute;
  right: 11px;
  top: 50%;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  transform: translateY(-50%);
  pointer-events: none;
}

.currency-field[data-label]::after {
  top: calc(50% + 0px);
}

.date-field {
  display: grid;
}

.date-display-input {
  padding-left: 8px;
  padding-right: 28px;
}

.date-picker-input {
  position: absolute;
  right: 2px;
  top: 4px;
  width: 26px;
  height: 34px;
  border: 0;
  background: transparent;
  color: transparent;
  padding: 0;
  box-shadow: none;
}

.date-picker-input:focus {
  box-shadow: none;
}

.date-picker-input::-webkit-calendar-picker-indicator {
  width: 18px;
  height: 18px;
  opacity: 0.78;
  cursor: pointer;
}

.highlight-layer {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  height: 42px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  line-height: 42px;
  pointer-events: none;
  white-space: pre;
}

.highlight-field.is-searching .highlight-layer {
  display: flex;
}

.highlight-field.is-searching input {
  background: transparent;
  color: transparent;
  caret-color: var(--ink);
}

.highlight-field.is-searching .date-display-input {
  color: transparent;
}

.highlight-layer mark {
  border-radius: 4px;
  background: var(--amber);
  color: #1f2937;
  padding: 0 1px;
}

.empty-row {
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}

.grid-save-all {
  display: flex;
  justify-content: flex-end;
  padding: 14px 16px;
  border-top: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fff, var(--panel-soft));
}

.grid-save-all button {
  min-width: 132px;
  box-shadow: 0 10px 26px rgba(15, 118, 110, 0.18);
}

.grid-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 16px 16px;
  background: linear-gradient(180deg, var(--panel-soft), #fff);
}

.grid-pagination[hidden] {
  display: none;
}

.grid-pagination button {
  min-width: 38px;
  height: 36px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.grid-pagination .pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 800;
  text-decoration: none;
}

.grid-pagination .pagination-link:not(.is-disabled):hover,
.grid-pagination .pagination-link:not(.is-disabled):focus {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.grid-pagination .pagination-link.is-disabled {
  opacity: 0.46;
}

.page-jump-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.page-jump-form label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.page-jump-form input {
  width: 78px;
  height: 36px;
}

.grid-pagination button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.row-action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.create-row .row-action-buttons {
  justify-content: flex-start;
  min-width: 136px;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0;
}

.icon-action img {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.save-icon-action {
  color: var(--accent-dark);
}

.save-icon-action:not(:disabled):hover,
.save-icon-action:not(:disabled):focus {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.delete-icon-action {
  color: #b42318;
}

.delete-icon-action:hover,
.delete-icon-action:focus {
  border-color: #f3b5ae;
  background: #fff1f0;
}

.cancel-icon-action {
  color: #526176;
}

.cancel-icon-action:hover,
.cancel-icon-action:focus {
  border-color: #a8b5c6;
  background: #f1f5f9;
}

.guest-cancel-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--ink);
  cursor: pointer;
}

.guest-cancel-check input {
  width: 20px;
  height: 20px;
  min-width: 20px;
  accent-color: var(--accent);
}

.guest-cancel-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice,
.validation-summary {
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 12px 14px;
}

.notice {
  border: 1px solid #fed7aa;
  background: var(--danger-soft);
  color: #8a3b12;
}

.validation-summary {
  color: #8a1f11;
}

.validation-summary ul {
  margin-bottom: 0;
}

.placeholder-panel {
  padding: 28px;
}

.placeholder-panel h2 {
  margin: 0;
  font-size: 1.25rem;
}

.placeholder-panel p {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-shell {
  display: grid;
  min-height: calc(100vh - 170px);
  place-items: center;
}

.login-panel {
  display: grid;
  gap: 16px;
  width: min(100%, 430px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 0;
  font-size: 2.6rem;
  font-weight: 850;
}

.login-panel p {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.login-panel label > span:last-child {
  color: #8a1f11;
  font-size: 0.8rem;
}

.check-row {
  display: flex !important;
  align-items: center;
  grid-template-columns: none;
  color: var(--ink) !important;
}

.check-row input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  accent-color: var(--accent);
}

.check-row span {
  color: var(--ink) !important;
}

.template-workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.template-list-panel,
.template-editor-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.template-list-header,
.template-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fff, var(--panel-soft));
}

.template-list-header h2,
.template-editor-header h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 850;
}

.template-list-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.template-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding: 10px;
}

.template-list-item {
  display: grid;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  text-decoration: none;
}

.template-list-item strong {
  font-size: 0.96rem;
}

.template-list-item span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.template-list-item:hover,
.template-list-item:focus,
.template-list-item.is-active {
  border-color: rgba(15, 118, 110, 0.25);
  background: var(--accent-soft);
  color: var(--ink);
}

.template-editor-panel {
  padding: 0;
}

.template-editor-header .eyebrow {
  margin-bottom: 6px;
}

.template-title-field,
.token-panel,
.language-editor-grid {
  padding: 18px 20px;
}

.template-title-field {
  border-bottom: 1px solid var(--line-soft);
}

.template-title-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.template-title-field span,
.language-editor span {
  display: block;
  margin-top: 8px;
  color: #8a1f11;
  font-size: 0.84rem;
}

.token-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
  background: #fbfdff;
}

.token-group h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.token-chip {
  height: 32px;
  border-color: #cfe0df;
  background: #fff;
  color: var(--accent-dark);
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.token-chip:hover,
.token-chip:focus {
  border-color: var(--accent);
  background: var(--accent-soft);
}

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

.template-settings-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 680px);
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.template-settings-panel h2 {
  margin: 0;
  font-size: 1.1rem;
}

.template-settings-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr)) 128px;
  gap: 12px;
  align-items: end;
}

.template-settings-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.template-settings-fields input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
}

.template-settings-fields small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.template-settings-save {
  min-height: 42px;
  padding: 0 14px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.language-editor {
  min-width: 0;
}

.language-editor-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.language-editor-title h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 850;
}

.language-editor-title span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 26px;
  margin: 0;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 850;
}

.template-textarea {
  min-height: 360px;
  line-height: 1.5;
}

.message-workspace {
  display: grid;
  gap: 18px;
}

.message-guest-panel,
.message-composer-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.message-guest-scroll {
  max-height: 620px;
  overflow: auto;
}

.message-guest-grid {
  min-width: 860px;
}

.message-guest-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.25fr) minmax(160px, 1fr) minmax(120px, 0.75fr) minmax(120px, 0.75fr) minmax(150px, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  padding: 12px 16px;
  text-align: left;
}

.message-guest-head {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 42px;
  background: #172033;
  color: #fff;
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.message-guest-data {
  height: auto;
  min-height: 34px;
  padding-top: 2px;
  padding-bottom: 2px;
  font-weight: 400;
}

.message-guest-data span {
  font-weight: 400;
}

.message-guest-data:hover,
.message-guest-data:focus {
  background: #fbfdff;
  outline: none;
}

.message-guest-data.is-selected {
  background: var(--accent-soft);
  box-shadow: inset 4px 0 0 var(--accent);
}

.message-guest-data strong,
.message-guest-data small,
.message-guest-data span span {
  display: block;
}

.message-guest-data small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.message-guest-pagination {
  padding: 14px 16px;
  border-top: 1px solid var(--line-soft);
  background: #fbfdff;
}

.message-composer-panel {
  padding: 0;
}

.message-composer-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fff, var(--panel-soft));
}

.message-composer-controls label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.message-preview-header {
  padding: 18px 20px 0;
}

.message-preview-header .eyebrow {
  margin-bottom: 6px;
}

.message-preview-header h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 850;
}

.message-preview-box {
  width: calc(100% - 40px);
  min-height: 300px;
  margin: 18px 20px 12px;
  line-height: 1.55;
}

.message-preview-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 20px 20px;
}

.message-preview-actions span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.share-menu {
  position: relative;
}

.share-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.share-icon {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
}

.share-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 12px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: skewY(-28deg);
}

.share-icon::after {
  content: "";
  position: absolute;
  right: 0;
  top: 1px;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.share-options {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 4;
  display: grid;
  min-width: 190px;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background:
    radial-gradient(circle at 50% 0, rgba(15, 118, 110, 0.14), transparent 52%),
    #fff;
  box-shadow: 0 18px 48px rgba(23, 32, 51, 0.14);
}

.share-options[hidden] {
  display: none;
}

.share-options button {
  width: 100%;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  white-space: nowrap;
}

.share-options button:hover,
.share-options button:focus {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 51, 0.42);
}

.confirm-backdrop[hidden] {
  display: none;
}

.confirm-dialog {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
  box-shadow: 0 24px 80px rgba(23, 32, 51, 0.2);
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 1.25rem;
}

.confirm-dialog p {
  margin: 10px 0 0;
  color: var(--muted);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 920px) {
  .staff-grid-row,
  .record-grid-row {
    grid-template-columns:
      minmax(130px, 1fr)
      minmax(130px, 1fr)
      minmax(140px, 1fr)
      92px;
  }

  .staff-grid-head div:nth-child(4),
  .staff-grid-form .grid-field:nth-of-type(4) {
    grid-column: 1 / -2;
  }

  .houses-grid {
    --grid-min-width: 1360px;
  }

  .guests-grid {
    --grid-min-width: 2380px;
  }

  .access-grid {
    min-width: 640px;
  }

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

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

  .message-composer-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guest-import-compose {
    grid-template-columns: 1fr;
  }

  .guest-file-import,
  .template-settings-panel,
  .template-settings-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 20px;
  }

  .app-nav {
    padding: 0 14px;
  }

  .nav-logo {
    max-width: 132px;
    height: 36px;
  }

  .home-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 26px;
  }

  .home-hero-logo {
    width: min(220px, 70vw);
    max-height: 90px;
    margin-bottom: 22px;
  }

  .home-hero h1 {
    font-size: 3.2rem;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header h1 {
    font-size: 2.6rem;
  }

  .search-box {
    width: 100%;
  }

  .calendar-controls {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .calendar-view-tabs {
    width: 100%;
  }

  .calendar-view-tabs a,
  .calendar-view-tabs button {
    flex: 1;
  }

  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  .calendar-legend {
    justify-content: flex-start;
    min-width: 0;
    padding: 0;
  }

  .calendar-nav-actions {
    justify-content: stretch;
  }

  .calendar-nav-actions a {
    flex: 1;
  }

  .calendar-scroll {
    max-height: 70vh;
    min-height: 360px;
  }

  .cleaners-planning-wrap {
    max-height: none;
    overflow: visible;
    background: transparent;
  }

  .cleaners-planning-table,
  .cleaners-planning-table thead,
  .cleaners-planning-table tbody,
  .cleaners-planning-table tr,
  .cleaners-planning-table th,
  .cleaners-planning-table td {
    display: block;
    width: 100%;
  }

  .cleaners-planning-table {
    border-collapse: separate;
    border-spacing: 0 8px;
    font-size: 0.84rem;
  }

  .cleaners-planning-table thead {
    display: none;
  }

  .cleaners-planning-table tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .cleaners-planning-table th,
  .cleaners-planning-table td,
  .cleaners-planning-table th:nth-child(2),
  .cleaners-planning-table td:nth-child(2),
  .cleaners-planning-table th:nth-child(n+3),
  .cleaners-planning-table td:nth-child(n+3) {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    max-width: none;
    padding: 6px 8px;
    border-right: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: top;
  }

  .cleaners-planning-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 850;
    text-transform: uppercase;
  }

  .incassi-date-form {
    width: 100%;
    justify-content: stretch;
  }

  .incassi-date-form input,
  .incassi-date-form button {
    flex: 1;
    min-width: 0;
  }

  .incassi-table-wrap {
    overflow: visible;
    background: transparent;
  }

  .incassi-table,
  .incassi-table thead,
  .incassi-table tbody,
  .incassi-table tr,
  .incassi-table th,
  .incassi-table td,
  .incassi-table tfoot {
    display: block;
    width: 100%;
  }

  .incassi-table {
    border-collapse: separate;
    border-spacing: 0 8px;
  }

  .incassi-table thead {
    display: none;
  }

  .incassi-table tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .incassi-table th,
  .incassi-table td,
  .incassi-table th:nth-child(1),
  .incassi-table td:nth-child(1),
  .incassi-table th:nth-child(2),
  .incassi-table td:nth-child(2),
  .incassi-table th:nth-child(3),
  .incassi-table td:nth-child(3) {
    width: 100%;
    padding: 8px;
    border-right: 0;
  }

  .incassi-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 850;
    text-transform: uppercase;
  }

  .incassi-table tfoot tr {
    padding: 8px;
  }

  .incassi-table tfoot th,
  .incassi-table tfoot td {
    padding: 4px 0;
    background: transparent;
  }

  .incassi-output {
    width: calc(100% - 32px);
  }

  .grid-toolbar {
    padding: 16px;
  }

  .staff-grid-head,
  .record-grid-head,
  .access-grid-head {
    display: none;
  }

  .staff-grid,
  .record-grid {
    min-width: 0;
  }

  .staff-grid-row,
  .record-grid-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }

  .staff-data-row,
  .data-grid-data-row {
    margin: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .staff-data-row.is-dirty,
  .data-grid-data-row.is-dirty {
    box-shadow: inset 4px 0 0 var(--accent);
  }

  .staff-grid-form .grid-field:nth-of-type(4) {
    grid-column: auto;
  }

  .grid-field::before {
    content: attr(data-label);
    display: block;
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  .currency-field::after {
    top: auto;
    right: 12px;
    bottom: 12px;
    transform: none;
  }

  .staff-grid-form,
  .record-grid-form {
    gap: 10px;
  }

  .staff-grid-form button,
  .record-grid-form button {
    width: 100%;
  }

  .row-action-buttons {
    justify-content: stretch;
  }

  .row-action-buttons .icon-action {
    width: 100%;
  }

  .grid-save-all {
    position: sticky;
    bottom: 0;
    padding: 12px 10px;
  }

  .grid-save-all button {
    width: 100%;
  }

  .grid-pagination {
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 10px 12px;
  }

  .grid-pagination button {
    flex: 0 0 auto;
  }

  .access-grid {
    min-width: 0;
  }

  .access-grid-row {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .confirm-actions {
    flex-direction: column-reverse;
  }

  .confirm-actions button {
    width: 100%;
  }

  .template-list-header,
  .template-editor-header {
    align-items: stretch;
    flex-direction: column;
  }

  .template-new-link,
  .template-editor-header button {
    width: 100%;
  }

  .token-panel,
  .template-list,
  .language-editor-grid {
    grid-template-columns: 1fr;
  }

  .template-textarea {
    min-height: 280px;
  }

  .message-guest-scroll {
    max-height: 560px;
  }

  .message-guest-grid {
    min-width: 0;
  }

  .message-guest-head {
    display: none;
  }

  .message-guest-row {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 10px;
    width: calc(100% - 20px);
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .message-guest-row span::before {
    content: attr(role);
    display: none;
  }

  .message-composer-controls {
    grid-template-columns: 1fr;
  }

  .message-preview-box {
    width: calc(100% - 28px);
    margin: 14px 14px 10px;
  }

  .message-preview-actions {
    align-items: stretch;
    flex-direction: column;
    padding: 0 14px 14px;
  }

  .message-preview-actions button {
    width: 100%;
  }

  .share-menu,
  .share-action {
    width: 100%;
  }

  .share-options {
    left: 0;
    right: 0;
  }
}

/* Guests keep a compact directory view until one row unfolds for editing. */
.guests-grid .guest-edit-row {
  cursor: pointer;
}

.guests-grid .guest-edit-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.grid-scroll.has-expanded-guest-row {
  overflow-x: hidden;
}

.guests-grid .guest-edit-row.is-expanded {
  position: sticky;
  left: 0;
  z-index: 4;
  box-sizing: border-box;
  width: var(--guest-editor-width, 100%);
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(132px, 100%), 1fr));
  gap: 8px 10px;
  align-items: end;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(15, 118, 110, 0.28);
  background: #f3fbfa;
  box-shadow: inset 4px 0 0 var(--accent), 0 8px 22px rgba(23, 32, 51, 0.08);
  cursor: default;
}

.guests-grid .guest-edit-row.is-expanded.is-edit-target {
  background: #e9f7f5;
  box-shadow: inset 4px 0 0 var(--accent), inset 0 0 0 1px rgba(15, 118, 110, 0.28), 0 8px 22px rgba(23, 32, 51, 0.08);
}

.guests-grid .guest-edit-row.is-expanded .grid-field::before,
.guests-grid .guest-edit-row.is-expanded .row-action-buttons::before {
  content: attr(data-label);
  display: block;
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.1;
  text-transform: uppercase;
}

.guests-grid .guest-edit-row.is-expanded .grid-field input,
.guests-grid .guest-edit-row.is-expanded .grid-field select {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  font-size: 0.95rem;
  line-height: 1.1;
  font-weight: 400;
}

.guests-grid .guest-edit-row.is-expanded .highlight-field.is-searching .highlight-layer {
  display: none;
}

.guests-grid .guest-edit-row.is-expanded .highlight-field.is-searching input,
.guests-grid .guest-edit-row.is-expanded .highlight-field.is-searching .date-display-input {
  background: #fff;
  color: var(--ink);
}

.guests-grid .guest-edit-row.is-expanded .date-display-input {
  padding-left: 6px;
  padding-right: 26px;
  font-size: 0.9rem;
}

.guests-grid .guest-edit-row.is-expanded .date-picker-input {
  right: 2px;
  top: 2px;
  z-index: 3;
  width: 22px;
  height: 30px;
  border: 0;
  background: transparent;
  color: transparent;
  opacity: 0;
  padding: 0;
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
}

.guests-grid .guest-edit-row.is-expanded .date-field::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 9px;
  width: 14px;
  height: 14px;
  z-index: 2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23172033' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M16 2v4'/%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
}

.guests-grid .guest-edit-row.is-expanded .currency-field input {
  padding-right: 26px;
}

.guests-grid .guest-edit-row.is-expanded .currency-field::after {
  right: 8px;
}

.guests-grid .guest-edit-row.is-expanded .guest-cancel-check input {
  width: 20px;
}

.guests-grid .guest-edit-row.is-expanded .cancellation-notes-field {
  grid-column: span 2;
}

.tax-button-field {
  align-items: center;
}

.tax-action {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border-color: rgba(15, 118, 110, 0.28);
  color: var(--accent-dark);
  font-size: 0.8rem;
}

.tax-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3990;
  background: rgba(15, 23, 42, 0.28);
  cursor: default;
}

.tax-popover {
  position: fixed;
  z-index: 4000;
  display: grid;
  width: min(360px, calc(100vw - 20px));
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(23, 32, 51, 0.18);
}

.tax-popover-title {
  color: var(--accent-dark);
  font-size: 0.86rem;
  font-weight: 700;
}

.tax-popover label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.1;
  text-transform: uppercase;
}

.tax-popover input,
.tax-popover select,
.tax-popover textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 400;
  text-transform: none;
}

.tax-popover input,
.tax-popover select {
  height: 32px;
  padding: 0 8px;
}

.tax-popover textarea {
  min-height: 58px;
  resize: vertical;
  padding: 8px;
}

.tax-comune-combo {
  position: relative;
}

.tax-comune-options {
  position: absolute;
  z-index: 3;
  top: calc(100% + 3px);
  right: 0;
  left: 0;
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.16);
}

.tax-comune-option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid #edf2f7;
  padding: 7px 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}

.tax-comune-option:hover,
.tax-comune-option:focus {
  background: #e8f7f4;
}

.tax-comune-option span:last-child {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.68rem;
}

.tax-comune-empty {
  padding: 8px 9px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: none;
}

.tax-cap-row {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfc;
  color: var(--muted);
  font-size: 0.78rem;
}

.tax-cap-row input {
  flex: 1;
  min-width: 0;
  height: 28px;
  border: 0;
  padding: 0;
  text-align: right;
  background: transparent;
}

.tax-cap-row select {
  flex: 0 0 86px;
  width: 86px;
  height: 28px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  font-size: 0.78rem;
}

.tax-cap-row span:last-child {
  color: var(--ink);
}

.tax-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}

.tax-popover-actions .icon-action {
  width: 32px;
  height: 32px;
}

.tax-popover-actions .icon-action img {
  width: 24px;
  height: 24px;
}

.guests-grid .guest-edit-row.is-expanded .row-action-buttons {
  align-self: end;
  justify-content: flex-end;
  gap: 4px;
}

.guests-grid .guest-edit-row.is-expanded .icon-action {
  width: 34px;
  height: 34px;
}

.guests-grid .guest-edit-row.is-expanded .icon-action img {
  width: 26px;
  height: 26px;
}

.guests-grid .guest-edit-row.is-expanded .row-action-buttons::before {
  flex-basis: 100%;
}

.guests-page [data-date-display][aria-invalid="true"] {
  border-color: #b42318;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

@media (max-width: 760px) {
  .guests-grid {
    min-width: var(--grid-min-width);
  }

  .guests-grid .guest-edit-row:not(.is-expanded) {
    grid-template-columns: var(--grid-columns);
    gap: 10px;
    margin: 0;
    padding: 12px 16px;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0;
  }

  .guests-grid .guest-edit-row.is-expanded {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 0;
    padding: 14px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .guests-grid .guest-edit-row.is-expanded .row-action-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .guests-grid .guest-edit-row.is-expanded .row-action-buttons::before {
    grid-column: 1 / -1;
  }

  .guests-grid .guest-edit-row.is-expanded .cancellation-notes-field {
    grid-column: auto;
  }
}
