:root {
    color-scheme: light;
    --bg: #f7f4ef;
    --bg-soft: #ffffff;
    --ink: #1f1f1f;
    --muted: #5a5a5a;
    --accent: #1f6f5c;
    --accent-strong: #195a4a;
    --border: #e2ddd4;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    color: var(--ink);
    background: radial-gradient(circle at top, #fff7ea, var(--bg));
    line-height: 1.6;
}

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

.container {
    width: min(1100px, 92vw);
    margin: 0 auto;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: -999px;
    background: var(--accent);
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 999px;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
    z-index: 10;
}

.site-header {
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 0;
}

.logo img {
    display: block;
    max-width: 220px;
    height: auto;
}

.site-nav {
    display: flex;
    gap: 1.25rem;
    font-size: 0.95rem;
}

.site-nav a {
    padding: 0.35rem 0;
    border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a:focus {
    border-bottom-color: var(--accent);
}

.hero {
    padding: 4rem 0 3rem;
}

.hero h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 1rem;
}

.hero p {
    max-width: 600px;
    font-size: 1.1rem;
    color: var(--muted);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.4rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button.mini {
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
}

.button.primary {
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow);
}

.button.primary:hover,
.button.primary:focus {
    background: var(--accent-strong);
    transform: translateY(-1px);
}

.button[disabled],
.button[disabled]:hover,
.button[disabled]:focus {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button.ghost {
    border-color: var(--accent);
    color: var(--accent);
    background: transparent;
}

.highlights {
    padding: 2rem 0 4rem;
}

.highlights .container {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card h2 {
    margin-top: 0;
    margin-bottom: 0.6rem;
    font-size: 1.1rem;
}

.card p {
    margin: 0;
    color: var(--muted);
}

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
    padding: 2.5rem 0 3rem;
    font-size: 0.95rem;
    color: var(--muted);
}

.site-footer .fine-print {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.cta {
    padding: 2rem 0 4rem;
}

.cta h2 {
    margin-top: 0;
}

.muted {
    color: var(--muted);
}

.catalog,
.cart,
.checkout,
.order {
    padding: 2.5rem 0 4rem;
}

.catalog-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.price {
    font-weight: 700;
    margin: 0.75rem 0;
}

.qty-input {
    width: 80px;
    padding: 0.4rem 0.5rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-right: 0.5rem;
}

.cart-actions {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.cart-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: space-between;
    align-items: center;
}

.checkout-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.checkout-summary {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.summary-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    display: grid;
    gap: 0.5rem;
}

.summary-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.95rem;
}

.summary-totals {
    display: grid;
    gap: 0.35rem;
    font-size: 0.95rem;
}

.summary-totals div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.summary-total {
    font-weight: 700;
    margin-top: 0.5rem;
}

.quote-print .quote-header {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: center;
    margin-bottom: 2rem;
}

.quote-print .quote-logo img {
    max-width: 220px;
    height: auto;
}

.quote-print .quote-block {
    margin-bottom: 1.5rem;
}

@media print {
    .site-header,
    .site-footer,
    .admin-nav,
    .admin-header .button {
        display: none;
    }

    body {
        background: #fff;
    }
}

.admin-page {
    padding: 2.5rem 0 4rem;
}

.admin-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.form {
    display: grid;
    gap: 1.25rem;
}

.form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field {
    display: grid;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.field input,
.field textarea,
.field select {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.65rem 0.8rem;
    font: inherit;
    background: #fff;
}

.field select.select-one-row {
    height: 2.65rem;
}

.field select.select-one-row[multiple] {
    overflow-y: auto;
}

[data-color-slot-container],
[data-new-slot-container] {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(4, minmax(240px, 1fr));
    align-items: start;
}

[data-color-slot-container] .slot-card,
[data-new-slot-container] .slot-card {
    position: relative;
    display: grid;
    gap: 0.6rem;
    padding: 0.4rem 1.9rem 0.45rem 0.35rem;
    overflow: visible;
    min-width: 0;
}

[data-color-slot-container] .slot-card .field,
[data-new-slot-container] .slot-card .field {
    font-size: 0.86rem;
    min-width: 0;
}

[data-color-slot-container] .slot-card .field input,
[data-color-slot-container] .slot-card .field select,
[data-new-slot-container] .slot-card .field input,
[data-new-slot-container] .slot-card .field select {
    font-size: 0.9rem;
    padding: 0.55rem 0.65rem;
    width: 100%;
    min-width: 0;
}

.slot-remove {
    position: absolute;
    top: 0.35rem;
    right: 0.45rem;
    z-index: 2;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    border: 1px solid #a12626;
    background: #fff;
    color: #a12626;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

[data-color-slot-container] .slot-card .field:first-of-type,
[data-new-slot-container] .slot-card .field:first-of-type {
    padding-right: 1rem;
}

.slot-remove:hover,
.slot-remove:focus {
    background: #a12626;
    color: #fff;
}

.slot-color-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.74rem;
    color: var(--muted);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-subtitle {
    margin: 0.35rem 0 0.25rem;
    font-size: 1rem;
}

.form-separator {
    border: 0;
    border-top: 1px dashed var(--border);
    margin: 0.35rem 0 0.65rem;
}

.field-colors {
    margin-top: 0.45rem;
}

.icon-button {
    min-width: 2rem;
    padding: 0.2rem 0.45rem;
    line-height: 1;
}

.icon-button-green {
    color: #1f6f3f;
    border-color: #1f6f3f;
}

.icon-button-green:hover,
.icon-button-green:focus {
    background: #1f6f3f;
    color: #fff;
}

.season-range-row {
    padding-right: 0;
}

.season-range-grid {
    grid-template-columns: repeat(4, minmax(110px, 150px)) 1.2rem;
    justify-content: start;
    align-items: end;
}

.season-range-remove {
    position: static;
    align-self: end;
    margin-bottom: 0.45rem;
}

@media (max-width: 1024px) {
    [data-color-slot-container],
    [data-new-slot-container] {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

@media (max-width: 520px) {
    [data-color-slot-container],
    [data-new-slot-container] {
        grid-template-columns: 1fr;
    }
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
}

.section-title {
    margin: 1rem 0 0;
    font-size: 1.1rem;
}

.error {
    color: #a12626;
    font-weight: 500;
    font-size: 0.85rem;
}

.notice-success {
    margin: 0 0 1rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid #b7d8c4;
    border-radius: 10px;
    background: #e9f7ef;
    color: #1f5130;
    font-weight: 600;
}

.table {
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
}

.table-row {
    display: grid;
    grid-template-columns: 1.4fr 1.2fr 1fr 1fr 0.8fr 0.8fr 0.8fr;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
}

#plate-run-live-costs .table-row {
    grid-template-columns: minmax(260px, 2.4fr) repeat(6, minmax(95px, 1fr));
}

#plate-run-live-costs .table-row > div {
    min-width: 0;
}

#plate-run-live-costs .table-row > div:first-child {
    overflow-wrap: anywhere;
    line-height: 1.25;
}

.table.tight .table-row {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

#plate-run-cost-table .table-row {
    grid-template-columns: minmax(320px, 2.7fr) repeat(6, minmax(96px, 1fr));
}

#plate-run-cost-table .table-row > div {
    min-width: 0;
}

#plate-run-cost-table .table-row > div:first-child {
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.3;
    overflow: hidden;
    padding-right: 0.35rem;
}

.filaments-table .table-row {
    grid-template-columns: 1.1fr 0.9fr 0.6fr 1.35fr 0.75fr 0.75fr 0.65fr;
}

.partners-table .table-row {
    grid-template-columns: 1.2fr 1.25fr 0.7fr 1fr;
    align-items: center;
}

.product-group-table {
    margin-bottom: 1rem;
}

.product-group-table .product-main-head,
.product-group-table .product-main-row {
    grid-template-columns: 1.9fr 0.55fr 0.55fr 0.55fr 0.8fr 1fr;
    align-items: center;
}

.product-group-table .product-variant-head,
.product-group-table .product-variant-row {
    grid-template-columns: 1.8fr 0.9fr 0.7fr 0.7fr 0.7fr;
    align-items: center;
}

.partners-actions {
    display: inline-grid;
    gap: 0.35rem;
    justify-items: start;
}

.variant-create-menu {
    position: relative;
    display: inline-block;
}

.variant-create-panel {
    display: none;
    position: absolute;
    top: calc(100% + 0.2rem);
    left: 0;
    min-width: 11rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
    z-index: 20;
    padding: 0.25rem;
}

.variant-create-panel a {
    display: block;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
}

.variant-create-panel a:hover,
.variant-create-panel a:focus {
    background: #f3f1eb;
}

.variant-create-menu:hover .variant-create-panel,
.variant-create-menu:focus-within .variant-create-panel {
    display: block;
}

.slot-name-group {
    margin-top: 0.45rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    display: inline-block;
    width: fit-content;
    max-width: 100%;
}

.build-def-card {
    margin-top: 0.8rem;
    padding: 0.7rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fcfbf8;
}

.build-slot-sections {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.variant-part-card {
    margin-bottom: 0.8rem;
}

.build-slot-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.6rem;
    margin-top: 0.6rem;
}

.variant-color-grid {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-top: 0.45rem;
}

.variant-slot-card {
    padding: 0.35rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    min-width: 0;
    overflow: hidden;
}

.variant-slot-card .field {
    margin: 0;
    min-width: 0;
}

.variant-slot-card .field span {
    font-size: 0.78rem;
}

.variant-slot-card select,
.variant-slot-card input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.variant-row-top {
    grid-template-columns: minmax(240px, 1.2fr) minmax(220px, 0.8fr);
}

.compact-four {
    grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.slot-name-title {
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.slot-name-row {
    display: grid;
    grid-template-columns: 1.5rem minmax(160px, 260px) auto;
    gap: 0.55rem;
    align-items: center;
    margin-top: 0.35rem;
}

.slot-name-row input {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.5rem 0.65rem;
    font: inherit;
}

.slot-custom-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.material-warning {
    margin-top: 0.5rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid #c83b2f;
    border-left-width: 4px;
    border-radius: 8px;
    background: #fdecea;
    color: #7a1d15;
    font-weight: 600;
}

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

.copy-profile-grid .field {
    min-width: 0;
}

.copy-profile-grid .field select {
    width: 100%;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compact-three {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.filament-brand-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.color-sheet-dialog {
    width: min(980px, 95vw);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.9rem;
}

.color-sheet-dialog::backdrop {
    background: rgba(10, 18, 10, 0.35);
}

.color-sheet-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.color-sheet-dialog-head h2 {
    margin: 0;
}

.color-sheet-grid {
    grid-template-columns: 110px 1.3fr 0.7fr 2.2rem !important;
}

.sheet-swatch {
    display: inline-block;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.color-sheet-remove {
    position: static;
}

.table-row:last-child {
    border-bottom: none;
}

.table-head {
    background: #f2eee6;
    font-weight: 700;
}

.strong {
    font-weight: 700;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: #f0e6c8;
    color: #3c2f17;
    font-size: 0.75rem;
    margin-left: 0.4rem;
}

.button.danger {
    background: #a12626;
    color: #fff;
    border-color: #a12626;
}

.button.danger:hover,
.button.danger:focus {
    background: #7f1e1e;
}

.danger-zone {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.admin-block {
    margin-top: 2rem;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.admin-nav a {
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
}

.swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid var(--border);
    vertical-align: middle;
    margin-right: 0.4rem;
}

@media (max-width: 720px) {
    .site-header .container {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-nav {
        flex-wrap: wrap;
    }

    .table-row {
        grid-template-columns: 1fr;
    }
}
