:root {
    --primary: #1b1533;
    --sidebar-bg: #120c24;
    --bg-app: #17112b;
    --bg-card: #251d43;
    --bg-card-alt: #2c2350;
    --border-subtle: #3d3164;
    --accent: #7339f0;
    --accent-hover: #5b28c9;
    --accent-soft: rgba(115, 57, 240, 0.16);
    --success: #10b981;
    --danger: #ef4444;
    --info: #3b82f6;
    --warning: #f59e0b;
    --text-main: #374151;
    --text-light: #6b7280;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: 'Inter', sans-serif; margin: 0; padding: 0; background: #edf2f7; color: var(--text-main); overflow-x: hidden; }

.erp-wrapper { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* LEFT-MOST NAVIGATION BAR */
.erp-sidebar { width: 240px; background: var(--sidebar-bg); color: white; display: flex; flex-direction: column; padding: calc(20px + var(--safe-top)) 0 20px 0; flex-shrink: 0; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1000; padding-left: var(--safe-left); }
.erp-logo-row { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.erp-logo { padding: 0 20px 20px 20px; border-bottom: 1px solid #221a3c; width: 100%; }
.brand-lockup { display: flex; align-items: flex-start; gap: 10px; }
.brand-mark { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; margin-top: 2px; filter: drop-shadow(0 2px 6px rgba(115, 57, 240, 0.45)); }
.brand-wordmark { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-wordmark strong { font-size: 0.88rem; font-weight: 700; color: #f8fafc; }
.menu-toggle-btn { display: none; background: var(--bg-card); border: 1px solid var(--border-subtle); color: white; font-size: 20px; padding: 6px 12px; border-radius: 8px; cursor: pointer; margin-right: 20px; margin-bottom: 16px; min-height: 44px; min-width: 44px; }
.nav-links { list-style: none; padding: 0; margin: 20px 0; overflow-y: auto; }
.nav-links li { padding: 14px 25px; display: flex; align-items: center; gap: 12px; cursor: pointer; color: #94a3b8; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.nav-links li:hover, .nav-links li.active { background: var(--bg-card-alt); color: white; border-left: 4px solid var(--accent); }
.nav-links li .icon { font-size: 1.2rem; }

/* DYNAMIC MODULE VISIBILITY CONTROLLER GRID */
.workspace-grid { flex: 1; display: block; height: 100%; overflow: hidden; background: var(--bg-app); }
.workspace-grid.split-billing-view { display: grid; grid-template-columns: 400px 1fr; background: #e6e2f5; }

/* FORMS PANEL HOUSING SCROLLER */
.form-workspace-scroller { display: flex; flex-direction: column; height: 100%; overflow-y: auto; background: var(--primary); }
.split-billing-view .form-workspace-scroller { border-right: 1px solid var(--border-subtle); }

/* FORMS WORKSPACE BODY CLEAN ACCENT BOUNDS */
.form-workspace {
    color: white;
    padding: 40px 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    flex: 1;
}
.split-billing-view .form-workspace { max-width: 100%; padding: 30px 20px; }

.erp-module { display: none; animation: moduleFade 0.2s ease-in-out forwards; }
.erp-module.active { display: block; }
.erp-module h2 { font-size: 1.3rem; margin-top: 0; margin-bottom: 25px; color: #f1f5f9; letter-spacing: -0.25px; padding-left: 12px; border-left: 3px solid var(--accent); }

/* PREMIUM FORM STYLING */
.input-group { margin-bottom: 20px; }
label { display: block; font-size: 11px; text-transform: uppercase; color: #94a3b8; margin-bottom: 7px; font-weight: 600; letter-spacing: 0.5px; }
input, select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-card);
    background-image: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.06));
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
    color: white;
    font-family: inherit;
    font-size: 13.5px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    min-height: 44px;
}
input::placeholder { color: #6b7290; }
input:hover, select:hover { border-color: #4a3c78; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18), 0 0 0 3px var(--accent-soft); background-color: var(--bg-card-alt); }
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.06)), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: 0 0, right 14px center;
    padding-right: 34px;
}

/* SERVICE ROWS */
.item-input-row { display: flex; gap: 6px; margin-bottom: 10px; align-items: center; }
.delete-row-btn { background: transparent; border: none; color: #ef4444; font-size: 20px; cursor: pointer; min-width: 36px; min-height: 36px; border-radius: 8px; transition: background 0.15s ease; flex-shrink: 0; }
.delete-row-btn:hover { background: rgba(239, 68, 68, 0.12); }

/* BUTTON SYSTEMS */
.action-btn { width: 100%; padding: 13px; background: var(--accent); color: white; border: none; border-radius: 9px; font-weight: 700; cursor: pointer; letter-spacing: 0.2px; box-shadow: 0 4px 14px rgba(115, 57, 240, 0.35); transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease; min-height: 46px; }
.action-btn:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(115, 57, 240, 0.45); }
.action-btn:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(115, 57, 240, 0.35); }
.action-btn-blue { width: 100%; padding: 13px; background: #3b82f6; color: white; border: none; border-radius: 9px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3); transition: transform 0.15s ease, box-shadow 0.15s ease; min-height: 46px; }
.action-btn-blue:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(59, 130, 246, 0.4); }
.secondary-btn { width: 100%; padding: 11px; background: var(--bg-card-alt); border: 1px solid var(--border-subtle); color: white; border-radius: 9px; margin: 15px 0; cursor: pointer; font-size: 12px; font-weight: 500; transition: background 0.15s ease, transform 0.15s ease; min-height: 42px; }
.secondary-btn:hover { background: #362a5c; transform: translateY(-1px); }
.danger-btn { width: 100%; padding: 10px; background: #7f1d1d; color: white; border: none; border-radius: 9px; cursor: pointer; font-size: 12px; transition: background 0.15s ease; min-height: 40px; }
.danger-btn:hover { background: #991b1b; }

/* HIGH INTERACTIVITY COMPONENT RULES */
.interactive-card {
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}
.interactive-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
.metric-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.metric-arrow {
    font-size: 14px;
    font-weight: 700;
    opacity: 0.5;
    transition: transform 0.2s ease;
}
.interactive-card:hover .metric-arrow {
    transform: translateX(3px);
    opacity: 1;
}
.dashboard-shortcut-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 5px;
}

/* INTERACTIVE ACTIVITY TIMELINE LIST LAYER */
.live-activity-badge {
    font-size: 9px;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.dashboard-timeline-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}
.timeline-event-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--bg-card-alt);
    border: 1px solid var(--bg-card);
    padding: 12px;
    border-radius: 8px;
    animation: moduleFade 0.25s ease-out;
}
.timeline-icon-shield {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.timeline-event-body {
    flex: 1;
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.4;
    min-width: 0;
}
.timeline-event-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 10px;
    color: #64748b;
}

/* BRAND INFRASTRUCTURE LOW-PROFILE STATUS BAR */
.erp-workspace-footer {
    background: var(--sidebar-bg);
    border-top: 1px solid var(--bg-card);
    padding: 12px 30px calc(12px + var(--safe-bottom)) 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #64748b;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 8px;
}
.split-billing-view .erp-workspace-footer { padding: 12px 20px calc(12px + var(--safe-bottom)) 20px; }
.footer-meta-item { display: flex; align-items: center; gap: 6px; }
.footer-meta-item span { color: #94a3b8; }
.footer-copyright { font-weight: 500; letter-spacing: 0.25px; }

/* PULSING BADGES FOR METRIC TRACKING */
.meta-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.meta-dot.pulse-blue { background: #3b82f6; box-shadow: 0 0 6px #3b82f6; animation: blueStatusPulse 2.5s infinite; }

/* PREVIEW CANVAS ROUTING STATES */
.preview-workspace { display: none; background: #e6e2f5; padding: 40px; height: 100%; overflow-y: auto; flex-direction: column; align-items: center; }
.split-billing-view .preview-workspace { display: flex; }
.action-bar { width: 210mm; max-width: 100%; margin-bottom: 20px; }

/* PREMIUM INTUITIVE DOCUMENT STYLES */
.document {
    width: 210mm; min-height: 297mm;
    max-width: 100%;
    background: #ffffff !important;
    color: #1e293b !important;
    padding: 40px !important;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
}

.doc-accent-bar {
    position: absolute;
    top: 0; left: 0; right: 0; height: 6px;
    background: linear-gradient(90deg, #7339f0, #a78bfa);
}

.doc-header-block {
    display: flex; justify-content: space-between; align-items: flex-start;
    border-bottom: 2px solid #f1f5f9; padding-bottom: 25px; margin-bottom: 30px;
}

#docBrandName { color: #0f172a !important; font-size: 26px; font-weight: 800; letter-spacing: -0.5px; margin: 0; }
.brand-tagline { color: #64748b !important; font-size: 12px; margin: 3px 0 15px 0; font-weight: 500; }
.brand-details p { font-size: 11px; color: #334155 !important; margin: 2px 0; }
.doc-invoice-meta { text-align: right; }
#displayDocType { font-size: 28px; font-weight: 800; color: #0f172a !important; letter-spacing: 1px; margin: 0 0 10px 0; }
.meta-grid { font-size: 11px; color: #475569 !important; display: flex; flex-direction: column; gap: 4px; }
.meta-grid strong { color: #0f172a !important; }

.status-badge { display: inline-block; padding: 5px 12px; background: #ecfdf5; color: #059669; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; margin-bottom: 15px; }
.invoice-parties { display: flex; justify-content: space-between; margin-bottom: 35px; gap: 20px; }
.party-box { flex: 1; background: #f8fafc; padding: 16px; border-radius: 6px; border: 1px solid #e2e8f0; }
.party-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b !important; font-weight: 700; display: block; margin-bottom: 6px; }
#displayClientName { color: #0f172a !important; font-size: 16px; font-weight: 700; margin: 0 0 2px 0; }
.party-subtext { font-size: 11px; color: #94a3b8 !important; margin: 0; }
.status-zone { max-width: 200px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }

.table-responsive-wrapper { width: 100%; overflow-x: auto; margin-bottom: 30px; -webkit-overflow-scrolling: touch; }
.items-table { width: 100% !important; border-collapse: collapse !important; min-width: 480px; }
.items-table th { background: #f1f5f9 !important; color: #334155 !important; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 10px 14px !important; border: none !important; }
.items-table td { padding: 12px 14px !important; border-bottom: 1px solid #e2e8f0 !important; color: #334155 !important; font-size: 12px; }
.items-table tbody tr:last-child td { border-bottom: 2px solid #cbd5e1 !important; }

.invoice-summary-block { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 25px; gap: 15px; }
.ref-box { background: #fff; border: 1px dashed #cbd5e1; padding: 10px 14px; border-radius: 4px; display: inline-block; margin-bottom: 0; }
.ref-title { font-size: 9px; text-transform: uppercase; color: #64748b !important; font-weight: 600; display: block; margin-bottom: 2px; }
#displayRef { font-family: monospace; font-size: 12px; font-weight: 700; color: #0f172a !important; margin: 0; }
.summary-calculations { width: 250px; max-width: 100%; }
.master-total { background: #0f172a !important; color: #ffffff !important; padding: 14px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; }
.master-total span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
#finalTotal { font-size: 18px; font-weight: 800; margin: 0; color: #b794f6 !important; }

/* AUTHENTICITY VERIFICATION PANEL */
.verification-panel { margin-top: 15px; display: flex; align-items: center; gap: 10px; background: #f5f3ff; border: 1px dashed #c4b5fd; border-radius: 6px; padding: 10px 14px; }
.verification-panel .verify-qr { flex-shrink: 0; width: 84px; height: 84px; background: #fff; padding: 4px; border-radius: 4px; line-height: 0; }
.verification-panel .verify-qr svg { width: 100%; height: 100%; display: block; }
.verification-panel .verify-copy { flex: 1; min-width: 0; }
.verification-panel .verify-title { font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; color: #6d28d9 !important; font-weight: 700; display: block; margin-bottom: 2px; }
.verification-panel .verify-code { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 13px; font-weight: 700; color: #4c1d95 !important; letter-spacing: 0.75px; word-break: break-all; }
.verification-panel .verify-note { font-size: 9px; color: #7c6ba8 !important; margin: 2px 0 0 0; line-height: 1.4; }

/* CORPORATE REMITTANCE PANEL */
.settlement-details-panel { margin-top: 15px; padding-top: 20px; border-top: 1px solid #e2e8f0; margin-bottom: 30px; }
.settlement-heading { margin: 0 0 12px 0; font-size: 11px; text-transform: uppercase; letter-spacing: 0.75px; color: #475569 !important; font-weight: 700; }
.settlement-grid { display: flex; gap: 20px; }
.settlement-method { flex: 1; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 14px; min-width: 0; }
.settlement-method h6 { margin: 0 0 8px 0; font-size: 12px; font-weight: 700; color: #0f172a !important; border-bottom: 1px dashed #cbd5e1; padding-bottom: 4px; }
.settlement-method p { margin: 4px 0; font-size: 11px; color: #334155 !important; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.settlement-method p span { color: #64748b !important; text-align: left; }
.settlement-method p strong { color: #0f172a !important; font-weight: 600; text-align: right; }

.doc-logo-mark { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; }

.doc-footer { border-top: 1px solid #e2e8f0; padding-top: 20px; text-align: center; margin-top: auto; }
.footer-channels { display: flex; justify-content: center; gap: 20px; font-size: 10px; color: #475569 !important; margin-bottom: 8px; flex-wrap: wrap; }
.footer-channels strong { color: #0f172a !important; }
.footer-legal-notice { font-size: 9px; color: #94a3b8 !important; margin: 0; line-height: 1.4; }

.watermark { position: absolute; top: 45%; left: 50%; transform: translate(-50%, -50%) rotate(-15deg); font-size: 90px; font-weight: 900; color: rgba(16, 185, 129, 0.08) !important; border: 8px solid rgba(16, 185, 129, 0.08); padding: 10px 40px; border-radius: 12px; text-transform: uppercase; letter-spacing: 4px; pointer-events: none; display: none; }

/* PREMIUM CARD & LIST ARCHITECTURE */
.form-card { background: linear-gradient(180deg, var(--bg-card), var(--bg-card-alt)); padding: 16px; border-radius: 12px; margin-bottom: 20px; border: 1px solid var(--border-subtle); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); }
.data-list { display: flex; flex-direction: column; gap: 8px; margin-top: 15px; }
.data-row-card { background: var(--bg-card); padding: 12px 14px; border-radius: 9px; display: flex; justify-content: space-between; align-items: center; gap: 10px; color: white; font-size: 13px; border-left: 3px solid var(--accent); transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease; }
.data-row-card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3); background: var(--bg-card-alt); }
.data-row-card.accent-blue { border-left-color: #3b82f6; }
.data-row-card .row-body { min-width: 0; }
.row-delete-btn { background: none; border: none; color: #f87171; cursor: pointer; font-size: 18px; padding: 6px 8px; border-radius: 8px; transition: background 0.15s ease; flex-shrink: 0; min-width: 36px; min-height: 36px; }
.row-delete-btn:hover { background: rgba(248, 113, 113, 0.15); }
.finance-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.metric { padding: 12px; border-radius: 10px; color: white; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18); }
.metric span { font-size: 10px; text-transform: uppercase; opacity: 0.8; }
.metric div { font-size: 16px; font-weight: bold; margin-top: 4px; }
.bg-green { background: #064e3b; }
.bg-red { background: #7f1d1d; }

.version-tag { display: inline-block; font-size: 9px; background: var(--bg-card); color: var(--accent); padding: 2px 6px; border-radius: 4px; font-weight: 700; margin-top: 4px; letter-spacing: 0.5px; }
.sync-status-wrapper { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 6px 10px; background: var(--bg-card); border-radius: 8px; border: 1px solid var(--bg-card-alt); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; transition: all 0.3s ease-in-out; }
.sync-text { font-size: 10px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; }
.sync-dot.live { background: #10b981; box-shadow: 0 0 8px #10b981; animation: statusPulse 2s infinite; }
.sync-text.live { color: #10b981; }
.sync-dot.diagnostics { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.sync-text.diagnostics { color: #f59e0b; }

@keyframes statusPulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 14px #10b981; }
    100% { transform: scale(0.95); opacity: 0.8; }
}
@keyframes moduleFade {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes blueStatusPulse {
    0% { transform: scale(0.95); opacity: 0.6; box-shadow: 0 0 4px #3b82f6; }
    50% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 10px #3b82f6; }
    100% { transform: scale(0.95); opacity: 0.6; box-shadow: 0 0 4px #3b82f6; }
}

/* NOTIFICATION PORTAL TOAST CONTAINER */
.toast-container { position: fixed; top: calc(20px + var(--safe-top)); right: calc(20px + var(--safe-right)); left: 20px; z-index: 99999; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; }
.custom-toast { background: rgba(37, 29, 67, 0.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: #cbd5e1; padding: 14px 20px; border-radius: 10px; font-size: 13px; font-weight: 500; width: 100%; min-width: 0; max-width: 380px; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4); display: flex; align-items: center; gap: 12px; pointer-events: auto; transform: translateX(120%); animation: toastSlideIn 0.3s forwards, toastFadeOut 0.3s 3.5s forwards; border-left: 4px solid #64748b; }
.custom-toast.success { border-left-color: #10b981; }
.custom-toast.error { border-left-color: #ef4444; }
.custom-toast.warning { border-left-color: #f59e0b; }
.custom-toast.info { border-left-color: #3b82f6; }
.toast-icon { font-size: 16px; font-weight: bold; display: flex; align-items: center; justify-content: center; }
.custom-toast.success .toast-icon { color: #10b981; }
.custom-toast.error .toast-icon { color: #ef4444; }
.custom-toast.warning .toast-icon { color: #f59e0b; }
.custom-toast.info .toast-icon { color: #3b82f6; }
.toast-message { flex: 1; line-height: 1.4; }
@keyframes toastSlideIn { to { transform: translateX(0); } }
@keyframes toastFadeOut { to { opacity: 0; transform: translateY(-10px); visibility: hidden; } }

/* AUTHENTICATION OVERLAY PORTAL */
.auth-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh; background: rgba(14, 10, 28, 0.97); z-index: 999999; display: flex; align-items: center; justify-content: center; padding: calc(20px + var(--safe-top)) calc(20px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(20px + var(--safe-left)); }
.auth-card { background: var(--bg-card); border: 1px solid var(--bg-card-alt); padding: 35px; border-radius: 14px; width: 100%; max-width: 400px; box-shadow: 0 20px 40px rgba(0,0,0,0.5); }
.auth-header { text-align: center; }
.auth-logo { width: 56px; height: 56px; object-fit: contain; margin-bottom: 14px; filter: drop-shadow(0 4px 10px rgba(115, 57, 240, 0.4)); }
.auth-header h2 { color: #f8fafc; font-size: 18px; letter-spacing: 0.25px; margin-bottom: 6px; }
.auth-header p { color: #94a3b8; font-size: 12px; line-height: 1.4; margin-bottom: 25px; }
.auth-btn { width: 100%; background: var(--accent); color: white; border: none; padding: 13px; border-radius: 9px; font-weight: 700; font-size: 13px; cursor: pointer; margin-top: 25px; box-shadow: 0 4px 14px rgba(115, 57, 240, 0.35); transition: background 0.2s ease, transform 0.15s ease; letter-spacing: 0.25px; min-height: 46px; }
.auth-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* ==========================================
   MOBILE DESIGN FRAMEWORK (BREAKPOINTS)
   ========================================== */
@media (max-width: 1024px) {
    .erp-wrapper { flex-direction: column; height: auto; overflow: visible; }

    .erp-sidebar { width: 100%; padding: calc(15px + var(--safe-top)) var(--safe-right) 15px var(--safe-left); border-bottom: 1px solid var(--bg-card); height: auto; }
    .erp-logo-row { padding: 0; margin: 0; }
    .erp-logo { border-bottom: none; padding: 0 0 0 20px; }
    .menu-toggle-btn { display: block; }

    .sidebar-collapsible-content { display: none; width: 100%; padding: 0 20px; }
    .erp-sidebar.menu-open { background: #0d0821; }
    .erp-sidebar.menu-open .sidebar-collapsible-content { display: block; }

    .sync-status-wrapper { margin-top: 12px; }
    .nav-links { display: flex; flex-direction: column; margin: 15px 0 0 0; border-top: 1px solid var(--bg-card); padding-top: 10px; }
    .nav-links li { padding: 12px 10px; border-left: none !important; border-radius: 8px; min-height: 44px; }
    .nav-links li.active { background: var(--bg-card-alt); border-left: none; padding-left: 15px; color: var(--accent); }

    .workspace-grid { display: block !important; height: auto; overflow: visible; }
    .form-workspace-scroller { height: auto; overflow: visible; }
    .form-workspace { border-left: none; padding: 25px 20px; border-bottom: 1px solid var(--border-subtle); height: auto; max-width: 100%; }
    .preview-workspace { padding: 25px 15px; overflow-y: visible; width: 100%; height: auto; }

    .action-bar, .document { width: 100%; max-width: 100%; min-width: 0; }
    .document { min-height: auto; padding: 30px 20px !important; }
    .doc-header-block { flex-direction: column; gap: 20px; align-items: stretch; }
    .doc-invoice-meta { text-align: left; border-top: 1px dashed #e2e8f0; padding-top: 15px; }

    .invoice-parties { flex-direction: column; gap: 12px; }
    .status-zone { max-width: 100%; width: 100%; }
    .invoice-summary-block { flex-direction: column; align-items: stretch; gap: 15px; }
    .summary-calculations { width: 100%; }
    .settlement-grid { flex-direction: column; gap: 15px; }

    .erp-workspace-footer { padding: 15px 20px calc(15px + var(--safe-bottom)) 20px; flex-direction: column; gap: 10px; text-align: center; }
    .dashboard-shortcut-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .form-workspace, .split-billing-view .form-workspace { padding: 18px 14px; }
    .preview-workspace { padding: 16px 10px; }
    .finance-metrics { grid-template-columns: 1fr; }
    .erp-module h2 { font-size: 1.15rem; margin-bottom: 18px; }
    .auth-card { padding: 24px 20px; }
    .form-card { padding: 14px; }

    /* Stack line-item rows: description gets its own line, qty/price/remove share the next */
    .item-input-row { flex-wrap: wrap; }
    .item-input-row .item-desc { flex: 1 1 100%; order: -1; margin-bottom: 6px; }
    .item-input-row .item-qty { width: 64px; }
    .item-input-row .item-unit-price { flex: 1; }

    .document { padding: 22px 16px !important; }
    #docBrandName { font-size: 20px; }
    #displayDocType { font-size: 22px; }
    .verification-panel { flex-direction: column; align-items: flex-start; }

    /* Line-items table: stack each row into a labeled card instead of
       relying on horizontal scroll, so every column stays readable
       without the reader needing to swipe sideways on a receipt. */
    .table-responsive-wrapper { overflow-x: visible; }
    .items-table { min-width: 0; }
    .items-table thead { display: none; }
    .items-table, .items-table tbody, .items-table tr, .items-table td { display: block; width: 100%; }
    .items-table tr { border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
    .items-table tr:last-child { border-bottom: 1px solid #e2e8f0 !important; }
    .items-table td { display: flex !important; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px !important; border-bottom: 1px solid #f1f5f9 !important; text-align: right !important; }
    .items-table td:last-child { border-bottom: none !important; }
    .items-table td::before { content: attr(data-label); font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; color: #94a3b8; font-weight: 700; flex-shrink: 0; }
    .items-table td:first-child { background: #f8fafc; text-align: left !important; }
    .items-table td:first-child::before { display: none; }
}

/* PRINT COMPILATION MATRIX CLEANUP */
@media print {
    @page { size: A4; margin: 0; }
    body { background: white; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .no-print { display: none !important; }
    .erp-wrapper, .workspace-grid { display: block; height: auto; }
    .preview-workspace { padding: 0; background: white; width: 210mm; display: flex !important; }
    .document { box-shadow: none; border-radius: 0; width: 210mm; height: 297mm; padding: 50px 80px !important; }
    .settlement-method { background: #f8fafc !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .verification-panel { background: #f5f3ff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .doc-footer { position: absolute; bottom: 50px; left: 80px; right: 80px; }
}
