/* store-ops dashboard — dark, on-brand (#5b8cff), fast, mobile-ok.
   No build step: plain CSS, custom properties, system font stack. */

:root {
  --brand: #5b8cff;
  --brand-dim: #3a5bb0;
  --bg: #0b0e14;
  --bg-soft: #11151f;
  --card: #151a26;
  --card-2: #1a2030;
  --line: #232a3b;
  --line-soft: #1d2331;
  --txt: #e6e9f0;
  --txt-dim: #9aa3b8;
  --txt-faint: #69728a;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(1100px 500px at 80% -10%, rgba(91, 140, 255, 0.10), transparent 60%),
    var(--bg);
  color: var(--txt);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 940px; margin: 0 auto; padding: 0 18px 80px; }

/* ── top bar ─────────────────────────────────────────────── */
header.topbar {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(10px);
  background: rgba(11, 14, 20, 0.78);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-in {
  max-width: 940px; margin: 0 auto; padding: 12px 18px;
  display: flex; align-items: center; gap: 12px;
}
.logo {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; letter-spacing: -0.01em; cursor: pointer;
}
.logo .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.18);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.18); }
  50% { box-shadow: 0 0 0 7px rgba(91, 140, 255, 0.06); }
}
.logo small { color: var(--txt-faint); font-weight: 500; margin-left: 2px; }
.spacer { flex: 1; }
.who {
  font-size: 13px; color: var(--txt-dim);
  display: flex; align-items: center; gap: 7px;
}
.who input {
  background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--txt); border-radius: 8px; padding: 5px 9px; font-size: 13px;
  width: 190px;
}
.env-pill {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--txt-faint);
}
.env-pill.live { color: var(--ok); border-color: rgba(52, 211, 153, 0.4); }
.env-pill.demo { color: var(--brand); border-color: rgba(91, 140, 255, 0.4); }

/* ── hero / agent banner ─────────────────────────────────── */
.agentline {
  margin: 22px 0 26px;
  display: flex; align-items: center; gap: 12px;
  color: var(--txt-dim); font-size: 13.5px;
}
.agentline .live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: blip 1.8s ease-out infinite;
}
@keyframes blip {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  100% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
}

h1 { font-size: 26px; letter-spacing: -0.02em; margin: 14px 0 4px; }
h2 { font-size: 18px; letter-spacing: -0.01em; margin: 30px 0 12px; }
h3 { font-size: 14px; margin: 0 0 10px; color: var(--txt-dim); text-transform: uppercase; letter-spacing: 0.06em; }
p.lead { color: var(--txt-dim); margin: 0 0 18px; max-width: 62ch; }

/* ── cards ───────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 18px;
}
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.appcard { cursor: pointer; transition: border-color .15s, transform .15s; }
.appcard:hover { border-color: var(--brand-dim); transform: translateY(-2px); }
.appcard .row1 { display: flex; align-items: baseline; gap: 8px; }
.appcard .name { font-weight: 650; font-size: 16px; }
.appcard .bundle { color: var(--txt-faint); font-size: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.appcard .meta { display: flex; gap: 18px; margin-top: 14px; }
.appcard .meta .k { font-size: 11px; color: var(--txt-faint); text-transform: uppercase; letter-spacing: .05em; }
.appcard .meta .v { font-size: 19px; font-weight: 650; margin-top: 2px; }

/* ── status badges ───────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--txt-dim); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.detected         { color: var(--txt-dim); }
.badge.researching      { color: var(--brand); border-color: rgba(91,140,255,.4); }
.badge.awaiting_approval{ color: var(--warn); border-color: rgba(251,191,36,.4); }
.badge.approved         { color: var(--ok); border-color: rgba(52,211,153,.4); }
.badge.rejected         { color: var(--bad); border-color: rgba(248,113,113,.4); }
.badge.shipped          { color: var(--brand); border-color: rgba(91,140,255,.5); }

.grade {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; font-weight: 800; font-size: 15px;
}
.grade.A, .grade.B { background: rgba(52,211,153,.14); color: var(--ok); }
.grade.C           { background: rgba(251,191,36,.14); color: var(--warn); }
.grade.D, .grade.F { background: rgba(248,113,113,.14); color: var(--bad); }

/* ── forms / buttons ─────────────────────────────────────── */
label.fld { display: block; margin: 0 0 14px; }
label.fld .lab { font-size: 12px; color: var(--txt-dim); margin-bottom: 6px; display: block; }
input.txt, textarea.txt {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--txt); border-radius: 10px; padding: 11px 12px; font-size: 14px;
  font-family: inherit;
}
input.txt:focus, textarea.txt:focus { outline: none; border-color: var(--brand); }
input.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

.btn {
  appearance: none; border: 1px solid var(--line); cursor: pointer;
  background: var(--card-2); color: var(--txt);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  transition: filter .12s, border-color .12s, opacity .12s;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #07101f; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #052015; }
.btn.bad { background: transparent; border-color: rgba(248,113,113,.5); color: var(--bad); }
.btn.ghost { background: transparent; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── reasoning / agent log ───────────────────────────────── */
.reasoning {
  font-size: 14px; line-height: 1.7;
}
.reasoning .step {
  display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.reasoning .step:last-child { border-bottom: 0; }
.reasoning .ico {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  background: rgba(91,140,255,.14); color: var(--brand);
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
}
.reasoning .step.warn .ico { background: rgba(251,191,36,.14); color: var(--warn); }
.reasoning .step.ok .ico { background: rgba(52,211,153,.14); color: var(--ok); }
.reasoning b { color: var(--txt); }
.reasoning .step span { color: var(--txt-dim); }

/* ── keyword table ───────────────────────────────────────── */
table.kw { width: 100%; border-collapse: collapse; font-size: 13px; }
table.kw th { text-align: left; color: var(--txt-faint); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.kw td { padding: 8px; border-bottom: 1px solid var(--line-soft); }
table.kw tr:last-child td { border-bottom: 0; }
table.kw .score { font-weight: 700; }
.bucket {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px;
}
.bucket.Primary       { background: rgba(91,140,255,.16); color: var(--brand); }
.bucket.Secondary     { background: rgba(52,211,153,.14); color: var(--ok); }
.bucket\.Long-tail, .bucket.Longtail { background: rgba(167,139,250,.16); color: #a78bfa; }
.bucket.Aspirational  { background: rgba(105,114,138,.18); color: var(--txt-faint); }

/* ── proposed copy fields ────────────────────────────────── */
.copyfield { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.copyfield:last-child { border-bottom: 0; }
.copyfield .hdr { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.copyfield .fname { font-size: 12px; color: var(--txt-faint); text-transform: uppercase; letter-spacing: .05em; }
.copyfield .val {
  font-size: 14px; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; word-break: break-word;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; line-height: 1.5;
}
.charcount { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--txt-dim); }
.charbar { height: 4px; border-radius: 4px; background: var(--line); margin-top: 7px; overflow: hidden; }
.charbar > i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.charbar.warn > i { background: var(--warn); }
.charbar.full > i { background: var(--ok); }

/* ── commands box ────────────────────────────────────────── */
.cmds { display: grid; gap: 10px; }
.cmd {
  background: #0a0d13; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.cmd .cmd-h { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border-bottom: 1px solid var(--line-soft); }
.cmd .store-tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 5px; }
.cmd .store-tag.appstore { background: rgba(91,140,255,.16); color: var(--brand); }
.cmd .store-tag.googleplay { background: rgba(52,211,153,.14); color: var(--ok); }
.cmd .desc { font-size: 12.5px; color: var(--txt-dim); }
.cmd pre {
  margin: 0; padding: 11px 13px; font-size: 12.5px; line-height: 1.55;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; color: #cdd6f4;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all;
}
.copy-btn { margin-left: auto; font-size: 12px; padding: 4px 10px; }

.locked {
  text-align: center; padding: 26px 18px; color: var(--txt-dim);
  border: 1px dashed var(--line); border-radius: 12px; font-size: 14px;
}
.locked .lock { font-size: 22px; display: block; margin-bottom: 8px; }

/* ── competitor read ─────────────────────────────────────── */
.comp { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.comp:last-child { border-bottom: 0; }
.comp .tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 5px; }
.comp .tag.new { background: rgba(91,140,255,.16); color: var(--brand); }
.comp .tag.changed { background: rgba(251,191,36,.14); color: var(--warn); }
.comp .tag.same { background: rgba(105,114,138,.16); color: var(--txt-faint); }
.comp .cname { font-weight: 600; }
.comp .cdetail { color: var(--txt-faint); font-size: 12.5px; margin-left: auto; }

/* ── rank chart / list ───────────────────────────────────── */
.ranklist { display: grid; gap: 7px; }
.rankrow { display: flex; align-items: center; gap: 12px; font-size: 13.5px; }
.rankrow .kw { flex: 1; color: var(--txt-dim); }
.rankrow .pos { font-weight: 700; font-variant-numeric: tabular-nums; }
.rankrow .pos.good { color: var(--ok); }
.rankrow .pos.mid { color: var(--warn); }
.rankrow .pos.none { color: var(--txt-faint); font-weight: 500; }

svg.spark { display: block; width: 100%; height: auto; }
svg.spark .axis { stroke: var(--line); stroke-width: 1; }
svg.spark .line { fill: none; stroke: var(--brand); stroke-width: 2; }
svg.spark .area { fill: url(#sparkfill); opacity: .5; }
svg.spark .dot { fill: var(--brand); }
svg.spark .lbl { fill: var(--txt-faint); font-size: 10px; }

/* ── misc ────────────────────────────────────────────────── */
.muted { color: var(--txt-dim); }
.faint { color: var(--txt-faint); }
.empty { text-align: center; padding: 50px 20px; color: var(--txt-dim); }
.empty .big { font-size: 40px; margin-bottom: 10px; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card-2); border: 1px solid var(--line); color: var(--txt);
  padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; font-size: 14px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--txt-dim); font-size: 13px; margin: 18px 0 4px; cursor: pointer; }
.backlink:hover { color: var(--txt); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 680px) { .split { grid-template-columns: 1fr; } .who input { width: 130px; } }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: rot .7s linear infinite; vertical-align: -2px; }
@keyframes rot { to { transform: rotate(360deg); } }
