:root {
    --primary: #0f172a;
    /* Slate 900 */
    --primary-light: #334155;
    --accent: #2563eb;
    /* Blue 600 */
    --accent-hover: #1d4ed8;
    --bg-main: #f8fafc;
    /* Slate 50 */
    --bg-card: #ffffff;
    --text-main: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    /* Slate 500 */
    --border: #e2e8f0;
    /* Slate 200 */
    --border-hover: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --font-sans: 'Inter', system-ui, sans-serif;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 10;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.sidebar-header span.text-primary {
    color: var(--accent);
}

.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    gap: 0.75rem;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item:hover,
.nav-item.active {
    background-color: #eff6ff;
    color: var(--accent);
    border-right: 3px solid var(--accent);
}

.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    min-width: 0;
    /* Prevents flex items from overflowing */
}

/* Typography & Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    gap: 0.5rem;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: white;
    color: var(--text-main);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background-color: var(--bg-main);
    border-color: var(--border-hover);
}

.btn-text {
    background: transparent;
    color: var(--accent);
    padding: 0;
}

.btn-text:hover {
    text-decoration: underline;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-dashed {
    background: transparent;
    border: 2px dashed var(--border);
    color: var(--text-muted);
    width: 100%;
    padding: 1rem;
    margin-top: 1rem;
    border-radius: var(--radius-md);
}

.btn-dashed:hover {
    border-color: var(--accent);
    color: var(--accent);
    background-color: #eff6ff;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group.row {
    display: flex;
    gap: 1rem;
}

.form-group.row .col {
    flex: 1;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    transition: var(--transition);
    background-color: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Editor Workspace (Albarán Document) */
.editor-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    padding: 3rem;
    margin-top: 1rem;
}

.doc-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 2rem;
}

.doc-company-info h3 {
    font-size: 1.25rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.doc-company-info p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
}

.doc-meta h2 {
    font-size: 2rem;
    color: var(--primary);
    letter-spacing: 2px;
    margin-bottom: 1rem;
    text-align: right;
}

.meta-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.meta-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.doc-input {
    border: 1px solid transparent;
    border-bottom: 1px solid var(--border);
    padding: 0.25rem 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    text-align: right;
    transition: var(--transition);
    background: transparent;
}

.doc-input:focus,
.doc-input:hover {
    border-color: var(--accent);
    outline: none;
    background: var(--bg-main);
}

.doc-client-section {
    background-color: var(--bg-main);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 3rem;
}

.client-selector {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.client-selector label {
    margin: 0;
}

.client-selector select {
    max-width: 300px;
}

.client-details {
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Tables in Document */
.doc-table-section {
    margin-bottom: 3rem;
}

.doc-table-section h3 {
    font-size: 1.125rem;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
}

.doc-table th {
    text-align: left;
    padding: 0.75rem 0.5rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 2px solid var(--border);
}

.doc-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.doc-cell-input {
    width: 100%;
    border: 1px solid transparent;
    padding: 0.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    border-radius: 4px;
    background: transparent;
    resize: vertical;
}

.doc-cell-input:focus,
.doc-cell-input:hover {
    border-color: var(--border-hover);
    background: white;
    box-shadow: var(--shadow-sm);
    outline: none;
}

.action-btn {
    color: #ef4444;
    /* Red 500 */
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

.action-btn:hover {
    background: #fef2f2;
}

.doc-totals {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.total-row {
    font-size: 1.125rem;
    color: var(--primary);
    display: flex;
    gap: 1rem;
    min-width: 200px;
    justify-content: space-between;
}

.doc-notes textarea {
    width: 100%;
    min-height: 80px;
    border: 1px solid transparent;
    background: var(--bg-main);
    padding: 1rem;
    font-family: inherit;
    border-radius: var(--radius-md);
    resize: vertical;
}

.doc-notes textarea:focus {
    border-color: var(--accent);
    outline: none;
    background: white;
}

/* Signatures */
.doc-signatures {
    display: flex;
    justify-content: space-between;
    gap: 4rem;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px dashed var(--border);
}

.signature-box {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.signature-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 2rem;
    text-align: center;
}

.signature-area {
    height: 120px;
    border: 1px dashed transparent;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.signature-area:hover {
    border-color: var(--border);
    background: var(--bg-main);
}

.signature-line {
    border-top: 1px solid var(--text-main);
    padding-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-main);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-close-modal {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: var(--bg-main);
}

/* Standard Data Tables */
.table-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-main);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tbody tr:hover {
    background: var(--bg-main);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    background: white;
    box-shadow: var(--shadow-lg);
    color: var(--primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid var(--accent);
}

.toast.success {
    border-color: #10b981;
}

.toast.error {
    border-color: #ef4444;
    color: #ef4444;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* AI Uploader */
.ai-uploader {
    border: 2px dashed var(--accent);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(to right, rgba(37, 99, 235, 0.05), rgba(37, 99, 235, 0.02));
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.ai-uploader.dragover {
    background: rgba(37, 99, 235, 0.1);
    transform: scale(1.01);
}

.ai-uploader-content i.ph-magic-wand {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.ai-uploader-content h3 {
    font-size: 1.125rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.ai-uploader-content p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
}

.spinner-icon {
    font-size: 2.5rem;
    color: var(--accent);
    animation: spin 1s linear infinite;
}

.mt-2 {
    margin-top: 0.5rem;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ===== Dual Address Grid (Billing + Shipping) ===== */
.address-dual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.address-block {
    padding: 0.75rem 0;
}

.address-block-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}

.address-block-header i {
    font-size: 1rem;
}

.address-block .text-muted {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.shipping-selector {
    margin-bottom: 0.5rem;
}

.shipping-selector select {
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
}

#shipping-manual-form .form-control {
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.checkbox-inline input[type="checkbox"] {
    accent-color: var(--accent);
}

/* ===== Mobile Header (hidden on desktop) ===== */
.mobile-header {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.mobile-header h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
}

.btn-menu-toggle {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary);
    padding: 0.25rem;
}

.btn-menu-close {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 9;
}

/* ===== Responsive: Tablet & Mobile ===== */
@media (max-width: 768px) {

    /* Mobile header visible */
    .mobile-header {
        display: flex;
    }

    /* Sidebar slides in from left */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 30;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-backdrop.open {
        display: block;
    }

    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .btn-menu-close {
        display: block;
    }

    /* Main content full width */
    .main-content {
        margin-left: 0 !important;
        padding: 1rem !important;
        max-width: 100% !important;
    }

    /* Section headers stack */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }

    .page-title {
        font-size: 1.375rem;
    }

    .page-subtitle {
        font-size: 0.85rem;
    }

    /* Editor document */
    .editor-container {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    /* Document header stacks */
    .doc-header {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }

    .doc-meta h2 {
        text-align: left;
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .meta-row {
        justify-content: flex-start;
    }

    .doc-input {
        text-align: left;
    }

    /* Client section */
    .doc-client-section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .client-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }

    .client-selector select {
        max-width: 100%;
        width: 100%;
    }

    /* Tables - horizontal scroll */
    .doc-table-section {
        margin-bottom: 1.5rem;
    }

    .doc-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .doc-table thead,
    .doc-table tbody,
    .doc-table tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }

    .doc-cell-input {
        font-size: 0.85rem;
        padding: 0.4rem;
    }

    /* Data tables (historial, clientes) */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-md);
    }

    .data-table th,
    .data-table td {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Signatures side by side but smaller */
    .doc-signatures {
        gap: 1.5rem;
        margin-top: 2rem;
    }

    .signature-area {
        height: 80px;
    }

    /* AI Uploader */
    .ai-uploader {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }

    .ai-uploader-content i.ph-magic-wand {
        font-size: 2rem;
    }

    .ai-uploader-content h3 {
        font-size: 1rem;
    }

    /* Modal full width on mobile */
    .modal-content {
        max-width: 95vw;
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-body {
        max-height: 60vh;
    }

    .form-group.row {
        flex-direction: column;
        gap: 0;
    }

    /* Totals */
    .doc-totals {
        align-items: flex-start;
    }

    .total-row {
        font-size: 1rem;
    }

    /* Notes */
    .doc-notes textarea {
        min-height: 60px;
    }

    /* Toast position */
    .toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }

    .toast {
        font-size: 0.85rem;
        padding: 0.75rem 1rem;
    }
}

/* ===== Extra small phones ===== */
@media (max-width: 400px) {
    .main-content {
        padding: 0.5rem !important;
    }

    .editor-container {
        padding: 0.75rem;
    }

    .page-title {
        font-size: 1.125rem;
    }

    .doc-meta h2 {
        font-size: 1.25rem;
    }

    .header-actions {
        flex-direction: column;
    }

    .doc-signatures {
        flex-direction: column;
        gap: 1.5rem;
    }
}

/* Print Styles - Clean Luxury Aesthetic */
@media print {
    @page {
        margin: 12mm 15mm;
        size: A4;
    }

    body {
        background: white !important;
        color: #1a1a1a !important;
        font-family: 'Inter', sans-serif !important;
        font-size: 9pt !important;
        line-height: 1.4 !important;
    }

    .no-print,
    .sidebar,
    .section-header {
        display: none !important;
    }

    .app-container {
        display: block !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }

    .editor-container {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Header - compact */
    .doc-header {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        border-bottom: 2px solid #000 !important;
        margin-bottom: 1rem !important;
        padding-bottom: 0.75rem !important;
    }

    .doc-company-info h3 {
        color: #000 !important;
        font-weight: 700 !important;
        letter-spacing: 0.05em !important;
        text-transform: uppercase !important;
        margin-bottom: 0.25rem !important;
    }

    .doc-company-info p {
        font-size: 8pt !important;
        margin-bottom: 0 !important;
        line-height: 1.4 !important;
    }

    .doc-meta h2 {
        color: #000 !important;
        font-weight: 300 !important;
        letter-spacing: 0.1em !important;
        margin-bottom: 0.5rem !important;
        font-size: 1.5rem !important;
        text-align: right !important;
    }

    /* Aligned meta fields — fixed width label */
    .meta-row {
        display: flex !important;
        justify-content: flex-end !important;
        align-items: center !important;
        margin-bottom: 0.2rem !important;
        height: 1.2rem !important;
    }

    .meta-label {
        width: 100px !important;
        text-align: right !important;
        font-size: 8pt !important;
        color: #666 !important;
        font-weight: 500 !important;
        padding-right: 0.75rem !important;
    }

    .doc-input {
        border: none !important;
        background: transparent !important;
        color: #000 !important;
        font-size: 9.5pt !important;
        font-weight: 600 !important;
        width: 140px !important;
        padding: 0 !important;
        text-align: left !important;
        margin: 0 !important;
    }

    /* Remove date picker calendar icon */
    input[type="date"]::-webkit-calendar-picker-indicator {
        display: none !important;
        -webkit-appearance: none !important;
    }

    input[type="date"] {
        -webkit-appearance: none !important;
        -moz-appearance: textfield !important;
    }

    /* Client section - split left/right */
    .doc-client-section {
        background-color: transparent !important;
        border: 1px solid #ccc !important;
        padding: 0.75rem 1rem !important;
        border-radius: 4px !important;
        margin-bottom: 1rem !important;
    }

    .address-dual-grid {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        width: 100% !important;
        gap: 2rem !important;
    }

    .address-block {
        flex: 1 !important;
        padding: 0 !important;
    }

    .address-billing {
        text-align: left !important;
    }

    .address-shipping {
        text-align: right !important;
    }

    .address-block-header {
        color: #000 !important;
        border-bottom: 1px solid #000 !important;
        margin-bottom: 0.25rem !important;
        padding-bottom: 0.1rem !important;
    }

    .address-block-header i {
        display: none !important;
        /* Hide icons in print */
    }

    .client-details {
        line-height: 1.4 !important;
        font-size: 9pt !important;
    }

    .address-block .text-muted {
        color: #333 !important;
        /* Darker for print */
        font-size: 9pt !important;
    }

    /* Table sections - compact */
    .doc-table-section {
        margin-bottom: 0.75rem !important;
    }

    .doc-table-section h3 {
        font-size: 10pt !important;
        margin-bottom: 0.25rem !important;
        padding-bottom: 0.25rem !important;
    }

    .doc-table th {
        color: #000 !important;
        border-bottom: 1px solid #000 !important;
        text-transform: uppercase !important;
        font-size: 7.5pt !important;
        letter-spacing: 0.05em !important;
        font-weight: 600 !important;
        padding: 0.3rem 0.4rem !important;
    }

    .doc-table td {
        border-bottom: 1px solid #eee !important;
        color: #333 !important;
        padding: 0.25rem 0.4rem !important;
    }

    .doc-cell-input {
        border: none !important;
        background: transparent !important;
        resize: none !important;
        color: #333 !important;
        padding: 0.15rem 0 !important;
        font-size: 9pt !important;
        text-align: inherit !important;
    }

    .doc-notes textarea {
        border: none !important;
        background: transparent !important;
        resize: none !important;
        color: #333 !important;
        padding: 0.5rem 0 !important;
        min-height: auto !important;
        font-size: 9pt !important;
    }

    .doc-notes {
        margin-bottom: 0 !important;
    }

    .doc-notes h3 {
        font-size: 10pt !important;
        margin-bottom: 0.25rem !important;
    }

    /* Fix table columns width for more "oxygen" */
    #table-productos {
        table-layout: fixed !important;
        width: 100% !important;
    }

    #table-productos th:nth-child(1),
    #table-productos td:nth-child(1) {
        width: 80px !important;
        text-align: center !important;
    }

    #table-productos th:nth-child(2),
    #table-productos td:nth-child(2) {
        width: auto !important;
    }

    #table-bultos {
        table-layout: fixed !important;
        width: 100% !important;
    }

    #table-bultos th:nth-child(1),
    #table-bultos td:nth-child(1) {
        width: 90px !important;
        text-align: center !important;
    }

    #table-bultos th:nth-child(3),
    #table-bultos td:nth-child(3) {
        width: 90px !important;
        text-align: center !important;
    }

    #table-bultos th:nth-child(2),
    #table-bultos td:nth-child(2) {
        width: auto !important;
    }

    /* Hide action column in print */
    .doc-table td:last-child,
    .doc-table th:last-child {
        display: none !important;
    }

    /* Totals - compact */
    .doc-totals {
        border-top: 1px solid #000 !important;
        padding-top: 0.5rem !important;
        margin-top: 0.5rem !important;
    }

    .total-row {
        font-size: 9pt !important;
    }

    .total-row strong {
        color: #000 !important;
    }

    /* Signatures - compact, always visible */
    .doc-signatures {
        border-top: none !important;
        margin-top: 1.5rem !important;
        padding-top: 0.5rem !important;
        gap: 2rem !important;
    }

    .signature-title {
        margin-bottom: 1rem !important;
        font-size: 8pt !important;
    }

    .signature-area {
        border: none !important;
        height: 70px !important;
    }

    .signature-line {
        border-top: 1px solid #000 !important;
        color: #666 !important;
        font-size: 8pt !important;
    }
}