:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e6e9f0;
    --text: #1f2433;
    --muted: #7b8195;
    --primary: #4f7cff;
    --primary-d: #3a63d8;
    --sidebar-bg: #11162b;
    --sidebar-text: #aab2cf;
    --sidebar-active: #4f7cff;
    --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
    --radius: 14px;
}
[data-bs-theme="dark"] {
    --bg: #0c1020;
    --surface: #161c33;
    --surface-2: #1c233e;
    --border: #283150;
    --text: #e8ebf5;
    --muted: #8b93b0;
    --sidebar-bg: #0a0e1c;
    --shadow: 0 1px 3px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
}

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

/* ===== SIDEBAR ===== */
.sidebar {
    width: 248px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: margin-left .25s;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 22px 22px;
    font-size: 1.25rem; font-weight: 700; color: #fff;
}
.sidebar-brand i { color: var(--primary); font-size: 1.5rem; }
.sidebar-nav { display: flex; flex-direction: column; padding: 8px 12px; gap: 2px; overflow-y: auto; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 10px;
    color: var(--sidebar-text); text-decoration: none;
    font-size: .92rem; font-weight: 500; transition: .15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--primary); color: #fff; }
.sidebar-nav a.disabled { opacity: .4; pointer-events: none; }
.sidebar-nav a i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-section {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
    color: #5a6280; padding: 16px 14px 6px; font-weight: 600;
}

/* ===== MAIN ===== */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex; align-items: center; gap: 16px;
    padding: 14px 26px; background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 1.15rem; font-weight: 700; margin: 0; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.btn-icon {
    background: transparent; border: none; color: var(--muted);
    width: 38px; height: 38px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.1rem; cursor: pointer; transition: .15s; text-decoration: none;
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }
.user-chip {
    display: flex; flex-direction: column; align-items: flex-start;
    padding: 4px 12px; line-height: 1.15;
}
.user-chip span { font-weight: 600; font-size: .85rem; }
.user-chip small { color: var(--muted); font-size: .72rem; }
.content { padding: 26px; flex: 1; }

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid; gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
}
.stat-icon {
    width: 52px; height: 52px; border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; color: #fff; flex-shrink: 0;
}
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: .82rem; }
.accent-blue .stat-icon { background: #4f7cff; }
.accent-green .stat-icon { background: #21bf73; }
.accent-teal .stat-icon { background: #11b5b5; }
.accent-purple .stat-icon { background: #8b5cf6; }
.accent-orange .stat-icon { background: #f59e0b; }
.accent-pink .stat-icon { background: #ec4899; }

/* ===== PANELS / TABLES ===== */
.panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h2 { font-size: 1rem; font-weight: 700; margin: 0; }
.badge-soft { background: rgba(79,124,255,.12); color: var(--primary); padding: 5px 12px; border-radius: 20px; font-size: .8rem; font-weight: 600; }
.toolbar { display: flex; gap: 12px; margin-bottom: 18px; align-items: center; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; max-width: 420px; }
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 40px; background: var(--surface); border-color: var(--border); color: var(--text); }

.table { color: var(--text); }
.table thead th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; border-color: var(--border); font-weight: 600; }
.table td, .table th { border-color: var(--border); padding: 13px 12px; }
.table-hover tbody tr:hover { background: var(--surface-2); }

/* ===== STATUS BADGES ===== */
.status { padding: 4px 11px; border-radius: 20px; font-size: .76rem; font-weight: 600; display: inline-block; }
.status-livre { background: #dcfce7; color: #16794a; }
.status-ocupado { background: #fee2e2; color: #b42318; }
.status-limpeza { background: #fef3c7; color: #92600a; }
.status-manutencao { background: #e0e7ff; color: #3730a3; }
.status-reservado { background: #dbeafe; color: #1e51b5; }
.status-res-confirmada { background: #dbeafe; color: #1e51b5; }
.status-res-hospedado { background: #dcfce7; color: #16794a; }
.status-res-pre_reserva { background: #fef3c7; color: #92600a; }
.status-res-finalizada { background: #e2e8f0; color: #475569; }
.status-res-cancelada { background: #fee2e2; color: #b42318; }
[data-bs-theme="dark"] .status { filter: brightness(.92) saturate(1.1); }

/* ===== PENDING LIST ===== */
.pending-list { list-style: none; margin: 0; padding: 0; }
.pending-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.pending-list li:last-child { border-bottom: none; }
.pending-list li i { color: var(--primary); }
.pending-list li small { margin-left: auto; color: var(--muted); }

/* ===== FORMS ===== */
.form-control, .form-select { background: var(--surface); border-color: var(--border); color: var(--text); }
.form-control:focus, .form-select:focus { background: var(--surface); color: var(--text); border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(79,124,255,.18); }
.form-label { font-size: .85rem; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); }
.input-group-text { background: var(--surface-2); border-color: var(--border); color: var(--muted); }

/* ===== AUTH ===== */
.auth-body { background: linear-gradient(135deg, #11162b 0%, #1e2a52 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-wrap { width: 100%; max-width: 410px; padding: 20px; }
.auth-card { background: var(--surface); border-radius: 18px; padding: 38px 34px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 1.5rem; font-weight: 700; color: var(--text); justify-content: center; }
.auth-brand i { color: var(--primary); }
.auth-sub { text-align: center; color: var(--muted); margin: 6px 0 26px; font-size: .9rem; }
.auth-hint { text-align: center; color: var(--muted); font-size: .78rem; margin-top: 18px; }

/* ===== RESPONSIVO ===== */
@media (max-width: 900px) {
    .sidebar { position: fixed; z-index: 50; margin-left: -248px; box-shadow: 4px 0 24px rgba(0,0,0,.3); }
    .sidebar.open { margin-left: 0; }
    .content { padding: 18px; }
}

/* ===== Filtros (chips) ===== */
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.chip {
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    padding: 6px 13px; border-radius: 20px; font-size: .82rem; font-weight: 600;
    cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: .15s;
}
.chip:hover { border-color: var(--primary); }
.chip span {
    background: var(--surface-2); color: var(--muted);
    border-radius: 12px; padding: 1px 8px; font-size: .72rem; font-weight: 700;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip.active span { background: rgba(255,255,255,.25); color: #fff; }
.chip-livre.active      { background: #21bf73; border-color: #21bf73; }
.chip-ocupado.active    { background: #ef4444; border-color: #ef4444; }
.chip-limpeza.active    { background: #f59e0b; border-color: #f59e0b; }
.chip-manutencao.active { background: #6366f1; border-color: #6366f1; }
.chip-reservado.active  { background: #4f7cff; border-color: #4f7cff; }

/* ===== Grade de quartos (cards) ===== */
.room-grid {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.room-card {
    --accent: #21bf73;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s;
}
.room-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(16,24,40,.12); }
.room-card.status-livre      { --accent: #21bf73; }
.room-card.status-ocupado    { --accent: #ef4444; }
.room-card.status-limpeza    { --accent: #f59e0b; }
.room-card.status-manutencao { --accent: #6366f1; }
.room-card.status-reservado  { --accent: #4f7cff; }

.room-card-head {
    background: var(--accent); color: #fff;
    padding: 13px 16px; display: flex; align-items: center; justify-content: space-between;
}
.room-num { font-weight: 700; font-size: 1.02rem; display: flex; align-items: center; gap: 8px; }
.room-status {
    background: rgba(255,255,255,.22); color: #fff;
    font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 20px;
    text-transform: uppercase; letter-spacing: .03em;
}
.room-card-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.room-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: .82rem; }
.room-meta i { color: var(--accent); }
.room-guest { font-size: .9rem; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 7px; }
.room-guest i { color: var(--accent); }
.room-guest-empty { color: var(--muted); font-weight: 500; }
.room-dates { font-size: .82rem; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.room-price { margin-top: auto; font-size: 1.15rem; font-weight: 700; color: var(--text); }
.room-price small { font-size: .72rem; font-weight: 500; color: var(--muted); }
.room-card-actions {
    display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
    padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2);
}

/* ===== Estoque: thumbnail e linha de baixo estoque ===== */
.prod-thumb {
    width: 42px; height: 42px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--muted); font-size: 1.1rem; flex: 0 0 auto;
}
tr.row-low { background: rgba(239, 68, 68, .07); }
tr.row-low td { border-color: rgba(239, 68, 68, .15); }

/* ===== Financeiro: descricao expansivel ===== */
.desc-toggle summary { cursor: pointer; list-style: none; }
.desc-toggle summary::-webkit-details-marker { display: none; }
.desc-toggle summary::before { content: "\25B8"; color: var(--muted); margin-right: 6px; font-size: .8em; }
.desc-toggle[open] summary::before { content: "\25BE"; }
.desc-toggle .desc-full { margin-top: 4px; font-size: .85rem; color: var(--muted); padding-left: 16px; }
