@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
    /* Brand */
    --brand:        #0d9488;
    --brand-dark:   #0f766e;
    --brand-light:  #ccfbf1;
    --brand-subtle: #f0fdfa;

    /* Sidebar */
    --sidebar-bg:           #0c1f2e;
    --sidebar-border:       rgba(255,255,255,0.06);
    --sidebar-text:         #7a9ab0;
    --sidebar-text-active:  #e2f0ef;
    --sidebar-hover-bg:     rgba(13,148,136,0.12);
    --sidebar-active-bg:    rgba(13,148,136,0.22);
    --sidebar-active-border:#0d9488;
    --sidebar-width:        256px;
    --sidebar-collapsed-width: 76px;

    /* Neutrals */
    --ink:       #0f172a;
    --ink-soft:  #334155;
    --muted:     #64748b;
    --subtle:    #94a3b8;
    --line:      #e2e8f0;
    --surface:   #ffffff;
    --page:      #f1f5f9;

    /* Semantic palette */
    --c-green:      #059669; --c-green-bg:   #ecfdf5; --c-green-border: rgba(5,150,105,.2);
    --c-blue:       #2563eb; --c-blue-bg:    #eff6ff; --c-blue-border:  rgba(37,99,235,.2);
    --c-amber:      #d97706; --c-amber-bg:   #fffbeb; --c-amber-border: rgba(217,119,6,.2);
    --c-red:        #dc2626; --c-red-bg:     #fef2f2; --c-red-border:   rgba(220,38,38,.2);
    --c-purple:     #7c3aed; --c-purple-bg:  #f5f3ff; --c-purple-border:rgba(124,58,237,.2);
    --c-teal:       #0d9488; --c-teal-bg:    #f0fdfa; --c-teal-border:  rgba(13,148,136,.2);
    --c-slate:      #475569; --c-slate-bg:   #f8fafc; --c-slate-border: rgba(71,85,105,.2);
    --c-orange:     #ea580c; --c-orange-bg:  #fff7ed; --c-orange-border:rgba(234,88,12,.2);
    --c-indigo:     #4f46e5; --c-indigo-bg:  #eef2ff; --c-indigo-border:rgba(79,70,229,.2);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(15,23,42,.05);
    --shadow-sm: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.06);
    --shadow:    0 4px 8px rgba(15,23,42,.06), 0 2px 4px rgba(15,23,42,.04);
    --shadow-md: 0 8px 20px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.04);
    --shadow-lg: 0 20px 48px rgba(15,23,42,.14);

    /* Motion */
    --t: 160ms cubic-bezier(.4,0,.2,1);

    /* Radii */
    --r-sm: 6px;
    --r:    10px;
    --r-lg: 14px;
    --r-xl: 20px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--page);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 600; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
    transition: grid-template-columns var(--t);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.08) transparent;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 18px 18px;
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: 6px;
    flex-shrink: 0;
    position: relative;
}

.brand-text {
    min-width: 0;
}

.sidebar-toggle {
    align-items: center;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: var(--r-sm);
    color: var(--sidebar-text-active);
    cursor: pointer;
    display: inline-flex;
    flex-shrink: 0;
    height: 30px;
    justify-content: center;
    margin-left: auto;
    padding: 0;
    transition: background var(--t), border-color var(--t), color var(--t);
    width: 30px;
}

.sidebar-toggle:hover {
    background: rgba(13,148,136,.22);
    border-color: rgba(94,234,212,.35);
    color: #5eead4;
}

.sidebar-toggle-collapsed {
    display: none;
}

.brand-mark {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand);
    color: #fff;
    border-radius: var(--r-sm);
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(13,148,136,.45);
    letter-spacing: .02em;
}

.brand-logo {
    align-items: center;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-shrink: 0;
    height: 42px;
    justify-content: center;
    overflow: visible;
    padding: 0;
    width: 42px;
}

.brand-logo img {
    display: block;
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.brand-logo--sidebar {
    height: 58px;
    width: 58px;
}

.brand strong {
    display: block;
    color: #e0eeee;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.brand small {
    display: block;
    color: var(--sidebar-text);
    font-size: 11px;
    margin-top: 1px;
}

/* Navigation */
nav {
    padding: 6px 10px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.nav-section-label {
    padding: 12px 10px 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(122,154,176,.45);
    user-select: none;
}

nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--r-sm);
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 500;
    transition: background var(--t), color var(--t), border-color var(--t);
    border-left: 2px solid transparent;
    line-height: 1;
}

nav a .nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: .7;
    transition: opacity var(--t);
}

nav a:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-active);
    border-left-color: rgba(13,148,136,.4);
}

nav a:hover .nav-icon { opacity: 1; }

.nav-label {
    min-width: 0;
}

.nav-badge {
    align-items: center;
    background: #ef4444;
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: 10.5px;
    font-weight: 700;
    justify-content: center;
    line-height: 1;
    margin-left: auto;
    min-width: 18px;
    padding: 4px 6px;
}

nav a.active {
    background: var(--sidebar-active-bg);
    color: #b2f5ea;
    border-left-color: var(--sidebar-active-border);
    font-weight: 600;
}

nav a.active .nav-icon { opacity: 1; color: #5eead4; }

@media (min-width: 981px) {
    .app-shell.sidebar-collapsed {
        grid-template-columns: var(--sidebar-collapsed-width) 1fr;
    }

    .app-shell.sidebar-collapsed .brand {
        gap: 0;
        justify-content: center;
        padding: 16px 10px 12px;
    }

    .app-shell.sidebar-collapsed .brand-logo--sidebar {
        height: 38px;
        width: 38px;
    }

    .app-shell.sidebar-collapsed .brand-text {
        display: none;
    }

    .app-shell.sidebar-collapsed .sidebar-toggle {
        bottom: 8px;
        height: 26px;
        margin-left: 0;
        position: absolute;
        right: 8px;
        width: 26px;
    }

    .app-shell.sidebar-collapsed .sidebar-toggle-expanded {
        display: none;
    }

    .app-shell.sidebar-collapsed .sidebar-toggle-collapsed {
        display: block;
    }

    .app-shell.sidebar-collapsed nav {
        align-items: center;
        padding: 8px 8px 20px;
    }

    .app-shell.sidebar-collapsed .nav-section-label {
        display: none;
    }

    .app-shell.sidebar-collapsed nav a {
        border-left-width: 0;
        font-size: 0;
        gap: 0;
        height: 42px;
        justify-content: center;
        padding: 0;
        position: relative;
        width: 42px;
    }

    .app-shell.sidebar-collapsed nav a .nav-icon {
        font-size: 13px;
        opacity: .9;
    }

    .app-shell.sidebar-collapsed nav a .nav-icon svg {
        height: 18px;
        width: 18px;
    }

    .app-shell.sidebar-collapsed .nav-label {
        display: none;
    }

    .app-shell.sidebar-collapsed .nav-badge {
        font-size: 9px;
        min-width: 16px;
        padding: 3px 5px;
        position: absolute;
        right: -4px;
        top: 2px;
    }

    .app-shell.sidebar-collapsed nav a:hover,
    .app-shell.sidebar-collapsed nav a.active {
        border-left-color: transparent;
    }
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow-xs);
}

.topbar h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -.01em;
}

.topbar p {
    color: var(--muted);
    margin: 2px 0 0;
    font-size: 12.5px;
}

.userbox {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
}

/* ============================================================
   USER MENU DROPDOWN
   ============================================================ */
.user-menu { position: relative; }

.user-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    padding: 5px 8px;
    cursor: pointer;
    font: inherit;
    transition: background var(--t), border-color var(--t);
}

.user-trigger:hover,
.user-menu.open .user-trigger {
    background: #f1f5f9;
    border-color: var(--line);
}

.user-caret {
    color: var(--muted);
    flex-shrink: 0;
    transition: transform var(--t);
}

.user-menu.open .user-caret { transform: rotate(180deg); }

/* Dropdown panel */
.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-md);
    padding: 6px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity var(--t), visibility var(--t), transform var(--t);
    pointer-events: none;
}

.user-menu.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Header block (name + email) */
.user-dropdown-header {
    padding: 8px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-dropdown-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.user-dropdown-role {
    font-size: 11.5px;
    color: var(--muted);
}

/* Divider */
.user-dropdown-divider {
    border: none;
    border-top: 1px solid var(--line);
    margin: 4px 0;
}

/* Menu items — shared by <a> and <button> */
.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: background var(--t), color var(--t);
}

.user-dropdown-item:hover { background: #f1f5f9; color: var(--ink); }

.user-dropdown-item.danger { color: var(--c-red); }
.user-dropdown-item.danger:hover { background: var(--c-red-bg); }

/* Content padding wrapper */
.content-area {
    padding: 24px 28px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
}

/* ============================================================
   BUTTONS
   ============================================================ */
button, .button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--r-sm);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    transition: background var(--t), border-color var(--t), box-shadow var(--t), transform var(--t), color var(--t);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
}

button:hover, .button:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    box-shadow: var(--shadow-xs);
}

button:active, .button:active { transform: translateY(1px); }

.primary, button.primary, .button.primary {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
    box-shadow: 0 1px 3px rgba(13,148,136,.3);
}

.primary:hover, button.primary:hover, .button.primary:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    box-shadow: 0 2px 8px rgba(13,148,136,.4);
    color: #fff;
}

.icon-button {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    flex-shrink: 0;
}

.icon-button svg { flex-shrink: 0; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================
   KPI GRID
   ============================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.kpi-grid article {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--t), transform var(--t);
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeUp .35s ease both;
}

.kpi-grid article:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Stagger animation on KPI cards */
.kpi-grid article:nth-child(1) { animation-delay: .04s; }
.kpi-grid article:nth-child(2) { animation-delay: .08s; }
.kpi-grid article:nth-child(3) { animation-delay: .12s; }
.kpi-grid article:nth-child(4) { animation-delay: .16s; }
.kpi-grid article:nth-child(5) { animation-delay: .20s; }
.kpi-grid article:nth-child(6) { animation-delay: .24s; }

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Icon colour variants */
.kpi-icon.teal   { background: var(--c-teal-bg);   color: var(--c-teal); }
.kpi-icon.blue   { background: var(--c-blue-bg);   color: var(--c-blue); }
.kpi-icon.green  { background: var(--c-green-bg);  color: var(--c-green); }
.kpi-icon.amber  { background: var(--c-amber-bg);  color: var(--c-amber); }
.kpi-icon.red    { background: var(--c-red-bg);    color: var(--c-red); }
.kpi-icon.purple { background: var(--c-purple-bg); color: var(--c-purple); }
.kpi-icon.indigo { background: var(--c-indigo-bg); color: var(--c-indigo); }

.kpi-content span {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.kpi-content strong {
    display: block;
    font-size: 26px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
    letter-spacing: -.02em;
}

/* Fallback for plain article > span/strong (no .kpi-content wrapper) */
.kpi-grid > article > span {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.kpi-grid > article > strong {
    display: block;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.02em;
}

/* ============================================================
   PANEL
   ============================================================ */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 #e2e8f0;
    scrollbar-gutter: stable;
    animation: fadeUp .3s ease both;
}

.panel:has(> table) {
    overflow: auto;
    max-height: calc(100vh - 190px);
}

form > .panel:has(> table) {
    max-height: calc(100vh - 300px);
}

.table-scroll,
.table-scroll-top {
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 #e2e8f0;
}

.table-scroll {
    overflow: auto;
    max-width: 100%;
    max-height: calc(100vh - 190px);
    -webkit-overflow-scrolling: touch;
}

form > .panel .table-scroll {
    max-height: calc(100vh - 330px);
}

.table-scroll-top {
    height: 16px;
    overflow-x: scroll;
    overflow-y: hidden;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
}

.table-scroll-top[hidden] {
    display: none;
}

.table-scroll-top-inner {
    height: 1px;
}

.panel::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar,
.table-scroll-top::-webkit-scrollbar,
.content-area::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

.panel::-webkit-scrollbar-track,
.table-scroll::-webkit-scrollbar-track,
.table-scroll-top::-webkit-scrollbar-track,
.content-area::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 999px;
}

.panel::-webkit-scrollbar-thumb,
.table-scroll::-webkit-scrollbar-thumb,
.table-scroll-top::-webkit-scrollbar-thumb,
.content-area::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border: 3px solid #e2e8f0;
    border-radius: 999px;
}

.panel::-webkit-scrollbar-thumb:hover,
.table-scroll::-webkit-scrollbar-thumb:hover,
.table-scroll-top::-webkit-scrollbar-thumb:hover,
.content-area::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fafcfc 0%, var(--surface) 100%);
}

.panel-head h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -.01em;
}

.actions, .tile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.inline-action-form {
    display: inline-flex;
    margin: 0;
}

.tile-actions {
    padding: 16px 20px;
    gap: 10px;
}

.tile-actions .button {
    padding: 10px 18px;
    font-size: 13.5px;
    border-radius: var(--r-sm);
}

/* ============================================================
   LIST FILTERS & PAGINATION
   ============================================================ */
.list-filters {
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.list-filter-panel {
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    margin-bottom: 14px;
}

.list-filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.list-filter-search {
    flex: 1 1 360px;
    max-width: 560px;
}

.list-filter-grid label {
    display: flex;
    flex-direction: column;
    flex: 0 1 220px;
    gap: 6px;
    min-width: 0;
}

.list-filter-grid label:has(input[type="date"]) { flex: 0 0 150px; }
.list-filter-grid label:has(select) { flex: 0 1 240px; }

.list-filter-grid label span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.list-filter-grid input,
.list-filter-grid select {
    min-height: 38px;
}

.list-filter-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.list-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid var(--line);
    background: #f8fafc;
}

.list-count,
.pagination-status {
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
}

.pagination {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

/* ============================================================
   TABBED ENTRY PANELS
   ============================================================ */
.tabbar {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: #f8fafc;
}

.tab-button {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

.tab-button.active {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
    box-shadow: var(--shadow-xs);
}

.booking-tab-panel { display: none; }
.booking-tab-panel.active { display: block; animation: fadeIn .18s ease; }

.booking-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: #f8fafc;
}

.booking-summary div {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
}

.booking-summary span {
    display: block;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.booking-summary strong {
    display: block;
    margin-top: 4px;
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   DASHBOARD FILTERS & AVAILABILITY
   ============================================================ */
.dashboard-filter-panel {
    padding: 16px 20px;
}

.dashboard-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.dashboard-filter label {
    display: grid;
    flex: 0 1 240px;
    gap: 5px;
    min-width: 0;
}

.dashboard-filter label:has(input[type="date"]) { flex: 0 0 150px; }
.dashboard-filter label:has(select) {
    flex: 1 1 320px;
    max-width: 520px;
}

.dashboard-filter label span {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
}

.dashboard-filter-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.availability-head {
    align-items: flex-start;
}

.availability-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
}

.availability-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.availability-legend i {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid currentColor;
}

.availability-calendar th,
.availability-calendar td {
    border-right: 1px solid #f1f5f9;
}

.availability-property-col {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 190px;
    background: #fff;
}

thead .availability-property-col {
    z-index: 3;
    background: #f8fafc;
}

.availability-day {
    min-width: 68px;
    text-align: center;
}

.availability-day span,
.availability-day small {
    display: block;
}

.availability-day span {
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
}

.availability-day small {
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
}

.availability-day.is-today {
    background: var(--brand-subtle);
}

.availability-cell {
    min-width: 68px;
    height: 42px;
    padding: 4px;
    text-align: center;
}

.availability-cell a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-height: 32px;
    padding: 3px 5px;
    border-radius: var(--r-sm);
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.15;
    overflow: hidden;
}

.availability-cell a:hover {
    box-shadow: inset 0 0 0 1px currentColor;
}

.availability-cell em {
    font-style: normal;
    opacity: .85;
}

.cal-status--enquiry,
.cal-status--confirmed { background: var(--c-blue-bg); color: var(--c-blue); }
.cal-status--checked_in { background: var(--c-teal-bg); color: var(--c-teal); }
.cal-status--checked_out { background: var(--c-slate-bg); color: var(--c-slate); }
.cal-status--owner_stay { background: var(--c-purple-bg); color: var(--c-purple); }
.cal-status--no_income { background: var(--c-orange-bg); color: var(--c-orange); }

/* ============================================================
   TABLES
   ============================================================ */
table { width: 100%; border-collapse: collapse; }

.panel > table,
.table-scroll > table {
    min-width: max-content;
}

thead tr { background: #f8fafc; }

th {
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 13.5px;
    color: var(--ink);
}

td input[type="number"] {
    min-width: 96px;
}

td.num input[type="number"] {
    max-width: 132px;
    text-align: right;
}

tbody tr { transition: background var(--t); }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* Numeric cells */
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ============================================================
   REPORTS
   ============================================================ */
.report-filters {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    padding: 14px;
    margin-bottom: 14px;
}

.report-filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.report-filters label {
    display: flex;
    flex-direction: column;
    flex: 0 1 220px;
    gap: 6px;
    min-width: 0;
}

.report-filters label:has(input[type="date"]) { flex: 0 0 150px; }
.report-filters label:has(select) { flex: 0 1 280px; }
.report-filters .report-fiscal-year { flex: 0 0 150px; }

.report-filters label span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.report-filters input,
.report-filters select {
    width: 100%;
    min-height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: var(--r-sm);
    background: #fff;
    color: var(--ink);
    padding: 8px 10px;
    font: inherit;
}

.report-filter-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
}

.report-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.report-card-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 14px;
}

.report-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 86px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    padding: 16px;
}

.report-card strong {
    font-size: 18px;
    letter-spacing: 0;
}

.report-card span {
    color: var(--muted);
    font-size: 12.5px;
}

a.report-card:hover {
    border-color: var(--brand);
    box-shadow: var(--shadow);
}

.report-panel {
    margin-bottom: 14px;
}

.report-table {
    font-size: 11.5px;
}

.report-table--fixed {
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
}

/* Freeze header row */
.report-scroll {
    overflow: auto;
    max-height: calc(100vh - 220px);
}

.report-table--fixed thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #bbf7d0;
}

/* Freeze Acc Code column */
.col-freeze-1 {
    position: sticky;
    left: 0;
    z-index: 3;
    min-width: 80px;
    width: 80px;
}

/* Freeze Account column */
.col-freeze-2 {
    position: sticky;
    left: 80px;
    z-index: 3;
    min-width: 200px;
    width: 200px;
}

/* Freeze both columns in header (higher z-index to overlap body) */
.report-table--fixed thead th.col-freeze-1,
.report-table--fixed thead th.col-freeze-2 {
    z-index: 5;
    background: #bbf7d0;
}

/* Solid backgrounds so scrolled content is hidden behind frozen cells */
.report-table--fixed tbody td.col-freeze-1,
.report-table--fixed tbody td.col-freeze-2 {
    background: #fff;
}

.report-row--section td.col-freeze-1,
.report-row--section td.col-freeze-2 { background: #b9e9f6; }
.report-row--subsection td.col-freeze-1,
.report-row--subsection td.col-freeze-2 { background: #d6f4fb; }
.report-row--subtotal td.col-freeze-1,
.report-row--subtotal td.col-freeze-2 { background: #c9eef7; }
.report-row--highlight td.col-freeze-1,
.report-row--highlight td.col-freeze-2 { background: #fde9dc; }
.report-row--major td.col-freeze-1,
.report-row--major td.col-freeze-2 { background: #8ee59f; }

/* Equal-width data columns */
.col-data {
    min-width: 90px;
    width: 90px;
    text-align: right;
}

.report-table th,
.report-table td {
    white-space: nowrap;
    border-right: 1px solid #d8ecf6;
    padding: 5px 8px;
    font-size: 11.5px;
}

.report-table th:last-child,
.report-table td:last-child {
    border-right: 0;
}

.report-table thead tr {
    background: #bbf7d0;
}

.report-table .total-cell {
    background: #d9f3fb;
    font-weight: 700;
}

.report-account-link {
    color: #0f766e;
    font-weight: 700;
    text-decoration: none;
}

.report-account-link:hover {
    color: var(--brand-dark);
    text-decoration: underline;
}

.report-account-button {
    appearance: none;
    border: 0;
    background: transparent;
    color: #0f766e;
    cursor: pointer;
    display: block;
    font: inherit;
    font-weight: 700;
    margin: 0;
    max-width: 100%;
    padding: 0;
    text-align: left;
    text-decoration: none;
}

.report-account-button:hover,
.report-account-button:focus {
    color: var(--brand-dark);
    text-decoration: underline;
}

.report-account-button--name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pl-detail-drawer[hidden] {
    display: none;
}

.pl-detail-drawer {
    position: fixed;
    inset: 0;
    z-index: 60;
}

.pl-detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.36);
}

.pl-detail-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(980px, 76vw);
    background: #fff;
    box-shadow: -18px 0 40px rgba(15, 23, 42, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pl-detail-content {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

.pl-drawer-head {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding: 16px 18px 12px;
}

.pl-drawer-head span {
    color: var(--muted);
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.pl-drawer-head h2 {
    font-size: 18px;
    line-height: 1.25;
    margin: 3px 0 4px;
}

.pl-drawer-head p {
    color: var(--muted);
    margin: 0;
}

.pl-drawer-summary {
    flex: 0 0 auto;
}

.pl-drawer-table-wrap {
    border-radius: 0;
    box-shadow: none;
    flex: 1;
    min-height: 0;
}

.pl-drawer-table {
    table-layout: fixed;
    width: 100%;
    min-width: 860px;
}

.pl-drawer-table th,
.pl-drawer-table td {
    vertical-align: top;
    white-space: normal;
}

.pl-drawer-table .ledger-nowrap,
.pl-drawer-table .num {
    white-space: nowrap;
}

.pl-drawer-table .ledger-text-cell,
.pl-drawer-table .ledger-property-cell {
    overflow-wrap: anywhere;
}

.report-detail-link {
    appearance: none;
    background: transparent;
    border: 0;
    color: var(--brand-dark);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    padding: 0;
    text-align: left;
    text-decoration: none;
}

.report-detail-link:hover,
.report-detail-link:focus {
    text-decoration: underline;
}

.report-wrap-cell,
.pl-reference-cell {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.report-row-expand {
    align-items: center;
    appearance: none;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 999px;
    color: var(--brand-dark);
    cursor: pointer;
    display: inline-flex;
    font-size: 13px;
    font-weight: 900;
    height: 22px;
    justify-content: center;
    margin-right: 6px;
    width: 22px;
}

.pl-breakdown-row[hidden] {
    display: none;
}

.pl-breakdown-row td {
    background: #f8fafc;
    padding: 10px 14px;
}

.pl-breakdown-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.pl-breakdown-panel h3 {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    margin: 0;
    padding: 10px 12px;
    text-transform: uppercase;
}

.pl-breakdown-table {
    min-width: 0;
    width: 100%;
}

.history-detail-table {
    min-width: 780px;
}

.pl-detail-loading,
.pl-detail-error {
    color: var(--muted);
    padding: 22px;
}

.pl-detail-error {
    color: #b91c1c;
}

.report-summary-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.report-summary-strip div {
    min-width: 150px;
}

.report-summary-strip span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.report-summary-strip strong {
    display: block;
    margin-top: 4px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.ledger-detail-table {
    table-layout: fixed;
    width: 100%;
    min-width: 100%;
}

.ledger-detail-table th,
.ledger-detail-table td {
    vertical-align: top;
    white-space: normal;
}

.ledger-detail-table .ledger-date-col { width: 9%; }
.ledger-detail-table .ledger-ref-col { width: 10%; }
.ledger-detail-table .ledger-account-col { width: 14%; }
.ledger-detail-table .ledger-memo-col { width: 18%; }
.ledger-detail-table .ledger-description-col { width: 20%; }
.ledger-detail-table .ledger-property-col { width: 11%; }
.ledger-detail-table .ledger-amount-col { width: 9%; }
.ledger-detail-table .ledger-balance-col { width: 10%; }
.ledger-detail-table .ledger-side-col { width: 5%; }

.ledger-detail-table .ledger-text-cell,
.ledger-detail-table .ledger-property-cell {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    line-height: 1.35;
}

.ledger-detail-table .ledger-nowrap,
.ledger-detail-table .num {
    white-space: nowrap;
}

.balance-sheet-table .col-freeze-2 {
    min-width: 230px;
    width: 230px;
}

.balance-sheet-table .col-data {
    min-width: 116px;
    width: 116px;
}

.drawer-head-actions {
    align-items: center;
    display: flex;
    gap: 8px;
}

.ledger-detail-table--drawer {
    min-width: 1080px;
}

.receipt-register-table {
    table-layout: fixed;
    width: 100%;
    min-width: 100% !important;
}

.receipt-register-table th,
.receipt-register-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    vertical-align: top;
}

.receipt-register-table .receipt-nowrap,
.receipt-register-table .num,
.receipt-register-table .print-cell {
    white-space: nowrap;
}

.receipt-register-table .settled-invoices-cell {
    line-height: 1.35;
}

.receipt-register-table .print-cell {
    text-align: center;
}

.receipt-register-table .print-cell .btn {
    padding: 4px 8px;
}

.report-row--section td {
    background: #b9e9f6;
    color: #0f172a;
    font-weight: 800;
    text-transform: uppercase;
}

.report-row--subsection td {
    background: #d6f4fb;
    font-weight: 700;
    text-transform: uppercase;
}

.report-row--subtotal td {
    background: #c9eef7;
    font-weight: 800;
    text-transform: uppercase;
    border-top: 1px solid #64748b;
}

.report-row--highlight td {
    background: #fde9dc;
    font-weight: 800;
    text-transform: uppercase;
    border-top: 1px solid #64748b;
    border-bottom: 1px solid #64748b;
}

.report-row--major td {
    background: #8ee59f;
    color: #0f172a;
    font-weight: 900;
    text-transform: uppercase;
}

.report-row--spacer td {
    height: 12px;
    padding: 0;
    background: #fff;
    border-right: 0;
}

.muted-row {
    color: var(--muted);
    padding: 22px 16px;
}

.report-split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.petty-report-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
}

.report-note {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    padding: 12px 14px 14px;
}

.report-breakdown-link {
    appearance: none;
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    text-align: left;
    text-transform: inherit;
    cursor: pointer;
}

.report-breakdown-link:hover {
    color: var(--brand-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.report-popup[hidden] {
    display: none;
}

.report-popup {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
}

.report-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .42);
}

.report-popup__panel {
    position: relative;
    width: min(520px, 100%);
    max-height: min(640px, calc(100vh - 48px));
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
}

.report-popup__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.report-popup__head h2 {
    font-size: 14px;
}

.report-popup__head span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.report-popup__body {
    padding: 12px 16px 16px;
}

.report-popup-table {
    min-width: 100%;
}

.report-popup-table td:first-child {
    font-weight: 600;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
    background: var(--c-teal-bg);
    color: var(--c-teal);
    border: 1px solid var(--c-teal-border);
    white-space: nowrap;
}

/* ── Booking statuses ── */
.status--enquiry      { background:var(--c-blue-bg);   color:var(--c-blue);   border-color:var(--c-blue-border); }
.status--confirmed    { background:var(--c-green-bg);  color:var(--c-green);  border-color:var(--c-green-border); }
.status--checked_in   { background:var(--c-teal-bg);   color:var(--c-teal);   border-color:var(--c-teal-border); }
.status--checked_out  { background:var(--c-slate-bg);  color:var(--c-slate);  border-color:var(--c-slate-border); }
.status--cancelled    { background:var(--c-red-bg);    color:var(--c-red);    border-color:var(--c-red-border); }
.status--owner_stay   { background:var(--c-purple-bg); color:var(--c-purple); border-color:var(--c-purple-border); }
.status--no_income    { background:var(--c-orange-bg); color:var(--c-orange); border-color:var(--c-orange-border); }

/* ── Journal / Bill / Capex / Asset statuses ── */
.status--draft        { background:var(--c-slate-bg);  color:var(--c-slate);  border-color:var(--c-slate-border); }
.status--submitted    { background:var(--c-blue-bg);   color:var(--c-blue);   border-color:var(--c-blue-border); }
.status--approved     { background:var(--c-green-bg);  color:var(--c-green);  border-color:var(--c-green-border); }
.status--posted       { background:var(--c-teal-bg);   color:var(--c-teal);   border-color:var(--c-teal-border); }
.status--paid         { background:var(--c-green-bg);  color:#065f46;         border-color:rgba(5,150,105,.3); font-weight:700; }
.status--issued       { background:var(--c-blue-bg);   color:var(--c-blue);   border-color:var(--c-blue-border); }
.status--open         { background:var(--c-blue-bg);   color:var(--c-blue);   border-color:var(--c-blue-border); }
.status--partial      { background:var(--c-amber-bg);  color:var(--c-amber);  border-color:var(--c-amber-border); }
.status--settled      { background:var(--c-green-bg);  color:var(--c-green);  border-color:var(--c-green-border); }
.status--pending      { background:var(--c-amber-bg);  color:var(--c-amber);  border-color:var(--c-amber-border); }
.status--released     { background:var(--c-teal-bg);   color:var(--c-teal);   border-color:var(--c-teal-border); }
.status--void         { background:var(--c-red-bg);    color:var(--c-red);    border-color:var(--c-red-border); }
.status--rejected     { background:var(--c-red-bg);    color:var(--c-red);    border-color:var(--c-red-border); }
.status--reversed     { background:var(--c-amber-bg);  color:var(--c-amber);  border-color:var(--c-amber-border); }
.status--converted    { background:var(--c-purple-bg); color:var(--c-purple); border-color:var(--c-purple-border); }
.status--active       { background:var(--c-green-bg);  color:var(--c-green);  border-color:var(--c-green-border); }
.status--disposed     { background:var(--c-amber-bg);  color:var(--c-amber);  border-color:var(--c-amber-border); }
.status--written_off  { background:var(--c-red-bg);    color:var(--c-red);    border-color:var(--c-red-border); }

/* ============================================================
   PUBLIC BOOKING LINK SWITCHES
   ============================================================ */
.public-link-panel {
    margin-bottom: 14px;
}

.public-link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    padding: 16px;
}

.public-link-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 12px 14px;
    background: var(--c-slate-bg);
}

.public-link-tile strong {
    display: block;
    font-size: 14px;
}

.public-link-tile .muted {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

.public-link-state {
    display: flex;
    align-items: center;
    gap: 10px;
}

.public-link-state form {
    margin: 0;
}

.public-switch {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 68px;
    height: 32px;
    padding: 3px 9px 3px 4px;
    border: 1px solid var(--c-red-border);
    border-radius: 999px;
    background: var(--c-red-bg);
    color: var(--c-red);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.public-switch span {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 7px rgba(15, 23, 42, .18);
    transition: transform .18s ease;
}

.public-switch.is-on {
    flex-direction: row-reverse;
    padding: 3px 4px 3px 9px;
    border-color: var(--c-green-border);
    background: var(--c-green-bg);
    color: var(--c-green);
}

.public-switch:hover {
    filter: saturate(1.08);
}

/* ============================================================
   FORM PANEL
   ============================================================ */
.form-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    max-width: 760px;
    padding: 26px;
    animation: fadeUp .3s ease;
}

.form-panel.wide { max-width: 1200px; }

.form-section-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    margin: 24px 0 12px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    letter-spacing: .01em;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

/* ============================================================
   FORM FIELDS
   ============================================================ */
form p {
    display: grid;
    gap: 5px;
    margin: 0 0 14px;
}

form p label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: .01em;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 9px 12px;
    font: inherit;
    font-size: 13.5px;
    background: #fff;
    color: var(--ink);
    transition: border-color var(--t), box-shadow var(--t);
    outline: none;
    appearance: auto;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(13,148,136,.14);
}

input:hover:not(:focus),
select:hover:not(:focus),
textarea:hover:not(:focus) {
    border-color: #94a3b8;
}

input[type="radio"],
input[type="checkbox"] { width: auto; }

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

textarea { min-height: 110px; resize: vertical; }

.check-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.check-option.compact {
    min-height: 0;
    white-space: nowrap;
}

.check-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
}

.select-search { margin-bottom: 6px; }

.account-combobox {
    position: relative;
    width: 100%;
    min-width: 0;
}

.account-combobox-native {
    display: none !important;
}

.account-combobox-input {
    width: 100%;
    min-width: 0;
}

.account-combobox-list {
    position: absolute;
    z-index: 120;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 260px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 16px 34px rgba(15, 35, 54, 0.16);
}

.account-combobox-option,
.account-combobox-empty {
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.35;
}

.account-combobox-option {
    cursor: pointer;
    color: var(--ink);
}

.account-combobox-option:hover,
.account-combobox-option.active {
    background: var(--brand-subtle);
    color: var(--brand-strong);
}

.account-combobox-empty {
    color: var(--muted);
}

form ul {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

form li label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 8px 12px;
    background: #fff;
    cursor: pointer;
    font-size: 13.5px;
    transition: border-color var(--t), background var(--t);
}

form li label:hover {
    border-color: var(--brand);
    background: var(--brand-subtle);
}

/* Error text */
.errorlist {
    list-style: none;
    padding: 0;
    margin: 4px 0 0;
    color: var(--c-red);
    font-size: 12px;
}

/* ============================================================
   JOURNAL ENTRY TABLE
   ============================================================ */
.entry-grid select,
.entry-grid input { min-width: 120px; }

.entry-grid td {
    padding: 6px 8px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.entry-grid tfoot th {
    text-align: right;
    background: var(--c-teal-bg);
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 700;
}

/* ============================================================
   JOURNAL TALLY
   ============================================================ */
.journal-tally {
    margin-top: 12px;
    padding: 10px 14px;
    border: 1px solid var(--c-red-border);
    border-radius: var(--r-sm);
    background: var(--c-red-bg);
    color: var(--c-red);
    font-size: 13px;
    font-weight: 500;
}

.journal-tally.balanced {
    background: var(--c-green-bg);
    color: var(--c-green);
    border-color: var(--c-green-border);
}

/* ============================================================
   MESSAGES
   ============================================================ */
.messages {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.message {
    padding: 11px 16px;
    border-radius: var(--r-sm);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--line);
    background: #fff;
}

.message.success { background:var(--c-green-bg); border-color:var(--c-green-border); color:#065f46; }
.message.error   { background:var(--c-red-bg);   border-color:var(--c-red-border);   color:#991b1b; }
.message.warning { background:var(--c-amber-bg); border-color:var(--c-amber-border); color:#92400e; }
.message.info    { background:var(--c-blue-bg);  border-color:var(--c-blue-border);  color:#1e40af; }

/* ============================================================
   INVOICE SUMMARY
   ============================================================ */
.summary-list {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px 16px;
    padding: 22px;
    margin: 0;
}

.summary-list dt {
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .02em;
    padding-top: 1px;
}

.summary-list dd {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0c1f2e 0%, #0d3545 55%, #0f6060 100%);
    padding: 20px;
}

.login-panel {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 38px 34px;
    width: min(420px, 100%);
    animation: fadeUp .45s ease;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 30px;
}

.brand-logo--login {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    height: 86px;
    width: 86px;
}

.login-tagline {
    display: block;
    color: var(--muted);
    font-size: 12.5px;
    margin-top: 2px;
}

.login-heading {
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 4px;
}

.login-system-owner {
    align-items: center;
    border-top: 1px solid var(--line);
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 11.5px;
    font-weight: 600;
    gap: 7px;
    justify-content: center;
    line-height: 1.3;
    margin-top: 24px;
    padding-top: 16px;
    text-align: center;
}

.login-system-owner img {
    display: block;
    height: 18px;
    max-width: 90px;
    object-fit: contain;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ============================================================
   FORM GRID SYSTEM
   ============================================================ */
.fgrid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px 16px;
    align-items: start;
}

/* Column span helpers (within a 4-col grid) */
.fg-1 { grid-column: span 1; }
.fg-2 { grid-column: span 2; }
.fg-3 { grid-column: span 3; }
.fg-4 { grid-column: span 4; }

/* Individual field wrapper: stacks label → input → errors */
.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

/* Field label — compact uppercase style */
.field > label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Full-width section separator inside .fgrid */
.fgrid-section {
    grid-column: 1 / -1;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--subtle);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
    margin-top: 8px;
}

.cash-entry-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 22px;
    align-items: start;
}

.cash-change-layout {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.cash-change-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 16px;
}

.cash-change-summary {
    margin: 18px 0 0;
}

.denomination-panel {
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: #f8fafc;
    overflow: hidden;
}

.denomination-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.denomination-panel-head h3 {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.denomination-panel-head strong,
.cash-modal-summary strong {
    font-variant-numeric: tabular-nums;
}

.denomination-table {
    width: 100%;
    background: var(--surface);
}

.denomination-table th,
.denomination-table td {
    padding: 8px 10px;
}

.denomination-table input {
    min-width: 0;
    width: 74px;
    padding: 6px 8px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.cash-modal[hidden] {
    display: none;
}

.cash-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.cash-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .46);
}

.cash-modal-panel {
    position: relative;
    width: min(420px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    padding: 18px;
}

.cash-modal-panel.allocation-modal-panel {
    width: min(760px, 100%);
}

.cash-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.cash-modal-head h2 {
    font-size: 16px;
}

.modal-subtitle {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12.5px;
}

.invoice-email-field {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.invoice-email-field span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.invoice-email-error {
    margin-top: 8px;
    color: var(--c-red);
    font-size: 12.5px;
}

.invoice-email-actions {
    margin-top: 16px;
}

.cash-modal-panel .denomination-panel {
    margin-top: 14px;
}

.cash-modal-summary {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: center;
    margin-top: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: #f8fafc;
}

.cash-modal-summary span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.cash-modal-summary strong {
    text-align: right;
}

.cash-modal-summary strong.balanced {
    color: var(--c-green);
}

.cash-modal-summary strong.unbalanced {
    color: var(--c-red);
}

.allocation-table {
    margin-top: 14px;
}

.allocation-table input[type="number"] {
    width: 92px;
    min-width: 0;
    text-align: right;
}

.allocation-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
}

body.modal-open {
    overflow: hidden;
}

.mini-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.mini-stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
}

.mini-stat span {
    display: block;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.mini-stat strong {
    display: block;
    margin-top: 4px;
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Compact textarea for notes/description */
.field-notes textarea,
textarea.compact { min-height: 52px; }

/* ── Property / option pill buttons ──────────────────────── */
/* Used by manually-iterated RadioSelect fields               */
.prop-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.prop-pill {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    padding: 7px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    background: var(--surface);
    cursor: pointer;
    user-select: none;
    transition: border-color var(--t), background var(--t),
                color var(--t), box-shadow var(--t);
}

/* Hide the native radio circle */
.prop-pill input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* Hover */
.prop-pill:hover {
    border-color: var(--brand);
    background: var(--brand-subtle);
    color: var(--brand-dark);
}

/* Selected — :has() is baseline-2023 in all modern browsers */
.prop-pill:has(input[type="radio"]:checked) {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(13,148,136,.28);
}

/* Date filter inputs should fit the date value instead of stretching like search fields */
input[type="date"] { min-width: 0; }

.list-filter-grid input[type="date"],
.report-filter-grid input[type="date"],
.dashboard-filter input[type="date"] {
    width: 150px;
    max-width: 100%;
}

.expense-lines-card {
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 12px;
    background: #fff;
    overflow: hidden;
}

.expense-bill-panel {
    max-width: min(1120px, 100%);
}

.expense-lines-card .table-scroll {
    max-height: none;
    overflow-x: visible;
}

.expense-lines-card .table-scroll > table {
    min-width: 0;
}

.expense-lines-table {
    table-layout: fixed;
    width: 100%;
}

.expense-line-account-col { width: 42%; }
.expense-line-description-col { width: 32%; }
.expense-line-amount-col { width: 18%; }
.expense-line-action-col { width: 8%; }

.expense-lines-table th,
.expense-lines-table td {
    padding-left: 8px;
    padding-right: 8px;
}

.expense-lines-head {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.expense-lines-head label {
    margin: 0;
}

.expense-lines-table th,
.expense-lines-table td {
    vertical-align: top;
}

.expense-lines-table .select-search {
    margin-bottom: 6px;
}

.expense-lines-table input,
.expense-lines-table select {
    min-width: 0;
    width: 100%;
}

.expense-lines-table td.num input[type="number"] {
    max-width: none;
}

.expense-line-account-cell {
    min-width: 0;
}

.public-booking-page {
    background: #eef4f6;
    min-height: 100vh;
}

.public-booking-shell {
    margin: 0 auto;
    max-width: 980px;
    padding: 34px 18px 48px;
}

.public-booking-hero {
    align-items: flex-end;
    background: linear-gradient(135deg, #0f766e, #0c4a6e);
    border-radius: 8px;
    color: #fff;
    display: flex;
    min-height: 190px;
    padding: 30px;
    margin-bottom: 18px;
}

.public-booking-logo {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    display: block;
    height: 132px;
    margin-bottom: 18px;
    object-fit: contain;
    width: 132px;
}

.public-booking-logo--success {
    height: 132px;
    margin-bottom: 18px;
    width: 132px;
}

.public-booking-hero span,
.public-booking-success > span {
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.public-booking-hero h1,
.public-booking-success h1 {
    font-size: 34px;
    letter-spacing: 0;
    line-height: 1.1;
    margin: 0 0 8px;
}

.public-booking-hero p,
.public-booking-success p {
    margin: 0;
    max-width: 620px;
}

.public-booking-card {
    margin: 0 auto;
}

.public-booking-success {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.public-booking-summary {
    margin: 22px 0;
}

.public-booking-note {
    color: var(--muted);
    margin-bottom: 18px !important;
}

.public-estimate-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    padding: 14px;
}

.public-estimate-empty,
.public-estimate-loading,
.public-estimate-message {
    color: var(--muted);
    font-size: 13px;
    margin: 0;
}

.public-estimate-message {
    margin-top: 10px;
}

.public-estimate-message.is-error {
    color: var(--c-red);
}

.public-estimate-result {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 10px;
}

.public-estimate-result div {
    border-right: 1px solid var(--line);
    padding-right: 10px;
}

.public-estimate-result div:last-child,
.public-estimate-result div[hidden] + div {
    border-right: 0;
}

.public-estimate-result span {
    color: var(--muted);
    display: block;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.public-estimate-result strong {
    display: block;
    font-size: 16px;
    font-variant-numeric: tabular-nums;
    margin-top: 4px;
}

.public-estimate-total strong {
    color: var(--brand-dark);
    font-size: 18px;
}

@media (max-width: 760px) {
    .public-estimate-result {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    .public-estimate-result div {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding-bottom: 8px;
    }
}

/* ============================================================
   CHAT WIDGET
   ============================================================ */
.chat-widget {
    bottom: 22px;
    position: fixed;
    right: 24px;
    z-index: 180;
}

.chat-launcher {
    align-items: center;
    background: var(--brand);
    border: 1px solid var(--brand-dark);
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    color: #fff;
    display: inline-flex;
    height: 52px;
    justify-content: center;
    padding: 0;
    position: relative;
    touch-action: none;
    user-select: none;
    width: 52px;
}

.chat-launcher:hover {
    background: var(--brand-dark);
    color: #fff;
}

.chat-launcher,
.ai-assistant-launcher {
    cursor: grab;
}

.chat-launcher.is-dragging,
.ai-assistant-launcher.is-dragging {
    cursor: grabbing;
}

.chat-launcher.hidden-when-open {
    display: none;
}

.chat-unread-badge {
    align-items: center;
    background: #ef4444;
    border: 2px solid #fff;
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: 10px;
    font-weight: 800;
    justify-content: center;
    line-height: 1;
    min-height: 20px;
    min-width: 20px;
    padding: 3px 5px;
    position: absolute;
    right: -2px;
    top: -4px;
}

.chat-unread-badge[hidden],
.chat-panel[hidden],
.chat-error[hidden] {
    display: none !important;
}

.chat-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    display: grid;
    grid-template-rows: auto auto minmax(220px, 1fr) auto;
    max-height: min(660px, calc(100vh - 44px));
    overflow: hidden;
    width: 390px;
}

.chat-panel-head {
    align-items: center;
    background: linear-gradient(180deg, #fafcfc 0%, var(--surface) 100%);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 14px 16px;
}

.chat-panel-head h2 {
    font-size: 15px;
    font-weight: 700;
}

.chat-panel-head p {
    color: var(--muted);
    font-size: 11.5px;
    margin: 2px 0 0;
}

.chat-head-actions {
    display: flex;
    gap: 6px;
}

.chat-error {
    background: var(--c-red-bg);
    border-bottom: 1px solid var(--c-red-border);
    color: #991b1b;
    font-size: 12px;
    font-weight: 600;
    padding: 9px 14px;
}

.chat-messages {
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 220px;
    overflow: auto;
    padding: 14px;
}

.chat-empty {
    align-items: center;
    color: var(--muted);
    display: flex;
    font-size: 12.5px;
    justify-content: center;
    min-height: 120px;
    text-align: center;
}

.chat-message {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-xs);
    max-width: 92%;
    padding: 10px 12px;
}

.chat-message.own {
    align-self: flex-end;
    background: var(--brand-subtle);
    border-color: var(--c-teal-border);
}

.chat-message-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-bottom: 5px;
}

.chat-message-meta strong {
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
}

.chat-message-meta span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.chat-message-body {
    color: var(--ink);
    font-size: 13px;
    line-height: 1.45;
    margin: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.chat-message-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

.link-button {
    background: transparent;
    border: 0;
    box-shadow: none;
    color: var(--brand-dark);
    font-size: 11.5px;
    font-weight: 700;
    padding: 0;
}

.link-button:hover {
    background: transparent;
    border: 0;
    box-shadow: none;
    color: var(--brand);
}

.link-button.danger {
    color: var(--c-red);
}

.chat-compose {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 10px;
    padding: 12px 14px 14px;
}

.chat-compose label {
    display: grid;
    gap: 5px;
}

.chat-compose label span {
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.chat-compose textarea {
    min-height: 74px;
}

.chat-compose-actions {
    display: flex;
    justify-content: flex-end;
}

/* ============================================================
   AI ASSISTANT WIDGET
   ============================================================ */
.ai-assistant-widget {
    bottom: 22px;
    position: fixed;
    right: 92px;
    z-index: 181;
}

.ai-assistant-launcher {
    align-items: center;
    background: #1d4ed8;
    border: 1px solid #1e40af;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    color: #fff;
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    height: 52px;
    justify-content: center;
    letter-spacing: .04em;
    padding: 0;
    position: relative;
    touch-action: none;
    user-select: none;
    width: 52px;
}

.ai-assistant-launcher:hover {
    background: #1e40af;
    color: #fff;
}

.ai-assistant-launcher.hidden-when-open {
    display: none;
}

.ai-assistant-panel[hidden],
.ai-assistant-error[hidden] {
    display: none !important;
}

.ai-assistant-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    display: grid;
    grid-template-rows: auto auto auto auto minmax(240px, 1fr) auto;
    max-height: min(720px, calc(100vh - 44px));
    overflow: hidden;
    width: 430px;
}

.ai-assistant-head {
    align-items: center;
    background: linear-gradient(180deg, #eff6ff 0%, var(--surface) 100%);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 14px 16px;
}

.ai-assistant-head h2 {
    font-size: 15px;
    font-weight: 800;
}

.ai-assistant-head p {
    color: var(--muted);
    font-size: 11.5px;
    margin: 2px 0 0;
}

.ai-assistant-notice {
    background: #eff6ff;
    border-bottom: 1px solid #bfdbfe;
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.45;
    padding: 10px 14px;
}

.ai-assistant-suggestions {
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 10px 14px;
}

.ai-assistant-suggestions button {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: none;
    color: var(--ink-soft);
    font-size: 11.5px;
    font-weight: 700;
    min-height: 30px;
    padding: 5px 10px;
}

.ai-assistant-suggestions button:hover {
    background: #eef6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.ai-assistant-error {
    background: var(--c-red-bg);
    border-bottom: 1px solid var(--c-red-border);
    color: #991b1b;
    font-size: 12px;
    font-weight: 600;
    padding: 9px 14px;
}

.ai-assistant-messages {
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 240px;
    overflow: auto;
    padding: 14px;
}

.ai-assistant-message {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-xs);
    max-width: 94%;
    padding: 10px 12px;
}

.ai-assistant-message.user {
    align-self: flex-end;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.ai-assistant-message.loading {
    opacity: .72;
}

.ai-assistant-message-meta {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.ai-assistant-message p {
    color: var(--ink);
    font-size: 13px;
    line-height: 1.48;
    margin: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.ai-assistant-compose {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 10px;
    padding: 12px 14px 14px;
}

.ai-assistant-compose label {
    display: grid;
    gap: 5px;
}

.ai-assistant-compose label span {
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.ai-assistant-compose textarea {
    min-height: 74px;
}

.ai-assistant-compose-actions {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.ai-assistant-mode {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

/* ============================================================
   AI ASSISTANT PAGE
   ============================================================ */
.page-breadcrumb {
    align-items: center;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 12.5px;
    font-weight: 700;
    gap: 8px;
    margin: 0 0 14px;
}

.page-breadcrumb a {
    color: var(--brand-dark);
}

.page-breadcrumb strong {
    color: var(--ink);
}

.ai-assistant-page-grid {
    align-items: start;
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1fr) 320px;
}

.ai-assistant-page-panel {
    display: grid;
    grid-template-rows: auto auto auto minmax(360px, 1fr) auto;
    min-height: calc(100vh - 220px);
}

.ai-assistant-page-head {
    align-items: flex-start;
    background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 18px;
    justify-content: space-between;
    padding: 20px 22px;
}

.ai-assistant-page-head h2 {
    color: var(--ink);
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 4px 0 6px;
}

.ai-assistant-page-head p,
.ai-assistant-guide p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
    margin: 0;
}

.eyebrow {
    color: var(--muted);
    display: inline-flex;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.status-pill {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 11.5px;
    font-weight: 800;
    justify-content: center;
    min-height: 28px;
    padding: 5px 10px;
}

.status-pill--info {
    background: var(--c-blue-bg);
    border: 1px solid var(--c-blue-border);
    color: #1d4ed8;
}

.ai-assistant-page-suggestions {
    background: #fff;
}

.ai-assistant-page-messages {
    min-height: 360px;
}

.ai-assistant-page-compose textarea {
    min-height: 104px;
}

.ai-assistant-side {
    display: grid;
    gap: 16px;
    position: sticky;
    top: 84px;
}

.ai-assistant-guide {
    margin-bottom: 0;
    padding: 18px;
}

.ai-assistant-guide ul {
    color: var(--ink-soft);
    display: grid;
    gap: 8px;
    margin: 12px 0 0;
    padding-left: 18px;
}

.ai-assistant-guide li {
    line-height: 1.45;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
    .list-filter-grid { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
    .list-filter-search { grid-column: span 2; }
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }

    .sidebar {
        position: static;
        height: auto;
        overflow: visible;
        border-bottom: 1px solid rgba(255,255,255,.08);
    }

    .brand {
        padding: 14px 16px;
        margin-bottom: 0;
    }

    nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 6px 10px 10px;
        gap: 3px;
    }

    .nav-section-label { display: none; }

    nav a {
        padding: 7px 10px;
        font-size: 12px;
        border-left: none;
        border-bottom: 2px solid transparent;
        border-radius: var(--r-sm) var(--r-sm) 0 0;
    }

    nav a:hover, nav a.active {
        border-left-color: transparent;
        border-bottom-color: var(--brand);
    }

    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-filter { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
    .dashboard-filter-actions { grid-column: 1 / -1; }
    .list-filter-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
    .list-filter-search { grid-column: 1 / -1; }
    .list-footer { align-items: flex-start; flex-direction: column; }

    .content-area { padding: 16px; }

    .topbar {
        padding: 12px 16px;
        flex-wrap: wrap;
    }

    .mini-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .cash-entry-layout { grid-template-columns: 1fr; }
    .cash-change-layout,
    .cash-change-panels { grid-template-columns: 1fr; }
    .denomination-panel { max-width: 420px; }
    .report-split-grid,
    .petty-report-grid { grid-template-columns: 1fr; }
    .ai-assistant-page-grid { grid-template-columns: 1fr; }
    .ai-assistant-side { position: static; }
    .pl-detail-panel { width: min(720px, 92vw); }
}

@media (max-width: 640px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .dashboard-filter { grid-template-columns: 1fr; }
    .list-filter-grid { grid-template-columns: 1fr; }
    .list-filter-search { grid-column: auto; }
    .list-filter-actions, .pagination { justify-content: flex-start; }
    .availability-head { display: block; }
    .availability-legend { margin-top: 10px; }

    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    .form-panel { padding: 16px; }

    .fgrid {
        grid-template-columns: repeat(2, 1fr);
    }
    .fg-1 { grid-column: span 1; }
    .fg-2, .fg-3, .fg-4 { grid-column: span 2; }
    .mini-stat-grid { grid-template-columns: 1fr; }
    .pl-detail-panel { width: 100vw; }
    .ai-assistant-page-panel {
        grid-template-rows: auto auto auto minmax(260px, 1fr) auto;
        min-height: auto;
    }
    .ai-assistant-page-head {
        display: grid;
        padding: 18px;
    }
    .ai-assistant-page-messages {
        min-height: 300px;
    }
    .chat-widget {
        bottom: 14px;
        right: 14px;
    }
    .chat-panel {
        max-height: calc(100vh - 28px);
        width: calc(100vw - 28px);
    }
    .ai-assistant-widget {
        bottom: 80px;
        left: 14px;
        right: auto;
    }
    .ai-assistant-panel {
        max-height: calc(100vh - 28px);
        width: calc(100vw - 28px);
    }
}
