/* ============================================================
   HOSTIVA v6 — UNIFIED DESIGN SYSTEM
   ============================================================ */
:root {
    --h-primary: #4e73df; --h-primary-dark: #2e59d9; --h-primary-soft: #eef2ff;
    --h-dark: #1a1c23; --h-success: #1cc88a; --h-info: #36b9cc;
    --h-warning: #f6c23e; --h-danger: #e74a3b;
    --h-text: #3a3b45; --h-text-muted: #6c757d;
    --h-bg: #eef1f6; --h-card: #ffffff; --h-border: #e7e9ee;
    --h-shadow-sm: 0 0.1rem 0.4rem rgba(40,50,90,0.06);
    --h-shadow: 0 0.4rem 1.4rem rgba(40,50,90,0.08);
    --h-radius: 12px; --h-radius-lg: 16px;
    --h-sidebar-w: 240px; --h-header-h: 64px;
    --h-font: 'Outfit','Inter','Segoe UI',system-ui,sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: auto; min-height: 100%; overflow-x: hidden; overflow-y: auto; }
body { font-family: var(--h-font); background: var(--h-bg); color: var(--h-text); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4,h5,h6 { font-family: var(--h-font); margin: 0 0 .5rem; color: #1a1c23; font-weight: 600; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
a { color: var(--h-primary); text-decoration: none; }
a:hover { color: var(--h-primary-dark); }

.app-layout { display: flex; min-height: 100vh; }

.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: var(--h-sidebar-w); background: var(--h-dark); color: rgba(255,255,255,0.85); overflow-y: auto; z-index: 100; transition: transform .25s ease; }
.sidebar::-webkit-scrollbar { width: 0; } .sidebar { scrollbar-width: none; }
.sidebar-brand { padding: 18px 22px; border-bottom: 1px solid rgba(255,255,255,0.06); display: flex; align-items: center; gap: 10px; }
.sidebar-brand .logo { width: 32px; height: 32px; background: linear-gradient(135deg,var(--h-primary),var(--h-primary-dark)); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.sidebar-brand .name { font-size: 18px; font-weight: 600; color: #fff; }
.sidebar-brand .name small { display: block; font-size: 10px; color: rgba(255,255,255,0.5); font-weight: 400; letter-spacing: .5px; text-transform: uppercase; }

.mode-toggle { margin: 14px 18px 8px; display: flex; background: rgba(255,255,255,0.05); border-radius: 8px; padding: 3px; font-size: 11px; font-weight: 600; }
.mode-toggle .mt-btn { flex: 1; padding: 6px 10px; text-align: center; border-radius: 6px; cursor: pointer; color: rgba(255,255,255,0.55); transition: all .2s ease; user-select: none; }
.mode-toggle .mt-btn.active { background: var(--h-primary); color: #fff; }

.sidebar-group { padding: 14px 22px 4px; font-size: 10px; color: rgba(255,255,255,0.35); letter-spacing: 1px; text-transform: uppercase; font-weight: 600; }
.sidebar-menu { list-style: none; padding: 0; margin: 0; }
.sidebar-menu li a { display: flex; align-items: center; gap: 12px; padding: 10px 22px; color: rgba(255,255,255,0.75); font-size: 13.5px; font-weight: 500; border-left: 3px solid transparent; transition: all .15s ease; }
.sidebar-menu li a:hover { background: rgba(255,255,255,0.05); color: #fff; }
.sidebar-menu li a.active, .sidebar-menu li.active > a { background: linear-gradient(90deg,rgba(78,115,223,0.25),rgba(78,115,223,0.04)); color: #fff; border-left-color: var(--h-primary); }
.sidebar-menu li a i { width: 18px; font-size: 15px; flex-shrink: 0; text-align: center; }
.sidebar-menu li a .menu-badge { margin-left: auto; background: var(--h-danger); color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 10px; font-weight: 600; }
.sidebar-menu .mode-hotel, .sidebar-menu .mode-str { display: none; }
body[data-mode="hotel"] .sidebar-menu .mode-hotel { display: list-item; }
body[data-mode="str"] .sidebar-menu .mode-str { display: list-item; }
body[data-mode="both"] .sidebar-menu .mode-hotel,
body[data-mode="both"] .sidebar-menu .mode-str { display: list-item; }

.main { flex: 1; margin-left: var(--h-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: var(--h-header-h); background: var(--h-card); border-bottom: 1px solid var(--h-border); display: flex; align-items: center; padding: 0 28px; position: sticky; top: 0; z-index: 50; box-shadow: var(--h-shadow-sm); }
.topbar .menu-toggle { display: none; width: 38px; height: 38px; border-radius: 8px; background: var(--h-bg); border: none; color: var(--h-text); font-size: 18px; cursor: pointer; margin-right: 14px; }
.topbar .page-title-bar { font-size: 16px; font-weight: 600; }
.topbar .topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar .icon-btn { width: 40px; height: 40px; border-radius: 10px; background: var(--h-bg); border: none; color: var(--h-text); font-size: 16px; cursor: pointer; position: relative; }
.topbar .icon-btn:hover { background: var(--h-primary-soft); color: var(--h-primary); }
.topbar .icon-btn .dot { position: absolute; top: 8px; right: 10px; width: 8px; height: 8px; background: var(--h-danger); border-radius: 50%; border: 2px solid var(--h-card); }
.topbar .user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 24px; background: var(--h-bg); cursor: pointer; }
.topbar .user-chip:hover { background: var(--h-primary-soft); }
.topbar .user-chip .avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg,var(--h-primary),var(--h-primary-dark)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; }
.topbar .user-chip .info { display: flex; flex-direction: column; line-height: 1.1; }
.topbar .user-chip .info .name { font-size: 13px; font-weight: 600; color: #1a1c23; }
.topbar .user-chip .info .role { font-size: 11px; color: var(--h-text-muted); }

.content { padding: 28px; flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-head .titles h1 { margin: 0 0 4px; font-size: 1.5rem; font-weight: 700; }
.page-head .titles .subtitle { color: var(--h-text-muted); font-size: 13.5px; }
.page-head .head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.card { background: var(--h-card); border: 1px solid var(--h-border); border-radius: var(--h-radius-lg); box-shadow: var(--h-shadow-sm); }
.card-header { padding: 18px 22px; border-bottom: 1px solid var(--h-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.card-body { padding: 22px; }
.card-footer { padding: 14px 22px; border-top: 1px solid var(--h-border); background: #fafbfd; border-radius: 0 0 var(--h-radius-lg) var(--h-radius-lg); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--h-card); border: 1px solid var(--h-border); border-radius: var(--h-radius-lg); padding: 22px; box-shadow: var(--h-shadow-sm); transition: all .2s ease; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--h-shadow); }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px; margin-bottom: 16px; }
.stat-card.primary .stat-icon { background: linear-gradient(135deg,#4e73df,#2e59d9); }
.stat-card.success .stat-icon { background: linear-gradient(135deg,#1cc88a,#169c6b); }
.stat-card.info .stat-icon { background: linear-gradient(135deg,#36b9cc,#258390); }
.stat-card.warning .stat-icon { background: linear-gradient(135deg,#f6c23e,#c69506); color: #6c4f00; }
.stat-card.danger .stat-icon { background: linear-gradient(135deg,#e74a3b,#b1281b); }
.stat-card.dark .stat-icon { background: linear-gradient(135deg,#1a1c23,#2c2f3a); }
.stat-card .stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--h-text-muted); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #1a1c23; line-height: 1.1; }
.stat-card .stat-meta { margin-top: 8px; font-size: 12px; color: var(--h-text-muted); display: flex; align-items: center; gap: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all .15s ease; line-height: 1.2; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg,var(--h-primary),var(--h-primary-dark)); color: #fff; }
.btn-primary:hover { box-shadow: 0 0.4rem 1rem rgba(78,115,223,0.3); }
.btn-secondary { background: var(--h-card); color: var(--h-text); border-color: var(--h-border); }
.btn-secondary:hover { background: var(--h-bg); }
.btn-success { background: var(--h-success); color: #fff; }
.btn-warning { background: var(--h-warning); color: #6c4f00; }
.btn-danger { background: var(--h-danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--h-text); }
.btn-ghost:hover { background: var(--h-bg); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }

.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-primary { background: #e7edff; color: #2e59d9; }
.badge-success { background: #d6f5e6; color: #0f6e56; }
.badge-warning { background: #fff4d4; color: #856404; }
.badge-danger { background: #fde2df; color: #a32d2d; }
.badge-info { background: #ddf3f7; color: #1e6b78; }
.badge-secondary { background: #eef1f6; color: #5a5c69; }

.table-wrap { overflow-x: auto; border-radius: var(--h-radius-lg); }
table.h-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--h-card); font-size: 13.5px; }
table.h-table thead th { background: #f8f9fc; padding: 14px 18px; text-align: left; font-weight: 600; font-size: 11.5px; color: var(--h-text-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--h-border); }
table.h-table tbody td { padding: 14px 18px; border-bottom: 1px solid var(--h-border); vertical-align: middle; }
table.h-table tbody tr:last-child td { border-bottom: none; }
table.h-table tbody tr:hover { background: #f8f9fc; }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.form-control { width: 100%; padding: 11px 14px; border: 1px solid var(--h-border); border-radius: 10px; font-family: inherit; font-size: 14px; background: var(--h-card); color: var(--h-text); transition: all .15s ease; }
.form-control:focus { outline: none; border-color: var(--h-primary); box-shadow: 0 0 0 3px rgba(78,115,223,0.15); }
textarea.form-control { min-height: 90px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 16px; }

.room-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(80px,1fr)); gap: 8px; }
.room-tile { aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: all .15s ease; border: 2px solid transparent; background: var(--h-bg); padding: 6px; }
.room-tile:hover { transform: scale(1.04); }
.room-tile .room-no { font-size: 14px; font-weight: 700; }
.room-tile .room-st { font-size: 9px; text-transform: uppercase; letter-spacing: .5px; opacity: .7; margin-top: 2px; }
.room-tile.occupied { background: #d6f5e6; border-color: #1cc88a; color: #0f6e56; }
.room-tile.dirty { background: #fff4d4; border-color: #f6c23e; color: #856404; }
.room-tile.maintenance, .room-tile.out_of_order { background: #fde2df; border-color: #e74a3b; color: #a32d2d; }
.room-tile.available, .room-tile.clean { background: #e7edff; border-color: #4e73df; color: #2e59d9; }
.room-tile.arriving { background: #ddf3f7; border-color: #36b9cc; color: #1e6b78; }

.alert { padding: 14px 18px; border-radius: 10px; margin-bottom: 16px; font-size: 13.5px; }
.alert-info { background: #ddf3f7; color: #1e6b78; }
.alert-success { background: #d6f5e6; color: #0f6e56; }
.alert-warning { background: #fff4d4; color: #856404; }
.alert-danger { background: #fde2df; color: #a32d2d; }

.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast { background: var(--h-card); border: 1px solid var(--h-border); border-left: 4px solid var(--h-primary); border-radius: 10px; padding: 14px 18px; box-shadow: var(--h-shadow); font-size: 13.5px; animation: slideIn .25s ease; }
.toast.success { border-left-color: var(--h-success); }
.toast.error { border-left-color: var(--h-danger); }
.toast.warning { border-left-color: var(--h-warning); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15,18,28,0.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--h-card); border-radius: var(--h-radius-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--h-border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { margin: 0; font-size: 1.1rem; }
.modal-close { background: var(--h-bg); border: none; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 18px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--h-border); display: flex; justify-content: flex-end; gap: 10px; background: #fafbfd; border-radius: 0 0 var(--h-radius-lg) var(--h-radius-lg); }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#1a1c23 0%,#2e3548 100%); padding: 20px; }
.auth-card { background: var(--h-card); border-radius: var(--h-radius-lg); padding: 40px 36px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.auth-card .logo-wrap { width: 64px; height: 64px; background: linear-gradient(135deg,var(--h-primary),var(--h-primary-dark)); border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; color: #fff; font-weight: 700; font-size: 24px; }
.auth-card h2 { text-align: center; margin: 0 0 6px; font-size: 1.5rem; }
.auth-card .subtitle { text-align: center; color: var(--h-text-muted); font-size: 13.5px; margin-bottom: 28px; }

.spinner { width: 24px; height: 24px; border: 3px solid var(--h-border); border-top-color: var(--h-primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--h-text-muted); gap: 12px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--h-text-muted); }
.empty-state i { font-size: 48px; opacity: .4; margin-bottom: 12px; display: block; }
.empty-state h4 { margin: 0 0 6px; color: var(--h-text); }

.text-muted { color: var(--h-text-muted); } .text-success { color: var(--h-success); }
.text-danger { color: var(--h-danger); } .text-primary { color: var(--h-primary); }
.text-warning { color: var(--h-warning); }
.text-right { text-align: right; } .text-center { text-align: center; }
.text-sm { font-size: 12.5px; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.mb-0 { margin-bottom: 0 !important; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; }
.d-flex { display: flex; } .gap-2 { gap: 8px; } .gap-3 { gap: 16px; }
.align-center { align-items: center; } .justify-between { justify-content: space-between; } .flex-1 { flex: 1; }

.split-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.split-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .topbar .menu-toggle { display: flex; align-items: center; justify-content: center; }
    .content { padding: 20px 16px; }
    .split-2, .split-1-1 { grid-template-columns: 1fr; }
}
@media (max-width: 575px) {
    .page-head { flex-direction: column; align-items: flex-start; }
    .stat-card { padding: 18px; }
    .stat-card .stat-value { font-size: 22px; }
    .topbar .user-chip .info { display: none; }
}
