/* ============================================================
   HolRent — Main Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Source+Sans+3:wght@300;400;600;700&display=swap');

/* ── Variables — matches landing page ── */
:root {
    /* Brand colours (--primary, --primary-dk, --primary-lt, --secondary,
       --accent, --success, --danger, --bg) are injected from .env by
       partials/header.php and housekeeping_print.php - no static
       fallback here, .env is the single source of truth. */
    --text:       #1a1a1a;
    --muted:      #7f8c8d;
    --border:     #d0dde3;
    --white:      #ffffff;
    --radius:     6px;
    --shadow:     0 4px 16px rgba(0,0,0,.18);
    --success-lt:    #d5f5e3;
    --success-dk:    #1e8449;
    --success-border:#a9dfbf;
    --future-lt:     #eafaf1;
    --future-dk:     #27ae60;
    --danger-lt:     #fadbd8;
    --danger-dk:     #922b21;
    --danger-border: #f1948a;
    --info-lt:       #d6eaf8;
    --info-dk:       #1a5276;
    --info-border:   #85c1e9;
    --warning-lt:    #fef9e7;
    --warning-dk:    #9a7d0a;
    --warning-border:#f9e79f;
    --warning2-lt:   #fff3cd;
    --warning2-border:#ffc107;
    --warning2-dk:   #856404;
    --neutral:       #95a5a6;
    --disabled-bg:   #bbb;
    --tooltip-bg:    #333;
    --gray-text:     #555;
    --gray-border:   #ccc;
    --neutral-lt:    #f2f3f4;
    --custom0-lt:    #f4ecf7;
    --custom0-border:#9b59b6;
    --custom0-dk:    #7d3c98;
    --custom1-lt:    #e8f8f5;
    --custom1-border:#1abc9c;
    --custom1-dk:    #148f77;
    --custom2-lt:    #fef5e7;
    --custom2-border:#f39c12;
    --custom2-dk:    #ca6f1e;
    --custom3-lt:    #eaf0fb;
    --custom3-border:#5b8def;
    --custom3-dk:    #2e5fa3;
}

/* ── Reset ── */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Typography — matches landing page ── */
h1, h2, h3 { font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* ── Body ── */
body {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    scrollbar-gutter: stable;
    overflow-y: scroll;
}

/* ── Today Banner ── */
.today-banner {
    position: relative;
    background: var(--primary-dk);
    padding: 0.6rem 4rem;
    display: flex;
    align-items: center;
}
/* Equal-width left/right columns so the centre tagline sits at true dead-centre
   of the whole bar, not just the leftover space between logo and date/login —
   which are naturally different widths. Content inside each side still hugs
   its own outer edge via justify-content, so nothing visually moves. */
.banner-side { flex: 1; display: flex; }
.banner-side-left { justify-content: flex-start; }
.banner-side-right { justify-content: flex-end; }
.today-banner .brand {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.02em;
    text-decoration: none;
    display: block;
    line-height: 1;
}
.today-banner .brand .brand-img { height: 50px; width: auto; vertical-align: middle; margin-right: 0.5rem; }
.header-tagline {
    flex: 1;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    font-family: 'Source Sans 3', sans-serif;
}
.today-date { font-size: 0.82rem; color: var(--white); white-space: nowrap; line-height: 1; }

/* ── Top Nav ── */
.app-nav {
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    padding: 0 0 0 3.25rem;
    box-shadow: var(--shadow);
    position: relative;
}
.app-nav .brand { display: flex; align-items: center; gap: 10px; padding: 8px 20px; text-decoration: none; color: var(--white); font-weight: 700; font-size: 1.05rem; border-right: 1px solid rgba(255,255,255,0.15); white-space: nowrap; }
.app-nav .brand img { height: 38px; }
.app-nav nav { display: flex; flex: 1; }
.app-nav nav::-webkit-scrollbar { display: none; }
.app-nav nav a { color: var(--white); text-decoration: none; padding: 0 14px; line-height: 54px; font-size: 0.88rem; transition: background .15s; white-space: nowrap; }
.app-nav nav a:hover, .app-nav nav a.active { background: rgba(255,255,255,0.12); color: var(--white); }
.app-nav .userinfo { padding: 0 12px; font-size: 0.82rem; color: var(--white); display: flex; align-items: center; gap: 10px; white-space: nowrap; flex-shrink: 0; }
.app-nav .userinfo a { color: var(--white); text-decoration: none; }
.app-nav .userinfo a:hover { color: var(--white); }
.user-mobile-icon { display: none; font-size: .95rem; line-height: 1; }
.mobile-only { display: none; }
.user-chevron { display: inline; font-size: .7rem; }

/* ── Nav Dropdowns ── */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-trigger { cursor: pointer; padding: 0 14px; line-height: 54px; font-size: 0.88rem; color: var(--white); white-space: nowrap; }
.nav-dropdown-menu { display: block; position: absolute; top: 54px; left: 0; background: var(--primary); border-radius: 0 0 6px 6px; box-shadow: 0 4px 12px rgba(0,0,0,.2); min-width: 180px; z-index: 500; }
.nav-dropdown-menu a { display: flex; padding: 8px 14px; color: var(--white); text-decoration: none; font-size: 0.88rem; line-height: normal; border-bottom: 1px solid rgba(255,255,255,0.08); }
.nav-dropdown-menu a:last-child { border-bottom: none; }
.nav-dropdown-menu a:hover { background: rgba(255,255,255,0.12); color: var(--white); }

/* ── Header — User Menu ── */
.userinfo { position: relative; }
.user-menu-btn { cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.35); }
.user-menu { display: block; position: absolute; right: 0; top: 100%; background: var(--primary); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.2); min-width: 160px; z-index: 100; margin-top: 4px; }
.user-menu a { display: flex; padding: 4px 12px; color: var(--white); text-decoration: none; font-size: 0.88rem; line-height: normal; }
.user-menu a:hover { background: rgba(255,255,255,0.12); color: var(--white); }
.user-menu a.logout { font-weight: 600; }

/* ── Page Wrapper ── */
.page { max-width: 1280px; width: 100%; margin: 0 auto; padding: 24px 20px; flex: 1; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-header h1 { font-size: 1.4rem; color: var(--primary-dk); }

/* ── Cards ── */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; border-top: 3px solid var(--primary); }
.card-title { font-size: 1rem; font-weight: 600; color: var(--primary); margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.card-flush-nm { padding: 0; overflow: hidden; }

/* ── Stat Boxes ── */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; border-left: 4px solid var(--primary); }
.stat .label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.3rem; font-weight: 700; color: var(--primary-dk); margin-top: 2px; }
.stat .sub   { font-size: 0.8rem; color: var(--muted); }
.stat.accent  { border-left-color: var(--accent); }
.stat.accent .value  { color: var(--accent); }
.stat.success { border-left-color: var(--success); }
.stat.success .value { color: var(--success); }
.stat.warning { border-left-color: var(--secondary); }
.stat.warning .value { color: var(--secondary); }
.stats > a { display: flex; text-decoration: none; color: inherit; flex: 1; }
.stats > a > .stat { flex: 1; }

/* ── Tables ── */
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th { background: var(--primary-dk); color: var(--white); padding: 10px 12px; text-align: left; font-weight: 600; white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); font-size: 0.85rem; }
tbody tr:hover { background: var(--primary-lt); }
tbody td { padding: 9px 12px; vertical-align: middle; }
tfoot td { padding: 8px 12px; }
.td-right  { text-align: right; }
.td-center { text-align: center; }

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.78rem; font-weight: 600; }
.badge-stayed    { background: var(--success-lt); color: var(--success-dk); }
.badge-cancelled { background: var(--danger-lt); color: var(--danger-dk); }
.badge-future    { background: var(--future-lt); color: var(--future-dk); }
.badge-cash      { background: var(--info-lt); color: var(--info-dk); }
.badge-other     { background: var(--neutral-lt); color: var(--gray-text); }
.badge-no-show     { background: var(--warning-lt); color: var(--warning-dk); }
.badge-warning   { background: var(--warning-lt); color: var(--warning-dk); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); border: none; cursor: pointer; font-size: 0.88rem; font-weight: 600; text-decoration: none; transition: filter .15s; white-space: nowrap; line-height: 1.4; }
.btn:hover { filter: brightness(0.9); }
.btn-primary   { background: var(--primary);   color: var(--white); }
.btn-danger    { background: var(--danger);     color: var(--white); }
.btn-secondary { background: var(--white); color: var(--primary); border: 1.5px solid var(--primary); }
.btn-disabled  { background: var(--disabled-bg); color: var(--white); cursor: not-allowed; pointer-events: none; }
.btn-sm { padding: 4px 10px; font-size: 0.82rem; }
/* Landing page — accent (secondary colour) fill, outline-on-dark variant, and a larger hero/CTA size */
.btn-accent { background: var(--secondary); color: var(--white); }
.btn-outline-light { background: transparent; color: rgba(255,255,255,0.85); border: 1px solid rgba(255,255,255,0.35); }
.btn-outline-light:hover { filter: none; border-color: var(--white); color: var(--white); }
.btn-lg { padding: 1rem 2.2rem; font-size: 1rem; }

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

/* Manage Users - all fields on one row, sized to what they actually hold
   rather than the generic auto-fit minimum used elsewhere. Scoped to this
   page only, doesn't touch the shared .form-grid used on other pages. */
.users-form-panel .form-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.users-form-panel .form-field-sm { flex: 0 0 100px; min-width: 0; }
.users-form-panel .form-field-md { flex: 0 0 160px; min-width: 0; }
.users-form-panel .form-field-lg { flex: 1 1 200px; min-width: 200px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 0.88rem; font-weight: 600; color: var(--primary-dk); }
.form-group input,
.form-group select,
.form-group textarea { padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 0.92rem; color: var(--text); background: var(--primary-lt); transition: border-color .15s; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-group input:focus::placeholder,
.form-group select:focus::placeholder,
.form-group textarea:focus::placeholder { color: transparent !important; }
.form-group textarea { resize: vertical; min-height: 70px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.form-actions-flush { margin-top: 0; }

/* ── Hosts / Platforms page ── */
.hosts-form-row      { display: flex; gap: 10px; align-items: flex-end; flex-wrap: nowrap; }
.hosts-field-name    { flex: 0 0 170px; }
.hosts-field-xs      { flex: 0 0 100px; }
.hosts-field-rate    { flex: 0 0 150px; }
.hosts-field-pet     { flex: 0 0 150px; }
.hosts-field-check   { flex: 0 0 auto; }
.hosts-field-actions { flex: 0 0 auto; }
/* Name label row: "Name" left, "☑ Host is active" immediately after with small gap */
.hosts-name-label-row { display: flex; align-items: center; justify-content: flex-start; gap: 6px; }
.hosts-active-inline  { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.hosts-inline-label   { font-weight: 400 !important; color: var(--text) !important; cursor: pointer; white-space: nowrap; }
.hosts-check-inline   { display: flex; align-items: center; gap: 6px; height: 37px; }
/* align-items: stretch makes Save and Cancel render at the same height */
.hosts-actions-inline { display: flex; align-items: stretch; gap: 6px; }
.hosts-table-actions  { display: flex; gap: 4px; align-items: center; }
.hosts-form-inline    { display: inline; }
.hosts-form-actions   { display: flex; gap: 8px; margin-top: 12px; }

/* Warning tooltip — hover ⚠ to show */
.hosts-tooltip-icon { display: inline-flex; align-items: center; position: relative; color: var(--accent); cursor: help; font-size: 0.85rem; margin-left: 3px; vertical-align: middle; }
.hosts-tooltip-text { display: none; position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%); background: var(--tooltip-bg); color: var(--white); padding: 5px 10px; border-radius: 4px; font-size: 0.78rem; white-space: nowrap; z-index: 300; pointer-events: none; }
.hosts-tooltip-text::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 4px solid transparent; border-top-color: var(--tooltip-bg); }
.hosts-tooltip-icon:hover .hosts-tooltip-text { display: block; }

/* ── Alerts ── */
.alert { padding: 10px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.9rem; }
.alert-success { background: var(--success-lt); color: var(--success-dk); border: 1px solid var(--success-border); }
.alert-danger  { background: var(--danger-lt); color: var(--danger-dk); border: 1px solid var(--danger-border); }
.alert-info    { background: var(--info-lt); color: var(--info-dk); border: 1px solid var(--info-border); }
.alert-warning { background: var(--warning-lt); color: var(--warning-dk); border: 1px solid var(--warning-border); }

/* ── Search Bar ── */
.search-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.search-bar input, .search-bar select { padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 0.92rem; color: var(--text); background: var(--primary-lt); transition: border-color .15s; }
.search-bar input:focus, .search-bar select:focus { outline: none; border-color: var(--primary); }
.search-input-wrap input[type="text"] { width: 100%; }
.search-bar input[type=text] { flex: 1; min-width: 180px; }
.search-bar-flush { margin-bottom: 0; }

/* ── Table utilities ── */
.h1-count { font-size: .9rem; color: var(--muted); font-weight: 400; }
.card-compact { padding: 10px; }
tbody tr.clickable { cursor: pointer; }
.td-muted { font-size: .82rem; color: var(--muted); }
.form-section { margin-bottom: 20px; }

/* ── Status Summary Badges ── */
.status-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.status-badge { padding: 6px 16px; border-radius: 20px; font-size: 0.88rem; font-weight: 600; text-decoration: none; white-space: nowrap; border: 2px solid var(--muted); color: var(--muted); }
.status-badge-stayed    { background: var(--success); color: var(--white); border-color: transparent; }
.status-badge-future    { background: transparent; border: 2px solid var(--success); color: var(--success); }
.status-badge-other     { background: transparent; border: 2px solid var(--muted); color: var(--muted); }
.status-badge-cash      { background: transparent; border: 2px solid var(--info-dk); color: var(--info-dk); }
.status-badge-cancelled { background: transparent; border: 2px solid var(--danger-dk); color: var(--danger-dk); }
.status-badge-no-show   { background: transparent; border: 2px solid var(--warning-border); color: var(--warning-dk); }
.status-badge-custom-0  { background: var(--custom0-lt); border: 2px solid var(--custom0-border); color: var(--custom0-dk); }
.status-badge-custom-1  { background: var(--custom1-lt); border: 2px solid var(--custom1-border); color: var(--custom1-dk); }
.status-badge-custom-2  { background: var(--custom2-lt); border: 2px solid var(--custom2-border); color: var(--custom2-dk); }
.status-badge-custom-3  { background: var(--custom3-lt); border: 2px solid var(--custom3-border); color: var(--custom3-dk); }

/* ── Guest Autocomplete ── */
.guest-result { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 1rem; color: var(--text); background: var(--white); }
.guest-result:hover { background: var(--primary-lt); color: var(--primary-dk); }

/* ── Pagination ── */
.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }
.pagination a, .pagination span { padding: 5px 11px; border-radius: var(--radius); font-size: 0.85rem; border: 2px solid var(--primary); text-decoration: none; color: var(--primary); outline: none; }
.pagination span.current { background: var(--primary); color: var(--white); border-color: var(--primary); }
.pagination a:hover { background: var(--primary-lt); }

/* ── Modal ── */
.modal-overlay { display: flex; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 9999; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
.modal-box { background: var(--primary-lt); border-radius: 10px; padding: 32px; max-width: 380px; width: 100%; text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,.3); }
.modal-box h2 { font-size: 1.2rem; color: var(--primary-dk); margin-bottom: 8px; }
.modal-box p  { color: var(--muted); margin-bottom: 20px; }
.modal-icon { font-size: 2rem; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-input { width: 100%; padding: 10px; border: 1.5px solid var(--gray-border); border-radius: 4px; font-size: 1rem; margin-bottom: 12px; }
.modal-error { color: var(--danger); font-size: 0.85rem; margin-bottom: 10px; display: none; }

/* ── Layout Grids ── */
.responsive-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 16px; align-items: start; }
.two-col-grid    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.finance-grid    { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }

/* ── GST Input — hide spinner arrows ── */
input[name="gst_rate"]::-webkit-outer-spin-button,
input[name="gst_rate"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ============================================================
   Login Page
   ============================================================ */
.login-page body, body.login-page { background: var(--login-bg-image) center center / cover no-repeat fixed; display: flex; align-items: center; justify-content: center; min-height: 100dvh; }
body.login-page::before { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,0.2); z-index: 0; }
.nav-back { position: fixed; top: 1.2rem; right: 1.5rem; color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.9rem; font-weight: 600; z-index: 10; }
.nav-back:hover { color: var(--white); }
.login-box { position: relative; z-index: 1; background: var(--bg); border-radius: 10px; box-shadow: 0 4px 24px rgba(0,0,0,.12); padding: 40px 36px; width: calc(100% - 2rem); max-width: 380px; margin: 1rem; }
.login-box h1 { text-align: center; color: var(--primary-dk); font-size: 1.3rem; margin-bottom: 24px; }
.login-subtitle { text-align: center; color: var(--muted); font-size: 0.82rem; margin-bottom: 24px; }
.login-box label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.login-box input { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius); font-size: .95rem; margin-bottom: 14px; background: var(--primary-lt); }
.login-box input:focus { outline: none; border-color: var(--primary); }
.login-box button { width: 100%; padding: 10px; background: var(--primary); color: var(--white); border: none; border-radius: var(--radius); font-size: 1rem; font-weight: 600; cursor: pointer; }
.login-box button:hover { background: var(--primary-dk); }
.login-box .error { background: var(--danger-lt); color: var(--danger-dk); border: 1px solid var(--danger-border); border-radius: var(--radius); padding: 9px 14px; margin-bottom: 14px; font-size: .88rem; }


/* ============================================================
   Housekeeping Print Page
   ============================================================ */
.hk-print-body { font-family: Arial, sans-serif; font-size: 14px; color: var(--text); background: var(--primary-lt); padding: 24px 28px; display: flex; min-height: 100vh; }
.hk-print-body h1 { font-size: 26px; font-weight: bold; color: var(--primary-dk); margin-bottom: 20px; line-height: 1.2; }
.hk-print-body table { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.hk-print-body thead th { background: var(--primary-dk); padding: 4px 12px 8px 12px; text-align: left; font-weight: bold; font-size: 14px; color: var(--white); }
.hk-print-body tbody tr td { padding: 8px 12px; background: var(--primary-lt); vertical-align: middle; }
.hk-print-body .date-in  { background: var(--success-lt) !important; color: var(--text); font-weight: bold; border-radius: 3px; text-align: center; width: 110px; }
.hk-print-body .date-out { background: var(--danger-lt) !important; color: var(--text); border-radius: 3px; text-align: center; width: 110px; }
.hk-print-body .col-guests  { text-align: center; width: 70px; }
.hk-print-body .col-nights  { text-align: center; width: 70px; font-weight: bold; }
.hk-print-body .col-cleaner { font-weight: bold; width: 130px; }
.hk-print-body .col-datein  { width: 110px; }
.hk-print-body .col-dateout { width: 110px; }
.hk-print-body .footer { margin-top: 20px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.hk-print-body .no-print { margin-top: 20px; }
.hk-print-body .hk-checklist { margin-top: 24px; }
.hk-print-body .tbl-checklist { width: 100%; border-collapse: collapse; }
.hk-print-body .tbl-checklist td { padding: 8px 10px; vertical-align: middle; font-size: 13px; color: var(--text); }
.hk-print-body .chk-box { width: 26px; }
.hk-print-body .chk-box span { display: inline-block; width: 16px; height: 16px; border: 1.5px solid var(--text); border-radius: 3px; }
@media print {
    .hk-print-body { background: var(--primary-lt); -webkit-print-color-adjust: exact; print-color-adjust: exact; padding: 14px 18px; }
    .hk-print-body .no-print { display: none; }
    /* The table is wrapped in .tbl-wrap for mobile scrolling — on paper
       there's no viewport to scroll, so force it back to normal flow. */
    .hk-print-body .tbl-scroll { overflow: visible; }
    .hk-print-body .tbl-wrap table td:first-child,
    .hk-print-body .tbl-wrap table th:first-child { position: static; }
}

/* Housekeeping Print — mobile compact layout. Shrinks padding/font and
   drops the free-text Notes column (the one unbounded-width field) so the
   remaining columns size to their actual content and fit the screen width
   without needing to scroll — this is a screen-only view, print output is
   untouched by this block. */
@media (max-width: 768px) {
    .hk-print-body { padding: 10px 10px; font-size: 11px; }
    .hk-print-body h1 { font-size: 17px; }
    .hk-print-body table { table-layout: auto; }
    .hk-print-body thead th { padding: 5px 5px; font-size: 11px; }
    .hk-print-body tbody tr td { padding: 5px 5px; }
    .hk-print-body .col-datein,
    .hk-print-body .col-dateout,
    .hk-print-body .date-in,
    .hk-print-body .date-out,
    .hk-print-body .col-guests,
    .hk-print-body .col-nights,
    .hk-print-body .col-cleaner { width: auto; }
    .hk-print-body thead th:last-child,
    .hk-print-body tbody td:last-child { display: none; }
}
.tbl-housekeeping { table-layout: fixed; width: 100%; }
.tbl-housekeeping col:nth-child(1) { width: 130px; }
.tbl-housekeeping col:nth-child(2) { width: 130px; }
.tbl-housekeeping col:nth-child(3) { width: 220px; }
.tbl-housekeeping col:nth-child(4) { width: 65px; }
.tbl-housekeeping col:nth-child(5) { width: 65px; }
.tbl-housekeeping col:nth-child(6) { width: 130px; }
.tbl-housekeeping col:nth-child(7) { width: auto; }
.hk-week-row { background: var(--primary); color: var(--white); font-weight: 700; padding: 7px 12px; font-size: .92rem; letter-spacing: .02em; }
.hk-week-count { font-weight: 400; opacity: .8; font-size: .82rem; margin-left: 8px; }

/* ── Users page ── */

@media (max-width: 900px) { .header-tagline { display: none; } }

    /* "More items" cover — positioned dynamically by app.js to start exactly
       at the right edge of whichever nav item is the last one fully visible,
       so it always lands on a clean word boundary (never mid-word) at any
       screen width, and never overlaps the hamburger/account icon that
       follows it. Solid nav-colour block, not a fade — a partially legible
       item looks like a mistake, so it's fully hidden instead. Hidden
       entirely once nothing more remains to scroll to. */
    .nav-cover {
        position: absolute;
        top: 0;
        height: 54px;
        background: var(--primary);
        display: none;
        align-items: center;
        justify-content: flex-start;
        cursor: pointer;
    }
    .nav-cover.nav-has-scroll { display: flex; }
    .nav-cover .chev {
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: rgba(255,255,255,0.95);
        color: var(--primary-dk);
        font-size: 1.15rem;
        font-weight: 700;
        line-height: 1;
        box-shadow: 0 1px 4px rgba(0,0,0,.3);
        margin-left: 4px;
    }

/* ============================================================
   Mobile — max-width: 768px
   ============================================================ */
@media (max-width: 768px) {
    .header-tagline { display: none; }
    .today-banner { padding: 4px 10px; }
    .today-banner .brand { font-size: 0.8rem; white-space: nowrap; }
    .today-banner .brand .brand-img { height: 30px; margin-right: 0.35rem; }
    .app-nav { flex-wrap: nowrap; padding: 0; }
    .app-nav .brand { padding: 8px 10px; border-right: none; flex-shrink: 0; }
    .app-nav .brand img { height: 32px; }
    .app-nav .brand strong { display: none; }
    .app-nav nav {
        flex: 1;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overflow-y: visible;
        position: relative;
    }
    .app-nav nav a { padding: 0 8px; font-size: 0.8rem; }
    .app-nav nav .nav-dropdown-trigger { padding: 0 8px; font-size: 0.8rem; }
    .app-nav .userinfo { display: flex; padding: 0 4px; flex-shrink: 0; }
    .app-nav .userinfo .user-label { display: none; }
        .user-mobile-icon { display: inline; }
        .mobile-only { display: inline; }
    .user-chevron     { display: none; }
    .page { padding: 12px 10px; }
    .responsive-grid { grid-template-columns: 1fr !important; }
    .two-col-grid    { grid-template-columns: 1fr !important; }
    .finance-grid    { grid-template-columns: minmax(0, 1fr) !important; }
    .form-grid-4     { grid-template-columns: 1fr !important; }
    .form-grid-3     { grid-template-columns: 1fr !important; }
    .responsive-grid > .card { margin-top: 0 !important; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .stat .value { font-size: 1.12rem; }
    .hide-mobile { display: none !important; }
    .payment-form { flex-wrap: wrap; }
    .login-box { padding: 28px 20px; }
    /* Hosts form — stack on mobile */
    .hosts-form-row { flex-wrap: wrap; }
    .hosts-field-name,
    .hosts-field-xs,
    .hosts-field-rate,
    .hosts-field-pet { flex: none; width: 100%; }
    /* Scrollable tables — keep the first column (name/date/guest) pinned
       while the rest scrolls, so context is never lost, and stop cells
       wrapping onto multiple lines (the .tbl-wrap scroll handles overflow
       instead of ugly mid-word wraps). Arrow hint added/removed by app.js
       based on actual scroll position — see .has-scroll below. */
    .tbl-wrap { position: relative; }
    .tbl-wrap table th:first-child,
    .tbl-wrap table td:first-child { position: sticky; left: 0; z-index: 2; }
    .tbl-wrap table tbody td:first-child { background: var(--white); }
    .tbl-wrap table thead th:first-child { background: var(--primary-dk); z-index: 3; }
    /* .hk-week-row is a colspan=7 banner cell with its own green background —
       the generic sticky-column white background above would otherwise win
       (higher specificity) and leave white text on a white cell. */
    .tbl-wrap table tbody td.hk-week-row:first-child { background: var(--primary); }
    .tbl-wrap table td, .tbl-wrap table th { white-space: nowrap; }
    /* 24-Aug-2026: Replaced the circular scroll-hint icon with a plain
       edge fade - the icon was sitting directly on top of column heading
       text (unprofessional). Two fades are used, not one, because the
       header row and body rows have different background colours and a
       single flat-colour fade can only match one of them. */
    .tbl-wrap.has-scroll::before {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        height: var(--hdr-h, 40px);
        width: 28px;
        background: linear-gradient(to right, transparent, var(--primary-dk));
        pointer-events: none;
    }
    .tbl-wrap.has-scroll::after {
        content: '';
        position: absolute;
        top: var(--hdr-h, 40px);
        right: 0;
        bottom: 0;
        width: 28px;
        background: linear-gradient(to right, transparent, var(--white));
        pointer-events: none;
    }
    /* Housekeeping table's fixed desktop column widths (130/130/220/65/65/130px)
       leave huge empty gaps on mobile where content is much narrower than the
       column (e.g. a single-digit night count in a 65px column). Auto layout
       lets each column hug its actual content instead. */
    .tbl-housekeeping { table-layout: auto; }
    .tbl-housekeeping col { width: auto !important; }
    .tbl-housekeeping thead th, .tbl-housekeeping tbody td { padding: 8px 6px; }
    /* Nights/Guests are single or double digits — tighter padding brings
       them closer to Guest without losing readability. */
    .tbl-housekeeping tbody td:nth-child(4), .tbl-housekeeping thead th:nth-child(4),
    .tbl-housekeeping tbody td:nth-child(5), .tbl-housekeeping thead th:nth-child(5) { padding-left: 3px; padding-right: 3px; }
    /* Guest name capped to fit a typical name, ellipsis for anything longer —
       frees the space a long name would otherwise claim for Notes instead. */
    .tbl-housekeeping tbody td:nth-child(3) a { display: block; width: 82px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    /* "Housekeeper" header abbreviated to "H'keeper" on mobile only — visual
       swap via pseudo-element, the actual text/markup is untouched. */
    .tbl-housekeeping thead th:nth-child(6) { font-size: 0; }
    .tbl-housekeeping thead th:nth-child(6)::before { content: "H'keeper"; font-size: 0.9rem; }
}

/* ── Site Footer ── */
.site-footer { text-align: center; padding: 12px 24px; color: var(--muted); font-size: 0.8rem; flex-shrink: 0; }
.site-footer a { color: var(--muted); text-decoration: none; font-weight: 700; }

/* ============================================================
   Properties Page
   ============================================================ */
.properties-wrap { max-width: 520px; margin: 0 auto; }
.properties-h1 { font-size: 1.4rem; color: var(--primary-dk); margin-bottom: 16px; }
.properties-wrap .card:last-child { margin-bottom: 0; padding: 20px 20px 10px 20px; }
.properties-field { margin-bottom: 12px; }
.properties-gst-note { color: var(--gray-text); font-size: 0.9rem; margin-bottom: 12px; }
.properties-gst-row { display: flex; flex-direction: row; align-items: center; gap: 12px; }
.properties-gst-input { width: 120px; -moz-appearance: textfield; }
.properties-gst-input::-webkit-outer-spin-button,
.properties-gst-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.properties-wrap .form-actions { flex-wrap: nowrap; align-items: center; }
.properties-wrap .form-actions .btn { flex-shrink: 0; }
.properties-multi-note { font-size: 0.85rem; color: var(--muted); margin: 0; flex: 1; min-width: 0; }
.properties-address-row { display: flex; gap: 14px; }
.properties-address-row .properties-suburb-field { flex: 1; min-width: 0; }
.properties-address-row .properties-suburb-field input { width: 100%; box-sizing: border-box; }
.properties-address-row .properties-fixed-field { flex: 0 0 auto; }
.properties-address-row .properties-fixed-field input { width: calc(6ch + 22px); box-sizing: border-box; }
.properties-multi-link { color: var(--primary); font-weight: 600; text-decoration: none; }
.properties-multi-link:hover { text-decoration: underline; }
/* NOTE: contact_us.php inline styles in $body string MUST remain inline — email clients strip external stylesheets. */
.contact-form { margin-top: 16px; }

/* ============================================================
   Dashboard
   ============================================================ */
.stat.clickable { cursor: pointer; }
.stat .sub { white-space: nowrap; }
.stat .sub a { color: inherit; }
.stat-note-out { color: var(--accent); font-size: .78rem; }
.stat-note-in  { color: var(--success); font-size: .78rem; }
.stat-unpaid-amt { color: var(--accent); }
.stat-future-val { color: var(--success); }
.empty-state { color: var(--muted); font-size: .9rem; }
.td-ref { font-size: .8rem; color: var(--muted); }

/* ============================================================
   Finance Page
   ============================================================ */
.finance-year-form { display: flex; gap: 8px; align-items: center; }
.finance-year-label { font-size: .88rem; color: var(--muted); }
.finance-year-select { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.tbl-link { color: var(--primary); font-weight: 600; text-decoration: none; }
.tbl-link:hover { text-decoration: underline; }
.td-accent { color: var(--accent); }
.td-empty { color: var(--muted); text-align: center; padding: 16px; }
.card-title-flex { display: flex; justify-content: space-between; align-items: center; }
.card-title-back { font-size: .82rem; font-weight: 400; color: var(--muted); text-decoration: none; }
.card-title-accent { color: var(--accent); }
.card-title-note { font-size: .8rem; color: var(--muted); font-weight: 400; }
.tbl-totals-row { font-weight: 600; border-top: 2px solid var(--border); }
.drill-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; padding-bottom: 8px; }
.pagination-info { color: var(--muted); font-size: .9rem; }

/* ============================================================
   Payments Page
   ============================================================ */
.tbl-payments { table-layout: fixed; width: 100%; }
.tbl-payments col:nth-child(1) { width: 22%; }
.tbl-payments col:nth-child(2) { width: 11%; }
.tbl-payments col:nth-child(3) { width: 11%; }
.tbl-payments col:nth-child(4) { width: 10%; }
.tbl-payments col:nth-child(5) { width: 11%; }
.tbl-payments col:nth-child(6) { width: 11%; }
.tbl-payments col:nth-child(7) { width: 24%; }
.payment-form { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: nowrap; }
.payment-entry-header { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.payment-header-date   { flex: 1; text-align: center; }
.payment-header-amount { width: 80px; text-align: right; }
.payment-header-ok     { width: 36px; text-align: center; }
.payment-form-input  { padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.85rem; text-align: center; }
.payment-date-overdue { color: var(--danger); border-color: var(--danger); font-weight: 600; }
.payment-form-amount { width: 80px; text-align: right; }
.input-prefilled       { opacity: 0.45; }
.input-prefilled:focus { opacity: 1; }
.btn-payment-ok { min-width: 36px; justify-content: center; }
.payments-total-row   { font-weight: 600; border-top: 2px solid var(--border); background: var(--primary-lt); }
.payments-total-label { color: var(--success); font-weight: 700; }
.payments-total-value { color: var(--success); font-size: 1.1rem; font-weight: 600; }

/* ============================================================
   Utilities
   ============================================================ */
.notice-muted { text-align: center; margin-bottom: 20px; font-size: 0.88rem; color: var(--gray-text); font-style: italic; }
/* Generic show/hide toggle — replaces inline style="display:none" so JS can use classList instead */
.is-hidden { display: none; }
.header-alert { margin: 12px 20px 0; }
/* Dims an inactive row — referenced by hosts.php's markup but was never defined until now */
.row-inactive > td:not(.td-nowrap) { opacity: 0.5; }
.td-nowrap { white-space: nowrap; }
.form-group-mb    { margin-bottom: 12px; }
.form-group-mb-lg { margin-bottom: 16px; }
.form-group-checkbox { flex-direction: row; align-items: center; gap: 8px; margin-bottom: 16px; }

/* ============================================================
   Booking New / Edit Pages
   ============================================================ */
.full-width { grid-column: 1 / -1; }
.form-group.full-width { position: relative; }
/* !! display:none is set inline — JS toggle depends on inline style state !! */
.guest-results-dropdown { border: 2px solid var(--primary); border-radius: 6px; max-height: 200px; overflow-y: auto; background: var(--white); position: absolute; width: 100%; z-index: 100; box-shadow: 0 6px 20px rgba(0,0,0,.25); margin-top: 4px; }
.search-input-wrap { position: relative; flex: 1; min-width: 180px; }
.text-muted { color: var(--muted); }
.text-muted-sm { color: var(--muted); font-size: 0.82rem; }
.text-danger { color: var(--danger-dk); }
.text-warning { color: var(--warning-dk); }
.label-nowrap { white-space: nowrap; }
.page-header-actions { display: flex; gap: 8px; align-items: center; }
.input-warning { background: var(--warning2-lt); border-color: var(--warning2-border); }
.input-addon { display: flex; align-items: center; gap: 8px; }
.net-expected { color: var(--success); font-weight: 600; font-size: 0.88rem; }
.alert-cancelled { background: var(--warning2-lt); border: 1px solid var(--warning2-border); border-radius: 4px; padding: 8px 12px; margin-bottom: 10px; color: var(--warning2-dk); font-weight: 600; }

/* ============================================================
   Payments Page — Mobile overrides
   ============================================================ */
@media (max-width: 768px) {
    .payment-form { justify-content: space-between; gap: 3px; }
    .payment-entry-header { justify-content: space-between; }
    /* Fixed % column widths (desktop) assume all 7 columns are visible.
       On mobile, several are hidden via .hide-mobile but their <col> width is
       still reserved under table-layout:fixed, starving the remaining
       columns. Switching to auto lets the visible columns size to content. */
    .tbl-payments { table-layout: auto; }
    .tbl-payments td, .tbl-payments th { padding: 9px 6px; }
    .tbl-payments td:last-child { padding-left: 2px; }
    /* Due date input is hidden on desktop's mobile view of other tables but
       is the actual due-date entry field here — kept visible and narrowed
       to fit alongside Amount + OK now that Net Expected is hidden. */
    .payment-form-input[type="date"] { width: 96px; padding: 4px 2px; font-size: 0.72rem; }
    /* 24-Aug-2026: On mobile the date field is switched to manual
       text entry by app.js (the native picker icon can't be resized
       or hidden reliably on mobile - a real browser limitation, see
       Chromium's own issue tracker). This carries the same narrow
       width once [type="date"] no longer matches. */
    .payment-form-date-mobile { width: 80px; padding: 4px 2px; font-size: 0.72rem; text-align: center; }
    .payment-form-amount { width: 74px; padding: 4px 3px 4px 13px; font-size: 0.82rem; }
    /* Guest name capped to a fixed width with ellipsis truncation, on the
       link itself (not the <td>) — a plain width on a block-level element
       is respected reliably under table-layout:auto, unlike max-width on
       the cell, which auto-layout treats only as an advisory hint. This
       keeps every row single-line and the four columns aligned consistently
       regardless of name length. */
    .tbl-payments td:first-child a { display: block; width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ============================================================
   Payments Page — Pre-filled input styling
   ============================================================ */

.amount-field-wrap { position: relative; display: inline-block; }
.amount-field-wrap .amount-field-prefix {
    position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
    pointer-events: none; font-weight: 600; color: var(--success);
}
.payment-form-amount { color: var(--success); font-weight: 700; font-family: inherit; }
