/* ===== Logixo web design system (mirrors Mobile Colors.xaml) ===== */
:root {
    --lx-primary:#0284C7; --lx-primary-deep:#0369A1; --lx-primary-light:#0EA5E9; --lx-primary-soft:#E0F2FE; --lx-primary-mid:#BAE6FD;
    --lx-navy:#13305E; --lx-navy-deep:#0B1F40;
    --lx-accent:#FF5A3C; --lx-accent-deep:#E64529; --lx-accent-soft:#FFEDE8;
    --lx-highlight:#F4B942; --lx-highlight-soft:#FDF4DF;
    --lx-success:#059669; --lx-success-soft:#D1FAE5; --lx-warning:#D97706; --lx-warning-soft:#FEF3C7;
    --lx-danger:#DC2626; --lx-danger-soft:#FEE2E2; --lx-info:#3B82F6; --lx-info-soft:#DBEAFE;
    --lx-page-bg:#F2F7FF; --lx-surface:#FFFFFF; --lx-surface-sunken:#F7FAFE;
    --lx-border:#E3EAF4; --lx-border-strong:#D3DCE8;
    --lx-text:#111827; --lx-text-2:#374151; --lx-text-muted:#6B7280; --lx-text-faint:#9CA3AF;
    --lx-radius-sm:8px; --lx-radius:12px; --lx-radius-lg:16px;
    --lx-shadow-xs:0 1px 2px rgba(16,24,40,.05);
    --lx-shadow-sm:0 1px 3px rgba(16,24,40,.07),0 1px 2px rgba(16,24,40,.04);
    --lx-shadow-md:0 8px 20px -6px rgba(16,24,40,.12),0 3px 6px -3px rgba(16,24,40,.06);
    --lx-shadow-lg:0 24px 48px -12px rgba(16,24,40,.22);
    --lx-hero:linear-gradient(135deg,#13305E 0%,#0369A1 60%,#0284C7 100%);
    --lx-accent-gradient:linear-gradient(90deg,#FF5A3C 0%,#F4B942 100%);
    --lx-gutter:12px; --lx-ease:cubic-bezier(.2,.8,.2,1);
}
@media (min-width:600px){ :root{ --lx-gutter:20px; } }
@media (min-width:1280px){ :root{ --lx-gutter:28px; } }

html, body { background:var(--lx-page-bg); -webkit-text-size-adjust:100%; }
body { -webkit-font-smoothing:antialiased; }
* { -webkit-tap-highlight-color:transparent; }
.lx-num, .mud-table-cell { font-variant-numeric:tabular-nums; }

/* Blazor error UI (kept) */
#blazor-error-ui { background:#FEF3C7; bottom:0; box-shadow:0 -1px 5px rgba(0,0,0,.2); display:none; left:0;
    padding:.6rem 1.25rem .7rem 1.25rem; position:fixed; width:100%; z-index:1000; }
#blazor-error-ui .dismiss { cursor:pointer; position:absolute; right:.75rem; top:.5rem; }

/* ---------- Layout shell ---------- */
.lx-layout { min-height:100vh; min-height:100dvh; }
.lx-main { background:var(--lx-page-bg); }
.lx-content { padding-top:16px; padding-bottom:32px;
    padding-left:var(--lx-gutter) !important; padding-right:var(--lx-gutter) !important; }
@media (max-width:600px){ .lx-content{ padding-top:12px; padding-bottom:24px; } }

/* App bar */
.mud-appbar.lx-appbar { background:rgba(255,255,255,.9) !important; color:var(--lx-text) !important;
    backdrop-filter:saturate(180%) blur(10px); -webkit-backdrop-filter:saturate(180%) blur(10px);
    border-bottom:1px solid var(--lx-border); box-shadow:none !important; }
.lx-appbar::after { content:""; position:absolute; left:0; right:0; bottom:-1px; height:2px; background:var(--lx-accent-gradient); }
.lx-appbar-logo { height:40px !important; width:auto; margin:0 10px 0 4px; }
.lx-appbar-brand { display:flex; align-items:center; gap:8px; min-width:0; }
.lx-appbar-title { font-weight:800 !important; letter-spacing:-.02em; color:var(--lx-navy) !important; white-space:nowrap; }
.lx-appbar-subtitle { white-space:nowrap; padding:2px 10px; border-radius:999px; background:var(--lx-primary-soft);
    color:var(--lx-primary-deep) !important; font-weight:600 !important; }
@media (max-width:600px){
    .lx-appbar .mud-toolbar-gutters{ padding-left:8px; padding-right:8px; }
    .lx-appbar-logo{ height:32px !important; margin:0 6px 0 0; }
}

/* Drawer + nav */
.sidebar-drawer { height:100vh; }
.mud-drawer.lx-drawer { background:var(--lx-surface) !important; border-right:1px solid var(--lx-border) !important; }
.mud-drawer.lx-drawer.mud-drawer-responsive.mud-drawer--open { box-shadow:var(--lx-shadow-lg); }
.lx-drawer .mud-drawer-content { padding:8px 0 24px; scrollbar-width:thin; }
.lx-nav-section, .lx-drawer .mud-navmenu > .mud-typography-caption {
    display:block; padding:14px 20px 6px !important; color:var(--lx-text-faint) !important; text-transform:uppercase;
    letter-spacing:.08em; font-size:.66rem !important; font-weight:700 !important; }
.lx-nav-title { font-weight:600; }
.lx-nav-sub { display:block; font-size:.7rem; color:var(--lx-text-faint); line-height:1.2; }
.lx-drawer .mud-nav-link { border-radius:10px; margin:2px 10px; width:auto; min-height:44px; padding:8px 12px;
    color:var(--lx-text-2) !important; position:relative; transition:background .15s var(--lx-ease), color .15s; }
.lx-drawer .mud-nav-link .mud-nav-link-icon { color:var(--lx-text-muted); }
.lx-drawer .mud-nav-link:hover { background:var(--lx-surface-sunken) !important; color:var(--lx-primary-deep) !important; }
.lx-drawer .mud-nav-link.active { background:var(--lx-primary-soft) !important; color:var(--lx-primary-deep) !important; font-weight:600; }
.lx-drawer .mud-nav-link.active .mud-nav-link-icon { color:var(--lx-primary) !important; }
.lx-drawer .mud-nav-link.active::before { content:""; position:absolute; left:-10px; top:8px; bottom:8px; width:3px;
    border-radius:0 3px 3px 0; background:var(--lx-primary); }
.lx-drawer .mud-nav-group .mud-collapse-container .mud-nav-link { min-height:40px; }
.lx-drawer .mud-divider { margin:8px 16px !important; border-color:var(--lx-border); }

/* ---------- Page header pattern ---------- */
.lx-page-header { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px 16px; margin-bottom:20px; }
.lx-page-header__title { display:flex; align-items:center; gap:14px; min-width:0; flex:1 1 260px; }
.lx-page-header__title > .mud-icon-root { margin-right:0 !important; flex-shrink:0; width:44px; height:44px; padding:10px;
    border-radius:12px; background:var(--lx-primary-soft); }
.lx-page-header__actions { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
@media (max-width:600px){
    .lx-page-header{ margin-bottom:14px; }
    .lx-page-header__title > .mud-icon-root{ width:38px; height:38px; padding:8px; }
    .lx-page-header__actions{ width:100%; }
    .lx-page-header__actions > .mud-button-root{ flex:1 1 calc(50% - 4px); }
}
/* Fallback for every page, even untouched ones */
.mud-typography-h4 { font-size:clamp(1.3rem, 1rem + 1.2vw, 1.75rem); }
.mud-typography-h5 { font-size:clamp(1.15rem, 1rem + .6vw, 1.375rem); }

/* ---------- Cards / surfaces ---------- */
.mud-card { border:1px solid var(--lx-border); border-radius:var(--lx-radius) !important; box-shadow:var(--lx-shadow-xs) !important; }
.mud-paper.mud-elevation-1 { box-shadow:var(--lx-shadow-sm); }
.mud-paper.mud-elevation-2 { box-shadow:var(--lx-shadow-md); }
.mud-table.mud-elevation-25 { box-shadow:none !important; }
.lx-card { background:var(--lx-surface); border:1px solid var(--lx-border); border-radius:var(--lx-radius); box-shadow:var(--lx-shadow-xs); }
.lx-section-title { font-weight:700 !important; font-size:1rem; color:var(--lx-text); letter-spacing:-.01em; }
.lx-section-sub { font-size:.8rem; color:var(--lx-text-faint); }
.lx-filter-card { border:1px solid var(--lx-border) !important; border-radius:var(--lx-radius) !important; background:var(--lx-surface); }
.lx-filter-card > .mud-card-content { padding:16px 16px 12px; }
.lx-filter-title { font-weight:700 !important; font-size:.75rem !important; text-transform:uppercase; letter-spacing:.06em; color:var(--lx-text-muted) !important; }
@media (max-width:600px){ .lx-filter-card > .mud-card-content{ padding:12px; } }

/* KPI */
.kpi-card { border:1px solid var(--lx-border); border-radius:var(--lx-radius) !important; position:relative; overflow:hidden;
    transition:transform .2s var(--lx-ease), box-shadow .2s var(--lx-ease); }
.kpi-card:hover { transform:translateY(-2px); box-shadow:var(--lx-shadow-md) !important; }
.kpi-icon { width:44px; height:44px; border-radius:12px; display:flex; align-items:center; justify-content:center; }
.lx-kpi-grid { display:grid; gap:12px; grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)); }
@media (max-width:600px){ .lx-kpi-grid{ grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px; } }
@media (hover:none){ .kpi-card:hover{ transform:none; } }

/* ---------- Buttons / chips / inputs ---------- */
.mud-button-root.mud-button { border-radius:10px; text-transform:none; font-weight:600; letter-spacing:.01em; }
.mud-button-filled.mud-button-filled-primary { box-shadow:0 1px 2px rgba(2,132,199,.25), 0 4px 10px -4px rgba(2,132,199,.45); }
.mud-button-filled.mud-button-filled-tertiary { box-shadow:0 1px 2px rgba(255,90,60,.25), 0 4px 10px -4px rgba(255,90,60,.5); }
.mud-chip { border-radius:999px; font-weight:600; font-size:.75rem; }
.mud-input.mud-input-outlined { background:var(--lx-surface); }
@media (pointer:coarse){
    .mud-icon-button { min-width:40px; min-height:40px; }
    .mud-button-root.mud-button { min-height:40px; }
    .mud-input input, .mud-input textarea { font-size:16px !important; } /* stops iOS zoom-on-focus */
}

/* ---------- Tables (MudTable / MudDataGrid / MudSimpleTable) ---------- */
.mud-table { border:1px solid var(--lx-border); border-radius:var(--lx-radius); overflow:hidden; }
.mud-card .mud-table, .mud-dialog .mud-table, .mud-paper .mud-table { border-color:transparent; border-radius:0; }
.mud-table-container { overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:thin; }
.mud-table-head .mud-table-cell { background:var(--lx-surface-sunken); color:var(--lx-text-muted); font-size:.72rem;
    font-weight:700; text-transform:uppercase; letter-spacing:.05em; white-space:nowrap; border-bottom:1px solid var(--lx-border); }
.mud-table-toolbar.mud-toolbar { height:auto; min-height:var(--mud-internal-toolbar-height); flex-wrap:wrap; row-gap:8px;
    padding-top:8px; padding-bottom:8px; }
.mud-table-pagination-toolbar { flex-wrap:wrap; height:auto !important; row-gap:4px; }
@media (max-width:600px){
    .mud-xs-table .mud-table-body .mud-table-row { display:block; margin:10px 8px; border:1px solid var(--lx-border);
        border-radius:var(--lx-radius); background:var(--lx-surface) !important; box-shadow:var(--lx-shadow-xs); overflow:hidden; }
    .mud-xs-table .mud-table-body .mud-table-row .mud-table-cell { border-bottom:1px dashed var(--lx-border) !important; gap:12px; }
    .mud-xs-table .mud-table-body .mud-table-row .mud-table-cell:last-child { border-bottom:0 !important; }
    .mud-xs-table .mud-table-cell:before { color:var(--lx-text-muted); font-size:.72rem; font-weight:600; text-transform:uppercase;
        letter-spacing:.04em; flex-shrink:0; }
    .mud-table-pagination-toolbar .mud-table-pagination-caption { display:none; }
}
/* Wrapper for wide raw <table> reports: gives sticky headers a vertical scroll context */
.lx-table-scroll { overflow:auto; -webkit-overflow-scrolling:touch; border:1px solid var(--lx-border); border-radius:var(--lx-radius);
    background:var(--lx-surface); max-height:calc(100vh - 220px); max-height:calc(100dvh - 220px); }
.lx-table-scroll thead th { position:sticky; top:0; z-index:2; }
@media (max-width:600px){ .lx-table-scroll{ max-height:calc(100dvh - 140px); } }

/* ---------- Dialogs ---------- */
.mud-dialog { border-radius:var(--lx-radius-lg) !important; box-shadow:var(--lx-shadow-lg) !important; }
.mud-dialog .mud-dialog-title { border-bottom:1px solid var(--lx-border); }
.mud-dialog .mud-dialog-title .mud-typography-h6 { font-weight:700; }
.mud-dialog .mud-dialog-actions { border-top:1px solid var(--lx-border); padding:10px 16px; flex-wrap:wrap; background:var(--lx-surface); }
@media (max-width:600px){
    .mud-dialog-container { padding:0 !important; }
    /* Medium+ dialogs become full-screen sheets on phones (DialogOptions in @code stay untouched) */
    .mud-dialog.mud-dialog-width-md, .mud-dialog.mud-dialog-width-lg, .mud-dialog.mud-dialog-width-xl, .mud-dialog.mud-dialog-width-xxl {
        width:100% !important; max-width:100% !important; margin:0 !important; height:100vh; height:100dvh;
        max-height:100dvh !important; border-radius:0 !important; }
    /* Small dialogs: near full width, still floating */
    .mud-dialog.mud-dialog-width-sm, .mud-dialog.mud-dialog-width-xs, .mud-dialog.mud-dialog-width-false {
        width:calc(100% - 24px) !important; max-width:calc(100% - 24px) !important; margin:12px !important;
        max-height:calc(100dvh - 24px) !important; }
    .mud-dialog .mud-dialog-title { padding:12px 16px; }
    .mud-dialog .mud-dialog-content { padding:8px 14px; }
    .mud-dialog .mud-dialog-actions { position:sticky; bottom:0; z-index:3; padding:8px 12px calc(8px + env(safe-area-inset-bottom)); }
    .mud-dialog .mud-dialog-actions > .mud-button-root { flex:1 1 auto; }
}

/* ---------- Tabs ---------- */
.mud-tabs-tabbar { border-bottom:1px solid var(--lx-border); }
.mud-tab { text-transform:none !important; font-weight:600; }

/* ---------- Legacy status helpers (kept) ---------- */
.status-paid { background:var(--lx-success-soft) !important; color:#065F46 !important; }
.status-pending { background:var(--lx-warning-soft) !important; color:#92400E !important; }
.status-cancelled { background:var(--lx-danger-soft) !important; color:#991B1B !important; }

/* ---------- Motion ---------- */
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
.page-content { animation:fadeIn .25s var(--lx-ease); }
@media (prefers-reduced-motion:reduce){ *, *::before, *::after { animation:none !important; transition:none !important; } }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width:8px; height:8px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:#CBD5E1; border-radius:8px; }
::-webkit-scrollbar-thumb:hover { background:#94A3B8; }

/* ---------- Auth (login) ---------- */
.lx-auth-bg { min-height:100vh; min-height:100dvh; background:var(--lx-hero); position:relative; overflow:hidden; }
.lx-auth-bg::before, .lx-auth-bg::after { content:""; position:absolute; border-radius:50%; filter:blur(60px); pointer-events:none; }
.lx-auth-bg::before { width:420px; height:420px; background:#0EA5E9; opacity:.35; top:-120px; right:-120px; }
.lx-auth-bg::after { width:360px; height:360px; background:#FF5A3C; opacity:.22; bottom:-140px; left:-120px; }
.lx-auth-card { position:relative; z-index:1; border-radius:20px !important; overflow:hidden;
    box-shadow:0 30px 60px -20px rgba(11,31,64,.55) !important; }
.lx-auth-card::before { content:""; position:absolute; inset:0 0 auto 0; height:4px; background:var(--lx-accent-gradient); }
.lx-auth-logo { width:96px !important; height:96px !important; object-fit:contain; }
@media (min-width:600px){ .lx-auth-logo{ width:112px !important; height:112px !important; } }

/* ---------- Print (reports / payslip) ---------- */
@media print {
    .mud-appbar, .mud-drawer, .mud-overlay, .lx-page-header__actions, .lx-filter-card { display:none !important; }
    .mud-main-content { padding:0 !important; margin:0 !important; }
    .lx-table-scroll { max-height:none; overflow:visible; border:0; }
    body, .lx-main { background:#fff !important; }
}
