:root{
    --primary:#4f46e5;
    --primary-dark:#3730a3;
    --accent:#06b6d4;
    --dark:#0f172a;
    --muted:#64748b;
    --bg:#f6f8fc;
    --card:#ffffff;
    --border:#e2e8f0;
    --success:#16a34a;
    --danger:#dc2626;
    --warning:#d97706;
    --shadow:0 18px 45px rgba(15,23,42,.08);
}
*{box-sizing:border-box}
body{margin:0;font-family:Inter,Segoe UI,Arial,sans-serif;background:radial-gradient(circle at top left,#eef2ff 0,#f8fafc 38%,#f6f8fc 100%);color:var(--dark)}
a{text-decoration:none;color:inherit}.container{width:min(1180px,94%);margin:0 auto;padding:28px 0}.topbar{background:rgba(255,255,255,.82);border-bottom:1px solid rgba(226,232,240,.9);position:sticky;top:0;z-index:10;backdrop-filter:blur(16px)}.nav{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px 3%}.brand{font-weight:900;color:var(--dark);font-size:20px;letter-spacing:-.4px}.brand:before{content:"";display:inline-block;width:12px;height:12px;background:linear-gradient(135deg,var(--primary),var(--accent));border-radius:4px;margin-right:9px}.links{display:flex;gap:10px;flex-wrap:wrap}.links a,.logout{padding:10px 14px;border-radius:14px;background:#eef2ff;color:#312e81;font-weight:800;font-size:14px;transition:.2s}.links a:hover{transform:translateY(-1px);background:#e0e7ff}.logout{background:#fff1f2;color:#be123c}.login-body{min-height:100vh;display:grid;place-items:center;background:linear-gradient(135deg,#111827 0%,#312e81 48%,#0891b2 100%);padding:20px;position:relative;overflow:hidden}.login-body:before{content:"";position:absolute;width:420px;height:420px;border-radius:50%;background:rgba(255,255,255,.12);top:-140px;right:-90px}.login-card{position:relative;background:rgba(255,255,255,.94);width:min(440px,100%);border-radius:30px;padding:34px;box-shadow:0 28px 90px rgba(0,0,0,.28);border:1px solid rgba(255,255,255,.55)}.login-card h1{margin:0 0 8px;font-size:30px;letter-spacing:-1px}.login-card p{color:var(--muted);margin:0 0 24px;line-height:1.6}label{display:block;margin:14px 0 7px;font-weight:800;color:#334155}input,select,textarea{width:100%;border:1px solid var(--border);border-radius:14px;padding:12px 14px;font-size:15px;background:#fff;outline:none;transition:.2s}input:focus,select:focus,textarea:focus{border-color:var(--primary);box-shadow:0 0 0 4px rgba(79,70,229,.11)}textarea{min-height:100px;resize:vertical}button,.btn{border:0;background:linear-gradient(135deg,var(--primary),#2563eb);color:#fff;border-radius:14px;padding:12px 17px;font-weight:900;cursor:pointer;display:inline-block;box-shadow:0 10px 22px rgba(79,70,229,.2);transition:.2s}button:hover,.btn:hover{transform:translateY(-1px)}.btn.secondary{background:#111827}.btn.success{background:var(--success)}.btn.danger,button.danger,.small-btn.danger{background:var(--danger)}.btn.warning{background:var(--warning)}.grid{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}.card{background:rgba(255,255,255,.9);border:1px solid rgba(226,232,240,.9);border-radius:26px;padding:24px;box-shadow:var(--shadow);margin-bottom:22px}.card h1,.card h2{margin-top:0;letter-spacing:-.5px}.page-head,.welcome{display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap;margin-bottom:18px}.page-head h1,.welcome h1{margin:0;font-size:34px;letter-spacing:-1px}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:22px}.stat{background:rgba(255,255,255,.9);border:1px solid var(--border);border-radius:24px;padding:20px;box-shadow:var(--shadow);position:relative;overflow:hidden}.stat:after{content:"";position:absolute;right:-25px;top:-25px;width:90px;height:90px;border-radius:50%;background:rgba(79,70,229,.08)}.stat strong{font-size:30px;display:block;margin-top:8px;letter-spacing:-1px}.muted{color:var(--muted)}.table-wrap{overflow:auto;background:#fff;border-radius:24px;border:1px solid var(--border);box-shadow:var(--shadow)}table{width:100%;border-collapse:collapse;min-width:920px}th,td{text-align:left;padding:14px;border-bottom:1px solid var(--border);vertical-align:middle}th{background:#f8fafc;font-size:12px;text-transform:uppercase;color:#475569;letter-spacing:.5px}tr:hover td{background:#fbfdff}.badge{padding:7px 10px;border-radius:99px;font-size:12px;font-weight:900;display:inline-block}.pending{background:#fef3c7;color:#92400e}.approved{background:#dcfce7;color:#166534}.rejected{background:#fee2e2;color:#991b1b}.admin{background:#e0e7ff;color:#3730a3}.employee{background:#cffafe;color:#155e75}.alert{padding:13px 15px;border-radius:16px;margin:12px 0;font-weight:800}.alert.error{background:#fee2e2;color:#991b1b}.alert.success{background:#dcfce7;color:#166534}.filters{display:grid;grid-template-columns:2fr 1fr 1fr 1fr auto;gap:12px;align-items:end}.actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}.file-link{color:var(--primary);font-weight:900}.small-input{min-width:150px;padding:9px 10px;border-radius:12px}.small-btn{padding:9px 12px;border-radius:12px;box-shadow:none;font-size:13px}.inline-form{display:inline-flex;gap:8px;align-items:center}.user-row input,.user-row select{min-width:130px}small{color:var(--muted)}
@media(max-width:900px){.stats{grid-template-columns:repeat(2,1fr)}.filters{grid-template-columns:1fr 1fr}.grid{grid-template-columns:1fr}.page-head h1,.welcome h1{font-size:28px}}
@media(max-width:700px){.nav{align-items:flex-start;flex-direction:column}.links{width:100%}.links a,.logout{flex:1;text-align:center}.container{width:94%;padding:18px 0}.card{padding:18px}.login-card{padding:24px}.filters{grid-template-columns:1fr}table{min-width:780px}}
@media(max-width:480px){.stats{grid-template-columns:1fr}.brand{font-size:18px}.links a,.logout{font-size:13px;padding:9px}.stat strong{font-size:26px}.login-card h1{font-size:26px}}
.simple-stats{grid-template-columns:repeat(3,1fr)}
.invoice-filters{grid-template-columns:2fr 1fr 1fr 1fr 1fr 1fr auto}
.my-filters{grid-template-columns:2fr auto}
.report-filters{grid-template-columns:1fr 1fr auto}
@media(max-width:800px){.simple-stats,.invoice-filters,.my-filters,.report-filters{grid-template-columns:1fr}.grid{grid-template-columns:1fr}.page-head h1,.welcome h1{font-size:28px}.nav{align-items:flex-start;flex-direction:column}.links{width:100%}.links a,.logout{flex:1;text-align:center}}

/* Final mobile improvements */
.invoice-preview-img{width:100%;border-radius:18px;border:1px solid #e5e7eb;display:block}
.invoice-preview-pdf{width:100%;height:520px;border:1px solid #e5e7eb;border-radius:18px;background:#fff}
@media(max-width:768px){
    body{font-size:15px}
    .container{width:100%;padding:14px}
    .card{padding:16px;border-radius:18px}
    .grid{grid-template-columns:1fr!important;gap:12px}
    .stats,.simple-stats{grid-template-columns:1fr!important}
    .nav{flex-direction:column;align-items:flex-start;gap:12px}
    .links{width:100%;display:grid;grid-template-columns:1fr 1fr;gap:8px}
    .links a,.logout{width:100%;text-align:center;padding:10px;font-size:14px}
    input,select,textarea,button,.btn{width:100%;font-size:16px}
    .page-head,.welcome{align-items:stretch}
    .page-head h1,.welcome h1,h1{font-size:24px}
    .filters,.invoice-filters,.my-filters,.report-filters{grid-template-columns:1fr!important}
    .table-wrap{border-radius:16px;overflow-x:auto}
    table{min-width:720px}
    th,td{padding:12px;font-size:14px}
    .invoice-preview-pdf{height:380px}
}
@media(max-width:420px){
    .links{grid-template-columns:1fr}
    .brand{font-size:17px}
    .login-card{padding:20px;border-radius:22px}
    .card{padding:14px}
}


/* Modern dropdown header with smooth animation */
.topbar {
    background: rgba(15, 23, 42, 0.96);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 999;
    backdrop-filter: blur(16px);
}

.nav {
    max-width: 1180px;
    margin: 0 auto;
    padding: 15px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand {
    color: #fff;
    font-size: 21px;
    font-weight: 900;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.brand:before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    border-radius: 4px;
    margin-right: 9px;
}

.menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 9px 13px;
    border-radius: 13px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
}

.menu-icon {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px;
    max-width: 22px !important;
    object-fit: contain;
    display: block;
}

.links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.links > a {
    color: #cbd5e1;
    background: transparent;
    padding: 10px 14px;
    border-radius: 13px;
    font-weight: 800;
    font-size: 14px;
    transition: 0.25s ease;
}

.links > a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.links > a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
}

.profile-dropdown {
    position: relative;
}

.profile-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 800;
    box-shadow: none;
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.profile-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.profile-arrow {
    width: 12px;
    height: 12px;
    object-fit: contain;
    display: inline-block;
    flex: 0 0 auto;
}

.profile-menu {
    position: absolute;
    right: 0;
    top: 50px;
    width: 230px;
    background: #fff;
    color: #0f172a;
    border-radius: 18px;
    padding: 13px;
    box-shadow: 0 24px 55px rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(226, 232, 240, 0.9);
    opacity: 0;
    transform: translateY(-12px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.profile-menu.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.profile-menu span {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

.profile-menu strong {
    display: block;
    margin: 5px 0 13px;
    font-size: 16px;
}

.profile-menu .logout {
    display: block;
    text-align: center;
    background: #ef4444;
    color: #fff;
    padding: 10px 12px;
    border-radius: 13px;
    font-weight: 900;
}

.profile-menu .logout:hover {
    background: #dc2626;
}

@media (max-width: 768px) {
    .nav {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between;
        flex-wrap: wrap;
        padding: 13px 14px;
    }

    .brand {
        font-size: 18px;
        max-width: calc(100% - 62px);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 46px;
        height: 42px;
    }

    .links {
        width: 100%;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transform: translateY(-8px);
        flex-direction: column;
        align-items: stretch;
        background: rgba(15, 23, 42, 0.98);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 18px;
        padding: 0 10px;
        margin-top: 0;
        gap: 8px;
        display: flex !important;
        transition: max-height 0.35s ease, opacity 0.25s ease, transform 0.25s ease, padding 0.25s ease, margin 0.25s ease;
    }

    .links.active {
        max-height: 520px;
        opacity: 1;
        transform: translateY(0);
        padding: 10px;
        margin-top: 12px;
    }

    .links > a,
    .profile-btn {
        width: 100%;
        text-align: center;
        padding: 12px 10px;
        font-size: 14px;
    }

    .profile-dropdown {
        width: 100%;
    }

    .profile-menu {
        position: static;
        width: 100%;
        margin-top: 8px;
        max-height: 0;
        overflow: hidden;
        padding: 0 12px;
        opacity: 0;
        transform: translateY(-8px);
        transition: max-height 0.3s ease, opacity 0.25s ease, transform 0.25s ease, padding 0.25s ease;
    }

    .profile-menu.active {
        max-height: 190px;
        padding: 12px;
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modern File Upload */

.modern-file-upload {
    width: 100%;
}

.modern-file-upload input[type="file"] {
    display: none;
}

.upload-box {
    width: 100%;
    min-height: 150px;
    border: 2px dashed #cbd5e1;
    border-radius: 22px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: 0.25s ease;
    padding: 20px;
    text-align: center;
}

.upload-box:hover {
    border-color: #2563eb;
    background: #eff6ff;
    transform: translateY(-2px);
}

.upload-icon {
    font-size: 42px;
}

.upload-text strong {
    display: block;
    font-size: 18px;
    color: #0f172a;
    margin-bottom: 4px;
}

.upload-text span {
    color: #64748b;
    font-size: 14px;
}

@media (max-width: 768px) {
    .upload-box {
        min-height: 125px;
        border-radius: 18px;
        padding: 16px;
        gap: 10px;
    }

    .upload-icon {
        font-size: 34px;
    }

    .upload-text strong {
        font-size: 16px;
    }

    .upload-text span {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .upload-box {
        min-height: 110px;
        border-radius: 16px;
        padding: 14px;
    }

    .upload-icon {
        font-size: 30px;
    }

    .upload-text strong {
        font-size: 15px;
    }
}


/* Invoice type badges */
.type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.type-badge.tax {
    background: #ecfeff;
    color: #0e7490;
    border: 1px solid #a5f3fc;
}

.type-badge.regular {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

@media (max-width: 768px) {
    select {
        width: 100%;
        font-size: 16px;
    }
}

/* =========================================================
   FINAL RESPONSIVE OVERRIDES - Mobile + Header + Upload
   Put this section at the end of assets/style.css
   ========================================================= */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

img,
iframe,
video {
    max-width: 100%;
}

/* Better action buttons spacing */
.action-buttons,
.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* Modern file upload final override */
.modern-file-upload {
    width: 100%;
    margin-top: 8px;
}

.modern-file-upload input[type="file"] {
    display: none !important;
}

.upload-box {
    width: 100%;
    min-height: 165px;
    border: 2px dashed #3b82f6;
    border-radius: 24px;
    background: linear-gradient(145deg, #f8fafc, #eef4ff);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: 0.25s ease;
}

.upload-box:hover {
    border-color: #2563eb;
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.14);
}

.upload-icon {
    font-size: 48px;
    line-height: 1;
}

.upload-text strong {
    display: block;
    font-size: 19px;
    color: #0f172a;
    margin-bottom: 5px;
}

.upload-text span {
    color: #64748b;
    font-size: 14px;
}

/* Tablet */
@media (max-width: 900px) {
    .container {
        width: 100%;
        padding: 18px 14px;
    }

    .grid,
    .filters,
    .invoice-filters,
    .my-filters,
    .report-filters,
    .stats,
    .simple-stats {
        grid-template-columns: 1fr !important;
    }

    .page-head,
    .welcome {
        align-items: stretch;
    }

    .page-head h1,
    .welcome h1,
    h1 {
        font-size: 26px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    .topbar {
        width: 100%;
    }

    .nav {
        width: 100%;
        padding: 13px 14px !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        gap: 10px;
    }

    .brand {
        font-size: 17px !important;
        max-width: calc(100% - 58px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .menu-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 46px !important;
        height: 42px !important;
        padding: 0 !important;
        flex: 0 0 46px;
    }

    .menu-icon {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px;
        max-width: 24px !important;
    }

    .links {
        display: flex !important;
        width: 100% !important;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transform: translateY(-8px);
        flex-direction: column !important;
        align-items: stretch !important;
        grid-template-columns: unset !important;
        background: rgba(15, 23, 42, 0.98);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 18px;
        padding: 0 10px !important;
        margin-top: 0 !important;
        gap: 8px;
        transition: max-height 0.35s ease, opacity 0.25s ease, transform 0.25s ease, padding 0.25s ease, margin 0.25s ease;
    }

    .links.active {
        max-height: 620px;
        opacity: 1;
        transform: translateY(0);
        padding: 10px !important;
        margin-top: 12px !important;
    }

    .links > a,
    .profile-btn {
        width: 100% !important;
        text-align: center !important;
        padding: 12px 10px !important;
        font-size: 14px !important;
    }

    .profile-dropdown {
        width: 100%;
    }

    .profile-menu {
        position: static !important;
        width: 100% !important;
        margin-top: 8px;
        max-height: 0;
        overflow: hidden;
        padding: 0 12px !important;
        opacity: 0;
        transform: translateY(-8px);
        transition: max-height 0.3s ease, opacity 0.25s ease, transform 0.25s ease, padding 0.25s ease;
    }

    .profile-menu.active {
        max-height: 210px;
        padding: 12px !important;
        opacity: 1;
        transform: translateY(0);
    }

    .container {
        width: 100% !important;
        padding: 14px !important;
    }

    .card {
        padding: 16px !important;
        border-radius: 18px !important;
    }

    input,
    select,
    textarea,
    button,
    .btn,
    .small-btn {
        width: 100%;
        font-size: 16px;
    }

    .inline-form,
    .actions,
    .action-buttons {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .small-input,
    .user-row input,
    .user-row select {
        min-width: 0;
        width: 100%;
    }

    .table-wrap {
        width: 100%;
        overflow-x: auto;
        border-radius: 16px;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 720px;
    }

    th,
    td {
        padding: 11px;
        font-size: 13px;
    }

    .upload-box {
        min-height: 130px;
        border-radius: 18px;
        padding: 18px;
        gap: 10px;
    }

    .upload-icon {
        font-size: 36px;
    }

    .upload-text strong {
        font-size: 16px;
    }

    .upload-text span {
        font-size: 13px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .container {
        padding: 10px !important;
    }

    .brand {
        font-size: 15px !important;
    }

    .brand:before {
        width: 10px;
        height: 10px;
        margin-right: 6px;
    }

    .card {
        padding: 13px !important;
    }

    h1,
    .page-head h1,
    .welcome h1 {
        font-size: 22px !important;
    }

    .login-card {
        padding: 20px !important;
        border-radius: 22px !important;
    }

    table {
        min-width: 650px;
    }

    .upload-box {
        min-height: 112px;
        padding: 14px;
        border-radius: 16px;
    }

    .upload-icon {
        font-size: 30px;
    }

    .upload-text strong {
        font-size: 15px;
    }

    .upload-text span {
        font-size: 12px;
    }
}

/* Mobile buttons beside each other */

.invoice-actions {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}

.invoice-actions .btn {
    flex: 1;
    text-align: center;
}

@media (max-width: 768px) {
    .invoice-actions {
        flex-direction: row !important;
        gap: 10px;
    }

    .invoice-actions .btn {
        width: 50% !important;
        padding: 12px 8px;
        font-size: 14px;
    }
}

@media (max-width: 420px) {
    .invoice-actions .btn {
        font-size: 13px;
        padding: 11px 6px;
    }
}

/* Header profile arrow fix */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.brand:before {
    display: none !important;
}

.brand-logo {
    width: 100px !important;
    height: 80px !important;
    min-width: 100px;
    max-width: 100px !important;
    object-fit: contain;
    display: block;
}

.profile-btn {
    min-height: 42px;
    line-height: 1;
    white-space: nowrap;
}

.profile-btn span {
    display: inline-block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-arrow {
    width: 14px !important;
    height: 14px !important;
    min-width: 14px;
    max-width: 14px !important;
    display: block;
    object-fit: contain;
    flex: 0 0 14px;
}

@media (max-width: 768px) {
    .brand {
        gap: 8px;
        max-width: calc(100% - 58px);
    }

    .brand-logo {
        width: 90px !important;
        height: 70px !important;
        min-width: 90px;
        max-width: 90px !important;
    }

    .brand span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .profile-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        max-width: 100%;
    }

    .profile-btn span {
        max-width: calc(100% - 28px);
    }
}
