/* Duology Redesign CSS - Strictly Scoped */

:root {
    --duology-primary: #3f4ff0;
    --duology-primary-light: #eff1ff;
    --duology-text-dark: #334155;
    --duology-text-muted: #64748b;
    --duology-border: #e2e8f0;
}

/* Base Typo for Documents only */
.invoice-preview-template,
.estimate-preview-template,
.proposal-preview-template,
.invoice-html-logo-wrapper,
#estimate-preview,
#proposal_content_area {
    font-family: 'Montserrat', sans-serif !important;
}

/* Document Header Titles */
.invoice-preview-template h4,
.estimate-preview-template h4,
.proposal-preview-template h4,
.invoice-html-number,
#estimate-number,
#proposal-number {
    color: var(--duology-primary) !important;
    font-weight: 700 !important;
}

/* Table Scoping - Removing generic .panel-body selectors */
.invoice-preview-template .table-responsive table,
.estimate-preview-template .table-responsive table,
.proposal-preview-template .table-responsive table,
.invoice-preview-template table.items,
.estimate-preview-template table.items,
.proposal-preview-template table.items {
    border-radius: 12px !important;
    overflow: hidden !important;
    border: 1px solid var(--duology-border) !important;
    border-collapse: separate !important;
}

/* Table Headers Scoping */
.invoice-preview-template .table-responsive table thead th,
.estimate-preview-template .table-responsive table thead th,
.proposal-preview-template .table-responsive table thead th {
    background-color: var(--duology-primary) !important;
    color: #ffffff !important;
    border: none !important;
    text-transform: uppercase !important;
    padding: 15px 10px !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    letter-spacing: 0.1em !important;
}

/* Table Row Stripes Scoping */
.invoice-preview-template .table-responsive table tbody tr:nth-child(even),
.estimate-preview-template .table-responsive table tbody tr:nth-child(even),
.proposal-preview-template .table-responsive table tbody tr:nth-child(even) {
    background-color: var(--duology-primary-light) !important;
}

/* Panel Scoping */
.panel_s.invoice-preview-template,
.panel_s.estimate-preview-template,
.panel_s.proposal-preview-template {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1) !important;
    border: none !important;
    border-radius: 16px !important;
}

/* Button Scoping */
.invoice-preview-template .btn,
.estimate-preview-template .btn,
.proposal-preview-template .btn,
.preview-top-wrapper .btn {
    background-color: var(--duology-primary) !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 6px -1px rgba(63, 79, 240, 0.4) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.invoice-preview-template .btn:hover,
.estimate-preview-template .btn:hover,
.proposal-preview-template .btn:hover,
.preview-top-wrapper .btn:hover {
    filter: brightness(1.2) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 15px -3px rgba(63, 79, 240, 0.5) !important;
}

/* Status Labels Scoping */
.invoice-preview-template .label,
.estimate-preview-template .label,
.proposal-preview-template .label {
    padding: 6px 12px !important;
    border-radius: 6px !important;
}

/* Fix Duplication in HTML Portal View */
.estimate-html-view .col-md-6.text-right span.bold:nth-of-type(2),
.estimate-html-view .col-md-6.text-right address:nth-of-type(2),
.invoice-html-view .col-md-6.text-right span.bold:nth-of-type(2),
.invoice-html-view .col-md-6.text-right address:nth-of-type(2) {
    display: none !important;
}

