:root {
    --ink: #17201d;
    --muted: #68736e;
    --paper: #f7f8f4;
    --surface: #ffffff;
    --line: #dfe5dd;
    --teal: #0f766e;
    --teal-dark: #0b4f4a;
    --amber: #b7791f;
    --sage: #dce8dd;
    --shadow: 0 14px 34px rgba(23, 32, 29, .1);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

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

a {
    color: var(--teal-dark);
}

header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(247, 248, 244, .94);
    border-bottom: 1px solid var(--line);
    padding: 14px clamp(18px, 4vw, 44px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    backdrop-filter: blur(14px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
    min-width: 220px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--teal-dark);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
}

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

.brand small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

nav {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

nav a,
.footer-links a {
    color: var(--ink);
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 650;
    font-size: 14px;
}

nav a:hover,
.footer-links a:hover {
    background: var(--sage);
}

main {
    width: min(1180px, calc(100% - 32px));
    min-height: calc(100vh - 190px);
    min-height: calc(100svh - 190px);
    margin: 0 auto;
    padding: 28px 0 52px;
}

footer {
    border-top: 1px solid var(--line);
    padding: 22px clamp(18px, 4vw, 44px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    color: var(--muted);
    background: #eef2eb;
}

footer p {
    margin: 4px 0 0;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    font-size: clamp(38px, 7vw, 72px);
    line-height: .98;
}

h2 {
    margin: 0 0 18px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
}

h3 {
    margin: 0 0 10px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--teal-dark);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.lead {
    max-width: 560px;
    color: #eef8f1;
    font-size: clamp(17px, 2.4vw, 22px);
    line-height: 1.45;
}

.hero-notice {
    width: max-content;
    max-width: 100%;
    margin: 22px 0 0;
    padding: 10px 12px;
    border: 1px solid rgba(191, 230, 220, .45);
    border-radius: 8px;
    color: #f5fffb;
    background: rgba(11, 79, 74, .58);
    font-weight: 800;
}

.hint {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.gate-hero {
    min-height: min(720px, calc(100vh - 126px));
    min-height: min(720px, calc(100svh - 126px));
    border-radius: 8px;
    padding: clamp(22px, 5vw, 54px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
    gap: 28px;
    align-items: end;
    color: #fff;
    background:
        linear-gradient(90deg, rgba(10, 25, 22, .86), rgba(10, 25, 22, .5), rgba(10, 25, 22, .2)),
        url("/static/lab-hero.png") center / cover no-repeat;
    box-shadow: var(--shadow);
}

.gate-copy {
    align-self: center;
}

.gate-copy .eyebrow {
    color: #bfe6dc;
}

.gate-card,
.form-box {
    background: rgba(255, 255, 255, .96);
    color: var(--ink);
    padding: 26px;
    border: 1px solid rgba(255, 255, 255, .65);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.form-box {
    max-width: 460px;
    margin: 34px auto;
}

.wide,
.wide-page,
.checkout-box {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
}

.wide-page,
.checkout-box {
    padding-top: 16px;
}

form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

label {
    font-weight: 700;
    font-size: 14px;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #cdd8d0;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(15, 118, 110, .18);
    border-color: var(--teal);
}

textarea {
    min-height: 86px;
    resize: vertical;
}

button,
.checkout-btn,
.venmo-btn {
    background: var(--teal-dark);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 44px;
    font-weight: 750;
    font: inherit;
}

button:hover,
.checkout-btn:hover,
.venmo-btn:hover {
    background: var(--teal);
}

.secondary-action {
    background: #fff;
    color: var(--teal-dark);
    border: 1px solid var(--line);
}

.secondary-action:hover {
    background: var(--sage);
}

.checkout-btn.secondary {
    background: #fff;
    color: var(--teal-dark);
    border: 1px solid var(--line);
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    gap: 24px;
    align-items: start;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.section-heading .hint {
    max-width: 360px;
    margin: 0;
}

.notice-chip,
.notice-banner,
.research-warning,
.cart-notice {
    color: #4b2f03;
    background: #fff6df;
    border: 1px solid #ead28e;
    border-radius: 8px;
    font-weight: 800;
}

.notice-chip {
    max-width: 390px;
    margin: 0;
    padding: 9px 12px;
    font-size: 13px;
    line-height: 1.35;
}

.notice-banner {
    margin: 0 0 18px;
    padding: 12px 14px;
}

.research-warning,
.cart-notice {
    margin: 0 0 14px;
    padding: 9px 10px;
    font-size: 12px;
    line-height: 1.35;
}

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

.updates-signup {
    margin-top: 24px;
    padding: 22px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: 20px;
    align-items: start;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(23, 32, 29, .06);
}

.updates-signup h2 {
    margin-bottom: 10px;
    font-size: clamp(24px, 3vw, 34px);
}

.updates-form .checkbox-line {
    font-size: 14px;
}

.card,
.cart,
.order-card,
.customer-card,
.stats div {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 10px 24px rgba(23, 32, 29, .06);
}

.cart {
    position: sticky;
    top: 88px;
}

.product-visual {
    position: relative;
    container-type: inline-size;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 8px;
    background: #edf4ef;
    margin-bottom: 14px;
    border: 1px solid #d6e0d7;
}

.product-visual img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.vial-label {
    position: absolute;
    left: 34.8%;
    top: 43.5%;
    width: 30.4%;
    height: 28.5%;
    padding: 3px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    color: var(--ink);
    text-align: center;
    line-height: 1;
    overflow: hidden;
    pointer-events: none;
}

.vial-label strong,
.vial-label span,
.vial-label em,
.vial-label small {
    display: block;
    max-width: 100%;
    overflow-wrap: normal;
    text-wrap: balance;
}

.vial-label strong {
    color: var(--teal-dark);
    font-size: clamp(4.5px, 2.1cqw, 7px);
    font-weight: 900;
    line-height: 1.05;
}

.vial-label span {
    font-size: clamp(7px, 3.7cqw, 10px);
    font-weight: 900;
    line-height: 1.05;
}

.vial-label em {
    font-size: clamp(6px, 2.8cqw, 8.5px);
    font-style: normal;
    font-weight: 800;
    line-height: 1.05;
}

.vial-label small {
    color: #4b2f03;
    font-size: clamp(4.5px, 1.75cqw, 6px);
    font-weight: 900;
    line-height: 1.05;
    text-transform: uppercase;
}

.pill,
.status-badge,
.stock-badge {
    width: max-content;
    max-width: 100%;
    margin: 0 0 10px;
    padding: 5px 9px;
    border-radius: 999px;
    background: #edf5ef;
    color: var(--teal-dark);
    font-size: 12px;
    font-weight: 800;
}

.stock-badge {
    background: #eef2eb;
    color: var(--muted);
}

.stock-in-stock {
    background: #e8f7ef;
    color: #11633a;
}

.stock-low-stock {
    background: #fff6df;
    color: #8a5a05;
}

.stock-out-of-stock {
    background: #fbe9e9;
    color: #8f1f1f;
}

button:disabled {
    cursor: not-allowed;
    background: #9ca7a1;
}

.notify-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.notify-form input[type="email"] {
    margin-top: 6px;
}

.notify-form .checkbox-line {
    font-size: 13px;
}

.product-meta {
    color: var(--muted);
    margin: -2px 0 12px;
}

.price {
    margin: 0 0 14px;
    font-size: 24px;
    font-weight: 850;
}

.cart-item {
    border-bottom: 1px solid var(--line);
    padding: 13px 0;
}

.cart-item:first-of-type {
    padding-top: 0;
}

.small-btn {
    padding: 8px 10px;
    min-height: 36px;
    font-size: 14px;
}

.flash {
    max-width: 980px;
    margin: 0 auto 18px;
    background: #fff8e6;
    border: 1px solid #ead28e;
    color: #5b4512;
    padding: 12px 16px;
    border-radius: 8px;
}

.flash p {
    margin: 0;
}

.checkbox-line {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 16px;
    line-height: 1.4;
}

.checkbox-line input {
    flex: 0 0 auto;
    width: 18px;
    margin-top: 3px;
}

.address-box {
    background: #eef2eb;
    padding: 12px;
    border-radius: 8px;
    word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.customer-card,
.order-card {
    margin-bottom: 16px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.detail-grid p {
    margin: 0;
}

.detail-grid strong,
.detail-grid span {
    display: block;
}

.detail-grid strong {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.summary-line,
.order-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.summary-line {
    margin: 8px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.order-items {
    margin-top: 14px;
}

.empty-state {
    padding: 18px;
    border: 1px dashed #b9c8bd;
    border-radius: 8px;
    color: var(--muted);
    background: rgba(255, 255, 255, .58);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stats p {
    margin: 0;
    font-size: 26px;
    font-weight: 850;
}

.inventory-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 18px;
}

.inventory-card,
.add-material-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 10px 24px rgba(23, 32, 29, .06);
}

.inventory-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.inventory-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.inventory-fields label,
.toggle-line {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toggle-line {
    flex-direction: row;
    align-items: center;
    width: max-content;
    max-width: 100%;
}

.toggle-line input {
    width: auto;
}

.add-material-panel {
    margin-bottom: 28px;
}

.add-material-panel summary {
    cursor: pointer;
    font-weight: 850;
    margin-bottom: 14px;
}

.admin-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 28px 0 14px;
}

.admin-section-heading h2 {
    margin: 0;
}

.admin-table-section {
    margin-bottom: 28px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.coa-page .hint {
    max-width: 780px;
    margin-bottom: 20px;
}

.coa-grid {
    display: grid;
    gap: 22px;
}

.coa-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 10px 24px rgba(23, 32, 29, .06);
}

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

.coa-summary h3 {
    margin-bottom: 0;
}

.coa-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.coa-facts p {
    margin: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8faf6;
}

.coa-facts strong,
.coa-facts span {
    display: block;
}

.coa-facts strong {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.coa-facts span {
    margin-top: 3px;
    font-weight: 800;
}

.coa-image-link {
    display: block;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.coa-image-link img {
    display: block;
    width: 100%;
    height: auto;
}

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

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

th {
    background: #eef2eb;
}

@media (max-width: 900px) {
    header,
    footer,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    nav {
        justify-content: flex-start;
    }

    .gate-hero,
    .layout,
    .stats,
    .detail-grid,
    .coa-facts,
    .updates-signup,
    .inventory-fields {
        grid-template-columns: 1fr;
    }

    .coa-summary,
    .inventory-card-top {
        flex-direction: column;
    }

    .gate-hero {
        min-height: auto;
        align-items: start;
        background:
            linear-gradient(180deg, rgba(10, 25, 22, .9), rgba(10, 25, 22, .58)),
            url("/static/lab-hero.png") center / cover no-repeat;
    }

    .cart {
        position: static;
    }
}

@media (max-width: 520px) {
    main {
        width: min(100% - 22px, 1180px);
        padding-top: 16px;
    }

    h1 {
        font-size: 34px;
        line-height: 1.02;
    }

    h2 {
        font-size: 26px;
    }

    .brand {
        min-width: 0;
    }

    .brand small {
        display: none;
    }

    .gate-card,
    .form-box,
    .card,
    .cart,
    .order-card,
    .customer-card,
    .updates-signup,
    .stats div {
        padding: 16px;
    }

    .gate-hero {
        padding: 14px;
        gap: 14px;
    }

    .gate-copy {
        align-self: start;
    }

    .lead {
        margin: 0;
        font-size: 15px;
        line-height: 1.35;
    }

    .hero-notice {
        margin-top: 12px;
        padding: 8px 10px;
        font-size: 13px;
        line-height: 1.25;
    }

    .gate-card h2 {
        margin-bottom: 8px;
        font-size: 22px;
    }

    .gate-card .hint {
        margin-top: 0;
    }

    .checkbox-line {
        gap: 8px;
        font-size: 14px;
    }

    .updates-signup {
        margin-top: 18px;
        gap: 14px;
    }

    .admin-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .summary-line,
    .order-topline {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }
}

@media (max-width: 380px) {
    header {
        padding-left: 12px;
        padding-right: 12px;
        gap: 10px;
    }

    main {
        width: min(100% - 16px, 1180px);
        padding-top: 10px;
    }

    .brand-mark {
        width: 36px;
        height: 36px;
    }

    nav a,
    .footer-links a {
        padding: 7px 8px;
        font-size: 13px;
    }

    .gate-hero {
        padding: 12px;
    }
}

@media (max-width: 520px) and (max-height: 740px) {
    .gate-hero {
        gap: 12px;
    }

    .lead {
        font-size: 14px;
    }

    .hero-notice {
        margin-top: 10px;
    }
}
