/* ============ Tokens ============ */
:root {
  --ink: #0F1720;
  --ink-2: #16212C;
  --ink-3: #1C2933;
  --line: #2A3742;
  --cream: #F1EAD9;
  --cream-dim: #C9C2AF;
  --slate: #8B99A8;
  --brass: #C9A227;
  --brass-bright: #E4C15C;

  --ok: #3FB68B;
  --warn: #E0A930;
  --danger: #C24E3A;
  --violet: #8B7FD6;
  --blue: #4FA8D8;
  --grey: #6B7785;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-lg: 0 20px 50px -20px rgba(0,0,0,.6);
  --shadow-md: 0 10px 24px -14px rgba(0,0,0,.5);

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

:root[data-theme="light"] {
  --ink: #FAF8F2;
  --ink-2: #FFFFFF;
  --ink-3: #F1ECE0;
  --line: #E1D9C6;
  --cream: #241F17;
  --cream-dim: #55503F;
  --slate: #837A67;
  --brass: #A9821E;
  --brass-bright: #C9A227;

  --shadow-lg: 0 20px 50px -24px rgba(60,50,20,.22);
  --shadow-md: 0 10px 24px -16px rgba(60,50,20,.18);
}

html { transition: background-color .2s ease; }
body { transition: background-color .2s ease, color .2s ease; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-body);
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 12% 8%, rgba(201,162,39,.08), transparent 40%),
    radial-gradient(circle at 88% 92%, rgba(139,127,214,.06), transparent 45%);
}
h1,h2,h3 { font-family: var(--font-display); font-weight: 600; margin: 0; color: var(--cream); }
p { margin: 0; }
button { font-family: var(--font-body); cursor: pointer; }
input {
  font-family: var(--font-body);
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--cream);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14.5px;
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(201,162,39,.18);
}
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--slate); margin-bottom: 14px; }
select {
  font-family: var(--font-body);
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--cream);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14.5px;
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(201,162,39,.18);
}
::selection { background: var(--brass); color: var(--ink); }

/* ============ Theme toggle ============ */
.theme-toggle {
  background: var(--ink-2); border: 1px solid var(--line); color: var(--cream-dim);
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
  position: relative;
}
.theme-toggle:hover { border-color: var(--brass); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: inline; color: var(--brass); }
#themeToggleLogin { position: absolute; top: 24px; right: 24px; }
.theme-toggle-inline { width: 32px; height: 32px; font-size: 13px; flex-shrink: 0; }

/* ============ Buttons ============ */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .2px;
  transition: transform .12s ease, filter .12s ease, background .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(180deg, var(--brass-bright), var(--brass)); color: #23180a; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--cream); }
.btn-ghost:hover { border-color: var(--brass); color: var(--brass-bright); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn-danger { background: rgba(194,78,58,.15); color: #e58369; border: 1px solid rgba(194,78,58,.4); }
.btn-danger:hover { background: rgba(194,78,58,.25); }
.btn-link { background: none; border: none; color: var(--slate); font-size: 13px; padding: 0; }
.btn-link:hover { color: var(--brass-bright); }
.icon-btn {
  background: var(--ink-3); border: 1px solid var(--line); color: var(--cream);
  width: 34px; height: 34px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.icon-btn:hover { border-color: var(--danger); color: #e58369; }

/* ============ Login ============ */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  position: relative;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.brand-mark {
  color: var(--brass); font-size: 22px; width: 42px; height: 42px;
  border: 1px solid var(--brass); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.brand h1 { font-size: 22px; letter-spacing: .5px; }
.brand p { color: var(--slate); font-size: 12.5px; margin-top: 2px; }
.login-hint { text-align: center; color: var(--slate); font-size: 11.5px; margin-top: 18px; }
.error-text { color: #e58369; font-size: 13px; margin: -6px 0 14px; }
.success-text { color: var(--ok); font-size: 13px; margin: -6px 0 14px; }

/* ============ Shell ============ */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex-shrink: 0;
  background: var(--ink-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: sticky; top: 42px; height: calc(100vh - 42px);
}
.side-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 18px; padding: 0 8px 26px; }
.side-brand .brand-mark { width: 30px; height: 30px; font-size: 15px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  background: none; border: none; color: var(--slate);
  padding: 11px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; text-align: left;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: var(--ink-3); color: var(--cream); }
.nav-item.active { background: rgba(201,162,39,.12); color: var(--brass-bright); }
.nav-ico { width: 18px; text-align: center; opacity: .85; }
.side-footer { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.side-user-name { font-size: 13.5px; font-weight: 600; }
.side-user-role { font-size: 11.5px; color: var(--slate); text-transform: capitalize; margin-bottom: 10px; }

.main { flex: 1; padding: 36px 44px; max-width: 1280px; }
.view-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.eyebrow { font-size: 11.5px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--brass); margin-bottom: 6px; }
.view-header h2 { font-size: 26px; }

/* ============ Stat grid ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-card {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-card .label { font-size: 12px; color: var(--slate); margin-bottom: 8px; }
.stat-card .value { font-family: var(--font-mono); font-size: 26px; color: var(--cream); }
.stat-card .value.brass { color: var(--brass-bright); }

/* ============ Panels ============ */
.dash-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.panel { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel-narrow { max-width: 420px; }
.panel h3 { font-size: 15px; margin-bottom: 16px; }
.panel-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel-header-row h3 { margin: 0; }

/* ============ Status ============ */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 100px;
  text-transform: capitalize; letter-spacing: .2px;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-livre { background: rgba(63,182,139,.15); color: var(--ok); }
.status-reservado { background: rgba(224,169,48,.15); color: var(--warn); }
.status-ocupado { background: rgba(194,78,58,.15); color: #e58369; }
.status-manutencao { background: rgba(139,127,214,.15); color: var(--violet); }
.status-limpeza { background: rgba(79,168,216,.15); color: var(--blue); }
.status-desocupado { background: rgba(107,119,133,.18); color: var(--grey); }

.status-breakdown { display: flex; flex-direction: column; gap: 12px; }
.status-row { display: flex; align-items: center; gap: 12px; }
.status-row .status-pill { width: 118px; flex-shrink: 0; justify-content: flex-start; }
.status-bar-track { flex: 1; height: 7px; background: var(--ink-3); border-radius: 100px; overflow: hidden; }
.status-bar-fill { height: 100%; border-radius: 100px; background: currentColor; }
.status-row .count { font-family: var(--font-mono); font-size: 12.5px; color: var(--slate); width: 22px; text-align: right; }

.frequency-panel { display: flex; flex-direction: column; gap: 14px; }
.freq-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: var(--ink-3); border-radius: var(--radius-sm); }
.freq-item .tag { font-size: 11px; color: var(--slate); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 3px; }
.freq-item .num { font-family: var(--font-display); font-size: 20px; }
.freq-item .stays { font-family: var(--font-mono); font-size: 13px; color: var(--brass-bright); }

/* ============ Filter bar ============ */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  background: var(--ink-2); border: 1px solid var(--line); color: var(--slate);
  padding: 7px 14px; border-radius: 100px; font-size: 12.5px; font-weight: 500;
  text-transform: capitalize;
}
.chip.active { background: var(--brass); border-color: var(--brass); color: #23180a; }

/* ============ Room grid — key tags ============ */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.room-tag {
  position: relative;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px 18px;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  overflow: hidden;
}
.room-tag::before {
  content: '';
  position: absolute; top: 14px; right: 16px;
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--ink);
}
.room-tag:hover { transform: translateY(-3px); border-color: var(--brass); box-shadow: var(--shadow-md); }
.room-tag .stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: currentColor; }
.room-tag .room-number { font-family: var(--font-display); font-size: 32px; margin-bottom: 2px; }
.room-tag .room-type { font-size: 12px; color: var(--slate); margin-bottom: 14px; }
.room-tag .room-price { font-family: var(--font-mono); font-size: 13px; color: var(--cream-dim); margin-top: 12px; }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--slate); font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); color: var(--cream-dim); }
tr:last-child td { border-bottom: none; }
.mono { font-family: var(--font-mono); }
.empty-state { color: var(--slate); font-size: 13.5px; padding: 18px 4px; text-align: center; }

/* ============ Complaints ============ */
.complaints-list { display: flex; flex-direction: column; gap: 10px; }
.complaint-item { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; padding: 13px 15px; background: var(--ink-3); border-radius: var(--radius-sm); border-left: 3px solid var(--danger); }
.complaint-item.resolved { border-left-color: var(--ok); opacity: .6; }
.complaint-item .txt { font-size: 13.5px; }
.complaint-item .meta { font-size: 11.5px; color: var(--slate); margin-top: 4px; }

/* ============ Room detail ============ */
.room-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.status-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.status-picker button { border: 1px solid var(--line); background: var(--ink-3); }
.status-picker button.current { border-color: var(--brass); }

.stay-card { background: var(--ink-3); border-radius: var(--radius-sm); padding: 16px; }
.stay-card .guest { font-family: var(--font-display); font-size: 18px; margin-bottom: 4px; }
.stay-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--slate); padding: 6px 0; border-bottom: 1px dashed var(--line); }
.stay-row:last-child { border-bottom: none; }
.stay-total { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 16px; color: var(--brass-bright); }
.charge-form { display: flex; gap: 8px; margin-top: 14px; }
.charge-form input { flex: 1; }

/* ============ Modal ============ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6,9,13,.72);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-backdrop[hidden] { display: none !important; }
.modal {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow-y: auto;
}
.modal.modal-wide { max-width: 660px; }
.modal h3 { margin-bottom: 20px; font-size: 19px; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; flex-direction: row; margin-bottom: 12px; }
.checkbox-row input { width: auto; }
.perm-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

/* ============ Toast ============ */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--ink-3); border: 1px solid var(--brass); color: var(--cream);
  padding: 12px 22px; border-radius: 100px; font-size: 13.5px; z-index: 200;
  box-shadow: var(--shadow-md);
}
.toast.error { border-color: var(--danger); color: #e58369; }

/* ============ World clock bar ============ */
.world-clock-bar {
  position: sticky; top: 0; z-index: 60;
  background: var(--ink-3); border-bottom: 1px solid var(--line);
  display: flex; gap: 20px; align-items: center;
  padding: 9px 22px; font-size: 12px;
  overflow-x: auto; white-space: nowrap;
}
.clock-item { display: flex; align-items: center; gap: 7px; color: var(--slate); flex-shrink: 0; }
.clock-flag { font-size: 13px; }
.clock-city { font-weight: 500; color: var(--cream-dim); }
.clock-time { font-family: var(--font-mono); color: var(--brass-bright); letter-spacing: .5px; }

/* ============ Settings ============ */
.panel-desc { font-size: 13px; color: var(--slate); line-height: 1.55; }

/* ============ Confirm modal ============ */
.confirm-text { font-size: 14px; color: var(--cream-dim); line-height: 1.6; margin-bottom: 4px; }

/* ============ Calendar ============ */
.calendar-nav { display: flex; align-items: center; gap: 10px; }
.cal-month-label { font-family: var(--font-display); font-size: 14px; min-width: 120px; text-align: center; text-transform: capitalize; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; max-width: 320px; }
.cal-weekday { text-align: center; font-size: 9.5px; color: var(--slate); text-transform: uppercase; letter-spacing: .4px; padding-bottom: 3px; }
.cal-day {
  position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  background: var(--ink-3); border: 1px solid transparent; border-radius: 6px;
  font-size: 11px; color: var(--cream-dim); cursor: default;
}
.cal-day.empty { background: transparent; }
.cal-day.has-event { cursor: pointer; color: var(--cream); font-weight: 600; }
.cal-day.has-event:hover { border-color: var(--brass); }
.cal-day.selected { border-color: var(--brass); background: rgba(201,162,39,.15); }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--brass); }
.cal-day .dot { position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--brass-bright); }
.calendar-day-events { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.cal-event { display: flex; justify-content: space-between; gap: 12px; padding: 10px 13px; background: var(--ink-3); border-radius: var(--radius-sm); font-size: 13px; }
.cal-event .cal-event-time { color: var(--brass-bright); font-family: var(--font-mono); font-size: 12px; flex-shrink: 0; }

/* ============ View toggle (cards/lista) ============ */
.view-toggle { display: flex; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.view-toggle button {
  background: none; border: none; color: var(--slate); padding: 8px 13px; font-size: 13px; font-weight: 500;
  border-right: 1px solid var(--line);
}
.view-toggle button:last-child { border-right: none; }
.view-toggle button.active { background: var(--brass); color: #23180a; }

/* ============ Pagination ============ */
.pagination-bar { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.pagination-bar select { width: auto; padding: 7px 10px; font-size: 13px; }
.pagination-bar button {
  background: var(--ink-2); border: 1px solid var(--line); color: var(--cream-dim);
  padding: 7px 13px; border-radius: 8px; font-size: 13px;
}
.pagination-bar button.active { background: var(--brass); border-color: var(--brass); color: #23180a; font-weight: 600; }
.pagination-bar button:disabled { opacity: .35; cursor: default; }

/* ============ List rows (alternativa a cards) ============ */
.item-list { display: flex; flex-direction: column; gap: 8px; }
.item-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 16px; cursor: pointer;
}
.item-row:hover { border-color: var(--brass); }
.item-row .item-main { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.item-row .item-title { font-family: var(--font-display); font-size: 16px; }
.item-row .item-sub { font-size: 12px; color: var(--slate); }
.item-row .item-meta { font-family: var(--font-mono); font-size: 13px; color: var(--cream-dim); white-space: nowrap; }

/* ============ Autocomplete de hóspede ============ */
.autocomplete-wrap { position: relative; }
.autocomplete-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); max-height: 220px; overflow-y: auto;
}
.autocomplete-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 13px; cursor: pointer; font-size: 13.5px; border-bottom: 1px solid var(--line);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--ink-3); }
.autocomplete-item .ac-name { color: var(--cream); font-weight: 500; }
.autocomplete-item .ac-doc { color: var(--slate); font-size: 12px; white-space: nowrap; }
.autocomplete-empty { padding: 12px 13px; color: var(--slate); font-size: 13px; }

/* ============ Document upload ============ */
.file-drop { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 12px; font-size: 12.5px; color: var(--slate); }
.doc-link { color: var(--brass-bright); text-decoration: none; font-size: 12.5px; }
.doc-link:hover { text-decoration: underline; }
@media (max-width: 900px) {
  .dash-columns { grid-template-columns: 1fr; }
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; padding: 14px 16px; overflow-x: auto; }
  .side-nav { flex-direction: row; }
  .side-footer { display: none; }
  .main { padding: 22px; }
}

/* Focus visibility */
button:focus-visible, .room-tag:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
