/* ==========================================================================
   ERP ENTERPRISE ARCHITECTURAL THEME DEFINITIONS & VARIABLES
   ========================================================================== */
:root {
    --bg-main: #f8fafc;
    --bg-side: #0f172a;
    --text-main: #1e293b;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --white: #ffffff;
    --border: #cbd5e1;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --success: #10b981;
    --danger: #ef4444;
}

.dark-mode {
    --bg-main: #0b0f19;
    --bg-side: #030712;
    --text-main: #f1f5f9;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --white: #1f2937;
    --border: #374151;
    --card-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3);
}

/* ==========================================================================
   GLOBAL BASE RESET & TRANSITIONS
   ========================================================================== */
* {
    box-sizing: border-box;
    transition: background-color 0.25s ease, color 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
    margin: 0; 
    background: var(--bg-main); 
    color: var(--text-main); 
    overflow-x: hidden;
}

/* ==========================================================================
   AUTHENTICATION SCREEN OVERLAY FRAME
   ========================================================================== */
.auth-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-main);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.auth-gate-card {
    background: var(--white);
    padding: 35px;
    border-radius: 12px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
}

.auth-logo-brand {
    text-align: center;
    margin-bottom: 20px;
}

.auth-logo-brand h2 {
    margin: 10px 0 2px;
    color: var(--accent);
}

.auth-logo-brand p {
    margin: 0;
    font-size: 13px;
    opacity: 0.7;
}

.auth-divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* ==========================================================================
   CHIEF ACCOUNTANT STRIP LAYOUT MATRIX
   ========================================================================== */
.accountant-bar {
    background: #f1f5f9;
    border-bottom: 2px solid #cbd5e1;
    padding: 10px 30px;
}

.dark-mode .accountant-bar {
    background: #1e293b;
    border-bottom: 2px solid #374151;
}

.workspace-wrap {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 13px;
}

.workspace-wrap select {
    width: auto;
    padding: 5px 10px;
    margin: 0;
}

/* ==========================================================================
   BASE MASTER FRAMEWORK SYSTEM LAYOUT
   ========================================================================== */
.container { 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
}

.master-header { 
    background: var(--white); 
    padding: 15px 30px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    border-bottom: 4px solid var(--accent); 
    box-shadow: var(--card-shadow);
    flex-wrap: wrap;
    gap: 15px;
}

.header-logo-container {
    display: flex;
    align-items: center;
}

.yazz-logo-v7 {
    width: 65px; 
    height: 65px;
    background: var(--accent);
    border-radius: 50%;
    display: flex; 
    align-items: center; 
    justify-content: center;
    color: #ffffff; 
    font-weight: 900; 
    font-size: 28px;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.2);
    margin: 0 auto;
}

.yazz-logo-v7.small {
    width: 55px;
    height: 55px;
    font-size: 24px;
}

.header-info h1 {
    margin: 0;
    font-size: 24px;
    letter-spacing: 0.5px;
    color: var(--accent);
}

.header-info p {
    margin: 3px 0;
    font-size: 13px;
    opacity: 0.85;
}

.user-badge-display {
    font-size: 12px;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-date-selector {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.header-date-selector input[type="date"] {
    max-width: 170px;
    font-weight: bold;
}

.main-layout { 
    display: flex; 
    flex: 1; 
}

/* ==========================================================================
   CONTROL NAVIGATION SIDEBAR ELEMENTS
   ========================================================================== */
.sidebar { 
    width: 260px; 
    background: var(--bg-side); 
    color: #f8fafc; 
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: sticky;
    top: 0;
    height: calc(100vh - 90px);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.nav-links { 
    list-style: none; 
    padding: 0; 
    margin: 0;
    overflow-y: auto;
}

.nav-links li { 
    padding: 14px 20px; 
    cursor: pointer; 
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 5px solid transparent; 
}

.nav-links li:hover { 
    background: rgba(255, 255, 255, 0.06); 
    border-left-color: var(--border);
}

.nav-links li.active-link {
    background: rgba(37, 99, 235, 0.15);
    border-left-color: var(--accent);
    color: #ffffff;
    font-weight: 600;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer button {
    width: 100%;
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}

/* ==========================================================================
   PRIMARY OPERATIONAL CONTENT PANELS
   ========================================================================== */
.content { 
    flex: 1; 
    padding: 25px; 
    overflow-x: hidden; 
}

.page { 
    display: none; 
}

.page.active { 
    display: block; 
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.section-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

/* ==========================================================================
   INPUTS, FORMS & GRID ARRANGEMENTS
   ========================================================================== */
.pos-grid { 
    display: grid; 
    grid-template-columns: 360px 1fr; 
    gap: 25px; 
}

.invoice-form, .settings-card, .receipt-inputs, .table-card { 
    background: var(--white); 
    padding: 20px; 
    border-radius: 10px; 
    border: 1px solid var(--border); 
    box-shadow: var(--card-shadow);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

input, select, textarea { 
    width: 100%; 
    padding: 12px; 
    margin: 4px 0; 
    border: 1px solid var(--border); 
    border-radius: 6px; 
    background: var(--white); 
    color: var(--text-main); 
    font-size: 14px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.qty-price-row { 
    display: grid; 
    grid-template-columns: 2fr 3fr; 
    gap: 8px; 
}

/* Table Inline Controls */
.table-inline-input {
    width: 90px;
    padding: 5px;
    margin: 0;
}

/* ==========================================================================
   CORPORATE INVOICING & PREVIEW SYSTEM FRAMES
   ========================================================================== */
.invoice-preview-card { 
    background: #ffffff; 
    padding: 35px; 
    border-radius: 6px; 
    box-shadow: 0 0 20px rgba(0,0,0,0.06); 
    color: #000000; 
    min-height: 650px; 
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #cbd5e1;
}

.invoice-document-frame {
    width: 100%;
}

.invoice-divider {
    border: 0;
    border-top: 2px dashed #000000;
    margin: 15px 0;
}

.invoice-meta-split {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.invoice-meta-split p {
    margin: 3px 0;
}

.invoice-financials-summary {
    margin-top: 20px;
    text-align: right;
    font-size: 14px;
}

.invoice-financials-summary p {
    margin: 5px 0;
    display: flex;
    justify-content: flex-end;
    gap: 30px;
}

.invoice-financials-summary p span {
    min-width: 100px;
    display: inline-block;
}

.grand-total-highlight {
    font-size: 18px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid #000000;
    color: #000000;
    display: flex;
    justify-content: flex-end;
    gap: 30px;
}

.invoice-declaration-note {
    margin-top: 30px;
    font-size: 12px;
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
}

.disclaimer-text {
    font-style: italic;
    opacity: 0.75;
}

/* ==========================================================================
   MASTER DATA TABLES & ANALYSIS SHEETS
   ========================================================================== */
.scroll-container { 
    max-height: 600px; 
    overflow-y: auto; 
    border: 1px solid var(--border); 
    border-radius: 8px; 
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.main-table, .items-table { 
    width: 100%; 
    border-collapse: collapse; 
}

.main-table th { 
    background: var(--accent); 
    color: #ffffff; 
    padding: 12px; 
    text-align: left; 
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.main-table td { 
    padding: 12px; 
    border-bottom: 1px solid var(--border); 
    font-size: 14px;
}

.main-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.04);
}

.items-table th {
    background: #334155;
    color: #ffffff;
    padding: 10px;
    font-size: 12px;
    text-align: left;
}

.items-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    color: #000000;
}

.table-summary-foot tr {
    background: rgba(37, 99, 235, 0.12) !important;
    font-weight: bold;
}

/* ==========================================================================
   INTERACTIVE ACTION SWITCHES & BUTTONS
   ========================================================================== */
button { 
    padding: 12px 22px; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 3px; 
}

button:active {
    transform: scale(0.97);
}

.btn-save { background: var(--success); color: white; }
.btn-save:hover { background: #099268; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-add { background: var(--accent); color: white; width: 100%; margin-top: 10px; }
.btn-add:hover { background: var(--accent-hover); }
.btn-pdf { background: #ea580c; color: white; }
.btn-pdf:hover { background: #c2410c; }
.btn-wa { background: #16a34a; color: white; }
.btn-wa:hover { background: #15803d; }
.btn-print { background: #4f46e5; color: white; }
.btn-print:hover { background: #4338ca; }

/* ==========================================================================
   EXECUTIVE ANALYTICAL METRIC CARDS
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.metric-card {
    padding: 20px;
    border-radius: 10px;
    color: #ffffff;
    box-shadow: var(--card-shadow);
}

.card-revenue { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.card-cash { background: linear-gradient(135deg, #10b981, #047857); }
.card-credit { background: linear-gradient(135deg, #f59e0b, #b45309); }

.metric-card h4 { margin: 0; font-size: 13px; text-transform: uppercase; opacity: 0.9; letter-spacing: 0.5px; }
.metric-val { margin: 10px 0 0 0; font-size: 26px; font-weight: 700; }

/* ==========================================================================
   HISTORY LOG STREAMS
   ========================================================================== */
.history-vertical-stream {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-card { 
    background: var(--white); 
    padding: 18px; 
    border-radius: 8px; 
    border-left: 6px solid var(--accent); 
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.history-card-meta h4 { margin: 0 0 5px 0; font-size: 16px; }
.history-card-meta p { margin: 2px 0; font-size: 13px; opacity: 0.85; }

/* ==========================================================================
   RECEIPT DESIGN PANES & CONTEXTUAL BLOCKS
   ========================================================================== */
.receipt-gen-grid {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 25px;
}

.receipt-preview-box {
    background: var(--white);
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.empty-state-notice {
    font-style: italic;
    opacity: 0.5;
    text-align: center;
}

.official-receipt-layout, .petty-cash-layout {
    background: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    padding: 25px;
    width: 100%;
    max-width: 550px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.report-context-block {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    background: var(--white);
    padding: 12px 20px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.report-context-block label {
    font-size: 13px;
    font-weight: 600;
}

.rep-custom-input, .rep-mirror-lbl { width: 100%; max-width: 260px; margin: 0; padding: 6px 10px; }
.rep-mirror-lbl { background: transparent; border: none; font-weight: bold; color: var(--text-main); }

.settings-layout-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 25px;
}

/* ==========================================================================
   MODAL OVERLAY SYSTEM CONTROLS
   ========================================================================== */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.5); 
    z-index: 3000; 
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.modal-content { 
    background: var(--white); 
    width: 100%;
    max-width: 450px; 
    margin: 0 auto; 
    padding: 25px; 
    border-radius: 10px; 
    box-shadow: var(--card-shadow);
}

.modal-action-block {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.print-only { display: none; }

/* ==========================================================================
   RESPONSIVE DESIGN SYSTEM MEDIA QUERY BREAKPOINTS
   ========================================================================== */
@media (max-width: 1024px) {
    .pos-grid { grid-template-columns: 1fr; }
    .main-layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .receipt-gen-grid { grid-template-columns: 1fr !important; }
}

/* ==========================================================================
   HIGH-FIDELITY COMMERCIAL PRINT FORMATTING
   ========================================================================== */
@media print {
    .no-print, .sidebar, .export-bar, .invoice-form, .receipt-inputs, button, .accountant-bar { 
        display: none !important; 
    }
    
    .content { 
        padding: 0; 
        margin: 0; 
        overflow: visible;
    }
    
    body { 
        background: #ffffff; 
        color: #000000; 
    }
    
    .page { 
        display: none !important; 
    }
    
    .page.active, .report-print-container, .invoice-preview-card, .official-receipt-layout, .petty-cash-layout { 
        display: block !important; 
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    
    .print-only { 
        display: block; 
    }
    
    .scroll-container { 
        max-height: none !important; 
        overflow: visible !important; 
    }
    
    .main-table th { 
        background: #334155 !important; 
        color: #ffffff !important; 
        position: static; 
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        /* ==========================================================================
   HISTORICAL LOCK REVIEWS INFORMATION BAR STYLING
   ========================================================================== */
.history-lock-notification-banner {
    background-color: #fff3cd;
    color: #856404;
    border-bottom: 2px solid #ffeeba;
    padding: 12px 30px;
    text-align: center;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    z-index: 9999999;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.dark-mode .history-lock-notification-banner {
    background-color: #795b02;
    color: #fdf1ce;
    border-bottom: 2px solid #9c7604;
}
    }
}