/* ===================================================================
   Snapshot interactive demo — fake Shopify admin frame + Polaris-ish UI
   Hand-rolled lookalike, no Shopify assets.
   =================================================================== */
:root {
  --topbar-bg: #1a1a1a;
  --frame-bg: #f1f1f1;
  --sidebar-bg: #ebebeb;
  --surface: #ffffff;
  --text: #202223;
  --text-subdued: #6d7175;
  --border: #e1e3e5;
  --border-subdued: #ebebeb;
  --success: #008060;
  --success-bg: #cdeadd;
  --success-text: #0d5c3f;
  --info-bg: #d9e9f7;
  --info-text: #17457a;
  --warn-bg: #ffea8a;
  --warn-text: #5c4803;
  --critical: #d72c0d;
  --panel-bg: #eaf4ff;
  --panel-border: #d4e5f3;
  --interactive: #2c6ecb;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--frame-bg);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- Back bar ---------- */
.tb {
  position: fixed; inset: 0 0 auto 0; height: 48px; z-index: 60;
  background: var(--topbar-bg);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  color: #fff; font-size: 13px;
}
.tb-back {
  display: inline-flex; align-items: center; gap: 8px;
  color: #fff; font-weight: 600;
}
.tb-back:hover { color: #d0d0d0; }
.tb-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.tb-note { color: #b5b5b5; font-size: 12px; }
.tb-cta {
  color: #fff; font-weight: 600; font-size: 12px;
  border: 1px solid #4a4a4a; border-radius: 999px; padding: 5px 14px;
}
.tb-cta:hover { background: #303030; }

/* ---------- Content area ---------- */
.main {
  margin: 48px 0 0;
  min-height: calc(100vh - 48px);
  padding: 16px 20px 60px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.app-frame { background: transparent; }

/* Local nav pill bar (replica of AppLocalNav) */
.app-nav {
  display: flex; gap: 8px; padding: 12px 24px; margin: 12px 0 0;
  border: 1px solid var(--border-subdued); border-radius: 8px;
  background: var(--surface); overflow-x: auto;
}
.app-nav-link {
  padding: 6px 10px; border-radius: 6px;
  font-size: 13px; line-height: 20px; font-weight: 500;
  color: var(--text); white-space: nowrap;
}
.app-nav-link:hover { background: #f6f6f7; }
.app-nav-link.active { color: #1a1a1a; background: #f1f1f1; font-weight: 650; }

/* page body */
.page {
  max-width: 800px; margin: 0 auto; padding: 20px 0 48px;
  display: flex; flex-direction: column; gap: 16px;
}
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 700; }
.page-sub { width: 100%; color: var(--text-subdued); font-size: 13px; margin-top: -8px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.back-link { color: var(--text-subdued); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.back-link:hover { color: var(--text); }
.bell-wrap { position: relative; display: inline-flex; cursor: pointer; padding: 8px; color: #4a4a4a; }
.bell-badge {
  position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px;
  border-radius: 9px; background: #e51c00; color: #fff; font-size: 11px;
  font-weight: 700; padding: 0 5px; line-height: 18px; text-align: center;
}
.popover {
  position: absolute; top: calc(100% + 6px); right: 0; width: 360px; max-height: 480px;
  background: #fff; border-radius: 12px; border: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(0,0,0,.18); z-index: 40; overflow: hidden;
  display: flex; flex-direction: column;
}
.popover .pop-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border-subdued);
  font-weight: 650; font-size: 13px;
}
.notif-row {
  display: flex; gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid var(--border-subdued); font-size: 12px;
}
.notif-row.unread { background: #f6f6f7; }
.notif-row .emoji { font-size: 20px; }

/* ---------- Components ---------- */
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(0,0,0,.05), 0 0 0 1px rgba(0,0,0,.05);
  padding: 20px;
}
.card h2 { font-size: 20px; font-weight: 650; }
.card h3 { font-size: 14px; font-weight: 650; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.start { align-items: flex-start; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.subdued { color: var(--text-subdued); font-size: 12px; }
.spacer { flex: 1; }

.btn {
  font-size: 13px; font-weight: 550; padding: 6px 12px;
  border-radius: 8px; border: 1px solid #c9cccf; background: #fff; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: #f6f6f7; }
.btn.primary { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.btn.primary:hover { background: #303030; }
.btn.plain { border: 0; background: none; color: var(--interactive); padding: 4px 6px; }
.btn.plain:hover { text-decoration: underline; background: none; }
.btn.slim { padding: 4px 10px; font-size: 12px; }

.badge {
  display: inline-block; font-size: 12px; font-weight: 550;
  padding: 2px 10px; border-radius: 10px; background: #e4e5e7; color: #303030;
  white-space: nowrap;
}
.badge.info { background: var(--info-bg); color: var(--info-text); }
.badge.success { background: var(--success-bg); color: var(--success-text); }
.badge.warning { background: var(--warn-bg); color: var(--warn-text); }
.badge.attention { background: #ffd6a4; color: #5e4200; }

.pill {
  border: 1px solid #c9cccf; background: #fff; border-radius: 10px;
  font-size: 12px; font-weight: 550; padding: 5px 12px;
}

.select {
  font-size: 13px; padding: 6px 28px 6px 12px; border-radius: 8px;
  border: 1px solid #c9cccf; background: #fff; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236d7175' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}

/* tooltip */
.tip { position: relative; display: inline-flex; align-items: center; outline: none; cursor: default; }
.tip .tip-body {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: 260px; background: #202223; color: #fff;
  font-size: 12px; line-height: 1.45; font-weight: 400;
  padding: 10px 12px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .12s ease; z-index: 30;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.tip .tip-body::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #202223;
}
.tip:hover .tip-body, .tip:focus .tip-body { opacity: 1; }
.tip.tip-right .tip-body { left: auto; right: -10px; transform: none; }
.tip.tip-right .tip-body::after { left: auto; right: 14px; transform: none; }

.info-icon { color: #6d7175; display: inline-flex; }

/* progress bar */
.progress { height: 8px; border-radius: 999px; background: #e4e5e7; overflow: hidden; }
.progress > div { height: 100%; border-radius: 999px; background: #1a1a1a; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 600; color: var(--text-subdued); font-size: 12px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td { padding: 12px; border-bottom: 1px solid var(--border-subdued); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th.num { text-align: right; }
.tbl tbody tr:hover { background: #fafbfb; }
.tbl a { color: var(--interactive); font-weight: 550; }
.tbl a:hover { text-decoration: underline; }

/* tabs (inside cards) */
.tabs { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.tab-row { display: flex; border-bottom: 1px solid var(--border); }
.tab { flex: 1; text-align: center; font-size: 13px; font-weight: 550; padding: 10px 0; color: var(--text-subdued); cursor: pointer; background: none; border: 0; }
.tab.active { color: var(--text); background: #f6f6f7; }
.tab-panel { padding: 18px 16px; font-size: 12px; color: var(--text-subdued); }

/* stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat {
  border: 1px solid var(--border-subdued); border-radius: 8px; padding: 14px 16px;
}
.stat .label { font-size: 12px; color: var(--text-subdued); font-weight: 600; }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 11px; font-weight: 650; border-radius: 8px; padding: 1px 7px; display: inline-block; margin-top: 6px; }
.stat .delta.up { background: var(--success-bg); color: var(--success-text); }
.stat .delta.down { background: #fbd3cb; color: #8a1f0f; }
.stat.accent { border-left: 4px solid var(--accent, #2c6ecb); }

/* blue chart panel (conversion progress) */
.panel {
  background: var(--panel-bg); border: 1px solid var(--panel-border);
  border-radius: 18px; padding: 20px 20px 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.rate { font-size: 28px; font-weight: 700; }
.delta-line { font-size: 14px; font-weight: 600; color: var(--success); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: #596b78; align-items: center; }
.legend .line { display: inline-block; width: 16px; height: 2.5px; vertical-align: 3px; margin-right: 7px; }
.legend .dash { display: inline-block; width: 16px; border-top: 2.5px dashed #7fbcd9; vertical-align: 3px; margin-right: 7px; }
.legend .swatch-ab { width: 14px; height: 9px; border-radius: 2px; background: rgba(124,58,237,.22); border: 1px solid rgba(124,58,237,.45); display: inline-block; margin-right: 7px; vertical-align: -1px; }
.legend .swatch-diamond { width: 8px; height: 8px; background: #6d7175; transform: rotate(45deg); display: inline-block; margin-right: 9px; }
.legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 7px; }

/* quality bar */
.quality-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; }
.quality-bar > span { height: 100%; }

/* banner */
.banner {
  border-radius: 10px; padding: 12px 16px; font-size: 13px;
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--border);
}
.banner.info { background: #eaf4ff; border-color: #b6d8f5; }
.banner .title { font-weight: 650; }

/* responsive */
@media (max-width: 700px) {
  .tb-note { display: none; }
}

/* demo ribbon (unused after back-bar redesign; kept harmless) */
.demo-ribbon { display: none; }
