*{
    box-sizing:border-box;
}

html{
    scroll-behavior:smooth;
}

body{
    margin:0;
    font-family:Arial,Helvetica,sans-serif;
    background:#f4f7fb;
    color:#172033;
}

/* =====================================================
   HEADER
===================================================== */

.topbar{
    background:rgba(255,255,255,.96);
    border-bottom:1px solid #e6eaf0;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:10px 24px;
    position:sticky;
    top:0;
    z-index:100;
    box-shadow:0 4px 18px rgba(20,33,61,.05);
}

.brand{
    display:flex;
    align-items:center;
    gap:10px;
    text-decoration:none;
    color:#14213d;
    font-weight:800;
}

.brand img{
    width:72px;
    height:60px;
    object-fit:contain;
}

.brand span{
    font-size:18px;
}

.topbar nav{
    display:flex;
    align-items:center;
    gap:7px;
    flex-wrap:wrap;
}

.topbar nav a{
    color:#344054;
    text-decoration:none;
    font-size:13px;
    font-weight:700;
    padding:9px 12px;
    border-radius:9px;
    transition:.2s ease;
}

.topbar nav a:hover{
    background:#edf4ff;
    color:#0048a8;
}


/* =====================================================
   MAIN CONTAINER
===================================================== */

.container{
    max-width:1180px;
    margin:28px auto;
    padding:0 18px;
}


/* =====================================================
   DASHBOARD STAT CARDS
===================================================== */

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

.stat{
    background:#fff;
    border:1px solid #edf0f5;
    border-radius:18px;
    box-shadow:0 7px 25px rgba(20,33,61,.07);
    padding:22px;
    transition:.25s ease;
}

.stat:hover{
    transform:translateY(-3px);
    box-shadow:0 14px 32px rgba(20,33,61,.11);
}

.stat span{
    display:block;
    color:#667085;
    font-size:13px;
    font-weight:700;
}

.stat b{
    display:block;
    color:#172033;
    font-size:28px;
    margin-top:9px;
    line-height:1.2;
}


/* =====================================================
   PANELS
===================================================== */

.stat,
.panel{
    background:#fff;
    border-radius:18px;
    box-shadow:0 7px 25px rgba(20,33,61,.07);
}

.panel{
    margin-top:22px;
    padding:22px;
    border:1px solid #edf0f5;
}

.panel h2{
    margin:0 0 5px;
    font-size:21px;
    color:#172033;
}

.panel p{
    margin:0;
    color:#7a8494;
    font-size:13px;
}


/* =====================================================
   PANEL HEADER
===================================================== */

.panel-head{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
}


/* =====================================================
   NORMAL BUTTONS
===================================================== */

.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:0;
    border-radius:11px;
    background:#0048a8;
    color:#fff;
    padding:11px 16px;
    text-decoration:none;
    cursor:pointer;
    font-weight:700;
    transition:.2s ease;
}

.btn:hover{
    transform:translateY(-2px);
    box-shadow:0 8px 18px rgba(0,72,168,.20);
}

.btn.secondary{
    background:#172033;
    margin-left:8px;
}

.full{
    width:100%;
}


/* =====================================================
   QUICK ACTIONS
===================================================== */

.premium-panel{
    overflow:hidden;
}

.section-title{
    margin-bottom:18px;
}

.quick-action-row{
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:15px !important;
    width:100% !important;
}

.quick-action-btn{
    display:flex !important;
    align-items:center !important;
    gap:14px !important;

    width:100% !important;
    min-width:0 !important;
    min-height:78px !important;

    margin:0 !important;
    padding:15px 17px !important;

    background:#f9fafc !important;
    border:1px solid #e5e9f0 !important;
    border-radius:16px !important;

    color:#172033 !important;
    text-decoration:none !important;

    box-shadow:none !important;

    transition:
        transform .22s ease,
        box-shadow .22s ease,
        border-color .22s ease,
        background .22s ease !important;
}

.quick-action-btn:hover{
    transform:translateY(-3px) !important;
    background:#fff !important;
    border-color:#cdd8e8 !important;
    box-shadow:0 12px 28px rgba(20,33,61,.10) !important;
    text-decoration:none !important;
}


/* ICON */

.action-icon{
    flex:0 0 46px !important;

    width:46px !important;
    height:46px !important;

    display:flex !important;
    align-items:center !important;
    justify-content:center !important;

    border-radius:13px !important;

    background:#edf4ff !important;
    color:#0048a8 !important;

    font-size:21px !important;
    font-weight:800 !important;
}


/* TEXT */

.action-text{
    display:block !important;
    flex:1 !important;
    min-width:0 !important;
}

.action-text strong{
    display:block !important;

    color:#172033 !important;

    font-size:15px !important;
    font-weight:800 !important;

    line-height:1.3 !important;

    text-decoration:none !important;
}

.action-text small{
    display:block !important;

    margin-top:5px !important;

    color:#8a93a3 !important;

    font-size:12px !important;

    line-height:1.3 !important;

    text-decoration:none !important;
}


/* ADD CLIENT PREMIUM */

.primary-action{
    background:linear-gradient(
        135deg,
        #0048a8,
        #1557b0
    ) !important;

    border-color:#0048a8 !important;

    box-shadow:0 8px 20px rgba(0,72,168,.16) !important;
}

.primary-action strong,
.primary-action small{
    color:#fff !important;
}

.primary-action .action-icon{
    background:rgba(255,255,255,.17) !important;
    color:#fff !important;
}


/* =====================================================
   TABLE
===================================================== */

.table-wrap{
    overflow:auto;
    border-radius:12px;
}

table{
    width:100%;
    border-collapse:collapse;
    margin-top:12px;
    background:#fff;
}

th,
td{
    text-align:left;
    padding:12px;
    border-bottom:1px solid #edf0f4;
    white-space:nowrap;
}

th{
    font-size:13px;
    color:#667085;
    font-weight:700;
}

td{
    font-size:14px;
    color:#344054;
}


/* =====================================================
   FORMS
===================================================== */

.form-grid{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:16px;
}

label{
    font-size:14px;
    font-weight:700;
    color:#344054;
}

input,
select,
textarea{
    display:block;
    width:100%;
    margin-top:7px;
    padding:12px;

    border:1px solid #d7dce5;
    border-radius:10px;

    font:inherit;
    background:#fff;
    color:#172033;

    outline:none;
    transition:.2s ease;
}

input:focus,
select:focus,
textarea:focus{
    border-color:#0048a8;
    box-shadow:0 0 0 3px rgba(0,72,168,.10);
}

textarea{
    min-height:100px;
    resize:vertical;
}

.wide{
    grid-column:1/-1;
}


/* =====================================================
   LOGIN
===================================================== */

.login-body{
    min-height:100vh;
    display:grid;
    place-items:center;
    background:linear-gradient(135deg,#edf5ff,#fff);
}

.login-card{
    width:min(420px,92vw);
    background:#fff;
    padding:32px;
    border-radius:20px;
    box-shadow:0 12px 40px rgba(20,33,61,.10);
}

.login-logo{
    display:block;
    width:180px;
    height:150px;
    object-fit:contain;
    margin:0 auto 8px;
}

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

.muted,
.small{
    text-align:center;
    color:#667085;
}

.login-card form{
    display:grid;
    gap:12px;
    margin-top:20px;
}

.error,
.success{
    padding:12px;
    border-radius:10px;
    margin:14px 0;
    font-size:14px;
}

.error{
    background:#fff0f0;
    color:#a40000;
}

.success{
    background:#effaf0;
    color:#176b24;
}


/* =====================================================
   DESKTOP FOOTER
===================================================== */

footer{
    text-align:center;
    color:#7a8494;
    padding:16px 10px;
    font-size:12px;
}

.desktop-footer{
    text-align:center;
    color:#8a93a3;
    padding:18px 10px 22px;
    margin-top:18px;
    font-size:12px;
}


/* =====================================================
   MOBILE BOTTOM APP BAR
===================================================== */

.mobile-bottom-bar{
    display:none;
}


/* =====================================================
   TABLET
===================================================== */

@media(max-width:800px){

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

    .topbar{
        align-items:flex-start;
        gap:10px;
    }

    .topbar nav{
        gap:4px;
    }

    .form-grid{
        grid-template-columns:1fr;
    }

    .wide{
        grid-column:auto;
    }

    .quick-action-row{
        grid-template-columns:1fr !important;
    }

}


/* =====================================================
   MOBILE
===================================================== */

@media(max-width:600px){

    body{
        padding-bottom:82px;
        overflow-x:hidden;
    }

    .container{
        width:100%;
        margin:16px auto;
        padding:0 12px;
    }


    /* HEADER */

    .topbar{
        display:block;
        padding:8px 12px 10px;
    }

    .brand{
        justify-content:center;
    }

    .brand img{
        width:58px;
        height:48px;
    }

    .brand span{
        font-size:17px;
    }

    .topbar .main-nav{
        display:none;
    }


    /* STATS */

    .grid{
        grid-template-columns:repeat(2,1fr);
        gap:10px;
    }

    .stat{
        padding:15px;
        border-radius:15px;
    }

    .stat span{
        font-size:11px;
    }

    .stat b{
        font-size:21px;
        margin-top:7px;
    }


    /* PANEL */

    .panel{
        margin-top:14px;
        padding:16px 13px;
        border-radius:17px;
    }

    .panel h2{
        font-size:18px;
    }


    /* QUICK ACTIONS */

    .quick-action-row{
        display:grid !important;
        grid-template-columns:1fr !important;
        gap:10px !important;
    }

    .quick-action-btn{
        min-height:68px !important;
        padding:11px 13px !important;
        border-radius:14px !important;
    }

    .action-icon{
        flex:0 0 42px !important;
        width:42px !important;
        height:42px !important;
        border-radius:12px !important;
        font-size:19px !important;
    }

    .action-text strong{
        font-size:14px !important;
    }

    .action-text small{
        font-size:11px !important;
        margin-top:4px !important;
    }


    /* TABLE */

    .table-wrap{
        margin-left:-2px;
        margin-right:-2px;
    }

    th,
    td{
        padding:10px;
        font-size:12px;
    }


    /* MOBILE BOTTOM BAR */

    .desktop-footer{
        display:none;
    }

    footer{
        display:none;
    }

    .mobile-bottom-bar{
        position:fixed!important;

        left:8px;
        right:8px;
        bottom:8px;

        height:64px;

        display:grid!important;
        grid-template-columns:repeat(5,1fr);

        background:rgba(255,255,255,.97);

        backdrop-filter:blur(15px);

        border:1px solid #e2e7ef;
        border-radius:18px;

        box-shadow:
            0 10px 35px rgba(20,33,61,.18);

        z-index:99999!important;

        padding:5px;
    }

    .mobile-action{
        display:flex;

        flex-direction:column;

        align-items:center;
        justify-content:center;

        gap:2px;

        min-width:0;

        color:#475467;

        text-decoration:none;

        border-radius:13px;

        transition:.2s ease;
    }

    .mobile-action span{
        font-size:19px;
        line-height:21px;
    }

    .mobile-action small{
        font-size:9px;
        font-weight:700;
        white-space:nowrap;
    }

    .mobile-action:hover,
    .mobile-action:active{
        background:#edf4ff;
        color:#0048a8;
        text-decoration:none;
    }

    .mobile-action.active{
        background:#0048a8;
        color:#fff;
        box-shadow:0 5px 14px rgba(0,72,168,.25);
    }

    .mobile-action.active span{
        transform:translateY(-1px);
    }

    .mobile-action small{
        letter-spacing:.1px;
    }

}


/* =====================================================
   SMALL PHONES
===================================================== */

@media(max-width:380px){

    .grid{
        gap:8px;
    }

    .stat{
        padding:13px 11px;
    }

    .stat b{
        font-size:19px;
    }

    .quick-action-btn{
        min-height:64px !important;
    }

    .mobile-bottom-bar{
        left:5px;
        right:5px;
    }

    .mobile-action span{
        font-size:17px;
    }

    .mobile-action small{
        font-size:8px;
    }

}

.dashboard-greeting{
    background:linear-gradient(135deg,#0048a8,#00357d);
    color:#fff;
    border-radius:20px;
    padding:26px 30px;
    margin-bottom:22px;
    box-shadow:0 10px 30px rgba(0,72,168,.18);
}

.dashboard-greeting .greeting-label{
    font-size:12px;
    font-weight:800;
    letter-spacing:1.5px;
    opacity:.85;
}

.dashboard-greeting h1{
    margin:7px 0 5px;
    font-size:32px;
}

.dashboard-greeting p{
    margin:0;
    font-size:14px;
    opacity:.9;
}

@media(max-width:600px){
    .dashboard-greeting{
        padding:20px;
        border-radius:16px;
    }

    .dashboard-greeting h1{
        font-size:25px;
    }
}


/* =====================================================
   FINAL MOBILE WIDTH FIX - DSR CRM
   Mobile only: keep the whole dashboard inside viewport.
===================================================== */
@media (max-width:600px){
    html, body{
        width:100% !important;
        max-width:100% !important;
        overflow-x:hidden !important;
    }

    .container,
    .dsr-dashboard{
        width:100% !important;
        max-width:100% !important;
        min-width:0 !important;
        box-sizing:border-box !important;
        overflow-x:hidden !important;
    }

    .dsr-dashboard > *,
    .dashboard-grid > *,
    .quick-actions > *,
    .stats-grid > *,
    .panel,
    .panel-head,
    .month-panel,
    .month-box,
    .service-row,
    .service-top{
        min-width:0 !important;
        max-width:100% !important;
        box-sizing:border-box !important;
    }

    .dsr-hero,
    .quick-actions,
    .stats-grid,
    .dashboard-grid{
        width:100% !important;
        max-width:100% !important;
        min-width:0 !important;
        box-sizing:border-box !important;
    }

    .quick-action,
    .stat-card,
    .panel{
        min-width:0 !important;
        max-width:100% !important;
    }

    .service-top{
        overflow:hidden !important;
    }

    .service-name{
        min-width:0 !important;
        max-width:100% !important;
        overflow-wrap:anywhere !important;
        word-break:break-word !important;
    }

    .service-amount{
        flex:0 0 auto !important;
    }

    .invoice-table{
        min-width:0 !important;
    }
}
