/* Invoice Tracker - modern application shell */
:root{--app-accent:#1769e8;--nav:#071b2e;--nav2:#0d2944;--ink:#0b1f43;--muted:#647898;--line:#dce7f3;--soft:#f4f8fd;--card:#fff;--green:#0b9b5b;--red:#e64552;--orange:#ef9b24;--shadow:0 8px 28px rgba(20,58,105,.06)}
*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;background:linear-gradient(135deg,#f5f9ff 0,#eef5fd 48%,#f7faff 100%);color:var(--ink)}body.modal-open{overflow:hidden}a{text-decoration:none;color:inherit}button,input,select,textarea{font:inherit}.app{display:flex;min-height:100vh}.sidebar{width:250px;background:linear-gradient(180deg,#061b2d,#08243d 70%,#061b2d);color:#d9e5f1;position:fixed;inset:0 auto 0 0;padding:14px 12px 10px;z-index:100;display:flex;flex-direction:column;min-height:0;overflow:hidden;box-shadow:8px 0 25px rgba(3,20,36,.08)}.sidebar-nav{flex:1;min-height:0;overflow:auto;padding:4px 2px;scrollbar-width:thin;scrollbar-color:#385873 transparent}.sidebar-nav::-webkit-scrollbar{width:5px}.sidebar-nav::-webkit-scrollbar-thumb{background:#385873;border-radius:99px}.brand{min-height:62px;display:flex;align-items:center;gap:10px;color:#fff;padding:2px 9px 12px;border-bottom:1px solid rgba(255,255,255,.08);margin-bottom:9px}.brand-logo{width:38px;height:38px;border-radius:11px;background:linear-gradient(135deg,#0b8ee9,#18c8a5);display:grid;place-items:center;font-weight:900;color:#fff;box-shadow:0 7px 18px rgba(14,155,219,.22);overflow:hidden}.brand-logo img{width:100%;height:100%;display:block;object-fit:contain;background:#fff;border-radius:11px}.brand strong{display:block;font-size:15px;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.brand small{display:block;font-size:9px;color:#9eb4ca;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nav-item,.nav-group-toggle{display:flex;align-items:center;gap:11px;width:100%;min-height:42px;padding:0 12px;border:0;border-radius:9px;margin:3px 0;color:#d0ddea;background:transparent;font-size:13px;cursor:pointer;text-align:left}.nav-item:hover,.nav-item.active,.nav-group[open]>.nav-group-toggle{background:linear-gradient(90deg,#1769ea,#125bd2);color:#fff;box-shadow:0 7px 16px rgba(23,105,232,.18)}.nav-icon,.nav-group-icon{width:20px;text-align:center;font-size:17px;flex:0 0 auto}.section{text-transform:uppercase;font-size:10px;letter-spacing:1.4px;color:#7890a7;padding:17px 12px 6px}.logout{color:#ff626d!important;margin-top:8px}.nav-group{margin:3px 0}.nav-group-toggle{justify-content:space-between;list-style:none}.nav-group-toggle::-webkit-details-marker{display:none}.nav-group-label{display:flex;align-items:center;gap:11px}.nav-group-arrow{transition:.18s}.nav-group[open] .nav-group-arrow{transform:rotate(180deg)}.nav-group-menu{display:grid;gap:2px;padding:2px 0 4px 30px}.nav-sub-item{display:flex;align-items:center;gap:8px;min-height:34px;padding:0 9px;border-radius:7px;color:#9fb2c5;font-size:11px}.nav-sub-item:hover,.nav-sub-item.active{background:#0e3557;color:#fff}.sidebar-user{display:flex;align-items:center;gap:9px;border-top:1px solid rgba(255,255,255,.08);padding:10px 7px 1px;margin-top:5px}.sidebar-user b,.sidebar-user small{display:block}.sidebar-user b{font-size:10px;color:#fff}.sidebar-user small{font-size:8px;color:#8da7bf;margin-top:2px}
.main{margin-left:250px;width:calc(100% - 250px);min-width:0}.topbar{height:66px;background:rgba(255,255,255,.94);border-bottom:1px solid #dfe8f3;display:flex;align-items:center;justify-content:space-between;padding:0 24px;position:sticky;top:0;z-index:120;backdrop-filter:blur(12px)}.topbar-left{display:flex;align-items:center;gap:18px;min-width:0}.topbar-page-title{display:flex;flex-direction:column;justify-content:center;min-width:0}.topbar-page-title .eyebrow{font-size:9px;line-height:1.1;margin-bottom:2px}.topbar-page-title h1{margin:0;color:#0c2350;font-size:20px;line-height:1.15;letter-spacing:-.25px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-menu{display:none;border:0;background:none;color:#0b2c59;font-size:23px;cursor:pointer}.top-search{height:40px;width:min(600px,46vw);background:#eef5fd;border:1px solid #e0eaf5;border-radius:8px;display:flex;align-items:center;padding:0 12px;gap:8px;color:#24538e}.top-search span{font-size:22px}.top-search input{border:0;outline:0;background:transparent;width:100%;color:#163665;font-size:13px}.top-actions{display:flex;align-items:center;gap:10px}.top-icon-button{position:relative;width:38px;height:38px;border:0;background:transparent;border-radius:9px;display:grid;place-items:center;color:#09275c;font-size:20px;cursor:pointer}.top-icon-button:hover{background:#eef5fd}.notification-dot{position:absolute;right:2px;top:0;min-width:16px;height:16px;border-radius:99px;background:#e33b42;color:#fff;font-size:9px;display:grid;place-items:center}.profile-menu{position:relative;border-left:1px solid #e1e9f2;padding-left:10px}.profile-trigger{border:0;background:transparent;display:flex;align-items:center;gap:9px;cursor:pointer;color:#0c2350}.profile-copy{text-align:left;min-width:105px}.profile-copy b,.profile-copy small{display:block}.profile-copy b{font-size:12px}.profile-copy small{font-size:10px;color:#60799d;margin-top:2px}.profile-chevron{font-size:18px}.profile-dropdown{position:absolute;right:0;top:calc(100% + 10px);width:250px;background:#fff;border:1px solid #dbe6f1;border-radius:13px;box-shadow:0 18px 45px rgba(15,46,84,.16);padding:8px;z-index:200}.profile-dropdown[hidden]{display:none}.profile-dropdown-head{display:flex;gap:9px;align-items:center;padding:10px;border-bottom:1px solid #edf2f7;margin-bottom:6px}.profile-dropdown-head b,.profile-dropdown-head small{display:block}.profile-dropdown-head b{font-size:12px}.profile-dropdown-head small{font-size:9px;color:#7186a4;margin-top:3px;white-space:nowrap;max-width:175px;overflow:hidden;text-overflow:ellipsis}.profile-dropdown>a{display:flex;gap:9px;align-items:center;padding:10px;border-radius:8px;font-size:11px;color:#29486f}.profile-dropdown>a:hover{background:#f1f6fc}.profile-dropdown .danger-link{color:#d73542}.avatar{width:32px;height:32px;border-radius:50%;display:grid;place-items:center;background:#eaf2ff;color:#1769e8;font-weight:800;overflow:hidden}.avatar-large{width:38px;height:38px}.page-shell{min-height:calc(100vh - 66px)}.page-header-line{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:17px 26px 5px}.page-header-line h1,.page-title-only h1{margin:2px 0 0;font-size:25px;line-height:1.1;letter-spacing:-.4px}.eyebrow{font-size:10px;color:#7890ad}.page-breadcrumb{display:flex;align-items:center;gap:8px;color:#7890ad;font-size:11px}.page-breadcrumb a{color:#1769e8}.page-title-only{padding:18px 26px 5px}.content{padding:14px 18px 28px;max-width:1700px;margin:0 auto;overflow-x:hidden}.grid{display:grid;gap:14px}.stats{grid-template-columns:repeat(4,minmax(0,1fr))}.two{grid-template-columns:repeat(2,minmax(0,1fr))}.three{grid-template-columns:repeat(3,minmax(0,1fr))}.four{grid-template-columns:repeat(4,minmax(0,1fr))}.card{background:rgba(255,255,255,.96);border:1px solid #dce6f1;border-radius:13px;padding:16px;box-shadow:var(--shadow)}.card h2,.card h3{margin-top:0;color:#0c2350}.stat-label{font-size:11px;color:#6b819f}.stat-value{font-size:26px;font-weight:850;margin-top:6px;color:#0b224a}.muted{color:#7185a2;font-size:11px}.toolbar{display:flex;gap:10px;align-items:center;justify-content:space-between;margin-bottom:13px;flex-wrap:wrap}.actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.btn{border:0;border-radius:8px;padding:9px 13px;font-weight:750;font-size:11px;cursor:pointer;background:var(--app-accent);color:#fff;white-space:nowrap;box-shadow:0 4px 10px rgba(23,105,232,.12)}.btn:hover{filter:brightness(.96)}.btn.secondary{background:#edf3fa;color:#29486f;box-shadow:none}.btn.success{background:#0b9b5b}.btn.danger{background:#e64552}.btn.small{padding:7px 10px}.input,.select,.textarea{width:100%;border:1px solid #cfdeed;border-radius:8px;padding:9px 10px;background:#fff;color:#17355f;font-size:12px;outline:none}.input:focus,.select:focus,.textarea:focus{border-color:#5a9af0;box-shadow:0 0 0 3px rgba(23,105,232,.08)}.field{margin-bottom:12px}.field label{display:block;font-size:10px;font-weight:750;color:#405a7d;margin-bottom:5px}.table-wrap{overflow:auto;max-width:100%}.table{width:100%;border-collapse:collapse;font-size:11px}.table th{background:#f2f6fb;color:#45617f;text-align:left;font-weight:750}.table td,.table th{padding:10px 9px;border-bottom:1px solid #e7eef6;white-space:nowrap}.table tbody tr:hover{background:#f9fbfe}.badge{display:inline-flex;align-items:center;padding:4px 8px;border-radius:999px;font-size:9px;font-weight:800;background:#edf3fa}.badge.green{background:#e5f8ef;color:#168258}.badge.red{background:#ffe8eb;color:#d93c4d}.badge.blue{background:#e6efff;color:#1c62d3}.badge.orange{background:#fff0db;color:#b76b08}.folder-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:14px}.folder{border:1px solid #e2eaf3;background:#fff;border-radius:12px;padding:16px;min-height:115px;display:flex;flex-direction:column;justify-content:space-between}.folder-icon{font-size:26px}.folder-title{font-weight:750;font-size:12px}.breadcrumbs{display:flex;gap:8px;align-items:center;font-size:11px;color:#7a8da8;margin-bottom:14px}.empty{text-align:center;padding:35px;color:#7b8da7}.pagination{display:flex;justify-content:flex-end;gap:6px;padding-top:13px}.kpi{font-size:10px;color:#697d99}.list{display:grid;gap:8px}.list-row{display:flex;justify-content:space-between;padding:10px 0;border-bottom:1px solid #edf2f7;font-size:11px}.right{text-align:right}.notice{padding:11px 13px;border-radius:9px;background:#edf5ff;color:#28558d;font-size:11px;margin-bottom:13px}.notice.success{background:#eafaf2;color:#087443}.notice.error{background:#fff0f1;color:#b4232c}
.modal-backdrop{position:fixed;inset:0;background:rgba(7,24,45,.48);backdrop-filter:blur(3px);display:none;align-items:center;justify-content:center;z-index:1000;padding:18px}.modal-backdrop.show{display:flex}.modal{background:#fff;border:1px solid #dbe5f0;border-radius:14px;width:min(760px,100%);max-height:calc(100dvh - 36px);overflow:auto;padding:18px;box-shadow:0 25px 70px rgba(6,31,60,.24)}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.form-grid .full{grid-column:1/-1}.product-modal-header{display:flex;align-items:flex-start;justify-content:space-between;gap:15px;padding-bottom:12px;border-bottom:1px solid #e7edf5;margin-bottom:14px}.product-modal-header h3{margin:0}.product-modal-close{width:32px;height:32px;border:0;border-radius:8px;background:#f0f4f9;color:#304a6d;cursor:pointer;font-size:18px}.product-modal-footer{display:flex;justify-content:flex-end;gap:8px;padding-top:14px;border-top:1px solid #e7edf5;margin-top:14px}.inline-form{display:inline-flex}.chart{height:230px;display:flex;align-items:end;gap:7px;padding:16px}.bar{flex:1;background:var(--app-accent);border-radius:5px 5px 0 0;min-height:10px}.page-title-only+.content{}
/* Global modern popup / toast layer */
.app-popup-backdrop{position:fixed;inset:0;background:rgba(5,20,40,.5);backdrop-filter:blur(4px);display:none;align-items:center;justify-content:center;padding:18px;z-index:5000}.app-popup-backdrop.open{display:flex}.app-popup{width:min(440px,100%);background:#fff;border:1px solid #dbe6f1;border-radius:17px;box-shadow:0 28px 80px rgba(5,28,57,.26);padding:22px;text-align:center}.app-popup-icon{width:52px;height:52px;border-radius:15px;background:#eaf2ff;color:#1769e8;display:grid;place-items:center;margin:0 auto 12px;font-size:22px}.app-popup.danger .app-popup-icon{background:#fff0f1;color:#e64552}.app-popup h3{margin:0;color:#0b2148;font-size:18px}.app-popup p{margin:8px 0 0;color:#6e829e;font-size:11px;line-height:1.55}.app-popup-actions{display:flex;justify-content:center;gap:8px;margin-top:18px}.app-toast{position:fixed;right:20px;bottom:20px;width:min(380px,calc(100% - 40px));padding:13px 15px;background:#fff;border:1px solid #dbe6f1;border-radius:12px;box-shadow:0 16px 40px rgba(8,31,61,.16);z-index:5100;display:flex;gap:10px;align-items:flex-start;animation:toastIn .22s ease}.app-toast b{font-size:11px;color:#12325a}.app-toast span{display:block;font-size:10px;color:#7085a1;margin-top:2px}@keyframes toastIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
@media(max-width:1100px){.stats,.four{grid-template-columns:repeat(2,minmax(0,1fr))}.three{grid-template-columns:1fr 1fr}.top-search{width:40vw}.profile-copy{display:none}}
@media(max-width:900px){.sidebar{transform:translateX(-100%);transition:.2s}.sidebar-open .sidebar{transform:none}.sidebar-open::after{content:"";position:fixed;inset:0;background:rgba(5,20,35,.45);z-index:90}.main{margin-left:0;width:100%}.mobile-menu{display:block}.topbar{padding:0 14px}.top-search{width:min(52vw,480px)}.page-header-line{padding:14px 16px 3px}.content{padding:12px}.three{grid-template-columns:1fr 1fr}.form-grid{grid-template-columns:1fr}}
@media(max-width:650px){.stats,.two,.three,.four{grid-template-columns:1fr}.topbar{height:60px}.top-search{display:none}.topbar-left{gap:4px}.top-actions{gap:3px}.page-header-line{align-items:flex-start}.page-header-line h1,.page-title-only h1{font-size:21px}.page-breadcrumb{display:none}.content{padding:10px}.card{padding:13px}.profile-trigger{padding:0}.profile-dropdown{right:-4px;width:240px}.sidebar{width:270px}}
body.density-compact .content{padding-top:8px;padding-bottom:18px}body.density-spacious .content{padding-top:24px;padding-bottom:36px}
body.theme-dark{--ink:#e8f1ff;--muted:#9fb2c8;--line:#27415d;--soft:#0b2034;--card:#102a43;background:#071b2d;color:#e8f1ff}body.theme-dark .topbar,body.theme-dark .card,body.theme-dark .modal,body.theme-dark .profile-dropdown,body.theme-dark .settings-card,body.theme-dark .settings-unit-panel,body.theme-dark .company-card,body.theme-dark .company-options,body.theme-dark .appearance-card,body.theme-dark .preview-card,body.theme-dark .system-card,body.theme-dark .notification-card,body.theme-dark .ds-panel,body.theme-dark .ds-preview,body.theme-dark .report-card,body.theme-dark .dash-card,body.theme-dark .dash-stat,body.theme-dark .profile-card{background:#102a43;border-color:#27415d;color:#e8f1ff}body.theme-dark .page-header-line h1,body.theme-dark .page-title-only h1,body.theme-dark h2,body.theme-dark h3,body.theme-dark h4,body.theme-dark .dash-stat strong,body.theme-dark .report-kpi strong{color:#f0f6ff}body.theme-dark .input,body.theme-dark .select,body.theme-dark .textarea,body.theme-dark .top-search{background:#0b2034;border-color:#31506d;color:#e8f1ff}body.theme-dark .table th,body.theme-dark .dash-table th{background:#0b2034;color:#a9bed3}body.theme-dark .table td,body.theme-dark .dash-table td{border-color:#27415d;color:#d8e5f3}body.theme-dark .settings-card-links,body.theme-dark .muted,body.theme-dark .page-breadcrumb,body.theme-dark .reports-head p,body.theme-dark .dash-head p{color:#9fb2c8}
@media(prefers-color-scheme:dark){body.theme-auto{--ink:#e8f1ff;--muted:#9fb2c8;--line:#27415d;background:#071b2d;color:#e8f1ff}body.theme-auto .topbar,body.theme-auto .card,body.theme-auto .dash-card,body.theme-auto .report-card,body.theme-auto .settings-card{background:#102a43;border-color:#27415d;color:#e8f1ff}}
.sidebar-collapse-button{display:none;position:absolute;right:-13px;bottom:58px;width:27px;height:27px;border-radius:50%;border:1px solid #cbd9e8;background:#fff;color:#173d68;box-shadow:0 4px 14px rgba(0,0,0,.12);z-index:3;cursor:pointer;font-size:18px}.sidebar-collapsible .sidebar-collapse-button{display:grid;place-items:center}.sidebar-collapsed .sidebar{width:78px;padding-left:9px;padding-right:9px}.sidebar-collapsed .main{margin-left:78px;width:calc(100% - 78px)}.sidebar-collapsed .brand{justify-content:center;padding-left:0;padding-right:0}.sidebar-collapsed .brand>div,.sidebar-collapsed .nav-item>span:last-child,.sidebar-collapsed .nav-group-label>span:last-child,.sidebar-collapsed .nav-group-arrow,.sidebar-collapsed .section,.sidebar-collapsed .nav-sub-item>span:last-child,.sidebar-collapsed .sidebar-user>div{display:none}.sidebar-collapsed .nav-item,.sidebar-collapsed .nav-group-toggle{justify-content:center;padding:0}.sidebar-collapsed .nav-group-menu{padding-left:0}.sidebar-collapsed .sidebar-user{justify-content:center}.sidebar-collapsed .sidebar-collapse-button{transform:rotate(180deg)}@media(max-width:900px){.sidebar-collapsible .sidebar-collapse-button{display:none}.sidebar-collapsed .sidebar{width:270px}.sidebar-collapsed .main{margin-left:0;width:100%}}

/* Page titles are rendered in the master topbar. Keep page content focused on its actual controls/forms. */
.invoice-page-heading > div:first-child,
.invoice-list-heading > div:first-child,
.invoice-detail-heading > div:first-child,
.invoice-preview-heading > div:first-child,
.return-list-heading > div:first-child,
.product-page-header > div:first-child,
.product-price-heading > div:first-child,
.add-stock-page-header > div:first-child,
.um-page-head > .um-title-wrap,
.profile-page-head > div:first-child,
.company-head > div:first-child,
.reports-head > div:first-child,
.dash-head > div:first-child,
.system-head > div:first-child,
.notification-head > div:first-child,
.ds-head > div:first-child,
.sg-page-header > div:first-child,
.appearance-head > div:first-child,
.invoice-settings-heading > div:first-child,
.return-heading > div:first-child { display:none !important; }

.invoice-page-heading:has(> .invoice-heading-actions),
.invoice-list-heading:has(> .btn),
.invoice-detail-heading:has(> .actions),
.invoice-preview-heading:has(> .actions),
.return-list-heading:has(> .return-list-actions),
.product-page-header:has(> .product-header-actions),
.reports-head:has(> .report-date-filter),
.dash-head:has(> .dash-date),
.profile-page-head:has(> .btn),
.ds-head:has(> .btn) { justify-content:flex-end; }

.invoice-settings-heading:has(> div:only-child),
.return-heading:has(> div:only-child),
.product-price-heading:has(> div:only-child),
.add-stock-page-header:has(> div:only-child),
.company-head:has(> div:only-child),
.system-head:has(> div:only-child),
.notification-head:has(> div:only-child),
.appearance-head:has(> div:only-child) { display:none !important; }

.topbar-page-title + .top-actions{margin-left:auto}

@media(max-width:650px){.topbar-page-title h1{font-size:16px}.topbar-page-title .eyebrow{font-size:8px}.topbar-left{gap:8px}.topbar-page-title{max-width:52vw}}

/* Database-driven appearance preferences */
body.font-size-small{font-size:13px}body.font-size-normal{font-size:14px}body.font-size-large{font-size:16px}
body.font-family-inter{font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif}
body.font-family-system-ui{font-family:system-ui,-apple-system,"Segoe UI",sans-serif}
body.font-family-poppins{font-family:Poppins,Inter,ui-sans-serif,system-ui,sans-serif}
body.layout-boxed .content{max-width:1450px}body.layout-fluid .content{max-width:1700px}
body.rounded-disabled .card,body.rounded-disabled .settings-card,body.rounded-disabled .company-card,body.rounded-disabled .appearance-card,body.rounded-disabled .system-card,body.rounded-disabled .notification-card,body.rounded-disabled .ds-panel,body.rounded-disabled .ds-preview,body.rounded-disabled .profile-card,body.rounded-disabled .btn,body.rounded-disabled .input,body.rounded-disabled .select,body.rounded-disabled .textarea{border-radius:3px}
body.animations-disabled *,body.animations-disabled *::before,body.animations-disabled *::after{transition:none!important;animation:none!important}
body.breadcrumb-disabled .page-breadcrumb{display:none!important}body.page-header-disabled .page-header-line,body.page-header-disabled .page-title-only{display:none!important}
