/* Paleta e espaçamentos portados de src/ui/theme.ts do app Expo. */
:root {
    --bg: #0f172a;
    --surface: #111827;
    --surface2: #1f2937;
    --text: #f8fafc;
    --text-dim: #94a3b8;
    --primary: #2563eb;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border: #334155;
    --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

a { color: inherit; text-decoration: none; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    display: none;
    width: 232px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 12px;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { font-size: 18px; font-weight: 700; padding: 0 10px 18px; }
.brand span { color: var(--text-dim); font-weight: 400; margin-left: 6px; font-size: 13px; }

.nav-item {
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-dim);
    font-weight: 500;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.is-active { background: var(--surface2); color: var(--primary); }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding: 14px 10px 0; }
.user-name { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }

.content { flex: 1; padding: 20px 16px 96px; max-width: 1400px; margin: 0 auto; width: 100%; }

.tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 30;
}
.tab { flex: 1; text-align: center; padding: 12px 4px; font-size: 11px; color: var(--text-dim); }
.tab.is-active { color: var(--primary); font-weight: 700; }

@media (min-width: 768px) {
    .sidebar { display: flex; }
    .tabbar { display: none; }
    .content { padding: 28px 32px 48px; }
}

/* ---------- tipografia ---------- */
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; font-weight: 600; margin: 24px 0 10px; }
.eyebrow { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
.dim { color: var(--text-dim); }
.empty { color: var(--text-dim); font-style: italic; }
.small { font-size: 12px; }

/* ---------- cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
}
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.imovel-head {
    display: flex; align-items: center; gap: 8px;
    padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.imovel-nome { font-size: 17px; font-weight: 700; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-lg { width: 14px; height: 14px; }

.block { margin-top: 10px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.block-title { color: var(--text-dim); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }

.reserva-card {
    background: var(--surface2);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    padding: 12px;
    display: block;
    width: 100%;
    text-align: left;
    border-top: 0; border-right: 0; border-bottom: 0;
    cursor: pointer;
    color: inherit;
    font: inherit;
}
.reserva-card:hover { filter: brightness(1.12); }
.hospede { font-size: 15px; font-weight: 600; }
.periodo { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.pendente { color: var(--warning); font-size: 13px; font-weight: 600; margin-top: 8px; }
.quitado { color: var(--success); font-size: 13px; font-weight: 600; margin-top: 8px; }
.tel-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.tel { color: var(--text-dim); font-size: 12px; }
.wa-btn {
    width: 28px; height: 28px; border-radius: 14px; background: #25D366;
    display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 14px;
}

/* ---------- pills / badges ---------- */
.pill {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    padding: 2px 6px; border-radius: 4px; display: inline-block;
}
.pill-curso { background: rgba(16,185,129,.2); color: var(--success); }
.pill-prox { background: rgba(37,99,235,.2); color: var(--primary); }
.pill-pendente { background: rgba(245,158,11,.2); color: var(--warning); }
.pill-parcial { background: rgba(37,99,235,.2); color: var(--primary); }
.pill-quitado { background: rgba(16,185,129,.2); color: var(--success); }
.pill-sinal { background: rgba(245,158,11,.2); color: var(--warning); }
.pill-quitacao { background: rgba(16,185,129,.2); color: var(--success); }
.pill-cancelado { background: rgba(239,68,68,.2); color: var(--danger); }
.pill-checkin { background: rgba(16,185,129,.2); color: var(--success); }
.pill-checkout { background: rgba(245,158,11,.2); color: var(--warning); }
.pill-ocupado { background: var(--surface2); color: var(--text-dim); }

/* ---------- formulários ---------- */
label.field { display: block; margin-bottom: 14px; }
.field-label { color: var(--text-dim); font-size: 12px; text-transform: uppercase; margin-bottom: 6px; display: block; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=tel], textarea, select {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 15px;
    font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
textarea { min-height: 76px; resize: vertical; }
.err { color: var(--danger); font-size: 12px; margin-top: 4px; }
.hint { color: var(--text-dim); font-size: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
    background: var(--surface2); color: var(--text-dim);
    padding: 8px 12px; border-radius: 20px; border: 0; cursor: pointer;
    font: inherit; font-size: 14px;
}
.chip.is-active { color: var(--text); background: var(--primary); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--primary); color: #fff; border: 0; border-radius: 8px;
    padding: 11px 16px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; padding: 0; }

.color-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.swatch { width: 36px; height: 36px; border-radius: 18px; border: 2px solid transparent; cursor: pointer; }
.swatch.is-active { border-color: var(--text); }

/* ---------- listas ---------- */
.list-item {
    display: block; width: 100%; text-align: left;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    padding: 12px; margin-bottom: 10px; color: inherit; font: inherit; cursor: pointer;
}
.list-item:hover { border-color: var(--primary); }
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.spacer { flex: 1; }

.summary { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.summary-row { display: flex; justify-content: space-between; padding: 4px 0; }
.summary-row .val-strong { font-weight: 700; color: var(--warning); }

/* ---------- calendário ---------- */
.cal-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px; gap: 12px; flex-wrap: wrap;
}
.cal-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cal-titulo {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 7px 12px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    min-width: 190px;
}
.cal-titulo:hover { border-color: var(--primary); }
.cal-caret { color: var(--text-dim); font-size: 11px; margin-left: 4px; }

/* Seletor de período no formato clássico: grade de meses -> grade de anos */
.periodo-picker {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    max-width: 360px;
}
.periodo-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.periodo-titulo {
    flex: 1;
    background: none;
    border: 0;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
}
.periodo-titulo:hover { background: var(--surface2); }
.periodo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.periodo-item {
    background: var(--surface2);
    border: 1px solid transparent;
    color: var(--text);
    border-radius: 8px;
    padding: 10px 4px;
    font: inherit;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    position: relative;
}
.periodo-item:hover { border-color: var(--primary); }
.periodo-item.is-active { background: var(--primary); font-weight: 700; }
.periodo-item.tem-reserva::after {
    content: '';
    position: absolute;
    bottom: 5px; left: 50%; transform: translateX(-50%);
    width: 4px; height: 4px; border-radius: 2px;
    background: var(--success);
}
.periodo-item.is-active.tem-reserva::after { background: #fff; }
.periodo-fechar { display: block; margin: 10px auto 0; }
.cal-month { font-size: 17px; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; color: var(--text-dim); font-size: 11px; text-transform: uppercase; padding-bottom: 6px; }
.cal-day {
    background: none; border: 0; cursor: pointer; color: var(--text);
    min-height: 58px; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px;
    border-radius: 8px; font: inherit;
}
.cal-day:hover { background: var(--surface); }
.cal-day.is-outside .cal-num { color: var(--text-dim); opacity: .4; }
.cal-day.is-selected { background: rgba(37,99,235,.33); }
.cal-num { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; position: relative; }
.cal-day.is-today .cal-num { color: var(--warning); font-weight: 700; }
.cal-day.is-holiday .cal-num { color: var(--danger); font-weight: 700; }
.holiday-dot { position: absolute; bottom: -2px; width: 4px; height: 4px; border-radius: 2px; background: var(--danger); }
.lanes { width: 100%; display: flex; flex-direction: column; gap: 2px; }
.lane { height: 5px; border-radius: 0; }
.lane-outline { opacity: .4; }
.lane-start { border-top-left-radius: 3px; border-bottom-left-radius: 3px; }
.lane-end { border-top-right-radius: 3px; border-bottom-right-radius: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 14px 0; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.feriado-row { color: var(--danger); font-size: 13px; margin-bottom: 8px; }

/* ---------- relatório ---------- */
.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat-title { color: var(--text-dim); font-size: 12px; text-transform: uppercase; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.stat-value.warning { color: var(--warning); }
.stat-sub { color: var(--text-dim); font-size: 12px; margin-top: 4px; }
.bar-row { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 12px; }
.bar-bg { height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; margin-bottom: 10px; }
.bar-fg { height: 8px; background: var(--primary); border-radius: 4px; }

/* ---------- modal / sheet ---------- */
.backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
@media (min-width: 768px) { .backdrop { align-items: center; } }
.sheet {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px 16px 0 0; width: 100%; max-width: 560px;
    max-height: 88vh; overflow-y: auto; padding: 16px;
}
@media (min-width: 768px) { .sheet { border-radius: 16px; } }
.sheet-title { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.sheet-action {
    display: flex; flex-direction: column; width: 100%; text-align: left;
    background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
    padding: 12px; margin-bottom: 8px; color: inherit; font: inherit; cursor: pointer;
}
.sheet-action:disabled { opacity: .45; cursor: not-allowed; }
.sheet-action .sa-label { font-weight: 600; }
.sheet-action .sa-hint { color: var(--text-dim); font-size: 12px; }

.pag-row {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
    padding: 10px; margin-bottom: 8px;
}
.pag-valor { font-weight: 700; }
.pag-data { color: var(--text-dim); font-size: 12px; }
.pag-obs { color: var(--text-dim); font-size: 11px; font-style: italic; }
.pag-confirm { border-color: var(--danger); background: rgba(239,68,68,.13); }

/* ---------- toasts ---------- */
.toasts { position: fixed; top: 12px; right: 12px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: 90vw; }
.toast { background: var(--surface2); border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }

/* ---------- FAB ---------- */
.fab {
    position: fixed; right: 18px; bottom: 68px;
    width: 56px; height: 56px; border-radius: 28px;
    background: var(--primary); color: #fff; border: 0; cursor: pointer;
    font-size: 28px; line-height: 1; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px rgba(0,0,0,.4); z-index: 20;
}
@media (min-width: 768px) { .fab { bottom: 24px; right: 28px; } }

/* ---------- autocomplete ---------- */
.autocomplete { position: relative; }
.suggestions {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 25;
    background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.suggestion { display: block; width: 100%; text-align: left; background: none; border: 0; color: inherit; font: inherit; padding: 10px 12px; cursor: pointer; }
.suggestion:hover { background: var(--surface); }

/* ---------- login ---------- */
body.guest { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.guest-box { width: 100%; max-width: 400px; }
.guest-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.guest-sub { color: var(--text-dim); margin-bottom: 24px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.alert { background: rgba(239,68,68,.13); border: 1px solid var(--danger); color: var(--text); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
/* Mesma caixa do .alert, em verde — usada nas confirmações do fluxo de senha. */
.alert-ok { background: rgba(16,185,129,.13); border-color: var(--success); }

/* ---------- toggle ---------- */
.toggle { width: 46px; height: 26px; border-radius: 13px; border: 0; padding: 2px; cursor: pointer; background: var(--surface2); position: relative; }
.toggle.is-on { background: var(--success); }
.toggle-thumb { width: 22px; height: 22px; border-radius: 11px; background: #fff; display: block; transition: transform .12s ease; transform: translateX(0); }
.toggle.is-on .toggle-thumb { transform: translateX(20px); }

/* ---------- acessando como outro usuário ---------- */
.impersonando {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: rgba(245, 158, 11, .14);
    border: 1px solid var(--warning);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 18px;
    font-size: 14px;
}
