/* =========================================================================
   LaVista Agent Portal — "Rack & Board"
   A rate-tariff ledger crossed with an airport departure board: ink-navy
   surfaces, stone-paper working area, a muted brass accent, and status
   badges styled like split-flap tiles. Motion is kept deliberately quiet -
   this is a tool agents open fast on a phone, not a showcase.
   ========================================================================= */

:root {
  --ink: #0F2436;
  --ink-2: #16324A;
  --ink-3: #1D3D59;
  --paper: #EDEEEA;
  --paper-2: #E3E5DD;
  --paper-3: #D7DACF;
  --white: #FFFFFF;
  --brass: #C08A2E;
  --brass-dark: #9C6F22;
  --brass-light: #E4B968;
  --pine: #2F6F52;
  --pine-light: #E6F0EA;
  --brick: #A83A32;
  --brick-light: #F5E6E4;
  --slate: #5B6472;
  --line: #C9CCC4;
  --line-dark: rgba(255, 255, 255, 0.14);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Roboto Mono", Menlo, Consolas, monospace;

  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 14px;
  --shadow-card: 0 1px 2px rgba(15, 36, 54, 0.06), 0 1px 1px rgba(15, 36, 54, 0.04);
  --shadow-pop: 0 8px 24px rgba(15, 36, 54, 0.16);
  --sidebar-w: 232px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

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

a { color: var(--ink); text-decoration-color: var(--brass); text-decoration-thickness: 2px; }
a:hover { color: var(--brass-dark); }
a.plain { text-decoration: none; color: inherit; }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3, h4 { margin: 0 0 4px; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 10px; }
.muted { color: var(--slate); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.72rem;
  color: var(--slate);
  font-weight: 600;
}

/* ---------------------------------------------------------------- shell */
.app-shell { min-height: 100vh; display: flex; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 20px 20px 90px; max-width: 1160px; width: 100%; margin: 0 auto; }
@media (min-width: 720px) { .content { padding: 28px 32px 48px; } }

.page-head { margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- top bar (auth pages + agency) */
.topbar {
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -0.01em; color: var(--paper); }
.brand-mark {
  width: 28px; height: 28px; border-radius: 6px;
  background: linear-gradient(155deg, var(--brass-light), var(--brass-dark));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 800; color: var(--ink); font-size: 13px;
}
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 0.85rem; }
.topbar-right a { color: var(--paper); opacity: 0.85; }
.topbar-right a:hover { opacity: 1; }

/* ---------------------------------------------------------------- staff sidebar */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--ink); color: var(--paper);
  display: none; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
@media (min-width: 900px) { .sidebar { display: flex; } }
.sidebar-brand { padding: 20px 18px 14px; }
.sidebar-nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; flex: 1; }
.sidebar-nav a {
  color: rgba(237,238,234,0.78); text-decoration: none; padding: 9px 12px; border-radius: var(--radius-s);
  font-size: 0.89rem; font-weight: 600; display: flex; align-items: center; gap: 9px;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: var(--paper); }
.sidebar-nav a.active { background: rgba(192,138,46,0.16); color: var(--white); border-left-color: var(--brass); }
.sidebar-section-label { padding: 14px 12px 4px; font-family: var(--font-mono); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.09em; color: rgba(237,238,234,0.45); }
.sidebar-footer { padding: 12px 18px 18px; font-size: 0.78rem; color: rgba(237,238,234,0.55); border-top: 1px solid var(--line-dark); margin-top: 6px; }
.sidebar-footer a { color: rgba(237,238,234,0.85); }

/* mobile top nav for staff (horizontal scroll, no JS) */
.staff-mobile-nav {
  display: flex; overflow-x: auto; gap: 4px; padding: 8px 10px; background: var(--ink);
  position: sticky; top: 0; z-index: 20; -webkit-overflow-scrolling: touch;
}
@media (min-width: 900px) { .staff-mobile-nav { display: none; } }
.staff-mobile-nav a {
  color: rgba(237,238,234,0.75); text-decoration: none; font-size: 0.78rem; font-weight: 700;
  padding: 7px 11px; border-radius: 999px; white-space: nowrap; flex-shrink: 0;
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em;
}
.staff-mobile-nav a.active { background: var(--brass); color: var(--ink); }

/* ---------------------------------------------------------------- agency bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--ink); display: flex; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(0,0,0,0.18);
}
@media (min-width: 900px) { .bottom-nav { display: none; } }
.bottom-nav a {
  flex: 1; text-align: center; color: rgba(237,238,234,0.68); text-decoration: none;
  font-size: 0.68rem; font-weight: 700; padding: 7px 4px 5px; border-radius: var(--radius-s);
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.03em;
}
.bottom-nav a .ico { display: block; font-size: 1.15rem; margin-bottom: 1px; }
.bottom-nav a.active { color: var(--brass-light); }
.has-bottom-nav .content { padding-bottom: 84px; }

.agency-desktop-nav { display: none; }
@media (min-width: 900px) {
  .agency-desktop-nav { display: flex; gap: 4px; }
  .agency-desktop-nav a { color: rgba(237,238,234,0.8); text-decoration: none; font-weight: 700; font-size: 0.85rem; padding: 8px 12px; border-radius: var(--radius-s); }
  .agency-desktop-nav a.active, .agency-desktop-nav a:hover { background: rgba(255,255,255,0.08); color: var(--white); }
  .has-bottom-nav .bottom-nav { display: none; }
  .has-bottom-nav .content { padding-bottom: 48px; }
}

/* ---------------------------------------------------------------- cards / panels */
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-l);
  padding: 18px; box-shadow: var(--shadow-card); margin-bottom: 16px;
}
.card-tight { padding: 14px 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 10px; flex-wrap: wrap; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat-card { background: var(--ink); color: var(--paper); border-radius: var(--radius); padding: 14px 16px; }
.stat-card .num { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 700; color: var(--white); }
.stat-card .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(237,238,234,0.7); font-weight: 600; }
.stat-card a { color: inherit; text-decoration: none; display: block; }

/* ---------------------------------------------------------------- flip-tile badges (signature element) */
.tile {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono);
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--ink); color: var(--paper); padding: 4px 9px 4px 8px; border-radius: 4px;
  border-left: 3px solid var(--slate);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
  white-space: nowrap;
}
.tile-pine { border-left-color: var(--pine); }
.tile-brick { border-left-color: var(--brick); }
.tile-brass { border-left-color: var(--brass); }
.tile-slate { border-left-color: var(--slate); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-sans); font-weight: 700; font-size: 0.86rem; cursor: pointer;
  border-radius: var(--radius-s); border: 1px solid transparent; padding: 9px 14px;
  text-decoration: none; line-height: 1.2; transition: transform 0.05s ease, background 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--ink-2); color: var(--white); }
.btn-brass { background: var(--brass); color: var(--ink); }
.btn-brass:hover { background: var(--brass-dark); color: var(--white); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--ink); }
.btn-danger { background: var(--brick); color: var(--white); }
.btn-danger:hover { background: #8a2e28; }
.btn-ghost { background: transparent; color: var(--slate); border: none; padding: 8px 10px; }
.btn-ghost:hover { color: var(--ink); text-decoration: underline; }
.btn-sm { padding: 6px 10px; font-size: 0.78rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------------------------------------------------------------- forms */
label { display: block; font-size: 0.78rem; font-weight: 700; margin-bottom: 5px; color: var(--ink); }
.field { margin-bottom: 14px; }
.field-hint { font-size: 0.75rem; color: var(--slate); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], input[type=url], select, textarea {
  width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--radius-s);
  font-size: 0.92rem; font-family: var(--font-sans); background: var(--white); color: var(--ink);
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--brass); }
.form-row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .form-row.cols-2 { grid-template-columns: 1fr 1fr; } .form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; } }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
form.inline { display: inline; }

/* ---------------------------------------------------------------- tables (ledger) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
thead th {
  background: var(--ink); color: var(--paper); text-align: left; padding: 10px 12px;
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700;
  position: sticky; top: 0; white-space: nowrap;
}
tbody td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--paper); }
td.num, th.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.row-muted td { color: var(--slate); }

/* card-collapse for small screens: table -> stacked cards */
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border-top: 1px solid var(--line); padding: 10px 4px; }
  table.stack td { border: none; padding: 4px 8px; display: flex; justify-content: space-between; gap: 10px; }
  table.stack td::before { content: attr(data-label); font-weight: 700; color: var(--slate); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
}

/* ---------------------------------------------------------------- alerts / flash */
.flash { border-radius: var(--radius-s); padding: 11px 14px; margin-bottom: 14px; font-size: 0.87rem; font-weight: 600; }
.flash-success { background: var(--pine-light); color: var(--pine); border: 1px solid #bfe0cf; }
.flash-error { background: var(--brick-light); color: var(--brick); border: 1px solid #e7c3bf; }

/* ---------------------------------------------------------------- empty states */
.empty {
  text-align: center; padding: 40px 20px; color: var(--slate); border: 1px dashed var(--line);
  border-radius: var(--radius); background: var(--white);
}
.empty .eyebrow { display: block; margin-bottom: 6px; }

/* ---------------------------------------------------------------- details/summary inline-edit rows (no JS needed) */
details.edit-row { border-top: 1px solid var(--line); }
details.edit-row summary {
  list-style: none; cursor: pointer; padding: 10px 12px; display: flex; align-items: center;
  justify-content: space-between; gap: 10px; font-size: 0.87rem;
}
details.edit-row summary::-webkit-details-marker { display: none; }
details.edit-row summary .edit-hint { font-family: var(--font-mono); font-size: 0.68rem; color: var(--brass-dark); text-transform: uppercase; letter-spacing: 0.05em; }
details.edit-row[open] summary { background: var(--paper); }
details.edit-row .edit-body { padding: 12px; background: var(--paper); border-top: 1px dashed var(--line); }

/* ---------------------------------------------------------------- auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--ink); }
.auth-card { width: 100%; max-width: 400px; background: var(--white); border-radius: var(--radius-l); padding: 28px 26px; box-shadow: var(--shadow-pop); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.auth-links { text-align: center; margin-top: 14px; font-size: 0.85rem; }

/* ---------------------------------------------------------------- misc */
.hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.pill-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pill-filter a { text-decoration: none; font-size: 0.78rem; font-weight: 700; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--slate); }
.pill-filter a.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.search-box { margin-bottom: 12px; }
.badge-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--brick); color: white; font-size: 0.68rem; font-weight: 700; font-family: var(--font-mono); }
.two-col { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 860px) { .two-col { grid-template-columns: 320px 1fr; align-items: start; } }
.hotel-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius); background: var(--paper-2); display: block; }
.file-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); font-size: 0.86rem; }
.file-row:first-child { border-top: none; }

/* ---------------------------------------------------------------- search bar + offer cards
   The agency-facing "find me a room for these dates" flow. Deliberately
   shaped like a travel search: dates first, then one card per sellable
   option with the stay total as the headline number. */
.search-bar {
  display: grid; gap: 10px; align-items: end;
  grid-template-columns: 1fr; background: var(--ink); color: var(--paper);
  padding: 14px; border-radius: var(--radius-l); margin-bottom: 18px;
}
@media (min-width: 720px) {
  .search-bar { grid-template-columns: 1fr 1fr 100px auto; }
}
.search-field label {
  color: rgba(237,238,234,0.75); font-family: var(--font-mono);
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 4px;
}
.search-field input, .search-field select { padding: 9px 10px; }
.search-go { height: 39px; }

.offer-card {
  display: grid; gap: 10px; grid-template-columns: 1fr; align-items: center;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--shadow-card);
}
@media (min-width: 680px) {
  .offer-card { grid-template-columns: 1fr auto 150px; gap: 18px; }
}
.offer-card-hotel:hover { border-color: var(--brass); }
.offer-room { font-weight: 800; font-size: 1rem; letter-spacing: -0.01em; }
.offer-meta { color: var(--slate); font-size: 0.83rem; margin-top: 2px; }
.offer-price { text-align: left; }
@media (min-width: 680px) { .offer-price { text-align: right; } }
.offer-total {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 1.25rem; font-weight: 700; color: var(--ink);
}
.offer-nightly { font-size: 0.78rem; color: var(--slate); font-family: var(--font-mono); }

details.tariff-toggle { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
details.tariff-toggle summary {
  cursor: pointer; font-weight: 700; font-size: 0.88rem; color: var(--slate);
  list-style: none; padding: 6px 0;
}
details.tariff-toggle summary::-webkit-details-marker { display: none; }
details.tariff-toggle summary::before { content: "▸ "; color: var(--brass); }
details.tariff-toggle[open] summary::before { content: "▾ "; }
details.tariff-toggle summary:hover { color: var(--ink); }

/* ---------------------------------------------------------------- offer thumbnails + room modal */
.offer-card { grid-template-columns: 1fr; }
@media (min-width: 680px) {
  .offer-card { grid-template-columns: 130px 1fr auto 150px; gap: 16px; }
}
.offer-thumb img, .offer-thumb-empty {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius-s); display: block;
}
.offer-thumb-empty {
  background: repeating-linear-gradient(45deg, var(--paper-2), var(--paper-2) 10px, var(--paper-3) 10px, var(--paper-3) 20px);
}
.offer-room-link {
  background: none; border: none; padding: 0; cursor: pointer; text-align: left;
  font: inherit; font-weight: 800; font-size: 1rem; color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--brass); text-decoration-thickness: 2px;
}
.offer-room-link:hover { color: var(--brass-dark); }
.offer-stay-label { font-size: 0.72rem; color: var(--slate); margin-bottom: 2px; }

.amenity-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.chip {
  font-size: 0.7rem; padding: 3px 8px; border-radius: 999px;
  background: var(--paper-2); color: var(--slate); font-weight: 600; white-space: nowrap;
}

.room-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.room-modal[hidden] { display: none; }
.room-modal-backdrop { position: absolute; inset: 0; background: rgba(15,36,54,0.6); }
.room-modal-panel {
  position: relative; background: var(--white); border-radius: var(--radius-l);
  max-width: 940px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-pop); padding: 20px;
}
.room-modal-close {
  position: absolute; top: 10px; right: 12px; background: none; border: none;
  font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--slate); padding: 4px 8px;
}
.room-modal-close:hover { color: var(--ink); }
.room-modal-body { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .room-modal-body { grid-template-columns: 1.1fr 1fr; } }
.room-modal-hero { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius); display: block; }
.room-modal-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.room-modal-thumbs img {
  width: 64px; height: 48px; object-fit: cover; border-radius: 4px; cursor: pointer;
  border: 2px solid transparent;
}
.room-modal-thumbs img:hover { border-color: var(--brass); }
.room-facts { list-style: none; padding: 0; margin: 12px 0; }
.room-facts li { padding: 6px 0; border-top: 1px solid var(--line); font-size: 0.88rem; }
.room-facts li strong { display: inline-block; min-width: 100px; color: var(--slate); font-weight: 700; }

/* staff room manager thumbnails */
.thumb-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumb-item { position: relative; }
.thumb-item img { width: 110px; height: 82px; object-fit: cover; border-radius: var(--radius-s); display: block; }
.thumb-del {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: var(--brick); color: white; cursor: pointer; font-size: 15px; line-height: 1;
}

/* Hotel page: rooms use the full width. The description, address and map
   were pushed to a sidebar that agents don't read while comparing prices -
   they want the room list. Materials moved below, behind a toggle. */
.rooms-full { display: block; }
.rooms-full > div { max-width: 100%; }

/* Search bar now has four fields (dates, adults, children) plus the button. */
@media (min-width: 860px) {
  .search-bar { grid-template-columns: 1fr 1fr 90px 90px auto; }
}
@media (min-width: 720px) and (max-width: 859px) {
  .search-bar { grid-template-columns: 1fr 1fr; }
  .search-go { grid-column: 1 / -1; }
}
