:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #eef4f1;
    --text: #1c2430;
    --muted: #687385;
    --line: #dfe5ec;
    --primary: #1769aa;
    --primary-dark: #0f4d7d;
    --success: #16825d;
    --warning: #a86700;
    --danger: #b42318;
    --shadow: 0 14px 40px rgba(29, 41, 57, 0.08);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 6px;
    color: #344054;
    font-weight: 650;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    color: #475467;
    font-size: 13px;
    background: #f8fafc;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 32px;
    border-bottom: 1px solid rgba(223, 229, 236, 0.9);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 800;
}

.brand-mark {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 8px;
    background: #133d5f;
    color: #fff;
    font-size: 13px;
}

.nav,
.admin-tabs,
.hero-actions,
.form-actions,
.actions-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.nav a {
    color: #344054;
    font-weight: 650;
}

.nav a.is-active,
.admin-tabs a.is-active {
    color: var(--primary);
}

.inline-form {
    margin: 0;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    padding: 0;
    font-weight: 700;
}

.danger-text {
    color: var(--danger);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 10px 16px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.button:hover {
    background: var(--primary-dark);
    color: #fff;
}

.button[disabled] {
    border-color: #cbd5e1;
    background: #cbd5e1;
    cursor: not-allowed;
}

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

.button-ghost {
    background: #fff;
    color: var(--primary);
}

.button-ghost:hover {
    background: #edf6ff;
    color: var(--primary-dark);
}

.full {
    width: 100%;
}

.page {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 52px;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 26px 0 38px;
    color: var(--muted);
    border-top: 1px solid var(--line);
}

.alert {
    margin-bottom: 18px;
    border-radius: 8px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: #fff;
}

.alert-success {
    border-color: #b7e4d3;
    background: #ecfdf6;
    color: #07543b;
}

.alert-danger {
    border-color: #fecaca;
    background: #fff1f2;
    color: var(--danger);
}

.alert-warning,
.alert-info {
    border-color: #f6d79a;
    background: #fff8e7;
    color: var(--warning);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 28px;
    align-items: stretch;
    min-height: 380px;
    padding: 44px;
    border-radius: 8px;
    background:
        linear-gradient(115deg, rgba(19, 61, 95, 0.92), rgba(23, 105, 170, 0.84)),
        url("https://images.unsplash.com/photo-1551434678-e076c223a692?auto=format&fit=crop&w=1600&q=80") center/cover;
    color: #fff;
    overflow: hidden;
}

.hero h1 {
    max-width: 760px;
    margin: 8px 0 14px;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.08;
    letter-spacing: 0;
}

.hero p {
    max-width: 680px;
    color: rgba(255, 255, 255, 0.86);
    font-size: 18px;
}

.hero .eyebrow {
    color: #d4f7e8;
}

.hero-panel {
    align-self: end;
    display: grid;
    gap: 12px;
}

.hero-panel div {
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
}

.hero-panel strong {
    display: block;
    font-size: 34px;
}

.hero-panel span {
    color: rgba(255, 255, 255, 0.78);
}

.section {
    margin-top: 34px;
}

.narrow {
    width: min(920px, 100%);
    margin-left: auto;
    margin-right: auto;
}

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

.section-head.compact {
    align-items: center;
    margin-bottom: 12px;
}

.section-head h1,
.section-head h2,
.content-box h2,
.auth-card h1,
.service-detail h1 {
    margin: 0;
    line-height: 1.2;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--success);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.lead {
    color: var(--muted);
    font-size: 18px;
}

.category-strip {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.category-strip span,
.pill,
.status,
.stock {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 4px 10px;
    background: #edf2f7;
    color: #344054;
    font-size: 12px;
    font-weight: 800;
}

.stock.ok {
    background: #e8f8ef;
    color: var(--success);
}

.stock.empty {
    background: #fff1f2;
    color: var(--danger);
}

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

.service-card,
.content-box,
.auth-card,
.plan-card,
.metric,
.table-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.service-card {
    overflow: hidden;
}

.service-card img,
.service-card-fallback {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #dfe9f2;
}

.service-card-fallback {
    display: grid;
    place-items: center;
    color: #133d5f;
    font-size: 42px;
    font-weight: 900;
}

.service-card-body {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.service-card h3 {
    margin: 0;
    font-size: 19px;
}

.service-card p,
.muted {
    color: var(--muted);
}

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.card-foot {
    margin-top: 4px;
}

.price,
.price-line .price {
    color: #0f5132;
    font-size: 22px;
    font-weight: 900;
}

.market-price {
    color: var(--muted);
    text-decoration: line-through;
}

.service-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 24px;
    align-items: start;
}

.content-box,
.auth-card,
.plan-card,
.metric {
    padding: 20px;
}

.muted-box {
    background: var(--surface-soft);
}

.plans-panel {
    position: sticky;
    top: 92px;
    display: grid;
    gap: 14px;
}

.plan-card {
    display: grid;
    gap: 12px;
}

.price-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.feature-list {
    margin: 0;
    padding-left: 18px;
    color: #344054;
}

.auth-wrap {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 220px);
}

.install-wrap {
    width: min(760px, 100%);
    margin: 0 auto;
}

.install-head {
    margin: 16px 0 20px;
}

.install-head h1 {
    margin: 0 0 10px;
    font-size: 38px;
    line-height: 1.18;
}

.install-head p {
    color: var(--muted);
}

.install-form {
    display: grid;
    gap: 22px;
}

.form-section {
    display: grid;
    gap: 14px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.form-section h2 {
    margin: 0;
}

.form-grid.tight {
    margin-bottom: 0;
}

.install-note {
    padding: 12px 14px;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--muted);
}

.auth-card {
    width: min(460px, 100%);
    display: grid;
    gap: 16px;
}

.table-wrap {
    overflow: auto;
}

.table-wrap.flush {
    border: 0;
    box-shadow: none;
}

.empty-state {
    display: grid;
    place-items: center;
    text-align: center;
    gap: 10px;
    min-height: 220px;
    padding: 34px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #fff;
}

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

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

.metric span {
    color: var(--muted);
    font-weight: 800;
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: 30px;
}

.kv {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 10px 12px;
    margin: 0;
}

.kv dt {
    color: var(--muted);
    font-weight: 800;
}

.kv dd {
    margin: 0;
}

.compact-kv {
    grid-template-columns: 80px minmax(0, 1fr);
}

.secret-box {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    padding: 14px;
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
}

.admin-tabs {
    margin: 4px 0 28px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.admin-tabs a {
    padding: 8px 12px;
    border-radius: 8px;
    color: #344054;
    font-weight: 800;
}

.admin-tabs a.is-active {
    background: #edf6ff;
}

.form-stack,
.stack-list,
.admin-card-list {
    display: grid;
    gap: 14px;
}

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

.form-title,
.span-2 {
    grid-column: 1 / -1;
}

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

.check input {
    width: auto;
}

.inline-editor {
    display: grid;
    grid-template-columns: 1.4fr 1fr 90px 100px auto;
    gap: 8px;
    align-items: center;
}

.right-action {
    margin: -8px 0 8px;
}

.order-admin-card {
    display: grid;
    gap: 16px;
}

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

    .hero,
    .service-detail,
    .detail-grid,
    .admin-grid,
    .metrics-grid {
        grid-template-columns: 1fr;
    }

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

    .plans-panel {
        position: static;
    }
}

@media (max-width: 640px) {
    .page {
        width: min(100% - 24px, 1180px);
        padding-top: 18px;
    }

    .topbar {
        padding: 12px 16px;
    }

    .hero {
        padding: 28px 22px;
    }

    .service-grid,
    .form-grid,
    .inline-editor {
        grid-template-columns: 1fr;
    }

    .section-head,
    .row-between {
        align-items: flex-start;
        flex-direction: column;
    }

    .kv {
        grid-template-columns: 1fr;
    }
}
