:root {
    --ink: #17181a;
    --charcoal: #242321;
    --graphite: #343331;
    --stone: #f4f1eb;
    --paper: #fffdf8;
    --line: #ddd6c9;
    --gold: #a78b2d;
    --gold-dark: #776118;
    --aqua: #0f8b8d;
    --green: #207a4c;
    --red: #b33b3b;
    --shadow: 0 18px 55px rgba(23, 24, 26, .12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--stone);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 248, .95);
    color: var(--ink);
    padding: 12px 13px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(167, 139, 45, .14);
}

label span {
    display: block;
    margin-bottom: 7px;
    color: #5d584f;
    font-size: 13px;
    font-weight: 700;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr);
    background: var(--paper);
}

.login-visual {
    min-height: 100vh;
    display: flex;
    align-items: flex-end;
    padding: 56px;
    background:
        linear-gradient(180deg, rgba(23, 24, 26, .08), rgba(23, 24, 26, .78)),
        url("../assets/hero-pool.jpg") center / cover;
}

.visual-copy {
    max-width: 720px;
    color: #fff;
}

.visual-copy p,
.eyebrow {
    margin: 0 0 8px;
    color: var(--gold);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.visual-copy h1 {
    margin: 0;
    font-size: clamp(44px, 7vw, 88px);
    line-height: .95;
}

.visual-copy span {
    display: block;
    max-width: 540px;
    margin-top: 20px;
    color: rgba(255, 255, 255, .86);
    font-size: 18px;
    line-height: 1.6;
}

.login-panel {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 52px;
    background:
        linear-gradient(180deg, rgba(255, 253, 248, .95), rgba(244, 241, 235, .94)),
        url("../assets/tile-art.jpg") center / cover;
}

.login-panel.narrow {
    width: min(460px, calc(100vw - 32px));
    min-height: auto;
    margin: auto;
    box-shadow: var(--shadow);
}

.login-logo {
    width: min(420px, 100%);
    height: auto;
    margin-bottom: 38px;
    image-rendering: auto;
}

.login-mark {
    width: 92px;
    height: auto;
}

.login-heading h2,
.section-heading h2,
.split-actions h2,
.admin-panel h2 {
    margin: 0;
    color: var(--charcoal);
    font-size: 28px;
}

.stack-form {
    display: grid;
    gap: 18px;
    margin-top: 26px;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
    background:
        linear-gradient(90deg, rgba(244, 241, 235, .9), rgba(244, 241, 235, .68)),
        url("../assets/interior-pool.jpg") center / cover fixed;
}

.side-nav {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 26px;
    background: rgba(23, 24, 26, .94);
    color: #fff;
}

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

.brand-lockup img {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #fff;
}

.brand-lockup strong,
.brand-lockup small {
    display: block;
}

.brand-lockup small {
    color: rgba(255, 255, 255, .62);
}

.side-nav nav {
    display: grid;
    gap: 10px;
}

.side-nav nav a,
.logout-form button {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    color: #fff;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
}

.side-nav nav a:hover,
.logout-form button:hover {
    border-color: rgba(167, 139, 45, .7);
    background: rgba(167, 139, 45, .16);
}

.logout-form {
    margin-top: auto;
}

.main-panel {
    padding: 28px;
}

.topbar,
.split-actions,
.section-heading.inline,
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.form-actions.end {
    justify-content: flex-end;
}

.topbar {
    margin-bottom: 22px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 44px);
}

.user-chip {
    min-width: 170px;
    padding: 12px 16px;
    border: 1px solid rgba(167, 139, 45, .28);
    border-radius: 8px;
    background: rgba(255, 253, 248, .82);
    text-align: right;
}

.user-chip span,
.user-chip small {
    display: block;
}

.user-chip small {
    color: var(--gold-dark);
    font-weight: 800;
    text-transform: uppercase;
}

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 850;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    background: var(--gold);
    color: #fff;
    box-shadow: 0 12px 24px rgba(167, 139, 45, .2);
}

.button.secondary {
    background: var(--charcoal);
    color: #fff;
}

.button.ghost {
    border: 1px solid var(--line);
    background: rgba(255, 253, 248, .88);
    color: var(--charcoal);
}

.button.accept {
    background: var(--green);
    color: #fff;
}

.button.reject {
    background: var(--red);
    color: #fff;
}

.button.small {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 12px;
}

.button.wide {
    width: 100%;
}

.alert {
    margin: 0 0 18px;
    border-radius: 8px;
    padding: 13px 15px;
    font-weight: 750;
}

.alert.success {
    border: 1px solid rgba(32, 122, 76, .25);
    background: rgba(32, 122, 76, .1);
    color: var(--green);
}

.alert.danger {
    border: 1px solid rgba(179, 59, 59, .25);
    background: rgba(179, 59, 59, .09);
    color: var(--red);
}

.split-actions,
.table-surface,
.form-band,
.admin-panel,
.metrics-grid article {
    border: 1px solid rgba(221, 214, 201, .8);
    border-radius: 8px;
    background: rgba(255, 253, 248, .9);
    box-shadow: var(--shadow);
}

.split-actions,
.form-band,
.admin-panel {
    padding: 24px;
}

.muted,
.refresh-note {
    color: #686158;
}

.table-surface {
    margin-top: 18px;
    overflow: hidden;
}

.responsive-table {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
}

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: #625c53;
    font-size: 12px;
    text-transform: uppercase;
}

td small {
    display: block;
    color: #857d72;
    margin-top: 3px;
}

.empty-state {
    padding: 34px 16px;
    color: #776f64;
    text-align: center;
}

.status {
    display: inline-flex;
    min-width: 86px;
    justify-content: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.status.pending {
    background: rgba(167, 139, 45, .15);
    color: var(--gold-dark);
}

.status.accepted {
    background: rgba(32, 122, 76, .13);
    color: var(--green);
}

.status.rejected {
    background: rgba(179, 59, 59, .12);
    color: var(--red);
}

.order-form {
    display: grid;
    gap: 18px;
}

.section-heading {
    margin-bottom: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.form-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide-field {
    grid-column: 1 / -1;
}

.items-table {
    display: grid;
    gap: 10px;
}

.item-row {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) 82px 82px 92px 136px 82px 136px 136px 116px 38px;
    gap: 8px;
    align-items: end;
}

.manual-format .item-row {
    grid-template-columns: minmax(260px, 2fr) 82px 82px 92px 136px 82px 136px 136px 116px 38px;
}

.manual-format input,
.manual-format output {
    min-width: 0;
    min-height: 44px;
    font-size: 14px;
    line-height: 1.2;
}

.item-field {
    min-width: 0;
}

.items-table .item-field > span {
    display: none !important;
}

.item-head {
    align-items: start;
    padding-bottom: 6px;
    color: #675f54;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.15;
    text-transform: uppercase;
}

.item-row output {
    display: block;
    min-height: 44px;
    padding: 12px 0 0;
    white-space: nowrap;
    color: var(--gold-dark);
    font-weight: 900;
}

.icon-button {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    cursor: pointer;
}

.totals-band {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
}

.toggle-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 248, .8);
}

.toggle-card input {
    width: 18px;
    height: 18px;
    accent-color: var(--gold);
}

.toggle-card span {
    margin: 0;
    color: var(--charcoal);
}

.summary-box {
    display: grid;
    gap: 12px;
    align-self: start;
    padding: 18px;
    border-radius: 8px;
    background: var(--charcoal);
    color: #fff;
}

.offer-items {
    display: grid;
    gap: 16px;
}

.offer-item-card {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
    padding: 18px;
    border: 1px solid rgba(221, 214, 201, .9);
    border-radius: 8px;
    background: rgba(255, 253, 248, .72);
}

.offer-image-field {
    display: grid;
    gap: 12px;
    align-content: start;
}

.image-preview {
    display: grid;
    min-height: 158px;
    place-items: center;
    overflow: hidden;
    border: 1px dashed rgba(167, 139, 45, .58);
    border-radius: 8px;
    background: rgba(244, 241, 235, .65);
    color: #746d63;
    font-size: 13px;
    font-weight: 800;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.offer-item-fields {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, .75fr) minmax(0, .9fr) minmax(0, .75fr);
    gap: 14px;
    align-items: end;
}

.offer-total-field output {
    display: block;
    min-height: 44px;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 248, .95);
    color: var(--gold-dark);
    font-weight: 900;
    white-space: nowrap;
}

.offer-remove {
    width: 100%;
}

.summary-box div,
.print-total div {
    display: flex;
    justify-content: space-between;
    gap: 18px;
}

.grand-total {
    border-top: 1px solid rgba(255, 255, 255, .18);
    padding-top: 12px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.metrics-grid article {
    padding: 20px;
}

.metrics-grid span {
    color: #696257;
    font-size: 13px;
    font-weight: 800;
}

.metrics-grid strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
}

.metrics-grid small {
    display: block;
    margin-top: 8px;
    color: #746d61;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.filter-form {
    display: grid;
    grid-template-columns: minmax(210px, 1fr) 160px auto;
    gap: 10px;
}

.filter-form.compact-filter {
    grid-template-columns: minmax(210px, 1fr) auto;
}

.sales-create-form {
    align-items: end;
}

.toggle-line,
.table-toggle {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    color: #4f4a43;
    font-weight: 850;
}

.toggle-line input,
.table-toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--gold);
}

.toggle-line span,
.table-toggle span {
    margin: 0;
}

.table-heading {
    padding: 22px 24px 0;
}

.sales-row-form {
    margin: 0;
}

.table-surface input {
    min-width: 130px;
    padding: 9px 10px;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-actions form {
    display: flex;
    gap: 7px;
}

.reject-form input {
    min-width: 130px;
    height: 34px;
    padding: 7px 9px;
}

.toast-host {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 40;
    display: grid;
    gap: 10px;
}

.toast {
    width: min(360px, calc(100vw - 44px));
    border: 1px solid rgba(167, 139, 45, .35);
    border-radius: 8px;
    background: rgba(23, 24, 26, .94);
    color: #fff;
    padding: 16px;
    box-shadow: var(--shadow);
    animation: toast-in .28s ease;
}

.order-popup {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(23, 24, 26, .28);
    backdrop-filter: blur(3px);
    animation: toast-in .22s ease;
}

.order-popup-card {
    position: relative;
    width: min(430px, 100%);
    border: 1px solid rgba(167, 139, 45, .45);
    border-radius: 8px;
    background: rgba(255, 253, 248, .98);
    padding: 26px;
    box-shadow: 0 24px 70px rgba(23, 24, 26, .28);
}

.order-popup-card span {
    color: var(--gold-dark);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.order-popup-card h2 {
    margin: 8px 0 10px;
    color: var(--charcoal);
    font-size: 28px;
    line-height: 1.1;
}

.order-popup-card p {
    margin: 0 0 20px;
    color: #5d584f;
    line-height: 1.55;
}

.order-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    cursor: pointer;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.print-body {
    background:
        radial-gradient(circle at 18% 12%, rgba(167, 139, 45, .12), transparent 28%),
        radial-gradient(circle at 82% 0, rgba(23, 24, 26, .08), transparent 24%),
        #ded9cf;
    padding: 22px;
}

.print-toolbar {
    width: min(1040px, 100%);
    margin: 0 auto 18px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.print-sheet {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 18mm;
    background: #fff;
    color: #1c1c1c;
    box-shadow: 0 24px 80px rgba(9, 19, 32, .22);
}

.premium-print {
    width: 210mm;
    min-height: 297mm;
    padding: 10mm 12mm 14mm;
    font-size: 9.2px;
    background:
        linear-gradient(135deg, rgba(23, 24, 26, .04), transparent 30%),
        linear-gradient(315deg, rgba(167, 139, 45, .08), transparent 28%),
        #fff;
}

.print-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 26px;
    border-bottom: 3px solid var(--gold);
    padding-bottom: 18px;
}

.print-header img {
    width: 240px;
    height: auto;
}

.print-header h1 {
    margin: 0;
    text-transform: uppercase;
}

.print-hero {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 10px;
    border: 0;
    padding: 8px;
    border-radius: 18px;
    border: 1px solid rgba(167, 139, 45, .34);
    background: linear-gradient(90deg, #f5f3ee, #fbfaf7);
    color: #17181a;
    break-inside: avoid;
    page-break-inside: avoid;
}

.order-letterhead {
    break-inside: avoid;
    page-break-inside: avoid;
}

.modern-letterhead {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    margin-bottom: 8px;
    padding: 0 0 10px;
}

.modern-letterhead::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(36, 35, 33, .24), rgba(167, 139, 45, .8), rgba(36, 35, 33, .08));
}

.letterhead-mark {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.letterhead-copy {
    display: grid;
    gap: 1px;
}

.letterhead-copy strong {
    color: #17181a;
    font-family: "Arial Rounded MT Bold", "Trebuchet MS", Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -.45px;
    line-height: .95;
}

.letterhead-copy span {
    color: #8c741d;
    font-size: 7px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.group-letterhead {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1054 / 245;
    object-fit: contain;
    margin-bottom: 8px;
    background: #fff;
}

.order-letterhead .print-brand {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
}

.print-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.print-company-logo {
    display: block;
    width: auto;
    height: 46px;
    max-width: 189px;
    object-fit: contain;
    object-position: left center;
}

.print-company-logo.tilevolution-logo {
    max-width: 112px;
}

.print-mark-logo {
    width: 58px;
    height: auto;
}

.print-hero p {
    margin: 0;
    color: #514d47;
    line-height: 1.45;
}

.print-title-block {
    min-width: 220px;
    border: 1px solid rgba(167, 139, 45, .28);
    border-radius: 14px;
    padding: 9px 10px;
    text-align: right;
    background: #fffdf8;
}

.print-title-block span {
    color: #c2a23a;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.print-info-grid span,
.print-project-line span,
.print-terms span {
    color: #8c741d;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .35px;
    text-transform: uppercase;
}

.print-title-block h1 {
    margin: 5px 0;
    color: #17181a;
    font-size: 20px;
    line-height: 1.05;
}

.print-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr .78fr;
    gap: 7px;
    margin: 9px 0 8px;
}

.print-info-grid div,
.print-project-line,
.print-terms div {
    border: 1px solid rgba(23, 24, 26, .14);
    border-radius: 12px;
    padding: 8px;
    background: rgba(255, 253, 248, .88);
    break-inside: avoid;
    page-break-inside: avoid;
}

.print-info-grid strong,
.print-project-line strong {
    display: block;
    margin-top: 5px;
    color: #17181a;
    font-size: 10.5px;
}

.print-info-grid p,
.print-terms p {
    margin: 6px 0 0;
    color: #514d47;
    line-height: 1.45;
}

.print-project-line {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 8px;
    border-color: rgba(167, 139, 45, .28);
    background: linear-gradient(90deg, rgba(167, 139, 45, .12), rgba(23, 24, 26, .035));
}

.print-meta {
    display: grid;
    grid-template-columns: 1.25fr 1fr .8fr;
    gap: 14px;
    margin: 24px 0;
}

.print-meta div,
.print-notes,
.signature-grid div {
    border: 1px solid rgba(23, 24, 26, .14);
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, .84);
}

.print-meta span,
.signature-grid span {
    display: block;
    color: #655f56;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.print-table {
    min-width: 0;
}

.print-table th,
.print-table td {
    padding: 6px;
    border: 0;
    border-bottom: 1px solid rgba(23, 24, 26, .12);
}

.manual-print-table {
    table-layout: fixed;
    font-size: 8.8px;
    line-height: 1.3;
    border: 1px solid rgba(23, 24, 26, .13);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 13px;
    overflow: hidden;
    background: #fff;
}

.manual-print-table th,
.manual-print-table td {
    overflow-wrap: normal;
    vertical-align: middle;
}

.manual-print-table th {
    padding: 6px 4px;
    color: #17181a;
    background: #ece8df;
    font-size: 8px;
    line-height: 1.12;
    vertical-align: top;
}

.manual-print-table td {
    padding: 5px 4px;
    font-size: 8.8px;
    line-height: 1.3;
    background: #fff;
}

.manual-print-table tbody tr:nth-child(even) td {
    background: #f7f4ec;
}

.manual-print-table td strong {
    display: block;
    font-size: 8.8px;
    line-height: 1.25;
}

.manual-print-table .product-cell {
    overflow-wrap: anywhere;
    vertical-align: middle;
    color: #17181a;
}

.manual-print-table .number-cell {
    white-space: nowrap;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.manual-print-table .money-cell {
    white-space: nowrap;
    text-align: right;
    font-size: 8.2px;
    font-variant-numeric: tabular-nums;
}

.manual-print-table .col-no {
    width: 3%;
}

.manual-print-table .col-product {
    width: 25%;
}

.manual-print-table .col-product-wide {
    width: 36%;
}

.manual-print-table .col-small {
    width: 7.2%;
}

.manual-print-table .col-discount {
    width: 6.4%;
}

.manual-print-table .col-money {
    width: 10%;
}

.manual-print-table small {
    color: #6f685f;
}

.print-lower-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 245px;
    gap: 10px;
    align-items: start;
    margin-top: 10px;
}

.offer-info-grid {
    grid-template-columns: 1.2fr .8fr .9fr;
}

.offer-print-items {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.offer-letter-copy,
.offer-closing-copy {
    margin: 8px 0;
    color: #242321;
    font-size: 9px;
    line-height: 1.45;
    padding: 7px 9px;
    border-radius: 12px;
    background: rgba(244, 241, 235, .72);
}

.offer-letter-copy p,
.offer-closing-copy p {
    margin: 0 0 6px;
}

.offer-print-item {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) 190px;
    gap: 8px;
    align-items: stretch;
    border: 1px solid rgba(23, 24, 26, .13);
    border-radius: 14px;
    padding: 7px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(23, 24, 26, .06);
    break-inside: avoid;
    page-break-inside: avoid;
}

.offer-print-image {
    display: grid;
    min-height: 76px;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(23, 24, 26, .13);
    border-radius: 12px;
    background: #f4f1eb;
    color: #777066;
    font-size: 8px;
    font-weight: 900;
    text-transform: uppercase;
}

.offer-print-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.offer-print-detail span {
    display: inline-flex;
    width: fit-content;
    border-radius: 999px;
    padding: 2px 7px;
    color: #17181a;
    background: rgba(167, 139, 45, .18);
    font-size: 8px;
    font-weight: 900;
    text-transform: uppercase;
}

.offer-print-detail h2 {
    margin: 5px 0 4px;
    color: var(--charcoal);
    font-size: 10.8px;
    line-height: 1.2;
}

.offer-print-detail p {
    margin: 0;
    color: #514d47;
    font-size: 8.5px;
    line-height: 1.35;
}

.offer-print-price {
    display: grid;
    gap: 3px;
    align-content: start;
    border-radius: 12px;
    padding: 6px;
    border: 1px solid rgba(167, 139, 45, .25);
    background: #f5f3ee;
}

.offer-print-price div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 8px;
    font-variant-numeric: tabular-nums;
}

.offer-print-price span {
    color: #655f56;
    font-weight: 800;
}

.offer-print-price strong {
    color: #17181a;
    white-space: nowrap;
}

.offer-lower-grid {
    margin-top: 9px;
}

.print-terms {
    display: grid;
    gap: 7px;
}

.print-total {
    display: grid;
    gap: 6px;
    width: 245px;
    margin: 10px 0 0 auto;
}

.print-total .grand-total {
    border-top: 1px solid rgba(167, 139, 45, .45);
}

.premium-total {
    width: auto;
    margin: 0;
    border: 0;
    border-radius: 14px;
    padding: 9px;
    border: 1px solid rgba(167, 139, 45, .25);
    background: #f5f3ee;
    color: #17181a;
    break-inside: avoid;
    page-break-inside: avoid;
}

.premium-total span {
    color: #655f56;
}

.premium-total strong {
    color: #17181a;
}

.print-notes {
    margin-top: 24px;
}

.signature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 18px;
    text-align: center;
    break-inside: avoid;
    page-break-inside: avoid;
}

.signature-grid strong {
    display: block;
    min-height: 48px;
    padding-top: 30px;
}

.signature-grid strong small {
    display: block;
    margin-top: 3px;
    color: #655f56;
    font-size: 8px;
    font-weight: 700;
}

.branch-footer {
    margin-top: 12px;
    padding-top: 9px;
    border-top: 2px solid #17181a;
    break-inside: avoid;
    page-break-inside: avoid;
}

.branch-footer > span {
    display: block;
    margin-bottom: 6px;
    color: var(--gold-dark);
    font-size: 8px;
    font-weight: 900;
    text-transform: uppercase;
}

.branch-address-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px 9px;
}

.branch-address-grid p {
    margin: 0;
    color: #514d47;
    font-size: 6.4px;
    line-height: 1.3;
}

.branch-address-grid strong {
    display: inline;
    color: #3f3b36;
    font-size: 6.2px;
    font-weight: 800;
}

@media (max-width: 980px) {
    .auth-page,
    .app-shell,
    .totals-band {
        grid-template-columns: 1fr;
    }

    .login-visual {
        min-height: 44vh;
        padding: 32px;
    }

    .login-panel {
        min-height: auto;
        padding: 32px;
    }

    .side-nav {
        position: static;
        height: auto;
    }

    .form-grid,
    .form-grid.compact,
    .form-grid.two-columns,
    .offer-item-card,
    .offer-item-fields,
    .metrics-grid,
    .print-meta,
    .print-info-grid,
    .print-lower-grid,
    .signature-grid {
        grid-template-columns: 1fr;
    }

    .item-head {
        display: none;
    }

    .item-row,
    .manual-format .item-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
        padding: 16px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: rgba(255, 253, 248, .72);
    }

    .item-product,
    .item-total,
    .item-row .icon-button {
        grid-column: 1 / -1;
    }

    .items-table .item-field > span {
        display: block !important;
        min-height: auto;
        margin-bottom: 7px;
        font-size: 12px;
        line-height: 1.25;
    }

    .item-row output {
        padding: 12px 13px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: rgba(255, 253, 248, .95);
    }

    .item-row .icon-button {
        width: 100%;
    }

    .topbar,
    .split-actions,
    .section-heading.inline,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-form {
        grid-template-columns: 1fr;
    }

    .image-preview {
        min-height: 190px;
    }
}

@media (max-width: 560px) {
    html,
    body {
        width: 100%;
        overflow-x: hidden;
    }

    body {
        font-size: 14px;
    }

    input,
    select,
    textarea {
        padding: 10px 11px;
        font-size: 14px;
    }

    label span {
        font-size: 12px;
    }

    .auth-page {
        grid-template-columns: 1fr;
    }

    .visual-copy h1,
    .topbar h1 {
        font-size: 34px;
        line-height: 1.05;
    }

    .app-shell {
        display: block;
        min-width: 0;
        background:
            linear-gradient(180deg, rgba(244, 241, 235, .78), rgba(244, 241, 235, .64)),
            url("../assets/interior-pool.jpg") center top / cover fixed;
    }

    .side-nav {
        gap: 16px;
        width: 100%;
        min-width: 0;
        padding: 18px;
    }

    .brand-lockup img {
        width: 42px;
        height: 42px;
    }

    .side-nav nav {
        gap: 8px;
    }

    .side-nav nav a,
    .logout-form button {
        min-height: 42px;
        padding: 10px 12px;
        font-size: 15px;
    }

    .main-panel {
        width: 100%;
        min-width: 0;
        padding: 18px;
    }

    .topbar {
        gap: 14px;
        margin-bottom: 16px;
    }

    .user-chip {
        width: 100%;
        min-width: 0;
        text-align: left;
    }

    .split-actions,
    .form-band,
    .admin-panel {
        padding: 18px;
    }

    .split-actions h2,
    .section-heading h2,
    .login-heading h2,
    .admin-panel h2 {
        font-size: 25px;
        line-height: 1.1;
    }

    .muted,
    .refresh-note {
        font-size: 14px;
        line-height: 1.45;
    }

    .button {
        width: 100%;
        min-height: 42px;
        padding: 10px 12px;
        font-size: 14px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .metrics-grid article {
        padding: 16px;
    }

    .filter-form {
        grid-template-columns: 1fr;
    }

    .filter-form.compact-filter,
    .offer-item-fields {
        grid-template-columns: 1fr;
    }

    .table-surface,
    .responsive-table {
        width: 100%;
        overflow: visible;
    }

    .responsive-table table {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0 10px;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td {
        display: block;
        width: 100%;
    }

    .responsive-table tr {
        border: 1px solid rgba(221, 214, 201, .9);
        border-radius: 8px;
        background: rgba(255, 253, 248, .92);
        overflow: hidden;
        box-shadow: 0 10px 22px rgba(23, 24, 26, .08);
    }

    .responsive-table td {
        display: grid;
        grid-template-columns: 108px minmax(0, 1fr);
        gap: 12px;
        padding: 10px 12px;
        border-bottom: 1px solid rgba(221, 214, 201, .72);
        font-size: 14px;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    .responsive-table td:last-child {
        border-bottom: 0;
    }

    .responsive-table td::before {
        content: attr(data-label);
        color: #625c53;
        font-size: 10px;
        font-weight: 900;
        line-height: 1.25;
        text-transform: uppercase;
    }

    .responsive-table td.empty-state {
        display: block;
        padding: 22px;
        text-align: center;
    }

    .responsive-table td.empty-state::before {
        content: "";
    }

    .responsive-table .button.small {
        width: 100%;
    }

    .admin-actions,
    .admin-actions form {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
    }

    .reject-form input,
    .table-surface input {
        width: 100%;
        min-width: 0;
    }

    .item-row,
    .manual-format .item-row {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .manual-format input,
    .manual-format output {
        font-size: 14px;
    }

    .totals-band {
        gap: 14px;
    }

    .summary-box {
        padding: 16px;
    }

    .offer-item-card {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .image-preview {
        min-height: 180px;
    }

    .toggle-card {
        align-items: flex-start;
    }

    .toast-host {
        right: 14px;
        bottom: 14px;
    }

    .order-popup {
        padding: 16px;
    }

    .order-popup-card {
        padding: 22px;
    }
}

@media (max-width: 420px) {
    .main-panel {
        padding: 14px;
    }

    .split-actions,
    .form-band,
    .admin-panel {
        padding: 15px;
    }

    .responsive-table td {
        grid-template-columns: 88px minmax(0, 1fr);
        gap: 9px;
        padding: 9px 10px;
        font-size: 13px;
    }

    .status {
        min-width: 76px;
        font-size: 11px;
    }

    .branch-address-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media screen and (max-width: 760px) {
    body.print-body {
        overflow-x: hidden;
        padding: 18px 10px 34px;
    }

    .print-toolbar {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }

    .print-toolbar .button {
        width: 100%;
        min-height: 44px;
        padding: 10px;
        font-size: 13px;
        white-space: nowrap;
    }

    .order-print-toolbar .button:last-child {
        grid-column: 1 / -1;
    }

    body.print-body .print-sheet {
        width: 210mm;
        min-width: 210mm;
        min-height: 297mm;
        margin: 0 auto;
        padding: 12mm;
        transform-origin: top center;
        zoom: .68;
    }

    body.print-body .print-hero {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
    }

    body.print-body .print-info-grid {
        display: grid;
        grid-template-columns: 1fr 1fr .78fr !important;
    }

    body.print-body .offer-info-grid {
        grid-template-columns: 1.2fr .8fr .9fr !important;
    }

    body.print-body .print-lower-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 245px !important;
    }

    body.print-body .signature-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media screen and (max-width: 640px) {
    body.print-body .print-sheet {
        zoom: .58;
    }
}

@media screen and (max-width: 520px) {
    body.print-body .print-sheet {
        zoom: .48;
    }
}

@media screen and (max-width: 420px) {
    body.print-body .print-sheet {
        zoom: .44;
    }
}

@media screen and (max-width: 375px) {
    body.print-body .print-sheet {
        zoom: .4;
    }
}

@media print {
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    html,
    body {
        background: #fff;
        font-size: 9px;
    }

    .print-toolbar {
        display: none;
    }

    .print-body {
        padding: 0;
        background: #fff;
    }

    .print-sheet {
        width: 100%;
        min-height: 0;
        margin: 0;
        padding: 7mm 7mm 35mm;
        background: #fff;
        box-shadow: none;
    }

    .premium-print {
        width: 100%;
        min-height: 0;
        background: #fff;
    }

    .order-letterhead {
        position: static;
        z-index: 20;
        background: #fff;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .modern-letterhead {
        gap: 7px;
        min-height: 22px;
        margin-bottom: 2mm;
        padding-bottom: 2mm;
    }

    .modern-letterhead::after {
        height: 1px;
    }

    .letterhead-mark {
        width: 20px;
        height: 20px;
    }

    .letterhead-copy strong {
        font-size: 14px;
    }

    .letterhead-copy span {
        font-size: 4.8px;
        letter-spacing: 1.2px;
    }

    .group-letterhead {
        max-height: 18mm;
        margin-bottom: 2mm;
        object-fit: contain;
        object-position: left top;
    }

    .print-company-logo {
        width: auto;
        height: 8mm;
        max-width: 31mm;
    }

    .print-company-logo.tilevolution-logo {
        max-width: 19mm;
    }

    .print-hero {
        display: flex;
        gap: 8px;
        padding: 5px 6px;
        border-radius: 9px;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .print-mark-logo {
        width: 46px;
    }

    .print-title-block {
        min-width: 170px;
        padding: 6px 7px;
        border-radius: 8px;
    }

    .print-title-block h1 {
        font-size: 13px;
    }

    .print-title-block span {
        font-size: 9.5px;
    }

    .print-info-grid span,
    .print-project-line span,
    .print-terms span {
        font-size: 8px;
    }

    .print-info-grid {
        display: grid;
        grid-template-columns: 1fr 1fr .78fr !important;
        gap: 5px;
        margin: 0 0 5px;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .print-info-grid div,
    .print-project-line,
    .print-terms div,
    .premium-total {
        border-radius: 8px;
        padding: 5px;
    }

    .print-info-grid strong,
    .print-project-line strong,
    .print-info-grid p,
    .print-terms p {
        margin-top: 3px;
    }

    .print-project-line,
    .print-lower-grid,
    .signature-grid {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .print-lower-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 205px !important;
        gap: 7px;
        margin-top: 7px;
    }

    .signature-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 7px;
        margin-top: 12px;
    }

    .signature-grid div {
        border-radius: 8px;
        padding: 7px;
    }

    .signature-grid strong {
        min-height: 42px;
        padding-top: 25px;
    }

    .branch-footer {
        position: fixed;
        right: 7mm;
        bottom: 6mm;
        left: 7mm;
        z-index: 10;
        margin: 0;
        padding-top: 4px;
        background: #fff;
    }

    .branch-footer > span {
        margin-bottom: 3px;
        font-size: 6px;
    }

    .branch-address-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 3px 6px;
    }

    .branch-address-grid p,
    .branch-address-grid strong {
        font-size: 4.9px;
        line-height: 1.18;
    }

    .print-table {
        width: 100%;
        break-inside: auto;
        page-break-inside: auto;
    }

    .print-table th,
    .print-table td {
        padding: 3px;
    }

    .manual-print-table {
        font-size: 7.9px;
        line-height: 1.22;
        border-radius: 8px;
    }

    .manual-print-table th {
        padding: 3px;
        font-size: 6.8px;
        line-height: 1.08;
    }

    .manual-print-table td,
    .manual-print-table td strong {
        font-size: 7.9px;
        line-height: 1.2;
    }

    .manual-print-table .money-cell {
        font-size: 7.4px;
    }

    .print-table thead {
        display: table-header-group;
    }

    .print-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .offer-print-item {
        grid-template-columns: 70px minmax(0, 1fr) 168px;
        gap: 5px;
        padding: 5px;
        border-radius: 9px;
        box-shadow: none;
    }

    .offer-print-image {
        min-height: 64px;
        border-radius: 8px;
    }

    .offer-print-detail h2 {
        font-size: 8.8px;
    }

    .offer-print-detail p,
    .offer-print-price div {
        font-size: 7.4px;
    }

    .offer-letter-copy,
    .offer-closing-copy {
        margin: 6px 0;
        padding: 5px 6px;
        border-radius: 8px;
        font-size: 7.8px;
        line-height: 1.32;
    }

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