/* ═══════════════════════════════════════
   HISAB APP — ADMIN DASHBOARD CSS
   ═══════════════════════════════════════ */

:root {
    --bg: #f7f6f2;
    --wh: #fff;
    --s1: #efeeea;
    --s2: #e5e4de;
    --b1: #d0cfca;
    --b2: #b8b7b0;
    --t1: #171717;
    --t2: #404040;
    --t3: #737373;
    --t4: #a3a3a3;
    --blue: #2563eb;
    --blue2: #1d4ed8;
    --blueL: #dbeafe;
    --green: #16a34a;
    --greenL: #d4edda;
    --greenT: #1e7e34;
    --red: #dc2626;
    --redL: #f8d7da;
    --redT: #bd2130;
    --yel: #ca8a04;
    --yelL: #fff3cd;
    --yelT: #856404;
    --pur: #7c3aed;
    --purL: #ede9fe;
    --org: #ea580c;
    --orgL: #ffedd5;
    --cyan: #0891b2;
    --cyanL: #cffafe;
    --teal: #0d9488;
    --r: 10px;
    --sh: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.03);
    --sh2: 0 2px 8px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    overflow-x: hidden;
}
body {
    font-family: 'Times New Roman', 'SolaimanLipi', Times, serif;
    background: var(--bg);
    color: var(--t1);
    line-height: 1.65;
}
.mono { font-family: 'Times New Roman', 'SolaimanLipi', Times, serif; }

/* ═══ LAYOUT ═══ */
.layout { display: flex; min-height: 100vh; }

/* ═══ SIDEBAR ═══ */
.sidebar {
    width: 260px;
    background: var(--wh);
    border-right: 2px solid var(--b1);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s;
}
.sb-header {
    padding: 16px;
    border-bottom: 1px solid var(--s2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sb-logo { display: flex; align-items: center; gap: 10px; }
.sb-logo-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 900; color: #fff;
}
.sb-title { font-size: 16px; font-weight: 700; }
.sb-subtitle { font-size: 10px; color: var(--t3); }
.sb-close { display: none; background: none; border: none; font-size: 18px; color: var(--t3); cursor: pointer; }
.sb-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.sb-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 8px;
    color: var(--t2); text-decoration: none;
    font-size: 14px; font-weight: 500;
    transition: .2s; margin-bottom: 2px;
}
.sb-link:hover { background: var(--s1); color: var(--t1); }
.sb-link.active { background: var(--blue); color: #fff; font-weight: 600; }
.sb-icon { font-size: 16px; width: 22px; text-align: center; }
.sb-footer { padding: 14px 16px; border-top: 1px solid var(--s2); }
.sb-logout {
    width: 100%; padding: 8px; border: 1px solid var(--b1);
    border-radius: 6px; background: transparent; color: var(--t2);
    font-size: 13px; cursor: pointer; transition: .2s;
}
.sb-logout:hover { background: var(--redL); color: var(--red); border-color: var(--red); }
.sb-user { font-size: 11px; color: var(--t4); margin-top: 6px; text-align: center; }

/* ═══ MAIN CONTENT ═══ */
.main-content { flex: 1; margin-left: 260px; min-height: 100vh; min-width: 0; }
.topbar {
    background: var(--wh);
    border-bottom: 1px solid var(--b1);
    padding: 12px 24px;
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.topbar-menu { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--t2); }
.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-right { margin-left: auto; }
.topbar-date { font-size: 12px; color: var(--t3); }
.page-content { padding: 24px; }

/* ═══ CARDS ═══ */
.card {
    background: var(--wh);
    border: 1px solid var(--b1);
    border-radius: var(--r);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--sh);
}
.card-header {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px; padding-bottom: 12px;
    border-bottom: 1px solid var(--s2);
}
.card-icon {
    width: 34px; height: 34px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; flex-shrink: 0;
}
.card-title { font-size: 15px; font-weight: 700; }
.card-subtitle { font-size: 11px; color: var(--t3); }

/* ═══ STATS GRID ═══ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px; margin-bottom: 16px;
}
.stat-card {
    background: var(--wh);
    border: 1px solid var(--b1);
    border-radius: 8px;
    padding: 14px; text-align: center;
    box-shadow: var(--sh);
    transition: .2s;
}
.stat-card:hover { border-color: var(--blue); box-shadow: var(--sh2); }
.stat-label {
    font-size: 9px; color: var(--t4);
    text-transform: uppercase; letter-spacing: .8px;
    margin-bottom: 3px; font-weight: 700;
}
.stat-value { font-size: 20px; font-weight: 800; }

/* ═══ FORMS ═══ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px; margin-bottom: 14px;
}
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label {
    font-size: 11px; color: var(--t3);
    font-weight: 700; text-transform: uppercase;
    letter-spacing: .4px;
}
.form-control {
    padding: 9px 12px;
    background: var(--wh);
    border: 1.5px solid var(--b1);
    border-radius: 7px;
    color: var(--t1);
    font-size: 14px;
    font-family: inherit;
    transition: .2s;
    width: 100%;
}
.form-control:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23737373' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* ═══ BUTTONS ═══ */
.btn {
    padding: 9px 20px; border: none; border-radius: 7px;
    font-size: 13px; font-weight: 600;
    font-family: inherit; cursor: pointer;
    transition: .2s;
    display: inline-flex; align-items: center; gap: 6px;
    text-decoration: none;
}
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue2); box-shadow: 0 3px 12px rgba(37,99,235,.25); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { box-shadow: 0 3px 12px rgba(22,163,74,.25); }
.btn-red { background: var(--redL); color: var(--red); border: 1px solid rgba(220,38,38,.15); }
.btn-red:hover { background: rgba(220,38,38,.12); }
.btn-ghost { background: transparent; color: var(--t2); border: 1px solid var(--b1); }
.btn-ghost:hover { background: var(--s1); }
.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 5px; }

/* ═══ TABLE ═══ */
.table-wrap { overflow-x: auto; border: 1px solid var(--b1); border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 600px; }
.table th {
    background: var(--s1); padding: 10px 12px;
    text-align: left; font-size: 10px; font-weight: 700;
    color: var(--t3); text-transform: uppercase;
    letter-spacing: .5px; border-bottom: 2px solid var(--b1);
    white-space: nowrap;
}
.table td { padding: 9px 12px; border-bottom: 1px solid var(--s2); vertical-align: middle; }
.table td a:not([class]) { text-decoration: none; color: inherit; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(37,99,235,.02); }

.badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 14px; font-size: 10px; font-weight: 700;
}
.badge-delivery { background: var(--greenL); color: var(--green); }
.badge-pending { background: var(--yelL); color: var(--yel); }
.badge-cancel { background: var(--redL); color: var(--red); }

/* ═══ ALERTS ═══ */
.alert {
    padding: 12px 18px; border-radius: 8px;
    margin-bottom: 16px; font-size: 13px;
}
.alert-success { background: var(--greenL); border: 1px solid rgba(22,163,74,.2); color: var(--green); }
.alert-error { background: var(--redL); border: 1px solid rgba(220,38,38,.2); color: var(--red); }
.alert-info { background: var(--blueL); border: 1px solid rgba(37,99,235,.2); color: var(--blue); }
.alert-warning { background: var(--yelL); border: 1px solid rgba(202,138,4,.2); color: var(--yel); }

/* ═══ EMPLOYEE GRID ═══ */
.emp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px; margin-bottom: 16px;
}
.emp-card {
    background: var(--wh);
    border: 2px solid var(--b1);
    border-radius: var(--r);
    padding: 16px; position: relative;
    transition: .2s;
}
.emp-card:hover { border-color: var(--blue); box-shadow: var(--sh2); }
.emp-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.emp-phone { font-size: 12px; color: var(--t3); }
.emp-stats { display: flex; gap: 12px; margin-top: 8px; }
.emp-stats .item b { display: block; font-size: 15px; color: var(--t1); }
.emp-stats .item span { font-size: 9px; color: var(--t4); text-transform: uppercase; }
.emp-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 4px; }

/* ═══ PDF REPORT STYLES ═══ */
.pdf-page {
    background: var(--wh);
    border: 1px solid var(--b1);
    border-radius: var(--r);
    padding: 36px 28px;
    max-width: 720px;
    margin: 0 auto 20px;
    box-shadow: var(--sh2);
}
.pdf-title { text-align: center; font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.pdf-subtitle { text-align: center; font-size: 13px; color: var(--t3); margin-bottom: 4px; }
.pdf-hr {
    height: 3px; border: none; margin: 12px 0 22px;
    border-radius: 2px;
    background: linear-gradient(90deg, #4a7cc9, var(--teal));
}
.pdf-step {
    background: #dce6f7;
    border-left: 4px solid #4a7cc9;
    border-radius: 0 6px 6px 0;
    padding: 12px 16px;
    margin-bottom: 6px;
}
.pdf-step-title { font-size: 13px; font-weight: 600; color: var(--t2); margin-bottom: 3px; }
.pdf-step-formula { font-family: 'DM Mono', monospace; font-size: 15px; color: var(--t1); font-weight: 500; }
.pdf-result {
    background: #d4edda;
    border-left: 4px solid #28a745;
    border-radius: 0 6px 6px 0;
    padding: 10px 16px; margin-bottom: 4px;
}
.pdf-result-text { font-size: 14px; font-weight: 700; color: #1e7e34; }
.pdf-loss {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    border-radius: 0 6px 6px 0;
    padding: 10px 16px; margin-bottom: 4px;
}
.pdf-loss-text { font-size: 14px; font-weight: 700; color: #bd2130; }
.pdf-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 0 6px 6px 0;
    padding: 10px 16px; margin-bottom: 4px;
}
.pdf-warning-text { font-size: 13px; font-weight: 600; color: #856404; }
.pdf-divider { border: none; border-top: 2px dashed var(--b1); margin: 16px 0; }
.dollar-tag {
    display: inline-block; background: var(--purL); color: var(--pur);
    padding: 1px 7px; border-radius: 3px; font-size: 10px; font-weight: 700;
}
.minus-tag {
    display: inline-block; background: var(--redL); color: var(--red);
    padding: 1px 5px; border-radius: 3px; font-size: 12px; font-weight: 800;
}
.plus-tag {
    display: inline-block; background: var(--greenL); color: var(--green);
    padding: 1px 5px; border-radius: 3px; font-size: 12px; font-weight: 800;
}

/* ═══ EMPTY STATE ═══ */
.empty-state { text-align: center; padding: 50px 20px; color: var(--t3); }
.empty-icon { font-size: 42px; margin-bottom: 10px; opacity: .35; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--t2); margin-bottom: 4px; }

/* ═══ ACTION BAR ═══ */
.action-bar {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px; margin-bottom: 16px;
}
.action-bar-left h2 { font-size: 17px; font-weight: 700; }
.action-bar-left p { font-size: 12px; color: var(--t3); }
.action-bar-right { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ═══ FINAL BOX ═══ */
.final-box {
    background: var(--wh);
    border: 2px solid var(--b1);
    border-radius: 8px;
    padding: 16px;
    margin: 8px 0;
}
.final-row {
    display: flex; justify-content: space-between;
    padding: 8px 0; align-items: center;
}
.final-row + .final-row { border-top: 1px dashed var(--b1); margin-top: 4px; }
.final-name { font-weight: 700; }
.final-amount { font-family: 'DM Mono', monospace; font-weight: 800; font-size: 17px; }
.final-detail { font-size: 10px; color: var(--t3); padding: 2px 0; }

/* ═══ AUTH PAGES ═══ */
.auth-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg); padding: 20px;
}
.auth-card {
    background: var(--wh);
    border: 1px solid var(--b1);
    border-radius: var(--r);
    padding: 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--sh2);
    text-align: center;
}
.auth-logo {
    width: 52px; height: 52px; border-radius: 14px;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 900; color: #fff;
    margin: 0 auto 16px;
}
.auth-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.auth-subtitle { font-size: 13px; color: var(--t3); margin-bottom: 24px; }

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sb-close { display: block; }
    .main-content { margin-left: 0; }
    .topbar { padding: 12px 16px; }
    .topbar-menu { display: block; }
    .page-content { padding: 12px; }
    .form-grid { grid-template-columns: 1fr 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .pdf-page { padding: 20px 14px; }
    
    /* Table Responsive — horizontal scroll */
    .hide-mobile { display: none !important; }
    .table-wrap { overflow-x: auto !important; border: none; }
    .table { font-size: 10px; width: 100%; }
    .table th, .table td { padding: 7px 6px !important; white-space: nowrap !important; }
    .table th { font-size: 9px; }
    .table td a { text-decoration: none !important; color: inherit !important; }
}
@media (max-width: 480px) {
    .form-grid { grid-template-columns: 1fr; }
    .emp-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .modal-box {
        width: calc(100% - 20px) !important;
        max-width: none !important;
        max-height: 92vh;
        overflow-y: auto;
        padding: 16px !important;
        margin: 10px;
        align-self: flex-end;
        border-radius: 12px 12px 0 0;
    }
    .modal-backdrop { align-items: flex-end; }
}

/* ═══ MODAL ═══ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
}
.modal-backdrop.open {
    opacity: 1;
    visibility: visible;
}
.modal-box {
    background: var(--wh);
    border-radius: var(--r);
    box-shadow: var(--sh2);
    padding: 24px;
    width: 100%;
    max-width: 400px;
    transform: translateY(16px);
    transition: transform .2s;
}
.modal-backdrop.open .modal-box {
    transform: translateY(0);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--t1);
}
.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--t4);
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}
.modal-close:hover { background: var(--s1); }
.modal-meta {
    background: var(--s1);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 18px;
    font-size: 13px;
    color: var(--t2);
    display: grid;
    gap: 4px;
}
.modal-meta span { color: var(--t4); font-size: 11px; }
.modal-footer {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* ═══ PRINT ═══ */
@media print {
    .sidebar, .topbar, .action-bar, .btn, .alert, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    .pdf-step, .pdf-result, .pdf-loss, .pdf-warning,
    .dollar-tag, .minus-tag, .plus-tag, .badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
