:root {
  --bg: #fff8f2;
  --bg2: #fff2ea;
  --panel: rgba(255,255,255,0.88);
  --text: #4a2b25;
  --muted: #9b7368;
  --line: #f1d7cd;
  --accent: #ff9e7a;
  --accent-strong: #ff7f50;
  --berry: #d67a8a;
  --mint: #9fc9b1;
  --sky: #a8c6ef;
  --warning: #cc8b5a;
  --danger: #cf6a6a;
  --ok-bg: rgba(159, 201, 177, 0.18);
  --warn-bg: rgba(255, 159, 67, 0.16);
  --danger-bg: rgba(214, 122, 138, 0.16);
  --shadow: 0 14px 34px rgba(182, 129, 112, 0.14);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, #ffe9d9 0%, transparent 28%),
    radial-gradient(circle at top right, #ffd9d9 0%, transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
}
.app { max-width: 1240px; margin: 0 auto; padding: 12px; }
.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}
.topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.topbar h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -0.02em; line-height: 1.12; }
.topbar p { margin: 0; color: var(--muted); font-size: 13px; }
button {
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--berry));
  color: white;
  box-shadow: 0 10px 24px rgba(214, 122, 138, 0.25);
}
#refreshBtn { width: 100%; }
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  margin-bottom: 14px;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255,248,242,0.92);
  backdrop-filter: blur(12px);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: rgba(255,255,255,0.82);
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--line);
  padding: 10px 14px;
  font-size: 13px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: white; }
.view { display: none; }
.view.active { display: block; }
.cards { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 14px; }
.card, .panel, .mini-card {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.card {
  padding: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,247,244,0.9));
}
.card .label { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.card .value { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; word-break: keep-all; overflow-wrap: anywhere; }
.grid.two { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 14px 0; }
.panel { padding: 15px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.panel-head.wrap { flex-wrap: wrap; }
.panel-head.spaced { margin: 8px 0 14px; }
.panel h2, .mini-card h3, .list-block h3 { margin: 0; }
.panel h2 { font-size: 20px; letter-spacing: -0.02em; }
.panel h3 { margin: 0 0 10px; font-size: 16px; }
.panel-head span, .mini-card p, .muted { color: var(--muted); }
.subgrid.three, .subgrid.two { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 10px; }
.mini-card {
  padding: 14px;
  background: linear-gradient(180deg, #fffdfa 0%, #fff7f4 100%);
}
.mini-card h3 { font-size: 16px; margin-bottom: 8px; }
.mini-card hr { border: 0; border-top: 1px dashed var(--line); margin: 10px 0; }
.mini-card.emphasis { background: linear-gradient(135deg, rgba(255, 235, 214, 0.9), rgba(255, 255, 255, 0.95)); }
.mini-card.emphasis.soft { background: linear-gradient(135deg, rgba(233, 244, 255, 0.9), rgba(255,255,255,0.95)); }
.hero {
  display: grid;
  gap: 16px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(255,242,234,0.95));
}
.hero-copy h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.18;
  letter-spacing: -0.03em;
}
.hero-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}
.hero-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.kpi-strip { margin-bottom: 14px; }
.focus-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.focus-line:last-child { border-bottom: 0; padding-bottom: 0; }
.focus-line strong { flex: 0 0 auto; }
.focus-line span { text-align: right; color: var(--text); }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.metric-grid.wide { grid-template-columns: 1fr; }
.metric-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,0.75);
}
.metric-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.metric-value { font-size: 20px; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; word-break: keep-all; overflow-wrap: anywhere; }
.tone-peach { background: rgba(255, 237, 223, 0.88); }
.tone-mint { background: rgba(233, 247, 239, 0.9); }
.tone-rose { background: rgba(255, 236, 240, 0.92); }
.tone-sky { background: rgba(235, 243, 255, 0.92); }
.chart-card ul { margin-top: 0; }
.ads-hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.list-block { margin-top: 14px; }
ul { margin: 10px 0 0; padding-left: 16px; }
li { margin: 8px 0; line-height: 1.55; word-break: keep-all; overflow-wrap: anywhere; }
.status-pill {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 159, 67, 0.14);
  color: var(--warning);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}
.next-step {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(159, 201, 177, 0.18);
  border: 1px solid rgba(159, 201, 177, 0.35);
  line-height: 1.55;
}
.empty { color: var(--muted); }
.stack-list { display: grid; gap: 10px; }
.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-direction: column;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.7);
}
.status-row .meta { min-width: 0; }
.status-row .title { font-weight: 800; margin-bottom: 4px; }
.status-row .detail { color: var(--muted); font-size: 14px; }
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-width: 60px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.badge.ok { background: var(--ok-bg); color: #4d7f67; }
.badge.warn { background: var(--warn-bg); color: var(--warning); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.alert-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.alert-list li {
  margin: 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.72);
}
.alert-list li.ok { background: var(--ok-bg); }
.alert-list li.warn { background: var(--warn-bg); }
.alert-list li.danger { background: var(--danger-bg); }
.alert-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 4px; }
.alert-area { font-weight: 800; }
.run-file { color: var(--muted); font-size: 12px; }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.chip {
  background: rgba(255,255,255,0.78);
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--line);
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 999px;
}
.chip.active { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: white; }
.run-item {
  list-style: none;
  margin: 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.72);
  cursor: pointer;
}
.run-item.active { border-color: var(--accent-strong); box-shadow: 0 0 0 2px rgba(255,127,80,0.12) inset; }
.detail-box {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  line-height: 1.6;
  overflow: hidden;
}
.detail-box pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 10px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  background: rgba(255,247,244,0.85);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  max-width: 100%;
  overflow-x: auto;
}
.detail-grid { display: grid; gap: 8px; }
.detail-grid .row { display: grid; grid-template-columns: 1fr; gap: 4px; }
#recentRuns,
#threadsExternalComments,
#threadsCommentNotes,
#smartstoreHoldReasons,
#smartstorePosted,
#smartstoreHeld,
#storeDiagnosisProducts,
#storeDiagnosisFlavors,
#storeDiagnosisInsights,
#storeDiagnosisLiveMetrics,
#adsInsights,
#adsStatusList {
  padding-left: 0;
  list-style: none;
}
#recentRuns li,
#threadsExternalComments li,
#threadsCommentNotes li,
#smartstoreHoldReasons li,
#smartstorePosted li,
#smartstoreHeld li,
#storeDiagnosisProducts li,
#storeDiagnosisFlavors li,
#storeDiagnosisInsights li,
#storeDiagnosisLiveMetrics li,
#adsInsights li,
#adsStatusList li {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.62);
  margin: 0 0 10px;
}
@media (min-width: 520px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .app { padding: 20px; }
  .topbar {
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
  }
  .topbar h1 { font-size: 30px; }
  .topbar p { font-size: 14px; }
  #refreshBtn { width: auto; }
  .tabs {
    gap: 8px;
    padding: 10px;
    margin-bottom: 18px;
    border-radius: 18px;
  }
  .tab { padding: 10px 16px; font-size: 14px; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
  .card { padding: 18px; }
  .card .label { font-size: 13px; }
  .card .value { font-size: 28px; }
  .grid.two { grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0; }
  .panel { padding: 18px; }
  .panel-head { align-items: center; gap: 12px; }
  .panel h2 { font-size: 24px; }
  .subgrid.three { grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
  .subgrid.two { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 12px; }
  .mini-card { padding: 16px; }
  .hero { grid-template-columns: 1.35fr 1fr; align-items: center; }
  .hero-copy h2 { font-size: 30px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metric-grid.wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .status-row { flex-direction: row; align-items: center; }
  .detail-grid .row { grid-template-columns: 110px 1fr; gap: 10px; }
}
@media (min-width: 1024px) {
  .app { max-width: 1240px; }
}
