* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: #1f2933;
    background: #f4f6f8;
    font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
    line-height: 1.6;
}

a {
    color: #1264a3;
    text-decoration: none;
}

a:hover {
    color: #0b4f7d;
}

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

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

.site-shell {
    min-height: 100vh;
}

.store-hero {
    background: #17324d;
    color: #fff;
    padding: 54px 18px 42px;
}

.store-hero-inner {
    width: min(1160px, 100%);
    margin: 0 auto;
}

.eyebrow {
    margin: 0 0 10px;
    color: #9fd3f0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.store-hero h1 {
    margin: 0;
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.12;
    letter-spacing: 0;
}

.store-intro {
    max-width: 760px;
    margin: 18px 0 0;
    color: #e9f3f8;
    font-size: 17px;
}

.store-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-top: 22px;
    color: #cde5f4;
}

.product-section,
.detail-header,
.product-detail {
    width: min(1160px, calc(100% - 28px));
    margin: 0 auto;
}

.product-section {
    padding: 34px 0 46px;
}

.section-heading,
.panel-heading,
.admin-page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

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

.section-heading h2,
.panel-heading h2,
.admin-page-title h1 {
    margin: 0;
}

.section-heading h2 {
    font-size: 25px;
}

.section-heading span,
.panel-heading span,
.admin-page-title p {
    color: #64748b;
}

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

.product-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid #dce3ea;
    border-radius: 8px;
}

.product-cover {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #dfe7ee;
}

.product-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s ease;
}

.product-card:hover .product-cover img {
    transform: scale(1.04);
}

.cover-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #6b7b8c;
    font-size: 14px;
}

.product-card-body {
    padding: 12px;
}

.product-card h3 {
    min-height: 48px;
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.45;
}

.product-card h3 a {
    color: #152536;
}

.product-card p {
    min-height: 66px;
    margin: 0 0 10px;
    color: #5e6c7a;
    font-size: 14px;
}

.link-more {
    font-weight: 700;
}

.site-footer {
    padding: 24px 18px 34px;
    color: #7a8795;
    text-align: center;
}

.detail-header {
    padding: 28px 0 14px;
}

.detail-header h1 {
    margin: 12px 0 0;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.2;
}

.back-link {
    color: #4f6275;
}

.product-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(300px, .92fr);
    gap: 26px;
    padding-bottom: 48px;
}

.media-gallery {
    display: grid;
    gap: 14px;
    align-content: start;
}

.media-item {
    margin: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid #dce3ea;
    border-radius: 8px;
}

.media-item img {
    width: 100%;
    height: auto;
}

.media-item video {
    width: 100%;
    max-height: 560px;
    background: #111827;
}

.detail-content {
    align-self: start;
    padding: 22px;
    background: #fff;
    border: 1px solid #dce3ea;
    border-radius: 8px;
}

.detail-content h2 {
    margin: 0 0 14px;
    font-size: 22px;
}

.rich-text {
    color: #344253;
    white-space: normal;
}

.empty-state {
    padding: 28px;
    color: #697789;
    background: #fff;
    border: 1px dashed #cbd5df;
    border-radius: 8px;
    text-align: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
}

.btn-primary {
    color: #fff;
    background: #0e6f68;
    border-color: #0e6f68;
}

.btn-primary:hover {
    color: #fff;
    background: #0b5e58;
}

.btn-ghost {
    color: #25445f;
    background: #fff;
    border-color: #cbd5df;
}

.btn-ghost:hover {
    color: #17324d;
    border-color: #9fb0bf;
}

.flash {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 6px;
    font-weight: 700;
}

.flash-success {
    color: #0b5e34;
    background: #dff7ea;
    border: 1px solid #9eddbb;
}

.flash-error {
    color: #8a1f1f;
    background: #ffe5e5;
    border: 1px solid #f4b4b4;
}

.login-body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 18px;
    background: #edf2f6;
}

.login-card,
.install-box {
    width: min(430px, 100%);
    padding: 28px;
    background: #fff;
    border: 1px solid #dce3ea;
    border-radius: 8px;
}

.login-card h1,
.install-box h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.login-card p,
.install-box p {
    margin: 0 0 20px;
    color: #64748b;
}

.install-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 18px;
}

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

.stack-form label,
.media-admin-meta label {
    display: grid;
    gap: 7px;
}

.stack-form label span,
.media-admin-meta label span {
    color: #334155;
    font-weight: 700;
}

.stack-form input,
.stack-form textarea,
.stack-form select,
.media-admin-meta input {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    color: #1f2933;
    background: #fff;
    border: 1px solid #cbd5df;
    border-radius: 6px;
}

.stack-form textarea {
    resize: vertical;
}

.stack-form small {
    color: #718096;
}

.wide-form {
    max-width: 900px;
}

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

.form-actions {
    display: flex;
    gap: 10px;
}

.admin-body {
    background: #eef3f7;
}

.admin-layout {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    min-height: 100vh;
}

.admin-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 22px 16px;
    color: #e6eef5;
    background: #1f3549;
}

.admin-brand {
    margin-bottom: 22px;
    color: #fff;
    font-size: 20px;
    font-weight: 800;
}

.admin-nav {
    display: grid;
    gap: 6px;
}

.admin-nav a {
    padding: 10px 12px;
    color: #d7e5ef;
    border-radius: 6px;
}

.admin-nav a:hover {
    color: #fff;
    background: #2c4b65;
}

.admin-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, .16);
}

.admin-user a {
    color: #9fd3f0;
}

.admin-main {
    min-width: 0;
    padding: 28px;
}

.admin-page-title {
    margin-bottom: 18px;
}

.admin-page-title h1 {
    font-size: 27px;
}

.admin-page-title p {
    margin: 4px 0 0;
}

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

.stat-card,
.panel {
    background: #fff;
    border: 1px solid #dce3ea;
    border-radius: 8px;
}

.stat-card {
    padding: 18px;
}

.stat-card span {
    display: block;
    color: #64748b;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    color: #17324d;
    font-size: 32px;
    line-height: 1;
}

.panel {
    margin-bottom: 18px;
    padding: 18px;
    overflow-x: auto;
}

.panel-heading {
    margin-bottom: 14px;
}

.panel-heading h2 {
    font-size: 20px;
}

.data-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e4ebf1;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: #475569;
    font-size: 14px;
    background: #f7fafc;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.table-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #dce3ea;
}

.thumb-empty {
    display: inline-grid;
    width: 64px;
    height: 64px;
    place-items: center;
    color: #758596;
    background: #eef3f7;
    border-radius: 6px;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.table-actions form {
    margin: 0;
}

.link-button {
    display: inline;
    padding: 0;
    color: #1264a3;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.link-button:hover {
    color: #0b4f7d;
}

.danger {
    color: #be2a2a;
}

.danger:hover {
    color: #981b1b;
}

.admin-product-form {
    padding-bottom: 78px;
}

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

.media-admin-item {
    position: relative;
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 1px solid #dce3ea;
    border-radius: 8px;
}

.media-preview {
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #111827;
    border-radius: 6px;
}

.media-preview img,
.media-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-admin-meta {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.media-admin-meta strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-admin-meta > span {
    color: #64748b;
    font-size: 14px;
}

.media-delete-button {
    justify-self: start;
}

.sticky-actions {
    position: fixed;
    right: 28px;
    bottom: 20px;
    left: 260px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px;
    background: rgba(238, 243, 247, .92);
    border: 1px solid #dce3ea;
    border-radius: 8px;
    backdrop-filter: blur(8px);
}

@media (min-width: 900px) {
    .product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 18px;
    }

    .product-card-body {
        padding: 15px;
    }
}

@media (max-width: 900px) {
    .product-detail {
        grid-template-columns: 1fr;
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: relative;
        height: auto;
    }

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

    .admin-main {
        padding: 18px;
    }

    .sticky-actions {
        left: 18px;
        right: 18px;
    }

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

@media (max-width: 640px) {
    .store-hero {
        padding-top: 38px;
    }

    .product-section,
    .detail-header,
    .product-detail {
        width: min(100% - 20px, 1160px);
    }

    .section-heading,
    .admin-page-title,
    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-grid,
    .stats-grid,
    .media-admin-grid {
        grid-template-columns: 1fr;
    }

    .product-card-body {
        padding: 10px;
    }

    .product-card h3 {
        min-height: 44px;
        font-size: 15px;
    }

    .product-card p {
        min-height: 74px;
        font-size: 13px;
    }

    .login-card,
    .install-box {
        padding: 22px;
    }
}
