:root {
    --bg: #eef5fb;
    --panel: #ffffff;
    --panel-soft: #f4f7fb;
    --text: #223047;
    --muted: #768399;
    --line: #dfe7f0;
    --sidebar: #0c1728;
    --sidebar-hover: #16243a;
    --sidebar-text: #c4cfdd;
    --accent: #42a6df;
    --gold: #e7b95d;
    --gold-hover: #d8a647;
    --green: #78c838;
    --blue: #42a6df;
    --red: #ec5a63;
    --orange: #e49a00;
    --input-bg: #ffffff;
    --shadow: 0 8px 22px rgba(40, 74, 110, .06);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #080c11;
    --panel: #111820;
    --panel-soft: #17202a;
    --text: #f3f6fa;
    --muted: #97a5b7;
    --line: #293542;
    --sidebar: #07111f;
    --sidebar-hover: #15243a;
    --sidebar-text: #c7d1df;
    --input-bg: #0d141c;
    --shadow: 0 10px 28px rgba(0, 0, 0, .30);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; }

svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Sidebar */
.sidebar {
    width: 214px;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 14px 9px;
    background: var(--sidebar);
    border-right: 1px solid rgba(255,255,255,.06);
    color: #fff;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    padding: 4px 1px 13px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.brand-copy strong {
    display: block;
    font-size: 12px;
}

.brand-copy span {
    display: block;
    margin-top: 2px;
    color: #8f9bad;
    font-size: 9px;
}

.sidebar-nav {
    padding-top: 12px;
}

.nav-group {
    margin-bottom: 15px;
}

.nav-caption {
    display: block;
    padding: 0 8px 6px;
    color: #5f6e82;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .7px;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    margin-bottom: 3px;
    padding: 7px 8px;
    border-radius: 7px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    transition: .18s ease;
}

.nav-item:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

.nav-item.active {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 5px 12px rgba(66,166,223,.25);
}

.nav-item.disabled {
    opacity: .65;
    cursor: default;
}

.nav-item.disabled:hover {
    background: transparent;
    color: var(--sidebar-text);
}

.sidebar-profile {
    display: grid;
    grid-template-columns: 32px 1fr 26px;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding: 11px 6px 2px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border: 1px solid var(--gold);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--gold);
    font-size: 11px;
    font-weight: 900;
}

.profile-copy strong {
    display: block;
    color: #fff;
    font-size: 10px;
}

.profile-copy span {
    display: block;
    margin-top: 2px;
    color: #8190a3;
    font-size: 8px;
    text-transform: capitalize;
}

.logout-link {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    color: #8390a2;
}

.logout-link:hover {
    background: rgba(236,90,99,.12);
    color: #ec5a63;
}

/* Main/header */
main {
    min-height: 100vh;
    margin-left: 214px;
    padding: 0 22px 28px;
}

.login-main {
    margin: 0;
    padding: 20px;
    display: grid;
    place-items: center;
}

.top-header {
    min-height: 74px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-title h1 {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
}

.top-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.icon-button,
.mobile-menu-button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
}

.mobile-menu-button { display: none; }

.theme-light { display: none; }
html[data-theme="dark"] .theme-dark { display: none; }
html[data-theme="dark"] .theme-light { display: inline; }

.btn {
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--panel);
    color: var(--text);
    text-decoration: none;
    font-size: 11px;
    font-weight: 800;
}

.btn.primary {
    background: var(--gold);
    border-color: var(--gold);
    color: #111;
}

.btn.primary:hover { background: var(--gold-hover); }

.mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    visibility: hidden;
    opacity: 0;
    background: rgba(0,0,0,.55);
    transition: .2s;
}

.mobile-overlay.show {
    visibility: visible;
    opacity: 1;
}

/* Dashboard toolbar */
.dashboard-toolbar {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.date-filter-form,
.global-search,
.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-arrow,
.today-button,
.date-control {
    height: 35px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
}

.date-arrow {
    width: 35px;
    cursor: pointer;
}

.date-control {
    display: flex;
    align-items: center;
}

.date-control input {
    width: 134px;
    height: 33px;
    border: 0 !important;
    padding: 0 9px;
    font-size: 10px;
    font-weight: 800;
}

.today-button {
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 9px;
    text-decoration: none;
    font-size: 10px;
    font-weight: 800;
}

.global-search input {
    min-width: 0;
    height: 35px;
}

.global-search button {
    width: 36px;
    height: 35px;
    border: 0;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    cursor: pointer;
}

.toolbar-actions {
    justify-content: flex-end;
}

.toolbar-button {
    min-height: 35px;
    padding: 0 12px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    white-space: nowrap;
    font-size: 10px;
    font-weight: 800;
}

.toolbar-button.blue { background: var(--blue); color: #fff; }
.toolbar-button.green { background: var(--green); color: #fff; }
.toolbar-button.neutral { background: var(--panel); border: 1px solid var(--line); }

/* Summary */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 11px;
    margin-bottom: 12px;
}

.summary-card {
    position: relative;
    min-height: 72px;
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 9px;
    align-items: center;
    padding: 11px 12px;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.summary-accent {
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 3px;
    border-radius: 0 4px 4px 0;
}

.summary-card.arrivals .summary-accent { background: var(--green); }
.summary-card.departures .summary-accent { background: var(--blue); }
.summary-card.inhouse .summary-accent,
.summary-card.occupancy .summary-accent { background: #8796aa; }

.summary-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: var(--panel-soft);
    font-size: 17px;
    font-weight: 900;
}

.summary-card.arrivals .summary-icon { color: var(--green); }
.summary-card.departures .summary-icon { color: var(--blue); }

.summary-card strong {
    display: block;
    font-size: 18px;
    line-height: 1;
}

.summary-card div span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* Tabs */
.tabs-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin: 11px 0;
}

.dashboard-tabs {
    display: flex;
    gap: 6px;
}

.dashboard-tab {
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--panel);
    text-decoration: none;
    font-size: 10px;
    font-weight: 800;
}

.dashboard-tab span {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--blue);
    color: #fff;
    font-size: 8px;
}

.dashboard-tab.active {
    border-color: var(--green);
    color: #68ae31;
}

.dashboard-tab.active span { background: var(--green); }

.table-search {
    width: 220px;
    height: 32px;
}

/* Panels and tables */
.operations-panel,
.lower-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 13px;
    box-shadow: var(--shadow);
}

.operations-panel {
    padding: 15px;
    margin-bottom: 13px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 11px;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title h2 {
    margin: 0;
    font-size: 15px;
}

.panel-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-weight: 900;
}

.panel-icon.arrivals {
    color: var(--green);
    background: rgba(120,200,56,.12);
}

.panel-icon.departures {
    color: var(--blue);
    background: rgba(66,166,223,.12);
}

.panel-count {
    padding: 4px 7px;
    border-radius: 999px;
    font-size: 8px;
    font-weight: 900;
}

.panel-count.arrivals {
    color: var(--green);
    background: rgba(120,200,56,.12);
}

.panel-count.departures {
    color: var(--blue);
    background: rgba(66,166,223,.12);
}

.operation-table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 9px;
}

.operation-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
}

.operation-table th,
.operation-table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 9px;
}

.operation-table th {
    background: var(--panel-soft);
    color: var(--muted);
    font-weight: 900;
}

.operation-table tbody tr:last-child td { border-bottom: 0; }
.operation-table tbody tr:hover { background: rgba(66,166,223,.04); }

.empty-table {
    height: 120px;
    text-align: center !important;
    color: var(--muted);
}

.empty-symbol {
    display: block;
    margin-bottom: 5px;
    font-size: 28px;
    opacity: .5;
}

.room-number {
    min-width: 34px;
    padding: 4px 6px;
    border-radius: 6px;
    display: inline-flex;
    justify-content: center;
    background: var(--panel-soft);
    font-weight: 900;
}

.status-pill {
    padding: 4px 7px;
    border-radius: 999px;
    display: inline-flex;
    font-size: 8px;
    font-weight: 900;
}

.status-reserved { background: rgba(240,160,0,.16); color: #d89000; }
.status-checked_in { background: rgba(36,189,120,.16); color: #22a06b; }
.status-checked_out { background: rgba(79,140,255,.16); color: #4f7cff; }
.status-cancelled { background: rgba(236,90,99,.16); color: #ec5a63; }

.open-reservation {
    color: var(--blue);
    text-decoration: none;
    font-weight: 800;
}

/* Lower cards */
.lower-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 11px;
    margin-bottom: 13px;
}

.lower-card {
    min-height: 145px;
    padding: 13px;
}

.lower-card header {
    min-height: 25px;
    padding-bottom: 9px;
    margin-bottom: 9px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lower-card h3 {
    margin: 0;
    font-size: 11px;
}

.live-badge,
.alert-count {
    min-width: 20px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 7px;
    font-weight: 900;
}

.live-badge {
    background: rgba(120,200,56,.14);
    color: var(--green);
}

.alert-count {
    background: rgba(236,90,99,.14);
    color: var(--red);
}

.notice-row {
    display: flex;
    gap: 8px;
    padding: 8px;
    margin-bottom: 6px;
    border-radius: 8px;
    background: var(--panel-soft);
}

.notice-mark {
    width: 23px;
    height: 23px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    font-size: 9px;
    font-weight: 900;
}

.notice-mark.success { color: var(--green); background: rgba(120,200,56,.14); }
.notice-mark.warning { color: var(--orange); background: rgba(228,154,0,.14); }

.notice-row strong {
    display: block;
    font-size: 9px;
}

.notice-row small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 8px;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 9px;
}

.metric-row:last-child { border-bottom: 0; }
.metric-row strong { color: var(--text); }

.payment-alert {
    padding: 10px;
    border: 1px solid rgba(236,90,99,.5);
    border-radius: 8px;
    background: rgba(236,90,99,.06);
}

.payment-alert strong {
    display: block;
    margin-bottom: 4px;
    font-size: 9px;
}

.payment-alert span {
    color: var(--red);
    font-size: 8px;
    font-weight: 800;
}

.compact-empty {
    padding: 25px 0;
    color: var(--muted);
    text-align: center;
    font-size: 9px;
}

/* Shared forms/pages */
input,
select,
textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text);
}

input::placeholder,
textarea::placeholder { color: var(--muted); }

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(66,166,223,.12);
}

.card,
.panel,
.login-card,
.dashboard-card,
.dashboard-panel,
.reservation-panel,
.form-panel,
.room,
.detail-box,
.summary-box {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.card,
.panel,
.login-card,
.dashboard-card,
.dashboard-panel,
.reservation-panel,
.form-panel {
    padding: 16px;
    border-radius: 12px;
}

.login-card {
    width: min(410px, 92vw);
    text-align: center;
}

.login-card img { width: 120px; }

.login-card form {
    display: grid;
    gap: 11px;
    margin: 18px 0;
    text-align: left;
}

.alert {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    font-size: 11px;
}

.alert.success { background: rgba(36,189,120,.15); color: #22a06b; }
.alert.danger { background: rgba(236,90,99,.15); color: #ec5a63; }

html[data-theme="dark"] ::-webkit-scrollbar { width: 9px; height: 9px; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: #080c11; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #33404d; border-radius: 999px; }

@media (max-width: 1120px) {
    .dashboard-toolbar {
        grid-template-columns: auto 1fr;
    }

    .toolbar-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .summary-grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    .sidebar.open { transform: translateX(0); }

    main { margin-left: 0; }

    .mobile-menu-button { display: grid; }

    .lower-dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    main { padding: 0 12px 20px; }

    .top-header {
        min-height: 64px;
    }

    .top-new-reservation {
        display: none;
    }

    .dashboard-toolbar {
        grid-template-columns: 1fr;
    }

    .date-filter-form,
    .global-search,
    .toolbar-actions {
        width: 100%;
    }

    .global-search input { flex: 1; }

    .summary-grid { grid-template-columns: 1fr; }

    .tabs-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-tabs {
        overflow-x: auto;
    }

    .table-search { width: 100%; }
}

@media print {
    .sidebar,
    .top-header,
    .dashboard-toolbar,
    .tabs-toolbar {
        display: none !important;
    }

    main {
        margin: 0;
        padding: 0;
    }
}
