:root {
    --hms-primary: #1f3c58;
    --hms-accent: #c8973a;
    --hms-bg: #f4f6f8;
    --hms-border: #e0e4e8;
    --hms-text: #24303d;
    --hms-sidebar-w: 250px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: var(--hms-bg);
    color: var(--hms-text);
}

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

.hms-sidebar {
    width: var(--hms-sidebar-w);
    background: var(--hms-primary);
    color: #fff;
    padding: 16px 0;
    overflow-y: auto;
    flex-shrink: 0;
}

.hms-brand {
    font-size: 1.3rem;
    font-weight: 700;
    padding: 0 20px 16px;
}

.hms-group-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9fb3c8;
    padding: 14px 20px 4px;
}

.hms-nav a {
    display: block;
    padding: 8px 20px;
    color: #e5ecf3;
    text-decoration: none;
    font-size: 0.9rem;
}

    .hms-nav a:hover {
        background: rgba(255,255,255,0.08);
    }

.hms-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hms-topbar {
    background: #fff;
    border-bottom: 1px solid var(--hms-border);
    padding: 16px 24px;
    font-size: 1.2rem;
    font-weight: 600;
}

.hms-content {
    padding: 24px;
}

.hms-alert {
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.hms-alert-success {
    background: #e4f6ea;
    color: #1e7d40;
    border: 1px solid #b8e6c6;
}

.hms-alert-error {
    background: #fbe6e6;
    color: #a02a2a;
    border: 1px solid #f0bcbc;
}

.hms-card {
    background: #fff;
    border: 1px solid var(--hms-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.hms-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.hms-stat {
    background: #fff;
    border: 1px solid var(--hms-border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

    .hms-stat .value {
        font-size: 1.8rem;
        font-weight: 700;
        color: var(--hms-primary);
    }

    .hms-stat .label {
        font-size: 0.8rem;
        color: #6b7684;
        text-transform: uppercase;
    }

table.hms-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

    table.hms-table th, table.hms-table td {
        padding: 10px 12px;
        border-bottom: 1px solid var(--hms-border);
        text-align: left;
        font-size: 0.9rem;
    }

    table.hms-table th {
        background: #f0f2f5;
        font-weight: 600;
    }

    table.hms-table tr:hover {
        background: #f8fafc;
    }

.hms-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.hms-btn {
    display: inline-block;
    background: var(--hms-primary);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.88rem;
}

    .hms-btn:hover {
        background: #16293c;
    }

.hms-btn-secondary {
    background: #6b7684;
}

.hms-btn-danger {
    background: #a02a2a;
}

.hms-btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.hms-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.hms-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #495260;
}

.hms-field input, .hms-field select, .hms-field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cdd4db;
    border-radius: 6px;
    font-size: 0.9rem;
}

.hms-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.hms-badge-green {
    background: #e4f6ea;
    color: #1e7d40;
}

.hms-badge-yellow {
    background: #fdf3d8;
    color: #8a6d1c;
}

.hms-badge-red {
    background: #fbe6e6;
    color: #a02a2a;
}

.hms-badge-blue {
    background: #e2ecfa;
    color: #1c4f8a;
}

.hms-badge-grey {
    background: #eceff2;
    color: #566172;
}

.hms-empty {
    padding: 40px;
    text-align: center;
    color: #8791a0;
}

.hms-actions a, .hms-actions button {
    margin-right: 6px;
}

/* ---- Pure-CSS tab strip (radio-driven, no JS, survives postback via ?tab=) ----
   Structure required: all <input type="radio" id="tab-X"> elements first (as
   siblings), then .hms-tab-strip (labels), then one .hms-tab-panel#panel-X per
   tab - in that same relative order - so the "~" general sibling selector below
   can reach forward from the checked radio to its panel. */
.hms-tabs input[type="radio"] {
    display: none;
}

.hms-tab-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 2px solid var(--hms-border);
    margin-bottom: 20px;
}

    .hms-tab-strip label {
        padding: 8px 14px;
        font-size: 0.85rem;
        font-weight: 600;
        color: #566172;
        background: #eceff2;
        border-radius: 6px 6px 0 0;
        cursor: pointer;
        user-select: none;
    }

.hms-tab-panel {
    display: none;
}

#tab-hotel:checked ~ .hms-tab-strip label[for="tab-hotel"],
#tab-branch:checked ~ .hms-tab-strip label[for="tab-branch"],
#tab-building:checked ~ .hms-tab-strip label[for="tab-building"],
#tab-floor:checked ~ .hms-tab-strip label[for="tab-floor"],
#tab-roomtype:checked ~ .hms-tab-strip label[for="tab-roomtype"],
#tab-room:checked ~ .hms-tab-strip label[for="tab-room"],
#tab-bedtype:checked ~ .hms-tab-strip label[for="tab-bedtype"],
#tab-amenities:checked ~ .hms-tab-strip label[for="tab-amenities"],
#tab-features:checked ~ .hms-tab-strip label[for="tab-features"],
#tab-facilities:checked ~ .hms-tab-strip label[for="tab-facilities"],
#tab-policies:checked ~ .hms-tab-strip label[for="tab-policies"],
#tab-tax:checked ~ .hms-tab-strip label[for="tab-tax"],
#tab-currency:checked ~ .hms-tab-strip label[for="tab-currency"],
#tab-numberseries:checked ~ .hms-tab-strip label[for="tab-numberseries"],
#tab-roommaster:checked ~ .hms-tab-strip label[for="tab-roommaster"],
#tab-roomstatus:checked ~ .hms-tab-strip label[for="tab-roomstatus"],
#tab-roomoperations:checked ~ .hms-tab-strip label[for="tab-roomoperations"],
#tab-history-stays:checked ~ .hms-tab-strip label[for="tab-history-stays"],
#tab-history-payments:checked ~ .hms-tab-strip label[for="tab-history-payments"],
#tab-history-preferences:checked ~ .hms-tab-strip label[for="tab-history-preferences"] {
    background: var(--hms-primary);
    color: #fff;
}

#tab-hotel:checked ~ #panel-hotel,
#tab-branch:checked ~ #panel-branch,
#tab-building:checked ~ #panel-building,
#tab-floor:checked ~ #panel-floor,
#tab-roomtype:checked ~ #panel-roomtype,
#tab-room:checked ~ #panel-room,
#tab-bedtype:checked ~ #panel-bedtype,
#tab-amenities:checked ~ #panel-amenities,
#tab-features:checked ~ #panel-features,
#tab-facilities:checked ~ #panel-facilities,
#tab-policies:checked ~ #panel-policies,
#tab-tax:checked ~ #panel-tax,
#tab-currency:checked ~ #panel-currency,
#tab-numberseries:checked ~ #panel-numberseries,
#tab-roommaster:checked ~ #panel-roommaster,
#tab-roomstatus:checked ~ #panel-roomstatus,
#tab-roomoperations:checked ~ #panel-roomoperations,
#tab-history-stays:checked ~ #panel-history-stays,
#tab-history-payments:checked ~ #panel-history-payments,
#tab-history-preferences:checked ~ #panel-history-preferences {
    display: block;
}


/* ---- Simple CSS-only bar charts (no JS charting library) - used by the
   Management Dashboard for Occupancy / Room revenue / Reservations /
   Booking source / Room type / Daily revenue / Monthly revenue. ---- */
.hms-chart-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495260;
    margin: 0 0 12px;
}

.hms-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.hms-bar-label {
    width: 110px;
    flex-shrink: 0;
    font-size: 0.8rem;
    color: #495260;
    text-align: right;
}

.hms-bar-track {
    flex: 1;
    background: #eceff2;
    border-radius: 4px;
    height: 18px;
    overflow: hidden;
}

.hms-bar-fill {
    background: var(--hms-primary);
    height: 100%;
    border-radius: 4px;
}

.hms-bar-fill-accent {
    background: var(--hms-accent);
}

.hms-bar-value {
    width: 90px;
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 600;
}


/* ---- Collapsible sidebar menu (JS-free, <details>) ---- */
.hms-nav .hms-menu-group {
    border-top: 1px solid rgba(255,255,255,0.08);
}

    .hms-nav .hms-menu-group > summary {
        list-style: none;
        cursor: pointer;
        padding: 11px 20px;
        font-size: 0.8rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #cfdbe8;
        display: flex;
        justify-content: space-between;
        align-items: center;
        user-select: none;
    }

        .hms-nav .hms-menu-group > summary::-webkit-details-marker {
            display: none;
        }

        .hms-nav .hms-menu-group > summary::after {
            content: "\25B8";
            font-size: 0.8rem;
            transition: transform 0.15s;
        }

    .hms-nav .hms-menu-group[open] > summary::after {
        transform: rotate(90deg);
    }

    .hms-nav .hms-menu-group > summary:hover {
        background: rgba(255,255,255,0.06);
    }

    .hms-nav .hms-menu-group[open] > summary {
        color: #fff;
    }

    .hms-nav .hms-menu-group > a {
        padding-left: 32px;
        font-size: 0.86rem;
        background: rgba(0,0,0,0.12);
    }

        .hms-nav .hms-menu-group > a:hover {
            background: rgba(255,255,255,0.1);
        }

/* currently selected page */
.hms-nav a.active {
    background: rgba(200,151,58,0.22);
    border-left: 4px solid var(--hms-accent);
    color: #fff;
    font-weight: 600;
}

.hms-nav > a.active {
    padding-left: 16px;
}

.hms-nav .hms-menu-group > a.active {
    padding-left: 28px;
}
