:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #f9fafb;
    --text: #161a22;
    --muted: #667085;
    --line: #d8dee8;
    --line-strong: #bac4d2;
    --primary: #d97706;
    --primary-strong: #b45309;
    --accent: #0891b2;
    --danger: #b42318;
    --success: #16835c;
    --warning: #9a6700;
    --sidebar: #171a21;
    --sidebar-soft: #222733;
    --shadow: 0 10px 28px rgba(22, 26, 34, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

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

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

a:hover {
    text-decoration: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    padding: 0 26px;
    background: #10131a;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 800;
    letter-spacing: 0;
    white-space: nowrap;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    overflow: hidden;
    border-radius: 7px;
    background: linear-gradient(135deg, #f59e0b, #22c55e);
    color: #10131a;
    font-size: 16px;
    font-weight: 850;
}

.brand-logo {
    display: block;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.12);
    object-fit: cover;
}

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

.nav a,
.account {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 6px;
    color: #dfe7f2;
    white-space: nowrap;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.account {
    color: #facc15;
    background: rgba(250, 204, 21, 0.08);
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 850;
    line-height: 1;
}

.admin-task-reminder {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(330px, calc(100vw - 32px));
    padding: 14px 16px;
    border: 1px solid #f0b65a;
    border-radius: 8px;
    background: #10131a;
    color: #fff;
    box-shadow: 0 18px 40px rgba(16, 19, 26, 0.26);
}

.admin-task-reminder:hover {
    background: #181c25;
    color: #fff;
}

.task-reminder-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    border-radius: 8px;
    background: #dc2626;
    color: #fff;
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.18);
}

.task-reminder-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.task-reminder-copy strong {
    color: #fff;
    font-size: 15px;
}

.task-reminder-copy span {
    color: #ffd89a;
    font-size: 13px;
}

.main {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    padding: 30px 0 52px;
}

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

.admin-sidebar {
    position: sticky;
    top: 60px;
    align-self: start;
    height: calc(100vh - 60px);
    padding: 22px 14px;
    overflow-y: auto;
    background: var(--sidebar);
    color: #fff;
}

.sidebar-kicker {
    color: #f59e0b;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.sidebar-title {
    margin: 4px 0 20px;
    font-size: 18px;
    font-weight: 800;
}

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

.admin-nav a {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 6px;
    color: #dbe4f0;
    font-weight: 650;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: var(--sidebar-soft);
    color: #fff;
}

.admin-nav a.active {
    box-shadow: inset 3px 0 0 var(--primary);
}

.admin-main {
    width: min(1260px, calc(100% - 32px));
}

.page-heading {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 14px;
}

.eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--primary-strong);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 26px;
    line-height: 1.22;
}

h2 {
    margin-bottom: 14px;
    font-size: 18px;
    line-height: 1.3;
}

h3 {
    margin-bottom: 8px;
    font-size: 15px;
}

.panel {
    margin-bottom: 18px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel.compact {
    padding: 14px;
}

.notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #f3d59e;
    border-radius: 8px;
    background: #fff8eb;
    color: #7c4a03;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric {
    min-height: 112px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.metric .label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.metric .value {
    display: block;
    margin-top: 10px;
    font-size: 28px;
    font-weight: 850;
    line-height: 1.1;
}

.metric .hint {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.toolbar {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #475467;
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid #c7d0de;
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    min-height: 0;
    padding: 0;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(217, 119, 6, 0.22);
    border-color: var(--primary);
}

textarea {
    min-height: 116px;
    resize: vertical;
}

.field {
    min-width: 180px;
    margin-bottom: 12px;
}

.field.inline {
    min-width: auto;
}

.field.inline label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text);
}

.field.inline input {
    width: auto;
    min-height: auto;
}

.field-help {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

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

.control-sm {
    width: auto;
    min-width: 160px;
    max-width: 220px;
}

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 750;
    white-space: nowrap;
}

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

.btn.disabled {
    border-color: #cbd5e1;
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.secondary,
button.secondary {
    border-color: #b7c1cf;
    background: #fff;
    color: var(--text);
}

.btn.danger,
button.danger {
    border-color: var(--danger);
    background: var(--danger);
}

.btn:hover,
button:hover {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
    color: #fff;
}

.btn.secondary:hover,
button.secondary:hover {
    background: #eef2f7;
    border-color: #9aa7b8;
    color: var(--text);
}

.btn.danger:hover,
button.danger:hover {
    background: #8f1c13;
    border-color: #8f1c13;
}

.result-summary {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pagination-current {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 10px;
    color: var(--muted);
    white-space: nowrap;
}

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

.catalog-meta {
    color: var(--muted);
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    gap: 18px;
}

.product-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.product-cover {
    position: relative;
    aspect-ratio: 16 / 10;
    background: #0f172a;
    overflow: hidden;
}

.product-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-stock {
    position: absolute;
    top: 10px;
    right: 10px;
    min-height: 26px;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(16, 19, 26, 0.78);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.product-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
}

.product-title {
    min-height: 42px;
    margin: 0;
    font-size: 16px;
    font-weight: 850;
    line-height: 1.32;
}

.product-desc {
    display: -webkit-box;
    min-height: 44px;
    overflow: hidden;
    color: var(--muted);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
}

.price {
    color: var(--primary-strong);
    font-size: 20px;
    font-weight: 900;
    white-space: nowrap;
}

.buy-card {
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.buy-preview {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.buy-preview img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.buy-info {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.summary-list {
    display: grid;
    gap: 10px;
    margin: 16px 0;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.summary-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.table-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

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

th,
td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

th {
    background: #eef2f6;
    color: #344054;
    font-weight: 850;
}

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

.muted {
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #eef2f6;
    color: #344054;
    font-size: 12px;
    font-weight: 800;
}

.badge.ok {
    background: #e8f6ef;
    color: var(--success);
}

.badge.warn {
    background: #fff4dc;
    color: var(--warning);
}

.badge.danger {
    background: #fee4e2;
    color: var(--danger);
}

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

.alert-success {
    border-color: #9ed8bd;
    color: var(--success);
}

.alert-error {
    border-color: #f2aaa5;
    color: var(--danger);
}

.alert-info {
    border-color: #8ed6e7;
    color: var(--accent);
}

.code {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    word-break: break-all;
    white-space: normal;
}

.highlight {
    background: #fff8e6;
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 16px 0;
}

.form-narrow {
    max-width: 480px;
}

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

.main.auth-main {
    width: min(576px, calc(100% - 32px));
}

.auth-main .form-narrow {
    width: 100%;
    max-width: none;
}

.split {
    display: grid;
    grid-template-columns: minmax(280px, 430px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.admin-disclosure {
    padding: 0;
    overflow: hidden;
}

.admin-disclosure summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 58px;
    padding: 0 18px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 850;
    list-style: none;
}

.admin-disclosure summary::-webkit-details-marker {
    display: none;
}

.admin-disclosure summary .muted {
    font-size: 13px;
    font-weight: 650;
}

.admin-disclosure[open] summary {
    border-bottom: 1px solid var(--line);
}

.disclosure-form {
    padding: 18px;
}

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

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

.compact-toolbar {
    margin-bottom: 12px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(16, 19, 26, 0.48);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-panel {
    width: min(560px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 24px 60px rgba(16, 19, 26, 0.22);
}

.modal-panel form {
    margin: 0;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.modal-head h2,
.modal-head p {
    margin-bottom: 0;
}

.modal-head p {
    margin-top: 4px;
}

.icon-button {
    width: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    font-size: 22px;
    line-height: 1;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 18px;
    align-items: start;
}

.order-product {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    margin-bottom: 16px;
}

.thumb-lg {
    width: 132px;
    aspect-ratio: 16 / 10;
    border-radius: 8px;
    object-fit: cover;
    background: #e5e7eb;
    border: 1px solid var(--line);
}

.secret-box,
.message-box {
    margin-bottom: 16px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.secret-box {
    font-size: 15px;
    font-weight: 850;
}

.message-box {
    white-space: normal;
}

.detail-actions {
    margin-top: 14px;
}

.ticket-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.timeline {
    display: grid;
    gap: 10px;
}

.timeline-item {
    display: grid;
    gap: 5px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text);
}

a.timeline-item:hover {
    border-color: var(--line-strong);
    background: #f3f6fa;
}

.notification-list {
    display: grid;
    gap: 12px;
}

.notification-item {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 0;
}

.notification-item.unread {
    border-color: #f0bd68;
    background: #fffaf0;
}

.notification-main {
    min-width: 0;
}

.notification-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification-title h2 {
    margin-bottom: 6px;
}

.unread-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--danger);
}

.admin-product-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.thumb-sm {
    width: 52px;
    height: 36px;
    flex: 0 0 auto;
    border-radius: 5px;
    object-fit: cover;
    background: #e5e7eb;
    border: 1px solid var(--line);
}

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

    .admin-sidebar {
        position: static;
        height: auto;
        padding: 14px;
    }

    .admin-nav {
        display: flex;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .admin-nav a {
        flex: 0 0 auto;
    }

    .buy-card,
    .split,
    .form-grid,
    .form-grid.two-cols,
    .detail-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .topbar {
        position: static;
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        padding: 12px 16px;
    }

    .nav {
        justify-content: flex-start;
    }

    .main,
    .admin-main {
        width: min(100% - 24px, 1200px);
        padding: 22px 0 36px;
    }

    .catalog-head,
    .product-footer,
    .notification-item,
    .ticket-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .order-product {
        grid-template-columns: 1fr;
    }

    .thumb-lg {
        width: 100%;
    }

    .admin-task-reminder {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
    }

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

    th,
    td {
        padding: 9px 10px;
    }
}
