:root {
  --bg: #f4f0e7;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #18312f;
  --muted: #677571;
  --line: #dedbd1;
  --accent: #d5623f;
  --accent-dark: #a94328;
  --green: #245f59;
  --green-soft: #e7f2ef;
  --amber: #b87823;
  --amber-soft: #fbefd9;
  --danger: #a7433a;
  --danger-soft: #f8e3df;
  --shadow: 0 18px 46px rgba(32, 48, 44, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(213, 98, 63, 0.28); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px; background: #163d39; color: #f9f7f1; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 0 8px 26px; border-bottom: 1px solid rgba(255,255,255,.14); }
.brand-mark { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 14px; background: #f7eee3; color: var(--accent-dark); }
.brand-mark svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand small { margin-top: 3px; color: rgba(255,255,255,.63); font-size: 11px; }
.main-nav { display: grid; gap: 7px; margin-top: 30px; }
.nav-item { min-height: 46px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 12px; padding: 0 14px; color: rgba(255,255,255,.68); background: transparent; text-align: left; transition: background .18s ease, color .18s ease; }
.nav-item > span:first-child { width: 24px; font-size: 21px; line-height: 1; text-align: center; }
.nav-item:hover, .nav-item.is-active { color: #fff; background: rgba(255,255,255,.11); }
.sidebar-foot { margin-top: auto; display: flex; align-items: flex-start; gap: 10px; padding: 18px 10px 0; border-top: 1px solid rgba(255,255,255,.14); }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { font-size: 12px; }
.sidebar-foot small { margin-top: 4px; color: rgba(255,255,255,.58); font-size: 10px; }
.status-dot { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: #6fce9b; box-shadow: 0 0 0 4px rgba(111,206,155,.12); }

.main-content { min-width: 0; padding: 34px clamp(24px, 4vw, 64px) 56px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 8px; color: var(--accent-dark); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { text-wrap: pretty; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(30px, 4vw, 48px); line-height: 1; font-weight: 500; letter-spacing: -.035em; }
h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(24px, 3vw, 34px); font-weight: 500; letter-spacing: -.025em; }
h3 { margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.api-pill, .read-only-badge, .result-status { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.api-pill > span { width: 7px; height: 7px; border-radius: 50%; background: #4aa67f; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); font-size: 20px; }
.icon-button:hover { border-color: var(--green); }

.view { display: none; }
.view.is-active { display: block; animation: view-in .24s ease both; }
@keyframes view-in { from { opacity: .3; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric-card { min-height: 140px; display: flex; flex-direction: column; justify-content: space-between; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255,253,248,.78); }
.metric-card span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card strong { font-family: Georgia, "Times New Roman", serif; font-size: 34px; font-weight: 500; }
.metric-card small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.metric-card--accent { background: #173f3b; border-color: #173f3b; color: #fff; }
.metric-card--accent span, .metric-card--accent small { color: rgba(255,255,255,.64); }

.search-panel, .results-section, #calendar-view, #rooms-view { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.search-panel { padding: clamp(22px, 3vw, 34px); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.section-heading--compact { align-items: center; }
.search-form { display: grid; grid-template-columns: 1.2fr 1.2fr .9fr .9fr .9fr auto; align-items: end; gap: 12px; }
.search-form label, .calendar-controls label { display: grid; gap: 7px; }
.search-form label > span, .calendar-controls label > span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
input, select { width: 100%; height: 48px; border: 1px solid #d7d5cc; border-radius: var(--radius-sm); padding: 0 13px; background: #fff; color: var(--ink); font-size: 14px; }
input:hover, select:hover { border-color: #acaea6; }
.primary-button, .secondary-button, .outline-button { min-height: 48px; border-radius: var(--radius-sm); font-weight: 800; }
.primary-button { min-width: 132px; display: inline-flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 18px; border: 0; background: var(--accent); color: #fff; }
.primary-button:hover { background: var(--accent-dark); }
.primary-button:disabled { opacity: .58; cursor: wait; }
.secondary-button { border: 1px solid var(--green); padding: 0 18px; background: var(--green); color: #fff; }
.outline-button { width: 100%; border: 1px solid var(--line); background: #f7f4ed; color: var(--muted); cursor: not-allowed; }
.request-preview { min-height: 18px; margin-top: 14px; color: var(--muted); font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }

.results-section { margin-top: 20px; padding: clamp(22px, 3vw, 34px); }
.result-status.is-available { border-color: #b7d9cc; background: var(--green-soft); color: var(--green); }
.result-status.is-error { border-color: #e5bdb5; background: var(--danger-soft); color: var(--danger); }
.results-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.result-card { position: relative; overflow: hidden; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-strong); }
.result-accent { position: absolute; inset: 0 0 auto; height: 4px; background: var(--green); }
.result-card-head { display: flex; justify-content: space-between; gap: 16px; }
.availability-label { display: inline-block; margin: 6px 0 12px; color: var(--green); font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.result-card h3 { font-family: Georgia, "Times New Roman", serif; font-size: 22px; font-weight: 500; }
.result-description { min-height: 42px; margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.price-block { flex: 0 0 auto; text-align: right; }
.price-block span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.price-block strong { display: block; margin-top: 3px; font-size: 20px; }
.result-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0; }
.result-meta span { padding: 7px 9px; border-radius: 9px; background: #f3f0e9; color: var(--muted); font-size: 10px; font-weight: 700; }
.rate-breakdown { display: grid; gap: 6px; margin-bottom: 16px; padding: 12px; border-radius: 12px; background: #f8f5ef; }
.rate-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.empty-state, .loading-state, .error-state { grid-column: 1 / -1; min-height: 230px; display: grid; place-items: center; align-content: center; gap: 9px; padding: 32px; border: 1px dashed #cfcac0; border-radius: var(--radius-md); text-align: center; }
.empty-state h3, .loading-state h3, .error-state h3 { font-family: Georgia, "Times New Roman", serif; font-size: 22px; font-weight: 500; }
.empty-state p, .loading-state p, .error-state p { max-width: 560px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 24px; }
.error-state .empty-icon { background: var(--danger-soft); color: var(--danger); }

#calendar-view, #rooms-view { padding: clamp(22px, 3vw, 34px); }
.calendar-heading { align-items: flex-end; }
.calendar-controls { display: flex; align-items: flex-end; gap: 10px; }
.calendar-controls input { width: 150px; }
.calendar-controls select { width: 110px; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin: -8px 0 18px; color: var(--muted); font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot--open { background: #4a9a7b; }
.legend-dot--low { background: #d59531; }
.legend-dot--closed { background: #b95448; }
.calendar-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
.calendar-table { min-width: 980px; display: grid; }
.calendar-row { display: grid; grid-template-columns: 190px repeat(var(--calendar-days), minmax(92px, 1fr)); }
.calendar-row + .calendar-row { border-top: 1px solid var(--line); }
.calendar-cell { min-height: 82px; padding: 12px; border-right: 1px solid var(--line); background: #fff; }
.calendar-cell:last-child { border-right: 0; }
.calendar-head .calendar-cell { min-height: 62px; background: #f4f1ea; }
.calendar-date strong, .calendar-date span { display: block; }
.calendar-date strong { font-size: 12px; }
.calendar-date span { margin-top: 3px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.calendar-type { position: sticky; left: 0; z-index: 2; background: var(--surface) !important; box-shadow: 8px 0 18px rgba(35,45,42,.04); }
.calendar-type strong { display: block; font-size: 13px; }
.calendar-type span { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.inventory-cell { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.inventory-cell strong { font-size: 18px; }
.inventory-cell span { color: var(--muted); font-size: 10px; }
.inventory-cell small { font-size: 10px; font-weight: 800; }
.inventory-cell.is-open small { color: var(--green); }
.inventory-cell.is-low { background: var(--amber-soft); }
.inventory-cell.is-low small { color: var(--amber); }
.inventory-cell.is-closed { background: var(--danger-soft); }
.inventory-cell.is-closed small { color: var(--danger); }

.room-types-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.room-type-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; }
.room-type-visual { min-height: 132px; display: flex; align-items: flex-end; padding: 18px; color: #fff; background: var(--room-color); }
.room-type-visual span { font: 600 11px/1.3 ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.room-type-body { padding: 20px; }
.room-type-body h3 { font-family: Georgia, "Times New Roman", serif; font-size: 24px; font-weight: 500; }
.room-type-body p { min-height: 42px; margin: 8px 0 18px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.room-type-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.room-type-details div { padding: 11px; border-radius: 10px; background: #f4f1ea; }
.room-type-details span, .room-type-details strong { display: block; }
.room-type-details span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.room-type-details strong { margin-top: 4px; font-size: 13px; }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .primary-button { width: 100%; }
  .results-grid, .room-types-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: auto; height: auto; padding: 16px; }
  .brand { padding: 0 0 14px; border-bottom: 0; }
  .main-nav { grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; }
  .nav-item { min-height: 48px; justify-content: center; padding: 0 8px; }
  .nav-item > span:first-child { display: none; }
  .sidebar-foot { display: none; }
  .main-content { padding: 24px 16px 42px; }
  .topbar { align-items: center; margin-bottom: 22px; }
  .api-pill { display: none; }
  .calendar-heading { align-items: flex-start; }
  .calendar-controls { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .calendar-controls input, .calendar-controls select { width: 100%; }
  .calendar-controls button { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .brand small { display: none; }
  .main-nav { overflow-x: auto; }
  .nav-item { min-width: 106px; font-size: 12px; }
  .topbar { align-items: flex-end; }
  h1 { font-size: 32px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 126px; padding: 16px; }
  .metric-card strong { font-size: 28px; }
  .section-heading, .calendar-heading { display: grid; gap: 14px; }
  .read-only-badge { width: max-content; }
  .search-form { grid-template-columns: 1fr 1fr; }
  .search-form label:nth-of-type(3), .search-form label:nth-of-type(4), .search-form label:nth-of-type(5) { grid-column: span 1; }
  .primary-button { grid-column: 1 / -1; min-height: 52px; }
  input, select { min-height: 48px; font-size: 16px; }
  .results-grid, .room-types-grid { grid-template-columns: 1fr; }
  .result-card-head { display: block; }
  .price-block { margin-top: 14px; text-align: left; }
  .room-type-details { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 390px) {
  .metrics { grid-template-columns: 1fr; }
  .metric-card { min-height: 112px; }
  .search-form { grid-template-columns: 1fr; }
  .search-form label, .search-form label:nth-of-type(n), .primary-button { grid-column: 1; }
}
