:root {
    --ink: #17212b;
    --muted: #71808f;
    --line: #e4e9ee;
    --soft: #f5f8fa;
    --panel: #ffffff;
    --teal: #087f8c;
    --teal-dark: #07616b;
    --coral: #e76f51;
    --green: #2f855a;
    --shadow: 0 18px 50px rgba(23, 33, 43, .08);
}

* { box-sizing: border-box; }
html { background: #f8fafb; }
body { margin: 0; color: var(--ink); background: #f8fafb; font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, textarea, select { font: inherit; }
.container { width: min(1160px, calc(100% - 40px)); margin: 0 auto; }
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.site-brand { display: inline-flex; align-items: center; gap: 11px; font-size: 18px; font-weight: 750; letter-spacing: 0; }
.site-brand img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; }
.brand-mark { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 9px; background: var(--teal); color: #fff; font-size: 13px; font-weight: 800; }
.site-nav { display: flex; align-items: center; gap: 24px; color: var(--muted); }
.site-nav a:hover, .site-nav a.active { color: var(--teal); }
.nav-admin { padding-left: 20px; border-left: 1px solid var(--line); }
.announcement-wrap { background: #fff; }
.announcement { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; color: #526270; font-size: 14px; }
.announcement-label { flex: 0 0 auto; padding: 1px 8px; color: #fff; background: var(--coral); border-radius: 4px; font-size: 12px; line-height: 22px; }
.page-main { padding: 42px 0 70px; }
.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 8px; color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 40px; line-height: 1.15; letter-spacing: 0; }
h2 { margin-bottom: 10px; font-size: 22px; }
.muted { color: var(--muted); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.category-nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.category-link { display: inline-flex; align-items: center; white-space: nowrap; padding: 8px 13px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--muted); }
.category-link:hover, .category-link.active { border-color: var(--teal); background: #effbfc; color: var(--teal-dark); }
.view-toggle { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.view-toggle button { min-width: 68px; padding: 7px 10px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.view-toggle button.is-active { background: var(--ink); color: #fff; }
.catalog { display: grid; gap: 16px; }
.catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.catalog-list { grid-template-columns: 1fr; }
.catalog-list .product-card { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.catalog-list .product-cover { aspect-ratio: auto; min-height: 160px; }
.catalog-list .product-body { display: flex; flex-direction: column; justify-content: center; }
.catalog-list .product-summary { max-width: 720px; }
.product-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); transition: transform .18s ease, box-shadow .18s ease; }
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.product-cover { aspect-ratio: 1.7 / 1; display: grid; place-items: center; background: #eaf4f5; color: var(--teal); overflow: hidden; }
.product-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder { font-size: 36px; font-weight: 800; letter-spacing: 0; }
.product-body { padding: 17px; }
.product-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.product-name { margin-bottom: 7px; font-size: 18px; line-height: 1.3; }
.product-summary { display: -webkit-box; min-height: 48px; margin-bottom: 16px; overflow: hidden; color: var(--muted); -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.product-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.price { color: var(--coral); font-size: 20px; font-weight: 800; }
.price small { font-size: 13px; font-weight: 600; }
.stock { color: var(--green); font-size: 12px; }
.stock.empty { color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 15px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.button-primary { background: var(--teal); color: #fff; }
.button-primary:hover { background: var(--teal-dark); }
.button-secondary { border-color: var(--line); background: #fff; color: var(--ink); }
.button-secondary:hover { border-color: var(--teal); color: var(--teal); }
.button-danger { background: #fff1ef; color: #bb4435; }
.button-danger:hover { background: #ffe1dc; }
.button-small { min-height: 34px; padding: 5px 10px; font-size: 13px; }
.button-wide { width: 100%; }
.empty-state { padding: 54px 24px; border: 1px dashed #ccd6de; border-radius: 8px; background: #fff; text-align: center; color: var(--muted); }
.site-footer { padding: 30px 0; border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 13px; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 26px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 8px 30px rgba(23, 33, 43, .035); }
.detail-panel { padding: 26px; }
.detail-cover { aspect-ratio: 1.75 / 1; margin-bottom: 24px; border-radius: 7px; background: #eaf4f5; overflow: hidden; display: grid; place-items: center; color: var(--teal); }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-description { color: #526270; white-space: pre-line; }
.purchase-box { position: sticky; top: 20px; padding: 24px; }
.purchase-box .price { margin: 5px 0 18px; font-size: 30px; }
.form-stack { display: grid; gap: 15px; }
label { display: grid; gap: 7px; color: #455565; font-size: 14px; font-weight: 650; }
input, textarea, select { width: 100%; padding: 10px 12px; border: 1px solid #d5dee5; border-radius: 5px; outline: none; background: #fff; color: var(--ink); }
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(8, 127, 140, .1); }
textarea { min-height: 120px; resize: vertical; }
.help-text { color: var(--muted); font-size: 12px; font-weight: 400; }
.alert { margin-bottom: 18px; padding: 11px 13px; border-radius: 5px; }
.alert-error { background: #fff0ee; color: #a94435; }
.alert-success { background: #edf9f2; color: #2d704c; }
.alert-info { background: #eef7fb; color: #2d6174; }
.order-result { max-width: 680px; margin: 0 auto; padding: 34px; }
.order-number { margin: 15px 0 20px; padding: 15px; border-radius: 6px; background: var(--soft); font-size: 20px; font-weight: 800; letter-spacing: 0; text-align: center; }
.delivery-content { padding: 16px; border: 1px dashed #a8c9c8; border-radius: 6px; background: #f3fbfa; white-space: pre-wrap; word-break: break-word; }
.installer-page { min-height: 100vh; display: grid; place-items: center; padding: 25px; }
.installer-shell { width: min(480px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.installer-shell h1 { font-size: 30px; }
.install-note { margin: 20px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

/* Admin */
.admin-body { background: #f2f5f7; }
.admin-layout { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.admin-sidebar { min-height: 100vh; display: flex; flex-direction: column; padding: 25px 16px; background: #17212b; color: #c9d2d9; }
.admin-brand-block { padding-bottom: 28px; }
.admin-logo { display: flex; align-items: center; gap: 10px; padding: 0 10px; color: #fff; font-size: 17px; font-weight: 750; }
.admin-front-link { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 38px; padding: 8px 12px; border: 1px solid #4cc487; border-radius: 5px; background: #2f9e68 !important; color: #fff !important; font-size: 15px; line-height: 1.6; white-space: nowrap; }
.admin-front-link:hover { background: #267f53; }
.admin-nav { display: grid; gap: 5px; }
.admin-nav a { padding: 11px 12px; border-radius: 5px; }
.admin-nav a:hover, .admin-nav a.active { background: #253744; color: #fff; }
.admin-sidebar .admin-bottom { display: grid; justify-items: stretch; gap: 8px; margin-top: auto; padding-top: 18px; border-top: 1px solid #31414c; }
.admin-logout { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 38px; padding: 8px 12px; border: 1px solid #c94b4b; border-radius: 5px; background: #c94b4b; color: #fff; font-size: 15px; line-height: 1.6; }
.admin-logout:hover { background: #a93c3c; }
.admin-main { min-width: 0; }
.admin-topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 32px; border-bottom: 1px solid var(--line); background: #fff; }
.admin-topbar strong { font-size: 19px; }
.admin-user { color: var(--muted); font-size: 13px; }
.admin-content { padding: 32px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { padding: 20px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { margin-top: 5px; font-size: 28px; font-weight: 800; }
.admin-panel { margin-bottom: 22px; padding: 22px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.admin-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.admin-panel-header h2 { margin: 0; font-size: 18px; }
.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; min-width: 680px; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 10px; border-bottom: 1px solid #edf0f2; text-align: left; vertical-align: middle; }
.data-table th { color: var(--muted); font-size: 12px; font-weight: 700; }
.data-table td { color: #40505d; }
.table-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.badge { display: inline-flex; padding: 3px 8px; border-radius: 4px; background: #eef4f6; color: #5d6e79; font-size: 12px; }
.badge-success { background: #edf9f2; color: #2d704c; }
.badge-warning { background: #fff7e8; color: #986b19; }
.badge-danger { background: #fff0ee; color: #a94435; }
.two-column-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.two-column-form .full { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 25px; background: #f2f5f7; }
.login-card { width: min(420px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: var(--shadow); }
.login-card h1 { font-size: 28px; }
.login-brand { margin-bottom: 20px; }

@media (max-width: 900px) {
    .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-layout { grid-template-columns: 1fr; }
    .purchase-box { position: static; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { min-height: auto; padding: 14px; }
    .admin-brand-block { padding-bottom: 14px; }
    .admin-logo { padding: 4px 8px 0; }
    .admin-nav { display: flex; overflow-x: auto; }
    .admin-nav a { white-space: nowrap; }
    .admin-sidebar .admin-bottom { margin-top: 12px; padding-top: 12px; }
}
@media (max-width: 620px) {
    .container { width: min(100% - 28px, 1160px); }
    .header-inner { min-height: 62px; align-items: flex-start; padding: 13px 0; }
    .site-nav { gap: 12px; font-size: 13px; }
    .nav-admin { display: none; }
    .page-main { padding: 30px 0 50px; }
    h1 { font-size: 30px; }
    .page-intro { display: block; }
    .page-intro .muted { margin-bottom: 18px; }
    .catalog-grid { grid-template-columns: 1fr; }
    .catalog-list .product-card { grid-template-columns: 1fr; }
    .catalog-list .product-cover { min-height: 0; aspect-ratio: 1.7 / 1; }
    .footer-inner { display: block; }
    .footer-inner span { display: block; margin-bottom: 4px; }
    .two-column-form { grid-template-columns: 1fr; }
    .two-column-form .full { grid-column: auto; }
    .admin-topbar { padding: 0 18px; }
    .admin-content { padding: 20px 14px; }
    .admin-panel { padding: 16px; }
    .stats-grid { gap: 9px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 23px; }
    .installer-shell, .login-card { padding: 24px; }
}
