:root {
    --app-theme: #FF6B35;
    --app-theme-dark: #E85A24;
    --app-theme-soft: color-mix(in srgb, var(--app-theme) 12%, #fff);
    --app-theme-glow: color-mix(in srgb, var(--app-theme) 35%, transparent);
    --app-header-h: 60px;
    --app-nav-h: 72px;
    --app-safe-b: env(safe-area-inset-bottom, 0px);
    --app-safe-t: env(safe-area-inset-top, 0px);
    --app-bg: #f4f6fb;
    --app-surface: #ffffff;
    --app-text: #0f172a;
    --app-muted: #64748b;
    --app-border: rgba(15, 23, 42, 0.06);
    --app-radius: 20px;
    --app-radius-sm: 14px;
    --app-shadow: 0 4px 24px -4px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.04);
    --app-shadow-lg: 0 20px 50px -12px rgba(15, 23, 42, 0.15);
}

* { box-sizing: border-box; }

html, body {
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Plus Jakarta Sans', 'Figtree', system-ui, sans-serif;
}

body {
    background: var(--app-bg);
    color: var(--app-text);
}

.app-impersonation-banner {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: linear-gradient(90deg, #1A202C, #2D3748);
    color: #fff;
    font-size: 12px;
}

.app-impersonation-leave-form {
    margin: 0;
}

.app-impersonation-leave-btn {
    background: #FF6B35;
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 7px 14px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.app-login-as-form {
    display: inline;
    margin: 0;
}

.app-login-as-btn {
    width: auto !important;
    padding: 8px 14px !important;
    font-size: 12px !important;
    background: #FFF4EF !important;
    color: #E85A24 !important;
    border: 1px solid rgba(255, 107, 53, 0.35) !important;
    border-radius: 999px !important;
    font-weight: 700 !important;
    box-shadow: none !important;
}

/* Ambient background */
.app-shell {
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    padding-top: calc(var(--app-header-h) + var(--app-safe-t) + 8px);
    padding-bottom: calc(var(--app-nav-h) + var(--app-safe-b) + 12px);
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, var(--app-theme-glow), transparent),
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--app-theme) 8%, transparent), transparent 40%),
        var(--app-bg);
}

/* ——— Header ——— */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: calc(var(--app-header-h) + var(--app-safe-t));
    padding-top: var(--app-safe-t);
    background: linear-gradient(145deg, var(--app-theme-dark) 0%, var(--app-theme) 50%, color-mix(in srgb, var(--app-theme) 80%, #1e1b4b) 100%);
    color: #fff;
    box-shadow: 0 8px 32px -8px var(--app-theme-glow);
}

.app-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,.12) 0%, transparent 50%);
    pointer-events: none;
}

.app-header-inner {
    position: relative;
    z-index: 1;
    height: var(--app-header-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    max-width: 640px;
    margin: 0 auto;
}

.app-logo {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    object-fit: cover;
    background: rgba(255,255,255,.15);
    border: 2px solid rgba(255,255,255,.35);
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.app-title {
    flex: 1;
    min-width: 0;
}

.app-title-main {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-title-sub {
    font-size: 11px;
    opacity: .85;
    font-weight: 500;
    margin-top: 1px;
}

.app-header-btn {
    background: rgba(255,255,255,.18);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 12px;
    padding: 10px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ——— Main ——— */
.app-main {
    padding: 0 16px 16px;
    max-width: 640px;
    margin: 0 auto;
}

.app-page-head {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--app-text);
    margin-bottom: 16px;
    padding-top: 4px;
}

/* ——— Bottom nav ——— */
.app-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 8px 12px calc(8px + var(--app-safe-b));
    max-width: 640px;
    margin: 0 auto;
}

.app-bottom-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.8);
    border-radius: 24px;
    box-shadow: var(--app-shadow-lg), 0 0 0 1px var(--app-border);
    height: 64px;
    padding: 0 4px;
}

.app-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--app-muted);
    text-decoration: none;
    padding: 8px 4px;
    border-radius: 16px;
    transition: color .2s, background .2s;
    position: relative;
}

.app-tab.active {
    color: var(--app-theme);
    background: var(--app-theme-soft);
}

.app-tab svg {
    width: 22px;
    height: 22px;
    stroke-width: 2;
}

.app-tab-fab {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    margin-top: -28px;
    border-radius: 18px;
    background: linear-gradient(145deg, var(--app-theme), var(--app-theme-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 12px 28px -4px var(--app-theme-glow), 0 4px 12px rgba(0,0,0,.15);
    border: 3px solid var(--app-bg);
    transition: transform .15s;
}

.app-tab-fab:active {
    transform: scale(0.94);
}

/* ——— Cards ——— */
.app-card {
    background: var(--app-surface);
    border-radius: var(--app-radius);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--app-shadow);
    border: 1px solid var(--app-border);
}

.app-card-glass {
    background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(255,255,255,.85));
    backdrop-filter: blur(12px);
}

.app-card-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--app-text);
    margin-bottom: 14px;
}

/* Hero welcome */
.app-hero {
    background: linear-gradient(135deg, var(--app-theme-dark), var(--app-theme));
    border-radius: var(--app-radius);
    padding: 20px;
    margin-bottom: 16px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 16px 40px -12px var(--app-theme-glow);
}

.app-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 60%;
    height: 120%;
    background: radial-gradient(circle, rgba(255,255,255,.15), transparent 70%);
}

.app-hero h2 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    position: relative;
}

.app-hero p {
    font-size: 13px;
    opacity: .9;
    margin-top: 4px;
    position: relative;
}

/* Stats */
.app-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.app-stat-grid-stack {
    grid-template-columns: 1fr;
}

.app-stat-grid-stack .app-stat {
    padding: 18px;
}

.app-stat-grid-stack .app-stat-value {
    font-size: 1.75rem;
}

.app-team-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.app-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--app-text);
    cursor: pointer;
}

.app-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--app-theme);
}

.app-stat {
    background: var(--app-surface);
    border-radius: var(--app-radius-sm);
    padding: 16px;
    box-shadow: var(--app-shadow);
    border: 1px solid var(--app-border);
    position: relative;
    overflow: hidden;
}

.app-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--app-theme), color-mix(in srgb, var(--app-theme) 60%, #a78bfa));
}

.app-stat.stat-warn::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.app-stat.stat-success::before { background: linear-gradient(90deg, #10b981, #34d399); }
.app-stat.stat-info::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }

.app-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 10px;
    background: var(--app-theme-soft);
}

.app-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--app-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.app-stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--app-text);
    margin-top: 2px;
    line-height: 1.1;
}

/* List rows */
.app-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--app-border);
    text-decoration: none;
    color: inherit;
    transition: opacity .15s;
}

.app-list-item:last-child { border-bottom: none; }
.app-list-item:active { opacity: .7; }

.app-list-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--app-theme-soft), color-mix(in srgb, var(--app-theme) 20%, #fff));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: var(--app-theme);
    flex-shrink: 0;
}

.app-list-body { flex: 1; min-width: 0; }
.app-list-title { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.app-list-meta { font-size: 12px; color: var(--app-muted); margin-top: 2px; }

.app-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 20px;
    background: var(--app-theme-soft);
    color: var(--app-theme);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.app-badge-success { background: #d1fae5; color: #047857; }
.app-badge-warn { background: #fef3c7; color: #b45309; }
.app-badge-muted { background: #f1f5f9; color: #64748b; }

/* Buttons */
.app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
    width: 100%;
    border: none;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    text-decoration: none;
}

.app-btn:active { transform: scale(0.98); }

.app-btn-primary {
    background: linear-gradient(145deg, var(--app-theme), var(--app-theme-dark));
    color: #fff;
    box-shadow: 0 8px 24px -6px var(--app-theme-glow);
}

.app-btn-ghost {
    background: var(--app-theme-soft);
    color: var(--app-theme);
}

.app-btn-outline {
    background: transparent;
    border: 2px solid var(--app-border);
    color: var(--app-text);
}

.app-btn-secondary {
    background: #fff;
    color: var(--app-text);
    border: 1.5px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.app-btn-secondary:active {
    background: #f8fafc;
}

/* Inputs */
.app-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1.5px solid #e2e8f0;
    font-size: 16px;
    margin-top: 6px;
    background: #fafbfc;
    transition: border-color .2s, box-shadow .2s;
    font-family: inherit;
}

.app-input:focus {
    outline: none;
    border-color: var(--app-theme);
    box-shadow: 0 0 0 4px var(--app-theme-soft);
    background: #fff;
}

.app-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--app-text);
    letter-spacing: -0.01em;
}

/* Menu grid */
.app-menu-sheet {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.app-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 8px;
    background: var(--app-surface);
    border-radius: var(--app-radius-sm);
    text-decoration: none;
    color: var(--app-text);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -0.01em;
    box-shadow: var(--app-shadow);
    border: 1px solid var(--app-border);
    transition: transform .15s, box-shadow .15s;
}

.app-menu-item:active {
    transform: scale(0.96);
}

.app-menu-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: var(--app-theme-soft);
}

/* Alerts */
.app-alert {
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 14px;
    border: 1px solid;
}

.app-alert-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.app-alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

/* FY progress bar */
.app-progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    margin-top: 12px;
}

.app-progress-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--app-theme), #a78bfa);
}

.app-metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 14px;
}

.app-metric-row span:first-child { color: var(--app-muted); font-weight: 500; }
.app-metric-row span:last-child { font-weight: 800; letter-spacing: -0.02em; }

.app-link {
    display: block;
    text-align: center;
    margin-top: 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--app-theme);
    text-decoration: none;
}

.app-install-banner {
    background: linear-gradient(135deg, var(--app-theme-dark), color-mix(in srgb, var(--app-theme) 70%, #7c3aed));
    color: #fff;
    border-radius: var(--app-radius);
    padding: 18px;
    margin-bottom: 14px;
    font-size: 14px;
    box-shadow: 0 12px 32px -8px var(--app-theme-glow);
}

/* Laptop / desktop: same mobile UI — centered phone-width column + bottom nav always */
@media (min-width: 768px) {
    :root {
        --app-phone-w: 430px;
    }

    body {
        background: #e8ecf4;
    }

    .app-shell {
        max-width: var(--app-phone-w);
        margin-left: auto;
        margin-right: auto;
        padding-bottom: calc(var(--app-nav-h) + var(--app-safe-b) + 16px);
        box-shadow:
            0 0 0 1px rgba(15, 23, 42, 0.06),
            0 24px 48px -12px rgba(15, 23, 42, 0.18);
        background:
            radial-gradient(ellipse 80% 50% at 50% -20%, var(--app-theme-glow), transparent),
            radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--app-theme) 8%, transparent), transparent 40%),
            var(--app-bg);
    }

    .app-header {
        left: 50%;
        right: auto;
        width: min(100%, var(--app-phone-w));
        transform: translateX(-50%);
    }

    .app-header-inner,
    .app-main {
        max-width: var(--app-phone-w);
    }

    .app-bottom-nav {
        display: block;
        left: 50%;
        right: auto;
        width: min(100%, var(--app-phone-w));
        transform: translateX(-50%);
        max-width: var(--app-phone-w);
    }

    /* Super-admin header links only; company users use bottom nav on all screens */
    .app-desktop-nav {
        display: flex !important;
        gap: 6px;
        margin-left: auto;
    }
}

.app-desktop-nav {
    display: none;
}

.app-desktop-nav a {
    color: rgba(255,255,255,.9);
    padding: 8px 12px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.app-desktop-nav a:hover {
    background: rgba(255,255,255,.15);
}

/* Lead profile */
.app-lead-hero {
    background: linear-gradient(135deg, var(--app-theme-dark), var(--app-theme));
    border-radius: var(--app-radius);
    padding: 20px;
    margin-bottom: 14px;
    color: #fff;
    box-shadow: 0 16px 40px -12px var(--app-theme-glow);
}

.app-lead-hero-inner {
    display: flex;
    align-items: center;
    gap: 14px;
}

.app-lead-hero .app-list-avatar {
    background: rgba(255,255,255,.25);
    color: #fff;
    border: 2px solid rgba(255,255,255,.4);
}

.app-lead-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 6px;
    color: #fff;
}

.app-lead-hero .app-badge {
    background: rgba(255,255,255,.2);
    color: #fff;
}

.app-action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.app-action-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    background: var(--app-surface);
    border-radius: var(--app-radius-sm);
    text-decoration: none;
    color: var(--app-text);
    font-size: 12px;
    font-weight: 700;
    box-shadow: var(--app-shadow);
    border: 1px solid var(--app-border);
    transition: transform .15s;
}

.app-action-chip:active {
    transform: scale(0.96);
}

.app-action-icon {
    font-size: 22px;
    line-height: 1;
}

.app-detail-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--app-border);
    text-decoration: none;
    color: var(--app-text);
    font-size: 14px;
    font-weight: 500;
}

.app-detail-row:last-child {
    border-bottom: none;
}

.app-detail-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--app-theme-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.app-lead-edit-btn {
    background: rgba(255,255,255,.95);
    color: var(--app-theme);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    flex-shrink: 0;
}

.app-card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.app-card-header-row .app-card-title {
    margin: 0;
}

.app-card-link {
    font-size: 13px;
    font-weight: 700;
    color: var(--app-theme);
    text-decoration: none;
}

.app-amount {
    font-weight: 800;
    color: var(--app-theme);
    flex-shrink: 0;
}

.app-amount-due {
    color: #dc2626;
}

.app-empty {
    text-align: center;
    padding: 16px 0;
    font-size: 14px;
    color: var(--app-muted);
}

/* Quick message chips */
.app-quick-msgs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.app-quick-msg {
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid var(--app-border);
    background: var(--app-theme-soft);
    color: var(--app-theme);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.app-quick-msg:active {
    transform: scale(0.96);
    background: var(--app-theme);
    color: #fff;
}

select.app-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

input[type="date"].app-input,
input[type="time"].app-input {
    min-height: 48px;
}

/* Lead type chips (multi-select) */
.app-type-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.app-type-chip {
    cursor: pointer;
}

.app-type-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.app-type-chip span {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 22px;
    border: 1.5px solid var(--app-border);
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: var(--app-text);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.app-type-chip input:checked + span {
    background: var(--app-theme);
    border-color: var(--app-theme);
    color: #fff;
}

.app-type-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.app-type-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: var(--app-theme-soft);
    color: var(--app-theme);
}

.app-type-tag-hero {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* ——— Mobile form pages (add lead, etc.) ——— */
.app-main:has(.app-form-page) .app-page-head:empty {
    display: none;
}

.app-form-page {
    padding-bottom: calc(var(--app-nav-h) + var(--app-safe-b) + 16px);
}

/* Clean form layout v2 (no field icons) */
.app-page-intro {
    margin-bottom: 18px;
}

.app-page-intro-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin: 0 0 4px;
    color: var(--app-text);
}

.app-page-intro-sub {
    font-size: 14px;
    color: var(--app-muted);
    margin: 0;
    line-height: 1.45;
}

.app-panel {
    background: var(--app-surface);
    border-radius: var(--app-radius);
    padding: 18px;
    margin-bottom: 12px;
    box-shadow: var(--app-shadow);
    border: 1px solid var(--app-border);
}

.app-panel-scan {
    background: linear-gradient(160deg, var(--app-theme-soft) 0%, var(--app-surface) 55%);
    border-color: color-mix(in srgb, var(--app-theme) 18%, var(--app-border));
}

.app-panel-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--app-theme);
    margin: 0 0 4px;
}

.app-panel-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 14px;
    color: var(--app-text);
}

.app-panel-title-spaced {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--app-border);
}

.app-panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.app-panel-title-row .app-panel-title {
    margin-bottom: 0;
}

.app-panel-desc {
    font-size: 13px;
    color: var(--app-muted);
    margin: 0 0 14px;
    line-height: 1.5;
}

.app-panel-desc code {
    font-size: 11px;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
}

.app-link-inline {
    color: var(--app-theme);
    font-weight: 700;
    text-decoration: none;
    font-size: 13px;
}

.app-form-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.app-fg-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 380px) {
    .app-fg-row {
        grid-template-columns: 1fr;
    }
}

.app-fg-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--app-text);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.app-req {
    color: #dc2626;
    font-weight: 700;
}

.app-form-page .app-input {
    margin-top: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.app-form-page .app-input:focus {
    border-color: var(--app-theme);
    box-shadow: 0 0 0 3px var(--app-theme-soft);
}

.app-input-area {
    min-height: 96px;
    resize: vertical;
    line-height: 1.5;
}

.app-pill-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.app-pill {
    cursor: pointer;
}

.app-pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.app-pill span {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: var(--app-text);
    transition: all 0.15s ease;
}

.app-pill input:checked + span {
    background: var(--app-theme);
    border-color: var(--app-theme);
    color: #fff;
    box-shadow: 0 4px 12px var(--app-theme-glow);
}

.app-scan-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.app-scan-action {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 12px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    background: var(--app-theme);
    color: #fff;
    border: none;
    box-shadow: 0 6px 16px var(--app-theme-glow);
    transition: transform 0.12s;
}

.app-scan-action:active {
    transform: scale(0.98);
}

.app-scan-action-secondary {
    background: #fff;
    color: var(--app-theme);
    border: 1.5px solid color-mix(in srgb, var(--app-theme) 35%, #e2e8f0);
    box-shadow: none;
}

.app-scan-preview {
    margin-top: 14px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--app-border);
}

.app-scan-preview img {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    display: block;
    background: #f1f5f9;
}

.app-scan-clear {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.app-scan-msg {
    margin: 12px 0 0;
    font-size: 13px;
    font-weight: 600;
    min-height: 1.2em;
}

.app-scan-msg.is-load { color: var(--app-theme); }
.app-scan-msg.is-ok { color: #047857; }
.app-scan-msg.is-err { color: #dc2626; line-height: 1.4; }

.app-form-card-body.app-form-stack {
    padding-top: 4px;
}

.app-form-card-body.app-form-stack .app-fg:last-child {
    margin-bottom: 0;
}

/* Quotation / invoice line items */
.app-line-items {
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.app-line-item {
    padding: 14px;
    background: #f8fafc;
    border-radius: 14px;
    border: 1px solid var(--app-border);
}

.app-line-item > .app-input {
    margin-top: 6px;
    margin-bottom: 12px;
}

.app-line-item-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

@media (max-width: 400px) {
    .app-line-item-grid {
        grid-template-columns: 1fr;
    }
}

.app-line-item-grid .app-fg {
    margin: 0;
}

.app-form-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    margin-bottom: 14px;
    border-radius: var(--app-radius);
    background: linear-gradient(135deg, var(--app-theme-dark), var(--app-theme));
    color: #fff;
    box-shadow: 0 16px 40px -12px var(--app-theme-glow);
}

.app-form-hero-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

.app-form-hero-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 4px;
}

.app-form-hero-sub {
    font-size: 12px;
    opacity: 0.9;
    margin: 0;
    line-height: 1.4;
}

/* Form section cards */
.app-form-card {
    padding: 0;
    overflow: hidden;
}

.app-form-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--app-border);
}

.app-form-card-head-border {
    border-top: 1px solid var(--app-border);
    margin-top: 4px;
}

.app-form-card-head .app-card-link {
    margin-left: auto;
    font-size: 13px;
}

.app-form-card-icon {
    font-size: 18px;
    line-height: 1;
}

.app-form-card-title {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--app-text);
}

.app-form-card-body {
    padding: 12px 16px 16px;
}

.app-form-card-body .app-input {
    margin-top: 6px;
}

.app-form-card-hint {
    font-size: 12px;
    color: var(--app-muted);
    margin: 0;
    padding: 0 16px 12px;
    line-height: 1.45;
}

.app-type-chips-pad {
    padding: 4px 16px 16px;
}

.app-form-card .app-field-row:first-of-type {
    border-top: none;
}

.app-field-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--app-border);
}

.app-field-row-last {
    border-bottom: none;
}

.app-field-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--app-theme-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.app-field-body {
    flex: 1;
    min-width: 0;
}

.app-field-body .app-label {
    display: block;
    margin-bottom: 4px;
}

.app-input-flat {
    margin-top: 0;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 16px;
    background: #f8fafc;
}

.mt-3 { margin-top: 12px; }

/* Status chips (single select) */
.app-status-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.app-status-chip {
    cursor: pointer;
}

.app-status-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.app-status-chip span {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 22px;
    border: 1.5px solid var(--app-border);
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    color: var(--app-text);
    white-space: nowrap;
}

.app-status-chip input:checked + span {
    background: var(--app-theme);
    border-color: var(--app-theme);
    color: #fff;
}

.app-form-footer {
    margin-top: 12px;
    padding: 16px;
    background: var(--app-surface);
    border-radius: var(--app-radius);
    border: 1px solid var(--app-border);
    box-shadow: var(--app-shadow);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-form-footer .app-btn {
    text-decoration: none;
}

.app-btn-lg {
    padding: 16px 20px;
    font-size: 16px;
    border-radius: 16px;
}

/* Card / hoarding scanner */
.app-scan-card {
    padding: 16px;
    border: 2px dashed color-mix(in srgb, var(--app-theme) 35%, var(--app-border));
    background: linear-gradient(180deg, var(--app-theme-soft), var(--app-surface));
}

.app-scan-title {
    font-size: 1rem;
    font-weight: 800;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}

.app-scan-sub {
    font-size: 12px;
    color: var(--app-muted);
    margin: 0 0 14px;
    line-height: 1.45;
}

.app-scan-sub code {
    font-size: 11px;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 6px;
}

.app-scan-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.app-scan-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 12px;
    border-radius: 16px;
    background: var(--app-surface);
    border: 1.5px solid var(--app-border);
    font-weight: 700;
    font-size: 13px;
    color: var(--app-theme);
    cursor: pointer;
    box-shadow: var(--app-shadow);
}

.app-scan-btn span:first-child {
    font-size: 28px;
    line-height: 1;
}

.app-scan-btn:active {
    transform: scale(0.97);
}

.app-scan-preview {
    position: relative;
    margin-top: 14px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--app-border);
}

.app-scan-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    background: #0f172a;
    display: block;
}

.app-scan-clear {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.app-scan-status {
    margin: 12px 0 0;
    font-size: 13px;
    font-weight: 600;
    min-height: 1.2em;
}

.app-scan-status-loading { color: var(--app-theme); }
.app-scan-status-success { color: #047857; }
.app-scan-status-error { color: #dc2626; }

/* Forms */
.app-form-group { margin-bottom: 16px; }
.app-form-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.app-form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.app-form-actions .app-btn { flex: 1; min-width: 120px; }

select.app-input, textarea.app-input { font-family: inherit; }
textarea.app-input { min-height: 88px; resize: vertical; }

.app-field-error {
    font-size: 12px;
    color: #dc2626;
    margin-top: 6px;
    font-weight: 500;
}

.app-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--app-muted);
    cursor: pointer;
}

.app-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--app-theme);
}

.app-forgot-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--app-theme);
    text-decoration: none;
}

/* List pages toolbar */
.app-list-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}

.app-pagination {
    margin-top: 14px;
}

.app-pagination nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

.app-pagination a,
.app-pagination span {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: var(--app-text);
    background: var(--app-surface);
    border: 1px solid var(--app-border);
}

.app-pagination span[aria-current="page"] {
    background: var(--app-theme);
    color: #fff;
    border-color: var(--app-theme);
}

/* Invoice / quotation list cards */
.app-invoice-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 16px;
    margin-bottom: 10px;
}

.app-invoice-card .row-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.app-invoice-card .inv-num {
    font-weight: 800;
    font-size: 15px;
    letter-spacing: -0.02em;
    color: var(--app-theme);
}

.app-invoice-card .inv-due {
    font-weight: 800;
    font-size: 15px;
    color: #dc2626;
}

.app-invoice-card .inv-meta {
    font-size: 12px;
    color: var(--app-muted);
    margin-top: 6px;
}

.app-invoice-card .inv-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--app-border);
    font-size: 13px;
}

/* Pricing / subscribe */
.app-pricing-hero {
    text-align: center;
    padding: 8px 0 20px;
}

.app-pricing-hero .price {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--app-theme);
    line-height: 1;
}

.app-pricing-hero .price span {
    font-size: 14px;
    font-weight: 600;
    color: var(--app-muted);
}

.app-steps {
    background: #f8fafc;
    border-radius: var(--app-radius-sm);
    padding: 16px;
    font-size: 14px;
    line-height: 1.6;
}

.app-steps p { margin: 0 0 10px; }
.app-steps p:last-child { margin-bottom: 0; }

.app-upi {
    font-family: ui-monospace, monospace;
    font-weight: 700;
    color: var(--app-theme);
    font-size: 15px;
    padding: 10px 14px;
    background: var(--app-theme-soft);
    border-radius: 10px;
    display: inline-block;
    margin: 4px 0;
}

/* WhatsApp */
.app-wa-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    background: #f1f5f9;
    color: var(--app-muted);
}

.app-wa-status.connected { background: #d1fae5; color: #047857; }
.app-wa-status.waiting { background: #fef3c7; color: #b45309; }

.app-wa-qr {
    width: 220px;
    height: 220px;
    border-radius: 20px;
    border: 3px solid var(--app-border);
    box-shadow: var(--app-shadow);
    margin: 0 auto;
    display: block;
}

.app-wa-connected {
    padding: 20px;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-radius: var(--app-radius-sm);
    text-align: center;
}

.app-wa-warn {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px solid #fde68a;
    color: #92400e;
}

.app-wa-warn code {
    display: block;
    margin-top: 10px;
    padding: 12px;
    background: #fff;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.5;
    word-break: break-all;
}

.app-details summary {
    font-weight: 700;
    cursor: pointer;
    color: var(--app-muted);
    list-style: none;
}

.app-details summary::-webkit-details-marker { display: none; }

.app-btn-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1.5px solid #fecaca;
}

/* Pagination */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.pagination a, .pagination span {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    color: var(--app-text);
}
.pagination .active span { background: var(--app-theme); color: #fff; border-color: var(--app-theme); }

/* Utility */
.hidden { display: none !important; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.text-center { text-align: center; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.font-semibold { font-weight: 700; }
.text-muted { color: var(--app-muted); }

/* Business module (directors, employees, expenses, P&L) */
.app-biz-hero {
    background: linear-gradient(145deg, var(--app-theme), color-mix(in srgb, var(--app-theme) 75%, #1e3a8a));
    border-radius: var(--app-radius);
    padding: 18px 18px 16px;
    margin-bottom: 14px;
    color: #fff;
    box-shadow: 0 12px 32px -8px var(--app-theme-glow);
    position: relative;
    overflow: hidden;
}

.app-biz-hero::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -15%;
    width: 55%;
    height: 110%;
    background: radial-gradient(circle, rgba(255,255,255,.18), transparent 68%);
    pointer-events: none;
}

.app-biz-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    position: relative;
}

.app-biz-hero-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: rgba(255,255,255,.2);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.app-biz-hero-title {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.app-biz-hero-sub {
    font-size: 12px;
    opacity: .88;
    margin-top: 4px;
    line-height: 1.4;
}

.app-biz-hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 14px;
    position: relative;
}

.app-biz-hero-stat {
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 14px;
    padding: 10px 8px;
    text-align: center;
}

.app-biz-hero-stat-val {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.app-biz-hero-stat-lbl {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: .85;
    margin-top: 3px;
}

.app-equity-bar {
    display: flex;
    height: 10px;
    border-radius: 99px;
    overflow: hidden;
    background: var(--app-border);
    margin-bottom: 14px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
}

.app-equity-segment {
    min-width: 4px;
    transition: width .3s ease;
}

.app-equity-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 14px;
}

.app-equity-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--app-muted);
}

.app-equity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.app-toolbar-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    padding: 12px 14px;
    margin-bottom: 14px;
    box-shadow: var(--app-shadow);
}

.app-toolbar-card p {
    font-size: 12px;
    color: var(--app-muted);
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
}

.app-toolbar-card .app-btn {
    width: auto;
    padding: 11px 16px;
    font-size: 13px;
    flex-shrink: 0;
    border-radius: 12px;
}

.app-entity-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: var(--app-shadow);
    transition: transform .15s, box-shadow .15s;
}

.app-entity-card:active {
    transform: scale(0.99);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.app-entity-card-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-entity-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--app-border);
}

.app-equity-pill {
    min-width: 52px;
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--app-theme-soft);
    color: var(--app-theme);
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    letter-spacing: -0.03em;
    flex-shrink: 0;
}

.app-login-dots {
    display: flex;
    align-items: center;
    gap: 5px;
}

.app-login-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--app-border);
}

.app-login-dot.filled {
    background: var(--app-theme);
    box-shadow: 0 0 0 2px var(--app-theme-soft);
}

.app-login-dots-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--app-muted);
    margin-left: 4px;
}

.app-profile-hero {
    text-align: center;
    padding: 24px 16px 20px;
    margin-bottom: 14px;
}

.app-profile-hero .app-list-avatar {
    width: 72px;
    height: 72px;
    font-size: 28px;
    margin: 0 auto 12px;
    border-radius: 22px;
}

.app-profile-hero-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.app-profile-hero-meta {
    font-size: 13px;
    color: var(--app-muted);
    margin-top: 4px;
}

.app-profile-equity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 16px;
    border-radius: 99px;
    background: var(--app-theme-soft);
    color: var(--app-theme);
    font-size: 14px;
    font-weight: 800;
}

.app-expense-amount {
    font-size: 1.1rem;
    font-weight: 800;
    color: #dc2626;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.app-expense-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #fef2f2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.app-employee-type-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.app-employee-type-icon.type-office { background: #eff6ff; }
.app-employee-type-icon.type-field { background: #ecfdf5; }
.app-employee-type-icon.type-commission { background: #fef3c7; }

.app-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.app-card-actions .app-btn {
    width: auto;
    padding: 9px 14px;
    font-size: 12px;
    border-radius: 10px;
}

.app-empty-state {
    text-align: center;
    padding: 36px 20px;
}

.app-empty-state-icon {
    font-size: 44px;
    line-height: 1;
    margin-bottom: 10px;
}

.app-empty-state-title {
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -0.02em;
}

.app-empty-state-sub {
    font-size: 13px;
    color: var(--app-muted);
    margin-top: 6px;
    line-height: 1.5;
}

.app-collect-card {
    border: 2px solid #a7f3d0;
    background: linear-gradient(180deg, #f0fdf4 0%, #fff 40%);
}

.app-pay-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.app-pay-chip {
    display: block;
    cursor: pointer;
}

.app-pay-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.app-pay-chip span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 8px;
    border-radius: 12px;
    border: 2px solid var(--app-border);
    background: var(--app-surface);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    transition: border-color .15s, background .15s, color .15s;
}

.app-pay-chip input:checked + span {
    border-color: #059669;
    background: #ecfdf5;
    color: #047857;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, .15);
}

.app-pay-chip:active span {
    transform: scale(0.98);
}

.app-due-director-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--app-border);
}

.app-due-director-row:last-child {
    border-bottom: none;
}

.app-due-amount {
    font-size: 1.15rem;
    font-weight: 800;
    color: #dc2626;
    letter-spacing: -0.03em;
}

.app-due-invoice-card {
    padding: 14px 0;
    border-bottom: 1px solid var(--app-border);
}

.app-due-invoice-card:last-child {
    border-bottom: none;
}

.app-due-invoice-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

/* Director financial dashboard charts */
.app-dir-hero {
    background: linear-gradient(145deg, #1e3a8a, #3b82f6);
    border-radius: var(--app-radius);
    padding: 18px 16px;
    margin-bottom: 14px;
    color: #fff;
    box-shadow: 0 12px 32px -8px rgba(30, 64, 175, .45);
}

.app-dir-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.app-dir-hero-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.85;
    margin: 0 0 4px;
}

.app-dir-hero-title {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0;
    line-height: 1.2;
}

.app-dir-hero-sub {
    font-size: 12px;
    opacity: 0.9;
    margin: 6px 0 0;
}

.app-dir-net-pill {
    text-align: center;
    padding: 10px 12px;
    border-radius: 14px;
    min-width: 88px;
    backdrop-filter: blur(8px);
}

.app-dir-net-pill.positive {
    background: rgba(16, 185, 129, .25);
    border: 1px solid rgba(255, 255, 255, .25);
}

.app-dir-net-pill.negative {
    background: rgba(220, 38, 38, .3);
    border: 1px solid rgba(255, 255, 255, .25);
}

.app-dir-net-label {
    display: block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.9;
}

.app-dir-net-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-top: 2px;
}

.app-dir-net-tag {
    font-size: 10px;
    font-weight: 700;
}

.app-finance-tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.app-finance-tile {
    display: flex;
    flex-direction: column;
    padding: 14px 12px;
    border-radius: var(--app-radius-sm);
    text-decoration: none;
    color: inherit;
    box-shadow: var(--app-shadow);
    border: 1px solid var(--app-border);
    transition: transform .15s;
}

.app-finance-tile:active {
    transform: scale(0.98);
}

.app-finance-tile-icon {
    font-size: 20px;
    margin-bottom: 6px;
}

.app-finance-tile-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.85;
}

.app-finance-tile-value {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-top: 4px;
}

.app-finance-tile.tile-due {
    background: linear-gradient(135deg, #fef2f2, #fff);
    border-color: #fecaca;
}

.app-finance-tile.tile-due .app-finance-tile-value {
    color: #dc2626;
}

.app-finance-tile.tile-collect {
    background: linear-gradient(135deg, #ecfdf5, #fff);
    border-color: #a7f3d0;
}

.app-finance-tile.tile-collect .app-finance-tile-value {
    color: #047857;
}

.app-finance-tile.tile-expense {
    background: linear-gradient(135deg, #fffbeb, #fff);
    border-color: #fde68a;
}

.app-finance-tile.tile-expense .app-finance-tile-value {
    color: #b45309;
}

.app-finance-tile.tile-equity {
    background: linear-gradient(135deg, #eff6ff, #fff);
    border-color: #bfdbfe;
}

.app-finance-tile.tile-equity .app-finance-tile-value {
    color: #1d4ed8;
}

.app-chart-card {
    margin-bottom: 14px;
}

.app-chart-split {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.app-donut-wrap {
    position: relative;
    width: 130px;
    height: 130px;
    flex-shrink: 0;
}

.app-donut {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.app-donut-hole {
    position: absolute;
    inset: 22%;
    background: var(--app-surface);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px var(--app-border);
}

.app-donut-hole-val {
    font-size: 1.25rem;
    font-weight: 800;
    color: #059669;
    line-height: 1;
}

.app-donut-hole-lbl {
    font-size: 9px;
    font-weight: 700;
    color: var(--app-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

.app-flow-legend {
    flex: 1;
    min-width: 0;
}

.app-flow-legend-row {
    display: grid;
    grid-template-columns: 10px 1fr auto auto;
    gap: 6px 8px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--app-border);
    font-size: 12px;
}

.app-flow-legend-row:last-child {
    border-bottom: none;
}

.app-flow-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.app-flow-legend-label {
    font-weight: 600;
    color: var(--app-text);
}

.app-flow-legend-amt {
    font-weight: 800;
    text-align: right;
}

.app-flow-legend-pct {
    font-size: 10px;
    color: var(--app-muted);
    text-align: right;
    min-width: 32px;
}

.app-bar-row {
    display: grid;
    grid-template-columns: 100px 1fr 56px;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
}

.app-bar-label {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--app-text);
}

.app-bar-track {
    height: 10px;
    background: #f1f5f9;
    border-radius: 99px;
    overflow: hidden;
}

.app-bar-fill {
    height: 100%;
    border-radius: 99px;
    min-width: 4px;
    transition: width .4s ease;
}

.app-bar-amt {
    font-size: 12px;
    font-weight: 800;
    text-align: right;
    color: var(--app-text);
}

.app-bar-net {
    display: flex;
    justify-content: space-between;
    padding: 12px 0 4px;
    margin-top: 8px;
    border-top: 2px solid var(--app-border);
    font-size: 14px;
    font-weight: 800;
}

.app-due-mini-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--app-border);
    text-decoration: none;
    color: inherit;
}

.app-due-mini-row:last-child {
    border-bottom: none;
}

.app-due-mini-row .app-due-amount {
    font-size: 1rem;
    font-weight: 800;
    color: #dc2626;
}

.app-proof-preview {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: var(--app-radius-sm);
    border: 1px solid var(--app-border);
    background: #f8fafc;
    display: block;
}

.app-attendance-card {
    border: 2px solid color-mix(in srgb, var(--app-theme) 25%, transparent);
    background: linear-gradient(180deg, #fff 0%, color-mix(in srgb, var(--app-theme) 6%, #fff) 100%);
}

.app-attendance-absent {
    padding-top: 12px;
    border-top: 1px dashed var(--app-border);
}

.app-field-track-card .app-field-log-btn {
    width: 100%;
}

.app-att-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.app-att-stat {
    border-radius: 14px;
    padding: 12px 10px;
    text-align: center;
}

.app-att-stat.present {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}

.app-att-stat.absent {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.app-att-stat.pending {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.app-att-stat-val {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
}

.app-att-stat.present .app-att-stat-val { color: #059669; }
.app-att-stat.absent .app-att-stat-val { color: #dc2626; }
.app-att-stat.pending .app-att-stat-val { color: #64748b; }

.app-att-stat-lbl {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.app-att-stat-pct {
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-top: 4px;
}

.app-att-bar-chart {
    margin-top: 16px;
    border-top: 1px solid var(--app-border);
    padding-top: 12px;
}

.app-att-emp-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 6px 10px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.app-att-emp-row:last-child {
    border-bottom: none;
}

.app-att-emp-name {
    font-weight: 600;
    font-size: 13px;
    grid-column: 1 / -1;
}

.app-att-emp-bar-wrap {
    grid-column: 1 / -1;
    height: 8px;
    background: #f1f5f9;
    border-radius: 99px;
    overflow: hidden;
}

.app-att-emp-bar {
    height: 100%;
    border-radius: 99px;
    min-width: 4px;
}

.app-att-emp-meta {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* WhatsApp chat inbox */
.app-chat-list-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid var(--app-border);
    text-decoration: none;
    color: inherit;
}

.app-chat-list-item:active {
    background: #f8fafc;
}

.app-chat-avatar {
    background: #25D366;
    color: #fff;
}

.app-chat-list-body {
    flex: 1;
    min-width: 0;
}

.app-chat-list-top,
.app-chat-list-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.app-chat-preview {
    color: #64748b;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.app-chat-time {
    font-size: 11px;
    color: #94a3b8;
    flex-shrink: 0;
}

.app-chat-unread {
    background: #25D366;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 99px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    flex-shrink: 0;
}

.app-chat-assignee {
    margin-top: 4px;
}

.app-chat-header-bar {
    margin: -8px 0 12px;
    padding: 0 2px;
}

.app-chat-back {
    font-size: 14px;
    font-weight: 600;
    color: var(--app-theme);
    text-decoration: none;
}

.app-chat-header-sub {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

.app-chat-thread {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100dvh - 280px);
    min-height: 240px;
    overflow-y: auto;
    padding: 8px 4px 16px;
    margin-bottom: 12px;
    background: #e5ddd5;
    border-radius: 12px;
}

.app-chat-bubble-wrap {
    display: flex;
}

.app-chat-bubble-wrap.inbound {
    justify-content: flex-start;
}

.app-chat-bubble-wrap.outbound {
    justify-content: flex-end;
}

.app-chat-bubble {
    max-width: 85%;
    padding: 10px 12px;
    border-radius: 12px;
    box-shadow: 0 1px 1px rgba(0,0,0,.06);
}

.app-chat-bubble-wrap.inbound .app-chat-bubble {
    background: #fff;
    border-top-left-radius: 4px;
}

.app-chat-bubble-wrap.outbound .app-chat-bubble {
    background: #dcf8c6;
    border-top-right-radius: 4px;
}

.app-chat-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}

.app-chat-meta {
    font-size: 10px;
    color: #64748b;
    margin-top: 6px;
    text-align: right;
}

.app-chat-failed {
    color: #dc2626;
    font-weight: 600;
}

.app-chat-compose {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    position: sticky;
    bottom: 0;
    background: var(--app-bg);
    padding-top: 8px;
}

.app-chat-input {
    flex: 1;
    border: 1px solid var(--app-border);
    border-radius: 20px;
    padding: 10px 14px;
    font: inherit;
    resize: none;
    min-height: 44px;
    background: #fff;
}

.app-chat-send {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: #25D366;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.app-chat-send:disabled {
    opacity: 0.6;
}

.app-chat-list-item.active {
    background: #f0fdf4;
    border-left: 3px solid #25D366;
}

.app-chat-list-item:hover {
    background: #f8fafc;
}

/* Full-page WhatsApp inbox (super admin + company admin) */
body.app-chat-fullpage {
    background: #e8ecf4;
}

body.app-chat-fullpage .app-shell.app-chat-full-shell {
    max-width: none;
    width: 100%;
    margin: 0;
    min-height: 100dvh;
    padding-top: calc(var(--app-header-h) + var(--app-safe-t));
    padding-bottom: 0;
    box-shadow: none;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
}

body.app-chat-fullpage .app-header {
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    transform: none;
}

body.app-chat-fullpage .app-header-inner {
    max-width: none;
}

body.app-chat-fullpage .app-main.app-chat-full-main {
    max-width: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
    margin: 0;
}

body.app-chat-fullpage .app-page-head {
    display: none;
}

.app-chat-inbox {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.app-chat-sidebar {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-right: 1px solid var(--app-border);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.app-chat-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--app-border);
    background: linear-gradient(135deg, var(--app-theme-dark), var(--app-theme));
    color: #fff;
}

.app-chat-sidebar-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.app-chat-sidebar-actions {
    display: flex;
    gap: 8px;
}

.app-chat-sidebar-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,.15);
    color: #fff;
    text-decoration: none;
    font-size: 16px;
}

.app-chat-sidebar-link:hover {
    background: rgba(255,255,255,.25);
}

.app-chat-sidebar-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.app-chat-sidebar-empty {
    padding: 32px 20px;
    text-align: center;
}

.app-chat-sidebar-pagination {
    padding: 8px 12px;
    border-top: 1px solid var(--app-border);
    background: #fff;
}

.app-chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #efeae2;
}

.app-chat-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #fff;
    border-bottom: 1px solid var(--app-border);
}

.app-chat-panel-title {
    font-size: 16px;
    font-weight: 700;
}

.app-chat-panel-title-wrap {
    min-width: 0;
}

.app-chat-back-mobile {
    display: none;
}

.app-chat-thread-full {
    flex: 1;
    max-height: none;
    min-height: 0;
    margin: 0;
    border-radius: 0;
    overflow-y: auto;
    padding: 16px 20px;
}

.app-chat-compose-full {
    padding: 12px 16px 16px;
    background: #f0f2f5;
    border-top: 1px solid var(--app-border);
}

.app-chat-empty-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    background: #f8fafc;
}

.app-chat-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.app-chat-empty-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
}

/* Desktop: split view, hide bottom nav */
@media (min-width: 768px) {
    body.app-chat-fullpage .app-bottom-nav {
        display: none;
    }

    body.app-chat-fullpage .app-shell.app-chat-full-shell {
        padding-bottom: 0;
    }

    .app-chat-panel {
        display: flex;
    }
}

/* Mobile: list OR thread (not split) */
@media (max-width: 767px) {
    body.app-chat-fullpage .app-shell.app-chat-full-shell {
        padding-bottom: calc(var(--app-nav-h) + var(--app-safe-b) + 8px);
    }

    .app-chat-inbox {
        flex-direction: column;
        height: auto;
        min-height: calc(100dvh - var(--app-header-h, 64px) - var(--app-nav-h) - 16px);
    }

    .app-chat-sidebar {
        max-width: none;
        flex: 1;
        border-right: none;
    }

    body.app-chat-fullpage.app-chat-has-thread .app-chat-sidebar {
        display: none;
    }

    body.app-chat-fullpage:not(.app-chat-has-thread) .app-chat-panel {
        display: none;
    }

    body.app-chat-fullpage.app-chat-has-thread .app-chat-panel {
        flex: 1;
        min-height: calc(100dvh - var(--app-header-h, 64px) - var(--app-nav-h) - 24px);
    }

    .app-chat-back-mobile {
        display: inline-flex;
        align-items: center;
        font-size: 22px;
        padding-right: 4px;
    }

    .app-chat-thread-full {
        flex: 1;
    }
}
