:root {
    --accent: #2563eb;
    --tableHead: #0f172a;
}

.invoice-root[data-template="clean"] {
    --accent: #0f766e;
    --tableHead: #111827;
}

.editable {
    position: relative;
    border-radius: 10px;
    outline: none;
    padding: 6px 10px;
    margin-left: -10px;
    margin-right: -10px;
}

.editable:focus {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
    background: color-mix(in srgb, var(--accent) 6%, white);
}

.editable::after {
    content: "✎";
    font-size: 11px;
    position: absolute;
    right: 8px;
    top: 6px;
    color: rgb(148 163 184);
    opacity: 0;
    transform: translateY(-1px);
    transition: opacity 120ms ease;
    pointer-events: none;
}

.editable:hover::after,
.editable:focus::after {
    opacity: 1;
}

.editable-title {
    font-family: "Instrument Serif", serif;
    font-size: 34px;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--accent);
    padding-right: 22px;
}

.switch {
    position: relative;
    width: 44px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgb(226 232 240);
    transition: 150ms ease;
    border-radius: 9999px;
    border: 1px solid rgb(203 213 225);
}

.switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 2px;
    background-color: white;
    transition: 150ms ease;
    border-radius: 9999px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
}

.switch input:checked+.slider {
    background-color: color-mix(in srgb, var(--accent) 18%, white);
    border-color: color-mix(in srgb, var(--accent) 50%, rgb(226 232 240));
}

.switch input:checked+.slider:before {
    transform: translateX(18px);
    background-color: var(--accent);
}

.template-card {
    border: 1px solid rgb(226 232 240);
    border-radius: 14px;
    padding: 12px;
    background: rgb(248 250 252);
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
    text-align: left;
}

.template-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 25px rgba(15, 23, 42, 0.08);
}

.template-card[data-active="true"] {
    border-color: color-mix(in srgb, var(--accent) 50%, rgb(226 232 240));
    background: color-mix(in srgb, var(--accent) 6%, rgb(248 250 252));
}

.template-mini {
    border-radius: 12px;
    height: 76px;
    padding: 10px;
    border: 1px solid rgb(226 232 240);
    background: white;
    overflow: hidden;
}

.template-mini .mini-bar {
    height: 10px;
    border-radius: 9999px;
    width: 60%;
    margin-bottom: 10px;
}

.template-mini .mini-row {
    height: 7px;
    border-radius: 9999px;
    width: 80%;
    margin-bottom: 8px;
    opacity: 0.9;
}

.template-mini .mini-row.wide {
    width: 95%;
}

.mini-classic .mini-bar,
.mini-classic .mini-row {
    background: #2563eb;
}

.mini-clean .mini-bar,
.mini-clean .mini-row {
    background: #0f766e;
}

.print-only {
    display: none !important;
}

@media print {
    .no-print {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    .print-only.flex {
        display: flex !important;
    }

    span.print-only {
        display: inline !important;
    }

    div.print-only {
        display: block !important;
    }

    div.print-only.flex {
        display: flex !important;
    }

    td.print-only {
        display: table-cell !important;
    }

    th.print-only {
        display: table-cell !important;
    }

    body {
        background: white !important;
        color: #090d16 !important;
    }

    main {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    main > div {
        display: block !important;
    }

    .invoice-root {
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 1.2cm !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .invoice-root > div {
        padding: 0 !important;
    }

    @page {
        size: A4;
        margin: 0;
    }

    th {
        background-color: var(--tableHead) !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    table, th, td {
        border-color: #cbd5e1 !important;
    }

    .editable {
        position: static !important;
        border: none !important;
        outline: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .editable::after {
        display: none !important;
    }

    .print-section-header {
        border-bottom: 2px solid var(--accent) !important;
        padding-bottom: 6px !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        color: #0f172a !important;
    }

    .print-payment-header {
        border-bottom: 2px solid #0f172a !important;
        padding-bottom: 6px !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        color: #0f172a !important;
    }

    /* Print layout classes to override Tailwind CDN dynamic variables */
    .print\:grid {
        display: grid !important;
    }
    .print\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    .print\:grid-cols-\[1fr_300px\] {
        grid-template-columns: 1fr 300px !important;
    }
    .print\:gap-10 {
        gap: 2.5rem !important;
    }
    .print\:gap-6 {
        gap: 1.5rem !important;
    }
    .print\:flex-row {
        flex-direction: row !important;
    }
    .print\:justify-between {
        justify-content: space-between !important;
    }
    .print\:items-start {
        align-items: flex-start !important;
    }

    /* Prevent print horizontal scrolling and force layout formatting */
    .overflow-x-auto {
        overflow: visible !important;
        overflow-x: visible !important;
    }

    table {
        table-layout: fixed !important;
        width: 100% !important;
        font-size: 11px !important;
    }

    th, td {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
    }

    th {
        padding: 6px 8px !important;
        font-size: 11px !important;
    }

    td {
        padding: 6px 8px !important;
    }

    th.col-product, td.col-product { width: 22% !important; }
    th.col-desc, td.col-desc { width: 28% !important; }
    th.col-qty, td.col-qty { width: 8% !important; }
    th.col-unit, td.col-unit { width: 8% !important; }
    th.col-price, td.col-price { width: 14% !important; }
    th.col-discount, td.col-discount { width: 8% !important; }
    th.col-tax, td.col-tax { width: 8% !important; }
    th.col-total, td.col-total { width: 14% !important; }

    /* Compact editable fields on paper */
    td .editable {
        font-size: 11px !important;
        line-height: 1.2 !important;
        word-break: break-word !important;
    }
}