/* ============================================================
   PayFlo design system — dark sidebar + light content shell.
   Built on top of Bootstrap 5; class names backward-compatible
   with existing views (.pf-head, .pf-card, .pf-stat, .pf-table).
   ============================================================ */

:root {
    --pf-bg:        #f5f5f7;
    --pf-surface:   #ffffff;
    --pf-border:    #e5e7eb;
    --pf-border-2:  #f1f3f5;
    --pf-ink:       #0f172a;
    --pf-ink-2:     #374151;
    --pf-muted:     #6b7280;
    --pf-muted-2:   #9ca3af;
    --pf-green:     #22c55e;
    --pf-green-2:   #16a34a;
    --pf-green-bg:  #dcfce7;
    --pf-green-fg:  #166534;
    --pf-amber-bg:  #fef3c7;
    --pf-amber-fg:  #92400e;
    --pf-red-bg:    #fee2e2;
    --pf-red-fg:    #991b1b;
    --pf-blue-bg:   #dbeafe;
    --pf-blue-fg:   #1e40af;
    --pf-purple-bg: #f3e8ff;
    --pf-purple-fg: #6b21a8;
    --pf-gray-bg:   #e5e7eb;
    --pf-gray-fg:   #374151;
    --pf-sidebar:        #0b0f17;
    --pf-sidebar-2:      #111827;
    --pf-sidebar-text:   rgba(255,255,255,.78);
    --pf-sidebar-mute:   rgba(255,255,255,.42);
    --pf-sidebar-active: rgba(34,197,94,.14);
    --pf-shadow-sm:  0 1px 2px rgba(15,23,42,.05);
    --pf-shadow-md:  0 4px 14px rgba(15,23,42,.07);
}

html, body { height: 100%; }
body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--pf-bg) !important;
    color: var(--pf-ink);
    -webkit-font-smoothing: antialiased;
}

/* ===========================================================
   App shell: sidebar + content
   =========================================================== */

.pf-shell { display: flex; min-height: 100vh; }
.pf-content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.pf-content-inner { padding: 22px 28px 60px; flex: 1 1 auto; }

@media (max-width: 991.98px) {
    .pf-content-inner { padding: 16px 14px 80px; }
}

/* ----- Sidebar ----- */
.pf-sidebar {
    width: 248px;
    flex: 0 0 248px;
    background: var(--pf-sidebar);
    color: var(--pf-sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.pf-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px 14px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-size: 17px;
}
/* ----------------------------------------------------------
   PayFlo brand mark
   Custom SVG monogram: a stylized "PF" — P bowl on top and a
   forward-flow arrow on the bottom, sharing a vertical stem.
   Conveys "Pay + Flow". Works as a CSS background-image, so
   any element with .pf-brand-mark gets the icon and scales to
   the element's size. The literal "P" text inside (legacy
   markup) is hidden but kept for screen-reader fallback.
   ---------------------------------------------------------- */
.pf-brand-mark {
    background-color: var(--pf-green);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' fill='none'><rect x='14' y='8' width='8' height='48' rx='4' fill='%23052e16'/><path d='M 22 12 L 38 12 a 10 10 0 0 1 0 20 L 22 32' stroke='%23052e16' stroke-width='7.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/><path d='M 22 46 L 42 46 M 36 40 L 42 46 L 36 52' stroke='%23052e16' stroke-width='6' stroke-linecap='round' stroke-linejoin='round' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 70% 70%;
    color: transparent !important;
    overflow: hidden;
    user-select: none;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(34,197,94,.35);
    position: relative;
}
/* Subtle inner highlight so the mark feels three-dimensional */
.pf-brand-mark::after {
    content: '';
    position: absolute; inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 55%);
    pointer-events: none;
}

.pf-sidebar-brand .pf-brand-mark {
    width: 30px; height: 30px;
    flex: 0 0 30px;
    display: inline-flex;
    font-size: 0;
}
.pf-sidebar-brand:hover { color: #fff; }
/* Wordmark: "Pay" stays white, "Flo" turns green for the brand accent */
.pf-sidebar-brand .pf-wm { letter-spacing: -0.01em; }
.pf-sidebar-brand .pf-wm .pf-wm-flo { color: var(--pf-green); }

.pf-sidebar-section {
    padding: 18px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pf-sidebar-mute);
    font-weight: 600;
}

.pf-sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 4px 10px 16px;
}
.pf-sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    margin: 2px 0;
    color: var(--pf-sidebar-text);
    text-decoration: none;
    font-size: 14px;
    border-radius: 8px;
    border-left: 3px solid transparent;
    position: relative;
    transition: background .12s, color .12s;
}
.pf-sidebar-nav a i {
    width: 16px; text-align: center;
    color: var(--pf-sidebar-mute);
    font-size: 15px;
}
.pf-sidebar-nav a:hover {
    background: rgba(255,255,255,.04);
    color: #fff;
}
.pf-sidebar-nav a:hover i { color: rgba(255,255,255,.85); }
.pf-sidebar-nav a.active {
    background: var(--pf-sidebar-active);
    color: #fff;
    border-left-color: var(--pf-green);
    font-weight: 500;
}
.pf-sidebar-nav a.active i { color: var(--pf-green); }
.pf-sidebar-nav .pf-nav-badge {
    margin-left: auto;
    background: var(--pf-green);
    color: #052e16;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    line-height: 1.4;
}

.pf-sidebar-user {
    border-top: 1px solid rgba(255,255,255,.06);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}
.pf-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--pf-green);
    color: #052e16;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    flex: 0 0 36px;
}
.pf-sidebar-user .name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.pf-sidebar-user .sub { font-size: 11px; color: var(--pf-sidebar-mute); margin-top: 2px; }

/* ----- Topbar (above content; holds breadcrumb-area + bell + logout) ----- */
.pf-topbar {
    background: #fff;
    border-bottom: 1px solid var(--pf-border);
    padding: 10px 28px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    position: sticky;
    top: 0;
    z-index: 30;
}
.pf-topbar .pf-bcrumb {
    font-size: 12px;
    color: var(--pf-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    flex: 1 1 auto;
    min-width: 0;
}
.pf-topbar .pf-bcrumb .sep { margin: 0 6px; color: var(--pf-muted-2); }
.pf-topbar-actions { display: flex; align-items: center; gap: 6px; }
.pf-topbar-actions .btn { font-size: 13px; }
.pf-topbar .pf-icon-btn {
    background: transparent;
    border: 1px solid var(--pf-border);
    color: var(--pf-ink-2);
    width: 36px; height: 36px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    position: relative;
}
.pf-topbar .pf-icon-btn:hover { background: var(--pf-border-2); }
.pf-topbar .pf-icon-btn .pf-bell-dot {
    position: absolute; top: -3px; right: -3px;
    background: #ef4444; color: #fff; border: 2px solid #fff;
    border-radius: 999px; font-size: 10px; font-weight: 700;
    padding: 1px 5px; line-height: 1.2; min-width: 18px;
    text-align: center;
}

@media (max-width: 991.98px) {
    .pf-topbar { padding: 10px 14px; }
}

/* ===========================================================
   Welcome / page header
   =========================================================== */

.pf-welcome {
    background: var(--pf-surface);
    border: 1px solid var(--pf-border);
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--pf-shadow-sm);
}
.pf-welcome h1 {
    font-size: 18px;
    margin: 0 0 2px;
    font-weight: 700;
    color: var(--pf-ink);
}
.pf-welcome .meta {
    color: var(--pf-muted);
    font-size: 12px;
}
.pf-welcome-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Existing pf-head — kept for back-compat but visually refreshed */
.pf-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.pf-head h2 { margin: 0; font-size: 22px; font-weight: 700; color: var(--pf-ink); display: flex; align-items: center; gap: 10px; letter-spacing: -0.01em; }
.pf-head h2 i { color: var(--pf-green); }
.pf-head .pf-sub { color: var(--pf-muted); font-size: 13px; margin-top: 4px; }
.pf-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Sub-page breadcrumb (DASHBOARD › PAYMENTS) */
.pf-crumb {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pf-muted);
    margin-bottom: 4px;
    font-weight: 600;
}
.pf-crumb .sep { margin: 0 6px; color: var(--pf-muted-2); }
.pf-page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--pf-ink);
    margin: 0 0 4px;
    letter-spacing: -0.01em;
}
.pf-page-sub { color: var(--pf-muted); font-size: 13px; margin-bottom: 16px; }

/* ===========================================================
   Cards + tables
   =========================================================== */

.pf-card {
    background: var(--pf-surface);
    border: 1px solid var(--pf-border);
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 16px;
    box-shadow: var(--pf-shadow-sm);
}
.pf-card-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pf-muted);
    font-weight: 600;
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}
.pf-card-title i { color: var(--pf-green); }

.pf-table { width: 100%; font-size: 13.5px; border-collapse: collapse; }
.pf-table thead th {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pf-muted);
    font-weight: 600;
    padding: 10px 10px;
    border-bottom: 1px solid var(--pf-border);
    text-align: left;
    background: transparent;
}
.pf-table tbody td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--pf-border-2);
    vertical-align: middle;
    color: var(--pf-ink-2);
}
.pf-table tbody tr:last-child td { border-bottom: 0; }
.pf-table tbody tr:hover td { background: rgba(34,197,94,.03); }

/* ===========================================================
   KPI / stat hero row
   =========================================================== */

.pf-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.pf-stat {
    background: var(--pf-surface);
    border: 1px solid var(--pf-border);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: var(--pf-shadow-sm);
    transition: box-shadow .15s, transform .15s;
}
.pf-stat:hover { box-shadow: var(--pf-shadow-md); }
.pf-stat .val {
    font-size: 28px;
    font-weight: 700;
    color: var(--pf-ink);
    line-height: 1.15;
    letter-spacing: -0.01em;
}
.pf-stat .lbl {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pf-muted);
    font-weight: 600;
    margin-top: 6px;
}
.pf-stat .delta {
    font-size: 12px;
    color: var(--pf-muted);
    margin-top: 4px;
}
.pf-stat .delta.up { color: var(--pf-green-2); }
.pf-stat .delta.down { color: #b91c1c; }
.pf-stat.is-active { border-color: var(--pf-green); box-shadow: 0 0 0 3px rgba(34,197,94,.10); }

/* ===========================================================
   Status / priority pills
   =========================================================== */

.pf-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.5;
    white-space: nowrap;
}
.pf-pill.success, .pf-pill.active, .pf-pill.paid, .pf-pill.completed,
.pf-pill.received, .pf-pill.approved, .pf-pill.confirmed, .pf-pill.executed,
.pf-pill.mgr_approved, .pf-pill.resolved {
    background: var(--pf-green-bg); color: var(--pf-green-fg);
}
.pf-pill.pending, .pf-pill.warning, .pf-pill.suspended,
.pf-pill.dist_pending, .pf-pill.unpaid, .pf-pill.awaiting_user,
.pf-pill.in_progress, .pf-pill.pending_approval, .pf-pill.sent {
    background: var(--pf-amber-bg); color: var(--pf-amber-fg);
}
.pf-pill.danger, .pf-pill.terminated, .pf-pill.rejected, .pf-pill.urgent,
.pf-pill.deactivated, .pf-pill.failed {
    background: var(--pf-red-bg); color: var(--pf-red-fg);
}
.pf-pill.info, .pf-pill.reinstated, .pf-pill.draft, .pf-pill.normal {
    background: var(--pf-blue-bg); color: var(--pf-blue-fg);
}
.pf-pill.purple, .pf-pill.pay_break, .pf-pill.on_hold {
    background: var(--pf-purple-bg); color: var(--pf-purple-fg);
}
.pf-pill.gray, .pf-pill.muted, .pf-pill.closed, .pf-pill.low,
.pf-pill.reallocated, .pf-pill.refunded, .pf-pill.returned {
    background: var(--pf-gray-bg); color: var(--pf-gray-fg);
}
.pf-pill.high { background: #ffedd5; color: #9a3412; }

/* ===========================================================
   Lifecycle / step-tracker
   =========================================================== */

.pf-lifecycle {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin: 8px 0 16px;
    padding: 6px 0;
    overflow-x: auto;
}
.pf-step { display: flex; flex-direction: column; align-items: center; flex: 1 1 0; min-width: 90px; position: relative; }
.pf-step .dot {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--pf-border);
    color: var(--pf-muted);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    z-index: 2;
}
.pf-step .label { font-size: 11px; color: var(--pf-muted); margin-top: 6px; text-align: center; max-width: 100px; }
.pf-step.done .dot { background: var(--pf-green); border-color: var(--pf-green); color: #fff; }
.pf-step.done .label { color: var(--pf-green-2); font-weight: 600; }
.pf-step.active .dot { background: #fff; border-color: var(--pf-green); color: var(--pf-green-2); box-shadow: 0 0 0 4px rgba(34,197,94,.15); }
.pf-step.active .label { color: var(--pf-ink); font-weight: 600; }
.pf-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--pf-border);
    z-index: 1;
}
.pf-step.done:not(:last-child)::after { background: var(--pf-green); }

/* ===========================================================
   Buttons
   =========================================================== */

.btn { font-size: 13.5px; border-radius: 8px; font-weight: 500; padding: 7px 14px; }
.btn-primary { background: var(--pf-green); border-color: var(--pf-green); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--pf-green-2); border-color: var(--pf-green-2); color: #fff; }
.btn-outline-primary { color: var(--pf-green-2); border-color: var(--pf-green); }
.btn-outline-primary:hover { background: var(--pf-green); border-color: var(--pf-green); color: #fff; }
.btn-dark { background: #111827; border-color: #111827; }
.btn-dark:hover { background: #0b0f17; border-color: #0b0f17; }
.pf-btn-soft {
    background: var(--pf-border-2);
    border: 1px solid var(--pf-border);
    color: var(--pf-ink-2);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 13.5px;
}
.pf-btn-soft:hover { background: var(--pf-border); color: var(--pf-ink); }

/* ===========================================================
   Forms
   =========================================================== */

.form-control, .form-select {
    border-radius: 8px;
    border-color: var(--pf-border);
    font-size: 14px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--pf-green);
    box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}
.form-label { font-weight: 500; color: var(--pf-ink-2); font-size: 13px; }

/* ===========================================================
   Bell / notifications dropdown overrides
   =========================================================== */

.pf-notif-menu {
    width: 380px;
    max-height: 480px;
    overflow-y: auto;
    border: 1px solid var(--pf-border);
    border-radius: 12px;
    box-shadow: var(--pf-shadow-md);
    padding: 0;
}
.pf-notif-menu .dropdown-item {
    border-radius: 8px;
    padding: 10px 12px;
}

/* ===========================================================
   SweetAlert2 visual matchup
   =========================================================== */

.swal2-popup { border-radius: 14px !important; font-family: inherit !important; }
.swal2-title { font-size: 18px !important; font-weight: 700 !important; }
.swal2-html-container { font-size: 14px !important; color: var(--pf-ink-2) !important; }
.swal2-styled.swal2-confirm { background: var(--pf-green) !important; border-radius: 8px !important; box-shadow: none !important; }
.swal2-styled.swal2-confirm:hover { background: var(--pf-green-2) !important; }
.swal2-styled.swal2-cancel { background: #fff !important; color: var(--pf-ink-2) !important; border: 1px solid var(--pf-border) !important; border-radius: 8px !important; }
.swal2-toast { border: 1px solid var(--pf-border) !important; box-shadow: var(--pf-shadow-md) !important; }

/* ===========================================================
   Misc helpers
   =========================================================== */

.font-mono { font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace; }
.text-tiny { font-size: 11px; }
.pf-divider { height: 1px; background: var(--pf-border); margin: 14px 0; border: 0; }
.pf-tag {
    display: inline-block; padding: 2px 8px; border-radius: 6px;
    background: var(--pf-border-2); color: var(--pf-ink-2);
    font-size: 11px; font-weight: 600;
    border: 1px solid var(--pf-border);
}

main h2 { margin-bottom: 1rem; }
.badge { font-weight: 500; }

/* Legacy aside fallback (used by views that pre-date the dark sidebar) */
aside .list-group-item { border: 0; border-bottom: 1px solid var(--pf-border-2); }
aside .list-group-item:last-child { border-bottom: 0; }
aside .list-group-item i { width: 1.2em; text-align: center; color: var(--pf-muted); }
aside .list-group-item.active { background-color: var(--pf-green); border-color: var(--pf-green); }
aside .list-group-item.active i { color: #fff; }

/* ===========================================================
   Responsive — sidebar collapses on small screens
   =========================================================== */

@media (max-width: 991.98px) {
    .pf-shell { flex-direction: column; }
    .pf-sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        height: 100vh;
        z-index: 1040;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 2px 0 20px rgba(0,0,0,.25);
    }
    .pf-sidebar.is-open { transform: translateX(0); }
    .pf-shell.has-overlay::before {
        content: '';
        position: fixed; inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 1035;
    }
    .pf-topbar .pf-menu-toggle { display: inline-flex !important; }
}
.pf-topbar .pf-menu-toggle { display: none; }

/* ===========================================================
   Mobile lock: business roles get a "use desktop" overlay.
   Body class .pf-mobile-lock is applied when the role is NOT
   super_admin / moderator AND viewport is small. The overlay
   sits above all content so the underlying UI is hidden.
   =========================================================== */

.pf-mobile-shield { display: none; }
@media (max-width: 767.98px) {
    body.pf-mobile-lock .pf-shell { filter: blur(2px); pointer-events: none; }
    body.pf-mobile-lock .pf-mobile-shield {
        display: flex;
        position: fixed; inset: 0;
        z-index: 2000;
        background: linear-gradient(180deg, #0b0f17 0%, #111827 100%);
        color: #fff;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 32px;
        text-align: center;
    }
    body.pf-mobile-lock .pf-mobile-shield .pf-brand-mark {
        width: 64px; height: 64px;
        border-radius: 16px;
        margin-bottom: 18px;
        box-shadow: 0 10px 28px rgba(34,197,94,.45);
    }
    body.pf-mobile-lock .pf-mobile-shield h2 {
        font-size: 20px; font-weight: 700; margin: 0 0 8px;
    }
    body.pf-mobile-lock .pf-mobile-shield p {
        max-width: 380px;
        color: rgba(255,255,255,.7);
        font-size: 14px;
        margin-bottom: 18px;
    }
    body.pf-mobile-lock .pf-mobile-shield .pf-mobile-actions {
        display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
    }
    body.pf-mobile-lock .pf-mobile-shield .pf-mobile-actions .btn {
        background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff;
    }
    body.pf-mobile-lock .pf-mobile-shield .pf-mobile-actions .btn-primary {
        background: var(--pf-green); border-color: var(--pf-green); color: #052e16; font-weight: 600;
    }
}

/* ===========================================================
   Spinners & loaders
   =========================================================== */

@keyframes pf-spin { to { transform: rotate(360deg); } }
@keyframes pf-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes pf-shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

.pf-spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid var(--pf-border);
    border-top-color: var(--pf-green);
    border-radius: 50%;
    animation: pf-spin 0.7s linear infinite;
    vertical-align: middle;
}
.pf-spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.pf-spinner-lg { width: 32px; height: 32px; border-width: 3px; }
.pf-spinner-xs { width: 11px; height: 11px; border-width: 2px; }

.pf-loading {
    display: flex; align-items: center; justify-content: center;
    flex-direction: column;
    gap: 12px;
    padding: 36px 20px;
    color: var(--pf-muted);
    font-size: 13px;
}
.pf-loading .pf-spinner { width: 28px; height: 28px; border-width: 3px; }

.pf-loading-inline {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12.5px; color: var(--pf-muted);
}

/* Skeleton placeholder shimmer for loading rows */
.pf-skeleton {
    display: inline-block;
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f3f4f6 0px, #e5e7eb 200px, #f3f4f6 400px);
    background-size: 800px 100%;
    animation: pf-shimmer 1.4s linear infinite;
    width: 100%;
    vertical-align: middle;
}
.pf-skeleton.pf-skeleton-sm { height: 10px; }
.pf-skeleton.pf-skeleton-lg { height: 18px; }
.pf-skeleton-row td { padding: 12px 10px; }
.pf-skeleton-row .pf-skeleton { display: block; }

/* Loading overlay for cards (set position:relative on the host) */
.pf-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.78);
    z-index: 5;
    display: flex; align-items: center; justify-content: center;
    border-radius: inherit;
    backdrop-filter: blur(2px);
}

/* Button spinner state */
.btn.is-loading {
    pointer-events: none; opacity: 0.85; position: relative;
}
.btn.is-loading::after {
    content: '';
    width: 14px; height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    display: inline-block;
    margin-left: 8px;
    animation: pf-spin 0.7s linear infinite;
    vertical-align: middle;
}

/* Top-of-page progress bar — for navigation/loading transitions */
.pf-progress-top {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: transparent;
    z-index: 9999;
    pointer-events: none;
}
.pf-progress-top::before {
    content: '';
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--pf-green) 0%, #4ade80 100%);
    transition: width 0.25s ease-out;
}
.pf-progress-top.is-loading::before {
    animation: pf-pulse 1.2s ease-in-out infinite;
    width: 60%;
}
.pf-progress-top.is-done::before { width: 100%; }

/* ===========================================================
   Pagination
   =========================================================== */

.pf-pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0 4px;
    flex-wrap: wrap;
    gap: 10px;
    border-top: 1px solid var(--pf-border-2);
    margin-top: 6px;
}
.pf-pagination .pf-page-info {
    font-size: 12.5px;
    color: var(--pf-muted);
}
.pf-pagination .pf-page-controls {
    display: flex; align-items: center; gap: 4px;
}
.pf-pagination .pf-page-controls button {
    background: #fff;
    border: 1px solid var(--pf-border);
    color: var(--pf-ink-2);
    width: 32px; height: 32px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.pf-pagination .pf-page-controls button:hover:not(:disabled) {
    background: var(--pf-border-2);
    color: var(--pf-ink);
}
.pf-pagination .pf-page-controls button:disabled {
    opacity: 0.4; cursor: not-allowed;
}
.pf-pagination .pf-page-controls button.active {
    background: var(--pf-green);
    color: #fff;
    border-color: var(--pf-green);
}
.pf-pagination .pf-page-controls .ellipsis {
    color: var(--pf-muted);
    padding: 0 4px;
}
.pf-pagination .pf-page-size {
    display: flex; align-items: center; gap: 6px;
    font-size: 12.5px;
    color: var(--pf-muted);
}
.pf-pagination .pf-page-size select {
    border: 1px solid var(--pf-border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12.5px;
    background: #fff;
    color: var(--pf-ink-2);
}

/* ===========================================================
   Auth pages (login / forgot / reset / 2FA / change-password)
   =========================================================== */

.pf-auth {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(180deg, var(--pf-sidebar) 0%, var(--pf-sidebar-2) 100%);
    padding: 28px 16px;
}
.pf-auth-card {
    background: var(--pf-surface);
    color: var(--pf-ink);
    width: 100%;
    max-width: 420px;
    padding: 32px 30px;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
.pf-auth-brand {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px;
    font-weight: 700;
    font-size: 18px;
    color: var(--pf-ink);
    letter-spacing: -0.01em;
}
.pf-auth-brand .pf-brand-mark {
    width: 38px; height: 38px; flex: 0 0 38px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(34,197,94,.32);
}
.pf-auth-brand .pf-wm-flo { color: var(--pf-green-2); }
.pf-auth h1 {
    font-size: 22px; font-weight: 700; margin: 0 0 4px;
    letter-spacing: -0.01em;
}
.pf-auth .lead { color: var(--pf-muted); font-size: 13.5px; margin-bottom: 22px; }
.pf-auth .form-label { font-weight: 500; color: var(--pf-ink-2); margin-bottom: 4px; font-size: 12.5px; }
.pf-auth .footer { font-size: 12px; color: var(--pf-muted); text-align: center; margin-top: 22px; }
.pf-auth a { color: var(--pf-green-2); text-decoration: none; }
.pf-auth a:hover { text-decoration: underline; }

/* ===========================================================
   Print — hide sidebar/topbar
   =========================================================== */

@media print {
    .pf-sidebar, .pf-topbar { display: none !important; }
    .pf-content-inner { padding: 0; }
    body { background: #fff !important; }
}
