/* style.css — mobile layout v3 (2026-05-15) */
:root{
    --navy:#0b1220;
    --navy-2:#111827;
    --slate:#475569;
    --blue:#4f46e5;
    --blue-dark:#4338ca;
    --bg:#f8fafc;
    --surface:#ffffff;
    --border:#e2e8f0;
    --text:#0f172a;
    --muted:#64748b;
    --radius:10px;
    --shadow:0 10px 30px rgba(15, 23, 42, 0.08);
    --commission-green:#15803d;
}




*{
    box-sizing:border-box;
    min-width:0;
}

html,
body{
    margin:0;
    font-family:Inter, "Segoe UI", Roboto, Arial, sans-serif;
    color:var(--text);
    overflow-x:hidden;
    width:100%;
}

a{
    text-decoration:none;
}

.btn-primary,
.btn-ghost{
    height:44px;
    padding:0 18px;
    border-radius:10px;
    font-weight:600;
    font-size:14px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    transition:all .2s ease;
    cursor:pointer;
    border:1px solid transparent;
}

.btn-primary{
    background:var(--blue);
    color:#fff;
}

.btn-primary:hover{
    background:var(--blue-dark);
}

.btn-ghost{
    background:#fff;
    color:var(--navy);
    border-color:var(--border);
}

.btn-ghost:hover{
    background:#f1f5f9;
}

/* Login */
.login-page{
    min-height:100vh;
    background:radial-gradient(circle at top right, #dbeafe 0%, #f8fafc 40%, #eef2ff 100%);
}

.login-shell{
    min-height:100vh;
    display:flex;
    justify-content:center;
    align-items:center;
    padding:24px;
}

.login-card{
    width:100%;
    max-width:440px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:16px;
    box-shadow:var(--shadow);
    padding:28px;
}

.login-brand{
    text-align:center;
    margin-bottom:18px;
}

.login-brand .logo{
    width:170px;
    height:auto;
    object-fit:contain;
    margin-bottom:12px;
}

.login-brand h1{
    margin:0;
    font-size:26px;
}

.login-brand p{
    margin:8px 0 0;
    color:var(--muted);
    font-size:14px;
}

.alert-error{
    display:flex;
    align-items:center;
    gap:8px;
    background:#fef2f2;
    border:1px solid #fecaca;
    color:#b91c1c;
    padding:10px 12px;
    border-radius:10px;
    margin-bottom:14px;
    font-size:14px;
}

.login-form{
    display:flex;
    flex-direction:column;
    gap:8px;
}

.login-form label{
    font-size:13px;
    color:#334155;
    font-weight:600;
    margin-top:6px;
}

.input-wrap{
    position:relative;
}

.input-wrap i{
    position:absolute;
    left:12px;
    top:50%;
    transform:translateY(-50%);
    color:#94a3b8;
}

.input-wrap input{
    width:100%;
    height:46px;
    border:1px solid var(--border);
    border-radius:10px;
    padding:0 14px 0 38px;
    font-size:14px;
    outline:none;
    transition:border-color .2s, box-shadow .2s;
}

.input-wrap input:focus{
    border-color:var(--blue);
    box-shadow:0 0 0 4px rgba(37, 99, 235, 0.12);
}

.login-form .btn-primary{
    width:100%;
    margin-top:10px;
}

/* Dashboard */
.dashboard-page{
    background:var(--bg);
}

.app-shell{
    min-height:100dvh;
    width:100%;
    max-width:100vw;
    overflow-x:hidden;
}

.sidebar{
    background:linear-gradient(180deg, var(--navy), var(--navy-2));
    color:#e2e8f0;
    padding:20px 16px;
    position:fixed;
    top:0;
    left:0;
    width:260px;
    height:100vh;
    z-index:40;
    transition:transform .25s ease;
}

.sidebar-brand{
    display:flex;
    align-items:center;
    gap:10px;
    margin-bottom:24px;
}

.sidebar-brand img{
    width:44px;
    height:44px;
    object-fit:contain;
    border-radius:8px;
    background:#fff;
}

.sidebar-brand strong{
    display:block;
    color:#fff;
    font-size:14px;
}

.sidebar-brand span{
    color:#94a3b8;
    font-size:12px;
}

.side-nav{
    display:flex;
    flex-direction:column;
    gap:6px;
}

.side-nav a{
    color:#cbd5e1;
    padding:11px 12px;
    border-radius:10px;
    font-size:14px;
    font-weight:500;
    display:flex;
    align-items:center;
    gap:10px;
    transition:all .2s ease;
}

.side-nav a:hover{
    background:rgba(148, 163, 184, 0.12);
    color:#fff;
}

.side-nav a.active{
    background:rgba(37, 99, 235, 0.22);
    color:#fff;
}

.main-content{
    margin-left:260px;
    padding:22px;
    width:calc(100% - 260px);
    max-width:100%;
    overflow-x:hidden;
}

.top-header{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:14px;
    box-shadow:var(--shadow);
    padding:20px;
    display:grid;
    grid-template-columns:minmax(260px, 360px) 1fr auto;
    align-items:center;
    gap:14px;
    margin-bottom:18px;
}

.top-header-left{
    display:flex;
    align-items:center;
    gap:10px;
}

.menu-btn{
    width:40px;
    height:40px;
    border-radius:10px;
    border:1px solid var(--border);
    background:#fff;
    color:var(--navy);
    cursor:pointer;
    display:none;
}

.menu-btn:hover{
    background:#f1f5f9;
}

.header-search{
    display:flex;
    align-items:center;
    gap:8px;
    width:100%;
    border:1px solid var(--border);
    border-radius:10px;
    padding:0 12px;
    height:42px;
    color:#94a3b8;
    background:#fff;
}

.header-search input{
    border:0;
    outline:none;
    width:100%;
    font-size:14px;
    background:transparent;
}

.top-header-center{
    min-width:0;
}

.top-header-title-row{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:12px 16px;
}

.top-header h1{
    margin:0;
    font-size:24px;
}

.top-header p{
    margin:6px 0 0;
    color:var(--muted);
    font-size:14px;
}

.month-filter-form{
    display:flex;
    align-items:center;
    gap:8px;
    flex-shrink:0;
}

.month-filter-label{
    font-size:13px;
    font-weight:600;
    color:#334155;
    white-space:nowrap;
}

.month-select{
    height:40px;
    min-width:140px;
    padding:0 12px;
    border:1px solid var(--border);
    border-radius:10px;
    font-size:14px;
    font-weight:500;
    color:var(--text);
    background:#fff;
    cursor:pointer;
    outline:none;
    transition:border-color .2s, box-shadow .2s;
}

.month-select:hover{
    border-color:#cbd5e1;
}

.year-select{
    min-width:96px;
}

.month-select:focus{
    border-color:var(--blue);
    box-shadow:0 0 0 4px rgba(79, 70, 229, 0.12);
}

.coupon-combobox-wrap{
    position:relative;
}

.coupon-combobox{
    position:relative;
    width:100%;
    max-width:100%;
}

.coupon-suggest-panel{
    position:absolute;
    top:calc(100% + 4px);
    left:0;
    right:0;
    z-index:50;
    max-height:250px;
    overflow-y:auto;
    overflow-x:hidden;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:10px;
    box-shadow:var(--shadow);
    padding:4px;
    scrollbar-width:thin;
    scrollbar-color:#cbd5e1 #f1f5f9;
}

.coupon-suggest-panel::-webkit-scrollbar{
    width:8px;
}

.coupon-suggest-panel::-webkit-scrollbar-track{
    background:#f1f5f9;
    border-radius:8px;
}

.coupon-suggest-panel::-webkit-scrollbar-thumb{
    background:#cbd5e1;
    border-radius:8px;
}

.coupon-suggest-panel::-webkit-scrollbar-thumb:hover{
    background:#94a3b8;
}

.coupon-suggest-item{
    display:block;
    width:100%;
    text-align:left;
    padding:10px 12px;
    margin:0;
    border:0;
    border-radius:8px;
    background:transparent;
    font-size:14px;
    color:var(--text);
    cursor:pointer;
    font-family:inherit;
    transition:background .15s ease;
}

.coupon-suggest-item:hover,
.coupon-suggest-item:focus{
    background:#f1f5ff;
    outline:none;
}

.top-header-actions{
    display:flex;
    align-items:center;
    gap:10px;
}

.user-chip{
    height:40px;
    padding:0 12px;
    border-radius:10px;
    background:#f8fafc;
    border:1px solid var(--border);
    display:flex;
    align-items:center;
    gap:8px;
    font-size:13px;
    color:#334155;
    font-weight:600;
}

.stat-grid{
    display:grid;
    grid-template-columns:repeat(3, minmax(0, 1fr));
    gap:14px;
    margin-bottom:18px;
}

.stat-card{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:14px;
    box-shadow:var(--shadow);
    padding:16px;
    display:flex;
    align-items:center;
    gap:12px;
    background-image:linear-gradient(120deg, rgba(79,70,229,.05), rgba(15,23,42,.02));
}

.stat-icon{
    width:42px;
    height:42px;
    border-radius:12px;
    display:flex;
    align-items:center;
    justify-content:center;
    color:#fff;
}

.stat-icon.navy{background:#1e293b;}
.stat-icon.blue{background:#2563eb;}
.stat-icon.slate{background:#475569;}

.stat-card h3{
    margin:0;
    font-size:20px;
}

.stat-card p{
    margin:4px 0 0;
    color:var(--muted);
    font-size:13px;
}

.panel-card{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:14px;
    box-shadow:var(--shadow);
    padding:18px;
    margin-bottom:18px;
}

.chart-wrap{
    display:flex;
    flex-direction:column;
    height:280px;
    width:100%;
    max-width:100%;
}

.chart-wrap .empty-inline{
    align-self:center;
}

.empty-inline{
    margin:0;
    padding:24px;
    color:var(--muted);
    font-size:14px;
    display:flex;
    align-items:center;
    justify-content:center;
}

.activity-list{
    list-style:none;
    margin:0;
    padding:0;
    display:flex;
    flex-direction:column;
    gap:10px;
}

.activity-item{
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 14px;
    border:1px solid var(--border);
    border-radius:12px;
    background:#fafbff;
    transition:background .2s ease;
}

.activity-item:hover{
    background:#f1f5ff;
}

.activity-icon{
    width:40px;
    height:40px;
    border-radius:12px;
    background:rgba(79,70,229,.12);
    color:var(--blue);
    display:flex;
    align-items:center;
    justify-content:center;
    flex-shrink:0;
}

.activity-body{
    flex:1;
    min-width:0;
    display:flex;
    flex-direction:column;
    gap:4px;
}

.activity-body strong{
    font-size:14px;
}

.activity-meta{
    font-size:13px;
    color:var(--muted);
    word-break:break-word;
}

.activity-amount{
    font-size:14px;
    font-weight:700;
    flex-shrink:0;
}

.panel-head h2{
    margin:0;
    font-size:18px;
}

.panel-head p{
    margin:6px 0 14px;
    color:var(--muted);
    font-size:14px;
}

.filter-grid{
    display:grid;
    grid-template-columns:2fr 1fr 1fr auto;
    gap:12px;
    align-items:end;
}

.field-group{
    display:flex;
    flex-direction:column;
    gap:6px;
}

.field-group label{
    font-size:13px;
    font-weight:600;
    color:#334155;
}

.field-group input{
    width:100%;
    height:44px;
    border:1px solid var(--border);
    border-radius:10px;
    padding:0 12px;
    font-size:14px;
    outline:none;
    transition:border-color .2s, box-shadow .2s;
}

.field-group input:focus{
    border-color:var(--blue);
    box-shadow:0 0 0 4px rgba(37, 99, 235, 0.12);
}

.filter-actions{
    display:flex;
    gap:8px;
}

.table-wrap{
    display:block;
    width:100%;
    max-width:100%;
    overflow-x:auto;
    overflow-y:visible;
    -webkit-overflow-scrolling:touch;
}

.report-table{
    width:100%;
    border-collapse:separate;
    border-spacing:0;
    table-layout:fixed;
}

.report-table th,
.report-table td{
    border-bottom:1px solid var(--border);
    padding:12px 10px;
    text-align:left;
    font-size:14px;
    white-space:normal;
    word-break:break-word;
    overflow-wrap:anywhere;
}

.report-table th{
    background:#f8fafc;
    color:#334155;
    font-size:13px;
    text-transform:uppercase;
    letter-spacing:.03em;
}

.report-table tr:hover td{
    background:#f8fbff;
}

.report-table small{
    color:var(--muted);
}

.report-table small.commission-pct{
    color:var(--commission-green);
    font-weight:600;
}

.total-commission-earned{
    color:var(--commission-green);
}

.total-commission-earned .woocommerce-Price-amount{
    color:var(--commission-green);
}

.report-table .col-sr{width:6%;}
.report-table .col-order{width:16%;}
.report-table .col-date{width:12%;}
.report-table .col-coupon{width:15%;}
.report-table .col-product{width:18%;}
.report-table .col-total{width:15%;}
.report-table .col-commission{width:18%;}

.report-table td.col-order{
    /*display: grid lanes;*/
    -webkit-line-clamp:3;
    -webkit-box-orient:vertical;
    overflow:hidden;
}

.empty-state{
    text-align:center;
    color:var(--muted);
    padding:20px 0;
}

.pagination{
    margin-top:18px;
    display:flex;
    flex-wrap:wrap;
    gap:6px;
}

.pagination a,
.pagination span{
    min-width:38px;
    height:38px;
    padding:0 10px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:10px;
    border:1px solid var(--border);
    color:#334155;
    background:#fff;
    font-weight:600;
    font-size:13px;
}

.pagination a:hover{
    border-color:var(--blue);
    color:var(--blue);
}

.pagination a.active{
    background:var(--blue);
    border-color:var(--blue);
    color:#fff;
}

.pagination .nav-btn{
    background:#f8fafc;
}

.footer-modern{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:14px;
    box-shadow:var(--shadow);
    padding:14px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:10px;
    color:var(--muted);
    font-size:14px;
}

.footer-modern img{
    width:34px;
    height:34px;
    object-fit:contain;
}

@media (min-width:769px) and (max-width:1100px){
    .filter-grid{
        grid-template-columns:1fr 1fr;
    }
    .filter-actions{
        grid-column:1 / -1;
    }
}

@media (max-width:920px){
    .sidebar{
        transform:translateX(-100%);
    }
    .sidebar.open{
        transform:translateX(0);
    }
    .main-content{
        margin-left:0;
        width:100%;
        padding:16px;
    }
    .top-header{
        grid-template-columns:1fr;
    }
    .menu-btn{
        display:inline-flex;
        align-items:center;
        justify-content:center;
    }
    .top-header-left{
        width:100%;
    }
    .stat-grid{
        grid-template-columns:1fr;
    }
    .top-header-actions{
        width:100%;
        justify-content:space-between;
    }
}

/* Mobile layout — max-width 768px (highest priority overrides) */
@media screen and (max-width:768px){
    html,
    body{
        overflow-x:hidden !important;
        max-width:100vw;
    }

    .app-shell{
        width:100% !important;
        max-width:100vw !important;
        overflow-x:hidden !important;
    }

    .sidebar{
        transform:translateX(-100%) !important;
    }

    .sidebar.open{
        transform:translateX(0) !important;
    }

    .main-content{
        margin-left:0 !important;
        width:100% !important;
        max-width:100% !important;
        padding:12px 14px !important;
        overflow-x:hidden !important;
        box-sizing:border-box !important;
    }

    .menu-btn{
        display:inline-flex !important;
        align-items:center;
        justify-content:center;
        flex-shrink:0;
    }

    .top-header{
        display:flex !important;
        flex-direction:column !important;
        align-items:stretch !important;
        grid-template-columns:unset !important;
        padding:14px 16px !important;
        margin-bottom:14px !important;
        gap:12px !important;
        width:100% !important;
        max-width:100% !important;
        box-sizing:border-box !important;
    }

    .top-header-left{
        order:1 !important;
        width:100% !important;
        max-width:100% !important;
        min-width:0 !important;
    }

    .top-header-center{
        order:2 !important;
        width:100% !important;
        max-width:100% !important;
        min-width:0 !important;
    }

    .top-header-actions{
        order:3 !important;
        width:100% !important;
        max-width:100% !important;
        min-width:0 !important;
    }

    .top-header h1{
        font-size:20px !important;
        line-height:1.3 !important;
        word-wrap:break-word;
    }

    .top-header p{
        font-size:13px !important;
        line-height:1.45 !important;
    }

    .top-header-title-row{
        flex-direction:column !important;
        align-items:flex-start !important;
        gap:10px !important;
        width:100% !important;
    }

    .month-filter-form{
        flex-direction:column !important;
        align-items:stretch !important;
        width:100% !important;
        gap:10px !important;
    }

    .month-filter-label{
        white-space:normal !important;
    }

    .month-select,
    .year-select{
        width:100% !important;
        max-width:100% !important;
        min-width:0 !important;
    }

    .top-header-actions{
        flex-wrap:wrap !important;
        justify-content:flex-start !important;
        gap:8px !important;
    }

    .user-chip{
        max-width:100% !important;
    }

    .stat-grid{
        display:flex !important;
        flex-direction:column !important;
        grid-template-columns:1fr !important;
        gap:12px !important;
        margin-bottom:14px !important;
        width:100% !important;
    }

    .stat-card{
        width:100% !important;
        max-width:100% !important;
        min-width:0 !important;
        padding:14px 16px !important;
        box-sizing:border-box !important;
    }

    .stat-card h3{
        font-size:18px !important;
        word-break:break-word;
    }

    .stat-card p{
        word-break:break-word;
    }

    .panel-card{
        width:100% !important;
        max-width:100% !important;
        padding:14px 16px !important;
        margin-bottom:14px !important;
        border-radius:12px !important;
        box-sizing:border-box !important;
    }

    .panel-head h2{
        font-size:17px !important;
        line-height:1.35 !important;
        overflow-wrap:break-word !important;
    }

    .panel-head p{
        font-size:13px !important;
        line-height:1.5 !important;
        margin-bottom:12px !important;
        overflow-wrap:break-word !important;
    }

    .filter-grid,
    #reports-filter-form.filter-grid{
        display:flex !important;
        flex-direction:column !important;
        grid-template-columns:1fr !important;
        gap:14px !important;
        width:100% !important;
        align-items:stretch !important;
    }

    .filter-grid > *,
    #reports-filter-form.filter-grid > *{
        width:100% !important;
        max-width:100% !important;
        min-width:0 !important;
        grid-column:auto !important;
    }

    .field-group,
    .field-wide,
    .coupon-combobox-wrap,
    .coupon-combobox{
        width:100% !important;
        max-width:100% !important;
    }

    .field-group label{
        font-size:12px !important;
    }

    .field-group input,
    .coupon-combobox input{
        width:100% !important;
        max-width:100% !important;
        min-height:44px !important;
        font-size:16px !important;
        box-sizing:border-box !important;
    }

    .filter-actions{
        display:flex !important;
        flex-direction:column !important;
        width:100% !important;
        gap:10px !important;
        grid-column:auto !important;
    }

    .filter-actions .btn-primary,
    .filter-actions .btn-ghost,
    .filter-actions a.btn-ghost{
        width:100% !important;
        min-height:44px !important;
        box-sizing:border-box !important;
    }

    .table-wrap{
        display:block !important;
        width:100% !important;
        max-width:100% !important;
        overflow-x:auto !important;
        overflow-y:visible !important;
        -webkit-overflow-scrolling:touch !important;
        touch-action:pan-x;
        margin:0 !important;
        padding-bottom:8px !important;
        box-sizing:border-box !important;
    }

    .report-table{
        display:table !important;
        width:max-content !important;
        min-width:720px !important;
        max-width:none !important;
        table-layout:auto !important;
    }

    .report-table .col-sr,
    .report-table .col-order,
    .report-table .col-date,
    .report-table .col-coupon,
    .report-table .col-product,
    .report-table .col-total,
    .report-table .col-commission{
        width:auto !important;
        min-width:4.5rem;
    }

    .report-table th,
    .report-table td{
        font-size:12px !important;
        padding:10px 8px !important;
        white-space:nowrap !important;
        word-break:normal !important;
        overflow-wrap:normal !important;
    }

    .report-table th{
        font-size:11px !important;
    }

    .report-table td.col-order{
        -webkit-line-clamp:unset !important;
        overflow:visible !important;
        white-space:nowrap !important;
    }

    .chart-wrap{
        height:220px !important;
        max-width:100% !important;
    }

    .activity-item{
        flex-wrap:wrap !important;
        gap:10px !important;
        padding:10px 12px !important;
    }

    .activity-amount{
        width:100% !important;
        text-align:right !important;
    }

    .pagination{
        justify-content:center !important;
    }

    .footer-modern{
        flex-wrap:wrap !important;
        text-align:center !important;
        padding:12px 14px !important;
    }
}

@media screen and (max-width:620px){
    .login-card{
        padding:20px;
    }

    .main-content{
        padding:10px 12px !important;
    }

    .panel-card{
        padding:12px 14px !important;
    }
}

/* v2 mobile — ensures overrides win over all prior breakpoints */
@media screen and (max-width:768px){
    .stat-grid{
        display:flex !important;
        flex-direction:column !important;
    }

    .filter-grid,
    form.filter-grid{
        display:flex !important;
        flex-direction:column !important;
    }

    .table-wrap{
        width:100% !important;
        overflow-x:auto !important;
    }
}
