:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #e4e7ec;
    --text: #17202a;
    --muted: #667085;
    --primary: #e6532f;
    --primary-dark: #bd3d20;
    --nav: #17212b;
    --nav-soft: #253240;
    --success: #137a4b;
    --success-bg: #ecfdf3;
    --warning: #9a6700;
    --warning-bg: #fff8e6;
    --danger: #b42318;
    --danger-bg: #fff1f0;
    --radius: 14px;
    --shadow: 0 2px 10px rgba(16, 24, 40, .055);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--primary-dark); }
h1, h2, h3 { color: var(--text); line-height: 1.25; }
h1 { margin: 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.035em; }
h2 { margin: 0 0 16px; font-size: 20px; letter-spacing: -.02em; }
h3 { margin: 22px 0 12px; font-size: 16px; }
p { margin: 9px 0; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 248px; display: flex; flex-direction: column; padding: 22px 14px; background: var(--nav); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 28px; color: #fff; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(145deg, #ff744f, #df4725); font-weight: 800; box-shadow: 0 7px 20px rgba(230, 83, 47, .3); }
.brand-copy strong { display: block; font-size: 18px; letter-spacing: -.02em; }
.brand-copy span { display: block; color: #aeb8c4; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.nav { display: flex; flex: 1; min-height: 0; flex-direction: column; gap: 4px; overflow-y: auto; padding-right: 2px; scrollbar-width: thin; }
.nav a, .nav summary { display: flex; align-items: center; min-height: 42px; padding: 10px 12px; border-radius: 9px; color: #cbd3dc; text-decoration: none; font-weight: 650; transition: .16s ease; }
.nav a:hover, .nav a.active, .nav summary:hover, .nav summary.active { background: var(--nav-soft); color: #fff; }
.nav-link:hover, .nav-link.active { transform: translateX(2px); }
.nav-group { margin: 0; }
.nav-group summary { justify-content: space-between; cursor: pointer; list-style: none; user-select: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-chevron { color: #8e9ba9; font-size: 20px; line-height: 1; transition: transform .16s ease; }
.nav-group[open] .nav-chevron { transform: rotate(90deg); }
.nav-submenu { display: grid; gap: 2px; margin: 3px 0 6px 13px; padding-left: 9px; border-left: 1px solid rgba(255,255,255,.12); }
.nav-submenu a { min-height: 34px; padding: 7px 10px; color: #aeb8c4; font-size: 13px; font-weight: 600; }
.nav-submenu a.active { color: #fff; }
.sidebar-footer { flex: 0 0 auto; border-top: 1px solid rgba(255,255,255,.1); padding: 16px 8px 0; }
.user-name { color: #fff; font-weight: 700; }
.user-role { color: #aeb8c4; font-size: 12px; }
.logout-form { margin-top: 12px; }
.logout-form button { width: 100%; background: rgba(255,255,255,.08); color: #e6ebef; border: 1px solid rgba(255,255,255,.12); }
.logout-form button:hover { background: rgba(255,255,255,.14); }

.main { min-height: 100vh; margin-left: 248px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 104px; padding: 24px clamp(22px, 4vw, 54px); background: rgba(255,255,255,.92); border-bottom: 1px solid var(--border); }
.eyebrow { margin: 0 0 5px; color: var(--primary-dark); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.workspace-badge { white-space: nowrap; padding: 7px 10px; border-radius: 999px; background: #fff4ef; color: #aa351c; font-size: 12px; font-weight: 700; }
.workspace-badge.production { background: #fff1f0; color: #b42318; border: 1px solid #fecdca; }
.environment-notice { margin-bottom: 18px; }
.content { width: min(1420px, 100%); padding: 30px clamp(22px, 4vw, 54px) 60px; }
.page-intro { max-width: 740px; margin: -8px 0 24px; color: var(--muted); font-size: 16px; }

.card { margin: 0 0 20px; padding: 22px; overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.ok, .ok { background: var(--success-bg); border-color: #b7ebcd; }
.card.warn, .warn { background: var(--warning-bg); border-color: #f1d58a; }
.card.error, .error { background: var(--danger-bg); border-color: #f3b4ae; }
.muted { color: var(--muted); font-size: 13px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 650; }
.stat-value { margin-top: 8px; font-size: clamp(25px, 3vw, 34px); font-weight: 800; letter-spacing: -.04em; }
.stat-meta { margin-top: 5px; color: var(--muted); font-size: 12px; }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0 0 24px; }
.action-card { display: block; padding: 19px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: .16s ease; }
.action-card:hover { border-color: #f0a08a; transform: translateY(-2px); box-shadow: 0 8px 22px rgba(16,24,40,.08); }
.action-card strong { display: block; margin-bottom: 5px; }
.action-card span { color: var(--muted); font-size: 13px; }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; background: #eef2f6; color: #475467; font-size: 12px; font-weight: 700; }
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.warning { background: var(--warning-bg); color: var(--warning); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: #e9f2ff; color: #175cd3; }

table { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; margin: 14px 0 0; color: #26313d; font-size: 14px; font-variant-numeric: tabular-nums; }
th { padding: 12px 14px; background: var(--surface-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); color: #475467; font-size: 12px; font-weight: 750; line-height: 1.35; text-align: left; white-space: nowrap; }
th:first-child { border-left: 1px solid var(--border); border-radius: 9px 0 0 9px; }
th:last-child { border-right: 1px solid var(--border); border-radius: 0 9px 9px 0; }
td { padding: 14px; border-bottom: 1px solid #edf0f2; line-height: 1.45; vertical-align: middle; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #fbfcfd; }
td .muted { line-height: 1.35; }
.product-cell { display: flex; align-items: center; gap: 12px; min-width: 250px; }
.product-thumb { width: 54px; height: 54px; flex: 0 0 54px; border-radius: 10px; border: 1px solid var(--border); background: #f2f4f7; object-fit: cover; }
.product-thumb.placeholder { display: grid; place-items: center; color: #98a2b3; font-size: 9px; font-weight: 800; text-align: center; text-transform: uppercase; }
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.pagination-links { display: flex; flex-wrap: wrap; gap: 6px; }
.pagination-links a, .pagination-links span { min-width: 36px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: #344054; text-align: center; text-decoration: none; }
.pagination-links .active { border-color: var(--primary); background: #fff4ef; color: var(--primary-dark); font-weight: 800; }
.filter-row { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
tr:last-child td { border-bottom: 0; }
dl { margin: 12px 0; }
dt { margin-top: 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
dd { margin: 2px 0 8px; font-weight: 600; }

form { margin: 0; }
label { display: inline-flex; flex-direction: column; gap: 6px; margin: 0 10px 12px 0; color: #344054; font-size: 13px; font-weight: 650; vertical-align: top; }
input, select, textarea { max-width: 100%; margin: 0; padding: 10px 12px; background: #fff; border: 1px solid #cfd5dd; border-radius: 8px; color: var(--text); font: inherit; font-weight: 400; line-height: 1.35; outline: none; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select { min-height: 42px; }
textarea { width: min(100%, 720px); min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #eb866c; box-shadow: 0 0 0 3px rgba(230,83,47,.12); }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 0; flex: 0 0 16px; vertical-align: -3px; accent-color: var(--primary); }
button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 15px; background: var(--primary); border: 1px solid var(--primary); border-radius: 8px; color: #fff; cursor: pointer; font: inherit; font-size: 14px; font-weight: 750; line-height: 1.2; text-decoration: none; transition: .16s ease; }
button:hover, .button:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
button.secondary, .button.secondary { background: #fff; border-color: #cfd5dd; color: #344054; }
button.secondary:hover, .button.secondary:hover { background: #f7f8fa; border-color: #98a2b3; color: #17202a; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.section-heading h2 { margin-bottom: 4px; }
.stat-grid.compact { margin: 18px 0; }
.stat-grid.compact .stat-card { padding: 14px; box-shadow: none; }
.inline-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin: 16px 0; }
.settings-row { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.filter-row { align-items: flex-end; gap: 12px; }
.filter-row label { margin: 0; }
.filter-row input, .filter-row select { min-width: 170px; }
.form-stack { display: grid; gap: 2px; }
.form-stack > label { display: flex; width: min(100%, 720px); margin-right: 0; }
.form-stack > label > input:not([type="checkbox"]):not([type="radio"]), .form-stack > label > select, .form-stack > input:not([type="hidden"]), .form-stack > textarea { width: min(100%, 720px); }
.form-stack > button, .form-stack > .button { justify-self: start; margin-top: 6px; }
.compact-input { width: 150px !important; }
.action-card form, form.action-card { display: flex; flex-direction: column; align-items: flex-start; }
.action-card input:not([type="checkbox"]):not([type="radio"]), .action-card select, .action-card textarea { width: 100%; }
td form { display: inline-flex; align-items: center; gap: 8px; }
td form label { margin: 0; }
td button, td .button { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.match-card { padding: 18px 0; border-top: 1px solid var(--border); }
.match-products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.match-product { display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.product-thumb.large { width: 72px; height: 72px; flex-basis: 72px; }
.match-decision { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 12px; }
.page-tabs { display: flex; align-items: center; gap: 6px; margin: -4px 0 20px; padding: 5px; border: 1px solid var(--border); border-radius: 11px; background: #fff; width: fit-content; }
.page-tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 8px; color: #475467; font-weight: 700; text-decoration: none; }
.page-tabs a.active { background: #fff1eb; color: var(--primary-dark); }
.count-pill { min-width: 22px; padding: 1px 6px; border-radius: 999px; background: #eef2f6; color: #475467; font-size: 11px; text-align: center; }
.disclosure { padding: 0; overflow: hidden; }
.disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 22px; cursor: pointer; list-style: none; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary small { display: block; margin-top: 3px; color: var(--muted); font-weight: 500; }
.disclosure > form { padding: 0 22px 22px; border-top: 1px solid var(--border); }
.table-scroll { width: 100%; overflow-x: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid > label { width: 100%; margin-right: 0; }
.form-grid input, .form-grid select { width: 100%; }
.inline-form { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.inline-form label { margin: 0; }
.compact-form { flex-wrap: wrap; }
.marketplace-chip { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; background: #fff1eb; color: var(--primary-dark); font-size: 12px; font-weight: 750; }
.detail-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; overflow: visible; }
.detail-hero h2 { margin: 10px 0 2px; font-size: 25px; }
.notice { margin: 14px 0; padding: 13px 15px; border: 1px solid #c7d7fe; border-radius: 10px; background: #eff5ff; color: #344054; }
.notice.warning { border-color: #f1d58a; background: var(--warning-bg); }
.notice.error { border-color: #f3b4ae; background: var(--danger-bg); }
.toggle-field { justify-content: center; min-height: 68px; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft); }
.confirm-panel { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 18px; padding: 15px; border: 1px solid #f1d58a; border-radius: 10px; background: var(--warning-bg); }
.confirm-panel label { margin: 0; }
.empty-state { padding: 28px 16px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--text); font-size: 16px; }
.workflow-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.workflow-steps > div { min-height: 112px; padding: 15px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-soft); }
.workflow-steps span { display: grid; place-items: center; width: 26px; height: 26px; margin-bottom: 10px; border-radius: 999px; background: #fff1eb; color: var(--primary-dark); font-weight: 800; }
.workflow-steps strong, .workflow-steps small { display: block; }
.workflow-steps small { margin-top: 4px; color: var(--muted); }
.product-hero { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; align-items: center; }
.product-hero-image { display: block; width: 180px; height: 180px; border-radius: 16px; border: 1px solid var(--border); object-fit: cover; background: #f2f4f7; }
.disclosure-card { padding: 0; }
.disclosure-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 22px; cursor: pointer; list-style: none; font-size: 16px; font-weight: 750; }
.disclosure-card > summary::-webkit-details-marker { display: none; }
.disclosure-card > summary::after { content: "+"; color: var(--primary-dark); font-size: 21px; line-height: 1; }
.disclosure-card[open] > summary { border-bottom: 1px solid var(--border); }
.disclosure-card[open] > summary::after { content: "−"; }
.disclosure-body { padding: 4px 22px 22px; overflow-x: auto; }
code, pre { background: #f1f4f7; border-radius: 6px; }
code { padding: 2px 5px; }
pre { padding: 14px; overflow: auto; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; background: radial-gradient(circle at top left, #fff3ee 0, transparent 34%), var(--bg); }
.auth-panel { width: min(480px, 100%); }
.auth-brand { display: flex; justify-content: center; align-items: center; gap: 11px; margin-bottom: 24px; color: var(--text); text-decoration: none; }
.auth-brand .brand-mark { color: #fff; }
.auth-panel h1 { text-align: center; margin-bottom: 22px; }
.auth-panel .card { padding: 28px; }
.auth-panel input { width: 100%; }

@media (max-width: 1080px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .workflow-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
    .sidebar { position: static; width: 100%; padding: 16px; }
    .brand { margin-bottom: 14px; }
    .nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
    .nav a, .nav summary { min-height: 36px; padding: 7px 9px; }
    .nav-group { grid-column: 1 / -1; }
    .nav-submenu { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: auto; margin: 2px 0 5px 10px; padding: 3px 0 3px 8px; background: transparent; border: 0; border-left: 1px solid rgba(255,255,255,.12); border-radius: 0; box-shadow: none; }
    .sidebar-footer { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding-top: 12px; }
    .logout-form { margin: 0 0 0 auto; }
    .main { margin-left: 0; }
    .topbar { min-height: auto; padding: 20px; }
    .content { padding: 22px 16px 44px; }
}
@media (max-width: 600px) {
    .stat-grid, .action-grid { grid-template-columns: 1fr; }
    .match-products { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .workflow-steps { grid-template-columns: 1fr; }
    .product-hero { grid-template-columns: 1fr; }
    .workspace-badge { display: none; }
    .card { padding: 17px; }
}
