@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 100 700;
    src: url('material-symbols-outlined.woff2') format('woff2');
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'liga';
}

/* CSS Variable Design Tokens */
:root {
    --primary: #1b6ef3;
    --primary-hover: #1558c7;
    --primary-glow: rgba(27, 110, 243, 0.15);
    --success: #10b981;
    --danger: #ef4444;
    --bg-app: #f1f5f9;
    --bg-panel: #ffffff;
    --bg-sidebar: #0f172a;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-white: #ffffff;
    --border: #e2e8f0;
    --border-dark: #334155;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-premium: 0 12px 24px -4px rgba(0, 0, 0, 0.06), 0 4px 12px -2px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    --zoom: 0.85;
}

/* Reset & Basic Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    color: var(--text-main);
    background-color: var(--bg-app);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Core Layout */
.app-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* 1. Sidebar (Left Panel) */
.sidebar {
    width: 360px;
    background-color: var(--bg-sidebar);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-dark);
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-dark);
}

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

.logo-icon {
    font-size: 32px;
    color: var(--primary);
    background: rgba(27, 110, 243, 0.1);
    padding: 6px;
    border-radius: 8px;
}

.logo-text h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo-text p {
    font-size: 11px;
    color: var(--text-muted);
}

/* Drag and Drop Upload Area */
.upload-section {
    padding: 20px;
}

.drag-zone {
    border: 2px dashed var(--border-dark);
    border-radius: var(--radius-md);
    padding: 24px 16px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.drag-zone:hover, .drag-zone.dragover {
    border-color: var(--primary);
    background: rgba(27, 110, 243, 0.05);
}

.upload-icon {
    font-size: 36px;
    color: var(--text-muted);
    margin-bottom: 12px;
    transition: color 0.25s ease;
}

.drag-zone:hover .upload-icon {
    color: var(--primary);
}

.drag-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

.drag-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

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

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

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

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-white);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.btn-secondary-outline {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary-outline:hover {
    background-color: rgba(0, 0, 0, 0.02);
    border-color: var(--text-muted);
}

/* Sidebar Tabs - Segmented Control style */
.sidebar-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px;
    border-radius: var(--radius-sm);
    margin: 16px;
    border: 1px solid var(--border-dark);
}

.tab-btn {
    flex: 1;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: var(--text-muted) !important;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-white) !important;
}

.tab-btn.active {
    background: var(--primary) !important;
    color: var(--text-white) !important;
    box-shadow: var(--shadow-sm);
}

/* Invoice List Sidebar Container */
.invoice-list-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.1);
}

.btn-clear-all {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.btn-clear-all:hover {
    color: var(--danger);
}

.invoice-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.empty-state .material-symbols-outlined {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 13px;
    font-weight: 500;
}

.empty-state p.sub {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.8;
}

/* Invoice Card Item */
.invoice-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    gap: 12px;
    position: relative;
    transition: all 0.2s ease;
}

.invoice-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-muted);
}

.invoice-item.selected {
    background: rgba(27, 110, 243, 0.15) !important;
    border-color: rgba(27, 110, 243, 0.45) !important;
    box-shadow: 0 0 10px rgba(27, 110, 243, 0.15);
}

.invoice-item.uploading {
    opacity: 0.6;
    pointer-events: none;
}

.invoice-thumb {
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.invoice-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.invoice-thumb .thumb-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 10px;
    color: var(--text-muted);
}

.invoice-thumb .thumb-placeholder .material-symbols-outlined {
    font-size: 24px;
    margin-bottom: 2px;
}

.invoice-thumb .thumb-placeholder.pdf-type {
    color: var(--danger);
}

.invoice-thumb .thumb-placeholder.image-type {
    color: var(--success);
}

.invoice-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.invoice-name {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

/* Inline Edit Amount Pill */
.amount-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.amount-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.amount-input-group {
    display: inline-flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 3px 10px;
    transition: all 0.2s ease;
}

.amount-input-group:focus-within,
.amount-input-group:hover {
    border-color: var(--primary);
    background: rgba(27, 110, 243, 0.08);
    box-shadow: 0 0 12px var(--primary-glow);
}

.amount-currency {
    position: static;
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    margin-right: 4px;
    user-select: none;
}

.amount-input {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 700;
    padding: 0 !important;
    width: 70px;
    outline: none !important;
    box-shadow: none !important;
}

/* Hide HTML5 Up/Down Spinners */
.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.amount-input[type="number"] {
    -moz-appearance: textfield;
}

/* Card Controls */
.item-actions {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.btn-action-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-action-icon:hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.1);
}

.btn-action-icon.delete-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.btn-action-icon.move-btn {
    font-size: 18px;
}

.btn-action-icon.move-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

/* Uploading Progress Overlay */
.upload-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    width: 0%;
    transition: width 0.2s;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

/* 2. Middle Preview Area */
.preview-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #cbd5e1; /* slate 300 for contrasting the white papers */
}

.preview-header {
    height: 64px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.preview-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-title .material-symbols-outlined {
    color: var(--primary);
}

.preview-title h2 {
    font-size: 15px;
    font-weight: 600;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-ctrl {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ctrl:hover {
    background-color: var(--bg-app);
    border-color: var(--text-muted);
}

.zoom-value {
    font-size: 12px;
    font-weight: 600;
    min-width: 44px;
    text-align: center;
}

.preview-controls .divider {
    width: 1px;
    height: 18px;
    background-color: var(--border);
    margin: 0 4px;
}

.page-indicator {
    font-size: 12px;
    color: var(--text-muted);
}

.page-indicator strong {
    color: var(--text-main);
}

/* Paper Viewport & Layout rendering */
.paper-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    scroll-behavior: smooth;
}

.viewport-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
}

.empty-hint {
    max-width: 320px;
}

.empty-hint h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin: 12px 0 6px 0;
}

.empty-hint p {
    font-size: 12px;
    line-height: 1.5;
}

.icon-large {
    font-size: 64px;
    opacity: 0.3;
}

/* A4 Sheet Preview Structure (Screen layout) */
.a4-sheet {
    width: 210mm;
    height: 297mm;
    background-color: #ffffff;
    box-shadow: var(--shadow-premium);
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transform: scale(var(--zoom));
    transform-origin: top center;
    margin-bottom: calc(297mm * (var(--zoom) - 1));
}

.a4-sheet.landscape {
    width: 297mm;
    height: 210mm;
    margin-bottom: calc(210mm * (var(--zoom) - 1));
}

/* Invoice Container Slots on Page */
.invoice-slot {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 10mm;
    box-sizing: border-box;
    overflow: hidden;
}

/* Slot Layout heights matching style templates */
.layout-1 .invoice-slot {
    height: 50%; /* Single top half */
}

.layout-2 .invoice-slot {
    height: 100%; /* Single full page scaling */
    padding: 12mm;
}

.layout-3 .invoice-slot {
    height: 50%; /* Stacked top and bottom */
}

.a4-sheet.landscape.layout-1 .invoice-slot,
.a4-sheet.landscape.layout-3 .invoice-slot {
    height: 100%;
    width: 50%; /* landscape split is left/right instead of top/bottom! */
    float: left;
}

.a4-sheet.landscape.layout-2 .invoice-slot {
    height: 100%;
    width: 100%;
}

/* Cutting lines inside canvas sheets (Disabled per user request) */
.a4-sheet.has-crop-line.layout-3::after {
    display: none !important;
}

/* Vertical layout: cut line horizontally across middle */
.a4-sheet.has-crop-line.layout-3:not(.landscape)::after {
    display: none !important;
}

/* Landscape layout: cut line vertically across middle */
.a4-sheet.has-crop-line.layout-3.landscape::after {
    display: none !important;
}

/* Render items inside slots */
.invoice-slot canvas, .invoice-slot img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    box-shadow: none;
    border: none;
    background: #ffffff;
}

/* 3. Settings Sidebar (Right Panel) */
.settings-pane {
    width: 320px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.settings-section {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-title .material-symbols-outlined {
    font-size: 18px;
    color: var(--primary);
}

/* Setting Groups & Form controls */
.setting-group {
    margin-bottom: 18px;
}

.setting-group.compact {
    margin-bottom: 12px;
}

.setting-row {
    display: flex;
    gap: 16px;
}

.setting-group.half {
    flex: 1;
}

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Select wrapper */
.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

select {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--bg-panel);
    color: var(--text-main);
    outline: none;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s;
}

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

select:disabled {
    background-color: var(--bg-app);
    color: var(--text-muted);
    cursor: not-allowed;
}

.select-arrow {
    position: absolute;
    right: 12px;
    pointer-events: none;
    color: var(--text-muted);
    font-size: 20px;
}

input[type="number"] {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all 0.2s;
}

input[type="number"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Custom Radio Toggles (Direction) */
.radio-toggle-group {
    display: flex;
    background-color: var(--bg-app);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.radio-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    margin-bottom: 0;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-label .material-symbols-outlined {
    font-size: 18px;
}

.radio-label:hover {
    color: var(--text-main);
}

.radio-label.active {
    background-color: var(--bg-panel);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Custom Checkbox Design */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-main);
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 1px solid var(--border);
    border-radius: 4px;
    position: relative;
    transition: all 0.2s;
    background: var(--bg-panel);
    display: inline-block;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkbox-custom::after {
    content: '';
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    display: block;
}

/* Visual Layout Picker Grid */
.layout-picker {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 4px;
}

.layout-option {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--bg-panel);
}

.layout-option:hover {
    border-color: var(--text-muted);
    background-color: var(--bg-app);
}

.layout-option.active {
    border-color: var(--primary);
    background-color: var(--primary-glow);
    color: var(--primary);
    box-shadow: 0 0 0 2px rgba(27, 110, 243, 0.1);
}

/* Graphic mini-previews of layout */
.layout-preview-icon {
    width: 32px;
    height: 42px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 3px;
    position: relative;
    margin-bottom: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 3px;
    gap: 3px;
    box-sizing: border-box;
}

.layout-option.active .layout-preview-icon {
    border-color: var(--primary);
    background: #ffffff;
}

.mini-invoice {
    background-color: #cbd5e1;
    border-radius: 1px;
    width: 100%;
}

.layout-preview-icon.style-one .mini-invoice {
    height: 16px;
}

.layout-preview-icon.style-two .mini-invoice.full {
    height: 100%;
}

.layout-preview-icon.style-three .mini-invoice.top,
.layout-preview-icon.style-three .mini-invoice.bottom {
    height: 16px;
}

.layout-name {
    font-size: 10px;
    font-weight: 600;
}

/* Summary Panel Card */
.summary-section {
    background-color: var(--bg-app);
}

.summary-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

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

.summary-row:last-child {
    margin-bottom: 0;
}

.summary-row .lbl {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.summary-row .val {
    font-size: 13px;
    font-weight: 600;
}

.total-amount-row {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 12px;
}

.total-amount-row .lbl {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.total-amount-row .val {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
}

/* Action Section Panel */
.action-section {
    padding: 24px 24px 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.btn-print-trigger {
    height: 48px;
    font-size: 14px;
}

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

.secondary-actions .btn {
    flex: 1;
}

/* Hide default print container on screen */
#print-container {
    display: none;
}

/* ========================================== */
/* Print Specific Styles Sheets               */
/* ========================================== */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@media print {
    /* Hide scrollbars and reset body bounds */
    html, body {
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Completely hide Web Application Shell UI */
    .app-layout {
        display: none !important;
    }

    /* Target Print Container ONLY */
    #print-container {
        display: block !important;
        position: relative !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Single printed A4 Sheet */
    .print-page {
        width: 100% !important;
        height: 297mm !important;
        page-break-after: always !important;
        break-after: page !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        position: relative;
        box-sizing: border-box;
        overflow: hidden;
        background: #ffffff !important;
        display: flex;
        flex-direction: column;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* Landscape sheets */
    .print-page.landscape {
        width: 100% !important;
        height: 210mm !important;
        flex-direction: row; /* Horizontal placement in landscape! */
    }

    /* Page container slots inside output */
    .print-page .invoice-slot {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        padding: 10mm;
        box-sizing: border-box;
        overflow: hidden;
        background: #ffffff !important;
    }

    /* Layout specific slots for Portrait page */
    .print-page.layout-style-1 .invoice-slot {
        height: 50%; /* Only top half */
    }
    
    .print-page.layout-style-2 .invoice-slot {
        height: 100%; /* Scales to full page */
        padding: 12mm;
    }
    
    .print-page.layout-style-3 .invoice-slot {
        height: 50%; /* Two slots split top/bottom */
    }

    /* Layout specific slots for Landscape page */
    .print-page.landscape.layout-style-1 .invoice-slot,
    .print-page.landscape.layout-style-3 .invoice-slot {
        height: 100%;
        width: 50%; /* side-by-side splits in landscape */
        float: left;
    }

    .print-page.landscape.layout-style-2 .invoice-slot {
        height: 100%;
        width: 100%;
    }

    /* Cutting Line (dashed gray division) in print - Disabled */
    .print-page.has-crop-line.layout-style-3::after,
    .print-page.has-crop-line.layout-style-3:not(.landscape)::after,
    .print-page.has-crop-line.layout-style-3.landscape::after {
        display: none !important;
        content: none !important;
        border: none !important;
    }

    /* Canvas / image scaling in print */
    .print-page .invoice-slot canvas,
    .print-page .invoice-slot img {
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
        display: block !important;
        box-shadow: none !important;
        border: none !important;
        background: #ffffff !important;
    }
}

/* Custom Modal Dialog Box Styles */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.custom-modal-overlay.active {
    opacity: 1;
}

.custom-modal-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 400px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
    transform: scale(0.92);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.custom-modal-overlay.active .custom-modal-card {
    transform: scale(1);
}

.modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-icon.warning {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #f8fafc;
    margin: 0;
}

.modal-message {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.6;
    margin: 0;
    word-break: break-all;
}

.modal-actions {
    display: flex;
    width: 100%;
    gap: 12px;
    margin-top: 8px;
}

.modal-actions button {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none !important;
}

.modal-btn-cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #cbd5e1 !important;
}

.modal-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff !important;
}

.modal-btn-confirm {
    background: var(--danger) !important;
    border: none !important;
    color: var(--text-white) !important;
}

.modal-btn-confirm:hover {
    background: #dc2626 !important;
}

/* Responsive adjustments for smaller screen heights to prevent scrollbars in settings panel */
@media (max-height: 920px) {
    .settings-section {
        padding: 16px 20px;
    }
    .setting-group {
        margin-bottom: 12px;
    }
    .section-title {
        margin-bottom: 10px;
    }
    .layout-picker {
        gap: 8px;
    }
    .layout-option {
        padding: 8px 4px;
    }
    .layout-preview-icon {
        margin-bottom: 4px;
        height: 38px;
    }
    .action-section {
        padding: 16px 20px 20px 20px;
        margin-top: 10px;
    }
}

@media (max-height: 800px) {
    .settings-section {
        padding: 10px 18px;
    }
    .setting-group {
        margin-bottom: 8px;
    }
    .section-title {
        margin-bottom: 6px;
        font-size: 12px;
    }
    .layout-picker {
        gap: 6px;
    }
    .layout-option {
        padding: 6px 4px;
    }
    .layout-preview-icon {
        height: 32px;
        width: 26px;
        margin-bottom: 2px;
    }
    .layout-name {
        font-size: 9px;
    }
    .action-section {
        padding: 12px 18px 16px 18px;
        margin-top: 6px;
        gap: 8px;
    }
    .btn-print-trigger {
        height: 38px;
        font-size: 13px;
    }
}


