:root {
    --bg-dark: #0b0f19;
    --bg-card: #111827;
    --accent-purple: #a855f7;
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --paper-bg: #ffffff;
    --paper-text: #0f172a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* LOGIN MODAL OVERLAY */
.login-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(11, 15, 25, 0.94);
    backdrop-filter: blur(16px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    text-align: center;
}

.login-logo {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    margin: 0 auto 16px;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
    font-family: 'Space Grotesk', sans-serif;
}

.login-title {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 24px;
}

.login-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 10px;
    border-radius: 10px;
    font-size: 12px;
    margin-bottom: 16px;
    display: none;
}

.hint-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px;
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 20px;
    text-align: left;
    line-height: 1.5;
}

/* App Navbar */
.app-header {
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
    font-family: 'Space Grotesk', sans-serif;
}

.brand-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-purple);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.user-status-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.role-badge {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge.admin { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.role-badge.employee { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }

/* Main Workspace Container */
.workspace {
    max-width: 1650px;
    width: 100%;
    margin: 25px auto;
    padding: 0 30px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* ADMIN ONLY: Summary Cards */
.admin-reports-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
    background: var(--gradient-primary);
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-info h4 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.stat-info .amount {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
}

.stat-info .sub-text {
    font-size: 11px;
    color: #34d399;
    margin-top: 4px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: rgba(168, 85, 247, 0.1);
    color: var(--accent-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.btn-report-print {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn-report-print:hover {
    background: var(--accent-purple);
    color: #fff;
    border-color: var(--accent-purple);
}

/* ADMIN ONLY: Credential Management Section */
.admin-cred-section {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.cred-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-top: 15px;
}

.cred-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
}

.cred-box h3 {
    font-size: 15px;
    color: #fff;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ADMIN ONLY: Detailed Product Sales Table */
.daily-sales-section {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.sales-report-tabs {
    display: flex;
    gap: 10px;
    background: rgba(15, 23, 42, 0.8);
    padding: 5px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--gradient-primary);
    color: #fff;
}

.dark-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.dark-table th {
    padding: 12px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}

.dark-table td {
    padding: 14px;
    font-size: 14px;
    color: var(--text-main);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.badge-tag {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}

.badge-stock {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}

/* Printable Sales Report View */
#printableSalesReportView {
    display: none;
    background: #ffffff;
    color: #0f172a;
    padding: 30px;
    border-radius: 12px;
}

.print-report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #1e1b4b;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.print-report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.print-report-table th, .print-report-table td {
    border: 1px solid #cbd5e1;
    padding: 10px;
    text-align: left;
    font-size: 13px;
}

.print-report-table th {
    background-color: #f1f5f9;
    text-transform: uppercase;
    font-size: 11px;
}

/* Main Portal Layout */
.portal-grid {
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 25px;
}

@media (max-width: 1280px) {
    .admin-reports-panel { grid-template-columns: 1fr; }
    .cred-grid { grid-template-columns: 1fr; }
    .portal-grid { grid-template-columns: 1fr; }
}

/* Glass Cards */
.glass-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.section-title {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i { color: var(--accent-purple); }

/* Document Mode Toggle */
.doc-type-toggle {
    display: flex;
    gap: 8px;
    background: rgba(15, 23, 42, 0.8);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: var(--gradient-primary);
    color: #fff;
}

/* Inputs & Form Groups */
.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.input-group.full { grid-column: span 2; }

label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.5px;
}

input, select {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 12px 14px;
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

input:focus, select:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
}

/* Buttons */
.glow-btn {
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    width: 100%;
}

.glow-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(168, 85, 247, 0.6);
}

.outline-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 8px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.outline-btn:hover { background: rgba(255, 255, 255, 0.08); }

.icon-btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
}

.icon-btn-danger:hover {
    background: #ef4444;
    color: #fff;
}

/* Paper Receipt Card Styles */
.receipt-paper {
    background: var(--paper-bg);
    color: var(--paper-text);
    border-radius: 18px;
    padding: 35px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
}

.receipt-paper::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: var(--gradient-primary);
}

.receipt-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
}

.store-title {
    font-size: 22px;
    font-weight: 800;
    color: #1e1b4b;
    font-family: 'Space Grotesk', sans-serif;
}

.store-meta {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
    margin-top: 4px;
}

.doc-stamp {
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 14px;
    border-radius: 30px;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 8px;
}

.doc-stamp.quotation {
    background: #fef3c7;
    color: #b45309;
}

.details-pill {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 18px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.pill-item label { color: #94a3b8; font-size: 10px; }
.pill-item p { font-size: 13px; font-weight: 700; color: #0f172a; }
.pill-sub { font-size: 11px; color: #64748b; font-weight: 400 !important; }

/* Receipt Table */
.receipt-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
}

.receipt-table th {
    border-bottom: 2px solid #e2e8f0;
    padding: 10px 6px;
    font-size: 11px;
    text-transform: uppercase;
    color: #64748b;
    text-align: left;
}

.receipt-table td {
    border-bottom: 1px solid #f1f5f9;
    padding: 12px 6px;
    font-size: 13px;
    color: #1e293b;
}

.text-right { text-align: right; }
.text-center { text-align: center; }

.customer-meta-tag {
    font-size: 10px;
    color: #6366f1;
    font-weight: 600;
    background: #e0e7ff;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 2px;
}

/* Summary Footer */
.summary-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 15px;
    border-top: 2px dashed #e2e8f0;
}

.qr-placeholder {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.qr-placeholder i { font-size: 28px; color: #1e1b4b; }

.totals-box {
    width: 210px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.total-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #64748b;
}

.total-item.grand {
    font-size: 18px;
    font-weight: 800;
    color: #4f46e5;
    padding-top: 6px;
    border-top: 2px solid #1e1b4b;
}

/* Employee Mode CSS Hiding Rules */
.admin-only {
    display: flex;
}

body.employee-mode .admin-only {
    display: none !important;
}

/* Printing Rules */
@media print {
    body { background: white; color: black; }
    .login-overlay, .app-header, .control-side, .no-print, .admin-reports-panel, .admin-cred-section, .daily-sales-section { display: none !important; }
    .workspace { display: block; padding: 0; margin: 0; }
    .portal-grid { display: block; }
    .receipt-paper { box-shadow: none; border: none; padding: 0; }

    body.printing-sales-report .receipt-paper,
    body.printing-sales-report .portal-grid {
        display: none !important;
    }

    body.printing-sales-report #printableSalesReportView {
        display: block !important;
    }
}