:root {
    --bg: #f5f8ff;
    --surface: #ffffff;
    --surface-alt: #edf3ff;
    --text: #102243;
    --muted: #5f6f8d;
    --border: #d7e3ff;
    --primary: #123bda;
    --primary-dark: #0b2a98;
    --danger: #c53c3c;
    --shadow: 0 24px 60px rgba(18, 59, 218, 0.12);
    --radius: 24px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(18, 59, 218, 0.14), transparent 30%),
        linear-gradient(180deg, #ffffff 0%, #f5f8ff 100%);
}

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

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

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

.site-shell,
.gate-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 28px 0 16px;
}

.brand-link {
    display: inline-flex;
    align-items: center;
}

.brand-logo {
    max-height: 66px;
    width: auto;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 22px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: var(--shadow);
}

.brand-mark.centered {
    min-width: 240px;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.site-nav a {
    padding: 12px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--border);
}

.badge {
    display: inline-block;
    min-width: 24px;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    text-align: center;
}

.page-content {
    padding-bottom: 48px;
}

.hero,
.section-block,
.auth-card,
.gate-card,
.install-card,
.card-panel,
.order-card,
.empty-state {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(215, 227, 255, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 28px;
    padding: 40px;
    margin-bottom: 28px;
}

.hero-copy h1,
.section-heading h1,
.section-heading h2,
.auth-card h1,
.empty-state h1,
.empty-state h3,
.product-detail h1 {
    margin: 0;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.82rem;
}

.hero-copy p:last-of-type {
    color: var(--muted);
    max-width: 54ch;
    line-height: 1.6;
}

.hero-actions,
.checkout-actions,
.admin-tabs,
.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-panel {
    display: grid;
    gap: 16px;
}

.stat-card,
.stat-box {
    padding: 20px;
    border-radius: 20px;
    background: linear-gradient(180deg, #f8fbff 0%, #e9f0ff 100%);
    border: 1px solid var(--border);
}

.stat-label {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}

.section-block,
.auth-card {
    padding: 28px;
    margin-bottom: 24px;
}

.narrow {
    max-width: 920px;
    margin-left: auto;
    margin-right: auto;
}

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

.section-heading.compact {
    margin-bottom: 18px;
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 12px 18px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.button.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 16px 32px rgba(18, 59, 218, 0.2);
}

.button.secondary {
    background: var(--surface-alt);
    color: var(--text);
    border: 1px solid var(--border);
}

.button.danger {
    background: #fff1f1;
    color: var(--danger);
    border: 1px solid #f0c6c6;
}

.button.small {
    padding: 9px 14px;
    font-size: 0.92rem;
}

.button.wide {
    width: 100%;
}

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

.product-card {
    overflow: hidden;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: #fff;
}

.product-image-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #f0f5ff, #dbe8ff);
}

.product-image,
.gallery-main img,
.cart-thumb,
.thumb-card img,
.settings-logo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-image.placeholder,
.large,
.gallery-main .placeholder {
    display: grid;
    place-items: center;
    height: 100%;
    color: var(--primary);
    font-size: 2rem;
    font-weight: 700;
}

.product-badges {
    position: absolute;
    top: 14px;
    left: 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
}

.badge-pill.outlined {
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary);
    border: 1px solid var(--border);
}

.product-body {
    padding: 18px;
}

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

.product-body p,
.muted {
    color: var(--muted);
    line-height: 1.55;
}

.product-meta,
.summary-line,
.summary-total,
.order-topline,
.cart-item,
.cart-item-actions,
.cart-item-info {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.product-buy-form,
.detail-buy-form,
.stack-form,
.inline-form {
    display: grid;
    gap: 14px;
}

.product-buy-form {
    grid-template-columns: 92px 1fr;
    margin-top: 16px;
}

.stack-form label,
.detail-buy-form label {
    display: grid;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    padding: 13px 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

.flash {
    padding: 14px 16px;
    margin-bottom: 18px;
    border-radius: 16px;
}

.flash-success {
    background: #ecfff4;
    border: 1px solid #bfe8cd;
}

.flash-error {
    background: #fff3f3;
    border: 1px solid #f0c6c6;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 0 0 40px;
    color: var(--muted);
    font-size: 0.95rem;
}

.gate-body,
.install-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.gate-shell {
    max-width: 520px;
}

.gate-card,
.install-card {
    padding: 34px;
}

.gate-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
}

.gate-logo {
    max-width: 220px;
    max-height: 120px;
    object-fit: contain;
}

.product-detail,
.checkout-layout,
.dashboard-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.gallery {
    display: grid;
    gap: 14px;
}

.gallery-main {
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(135deg, #eff5ff, #d7e7ff);
    aspect-ratio: 1 / 1;
}

.gallery-thumbs,
.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

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

.thumb-button {
    padding: 0;
    cursor: pointer;
}

.thumb-button img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.detail-panel,
.card-panel {
    padding: 24px;
}

.detail-price {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.detail-stock {
    margin: 8px 0 20px;
}

.detail-description {
    line-height: 1.7;
    margin-bottom: 24px;
}

.cart-list,
.order-stack,
.settings-stack {
    display: grid;
    gap: 18px;
}

.cart-item,
.order-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 20px;
}

.cart-item-info {
    justify-content: flex-start;
}

.cart-thumb {
    width: 84px;
    height: 84px;
    border-radius: 16px;
}

.checkout-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-top: 8px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.82rem;
}

.status-open {
    background: #edf3ff;
    color: var(--primary);
}

.status-completed {
    background: #ecfff4;
    color: #1d6d44;
}

.status-canceled {
    background: #fff1f1;
    color: var(--danger);
}

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

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
}

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

.admin-table th {
    background: #f7faff;
}

.inline-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

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

.simple-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
}

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

.inline-option {
    display: flex;
    gap: 10px;
    align-items: center;
    font-weight: 600;
}

.inline-option input {
    width: auto;
}

.thumb-card {
    padding: 12px;
    display: grid;
    gap: 10px;
}

.thumb-card img {
    border-radius: 14px;
    aspect-ratio: 1 / 1;
}

.settings-logo-preview {
    max-width: 220px;
    max-height: 120px;
    border-radius: 16px;
}

.install-card {
    max-width: 560px;
}

.install-brand {
    margin-bottom: 18px;
}

@media (max-width: 900px) {
    .hero,
    .product-detail,
    .checkout-layout,
    .dashboard-columns,
    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    .site-header,
    .checkout-bar,
    .site-footer,
    .section-heading {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 640px) {
    .site-shell,
    .gate-shell {
        width: min(100% - 20px, 1180px);
    }

    .hero,
    .section-block,
    .auth-card,
    .gate-card,
    .install-card,
    .card-panel {
        padding: 22px;
    }

    .product-grid,
    .form-grid,
    .product-buy-form {
        grid-template-columns: 1fr;
    }

    .cart-item,
    .order-topline,
    .cart-item-actions,
    .cart-item-info,
    .summary-line,
    .summary-total {
        flex-direction: column;
        align-items: flex-start;
    }

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