:root {
  --navy: #0d1526;
  --navy-2: #121d33;
  --bg: #f2f6f7;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #dfe7eb;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --green: #0f9f6e;
  --green-soft: #e8f7f1;
  --amber: #d97706;
  --amber-soft: #fff6e6;
  --red: #dc2626;
  --red-soft: #fff0f0;
  --shadow: 0 8px 30px rgba(14, 30, 48, .07);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #07101d;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.45;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(800px 460px at 10% 0%, rgba(25, 61, 111, .28), transparent 60%),
    radial-gradient(900px 520px at 95% 100%, rgba(20, 52, 92, .2), transparent 55%);
}

.login-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) 390px;
  align-content: center;
  gap: 60px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 70px 34px;
}

.login-brand {
  position: fixed;
  top: 22px;
  left: 26px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8da5c9;
  font-size: 11px;
  letter-spacing: 1.2px;
}

.login-brand b { color: #6d9cf5; font-size: 12px; letter-spacing: 1.8px; }

.brand-square {
  width: 10px;
  height: 10px;
  background: var(--blue);
  border-radius: 2px;
  box-shadow: 0 0 14px rgba(59, 130, 246, .55);
}

.login-hero { align-self: center; color: #f5f8ff; }

.login-hero h1 {
  margin: 0;
  font-size: clamp(38px, 5.6vw, 68px);
  line-height: 1.12;
  letter-spacing: -1px;
}

.login-hero h1 span {
  background: linear-gradient(90deg, #5b8def, #38bdf8 50%, #fbbf24);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-hero p {
  margin: 18px 0 0;
  color: #8fa3c7;
  letter-spacing: 2px;
  font-size: 13px;
}

.login-card {
  align-self: center;
  background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 14px;
  padding: 28px 26px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .42);
}

.login-card h2 { margin: 0; font-size: 21px; }
.login-note { margin: 5px 0 20px; color: var(--muted); font-size: 12px; }
.login-card label { display: block; margin: 0 0 6px; color: #4b5563; font-size: 12px; }

.login-card input {
  width: 100%;
  height: 42px;
  margin-bottom: 15px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  color: var(--ink);
  outline: none;
}

.login-card input:focus {
  border-color: #7aa5f8;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.login-error {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 12px;
}

.login-foot { margin: 14px 0 0; text-align: center; color: #8a96a8; font-size: 11px; }

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  width: calc(100vw - 30px);
  height: calc(100vh - 30px);
  max-width: 1760px;
  margin: 15px auto;
  overflow: hidden;
  border-radius: 13px;
  background: var(--bg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}

.sidebar {
  width: 174px;
  flex: 0 0 174px;
  display: flex;
  flex-direction: column;
  background: var(--navy);
  color: #a8b7ce;
  padding: 13px 11px 12px;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 2px 8px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.side-brand b {
  display: block;
  color: #f1f5ff;
  font-size: 13px;
  letter-spacing: 1.5px;
}

.side-brand small {
  display: block;
  margin-top: 1px;
  color: #62708a;
  font-size: 8px;
  letter-spacing: 1.1px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.nav-list::-webkit-scrollbar { width: 5px; }
.nav-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 3px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 39px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #9eacc2;
  text-align: left;
  font-size: 12px;
}

.nav-item:hover { background: rgba(255, 255, 255, .05); color: #dbe6f8; }

.nav-item.active {
  background: rgba(59, 130, 246, .15);
  color: #dbe8ff;
  box-shadow: inset 2px 0 0 #5b8def;
}

.nav-icon {
  width: 18px;
  flex: 0 0 18px;
  text-align: center;
  color: #7695c8;
  font-size: 13px;
}

.nav-item.active .nav-icon { color: #73a2ff; }

.nav-item .mini-badge {
  margin-left: auto;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: #dc2626;
  color: white;
  font-size: 9px;
  line-height: 17px;
  text-align: center;
}

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-caret { margin-left: auto; color: #53647e; font-size: 12px; }
.nav-children { display: none; padding: 1px 0 4px 27px; }
.nav-children.open { display: flex; flex-direction: column; gap: 1px; }

.nav-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 31px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #71819b;
  text-align: left;
  font-size: 10px;
}

.nav-child:hover { background: rgba(255, 255, 255, .04); color: #c8d5e8; }
.nav-child.active { background: rgba(59, 130, 246, .12); color: #a9c4ff; }
.nav-child .mini-badge { margin-left: auto; }

.side-foot {
  margin-top: auto;
  padding: 12px 8px 2px;
  border-top: 1px solid rgba(255, 255, 255, .06);
}

.agent-pulse {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #7993b9;
  font-size: 10px;
}

.agent-pulse span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2dd4bf;
  box-shadow: 0 0 0 3px rgba(45, 212, 191, .1);
}

.text-btn {
  margin-top: 9px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #7186a6;
  font-size: 10px;
}

.text-btn:hover { color: #d1dcf0; }

.main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 63px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(8px);
}

.topbar-left, .topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar h1 {
  margin: 1px 0 0;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -.2px;
}

.eyebrow {
  margin: 0;
  color: #8a96a7;
  font-size: 9px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.sync-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #7a8799;
  font-size: 10px;
  white-space: nowrap;
}

.sync-state i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.store-select {
  height: 31px;
  padding: 0 26px 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #3f4b5f;
  font-size: 11px;
}

.primary-btn, .ghost-btn, .danger-btn {
  height: 31px;
  padding: 0 13px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.primary-btn {
  border: 1px solid #1d4ed8;
  background: var(--blue);
  color: white;
  box-shadow: 0 3px 10px rgba(37, 99, 235, .2);
}

.primary-btn:hover { background: #1d4ed8; }
.primary-btn:disabled { opacity: .5; cursor: default; }

.ghost-btn {
  border: 1px solid var(--line);
  background: white;
  color: #4b5563;
}

.ghost-btn:hover { border-color: #c6d2da; background: #f8fafb; }

.danger-btn {
  border: 1px solid #f0cccc;
  background: #fff;
  color: #b91c1c;
}

.wide { width: 100%; height: 40px; }

.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 17px 22px 26px;
}

.content::-webkit-scrollbar, .run-drawer::-webkit-scrollbar { width: 8px; }
.content::-webkit-scrollbar-thumb, .run-drawer::-webkit-scrollbar-thumb {
  background: #cbd6dc;
  border-radius: 4px;
}

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

.section-head h2 { margin: 0; font-size: 15px; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}

.monitor-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
  padding: 9px 4px;
  border: 1px solid #e3eaee;
  border-radius: 9px;
  background: rgba(255, 255, 255, .7);
}

.monitor-stat {
  min-width: 0;
  padding: 0 13px;
  border-left: 1px solid #e8edf0;
}

.monitor-stat:first-child { border-left: 0; }
.monitor-stat span { display: block; color: #7d8999; font-size: 9px; }
.monitor-stat b { display: inline-block; margin-top: 2px; font-size: 17px; letter-spacing: -.3px; }
.monitor-stat em {
  display: inline-block;
  margin-left: 7px;
  color: #8a95a5;
  font-size: 8px;
  font-style: normal;
}
.monitor-stat em.warn { color: #b45309; }
.monitor-stat em.ok { color: #047857; }

.metric-card {
  min-height: 92px;
  padding: 14px 15px;
  background: var(--card);
  border: 1px solid #e6ecef;
  border-radius: 11px;
  box-shadow: 0 2px 10px rgba(20, 40, 60, .025);
}

.metric-label { color: #778294; font-size: 10px; }
.metric-value { margin-top: 7px; font-size: 23px; font-weight: 700; letter-spacing: -.6px; }
.metric-foot { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 10px; }
.metric-foot.positive { color: var(--green); }
.metric-foot.warning { color: var(--amber); }
.metric-foot.neutral { color: #6b7280; }
.metric-note { color: #9aa4b2; }

.competitor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  gap: 14px;
  align-items: stretch;
  height: calc(100vh - 238px);
  min-height: 460px;
}

.card {
  background: var(--card);
  border: 1px solid #e3eaee;
  border-radius: 11px;
  box-shadow: 0 3px 14px rgba(20, 40, 60, .035);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 47px;
  padding: 9px 14px;
  border-bottom: 1px solid #edf1f3;
}

.card-head h3 { margin: 0; font-size: 12px; font-weight: 650; }
.card-head p { margin: 2px 0 0; color: #8a95a5; font-size: 9px; }

.tab-row {
  display: flex;
  gap: 4px;
  padding: 9px 12px;
  border-bottom: 1px solid #edf1f3;
}

.tab {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6f7b8d;
  font-size: 10px;
}

.tab.active { background: var(--blue-soft); color: #1d4ed8; font-weight: 650; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid #edf1f3;
}

.filter-pill {
  height: 26px;
  padding: 0 9px;
  border: 1px solid #e0e7eb;
  border-radius: 6px;
  background: #fff;
  color: #687386;
  font-size: 9px;
}

.filter-pill.active { border-color: #b9cffb; background: #f1f6ff; color: #2563eb; }

.search-box {
  width: 160px;
  height: 26px;
  margin-left: auto;
  padding: 0 9px;
  border: 1px solid #e0e7eb;
  border-radius: 6px;
  outline: none;
  font-size: 9px;
}

.signal-list { padding: 8px; }

.competitor-layout > .card:first-child {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.competitor-layout > .card:first-child .signal-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.signal-item {
  position: relative;
  display: block;
  width: 100%;
  padding: 11px 11px 11px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.signal-item + .signal-item { margin-top: 3px; }
.signal-item:hover { background: #f8fafb; }
.signal-item.active { border-color: #cfdff8; background: #f3f7ff; }

.signal-item::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 5px;
  width: 3px;
  border-radius: 2px;
  background: #cbd5e1;
}

.signal-item.high::before { background: var(--red); }
.signal-item.medium::before { background: var(--amber); }
.signal-item.low::before { background: var(--green); }

.signal-top { display: flex; align-items: center; gap: 6px; }
.signal-mini-thumb {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 1px solid #e3eaee;
  border-radius: 5px;
  background: #f7f9fa;
  object-fit: cover;
  cursor: zoom-in;
}
.signal-asin { font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; font-weight: 650; }
.signal-item h4 { margin: 5px 0 4px; font-size: 11px; line-height: 1.35; font-weight: 600; }
.signal-item p { margin: 0; color: #7c8798; font-size: 9px; line-height: 1.45; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 8px;
  font-weight: 650;
  white-space: nowrap;
}

.badge.high { background: var(--red-soft); color: #b91c1c; }
.badge.medium { background: var(--amber-soft); color: #b45309; }
.badge.low { background: var(--green-soft); color: #047857; }
.badge.blue { background: var(--blue-soft); color: #1d4ed8; }
.badge.gray { background: #f1f4f6; color: #6b7280; }

.signal-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 7px;
  color: #9aa4b2;
  font-size: 8px;
}

.table-wrap {
  overflow-x: auto;
  padding: 4px 10px 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9px;
}

.data-table th {
  padding: 9px 8px;
  border-bottom: 1px solid #e8edf0;
  color: #8a95a5;
  font-size: 8px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #f0f3f5;
  color: #465369;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: #fbfcfd; }
.data-table td small { display: block; margin-top: 2px; color: #9aa5b2; font-size: 8px; }
.cell-title {
  display: block;
  max-width: 280px;
  overflow: hidden;
  color: #263244;
  font-size: 9px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.product-cell > div { min-width: 0; }

.product-thumb {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid #e4eaee;
  border-radius: 6px;
  background: #f7f9fa;
  object-fit: cover;
  cursor: zoom-in;
}

.product-thumb.placeholder {
  display: grid;
  place-items: center;
  color: #9aa5b2;
  font-size: 13px;
}

.agent-main-image {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 1px solid #e2e9ed;
  border-radius: 8px;
  background: #f7f9fa;
  object-fit: cover;
  cursor: zoom-in;
}

.table-link {
  color: #2563eb;
  font-size: 9px;
  text-decoration: none;
  white-space: nowrap;
}

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

.delta { color: #778496; font-size: 9px; font-weight: 600; }
.delta.positive { color: #0f9f6e; }
.delta.negative { color: #dc2626; }

.arrival-progress { min-width: 100px; }
.arrival-progress span { display: block; color: #687487; font-size: 8px; white-space: nowrap; }
.arrival-progress > div {
  height: 5px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 3px;
  background: #edf2f5;
}
.arrival-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b8def, #38bdf8);
}

.review-spark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
  min-width: 46px;
}
.review-spark i {
  display: block;
  width: 4px;
  min-height: 3px;
  border-radius: 2px 2px 0 0;
  background: #5b8def;
}

.task-table { padding: 2px 12px 10px; }
.task-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto 72px;
  align-items: center;
  gap: 9px;
  padding: 11px 4px;
  border-bottom: 1px solid #f0f3f5;
}
.task-row:last-child { border-bottom: 0; }
.task-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0f9f6e;
}
.task-dot.failed { background: #dc2626; }
.task-main { min-width: 0; }
.task-main b { display: block; font-size: 10px; font-weight: 600; }
.task-main span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #8793a3;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-row time { color: #9aa5b2; font-size: 8px; text-align: right; white-space: nowrap; }

.platform-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.band-list { padding: 12px 14px 15px; }
.band-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  color: #69768a;
  font-size: 9px;
}
.band-row b { color: #3d4a5e; font-size: 10px; text-align: right; }
.band-track {
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: #edf2f5;
}
.band-track i {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b8def, #38bdf8);
}

.platform-gaps {
  margin: 0;
  padding: 12px 14px 14px 30px;
  color: #6e7b8d;
  font-size: 9px;
  line-height: 1.7;
}

.discount-list { padding: 2px 14px 10px; }
.discount-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f3f5;
}
.discount-row:last-child { border-bottom: 0; }
.discount-row > div { min-width: 0; }
.discount-row b {
  display: block;
  overflow: hidden;
  color: #344054;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.discount-row small { color: #9aa5b2; font-size: 8px; }
.discount-row > span { color: #6b7889; font-size: 9px; white-space: nowrap; }
.discount-row s { margin-right: 5px; color: #9aa5b2; }
.discount-row strong { color: #0f9f6e; font-size: 11px; }
.badge.warning { color: #b45309; background: var(--amber-soft); }

.settings-form { padding: 8px 14px 15px; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid #f0f3f5;
}
.setting-row:last-of-type { border-bottom: 0; }
.setting-row b { display: block; color: #344054; font-size: 10px; }
.setting-row small { display: block; margin-top: 2px; color: #8a95a5; font-size: 8px; }
.setting-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: #2563eb; }
.setting-number, .setting-time {
  width: 92px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #dfe7eb;
  border-radius: 6px;
  background: #fbfcfd;
  color: #344054;
  font: inherit;
  font-size: 10px;
  outline: none;
}
.setting-number:focus, .setting-time:focus { border-color: #8db0f6; background: #fff; }
.setting-history {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 10px;
  color: #8a95a5;
  font-size: 8px;
}
.settings-note {
  margin: 12px 0;
  padding: 9px 10px;
  border-radius: 7px;
  background: #f5f8fa;
  color: #6e7b8d;
  font-size: 9px;
  line-height: 1.55;
}

.shop-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.shop-list { padding: 7px; }
.shop-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
}
.shop-list-item + .shop-list-item { margin-top: 3px; }
.shop-list-item:hover { background: #f8fafb; }
.shop-list-item.active { border-color: #cfdff8; background: #f3f7ff; }
.shop-list-icon {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #edf3ff;
  color: #2563eb;
  font-size: 11px;
}
.shop-list-main { min-width: 0; flex: 1; }
.shop-list-main b {
  display: block;
  overflow: hidden;
  color: #344054;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shop-list-main small { display: block; margin-top: 2px; color: #9aa5b2; font-size: 8px; }

.shop-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f3;
}
.shop-detail-stats div {
  padding: 8px 9px;
  border: 1px solid #e7edf0;
  border-radius: 7px;
  background: #fbfcfd;
}
.shop-detail-stats span { display: block; color: #8a95a5; font-size: 8px; }
.shop-detail-stats b { display: block; margin-top: 2px; color: #344054; font-size: 12px; }
.shop-products-head { border-top: 0; }

.agent-panel {
  position: static;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.agent-panel > .agent-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.agent-panel-head {
  padding: 13px 15px;
  border-bottom: 1px solid #e8edf0;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .075), rgba(45, 212, 191, .055)),
    #fff;
}

.agent-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.agent-title-row > div { flex: 1; min-width: 0; }

.agent-title-row h3 { margin: 0; font-size: 13px; line-height: 1.35; }
.agent-sub { margin: 5px 0 0; color: #7b8798; font-size: 9px; }

.agent-body { padding: 13px 15px 16px; }

.facts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 11px;
}

.skill-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid #dbe6fb;
  border-radius: 8px;
  background: linear-gradient(135deg, #f3f7ff, #f8fbff);
}

.skill-strip > div { min-width: 0; }
.skill-kicker {
  display: block;
  color: #6d8fc8;
  font-size: 7px;
  letter-spacing: 1.3px;
}
.skill-strip b {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #2f4b74;
  font-size: 9px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.assessment-grid div {
  padding: 7px 9px;
  border: 1px solid #e7edf0;
  border-radius: 7px;
  background: #fbfcfd;
}

.assessment-grid span { display: block; color: #8a95a5; font-size: 8px; }
.assessment-grid b { display: block; margin-top: 2px; color: #465369; font-size: 9px; }

.data-gaps {
  margin-top: 10px;
  padding: 10px 11px;
  border: 1px solid #f0dfc4;
  border-radius: 8px;
  background: #fffaf1;
}

.data-gaps .block-title { color: #9a610c; }
.data-gaps .block-title span:last-child {
  color: #b45309;
  font-size: 8px;
  font-weight: 600;
}

.fact {
  padding: 8px 9px;
  border: 1px solid #e7edf0;
  border-radius: 7px;
  background: #fbfcfd;
}

.fact span { display: block; color: #8a95a5; font-size: 8px; }
.fact b { display: block; margin-top: 3px; font-size: 11px; }
.fact b.danger { color: #c52525; }
.fact b.warning { color: #b45309; }
.fact b.positive { color: #047857; }
.fact b.neutral { color: #475569; }

.status-note {
  margin-top: 11px;
  padding: 9px 11px;
  border-radius: 7px;
  background: #f6f8fa;
  color: #667386;
  font-size: 9px;
}

.quote-box {
  margin-top: 10px;
  padding: 10px 11px;
  border: 1px solid #dce9e3;
  border-radius: 8px;
  background: #f6fbf8;
}

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

.quote-grid div { min-width: 0; }
.quote-grid span { display: block; color: #789189; font-size: 8px; }
.quote-grid b { display: block; margin-top: 2px; color: #166044; font-size: 10px; }
.quote-box p {
  margin: 8px 0 0;
  color: #416b5a;
  font-size: 9px;
  line-height: 1.5;
}

.history-block {
  margin-top: 10px;
  padding: 9px 10px 8px;
  border: 1px solid #e3eaee;
  border-radius: 8px;
  background: #fbfcfd;
}
.history-block .block-title { margin-bottom: 6px; }
.history-spark {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 42px;
  padding: 2px 2px 0;
}
.history-spark i {
  flex: 1;
  min-width: 4px;
  max-width: 18px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #7aa5f8, #3b82f6);
  opacity: .85;
}
.history-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: #9aa5b2;
  font-size: 8px;
}

.supplement-row {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 9px;
}

.supplement-row .ghost-btn,
.supplement-row .danger-btn { height: 28px; }

.run-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #e3eaee;
  border-radius: 7px;
  background: #fff;
  color: #687386;
  font-size: 9px;
}

.run-chip b { color: #2f3b4e; font-size: 9px; }

.evidence-block {
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid #e4eaee;
  border-radius: 8px;
  background: #fbfcfd;
}

.block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 650;
}

.evidence-list { margin: 0; padding: 0; list-style: none; }
.evidence-list li {
  position: relative;
  padding-left: 13px;
  color: #596579;
  font-size: 9px;
  line-height: 1.55;
}

.evidence-list li + li { margin-top: 4px; }
.evidence-list li::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #8ea4c7;
}

.recommendation {
  margin-top: 11px;
  padding: 10px 12px;
  border-left: 3px solid #3b82f6;
  border-radius: 0 8px 8px 0;
  background: #f3f7ff;
  color: #34445e;
  font-size: 9px;
  line-height: 1.55;
}

.recommendation strong { display: block; margin-bottom: 3px; color: #1d4ed8; font-size: 9px; }

.action-row {
  display: flex;
  gap: 7px;
  margin-top: 12px;
}

.action-row .primary-btn { flex: 1; }

.empty-state {
  padding: 34px 20px;
  color: #8b96a6;
  text-align: center;
  font-size: 10px;
}

.run-drawer {
  position: fixed;
  z-index: 40;
  top: 15px;
  right: 15px;
  bottom: 15px;
  width: min(390px, calc(100vw - 30px));
  display: flex;
  flex-direction: column;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 17px 14px;
  border-bottom: 1px solid #e9eef1;
}

.drawer-head h3 { margin: 3px 0 0; font-size: 14px; }
.icon-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #e0e7eb;
  border-radius: 7px;
  background: #fff;
  color: #607086;
  font-size: 17px;
  line-height: 1;
}

.run-status {
  padding: 12px 17px 0;
  color: #687386;
  font-size: 10px;
}

.run-steps {
  margin: 14px 0 0;
  padding: 0 17px 20px;
  list-style: none;
}

.run-steps li {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 9px;
  min-height: 52px;
}

.step-dot {
  position: relative;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border: 1px solid #d3dde3;
  border-radius: 50%;
  background: #fff;
  color: #9aa4b2;
  font-size: 8px;
  line-height: 16px;
  text-align: center;
}

.run-steps li:not(:last-child) .step-dot::after {
  content: "";
  position: absolute;
  top: 18px;
  left: 8px;
  width: 1px;
  height: 34px;
  background: #e2e8ec;
}

.run-steps li.running .step-dot { border-color: #93b4fb; color: #2563eb; background: #eff5ff; }
.run-steps li.completed .step-dot { border-color: var(--green); color: white; background: var(--green); }
.run-steps li.completed .step-dot::after { background: #bfe8d9; }

.step-label { color: #596579; font-size: 10px; line-height: 1.5; }
.run-steps li.running .step-label { color: #1d4ed8; font-weight: 650; }
.step-state { display: block; margin-top: 2px; color: #9aa4b2; font-size: 8px; }

.drawer-foot {
  margin-top: auto;
  padding: 13px 17px;
  border-top: 1px solid #e9eef1;
  background: #fbfcfd;
  color: #8a95a5;
  font-size: 9px;
}

.modal-backdrop {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 11, 22, .62);
  backdrop-filter: blur(5px);
}

.modal-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 26px 90px rgba(0, 0, 0, .45);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 16px 18px 13px;
  border-bottom: 1px solid #e8edf0;
}

.modal-head h3 { margin: 2px 0 0; font-size: 14px; }

.modal-note {
  margin: 13px 18px 0;
  padding: 9px 11px;
  border-radius: 7px;
  background: #f5f8fa;
  color: #677487;
  font-size: 9px;
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 14px 18px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #5e6b7d;
  font-size: 9px;
}

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

.form-grid input {
  height: 34px;
  padding: 0 9px;
  border: 1px solid #dfe7eb;
  border-radius: 7px;
  background: #fbfcfd;
  color: #263244;
  outline: none;
  font-size: 10px;
}

.form-grid input:focus {
  border-color: #8cb0f7;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
  background: #fff;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 18px 17px;
}

.modal-actions .primary-btn,
.modal-actions .ghost-btn { height: 34px; }

.image-lightbox {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 34px;
  background: rgba(3, 9, 18, .88);
  backdrop-filter: blur(5px);
}

.image-lightbox img {
  max-width: min(1100px, 92vw);
  max-height: 86vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .55);
  object-fit: contain;
}

.image-lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  max-width: 420px;
  padding: 10px 15px;
  border-radius: 8px;
  background: #111827;
  color: white;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  font-size: 11px;
}

.placeholder {
  display: grid;
  place-items: center;
  min-height: 360px;
  text-align: center;
}

.placeholder h2 { margin: 0; font-size: 16px; }
.placeholder p { max-width: 420px; margin: 7px 0 0; color: #788495; font-size: 11px; }

.mobile-only { display: none; }

@media (max-width: 980px) {
  .app-shell { width: 100vw; height: 100vh; margin: 0; border-radius: 0; }
  .sidebar {
    position: absolute;
    z-index: 30;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-102%);
    transition: transform .2s ease;
    box-shadow: 20px 0 50px rgba(0, 0, 0, .35);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: inline-flex; align-items: center; justify-content: center; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .competitor-layout { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .competitor-layout > .card:first-child .signal-list { max-height: 360px; flex: none; }
  .agent-panel { height: auto; }
  .agent-panel > .agent-body { overflow: visible; }
  .agent-panel { position: static; }
  .login-view { grid-template-columns: 1fr; max-width: 520px; gap: 30px; }
  .login-hero h1 { font-size: 38px; }
}

@media (max-width: 600px) {
  .topbar { align-items: flex-start; padding: 10px 12px; }
  .topbar h1 { font-size: 15px; }
  .topbar-actions { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .sync-state, .store-select { display: none; }
  .content { padding: 12px; }
  .metrics-grid { gap: 8px; }
  .monitor-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 0; }
  .monitor-stat:nth-child(3) { border-left: 0; }
  .metric-card { padding: 11px; min-height: 82px; }
  .metric-value { font-size: 19px; }
  .login-view { padding: 70px 18px 30px; }
  .login-brand { left: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .quote-grid { grid-template-columns: 1fr; }
  .platform-grid { grid-template-columns: 1fr; }
  .shop-layout { grid-template-columns: 1fr; }
  .shop-detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .discount-row { grid-template-columns: 1fr; gap: 5px; }
}
