:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --border: #e5e8f0;
    --text: #1b2333;
    --text-muted: #6b7385;
    --primary: #335cff;
    --primary-soft: #eef2ff;
    --success: #0f9d58;
    --success-soft: #e7f7ee;
    --warning: #b45309;
    --warning-soft: #fef3c7;
    --danger: #d92d20;
    --danger-soft: #fee4e2;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(28, 40, 72, 0.06);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 15% -10%, #e8edff 0%, transparent 60%),
        var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

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

a:hover {
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.container {
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

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

.brand::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: linear-gradient(135deg, #335cff, #7c3aed);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.brand:hover {
    text-decoration: none;
}

.site-nav {
    display: flex;
    gap: 8px;
}

.site-nav__link {
    padding: 8px 14px;
    border-radius: 10px;
    color: var(--text-muted);
    font-weight: 600;
}

.site-nav__link:hover {
    background: #f1f4fa;
    color: var(--text);
    text-decoration: none;
}

.site-nav__link.is-active {
    background: var(--primary-soft);
    color: var(--primary);
}

main.container {
    flex: 1;
    padding: 32px 0 48px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.page-head h1 {
    margin: 0;
    font-size: 24px;
    letter-spacing: -0.02em;
}

.page-head p {
    margin: 6px 0 0;
    color: var(--text-muted);
}

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

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

table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

thead th {
    padding: 14px 20px;
    background: #f8f9fd;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

tbody td {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f2f8;
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: #fafbff;
}

.product-name {
    font-weight: 600;
}

.product-id {
    margin-left: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

.sku {
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f4f6fa;
    color: #3d4456;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 12.5px;
}

.cell-num {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

.stock {
    display: inline-flex;
    justify-content: center;
    min-width: 44px;
    padding: 2px 10px;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.stock.is-normal {
    background: #f2f4f9;
    color: #3d4456;
}

.stock.is-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.stock.is-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge--success {
    background: var(--success-soft);
    color: var(--success);
}

.badge--muted {
    background: #f2f4f9;
    color: var(--text-muted);
}

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

.empty {
    padding: 56px 20px !important;
    color: var(--text-muted);
    text-align: center;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 20px;
    background: #fcfdff;
    border-top: 1px solid var(--border);
}

.pagination__info {
    color: var(--text-muted);
    font-size: 13px;
}

.pagination__links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.pagination__links a,
.pagination__links span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.pagination__links a:hover {
    border-color: #c9d2ea;
    background: #f7f9ff;
    text-decoration: none;
}

.pagination__links .is-current {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.pagination__links .is-disabled {
    background: #f7f8fc;
    color: #b6bccb;
}

.error-card {
    padding: 64px 24px;
    text-align: center;
}

.error-code {
    margin: 0;
    color: var(--primary);
    font-size: 56px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.error-card h1 {
    margin: 8px 0 24px;
    font-size: 20px;
    font-weight: 600;
}

.btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 18px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.btn:hover {
    background: #2549d8;
    text-decoration: none;
}

.site-footer {
    padding: 24px 0 32px;
    color: var(--text-muted);
    font-size: 12.5px;
}

.sr-only {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.alert {
    margin-bottom: 20px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 500;
}

.alert--success {
    border-color: #b9e8cd;
    background: var(--success-soft);
    color: #087a45;
}

.alert--error {
    border-color: #fec9c5;
    background: var(--danger-soft);
    color: #b42318;
}

.btn--secondary {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}

.btn--secondary:hover {
    border-color: #c9d2ea;
    background: #f7f9ff;
    color: var(--text);
}

.list-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: #fcfdff;
}

.list-toolbar input {
    width: min(360px, 100%);
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.list-toolbar input:focus {
    border-color: var(--primary);
    outline: 2px solid var(--primary-soft);
}

.toolbar-reset {
    color: var(--text-muted);
    font-size: 13px;
}

.cell-actions {
    white-space: nowrap;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.action-link {
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
}

.action-link:hover {
    text-decoration: underline;
}

.action-link--danger {
    color: var(--danger);
}

.form-card {
    padding: 28px;
}

.product-form {
    width: 100%;
}

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

.form-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.form-field--wide {
    grid-column: 1 / -1;
}

.form-field label {
    color: #344054;
    font-size: 13px;
    font-weight: 600;
}

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

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-field textarea {
    min-height: 140px;
    resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.field-error {
    color: var(--danger);
    font-size: 12.5px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.auth-card {
    width: min(460px, 100%);
    padding: 28px;
}

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

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.detail-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.detail-item strong {
    overflow-wrap: anywhere;
    font-size: 15px;
}

.detail-item code {
    color: var(--text-muted);
    font-size: 12px;
}

.phase1-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.phase1-grid h2 {
    margin: 0 0 16px;
    font-size: 17px;
}

.permission-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.permission-tag {
    padding: 4px 10px;
    border: 1px solid #dce4ff;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 600;
}

@media (max-width: 640px) {
    .container {
        width: calc(100% - 32px);
    }

    main.container {
        padding-top: 20px;
    }

    .page-head h1 {
        font-size: 20px;
    }

    .pagination {
        justify-content: center;
    }

    .form-card,
    .auth-card {
        padding: 20px;
    }

    .form-grid,
    .detail-grid,
    .phase1-grid {
        grid-template-columns: 1fr;
    }

    .form-field--wide {
        grid-column: auto;
    }

    .list-toolbar {
        flex-wrap: wrap;
    }
}

.platform-body {
    display: block;
    min-height: 100vh;
    background: #f4f6fb;
}

.platform-shell {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    min-height: 100vh;
}

.platform-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 22px 16px;
    background: #111827;
    color: #d1d5db;
}

.platform-brand {
    padding: 0 10px 24px;
    color: #fff;
    font-size: 15px;
    line-height: 1.4;
}

.platform-brand::before {
    flex: 0 0 auto;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.14);
}

.platform-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.platform-nav__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 12px;
    border-radius: 10px;
    color: #cbd5e1;
    font-weight: 600;
}

.platform-nav__link:hover {
    background: #1f2937;
    color: #fff;
    text-decoration: none;
}

.platform-nav__link.is-active {
    background: var(--primary);
    color: #fff;
}

.platform-nav__count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 12px;
    text-align: center;
}

.platform-sidebar__footer {
    margin-top: auto;
    padding: 14px 10px 0;
    border-top: 1px solid #273244;
    color: #7c879b;
    font-size: 12px;
}

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

.platform-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    height: 68px;
    padding: 0 30px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
}

.platform-topbar strong {
    font-size: 15px;
}

.platform-topbar__subtitle {
    margin-left: 12px;
    color: var(--text-muted);
    font-size: 12px;
}

.platform-topbar__user {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
    font-size: 13px;
}

.platform-topbar form {
    margin: 0;
}

.platform-logout,
.platform-link-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.platform-logout {
    color: var(--text-muted);
}

.platform-link-button {
    color: var(--primary);
    font-size: 13px;
}

.platform-link-button:hover,
.platform-logout:hover {
    text-decoration: underline;
}

.action-link--danger.platform-link-button {
    color: var(--danger);
}

.platform-content {
    width: min(1320px, 100%);
    margin: 0 auto;
    padding: 30px;
}

.platform-content .page-head {
    margin-bottom: 22px;
}

.list-toolbar select {
    height: 38px;
    padding: 0 32px 0 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.review-form {
    display: grid;
    gap: 8px;
    min-width: 240px;
    margin-top: 10px;
}

.review-form textarea {
    min-height: 72px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    resize: vertical;
}

.review-form .btn {
    justify-content: center;
}

.setting-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    grid-column: 1 / -1;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fafbff;
    color: #344054;
    font-weight: 600;
}

.setting-switch input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.log-detail {
    max-width: 360px;
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 12px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

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

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

    .platform-brand {
        padding-bottom: 14px;
    }

    .platform-nav {
        flex-direction: row;
        overflow-x: auto;
    }

    .platform-nav__link {
        flex: 0 0 auto;
    }

    .platform-sidebar__footer {
        display: none;
    }

    .platform-content {
        padding: 20px;
    }
}

@media (max-width: 560px) {
    .platform-topbar {
        height: auto;
        padding: 14px 16px;
    }

    .platform-topbar__subtitle {
        display: none;
    }

    .platform-content {
        padding: 16px;
    }
}

.merchant-brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    object-fit: cover;
    background: #fff;
}

.store-logo-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 112px;
    height: 112px;
    overflow: hidden;
    border: 1px dashed #c9d2ea;
    border-radius: 14px;
    background: #f8faff;
    color: var(--text-muted);
}

.store-logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.permission-heading {
    margin: 28px 0 14px;
    font-size: 17px;
}

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

.permission-group {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fcfdff;
}

.permission-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 9px;
    border-radius: 8px;
    color: #344054;
    cursor: pointer;
}

.permission-option:hover {
    background: #f1f4fa;
}

.permission-option--menu {
    margin-bottom: 2px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}

.permission-option input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.permission-option small {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 11px;
}

@media (max-width: 720px) {
    .permission-grid {
        grid-template-columns: 1fr;
    }
}
