/* ==========================================================================
   HMS · Light Liquid Glass theme
   Palette: Signal Red #E10600 · Charcoal Grey #2A2A2A · Moonlit Silver #C0C0C0
            Deep Maroon #5A0F0C · Warm Taupe #8E8886
   Frosted, translucent panels over a soft warm background with faint colour
   blooms: blur + saturation backdrop, a thin hairline edge. Flat: no drop shadows.
   ========================================================================== */

:root {
    --red: #E10600;
    --charcoal: #2A2A2A;
    --silver: #C0C0C0;
    --maroon: #5A0F0C;
    --taupe: #8E8886;

    --text: var(--charcoal);
    --muted: #6a6361;
    --faint: #9a9391;
    --line: rgba(42, 42, 42, .10);

    --glass-a: rgba(255, 255, 255, .92);
    --glass-b: rgba(255, 255, 255, .62);
    --glass-border: rgba(42, 42, 42, .10);
    --blur: 24px;
    --radius: 24px;
    --radius-sm: 14px;

    /* functional colours, tuned to sit with the palette */
    --ok: #2c7a58;
    --warn: #b36b00;
    --bad: #E10600;
    --info: var(--maroon);

    --serif: "Playfair Display", Georgia, "Times New Roman", serif;
    --sans: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; }

body {
    margin: 0;
    min-height: 100vh;
    font: 15px/1.5 var(--sans);
    color: var(--text);
    background: #e9e7e6;
    -webkit-font-smoothing: antialiased;
}

/* ---- Plain solid background (light grey) ---- */
.bg { position: fixed; inset: 0; z-index: -1; background: #e9e7e6; }
.blob { display: none; }

/* ---- The glass material ---- */
.glass {
    position: relative;
    background: linear-gradient(145deg, var(--glass-a), var(--glass-b));
    -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
    backdrop-filter: blur(var(--blur)) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
}
/* specular sheen from the top-left, like light catching curved glass */
.glass::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0; pointer-events: none;
    background:
        radial-gradient(120% 65% at 0% 0%, rgba(255, 255, 255, .85), transparent 48%),
        linear-gradient(180deg, rgba(255, 255, 255, .35), transparent 28%);
}
.glass > * { position: relative; z-index: 1; }
.glass.pad { padding: 22px; }
.glass.tight { padding: 14px 18px; }

/* ---- Layout shell ---- */
.shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 20px; padding: 20px; min-height: 100vh; }
.sidebar { position: sticky; top: 20px; height: calc(100vh - 40px); padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 16px; }
.brand .mark {
    width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
    font: 700 20px var(--serif); color: #fff;
    background: linear-gradient(145deg, #ff3b30 0%, var(--red) 45%, var(--maroon) 130%);
}
.brand b { display: block; font: 700 16px/1.2 var(--serif); }
.brand small { color: var(--muted); font-size: 12px; }
.nav-group { margin: 14px 14px 4px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm);
    color: var(--muted); text-decoration: none; font-weight: 500; border: 1px solid transparent;
    transition: background .2s, color .2s;
}
.nav a:hover { color: var(--charcoal); background: rgba(255, 255, 255, .6); }
.nav a.active {
    color: var(--maroon); font-weight: 600;
    background: linear-gradient(135deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .55));
    border-color: rgba(42, 42, 42, .10);
}
.nav a.active svg { color: var(--red); }
.nav svg { flex: none; }
.sidebar .me { margin-top: auto; padding: 14px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .55); border: 1px solid rgba(42, 42, 42, .08); }
.me b { display: block; }
.me small { color: var(--muted); }
.me form { margin-top: 10px; }

.main { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; border-radius: 999px; }
.topbar h1 { margin: 0; font: 700 24px/1.2 var(--serif); letter-spacing: -.01em; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.menu-toggle { display: none; }

/* ---- Grid helpers ---- */
.grid { display: grid; gap: 18px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.right { margin-left: auto; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
h2 { margin: 0 0 14px; font: 700 19px/1.25 var(--serif); }
h3 { margin: 0 0 8px; font: 700 15px var(--serif); }

/* ---- Stat tiles ---- */
.stat { padding: 20px 22px;  }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.stat .value { font-size: 31px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; color: var(--charcoal); }
.stat .hint { color: var(--faint); font-size: 12.5px; }
.stat.accent .value { color: var(--maroon); }
.stat.ok .value { color: var(--ok); }
.stat.warn .value { color: var(--red); }
.stat.bad .value { color: var(--red); }
/* a thin red edge marks the headline tile */

/* ---- Forms ---- */
label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
    width: 100%; padding: 11px 14px; font: inherit; color: var(--text);
    background: rgba(255, 255, 255, .72);
    border: 1px solid rgba(42, 42, 42, .14); border-radius: var(--radius-sm);
    outline: none; transition: border-color .2s, background .2s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--red); background: #fff; }
input[type=checkbox] { width: 18px; height: 18px; padding: 0; accent-color: var(--red); }
.field { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.check { display: flex; align-items: center; gap: 10px; }
.check label { margin: 0; color: var(--text); }
.staff-id { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px dashed rgba(90, 15, 12, .45); background: rgba(90, 15, 12, .05); }
.staff-id label { color: var(--maroon); font-weight: 600; margin-bottom: 4px; }
.error { color: var(--red); font-size: 12.5px; margin-top: 5px; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
    padding: 10px 18px; font: inherit; font-weight: 600; color: var(--charcoal); text-decoration: none; white-space: nowrap;
    background: linear-gradient(160deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .55));
    border: 1px solid rgba(42, 42, 42, .16); border-radius: 999px;
    transition: transform .18s ease;
}
.btn:hover { background: #fff; }
.btn.primary:hover { background: #b30500; }
.btn.good:hover { background: #24634a; }
.btn.danger:hover { background: #3e0a08; }
.btn:active { transform: scale(.98); }
.btn.primary {
    color: #fff; border-color: rgba(255, 255, 255, .45);
    background: linear-gradient(160deg, #ff3b30 0%, var(--red) 50%, #b30500 100%);
}
.btn.good { color: #fff; border-color: rgba(255, 255, 255, .4); background: linear-gradient(160deg, #3f9a73, var(--ok)); }
.btn.danger { color: #fff; border-color: rgba(255, 255, 255, .35); background: linear-gradient(160deg, #7d1b17, var(--maroon)); }
.btn.sm { padding: 6px 13px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.inline-form { display: inline; }
a { color: var(--maroon); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(225, 6, 0, .04); }
tbody tr:last-child td { border-bottom: 0; }
td a { color: var(--charcoal); text-decoration: none; font-weight: 600; }
td a:hover { color: var(--red); }
td a.btn { font-weight: 600; }
td a.btn.primary, td a.btn.good, td a.btn.danger { color: #fff; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

/* ---- Status pills ---- */
.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: capitalize; border: 1px solid var(--line); background: rgba(255, 255, 255, .7); white-space: nowrap; color: var(--charcoal); }
.pill.available, .pill.paid, .pill.done, .pill.resolved, .pill.delivered, .pill.low { color: var(--ok); background: rgba(44, 122, 88, .10); border-color: rgba(44, 122, 88, .35); }
.pill.occupied, .pill.checked_in, .pill.in_progress, .pill.placed { color: var(--red); background: rgba(225, 6, 0, .08); border-color: rgba(225, 6, 0, .35); }
.pill.reserved, .pill.partial, .pill.pending, .pill.high, .pill.open { color: var(--warn); background: rgba(179, 107, 0, .10); border-color: rgba(179, 107, 0, .35); }
.pill.cleaning, .pill.checked_out, .pill.normal { color: #5b5553; background: rgba(142, 136, 134, .16); border-color: rgba(142, 136, 134, .5); }
.pill.maintenance, .pill.unpaid, .pill.cancelled, .pill.urgent { color: #fff; background: var(--maroon); border-color: var(--maroon); }

/* ---- Room board ---- */
.room-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.room-tile {
    display: block; padding: 12px 14px; border-radius: 18px; text-decoration: none; color: var(--charcoal);
    border: 1px solid rgba(42, 42, 42, .10); background: linear-gradient(150deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .45));
    transition: transform .2s; border-top: 3px solid var(--silver);
}
.room-tile:hover { background: #fff; }
.room-tile b { font-size: 20px; display: block; letter-spacing: -.01em; }
.room-tile small { color: var(--muted); display: block; margin-bottom: 8px; }
.room-tile.available { border-top-color: var(--ok); }
.room-tile.occupied { border-top-color: var(--red); background: linear-gradient(150deg, rgba(225, 6, 0, .12), rgba(255, 255, 255, .5)); }
.room-tile.reserved { border-top-color: var(--warn); }
.room-tile.cleaning { border-top-color: var(--taupe); }
.room-tile.maintenance { border-top-color: var(--maroon); background: linear-gradient(150deg, rgba(90, 15, 12, .16), rgba(255, 255, 255, .5)); }

/* ---- Chart ---- */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 170px; padding-top: 8px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar i { display: block; width: 100%; min-height: 4px; border-radius: 12px 12px 6px 6px; background: linear-gradient(180deg, var(--red), var(--maroon)); }
.bar span { font-size: 11.5px; color: var(--muted); }
.bar em { font-size: 11px; font-style: normal; color: var(--faint); }

/* ---- Misc ---- */
.flash { padding: 13px 18px; border-radius: var(--radius-sm); border: 1px solid rgba(44, 122, 88, .4); background: rgba(44, 122, 88, .12); color: #1d553c; font-weight: 500; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.flash.err { border-color: rgba(225, 6, 0, .4); background: rgba(225, 6, 0, .09); color: var(--maroon); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.totals { margin-left: auto; width: min(360px, 100%); }
.totals div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.totals .grand { font-size: 18px; font-weight: 700; border-bottom: 0; padding-top: 12px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.pagination { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--charcoal); font-size: 13px; background: rgba(255, 255, 255, .6); }
.pagination .active span { background: var(--red); color: #fff; border-color: var(--red); }
details.fold summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; }
details.fold summary::-webkit-details-marker { display: none; }
hr { border: 0; border-top: 1px solid var(--line); }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); padding: 34px; }
.login-card h1 { margin: 14px 0 4px; font: 700 28px var(--serif); }

/* ---- Responsive ---- */
@media (max-width: 1100px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; padding: 12px; }
    .sidebar { position: fixed; z-index: 50; left: 12px; top: 12px; bottom: 12px; width: 272px; height: auto; transform: translateX(-120%); transition: transform .3s ease; background: rgba(255, 255, 255, .92); }
    body.nav-open .sidebar { transform: translateX(0); }
    .menu-toggle { display: inline-flex; }
    .g-3, .g-2 { grid-template-columns: 1fr; }
    .topbar { border-radius: 26px; }
}
@media (max-width: 560px) { .g-4 { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; } }

/* ---- Accessibility / fallbacks ---- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass { background: rgba(255, 255, 255, .94); }
}
@media (prefers-reduced-transparency: reduce) {
    .glass { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) { .blob-unused { animation: none; } * { transition: none !important; } }

/* ---- Print (invoices & reports) ---- */
@media print {
    body { background: #fff; color: #111; }
    .bg, .sidebar, .topbar, .no-print, .flash { display: none !important; }
    .shell { display: block; padding: 0; }
    .glass { background: #fff; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
    .glass::before { display: none; }
    th, td, .muted, .small { color: #111 !important; border-color: #ccc !important; }
    .pill { color: #111 !important; background: none !important; border-color: #999 !important; }
}

/* Staff ID is pre-filled from the login and cannot be edited */
.staff-id input[readonly] { background: transparent; border-style: dashed; font-weight: 600; color: var(--maroon); cursor: default; }
.staff-id input[readonly]:focus { border-color: rgba(42, 42, 42, .14); outline: none; }
