/* Style sheet for Jewellers Billing & Sales Ledger Web Application */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700;800&family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    /* Color Palette - Elegant Ivory & Royal Gold Light Theme */
    --bg-app: #faf8f5;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #fbf8f1;
    --border-color: #e7dfd5;
    --border-focus: #b45309;
    
    --color-primary: #b45309;
    --color-primary-hover: #92400e;
    --color-primary-glow: rgba(180, 83, 9, 0.12);
    --gold-gradient: linear-gradient(135deg, #d97706, #b45309);
    --gold-text-gradient: linear-gradient(135deg, #92400e, #b45309, #d97706);
    
    --color-success: #059669;
    --color-success-bg: rgba(5, 150, 105, 0.1);
    --color-warning: #d97706;
    --color-warning-bg: rgba(217, 119, 6, 0.1);
    --color-error: #dc2626;
    --color-error-bg: rgba(220, 38, 38, 0.1);
    --color-info: #0891b2;
    --color-info-bg: rgba(8, 145, 178, 0.1);

    --text-primary: #1c1917;
    --text-secondary: #57534e;
    --text-muted: #a8a29e;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-glow: 0 0 20px rgba(180, 83, 9, 0.18);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Global styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    outline: none;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
}

/* App Container Layout */
.app-container {
    display: flex;
    width: 100%;
    max-width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    height: 100%;
    z-index: 10;
    overflow-y: auto;
    transition: transform var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--gold-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 19px;
    box-shadow: var(--shadow-glow);
    border: 1px solid rgba(254, 240, 138, 0.3);
}

.logo-text {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 0.5px;
    font-family: 'Cinzel', 'Outfit', serif;
    background: var(--gold-text-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-subtext {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--color-primary);
    display: block;
    margin-top: -3px;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    width: 100%;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-card-hover);
}

.nav-link.active {
    color: white;
    background-color: var(--color-primary);
    box-shadow: 0 4px 12px var(--color-primary-glow);
}

.nav-link i {
    font-size: 18px;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-normal);
}

.theme-toggle-btn:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--text-muted);
}

.theme-toggle-icons {
    display: flex;
    gap: 8px;
    background-color: var(--bg-app);
    padding: 4px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.theme-icon {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.theme-icon.active {
    background-color: var(--color-primary);
    color: white;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.status-badge.connected {
    background-color: var(--color-success-bg);
    color: var(--color-success);
}

.status-badge.disconnected {
    background-color: var(--color-warning-bg);
    color: var(--color-warning);
}

/* Main Content Area */
.main-content {
    flex: 1 1 0%;
    min-width: 0;
    max-width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px 32px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Header styles */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.header-title-area {
    min-width: 0;
    flex: 1 1 260px;
}

.header-title-area h1 {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.header-title-area p {
    color: var(--text-secondary);
    font-size: 14.5px;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Main buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    box-shadow: 0 4px 12px var(--color-primary-glow);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--color-primary-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--text-secondary);
}

.btn-whatsapp {
    background-color: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
}

.btn-whatsapp:hover {
    background-color: #15803d;
    border-color: #15803d;
    transform: translateY(-1px);
}

/* View Sections (Controlled by JS tab switching) */
.view-section {
    display: none;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-section.active {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Dashboard Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
    gap: 16px;
    width: 100%;
    min-width: 0;
}

.metric-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    position: relative;
    overflow: hidden;
    min-width: 0;
    transition: all var(--transition-normal);
}

.metric-card:hover {
    transform: translateY(-2px);
    border-color: var(--text-muted);
    box-shadow: var(--shadow-md);
}

.metric-card.clickable-card {
    cursor: pointer;
}

.metric-card.clickable-card:hover {
    border-color: var(--color-error);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 10px;
    gap: 8px;
}

.metric-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.metric-icon.indigo { background-color: var(--color-primary-glow); color: var(--color-primary); }
.metric-icon.emerald { background-color: var(--color-success-bg); color: var(--color-success); }
.metric-icon.amber { background-color: var(--color-warning-bg); color: var(--color-warning); }
.metric-icon.cyan { background-color: var(--color-info-bg); color: var(--color-info); }
.metric-icon.rose { background-color: var(--color-error-bg); color: var(--color-error); }

.metric-value {
    font-size: clamp(18px, 1.75vw, 24px);
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.4px;
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.metric-change {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.metric-change.up { color: var(--color-success); }
.metric-change.down { color: var(--color-error); }
.metric-change.neutral { color: var(--text-muted); }

/* Dashboard Charts Section */
.charts-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 24px;
    width: 100%;
    min-width: 0;
}

@media (max-width: 1120px) {
    .charts-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.chart-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 360px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.chart-title {
    font-size: 17px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-container {
    position: relative;
    flex-grow: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 270px;
}

/* Sales Form Layout */
.form-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    box-shadow: var(--shadow-md);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

@media (max-width: 600px) {
    .form-group.full-width {
        grid-column: span 1;
    }
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-control {
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
    transition: all var(--transition-fast);
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.form-control[readonly] {
    background-color: var(--bg-card-hover);
    color: var(--text-secondary);
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Ledger List Elements */
.ledger-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.search-filter-box {
    display: flex;
    gap: 12px;
    flex-grow: 1;
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
}

.search-input-wrapper {
    position: relative;
    flex: 1 1 220px;
    min-width: 0;
}

.search-input-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-wrapper input {
    padding-left: 40px;
}

.table-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-shadow: var(--shadow-sm);
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    max-height: 600px;
}

table.sales-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

table.sales-table th {
    background-color: var(--bg-sidebar);
    padding: 16px 20px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

table.sales-table td {
    padding: 16px 20px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

table.sales-table tbody tr {
    transition: background-color var(--transition-fast);
}

table.sales-table tbody tr:hover {
    background-color: var(--bg-card-hover);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge.completed, .badge.paid { background-color: var(--color-success-bg); color: var(--color-success); border: 1px solid rgba(16, 185, 129, 0.25); }
.badge.pending, .badge.unpaid { background-color: var(--color-warning-bg); color: var(--color-warning); border: 1px solid rgba(245, 158, 11, 0.25); }
.badge.partial { background-color: rgba(234, 179, 8, 0.12); color: #eab308; border: 1px solid rgba(234, 179, 8, 0.25); }
.badge.refunded { background-color: var(--color-error-bg); color: var(--color-error); }

.badge.gold { background-color: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); font-weight: 600; }
.badge.silver { background-color: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); font-weight: 600; }
.badge.platinum { background-color: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); font-weight: 600; }

.badge.synced { background-color: var(--color-success-bg); color: var(--color-success); }
.badge.pending-sync { background-color: var(--color-warning-bg); color: var(--color-warning); }

/* Setup & Instructions panel */
.setup-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 28px;
}

@media (max-width: 900px) {
    .setup-grid {
        grid-template-columns: 1fr;
    }
}

.info-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-card h3 {
    font-size: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step-item {
    display: flex;
    gap: 16px;
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--color-primary-glow);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.step-content p {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 4px;
}

.step-content small {
    color: var(--text-secondary);
    font-size: 12px;
}

/* Code Container */
.code-container {
    position: relative;
    background-color: #0d0e11;
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-color);
    margin-top: 10px;
}

.code-container pre {
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #e2e8f0;
    line-height: 1.5;
    max-height: 250px;
}

.copy-btn {
    position: absolute;
    right: 12px;
    top: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.copy-btn:hover {
    background-color: var(--color-primary);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

.toast {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--color-primary);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 450px;
    animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: transform 0.3s, opacity 0.3s;
}

.toast.success { border-left-color: var(--color-success); }
.toast.warning { border-left-color: var(--color-warning); }
.toast.error { border-left-color: var(--color-error); }

.toast-message {
    flex-grow: 1;
    font-size: 14px;
    font-weight: 500;
}

.toast-close {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* Empty State Styling */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    gap: 16px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    color: var(--text-muted);
}

.empty-state h4 {
    font-size: 18px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 14px;
    max-width: 400px;
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile Responsive Sidebar Toggle */
.mobile-header {
    display: none;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
        overflow-x: hidden;
    }
    .app-container {
        flex-direction: column;
        width: 100%;
        height: 100vh;
        overflow: hidden;
    }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        height: 100%;
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.4);
        z-index: 10001;
        transition: transform var(--transition-normal);
        overflow-y: auto;
    }
    .sidebar.active, .sidebar.open {
        transform: translateX(0) !important;
    }
    .sidebar-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(2px);
        z-index: 10000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .sidebar-backdrop.active, .sidebar-backdrop.open {
        opacity: 1;
        pointer-events: auto;
    }
    .mobile-header {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 99;
    }
    .main-content {
        padding: 16px 14px;
        gap: 18px;
        width: 100%;
        overflow-x: hidden;
    }
    .view-section.active {
        gap: 18px;
    }
    .header-container {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding-bottom: 14px;
    }
    .header-title-area {
        flex: 0 0 auto;
        width: 100%;
    }
    .header-title-area h1 {
        font-size: 24px;
    }
    .header-title-area p {
        font-size: 13.5px;
    }
    .header-actions {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        gap: 8px;
    }
    .header-actions .btn {
        flex: 1 1 calc(50% - 4px);
        justify-content: center;
        padding: 9px 12px;
        font-size: 13px;
    }
    .form-container {
        padding: 16px;
        border-radius: var(--radius-md);
    }
    .mobile-only-close {
        display: block !important;
    }
    .chart-card {
        padding: 16px;
        min-height: 320px;
    }
    .chart-container {
        min-height: 230px;
    }
}

/* Rates Ticker Bar */
.rates-ticker-bar {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.08), rgba(245, 158, 11, 0.04));
    border: 1px solid rgba(217, 119, 6, 0.25);
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    margin-bottom: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.rates-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-primary);
}

.rates-list {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.rate-badge {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
    gap: 6px;
    box-shadow: var(--shadow-sm);
}

.rate-badge strong {
    color: var(--color-primary);
}

.rate-badge .metal-name {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Dynamic Jewellery Items Table & Cards */
.jewel-items-section {
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 8px;
    margin-bottom: 24px;
}

.jewel-items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.jewel-items-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Edit Mode Banner & Repeat Customer Khata Banner */
.edit-mode-banner {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(217, 119, 6, 0.08));
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--color-primary);
}

.repeat-customer-banner {
    background-color: var(--color-info-bg);
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: var(--text-primary);
}

.jewel-item-row {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 14px;
    position: relative;
    transition: all var(--transition-fast);
}

.jewel-item-row:hover {
    border-color: rgba(217, 119, 6, 0.45);
    box-shadow: var(--shadow-sm);
}

.jewel-row-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 12px;
    align-items: end;
}

.desc-col { grid-column: span 5; }
.purity-col { grid-column: span 3; }
.huid-col { grid-column: span 3; }
.action-col { grid-column: span 1; justify-self: end; align-self: end; }

.gross-col { grid-column: span 2; }
.stone-col { grid-column: span 2; }
.net-col { grid-column: span 2; }
.rate-col { grid-column: span 2; }
.making-col { grid-column: span 4; }

.stone-amt-col { grid-column: span 4; }
.total-col {
    grid-column: span 8;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    padding-bottom: 4px;
}

.making-input-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.making-input-group .item-making-type {
    width: 112px;
    flex-shrink: 0;
    padding: 12px 8px;
}

.item-delete-btn {
    background: transparent;
    border: none;
    color: var(--color-error);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.item-delete-btn:hover {
    background-color: var(--color-error-bg);
}

.btn-add-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: transparent;
    color: var(--color-primary);
    border: 1px dashed var(--color-primary);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
    justify-content: center;
    margin-top: 10px;
}

.btn-add-item:hover {
    background-color: var(--color-primary-glow);
    border-style: solid;
}

/* Bill Calculation Breakdown Panel */
.bill-breakdown-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
    gap: 10px;
    flex-wrap: wrap;
}

.breakdown-controls-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.breakdown-row.highlight {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-primary);
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
    margin-top: 4px;
}

.old-gold-calc-panel {
    background-color: var(--bg-app);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.old-gold-calc-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 10px;
}

/* Item Field Labels (Always shown cleanly on every card) */
.item-field-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Tablet & Mobile Breakpoints for Form & Items */
@media (max-width: 1024px) {
    .jewel-items-section {
        padding: 14px;
    }
    .jewel-items-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .jewel-row-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 10px;
    }
    .desc-col { grid-column: span 5; }
    .action-col { grid-column: span 1; justify-self: flex-end; }
    .purity-col { grid-column: span 3; }
    .huid-col { grid-column: span 3; }
    .gross-col, .stone-col, .net-col { grid-column: span 2; }
    .rate-col { grid-column: span 2; }
    .making-col { grid-column: span 4; }
    .stone-amt-col { grid-column: span 3; }
    .total-col { grid-column: span 3; }
    .old-gold-calc-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet & Phone Breakpoint for Rates, Ledger & Tables */
@media (max-width: 768px) {
    .rates-ticker-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 14px;
        gap: 12px;
    }
    .rates-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
    }
    .rate-badge {
        font-size: 12px;
        padding: 8px 10px;
        justify-content: space-between;
        width: 100%;
    }
    .ledger-header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .search-filter-box {
        flex-direction: column;
        max-width: 100% !important;
        width: 100%;
        gap: 8px;
    }
    .search-input-wrapper {
        flex: 0 0 auto;
        width: 100%;
    }
    .search-filter-box select {
        width: 100% !important;
    }
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-md);
        width: 100%;
    }
    table.sales-table {
        min-width: 760px;
    }
}

/* Mobile Phone Breakpoint (<= 600px) */
@media (max-width: 600px) {
    .jewel-row-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .desc-col { grid-column: span 2; }
    .purity-col { grid-column: span 1; }
    .huid-col { grid-column: span 1; }
    .gross-col, .stone-col { grid-column: span 1; }
    .net-col, .rate-col { grid-column: span 1; }
    .making-col { grid-column: span 2; }
    .stone-amt-col { grid-column: span 2; }
    .total-col {
        grid-column: span 1;
        align-items: flex-start;
        padding-bottom: 0;
    }
    .total-col .item-line-total {
        font-size: 16px !important;
    }
    .action-col {
        grid-column: span 1;
        justify-self: flex-end;
        align-self: flex-end;
        order: 99;
    }
    .item-delete-btn {
        width: 36px;
        height: 36px;
        background-color: var(--color-error-bg);
    }
    .btn-add-item {
        padding: 12px;
        font-size: 13.5px;
    }
    .bill-breakdown-card {
        padding: 14px;
    }
    .breakdown-row {
        flex-wrap: wrap;
        gap: 6px;
    }
    .breakdown-row > strong,
    .breakdown-row > span:last-child {
        margin-left: auto;
    }
    .old-gold-calc-grid {
        grid-template-columns: 1fr;
    }
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .metric-card {
        padding: 12px 14px;
        border-radius: var(--radius-md);
    }
    #dashboard-view .metric-card:last-child {
        grid-column: span 2;
    }
    .metric-value {
        font-size: clamp(16px, 4.4vw, 20px);
    }
    .metric-header {
        font-size: 12px;
        margin-bottom: 6px;
    }
    .metric-icon {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }
    .metric-change {
        font-size: 10.5px;
    }
    .invoice-modal-card {
        width: 96% !important;
        margin: 6px auto !important;
        max-height: 94vh !important;
        border-radius: var(--radius-md) !important;
    }
    .invoice-modal-header {
        padding: 12px 16px !important;
    }
    .invoice-modal-header h3 {
        font-size: 16px !important;
    }
    .invoice-modal-actions {
        padding: 12px 16px !important;
        flex-wrap: wrap;
    }
    .invoice-modal-actions .btn {
        flex: 1 1 calc(50% - 6px);
        font-size: 13px !important;
        padding: 9px 12px !important;
        justify-content: center;
    }
    .invoice-paper {
        padding: 16px 12px 0 12px !important;
        overflow-x: auto;
    }
    .invoice-table {
        min-width: 560px;
    }
    .invoice-brand-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .invoice-brand-row > div:last-child {
        text-align: left !important;
    }
    .invoice-details-row {
        flex-direction: column;
        gap: 12px;
    }
    .invoice-number-date {
        text-align: left !important;
    }
    .invoice-footer-grid {
        flex-direction: column;
        gap: 16px;
    }
    .invoice-footer-grid > div:last-child {
        width: 100% !important;
    }
}

@media (max-width: 380px) {
    .metrics-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    #dashboard-view .metric-card:last-child {
        grid-column: span 1;
    }
    .rates-list {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* Invoice Modal Card */
.invoice-modal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 95%;
    max-width: 820px;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zoomIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.invoice-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.invoice-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-primary);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.modal-close-btn:hover {
    color: var(--color-error);
}

/* Invoice Paper Area (looks like a clean receipt sheet) */
.invoice-paper {
    padding: 28px 32px 0 32px;
    overflow-y: auto;
    background-color: #ffffff;
    color: #1c1917;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    flex-grow: 1;
    box-sizing: border-box;
}

.invoice-brand-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.invoice-logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.invoice-logo-title-serif {
    font-family: 'Cinzel', 'Georgia', serif;
    font-size: 24px;
    font-weight: 800;
    color: #92400e;
    letter-spacing: 1px;
    line-height: 1.1;
}

.invoice-logo-subtitle {
    font-size: 10px;
    font-weight: 700;
    color: #b45309;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: 2px;
}

.invoice-header-bar {
    background: linear-gradient(135deg, #92400e, #b45309, #d97706);
    border-bottom: 3px solid #78350f;
    padding: 10px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-left: -32px;
    margin-right: -32px;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.invoice-header-title {
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 2px;
    line-height: 1.1;
    text-transform: uppercase;
    font-family: 'Cinzel', 'Outfit', serif;
}

.invoice-header-tagline {
    color: #fef3c7;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.invoice-details-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 12.5px;
    line-height: 1.6;
    color: #1c1917;
}

.invoice-bill-to {
    flex: 1;
}

.invoice-customer-name {
    font-size: 15px;
    font-weight: 700;
    margin-top: 4px;
    margin-bottom: 2px;
    color: #1c1917;
}

.invoice-number-date {
    text-align: right;
    min-width: 240px;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    border: 1.5px solid #1c1917;
    margin-bottom: 16px;
}

.invoice-table th {
    background-color: #92400e;
    color: #ffffff;
    border: 1px solid #78350f;
    padding: 8px 8px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.invoice-table td {
    border: 1px solid #d6d3d1;
    padding: 8px 8px;
    font-size: 12px;
    color: #1c1917;
}

.invoice-footer-grid {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 16px;
    margin-bottom: 20px;
    gap: 20px;
}

.payment-details-box {
    font-size: 12px;
    color: #1c1917;
    line-height: 1.6;
    flex: 1;
}

.payment-info-line {
    margin-bottom: 2px;
}

.invoice-bottom-contacts {
    border-top: 1.5px solid #e7e5e4;
    padding-top: 12px;
    font-size: 11px;
    color: #57534e;
    line-height: 1.6;
    margin-bottom: 16px;
}

.contact-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.invoice-footer-bar {
    background: linear-gradient(135deg, #92400e, #b45309);
    border-top: 3px solid #78350f;
    height: 14px;
    margin-left: -32px;
    margin-right: -32px;
    position: relative;
    overflow: hidden;
}

.invoice-footer-accent {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 14px 14px;
    border-color: transparent transparent #f59e0b transparent;
}

.invoice-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* Dashboard Gold (Carat-Wise) & Silver Breakdown Section */
.metal-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    width: 100%;
    min-width: 0;
}

.metal-breakdown-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.metal-breakdown-card:hover {
    box-shadow: var(--shadow-md);
}

.metal-breakdown-card.gold-card {
    border-top: 3px solid #f59e0b;
}

.metal-breakdown-card.silver-card {
    border-top: 3px solid #94a3b8;
}

.mb-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.mb-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 210px;
}

.mb-title-wrap h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.mb-title-wrap p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.35;
}

.mb-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.mb-icon.gold {
    background: rgba(245, 158, 11, 0.14);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.28);
}

.mb-icon.silver {
    background: rgba(148, 163, 184, 0.16);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.light-theme .mb-icon.gold {
    color: #b45309;
    background: rgba(217, 119, 6, 0.12);
}

.light-theme .mb-icon.silver {
    color: #475569;
    background: rgba(100, 116, 139, 0.12);
}

.mb-total-pill {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 7px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-app);
    flex-shrink: 0;
    line-height: 1.35;
}

.mb-total-pill strong {
    font-size: 14px;
    font-weight: 700;
}

.mb-total-pill span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.mb-total-pill.gold strong {
    color: #f59e0b;
}

.light-theme .mb-total-pill.gold strong {
    color: #b45309;
}

.mb-total-pill.silver strong {
    color: #cbd5e1;
}

.light-theme .mb-total-pill.silver strong {
    color: #475569;
}

.mb-variety-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mb-variety-row {
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
}

.mb-variety-row:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

.mb-variety-row.is-empty {
    opacity: 0.72;
}

.mb-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.mb-row-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.mb-karat-badge {
    min-width: 44px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

.mb-karat-badge.k24 {
    background: rgba(234, 179, 8, 0.18);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.32);
}

.mb-karat-badge.k22 {
    background: rgba(245, 158, 11, 0.16);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.mb-karat-badge.k18 {
    background: rgba(217, 119, 6, 0.16);
    color: #fb923c;
    border: 1px solid rgba(217, 119, 6, 0.3);
}

.mb-karat-badge.k14 {
    background: rgba(180, 83, 9, 0.18);
    color: #fdba74;
    border: 1px solid rgba(180, 83, 9, 0.32);
}

.mb-karat-badge.silver {
    background: rgba(148, 163, 184, 0.16);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.32);
}

.light-theme .mb-karat-badge.k24 { color: #a16207; }
.light-theme .mb-karat-badge.k22 { color: #b45309; }
.light-theme .mb-karat-badge.k18 { color: #c2410c; }
.light-theme .mb-karat-badge.k14 { color: #9a3412; }
.light-theme .mb-karat-badge.silver { color: #334155; background: rgba(100, 116, 139, 0.14); }

.mb-row-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mb-row-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mb-row-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.mb-row-right {
    text-align: right;
    flex-shrink: 0;
    line-height: 1.3;
}

.mb-row-weight {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.mb-row-amount {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary);
}

.silver-card .mb-row-amount {
    color: var(--text-secondary);
}

.mb-progress-track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background-color: var(--bg-card-hover);
    overflow: hidden;
}

.mb-progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.35s ease;
}

.mb-progress-fill.gold {
    background: linear-gradient(90deg, #f59e0b, #eab308);
}

.mb-progress-fill.silver {
    background: linear-gradient(90deg, #64748b, #cbd5e1);
}

.mb-card-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 14px;
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.mb-footer-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.mb-sub-note {
    font-size: 11px;
    color: var(--text-muted);
}

.mb-footer-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mb-footer-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    font-weight: 600;
}

.mb-footer-right strong {
    font-size: 16px;
    font-weight: 800;
}

.mb-footer-right .gold-text {
    color: #f59e0b;
}

.light-theme .mb-footer-right .gold-text {
    color: #b45309;
}

.mb-footer-right .silver-text {
    color: #cbd5e1;
}

.light-theme .mb-footer-right .silver-text {
    color: #334155;
}

@media (max-width: 1020px) {
    .metal-breakdown-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }
}

@media (max-width: 520px) {
    .metal-breakdown-card {
        padding: 14px;
        gap: 12px;
    }
    .mb-total-pill {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .mb-row-top {
        align-items: flex-start;
    }
    .mb-row-title {
        white-space: normal;
        font-size: 12.5px;
    }
}

/* Print Media Overrides */
@media print {
    @page {
        size: A4 portrait;
        margin: 10mm 12mm;
    }

    html, body {
        background-color: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Strictly hide everything on the screen except the active invoice */
    .app-container, 
    .toast-container, 
    .no-print, 
    #rates-modal,
    #payment-update-modal,
    #customer-khata-modal,
    .modal-overlay,
    .invoice-modal-header, 
    .invoice-modal-actions {
        display: none !important;
    }
    
    /* Only display the invoice modal when active */
    #invoice-modal.active {
        position: static !important;
        display: block !important;
        background: transparent !important;
        backdrop-filter: none !important;
        opacity: 1 !important;
        z-index: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    #invoice-modal.active .invoice-modal-card {
        border: none !important;
        box-shadow: none !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        transform: none !important;
        animation: none !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #invoice-modal.active .invoice-paper {
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        background: #ffffff !important;
        color: #000000 !important;
    }
}
