:root{
    --sidebar:#06294f;
    --blue:#005baa;
    --green:#0f766e;
    --red:#dc2626;
    --orange:#f97316;
    --bg:#f3f7fb;
    --card:#fff;
    --border:#dbe5f0;
    --text:#102033;
    --muted:#64748b;
    --shadow:0 16px 45px rgba(15,23,42,.08);
}

*{
    box-sizing:border-box;
}

body{
    margin:0;
    font-family:"Segoe UI",Arial,sans-serif;
    background:var(--bg);
    color:var(--text);
}

.layout{
    display:flex;
    min-height:100vh;
}

.sidebar{
    width:280px;
    background:linear-gradient(180deg,var(--sidebar),#003f7d);
    color:#fff;
    padding:24px 18px;
    position:fixed;
    top:0;
    bottom:0;
    left:0;
    overflow:auto;
}

.brand{
    font-size:21px;
    font-weight:900;
    margin-bottom:24px;
}

.nav a{
    display:block;
    color:rgba(255,255,255,.9);
    text-decoration:none;
    padding:13px 14px;
    border-radius:13px;
    margin-bottom:8px;
    font-weight:750;
}

.nav a:hover,
.nav a.active{
    background:rgba(255,255,255,.15);
}

.main{
    margin-left:280px;
    width:calc(100% - 280px);
    padding:26px;
}

.topbar{
    background:#fff;
    border:1px solid var(--border);
    border-radius:22px;
    padding:22px 24px;
    box-shadow:var(--shadow);
    display:flex;
    justify-content:space-between;
    gap:12px;
    margin-bottom:22px;
}

.topbar h1{
    margin:0;
    font-size:28px;
}

.muted{
    color:var(--muted);
}

.stats{
    display:grid;
    grid-template-columns:repeat(9,1fr);
    gap:16px;
    margin-bottom:22px;
}

.stat{
    background:#fff;
    border:1px solid var(--border);
    border-radius:20px;
    padding:18px;
    box-shadow:var(--shadow);
}

.stat span{
    color:var(--muted);
    font-weight:750;
    font-size:13px;
}

.stat strong{
    display:block;
    font-size:28px;
    margin-top:5px;
}

.card{
    background:#fff;
    border:1px solid var(--border);
    border-radius:22px;
    padding:22px;
    box-shadow:var(--shadow);
    margin-bottom:22px;
}

.grid{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:14px;
}

.grid3{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:14px;
}

.app-filters{
    grid-template-columns:1.5fr 1fr 1fr 1fr auto;
}

label{
    font-weight:800;
    font-size:13px;
    display:block;
    margin-bottom:7px;
}

input,
select,
textarea{
    width:100%;
    border:1px solid var(--border);
    border-radius:12px;
    padding:11px 12px;
}

button,
.btn{
    border:none;
    border-radius:12px;
    padding:11px 15px;
    font-weight:850;
    cursor:pointer;
    text-decoration:none;
    display:inline-flex;
    gap:7px;
    align-items:center;
}

button:disabled{
    opacity:.45;
    cursor:not-allowed;
}

.btn-blue{
    background:var(--blue);
    color:#fff;
}

.btn-green{
    background:var(--green);
    color:#fff;
}

.btn-red{
    background:var(--red);
    color:#fff;
}

.btn-orange{
    background:var(--orange);
    color:#fff;
}

.btn-light{
    background:#eef4fb;
    color:#1e293b;
    border:1px solid var(--border);
}

.btn-sm{
    padding:6px 8px;
    font-size:11px;
    border-radius:9px;
    justify-content:center;
    text-align:center;
}

.full-width{
    width:100%;
    justify-content:center;
}

.app-table-card{
    position:relative;
}

.scroll-x-top{
    overflow-x:auto;
    overflow-y:hidden;
    height:18px;
    border:1px solid var(--border);
    border-radius:12px;
    background:#f8fafc;
    margin:14px 0 10px 0;
    position:sticky;
    top:0;
    z-index:20;
}

.scroll-x-top-inner{
    height:1px;
    min-width:1380px;
}

.table-wrap{
    overflow:auto;
    border:1px solid var(--border);
    border-radius:16px;
    max-height:72vh;
    scrollbar-gutter:stable both-edges;
}

.table-wrap thead th{
    position:sticky;
    top:0;
    z-index:2;
}

.scroll-x-top::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar{
    height:14px;
    width:14px;
}

.scroll-x-top::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb{
    background:#94a3b8;
    border-radius:999px;
    border:3px solid #f8fafc;
}

.scroll-x-top::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track{
    background:#f1f5f9;
}

table{
    width:100%;
    min-width:1380px;
    border-collapse:collapse;
    background:#fff;
}

th{
    background:#f1f6fb;
    text-align:left;
    padding:10px 8px;
    border-bottom:1px solid var(--border);
    font-size:12px;
    vertical-align:top;
}

td{
    padding:10px 8px;
    border-bottom:1px solid #eef2f7;
    font-size:13px;
    vertical-align:top;
}

/* Email column reduced */
#appTable th:nth-child(4),
#appTable td:nth-child(4){
    width:145px;
    max-width:145px;
    word-break:break-word;
    overflow-wrap:anywhere;
    font-size:12px;
}

/* Payment method column reduced */
#appTable th:nth-child(6),
#appTable td:nth-child(6){
    width:95px;
    max-width:95px;
}

/* Deposit status column reduced */
#appTable th:nth-child(7),
#appTable td:nth-child(7){
    width:80px;
    max-width:80px;
}

/* Base deposit and Gross paid columns compact */
#appTable th:nth-child(8),
#appTable td:nth-child(8),
#appTable th:nth-child(9),
#appTable td:nth-child(9){
    width:90px;
    max-width:90px;
    white-space:nowrap;
}

/* Section, Row, Plot compact */
#appTable th:nth-child(10),
#appTable td:nth-child(10),
#appTable th:nth-child(11),
#appTable td:nth-child(11),
#appTable th:nth-child(12),
#appTable td:nth-child(12){
    width:65px;
    max-width:75px;
}

/* Status column wraps Payment Pending into 2 lines */
#appTable th:nth-child(13),
#appTable td:nth-child(13){
    width:82px;
    max-width:82px;
    text-align:center;
}

.badge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:5px 8px;
    border-radius:999px;
    font-weight:850;
    font-size:11px;
    white-space:normal;
    line-height:1.05;
    text-align:center;
    max-width:76px;
    min-height:26px;
}

.Pending{
    background:#fef3c7;
    color:#92400e;
}

.Approved{
    background:#dcfce7;
    color:#166534;
}

.Rejected{
    background:#fee2e2;
    color:#991b1b;
}

.PaymentPending{
    background:#ffedd5;
    color:#9a3412;
    max-width:70px;
}

.Paid{
    background:#dcfce7;
    color:#166534;
}

.Unpaid{
    background:#ffedd5;
    color:#9a3412;
}

.Stripe{
    background:#dbeafe;
    color:#1d4ed8;
}

.Bank{
    background:#ede9fe;
    color:#5b21b6;
}

.alert{
    display:none;
    padding:13px 15px;
    border-radius:14px;
    margin-bottom:16px;
}

.alert.ok{
    display:block;
    background:#dcfce7;
    color:#166534;
    border:1px solid #bbf7d0;
}

.alert.err{
    display:block;
    background:#fee2e2;
    color:#991b1b;
    border:1px solid #fecaca;
}

.modal-bg{
    display:none;
    position:fixed;
    inset:0;
    background:rgba(15,23,42,.55);
    align-items:center;
    justify-content:center;
    padding:18px;
    z-index:1000;
}

.modal{
    background:#fff;
    border-radius:22px;
    padding:22px;
    max-width:760px;
    width:100%;
    box-shadow:0 30px 90px rgba(0,0,0,.25);
}

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

.x{
    background:#eef2f7;
    border:0;
    width:36px;
    height:36px;
    border-radius:12px;
}

.actions{
    display:flex;
    gap:6px;
    flex-wrap:nowrap;
    align-items:center;
}

.small{
    font-size:12px;
    color:#64748b;
}

/* Action column enlarged */
.action-col{
    width:315px;
    min-width:315px;
    max-width:315px;
    white-space:nowrap;
}

.action-grid{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:5px;
    width:100%;
    min-width:295px;
}

.action-grid button{
    font-size:10.5px;
    padding:5px 6px;
    white-space:nowrap;
    min-height:30px;
    justify-content:center;
}

/* Old More menu retained but hidden/not used */
.primary-actions{
    display:flex;
    align-items:center;
    gap:6px;
    white-space:nowrap;
}

.btn-more{
    background:#eef4fb;
    color:#1e293b;
    border:1px solid var(--border);
    padding:7px 10px;
    font-size:12px;
    position:relative;
}

.action-menu-wrap{
    position:relative;
    display:inline-flex;
}

.action-menu{
    display:none;
    position:fixed;
    width:190px;
    background:#fff;
    border:1px solid var(--border);
    border-radius:14px;
    box-shadow:0 20px 50px rgba(15,23,42,.18);
    padding:7px;
    z-index:80;
}

.action-menu.show{
    display:block;
}

.action-menu button{
    width:100%;
    justify-content:flex-start;
    background:#fff;
    color:#102033;
    border-radius:10px;
    padding:9px 10px;
    font-size:12px;
}

.action-menu button:hover:not(:disabled){
    background:#f1f6fb;
}

.action-menu button.danger{
    color:#991b1b;
}

.action-menu button.warning{
    color:#9a3412;
}

.action-menu button:disabled{
    opacity:.4;
    cursor:not-allowed;
}

.btn-purple{
    background:#7c3aed;
    color:#fff;
}

.btn-dark{
    background:#334155;
    color:#fff;
}

.btn-disabled{
    background:#cbd5e1;
    color:#64748b;
    cursor:not-allowed;
}

.login-body{
    background:linear-gradient(135deg,#003f7d,#0f766e);
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
}

.login-card{
    background:#fff;
    border-radius:24px;
    padding:32px;
    width:420px;
    max-width:92%;
    box-shadow:0 30px 80px rgba(0,0,0,.25);
}

.login-card h1{
    text-align:center;
    margin:0 0 8px;
}

.sub{
    text-align:center;
    color:#64748b;
    margin-bottom:24px;
}

.back{
    display:block;
    text-align:center;
    margin-top:16px;
    color:#475569;
}

@media(max-width:1300px){
    .stats{
        grid-template-columns:repeat(3,1fr);
    }

    .app-filters{
        grid-template-columns:repeat(2,1fr);
    }
}

@media(max-width:1000px){
    .sidebar{
        position:relative;
        width:100%;
        height:auto;
    }

    .layout{
        display:block;
    }

    .main{
        margin-left:0;
        width:100%;
        padding:16px;
    }

    .stats,
    .grid,
    .grid3,
    .app-filters{
        grid-template-columns:1fr;
    }

    .topbar{
        display:block;
    }

    table{
        min-width:1320px;
    }

    .scroll-x-top-inner{
        min-width:1320px;
    }
}