:root {
  color-scheme: light;
  --ink: #17221f;
  --muted: #66726e;
  --paper: #fffdf8;
  --canvas: #f5f2ea;
  --line: #deddd6;
  --brand: #173f39;
  --brand-soft: #dfece8;
  --accent: #c96847;
  --accent-soft: #f7e6df;
  --garden: #5e824d;
  --garden-soft: #e7efe1;
  --house: #426f88;
  --house-soft: #e1edf3;
  --danger: #a33c36;
  --danger-soft: #f8e3e0;
  --warning: #8a6419;
  --warning-soft: #f8efd7;
  --success: #24684f;
  --success-soft: #deefe7;
  --shadow: 0 16px 44px rgba(26, 40, 35, .09);
  --shadow-small: 0 5px 18px rgba(26, 40, 35, .08);
  --radius: 18px;
  --radius-small: 11px;
  --sidebar: 244px;
  --topbar: 76px;
  --focus: 0 0 0 3px rgba(201, 104, 71, .28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .58; }
a { color: var(--brand); }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2.35rem); line-height: 1.12; letter-spacing: -.035em; }
h2 { font-size: clamp(1.25rem, 2vw, 1.55rem); line-height: 1.22; letter-spacing: -.02em; }
h3 { font-size: 1.02rem; }
small { color: var(--muted); font-weight: 450; }

:focus-visible { outline: 0; box-shadow: var(--focus); }

.skip-link {
  position: fixed;
  z-index: 9999;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: white;
  background: var(--brand);
  border-radius: 8px;
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; }
.noscript { padding: 12px; text-align: center; color: white; background: var(--danger); }
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

.boot-screen {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--brand-soft);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
.spinner.small { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.shell { min-height: 100dvh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 16px;
  color: #f8f5ed;
  background: var(--brand);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 0 7px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  flex: 0 0 auto;
  width: 37px; height: 37px;
  display: grid; place-items: center;
  color: var(--brand);
  background: #f9f5ea;
  border-radius: 12px;
  font-weight: 800;
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; padding: 3px; object-fit: contain; }
.brand-copy { min-width: 0; }
.brand-name { display: block; overflow: hidden; font-size: 1.02rem; font-weight: 740; text-overflow: ellipsis; white-space: nowrap; }
.brand-subtitle { display: block; color: rgba(255,255,255,.66); font-size: .75rem; }
.nav { display: grid; gap: 5px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 11px;
  color: rgba(255,255,255,.72);
  background: transparent;
  text-align: left;
  text-decoration: none;
  transition: background .16s ease, color .16s ease;
}
.nav-link:hover { color: white; background: rgba(255,255,255,.08); }
.nav-link.active { color: var(--brand); background: #f9f5ea; font-weight: 680; }
.nav-icon { width: 21px; font-size: 1rem; text-align: center; }
.sidebar-foot { margin-top: auto; }
.user-chip {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border-top: 1px solid rgba(255,255,255,.13);
}
.avatar { width: 34px; height: 34px; display: grid; place-items: center; color: var(--brand); background: #f2e4d3; border-radius: 50%; font-weight: 750; text-transform: uppercase; }
.user-name { overflow: hidden; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.logout-button { grid-column: 1 / -1; display: flex; justify-content: center; align-items: center; gap: 7px; width: 100%; margin-top: 3px; padding: 8px 10px; color: white; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.24); border-radius: 8px; font-size: .78rem; font-weight: 680; }
.logout-button:hover { color: var(--brand); background: #f9f5ea; border-color: #f9f5ea; }
.logout-mobile { display: none; color: var(--danger); border-color: #dfbbb7; }

.topbar {
  position: fixed;
  inset: 0 0 auto var(--sidebar);
  z-index: 20;
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 clamp(20px, 4vw, 48px);
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  border-bottom: 1px solid rgba(222, 221, 214, .76);
  backdrop-filter: blur(12px);
}
.topbar-title { margin: 0; font-size: 1rem; font-weight: 720; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.online-state { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .78rem; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.online-state.offline .online-dot { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.mobile-menu { display: none; }
.main {
  min-height: 100dvh;
  margin-left: var(--sidebar);
  padding: calc(var(--topbar) + 32px) clamp(20px, 4vw, 48px) 56px;
}
.content { width: min(1250px, 100%); margin: 0 auto; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.page-head h1 { margin-bottom: 6px; }
.page-head p { margin-bottom: 0; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.eyebrow { margin-bottom: 5px; color: var(--accent); font-size: .71rem; font-weight: 780; letter-spacing: .13em; text-transform: uppercase; }

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 680;
  line-height: 1.15;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button.primary { color: white; background: var(--brand); box-shadow: 0 5px 14px rgba(23,63,57,.18); }
.button.primary:hover:not(:disabled) { background: #0d342f; box-shadow: 0 7px 18px rgba(23,63,57,.24); }
.button.secondary { color: var(--brand); background: var(--brand-soft); border-color: #c7ddd7; }
.button.ghost { color: var(--ink); background: var(--paper); border-color: var(--line); }
.button.danger { color: white; background: var(--danger); }
.button.danger-ghost { color: var(--danger); background: transparent; border-color: #e5bbb7; }
.button.compact { min-height: 34px; padding: 6px 10px; font-size: .82rem; }
.button.loading { pointer-events: none; }
.button.loading::before { content: ""; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.icon-button {
  width: 39px; height: 39px;
  display: inline-grid; place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  font-size: 1.35rem;
  line-height: 1;
}
.icon-button:hover { background: #f3f0e9; }
.push-left { margin-right: auto; }

.card {
  padding: clamp(17px, 2.5vw, 25px);
  background: var(--paper);
  border: 1px solid rgba(218, 217, 209, .84);
  border-radius: var(--radius);
  box-shadow: var(--shadow-small);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head p { margin: 3px 0 0; color: var(--muted); font-size: .86rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(290px, .72fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }
.quick-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.quick-stat { padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.quick-stat strong { display: block; margin-top: 5px; font-size: 1.55rem; line-height: 1; }
.quick-stat span { color: var(--muted); font-size: .78rem; }

.calendar-controls { display: flex; align-items: center; gap: 8px; }
.calendar-title { min-width: 150px; margin: 0; text-align: center; text-transform: capitalize; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: -5px 0 15px; color: var(--muted); font-size: .75rem; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; }
.legend-dot.house { background: var(--house); }
.legend-dot.garden { background: var(--garden); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.weekday { padding: 4px 2px 7px; color: var(--muted); font-size: .7rem; font-weight: 730; text-align: center; text-transform: uppercase; }
.calendar-day {
  position: relative;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  background: #f8f6f0;
  text-align: left;
}
.calendar-day:hover { border-color: #bdc9c5; background: white; }
.calendar-day.outside { opacity: .32; }
.calendar-day.today { border-color: var(--accent); }
.calendar-day.today .day-number { color: white; background: var(--accent); }
.day-number { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; font-size: .76rem; font-weight: 700; }
.occupancy { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 3px; padding: 2px 5px; overflow: hidden; border-radius: 6px; font-size: .68rem; font-weight: 680; }
.occupancy.house { color: #244f66; background: var(--house-soft); }
.occupancy.garden { color: #3f6532; background: var(--garden-soft); }
.occupancy.empty { visibility: hidden; }

.upcoming-list { display: grid; gap: 9px; }
.upcoming-item {
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: inherit;
  background: #f8f6f0;
  text-align: left;
}
.upcoming-item:hover { border-color: var(--line); background: white; }
.date-tile { padding: 5px 2px; border-radius: 8px; color: var(--brand); background: var(--brand-soft); text-align: center; }
.date-tile strong { display: block; font-size: 1.05rem; line-height: 1; }
.date-tile span { font-size: .64rem; font-weight: 720; text-transform: uppercase; }
.item-title { display: block; overflow: hidden; font-weight: 690; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { display: block; color: var(--muted); font-size: .75rem; }
.location-badge, .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 690;
  white-space: nowrap;
}
.location-badge.house { color: #29546b; background: var(--house-soft); }
.location-badge.garden { color: #436a35; background: var(--garden-soft); }
.status-badge.active { color: var(--success); background: var(--success-soft); }
.status-badge.inactive { color: var(--muted); background: #ecebe7; }

.filter-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(130px, .65fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}
.filter-bar.compact-filter { grid-template-columns: repeat(5, minmax(120px, 1fr)) auto; }
.filter-toggle { display: none; }
label { display: grid; gap: 6px; color: #394640; font-size: .81rem; font-weight: 680; }
.label-text { display: inline-flex; align-items: center; gap: 3px; }
input, select, textarea {
  width: 100%;
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid #cfd1ca;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23,63,57,.11); }
input[type="color"] { padding: 5px; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 5px; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.input-with-icon { position: relative; }
.input-with-icon input { padding-left: 35px; }
.input-with-icon span { position: absolute; left: 12px; top: 50%; color: var(--muted); transform: translateY(-50%); }
.form-grid { display: grid; gap: 15px; }
.form-grid.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.checkbox-label { display: flex; align-items: center; gap: 9px; min-height: 43px; }
.checkbox-label input { width: 18px; min-height: 18px; accent-color: var(--brand); }
.field-help { color: var(--muted); font-size: .74rem; font-weight: 450; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
.data-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.data-table th { padding: 11px 13px; color: var(--muted); background: #f4f2ec; font-size: .7rem; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 12px 13px; border-top: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr { transition: background .12s ease; }
.data-table tbody tr:hover { background: #faf8f2; }
.data-table .row-action { width: 1%; text-align: right; }
.click-row { cursor: pointer; }
.name-cell strong { display: block; }
.name-cell small { display: block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.stay-mobile-list { display: none; }

.empty-state { min-height: 180px; display: grid; place-content: center; justify-items: center; padding: 28px; color: var(--muted); text-align: center; }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 13px; color: var(--brand); background: var(--brand-soft); border-radius: 17px; font-size: 1.4rem; }
.empty-state h3 { margin-bottom: 5px; color: var(--ink); }
.empty-state p { max-width: 380px; margin-bottom: 15px; }
.loading-state { min-height: 190px; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); }
.message { padding: 11px 13px; margin-bottom: 14px; border: 1px solid; border-radius: 10px; font-size: .85rem; }
.message.error { color: #7e2924; background: var(--danger-soft); border-color: #e6b9b5; }
.message.success { color: var(--success); background: var(--success-soft); border-color: #b9dacb; }
.message.warning { color: var(--warning); background: var(--warning-soft); border-color: #ead49d; }

.stats-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 20px; }
.metric-card { padding: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow-small); }
.metric-card span { color: var(--muted); font-size: .78rem; }
.metric-card strong { display: block; margin: 4px 0 2px; font-size: clamp(1.65rem, 4vw, 2.2rem); line-height: 1; letter-spacing: -.035em; }
.metric-card small { font-size: .7rem; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.distribution { display: grid; gap: 12px; }
.distribution-row { display: grid; grid-template-columns: minmax(75px, 1fr) 3fr auto; align-items: center; gap: 10px; }
.distribution-name { overflow: hidden; font-size: .81rem; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 9px; overflow: hidden; background: #ebe9e2; border-radius: 999px; }
.bar-fill { height: 100%; min-width: 2px; display: block; background: var(--brand); border-radius: inherit; }
.bar-fill.accent { background: var(--accent); }
.bar-fill.house { background: var(--house); }
.bar-fill.garden { background: var(--garden); }
.distribution-value { min-width: 34px; font-variant-numeric: tabular-nums; font-size: .78rem; font-weight: 700; text-align: right; }
.stats-timeline-card { margin-bottom: 20px; }
.chart-scroll { overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: thin; }
.bar-chart { min-width: 100%; height: 230px; display: flex; align-items: stretch; gap: 8px; }
.bar-chart.week { min-width: 100%; }
.chart-column { min-width: 12px; flex: 1 1 12px; display: grid; grid-template-rows: 24px minmax(130px, 1fr) 30px; gap: 2px; text-align: center; }
.chart-value { align-self: end; overflow: visible; font-size: .72rem; font-variant-numeric: tabular-nums; }
.chart-track { min-height: 0; display: flex; align-items: flex-end; overflow: hidden; background: linear-gradient(to top, #ebe9e2 1px, transparent 1px) 0 100% / 100% 25%; border-bottom: 1px solid #d7d5ce; border-radius: 5px 5px 0 0; }
.chart-bar { width: 100%; display: block; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 82%, black)); border-radius: 5px 5px 0 0; }
.chart-label { align-self: start; color: var(--muted); font-size: .68rem; font-weight: 650; line-height: 1.15; white-space: nowrap; }
.chart-empty { min-height: 170px; }

.tabs { display: flex; gap: 4px; margin-bottom: 20px; padding: 4px; overflow-x: auto; background: #eae8e1; border-radius: 12px; }
.tabs, .guest-nav { scrollbar-width: none; }
.tabs::-webkit-scrollbar, .guest-nav::-webkit-scrollbar { display: none; }
.tab-button { min-width: max-content; flex: 1; padding: 9px 13px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-weight: 680; }
.tab-button:hover { color: var(--ink); }
.tab-button.active { color: var(--brand); background: var(--paper); box-shadow: 0 2px 7px rgba(20,30,26,.08); }
.admin-grid { display: grid; grid-template-columns: minmax(230px, .58fr) minmax(0, 1.42fr); gap: 20px; align-items: start; }
.resource-list { display: grid; gap: 7px; }
.resource-button {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: inherit;
  background: #f7f5ef;
  text-align: left;
}
.resource-button:hover { border-color: var(--line); }
.resource-button.active { color: var(--brand); background: var(--brand-soft); border-color: #bfd5cf; }
.resource-button strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resource-button small { display: block; font-weight: 450; }
.wiki-page-item { grid-template-columns: auto minmax(0, 1fr) auto; gap: 5px; padding: 0 10px 0 4px; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.wiki-page-select { min-width: 0; padding: 10px 5px; overflow: hidden; color: inherit; background: transparent; border: 0; text-align: left; }
.wiki-page-select span, .wiki-page-select strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiki-drag-handle { width: 32px; height: 38px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 7px; font-size: 1.25rem; line-height: 1; cursor: grab; touch-action: none; }
.wiki-drag-handle:hover { color: var(--brand); background: rgba(23,63,57,.07); }
.wiki-drag-handle:active { cursor: grabbing; }
.wiki-drag-handle:disabled { cursor: default; opacity: .3; }
.wiki-page-item.dragging { z-index: 1; border-color: var(--accent); box-shadow: 0 9px 24px rgba(26,40,35,.15); transform: scale(1.015); opacity: .82; }
.wiki-page-list.sorting .wiki-page-item:not(.dragging) { transition: transform .12s ease; }
.wiki-page-list.sorting { user-select: none; }
.code-pill { padding: 3px 6px; color: var(--brand); background: white; border: 1px solid #cbd9d5; border-radius: 6px; font-family: ui-monospace, monospace; font-size: .7rem; }
.section-divider { height: 1px; margin: 22px 0; background: var(--line); border: 0; }
.brand-settings { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 16px; align-items: center; padding: 14px; background: #f7f5ef; border: 1px solid var(--line); border-radius: 11px; }
.brand-preview { display: grid; place-items: center; min-height: 78px; background: var(--brand); border-radius: 11px; }
.brand-preview .brand-mark { width: 52px; height: 52px; font-size: 1.15rem; }

.editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; background: #f1efe9; border: 1px solid #cfd1ca; border-bottom: 0; border-radius: 9px 9px 0 0; }
.editor-button { min-width: 34px; height: 32px; padding: 4px 8px; border: 1px solid transparent; border-radius: 6px; color: var(--ink); background: transparent; }
.editor-button:hover { background: white; border-color: var(--line); }
.rich-editor {
  min-height: 260px;
  padding: 16px;
  overflow: auto;
  border: 1px solid #cfd1ca;
  border-radius: 0 0 9px 9px;
  background: white;
  outline: none;
}
.rich-editor:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23,63,57,.11); }
.rich-content { overflow-wrap: anywhere; }
.rich-content h1, .rich-content h2, .rich-content h3 { margin-top: 1.4em; }
.rich-content a { text-decoration-thickness: 1px; text-underline-offset: 2px; }
.rich-content img { height: auto; margin: 16px auto; border-radius: 10px; }
.rich-content blockquote { margin-left: 0; padding: 8px 16px; color: var(--muted); border-left: 3px solid var(--accent); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); gap: 10px; margin-top: 13px; }
.media-card { position: relative; overflow: hidden; background: #f2f0ea; border: 1px solid var(--line); border-radius: 10px; }
.media-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.media-card-file { aspect-ratio: 4/3; display: grid; place-content: center; color: var(--muted); font-size: 1.5rem; }
.media-caption { padding: 7px; overflow: hidden; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.media-title-form { display: grid; gap: 5px; padding: 8px; }
.media-title-form input { min-height: 35px; padding: 6px 8px; font-size: .74rem; }
.media-title-form .button { width: 100%; }
.media-insert { width: 100%; border-radius: 0; }
.media-remove { position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; border: 0; border-radius: 50%; color: white; background: rgba(20,25,23,.76); }
.placeholder-list { display: flex; flex-wrap: wrap; gap: 6px; }
.placeholder { padding: 4px 7px; border: 1px solid #c9d8d3; border-radius: 7px; color: var(--brand); background: var(--brand-soft); font-family: ui-monospace, monospace; font-size: .72rem; }

.dialog {
  width: min(690px, calc(100vw - 28px));
  max-height: min(90dvh, 900px);
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 19px;
  box-shadow: 0 30px 90px rgba(13,29,24,.3);
}
.dialog::backdrop { background: rgba(11,25,21,.52); backdrop-filter: blur(3px); }
.dialog form { padding: clamp(18px, 4vw, 28px); }
.dialog-small { width: min(440px, calc(100vw - 28px)); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 21px; }
.dialog-head h2 { margin: 0; }
.dialog-head .eyebrow { margin-bottom: 4px; }
.dialog-actions, .dialog-secondary { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 23px; }
.dialog-secondary { padding-top: 16px; border-top: 1px solid var(--line); }
.mail-history { flex: 1 0 100%; padding: 10px 12px; color: var(--muted); background: #f7f5ef; border-radius: 9px; font-size: .76rem; }
.mail-history > strong { display: block; margin-bottom: 5px; color: var(--ink); }
.mail-history ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.mail-history li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.mail-history li small { overflow-wrap: anywhere; }

.toast-region { position: fixed; z-index: 10000; right: 20px; bottom: 20px; display: grid; gap: 9px; pointer-events: none; }
.toast {
  width: min(390px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  color: white;
  background: #1c2925;
  border-radius: 11px;
  box-shadow: 0 14px 42px rgba(10,20,17,.25);
  pointer-events: auto;
  animation: toast-in .22s ease-out;
}
.toast.error { background: #7d302c; }
.toast.success { background: #205a46; }
.toast button { padding: 3px; border: 0; color: inherit; background: transparent; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

.auth-page { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 560px); background: var(--paper); }
.auth-art {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(34px, 7vw, 90px);
  overflow: hidden;
  color: white;
  background: var(--brand);
}
.auth-art::before, .auth-art::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }
.auth-art::before { width: 480px; height: 480px; right: -170px; bottom: -180px; }
.auth-art::after { width: 300px; height: 300px; right: -80px; bottom: -90px; }
.auth-art .brand { z-index: 1; padding: 0; }
.auth-quote { position: relative; z-index: 1; max-width: 580px; }
.auth-quote h1 { max-width: 600px; margin-bottom: 17px; font-size: clamp(2.2rem, 5vw, 4.5rem); }
.auth-quote p { max-width: 480px; color: rgba(255,255,255,.68); font-size: 1.02rem; }
.auth-main { display: grid; place-content: center; padding: 28px; }
.auth-card { width: min(390px, 100%); }
.auth-card h1 { margin-bottom: 8px; }
.auth-card > p { margin-bottom: 25px; color: var(--muted); }
.auth-card form { display: grid; gap: 15px; }
.auth-card .button { margin-top: 6px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 49px; }
.password-toggle { position: absolute; right: 5px; top: 50%; width: 37px; height: 34px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; transform: translateY(-50%); }
.auth-mobile-brand { display: none; margin-bottom: 25px; }

.guest-body { background: #f3efe5; }
.guest-shell { min-height: 100dvh; }
.guest-header { color: white; background: var(--brand); }
.guest-header-inner { width: min(1080px, calc(100% - 36px)); margin: auto; padding: 22px 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.guest-header .brand { padding: 0; }
.guest-main { width: min(1080px, calc(100% - 36px)); margin: 0 auto; padding: 38px 0 70px; }
.guest-welcome {
  position: relative;
  padding: clamp(25px, 6vw, 54px);
  overflow: hidden;
  color: white;
  background: linear-gradient(125deg, var(--brand), #285a50);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.guest-welcome::after { content: ""; position: absolute; width: 260px; height: 260px; right: -90px; top: -120px; border: 45px solid rgba(255,255,255,.055); border-radius: 50%; }
.guest-welcome h1 { position: relative; z-index: 1; max-width: 720px; margin-bottom: 11px; font-size: clamp(2rem, 6vw, 3.7rem); }
.guest-welcome h1, .guest-page h1 { overflow-wrap: anywhere; }
.guest-welcome p { position: relative; z-index: 1; max-width: 590px; margin: 0; color: rgba(255,255,255,.74); }
.reservation-card { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 18px 30px; margin-top: 27px; padding: 16px 18px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); border-radius: 13px; backdrop-filter: blur(8px); }
.reservation-detail span { display: block; color: rgba(255,255,255,.63); font-size: .69rem; text-transform: uppercase; }
.reservation-detail strong { display: block; margin-top: 2px; }
.guest-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; margin-top: 26px; align-items: start; }
.guest-nav { position: sticky; top: 20px; display: grid; gap: 5px; padding: 9px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-small); }
.guest-nav button { padding: 9px 11px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; text-align: left; }
.guest-nav button:hover { color: var(--ink); background: #f3f0e9; }
.guest-nav button.active { color: var(--brand); background: var(--brand-soft); font-weight: 700; }
.guest-page { min-height: 300px; padding: clamp(22px, 5vw, 42px); background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-small); }
.guest-page > h1 { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.guest-media { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 26px; }
.guest-media a { overflow: hidden; color: inherit; background: #f3f1eb; border: 1px solid var(--line); border-radius: 11px; text-decoration: none; }
.guest-media img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.guest-media span { display: block; padding: 9px; overflow: hidden; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.guest-footer { padding: 24px; display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; color: var(--muted); text-align: center; font-size: .78rem; }
.guest-footer-link { padding: 0; color: inherit; background: transparent; border: 0; font: inherit; text-decoration: underline; text-underline-offset: 3px; }
.guest-footer-link:hover { color: var(--ink); }
.privacy-dialog form { min-height: min(70dvh, 680px); }
.privacy-content { max-width: 760px; }

@media (max-width: 1050px) {
  :root { --sidebar: 210px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid > .stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar.compact-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar > :first-child { grid-column: span 2; }
  .stats-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  :root { --topbar: 62px; }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .sidebar {
    inset: auto 0 0;
    width: auto;
    height: calc(68px + env(safe-area-inset-bottom));
    display: block;
    padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid rgba(255,255,255,.12);
  }
  .sidebar > .brand, .sidebar-foot { display: none; }
  .nav { grid-template-columns: repeat(4, 1fr); gap: 2px; }
  .nav-link { min-width: 0; height: 55px; flex-direction: column; justify-content: center; gap: 1px; padding: 4px 2px; font-size: .66rem; text-align: center; }
  .nav-icon { height: 20px; font-size: .95rem; }
  .nav-link.active { color: white; background: rgba(255,255,255,.13); }
  .topbar { inset: 0 0 auto; padding: 0 16px; }
  .mobile-menu { display: none; }
  .topbar .online-state span:last-child { display: none; }
  .logout-mobile { display: inline-flex; }
  .main { margin-left: 0; padding: calc(var(--topbar) + 24px) 15px 32px; }
  #dashboard-quick { display: none; }
  .page-head { align-items: flex-start; margin-bottom: 19px; }
  .page-head .page-description { display: none; }
  .page-actions .button-label-optional { display: none; }
  .stats-print-action { display: none; }
  .card { padding: 15px; border-radius: 15px; }
  .quick-stats { grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .quick-stat { padding: 11px; }
  .quick-stat strong { font-size: 1.25rem; }
  .calendar-card { padding: 12px 7px; }
  .calendar-card .card-head { padding: 0 6px; }
  .calendar-title { min-width: 116px; font-size: 1rem; }
  .calendar-legend { padding: 0 6px; }
  .calendar-grid { gap: 2px; }
  .calendar-day { min-height: 70px; gap: 3px; padding: 4px 3px; border-radius: 7px; }
  .day-number { width: 22px; height: 22px; font-size: .67rem; }
  .occupancy { padding: 2px 3px; font-size: .65rem; }
  .dashboard-grid > .stack { grid-template-columns: 1fr; }
  .filter-bar, .filter-bar.compact-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar > :first-child { grid-column: span 2; }
  .filter-bar .button { width: 100%; }
  .filter-toggle {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    color: var(--ink);
    background: #f8f6f0;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-weight: 700;
  }
  .filter-toggle-icon { font-size: 1.2rem; transition: transform .15s ease; }
  .filter-toggle[aria-expanded="true"] .filter-toggle-icon { transform: rotate(180deg); }
  .stay-filter-form { margin-top: 12px; }
  .stay-filter-form:not(.is-open) { display: none; }
  .table-wrap { border: 0; overflow: visible; }
  .stays-desktop-table { display: none; }
  .stay-mobile-list { display: grid; gap: 8px; }
  .stay-mobile-card { width: 100%; display: grid; gap: 11px; padding: 12px; color: inherit; background: #f8f6f0; border: 1px solid var(--line); border-radius: 11px; text-align: left; }
  .stay-mobile-card:hover { background: white; border-color: #bdc9c5; }
  .stay-mobile-head { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
  .stay-mobile-name { min-width: 0; }
  .stay-mobile-name strong, .stay-mobile-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .stay-mobile-name strong { font-size: 1rem; }
  .stay-mobile-name small { margin-top: 1px; font-size: .72rem; font-weight: 500; }
  .stay-mobile-facts { display: grid; grid-template-columns: minmax(0, 1.8fr) .55fr minmax(0, 1fr); gap: 10px; }
  .stay-mobile-facts > span { min-width: 0; }
  .stay-mobile-facts small, .stay-mobile-facts strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .stay-mobile-facts small { color: var(--muted); font-size: .63rem; font-weight: 650; }
  .stay-mobile-facts strong { margin-top: 2px; font-size: .76rem; font-weight: 680; }
  .stats-grid { grid-template-columns: 1fr; }
  .bar-chart { height: 205px; }
  .bar-chart.week { min-width: max(100%, calc(var(--chart-count, 1) * 42px)); }
  .chart-column { min-width: 34px; flex: 1 0 34px; }
  .bar-chart.week .chart-label::before { content: "KW "; }
  .dialog-wide { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border-radius: 0; }
  .dialog-wide form { min-height: 100%; padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
  .admin-grid { grid-template-columns: 1fr; }
  .form-grid.three-cols { grid-template-columns: 1fr 1fr; }
  .form-grid.three-cols .span-3 { grid-column: span 2; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-main { min-height: 100dvh; align-content: center; }
  .auth-mobile-brand { display: block; }
  .auth-mobile-brand .brand-mark { width: 48px; height: 48px; color: white; background: var(--brand); border-radius: 14px; font-size: 1.25rem; }
  .guest-layout { grid-template-columns: 1fr; }
  .guest-nav { position: static; grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .guest-body { padding-bottom: 0; }
}

@media (max-width: 480px) {
  .page-head { display: grid; }
  .page-actions { width: 100%; }
  .page-actions .button { flex: 1; }
  .quick-stats { overflow-x: auto; grid-template-columns: repeat(3, minmax(104px, 1fr)); }
  .calendar-day .occupancy { width: 100%; justify-content: center; gap: 2px; padding-inline: 1px; }
  .calendar-day .occupancy span { font-size: 0; }
  .calendar-day .occupancy.house span::after { content: "H"; font-size: .65rem; }
  .calendar-day .occupancy.garden span::after { content: "G"; font-size: .65rem; }
  .form-grid.two-cols, .form-grid.three-cols { grid-template-columns: 1fr; }
  .span-2, .span-3, .form-grid.three-cols .span-3 { grid-column: span 1; }
  .filter-bar, .filter-bar.compact-filter { grid-template-columns: 1fr; }
  .filter-bar > :first-child { grid-column: auto; }
  .stats-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { padding: 14px; }
  .dialog-actions .button { flex: 1; }
  .dialog-secondary .button { flex: 1 1 140px; }
  .brand-settings { grid-template-columns: 1fr; }
  .push-left { margin-right: 0; }
  .toast-region { right: 16px; bottom: calc(82px + env(safe-area-inset-bottom)); }
  .guest-header-inner, .guest-main { width: min(100% - 24px, 1080px); }
  .guest-header-inner { padding: 15px 0; }
  .guest-welcome { border-radius: 18px; }
  .reservation-card { display: grid; grid-template-columns: 1fr 1fr; }
  .guest-page { padding: 20px; }
}

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

@media print {
  :root { --paper: white; --canvas: white; }
  body { padding: 0; color: black; background: white; font-size: 11pt; }
  .sidebar, .topbar, .page-actions, .filter-bar, .tabs, .button, .guest-nav, .toast-region { display: none !important; }
  .main { margin: 0; padding: 0; }
  .card, .metric-card, .guest-page, .guest-welcome { color: black; background: white; border: 1px solid #bbb; box-shadow: none; break-inside: avoid; }
  .guest-main { width: 100%; padding: 0; }
  .guest-layout { display: block; }
  .guest-header { color: black; background: white; border-bottom: 1px solid #bbb; }
  .guest-welcome p, .reservation-detail span { color: #444; }
  .reservation-card { border-color: #bbb; }
  a { color: black; text-decoration: none; }
}
