:root {
    --ink: #17212b;
    --muted: #637083;
    --line: #d9e0e8;
    --panel: #ffffff;
    --soft: #f4f7f9;
    --blue: #145c9e;
    --green: #11735c;
    --red: #9a2c2c;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--soft);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: 32px;
    letter-spacing: 0;
}

.summary {
    max-width: 760px;
    margin-bottom: 0;
    color: #dce8f4;
}

.eyebrow,
.category {
    margin-bottom: 6px;
    color: var(--green);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.page-actions a,
.ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 6px;
    padding: 8px 12px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}

.print-page,
.workbench,
.layout {
    padding: 24px 36px 40px;
}

.home-shell {
    padding: 0;
}

.layout.single {
    display: grid;
    grid-template-columns: minmax(0, 840px);
}

.home-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    min-height: 48px;
    border-bottom: 1px solid var(--line);
    padding: 6px 14px;
    background: var(--panel);
}

.home-menu a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border-radius: 6px;
    padding: 8px 14px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 800;
}

.home-menu a.active,
.home-menu a:hover {
    background: #eef4f8;
    color: var(--blue);
}


.panel,
.filters,
.selection-bar,
.table-wrap,
.print-document {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

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

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 260px auto auto;
    gap: 12px;
    align-items: end;
    padding: 16px;
}

label span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select,
button,
.ghost {
    min-height: 40px;
    border-radius: 6px;
    font: inherit;
}

input,
select {
    width: 100%;
    border: 1px solid #c7d0db;
    padding: 8px 10px;
    background: #fff;
    color: var(--ink);
}

button,
.ghost,
.page-actions a {
    border: 1px solid var(--blue);
    padding: 8px 13px;
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
}

.ghost,
.page-actions a {
    background: #fff;
    color: var(--blue);
}

.back-button {
    border-color: #6fbf00;
    background: #9be22d;
    color: #173600;
}

.back-button:hover,
.back-button:focus {
    background: #86cf19;
}

.ghost.small {
    min-height: 34px;
    padding: 6px 10px;
}

.selection-bar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin: 14px 0;
    padding: 12px 16px;
}

.selection-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

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

.check input,
.select-col input {
    width: auto;
    min-height: auto;
}

.check span {
    margin-bottom: 0;
}

.inline-check {
    min-height: 40px;
}

.table-wrap {
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--line);
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #eef4f8;
    color: #283645;
    font-size: 12px;
    text-transform: uppercase;
}

.data-table tr:hover td {
    background: #f8fbfd;
}

.select-col {
    width: 70px;
    text-align: center;
}

.num {
    text-align: right !important;
    white-space: nowrap;
}

.row-note {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.calculator .panel {
    padding: 16px;
}

.sticky {
    position: sticky;
    top: 16px;
}

.calc-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
}

.calculator h2 {
    margin-bottom: 0;
    font-size: 20px;
    letter-spacing: 0;
}

.calc-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 16px 0;
}

.empty {
    padding: 16px;
    border: 1px dashed #b8c4d0;
    border-radius: 6px;
    color: var(--muted);
    text-align: center;
}

.calc-lines {
    display: grid;
    gap: 10px;
    max-height: 42vh;
    overflow: auto;
}

.calc-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px 78px auto 34px;
    gap: 8px;
    align-items: end;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.line-title span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.calc-line label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.calc-line input {
    min-height: 34px;
    padding: 6px;
}

.line-total {
    white-space: nowrap;
}

.remove {
    min-height: 34px;
    border-color: #d9a9a9;
    padding: 0;
    background: #fff;
    color: var(--red);
}

.totals {
    display: grid;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.totals div,
.quote-totals div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.totals .grand,
.quote-totals div:last-child {
    font-size: 20px;
}

.print-quote {
    width: 100%;
    margin-top: 14px;
}

.error {
    padding: 18px;
    border-color: #e0b4b4;
}

code {
    padding: 2px 4px;
    border-radius: 4px;
    background: #edf1f5;
}

.page-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.print-document {
    padding: 22px;
}

.quote-print {
    display: none;
}

.print-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.print-head h2 {
    margin-bottom: 0;
    font-size: 24px;
}

.note-row td {
    color: var(--muted);
    font-size: 12px;
    padding-top: 0;
}

.quote-totals {
    max-width: 420px;
    margin: 18px 0 0 auto;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

@media (max-width: 1100px) {
    .workbench {
        grid-template-columns: 1fr;
    }

    .sticky {
        position: static;
    }

    .calc-lines {
        max-height: none;
    }
}

@media (max-width: 760px) {
    .print-page,
    .workbench,
    .layout {
        padding: 18px;
    }

    .filters,
    .calc-line {
        grid-template-columns: 1fr;
    }

    .selection-bar,
    .print-head {
        align-items: stretch;
        flex-direction: column;
    }
}

@media print {
    @page {
        margin: 12mm;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 11px;
    }

    .no-print,
    .page-actions {
        display: none !important;
    }

    .print-page,
    .workbench,
    .layout {
        display: block;
        padding: 0;
    }

    .print-document {
        display: block;
        border: 0;
        border-radius: 0;
        padding: 0;
    }

    body.print-quote-mode .selector,
    body.print-quote-mode .calculator,
    body.print-quote-mode .catalogue-print {
        display: none !important;
    }

    body.print-quote-mode .quote-print {
        display: block !important;
    }

    .data-table {
        font-size: 10px;
    }

    .data-table th,
    .data-table td {
        padding: 5px 6px;
        border-bottom: 1px solid #bbb;
    }

    .data-table th {
        position: static;
        background: #eee !important;
        color: #000;
    }

    .data-table tr:hover td {
        background: transparent;
    }
}

.catalogue-controls {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 280px auto;
    gap: 14px;
    align-items: end;
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.control-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
}

.control-group .eyebrow {
    width: 100%;
}

.radio-line {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    min-height: 34px;
}

.radio-line input {
    width: auto;
    min-height: auto;
}

.radio-line span,
.category-filter span {
    margin-bottom: 0;
}

.category-filter span {
    margin-bottom: 6px;
}

.print-select-col {
    width: 72px;
    text-align: center !important;
}

.print-select-col input {
    width: auto;
    min-height: auto;
}

@media (max-width: 900px) {
    .catalogue-controls {
        grid-template-columns: 1fr;
    }
}

@media print {
    .catalogue-row.print-hidden,
    .catalogue-note.print-hidden {
        display: none !important;
    }
}

.front-workspace {
    position: relative;
    height: calc(100vh - 48px);
    min-height: 420px;
    overflow: hidden;
    background: #fff;
}

.front-slides,
.front-slide {
    position: absolute;
    inset: 0;
}

.front-slide {
    display: none;
}

.front-slide.active {
    display: block;
}

.front-slide img,
.front-placeholder {
    display: block;
    width: 100%;
    height: 100%;
}

.front-slide img {
    object-fit: fill;
}

.front-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: #f8fbfd;
    text-align: center;
}

.front-arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    width: 46px;
    min-height: 64px;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: rgba(23, 33, 43, .62);
    color: #fff;
    font-size: 30px;
    line-height: 1;
}

.front-prev {
    left: 0;
}

.front-next {
    right: 0;
}

.front-count {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 3;
    border-radius: 6px;
    padding: 6px 10px;
    background: rgba(23, 33, 43, .68);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.booklet-page {
    padding: 24px 36px 40px;
}

.booklet-document {
    display: grid;
    gap: 18px;
}

.booklet-sheet {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 72vh;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.booklet-sheet img,
.booklet-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 72vh;
}

.booklet-sheet img {
    object-fit: fill;
}

.booklet-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: #f8fbfd;
}

@media print {
    .booklet-page {
        padding: 0;
    }

    .booklet-document {
        display: block;
    }

    .booklet-sheet {
        width: 100vw;
        height: 100vh;
        min-height: 100vh;
        break-after: page;
        page-break-after: always;
        border: 0;
        border-radius: 0;
    }

    .booklet-sheet:last-child {
        break-after: auto;
        page-break-after: auto;
    }

    .booklet-sheet img,
    .booklet-placeholder {
        width: 100%;
        height: 100%;
        min-height: 100vh;
    }
}

.catalogue-print-button {
    align-self: end;
    white-space: nowrap;
}

.catalogue-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    padding: 8px 10px;
}

.control-group {
    flex: 1 1 520px;
    gap: 8px 12px;
}

.control-group .range-label {
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.category-filter {
    flex: 0 1 250px;
}

.category-filter span {
    display: none;
}

.category-filter select {
    min-height: 36px;
    padding: 6px 9px;
}

.catalogue-controls .inline-check {
    flex: 0 0 auto;
    min-height: 36px;
}

.catalogue-print-button {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 6px 12px;
    align-self: center;
}

@media (max-width: 900px) {
    .control-group,
    .category-filter {
        flex: 1 1 100%;
    }
}
