:root {
    --brand: #711739;
    --brand-dark: #58122d;
    --brand-light: #8a1c47;
    --brand-50: #fbeef3;
    --accent: #e0a64e;
    --accent-soft: #fbf3e4;

    --bg: #f4f5f9;
    --surface: #ffffff;
    --ink: #1f2330;
    --muted: #7a8095;
    --line: #eceef3;

    --sidebar-w: 264px;
    --topbar-h: 68px;

    --radius: 16px;
    --radius-sm: 12px;
    --shadow-sm: 0 1px 2px rgba(20, 22, 30, 0.04), 0 2px 8px rgba(20, 22, 30, 0.05);
    --shadow-md: 0 8px 24px rgba(20, 22, 30, 0.08);
    --shadow-brand: 0 10px 26px rgba(113, 23, 57, 0.28);
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }

html { overflow-x: clip; }

body.app-body {
    font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    margin: 0;
}

/* ============ Layout shell ============ */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.app-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--sidebar-w);
    background: linear-gradient(185deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    box-shadow: var(--shadow-md);
    transition: transform 0.25s ease;
    height: 100vh;
    height: 100dvh;
}

.app-main {
    flex: 1;
    min-width: 0;
    margin-inline-start: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    transition: margin-inline-start 0.25s ease;
}

/* ============ Sidebar ============ */
.sidebar-header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-brand {
    height: var(--topbar-h);
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding-inline: 1.4rem;
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.5px;
}
.sidebar-brand .brand-mark {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    font-size: 1.1rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.sidebar-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.45);
    padding: 0.9rem 0.85rem 0.35rem;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: background 0.15s ease, color 0.15s ease;
    position: relative;
}
.sidebar-link i { width: 1.3rem; text-align: center; font-size: 1rem; opacity: 0.9; }
.sidebar-link:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.sidebar-link.active {
    background: #fff;
    color: var(--brand-dark);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}
.sidebar-link.active i { opacity: 1; color: var(--brand); }

.sidebar-footer {
    padding: 1rem 1.1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
}
.sidebar-close { display: none; }

/* ============ Topbar ============ */
.app-topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-inline: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.topbar-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.topbar-spacer { flex: 1; }

.icon-btn {
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--bg); border-color: #dfe2ec; color: var(--brand); }

.topbar-user {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.3rem 0.4rem;
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
}
.topbar-user:hover { background: var(--bg); }
.user-avatar {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    color: #fff; font-weight: 700;
}
.user-meta { line-height: 1.15; }
.user-meta .u-name { font-weight: 600; font-size: 0.9rem; }
.user-meta .u-role { font-size: 0.74rem; color: var(--muted); }

.sidebar-toggle { display: none; }
.sidebar-toggle-desktop { display: grid; }
.icon-btn.sidebar-close { display: none; }

/* ============ Content ============ */
.app-content { padding: 1.75rem; flex: 1; min-width: 0; }
.app-content:focus { outline: none; }
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.5rem; font-weight: 800; margin: 0; }
.page-head .page-sub { color: var(--muted); font-size: 0.92rem; }

/* ============ Stat cards ============ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.1rem;
    margin-bottom: 1.75rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.stat-card .s-value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.stat-card .s-label { color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }
.stat-icon {
    width: 54px; height: 54px;
    border-radius: 14px;
    display: grid; place-items: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.si-brand { background: var(--brand-50); color: var(--brand); }
.si-warning { background: #fff4e2; color: #d98a14; }
.si-danger { background: #fdeaea; color: #d64545; }
.si-info { background: #e8f1fd; color: #2f6fdb; }
.si-success { background: #e7f6ee; color: #2a9d63; }
.si-accent { background: var(--accent-soft); color: var(--accent); }

/* ============ Card / table ============ */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.panel-head {
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
    display: flex; align-items: center; gap: 0.5rem;
}
.panel-head i { color: var(--brand); }

.table {
    margin: 0;
    --bs-table-hover-bg: var(--brand-50);
}
.table thead th {
    background: #faf7f9;
    color: var(--brand-dark);
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: none;
    border-bottom: 1px solid var(--line);
    padding: 0.85rem 1.1rem;
    white-space: nowrap;
}
.table tbody td {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    font-size: 0.9rem;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table-responsive {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-color: #c9cdd8 transparent;
    scrollbar-width: thin;
}
.table-responsive > .table { width: max-content; min-width: 100%; }
.table-responsive .table td { max-width: 22rem; overflow-wrap: anywhere; }

/* Compact table: tighter padding/font so wide listings fit without h-scroll */
.table-compact thead th { padding: 0.6rem 0.55rem; font-size: 0.78rem; }
.table-compact tbody td { padding: 0.6rem 0.55rem; font-size: 0.83rem; }
.table-compact .pill { padding: 0.2rem 0.5rem; font-size: 0.72rem; }

.pill {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
}
.pill-success { background: #e7f6ee; color: #1f8a52; }
.pill-warning { background: #fff4e2; color: #c47e0f; }
.pill-muted { background: #eef0f5; color: #6b7180; }
.pill-info { background: #e8f1fd; color: #2f6fdb; }
.pill-danger { background: #fdeaea; color: #d64545; }

/* Finance form: client mini-stats + type buttons */
.mini-stat { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem 0.7rem; text-align: center; }
.mini-stat .ms-label { font-size: 0.72rem; color: var(--muted); }
.mini-stat .ms-val { font-size: 1.05rem; font-weight: 700; }
.type-buttons .btn { min-width: 110px; }

/* ===== Transaction view: hero amount + clean spec list ===== */
.tx-hero { text-align: center; padding: 1.1rem 1rem 1.3rem; }
.tx-hero .amt { font-size: 2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ink); }
.tx-hero .amt .cur { font-size: 0.95rem; font-weight: 600; color: var(--muted); margin-inline-start: 0.3rem; }
.tx-hero .sub { color: var(--muted); font-size: 0.9rem; margin-top: 0.45rem; }
.tx-hero .sub .num { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

.spec { margin: 0; padding: 0 1rem 0.4rem; }
.spec > div { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.spec > div:first-child { border-top: 0; }
.spec .k { color: var(--muted); font-size: 0.85rem; flex: 0 0 auto; }
.spec .v { font-weight: 600; text-align: end; word-break: break-word; font-variant-numeric: tabular-nums; }
.spec .v a { color: var(--brand); }
.spec-note { padding: 0.7rem 1rem 1rem; }
.spec-note .k { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.2rem; }
.spec-note .v { font-weight: 500; line-height: 1.6; }

/* Lighter ledger / cashbox tables on the view page */
.tx-table thead th { background: var(--bg); color: var(--muted); font-weight: 600; font-size: 0.82rem; border-bottom: 1px solid var(--line); }
.tx-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg) 55%, transparent); }
.tx-table td, .tx-table th { vertical-align: middle; }
.tx-table .num { font-variant-numeric: tabular-nums; }

/* Transaction-type groups (receipts / disbursements / refunds) */
.type-group { border: 1px solid var(--line); border-radius: 12px; padding: 0.55rem 0.65rem 0.65rem; }
.type-group-label { font-size: 0.7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 0.4rem; }

/* Sticky save/cancel bar on the (long) transaction form */
.form-actions-bar {
    position: sticky; bottom: 0; z-index: 5;
    padding: 0.75rem 0; margin-top: 0.5rem;
    background: linear-gradient(to top, var(--surface) 75%, transparent);
}
.form-actions-bar .btn { min-width: 150px; }

/* Expense items table → stacked cards on small screens */
@media (max-width: 575.98px) {
    #expTable, #expTable thead, #expTable tbody, #expTable tfoot, #expTable tr, #expTable td, #expTable th { display: block; }
    #expTable thead { display: none; }
    #expTable tbody tr { border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem; margin-bottom: 0.6rem; }
    #expTable tbody td { border: 0; padding: 0.25rem 0; }
    #expTable tbody td::before { content: attr(data-label); display: block; font-size: 0.72rem; color: var(--muted); margin-bottom: 0.15rem; }
    #expTable tfoot tr { display: flex; justify-content: space-between; font-weight: 700; padding: 0.4rem 0.2rem 0; }
    #expTable tfoot td.port-col:empty, #expTable tfoot td:empty { display: none; }
}

/* Finance sub-nav tabs */
.finance-tabs .nav-link { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-weight: 600; font-size: 0.9rem; }
.finance-tabs .nav-link.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ============ Operations / status page ============ */
.stage-dot { font-size: 1.4rem; color: #ccd0db; margin-bottom: 0.3rem; }
.stage-dot.done { color: #2a9d63; }

.timeline-item {
    position: relative;
    padding-inline-start: 1.4rem;
    padding-bottom: 1rem;
    border-inline-start: 2px solid var(--line);
    margin-inline-start: 0.4rem;
}
.timeline-item:last-child { border-inline-start-color: transparent; padding-bottom: 0; }
.timeline-dot {
    position: absolute;
    inset-inline-start: -7px;
    top: 2px;
    width: 12px; height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--line);
}
.timeline-dot.timeline-position { background: #2f6fdb; }
.timeline-dot.timeline-operational { background: var(--brand); }

/* ============ Buttons ============ */
.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
    font-weight: 600;
}
a { color: var(--brand); }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid rgba(224, 166, 78, 0.7);
    outline-offset: 2px;
}

.skip-link {
    position: fixed;
    inset-block-start: 0.5rem;
    inset-inline-start: 0.5rem;
    z-index: 1100;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    background: #fff;
    color: var(--brand-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-150%);
    transition: transform 0.15s ease;
}
.skip-link:focus { transform: translateY(0); }

/* ============ Login ============ */
.login-body {
    font-family: "Tajawal", system-ui, sans-serif;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background:
        radial-gradient(1200px 600px at 100% 0%, rgba(224, 166, 78, 0.22), transparent 55%),
        linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 70%);
}
.login-card {
    width: 100%; max-width: 410px;
    background: var(--surface);
    border-radius: 22px;
    padding: 2.5rem 2.2rem;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.28);
}
.login-logo {
    width: 64px; height: 64px;
    margin: 0 auto 1rem;
    display: grid; place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    color: #fff; font-size: 1.6rem;
    box-shadow: var(--shadow-brand);
}
.login-card .form-control {
    border-radius: 12px;
    padding: 0.65rem 0.9rem;
    border-color: #e4e7ef;
}
.login-card .form-control:focus {
    border-color: var(--brand-light);
    box-shadow: 0 0 0 0.2rem rgba(113, 23, 57, 0.12);
}
.login-card .input-group-text {
    background: var(--bg);
    border-color: #e4e7ef;
    color: var(--muted);
    border-radius: 12px;
}

/* ============ Responsive ============ */
.sidebar-control,
.sidebar-desktop-control {
    position: fixed;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(15, 17, 25, 0.55);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1035;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}
@media (max-width: 991.98px) {
    .app-sidebar {
        width: min(86vw, 320px);
        transform: translateX(-105%);
        transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
        will-change: transform;
    }
    html[dir="rtl"] .app-sidebar { transform: translateX(105%); }
    .app-sidebar.open,
    .sidebar-control:checked ~ .app-sidebar { transform: translateX(0); }

    .sidebar-header {
        min-height: calc(60px + env(safe-area-inset-top));
        padding-block-start: env(safe-area-inset-top);
    }
    .sidebar-brand {
        height: 60px;
        padding-inline: 1rem 0.5rem;
        font-size: 1.2rem;
    }
    .icon-btn.sidebar-close {
        display: grid;
        width: 44px;
        height: 44px;
        margin-inline-end: 0.65rem;
        border-color: rgba(255, 255, 255, 0.18);
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
        flex: 0 0 auto;
    }
    .sidebar-close:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
    .sidebar-nav {
        padding: 0.75rem;
        overscroll-behavior: contain;
    }
    .sidebar-link { min-height: 46px; padding: 0.72rem 0.8rem; }
    .sidebar-footer { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }

    .app-main { margin-inline-start: 0; }
    .sidebar-toggle { display: grid; }
    .sidebar-toggle-desktop { display: none; }
    body.sidebar-open { overflow: hidden; overscroll-behavior: none; touch-action: none; }
    body.sidebar-open .app-sidebar { touch-action: pan-y; }
    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    .sidebar-control:checked ~ .sidebar-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    .sidebar-control:checked ~ .app-main {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }

    .app-topbar {
        min-height: calc(60px + env(safe-area-inset-top));
        height: auto;
        gap: 0.5rem;
        padding-block: max(0.5rem, env(safe-area-inset-top)) 0.5rem;
        padding-inline: 0.75rem;
    }
    .topbar-title {
        min-width: 0;
        max-width: 42vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 1rem;
    }
    .icon-btn { width: 44px; height: 44px; flex: 0 0 auto; }
    .topbar-user { min-height: 44px; padding: 0.15rem; }
    .user-avatar { width: 38px; height: 38px; }
    .dropdown-menu { max-width: calc(100vw - 1rem); }

    .app-content {
        width: 100%;
        padding: 1rem 0.85rem max(1.25rem, env(safe-area-inset-bottom));
    }
    .page-head { margin-bottom: 1rem; gap: 0.75rem !important; }
    .page-head h1 { font-size: 1.3rem; line-height: 1.35; }
    .page-head .page-sub,
    .page-head .text-muted { font-size: 0.86rem; }

    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    .stat-card { padding: 1rem; gap: 0.65rem; }
    .stat-card:hover { transform: none; box-shadow: var(--shadow-sm); }
    .stat-card .s-value { font-size: 1.4rem; }
    .stat-icon { width: 46px; height: 46px; border-radius: 12px; font-size: 1.1rem; }

    .panel { border-radius: 13px; }
    .panel-head { padding: 0.9rem 1rem; flex-wrap: wrap; justify-content: space-between; }

    .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; }
    .btn-sm { min-height: 38px; }
    .form-control,
    .form-select,
    .input-group-text { min-height: 44px; }
    textarea.form-control { min-height: 96px; }

    .table-responsive { touch-action: pan-x pan-y; }
    .table thead th { padding: 0.72rem 0.8rem; }
    .table tbody td { padding: 0.72rem 0.8rem; }

    .finance-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.35rem;
        scrollbar-width: none;
    }
    .finance-tabs::-webkit-scrollbar { display: none; }
    .finance-tabs .nav-item { flex: 0 0 auto; }
    .finance-tabs .nav-link { min-height: 42px; white-space: nowrap; }

    .bulk-form { flex-wrap: wrap; width: 100%; gap: 0.5rem !important; }
    .bulk-form :is(.form-control, .form-select) { flex: 1 1 160px; width: auto; }
    .bulk-form .btn { flex: 0 0 auto; }
    .type-buttons { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .type-buttons .btn { min-width: 0; width: 100%; }

    .pagination { flex-wrap: wrap; gap: 0.2rem; }
    .modal-dialog { margin: 0.5rem; }
    .modal-content { border-radius: 14px; }
}

@media (min-width: 992px) {
    .sidebar-desktop-control:checked ~ .app-sidebar {
        transform: translateX(-105%);
    }
    html[dir="rtl"] .sidebar-desktop-control:checked ~ .app-sidebar {
        transform: translateX(105%);
    }
    .sidebar-desktop-control:checked ~ .app-main { margin-inline-start: 0; }
    .sidebar-desktop-control:checked ~ .app-main .sidebar-toggle-desktop {
        border-color: rgba(113, 23, 57, 0.25);
        background: var(--brand-50);
        color: var(--brand);
    }
}

@media (max-width: 767.98px) {
    .form-control,
    .form-select,
    .input-group-text { font-size: 16px; }

    .app-content form > .d-flex.justify-content-end { flex-wrap: wrap; }
    .app-content form > .d-flex.justify-content-end .btn { flex: 1 1 130px; }
}

@media (max-width: 575.98px) {
    .app-content { padding-inline: 0.65rem; }
    .topbar-title { max-width: 34vw; font-size: 0.95rem; }
    .topbar-user .fa-chevron-down { display: none; }

    .page-head.d-flex { align-items: stretch !important; }
    .page-head > .d-flex {
        width: 100%;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem !important;
    }
    .page-head > .d-flex > :is(.btn, form),
    .page-head > .btn { width: 100%; }
    .page-head > .d-flex > form .btn { width: 100%; }

    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
    .stat-card { min-width: 0; padding: 0.8rem; align-items: flex-start; }
    .stat-card .s-value { font-size: 1.25rem; overflow-wrap: anywhere; }
    .stat-card .s-label { font-size: 0.78rem; }
    .stat-icon { width: 40px; height: 40px; font-size: 1rem; }

    .panel-head { padding: 0.8rem; }
    .table thead th,
    .table tbody td { padding: 0.65rem 0.7rem; font-size: 0.82rem; }
    .panel > .table-responsive { border-radius: inherit; }

    .login-body { padding: 0.75rem; }
    .login-card { padding: 1.75rem 1.15rem; border-radius: 18px; }
}

@media (max-width: 359.98px) {
    .topbar-title { display: none; }
    .stat-grid { grid-template-columns: 1fr; }
}

@media (max-height: 540px) and (max-width: 991.98px) {
    .sidebar-nav { padding-block: 0.45rem; }
    .sidebar-link { min-height: 40px; padding-block: 0.5rem; }
    .sidebar-footer { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
