:root {
    color-scheme: light;
    --ink: #142033;
    --muted: #607086;
    --line: #d6dfeb;
    --soft: #f1f5f9;
    --panel: #ffffff;
    --brand: #075985;
    --brand-dark: #0c4a6e;
    --accent: #d97706;
    --shadow: 0 18px 45px rgba(15, 43, 70, .11);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--soft);
    background-image: linear-gradient(180deg, #f8fbff 0, #f1f5f9 440px);
}

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

main {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px max(16px, calc((100vw - 1180px) / 2));
    background: rgba(7, 31, 54, .96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 230px;
}

.brand small,
.muted,
.list-item small {
    color: var(--muted);
}

.brand,
.nav a {
    color: #e8f3fb;
}

.brand em {
    color: #7dd3fc;
    font-size: 11px;
    font-style: normal;
    letter-spacing: 1px;
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    color: white;
    font-weight: 700;
    background: linear-gradient(135deg, #0284c7, #075985);
    border-radius: 8px;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.nav a {
    padding: 10px 12px;
    border-radius: 8px;
}

.nav a:hover {
    background: rgba(255, 255, 255, .1);
}

.language-picker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: 4px;
}

.language-picker label {
    margin: 0;
    color: #b9d8eb;
    font-size: 12px;
}

.language-picker select {
    width: auto;
    min-width: 126px;
    padding: 8px 10px;
    color: #e8f3fb;
    background: #103e61;
    border-color: rgba(255, 255, 255, .25);
}

.topbar .button.ghost {
    color: #e8f3fb;
    border-color: rgba(255, 255, 255, .25);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    color: white;
    font-weight: 700;
    background: var(--brand);
    cursor: pointer;
}

.button:hover {
    background: var(--brand-dark);
}

.button:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.button.secondary {
    color: var(--brand-dark);
    background: #d9f1ee;
}

.button.ghost {
    color: var(--brand-dark);
    background: transparent;
    border: 1px solid var(--line);
}

.button.large {
    min-height: 50px;
    padding-inline: 20px;
}

.button.full {
    width: 100%;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
    gap: 42px;
    align-items: center;
    padding: 74px 0 34px;
}

.hero h1 span {
    color: var(--brand);
}

.hero h1,
.page-head h1 {
    margin: 0;
    font-size: clamp(34px, 5vw, 64px);
    line-height: 1.02;
    letter-spacing: 0;
}

.lead {
    max-width: 680px;
    color: var(--muted);
    font-size: 19px;
    line-height: 1.6;
}

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

.actions,
.checkout-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.portal-preview,
.form-card,
.summary,
.product-card,
.list-item,
.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.portal-preview {
    padding: 22px;
    background: linear-gradient(145deg, #0b3658, #071f36);
    border-color: #17577d;
}

.preview-head {
    display: flex;
    gap: 8px;
    padding-bottom: 18px;
}

.preview-head span {
    width: 12px;
    height: 12px;
    background: #94a3b8;
    border-radius: 50%;
}

.metric-grid,
.section-grid,
.product-grid,
.stat-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.metric-grid div,
.section-grid article {
    padding: 18px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.portal-preview .metric-grid div {
    color: #f8fbff;
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .14);
}

.portal-preview .metric-grid small {
    color: #b9d8eb;
}

.metric-grid strong,
.stat strong {
    display: block;
    font-size: 28px;
}

.metric-grid small,
.stat span {
    color: var(--muted);
}

.section-grid,
.content-band,
.page-head,
.auth-panel,
.checkout-layout,
.admin-layout,
.builder-layout,
.list-stack {
    margin: 28px 0;
}

.content-band {
    padding: 28px;
    background: #eef4f8;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.section-title h2,
.product-card h2,
.product-card h3,
.form-card h1,
.form-card h2,
.list-item h2,
.summary h2 {
    margin-top: 0;
}

.product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.product-card,
.list-item,
.form-card,
.summary,
.stat {
    padding: 22px;
}

.product-card {
    position: relative;
    display: flex;
    min-height: 260px;
    flex-direction: column;
    gap: 12px;
}

.product-badge,
.status-pill {
    display: inline-flex;
    align-self: flex-start;
    padding: 6px 9px;
    border-radius: 999px;
    color: #075985;
    font-size: 12px;
    font-weight: 800;
    background: #e0f2fe;
}

.status-pill.ok {
    color: #166534;
    background: #dcfce7;
}

.status-pill.warn {
    color: #991b1b;
    background: #fee2e2;
}

.product-meta {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.product-meta span {
    padding: 6px 8px;
    color: #486176;
    font-size: 12px;
    background: #f1f5f9;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.detail-meta {
    margin: 18px 0;
}

.license-tools {
    margin-top: 10px;
}

.license-tools summary {
    color: var(--brand);
    cursor: pointer;
    font-weight: 700;
}

.license-tools form {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.product-card .button,
.product-card form {
    margin-top: auto;
}

.product-card p {
    line-height: 1.55;
}

.auth-panel {
    display: grid;
    place-items: start center;
    min-height: 65vh;
    padding-top: 42px;
}

.form-card {
    width: min(460px, 100%);
}

.form-card.wide {
    width: min(760px, 100%);
}

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

label {
    display: grid;
    gap: 8px;
    margin: 0 0 16px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    background: white;
}

textarea {
    resize: vertical;
}

.flash {
    width: min(1180px, calc(100% - 32px));
    margin: 18px auto 0;
    padding: 14px 16px;
    border-radius: 8px;
    background: #d9f1ee;
    border: 1px solid #99d5ce;
}

.flash.error {
    color: #7f1d1d;
    background: #fee2e2;
    border-color: #fecaca;
}

.page-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding-top: 30px;
}

.stat-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat {
    display: block;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

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

th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

.qty {
    width: 90px;
}

.checkout-row {
    justify-content: flex-end;
    margin-top: 20px;
}

.checkout-layout,
.admin-layout,
.builder-layout {
    display: grid;
    grid-template-columns: minmax(300px, 460px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.builder-layout {
    grid-template-columns: minmax(360px, 680px) minmax(0, 1fr);
}

.builder-toolbar,
.searchbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 18px 0;
}

.searchbar input {
    flex: 1 1 360px;
}

.builder-fields {
    display: grid;
    gap: 10px;
    margin: 18px 0;
}

.builder-row {
    display: grid;
    grid-template-columns: 28px minmax(160px, 1fr) 130px 92px auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.drag {
    color: var(--muted);
    font-weight: 800;
    cursor: grab;
}

.choice,
.mini-choice {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
}

.choice input,
.mini-choice input {
    width: auto;
}

.inline-form {
    margin: 0;
}

.inline-form select {
    min-width: 130px;
}

.hp-field {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.prose {
    line-height: 1.7;
}

.prose p {
    margin: 0 0 16px;
}

code {
    display: inline-block;
    padding: 4px 6px;
    border-radius: 6px;
    background: #f1f5f9;
    border: 1px solid var(--line);
}

.row-editor {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(120px, 1fr) minmax(150px, 1fr) 150px auto;
    gap: 10px;
    align-items: center;
    margin: 0 0 10px;
}

.product-editor {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
    align-items: end;
}

.support-topic-editor {
    display: grid;
    grid-template-columns: minmax(180px, .8fr) minmax(240px, 1.4fr) 90px 150px auto;
    gap: 12px;
    align-items: end;
}

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

.danger-form {
    display: flex;
    justify-content: flex-end;
}

.action-item {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
}

.product-image {
    display: block;
    width: 100%;
    min-height: 130px;
    max-height: 190px;
    object-fit: cover;
    background: #eef4f8;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.product-preview img {
    display: block;
    width: min(220px, 100%);
    max-height: 140px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.product-detail {
    display: grid;
    grid-template-columns: minmax(280px, .9fr) minmax(0, 1.1fr);
    gap: 28px;
    align-items: start;
    margin: 28px 0;
}

.product-detail-image,
.product-detail-content {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.product-detail-image {
    display: block;
    max-height: 520px;
    object-fit: cover;
}

.product-detail-content {
    padding: 28px;
}

.formatted-text p {
    margin: 0 0 16px;
    line-height: 1.75;
}

.detail-price {
    display: block;
    margin: 20px 0;
    font-size: 26px;
}

.support-admin-post {
    border-color: #99d5ce;
    background: #f0fdfa;
}

.forum-thread {
    margin-top: 20px;
}

.forum-post {
    box-shadow: none;
}

.forum-post-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.post-tools {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.post-tools summary {
    cursor: pointer;
    color: var(--brand-dark);
    font-weight: 700;
    margin-bottom: 12px;
}

.summary p {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.summary .total {
    font-size: 20px;
    border-bottom: 0;
}

.payment-box {
    margin: 14px 0;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.payment-box p {
    margin: 8px 0 0;
    color: var(--muted);
}

.is-hidden {
    display: none;
}

.list-stack {
    display: grid;
    gap: 16px;
}

.footer {
    display: flex;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 50px;
    padding: 28px 16px;
    color: var(--muted);
    border-top: 1px solid var(--line);
}

@media (max-width: 850px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav {
        width: 100%;
        justify-content: flex-start;
    }

    .language-picker {
        width: 100%;
    }

    .hero,
    .checkout-layout,
    .admin-layout,
    .builder-layout,
    .product-detail {
        grid-template-columns: 1fr;
    }

    .metric-grid,
    .section-grid,
    .product-grid,
    .stat-row {
        grid-template-columns: 1fr;
    }

    .content-band {
        padding: 18px;
    }

    .builder-row,
    .form-grid,
    .row-editor,
    .product-editor,
    .support-topic-editor {
        grid-template-columns: 1fr;
    }
}
