:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-soft: #f8f8fa;
  --border: #e1e3e5;
  --border-strong: #c9cccf;
  --text: #202223;
  --muted: #6d7175;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --success: #007f5f;
  --danger: #c5280c;
  --purple: #6d28d9;
  --sidebar: 220px;
  --shadow: 0 1px 2px rgba(31,33,36,.08), 0 2px 8px rgba(31,33,36,.06);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: #7069dd; font-size: 11px; font-weight: 750; letter-spacing: .11em; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column; padding: 18px 14px; background: #eef0f3; border-right: 1px solid var(--border); z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 24px; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand b { font-size: 17px; letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.sidebar nav { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 8px; color: #4a4d50; font-weight: 580; }
.nav-item:hover { background: rgba(255,255,255,.7); }
.nav-item.active { color: var(--primary-dark); background: #fff; box-shadow: 0 1px 2px rgba(31,33,36,.06); }
.nav-icon { display: grid; place-items: center; width: 20px; height: 20px; font-size: 17px; }
.sidebar-foot { margin-top: auto; display: flex; align-items: flex-start; gap: 8px; padding: 12px 8px 2px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.status-dot { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: #20a36a; box-shadow: 0 0 0 3px rgba(32,163,106,.12); flex: 0 0 auto; }
.status-dot.offline { background: #e0a100; box-shadow: 0 0 0 3px rgba(224,161,0,.13); }

.app-shell { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px clamp(20px, 4vw, 44px); background: rgba(255,255,255,.92); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 8; backdrop-filter: blur(12px); }
.breadcrumb { margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions form { margin: 0; }
main { max-width: 1680px; margin: 0 auto; padding: 26px clamp(20px, 4vw, 44px) 64px; }
.section { margin-bottom: 20px; scroll-margin-top: 105px; }

.button, .icon-button, .text-button { border: 0; cursor: pointer; transition: background .15s, border-color .15s, transform .15s, opacity .15s; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 7px 14px; border-radius: 8px; font-weight: 650; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { cursor: wait; opacity: .58; }
.button-primary { color: #fff; background: var(--primary); box-shadow: inset 0 -1px rgba(0,0,0,.18); }
.button-primary:hover:not(:disabled) { background: var(--primary-dark); }
.button-secondary { color: #303336; background: #fff; border: 1px solid var(--border-strong); box-shadow: 0 1px 1px rgba(0,0,0,.04); }
.button-secondary:hover { background: #f7f7f8; }
.button-large { width: 100%; min-height: 44px; }
.icon-button { width: 36px; height: 36px; border-radius: 8px; background: transparent; color: var(--muted); font-size: 20px; }
.icon-button:hover { background: #eceef0; color: var(--text); }
.text-button { padding: 5px 0; background: none; color: var(--primary); font-weight: 650; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card { min-height: 124px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 1px 2px rgba(31,33,36,.04); }
.stat-card > span { display: block; color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; margin: 9px 0 6px; font-size: 30px; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stat-card small { color: #8b8f93; font-size: 11px; }

.job-card { padding: 19px 20px 17px; background: linear-gradient(105deg, #fff 55%, #f5f3ff); border: 1px solid #dcd9f7; border-radius: 12px; box-shadow: 0 1px 3px rgba(61,54,144,.06); }
.job-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.title-row { display: flex; align-items: center; gap: 9px; }
.title-row h2 { margin: 0; font-size: 16px; }
.job-heading p { margin: 6px 0 0; color: var(--muted); }
.job-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.progress-track { width: 100%; height: 7px; margin: 17px 0 13px; background: #e8e7f3; border-radius: 99px; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--primary), #8b5cf6); border-radius: inherit; transition: width .35s ease; }
.progress-track span.indeterminate { width: 38% !important; animation: indeterminate 1.4s ease-in-out infinite; }
@keyframes indeterminate { from { transform: translateX(-105%); } to { transform: translateX(275%); } }
.job-metrics { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: 12px; }
.job-metrics b { color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.wait-reason { margin: 11px 0 0; padding: 8px 10px; color: #5b4a00; background: #fff8d8; border-radius: 7px; font-size: 12px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 20px 22px 14px; }
.panel-heading h2 { margin: 0; font-size: 19px; }
.panel-heading > p { margin: 0; font-size: 12px; }
.filters { display: grid; grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(145px, .55fr)) auto; gap: 9px; padding: 12px 22px; background: #fafafa; border-top: 1px solid #eee; border-bottom: 1px solid var(--border); }
.filters input, .filters select, .login-card input { width: 100%; height: 38px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 11px; color: var(--text); background: #fff; outline: 0; }
.filters input:focus, .filters select:focus, .login-card input:focus { border-color: #716ae2; box-shadow: 0 0 0 2px rgba(79,70,229,.12); }
.search-field { position: relative; }
.search-field span { position: absolute; left: 12px; top: 7px; color: var(--muted); font-size: 18px; }
.search-field input { padding-left: 36px; }
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 20px 22px 12px; }
.product-card { min-width: 0; background: #fff; border: 1px solid var(--border); border-radius: 11px; overflow: hidden; transition: transform .18s, box-shadow .18s, border-color .18s; }
.product-card:hover { transform: translateY(-2px); border-color: #cccadf; box-shadow: 0 8px 25px rgba(40,34,100,.10); }
.product-image { position: relative; aspect-ratio: 1 / .88; overflow: hidden; background: #eceef1; }
.product-image img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .35s; }
.product-card:hover .product-image img { transform: scale(1.02); }
.image-placeholder { height: 100%; display: grid; place-items: center; color: #8c8f94; font-size: 28px; font-weight: 800; letter-spacing: .1em; }
.score-pill { position: absolute; top: 10px; left: 10px; padding: 5px 8px; border-radius: 7px; color: #fff; background: rgba(32,34,36,.82); backdrop-filter: blur(4px); font-size: 11px; font-weight: 720; }
.product-body { padding: 14px 14px 12px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 5px; min-height: 22px; }
.badge { display: inline-flex; align-items: center; min-height: 21px; padding: 2px 7px; border-radius: 99px; font-size: 10px; font-weight: 720; line-height: 1.2; }
.badge-neutral { color: #5c5f62; background: #edeff0; }
.badge-info { color: #1f5199; background: #e5f1ff; }
.badge-purple { color: #5b21b6; background: #ede9fe; }
.badge-success { color: #08765a; background: #dff6ec; }
.badge-running { color: #4f36a8; background: #ebe7ff; }
.badge-danger { color: var(--danger); background: #fee7e3; }
.product-body h3 { height: 42px; margin: 11px 0 7px; overflow: hidden; font-size: 15px; line-height: 1.4; letter-spacing: -.01em; }
.product-copy { height: 48px; margin-bottom: 12px; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.engagement-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 10px 0; border-top: 1px solid #eee; border-bottom: 1px solid #eee; }
.engagement-item { min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 4px; }
.engagement-icon { grid-row: span 2; color: #7771c8; }
.engagement-item strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.engagement-item small { color: var(--muted); font-size: 9px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 11px; }
.store-identity { min-width: 0; display: flex; flex-direction: column; }
.store-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.store-identity small { color: var(--muted); font-size: 9px; }
.empty-state { padding: 65px 20px 75px; text-align: center; color: var(--muted); }
.empty-state div { font-size: 44px; color: #a7a3dc; }
.empty-state h3 { margin: 12px 0 7px; color: var(--text); }
.load-more { display: flex; justify-content: center; padding: 12px 20px 23px; }

.product-dialog { width: min(920px, calc(100vw - 30px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 15px; box-shadow: 0 24px 80px rgba(20,20,35,.25); }
.product-dialog::backdrop { background: rgba(26,28,31,.48); backdrop-filter: blur(2px); }
.dialog-close { position: absolute; top: 12px; right: 12px; z-index: 3; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); cursor: pointer; font-size: 22px; }
.detail-hero { display: grid; grid-template-columns: minmax(260px, .8fr) 1fr; gap: 26px; padding: 28px; }
.detail-hero > img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #eee; }
.detail-hero h2 { font-size: 24px; letter-spacing: -.025em; }
.detail-copy { color: var(--muted); line-height: 1.65; }
.detail-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.detail-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border-top: 1px solid var(--border); }
.detail-section { padding: 23px 28px; background: #fff; }
.detail-section h3 { font-size: 15px; }
.definition-row { display: flex; justify-content: space-between; gap: 20px; padding: 11px 0; border-bottom: 1px solid #eee; }
.definition-row:last-child { border-bottom: 0; }
.definition-row > div { display: flex; flex-direction: column; }
.definition-row span { font-size: 12px; }
.definition-row small { max-width: 300px; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.definition-row strong { white-space: nowrap; font-size: 12px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; max-width: 370px; padding: 12px 16px; color: #fff; background: #292b2d; border-radius: 9px; box-shadow: 0 12px 35px rgba(0,0,0,.2); }
.toast[data-tone="danger"] { background: #9d210b; }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 30px; background: radial-gradient(circle at 18% 14%, #e9e7ff 0, transparent 30%), #f5f5f7; }
.login-shell { width: min(980px, 100%); min-height: 590px; display: grid; grid-template-columns: 1.2fr .8fr; overflow: hidden; background: #fff; border: 1px solid #e3e2e8; border-radius: 20px; box-shadow: 0 30px 80px rgba(45,40,90,.14); }
.login-brand { padding: 64px; display: flex; flex-direction: column; justify-content: center; color: #fff; background: linear-gradient(145deg, #242052, #4f46e5 58%, #7c3aed); position: relative; overflow: hidden; }
.login-brand::after { content: ""; position: absolute; width: 380px; height: 380px; right: -190px; bottom: -160px; border: 50px solid rgba(255,255,255,.08); border-radius: 50%; }
.login-brand img { margin-bottom: 35px; filter: drop-shadow(0 8px 18px rgba(0,0,0,.18)); }
.login-brand .eyebrow { color: #c9c4ff; }
.login-brand h1 { max-width: 500px; margin-bottom: 22px; font-size: clamp(36px, 4vw, 55px); line-height: 1.08; letter-spacing: -.045em; }
.login-brand > p:last-child { max-width: 470px; color: #dfddff; line-height: 1.7; }
.login-card { padding: 55px 42px; display: flex; flex-direction: column; justify-content: center; }
.login-card h2 { margin-bottom: 8px; font-size: 25px; }
.login-card form { display: grid; gap: 17px; margin-top: 26px; }
.login-card label { display: grid; gap: 7px; color: #4f5255; font-size: 12px; font-weight: 650; }
.login-card input { height: 43px; }
.form-error { margin: 18px 0 -6px; padding: 9px 11px; color: #8b1e0b; background: #fff0ed; border-radius: 8px; font-size: 12px; }
.login-note { margin: 22px 0 0; color: #8a8d91; font-size: 10px; line-height: 1.55; }

@media (max-width: 1280px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters { grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(145px, .5fr)) auto; }
  .filters select:nth-of-type(2) { display: none; }
}
@media (max-width: 960px) {
  :root { --sidebar: 72px; }
  .brand span, .nav-item:not(.active) { font-size: 0; }
  .brand { padding-inline: 5px; }
  .nav-item { justify-content: center; }
  .nav-icon { font-size: 20px; }
  .sidebar-foot span:last-child { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: 1fr 1fr auto; }
  .filters select:nth-of-type(3) { display: none; }
  .login-shell { grid-template-columns: 1fr 1fr; }
  .login-brand { padding: 45px; }
}
@media (max-width: 680px) {
  :root { --sidebar: 0px; }
  .sidebar { display: none; }
  .topbar { position: static; padding: 16px; }
  .topbar .breadcrumb { display: none; }
  .topbar h1 { font-size: 19px; }
  .top-actions .button-secondary { display: none; }
  main { padding: 16px 12px 45px; }
  .stats-grid { gap: 8px; }
  .stat-card { min-height: 108px; padding: 15px; }
  .stat-card strong { font-size: 25px; }
  .job-card { padding: 16px; }
  .job-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .panel-heading { padding-inline: 15px; }
  .filters { grid-template-columns: 1fr auto; padding: 10px 15px; }
  .filters select { display: none !important; }
  .product-grid { grid-template-columns: 1fr; padding: 15px; }
  .product-image { aspect-ratio: 1.2; }
  .detail-hero { grid-template-columns: 1fr; padding: 20px; }
  .detail-groups { grid-template-columns: 1fr; }
  .login-body { padding: 0; }
  .login-shell { min-height: 100vh; grid-template-columns: 1fr; border: 0; border-radius: 0; }
  .login-brand { min-height: 270px; padding: 32px; }
  .login-brand img { width: 44px; height: 44px; margin-bottom: 20px; }
  .login-brand h1 { margin-bottom: 12px; font-size: 34px; }
  .login-brand > p:last-child { margin-bottom: 0; }
  .login-card { padding: 38px 28px; }
}

