/* Leakwise inside Shopify admin: Shopify's system font and neutral surfaces, with Leakwise's red for leaks. */
:root {
  --bg: #f1f1f1; --card: #fff; --subdued: #f7f7f7; --ink: #303030; --ink-2: #4a4a4a; --muted: #616161; --line: #e3e3e3; --line-soft: #ebebeb;
  --red: #b23a1f; --red-bg: #fde8e1; --amber: #8a5a0a; --amber-bg: #fff1d6; --amber-fill: #d49a2a; --green: #29845a; --green-bg: #e3f5ea; --dark: #1a1a1a;
  --radius: 12px; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root { color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid #005bd3; outline-offset: 1px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h2 { font-size: 14px; font-weight: 650; margin: 0 0 12px; }

.loading { display: flex; gap: 14px; align-items: center; background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: 0 1px 0 rgba(0,0,0,.07); }
.loading p { margin: 0; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--red); animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; border: 1px solid transparent; padding: 6px 12px; font-weight: 600; cursor: pointer; background: none; }
.btn.primary { background: var(--dark); color: #fff; }
.btn.on-dark { background: #fff; color: var(--dark); }
.btn.on-dark-ghost { border-color: rgba(255,255,255,.4); color: #fff; }
.btn.link { color: #005bd3; padding: 2px 0; }
.btn.link:hover { text-decoration: underline; }
.icon-btn { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); border-radius: 6px; padding: 0 8px; }

.summary, .insights { display: grid; grid-template-columns: minmax(280px, 0.95fr) 1.35fr; gap: 16px; margin-bottom: 16px; align-items: start; }
.headline { background: var(--dark); color: #fff; border-radius: var(--radius); padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; min-height: 100%; }
.headline .label { color: #cfcfcf; font-weight: 600; }
.headline .total { font-size: 46px; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; color: #ff9d80; }
.headline .note { display: grid; gap: 2px; }
.headline .note .sub { color: #b5b5b5; font-size: 13px; }
.headline-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 10px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 1px 0 rgba(0,0,0,.07); border-top: 3px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; gap: 4px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .n { font-size: 22px; font-weight: 700; }
.stat.red { border-top-color: var(--red); } .stat.red .n { color: var(--red); }
.stat.amber { border-top-color: var(--amber-fill); }
.stat.green { border-top-color: var(--green); } .stat.green .n { color: var(--green); }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 0 rgba(0,0,0,.07), 0 0 0 1px rgba(0,0,0,.03); min-width: 0; }
.chart-col { display: grid; gap: 16px; }
.receipt { font-family: var(--mono); font-size: 13px; background: var(--subdued); border-radius: 8px; padding: 14px 16px; }
.receipt .row { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.receipt .neg { color: var(--red); }
.receipt .missing { color: var(--muted); }
.receipt hr { border: 0; border-top: 1px dashed #c9c9c9; margin: 8px 0; }
.receipt .tot { font-weight: 700; }
.receipt .grand { font-weight: 700; font-size: 15px; color: var(--green); }
.receipt .grand.neg { color: var(--red); }
.receipt .s { text-align: right; color: var(--muted); font-size: 12px; }
.receipt .note { font-family: inherit; margin: 10px 0 0; }

.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 0.9fr) 2fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: block; height: 10px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; background: var(--red); }
.bar-fill.amber { background: var(--amber-fill); }
.bar-fill.ink { background: var(--ink-2); }
.bar-val { font-weight: 650; min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.weeks { display: grid; gap: 6px; height: 150px; align-items: end; }
.wk { display: grid; grid-template-rows: 1fr auto; height: 100%; min-width: 0; }
.wk .stack { display: flex; flex-direction: column-reverse; height: 100%; }
.wk .seg { display: block; width: 100%; }
.wk .seg.kept { background: var(--ink-2); border-radius: 0 0 3px 3px; }
.wk .seg.refund { background: var(--red); }
.wk .seg.disc { background: var(--amber-fill); border-radius: 3px 3px 0 0; }
.wk.part .stack { opacity: .45; }
.wk-label { font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; padding-top: 4px; }
.legend { display: flex; gap: 14px; font-size: 12px; margin-top: 8px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.kept { background: var(--ink-2); } .legend i.refund { background: var(--red); } .legend i.disc { background: var(--amber-fill); }

.panel { padding-top: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 -16px 14px; padding: 0 10px; flex-wrap: wrap; }
.tabs [role=tab] { border: 0; background: none; padding: 12px 10px 10px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs [role=tab][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--dark); }
.pill { background: var(--red-bg); color: var(--red); font-size: 12px; padding: 0 7px; border-radius: 99px; }
.pill:empty { display: none; }

.leaks { display: grid; gap: 10px; }
.leak { border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 10px; padding: 14px 16px; display: grid; grid-template-columns: 30px 1fr auto; gap: 4px 14px; }
.leak.tone-amber { border-left-color: var(--amber-fill); }
.leak.tone-ink { border-left-color: var(--ink-2); }
.leak.info { border-left-color: var(--line); }
.leak.handled { background: var(--subdued); }
.leak.handled h3 { text-decoration: line-through; text-decoration-color: rgba(0,0,0,.3); }
.leak .n { font-size: 22px; font-weight: 700; color: var(--red); grid-row: span 3; }
.leak.review .n, .leak.info .n { color: var(--muted); }
.leak h3 { margin: 0; font-size: 15px; font-weight: 650; }
.leak .amt { text-align: right; font-size: 18px; font-weight: 700; white-space: nowrap; }
.leak .amt small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.leak p, .leak .fix, .leak details { grid-column: 2 / 4; margin: 2px 0 0; }
.leak .fix b { color: var(--green); }
.leak summary { cursor: pointer; color: #005bd3; font-weight: 600; margin-top: 6px; }
.tag { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; vertical-align: 1px; }
.tag.leak-t { background: var(--red-bg); color: var(--red); } .tag.review-t { background: var(--amber-bg); color: var(--amber); } .tag.info-t { background: var(--subdued); color: var(--muted); }
.status-pick { display: block; margin-top: 6px; }
.status-pick select { font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.status-pick.s-doing select { background: var(--amber-bg); color: var(--amber); }
.status-pick.s-done select { background: var(--green-bg); color: var(--green); }
.status-pick.s-na select { background: var(--subdued); color: var(--muted); }
.empty, .note-box { border: 1px dashed var(--line); border-radius: 10px; padding: 18px; color: var(--muted); display: grid; gap: 4px; }
.empty b { color: var(--ink); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px 12px; background: var(--subdued); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.loss td { background: #fff6f3; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .neg { color: var(--red); font-weight: 650; }
table.data input { width: 84px; padding: 4px 8px; border: 1px solid #8a8a8a; border-radius: 8px; text-align: right; }
.sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.sort::after { content: " ↕"; opacity: .4; }
.sort.asc::after { content: " ↑"; opacity: 1; }
.sort.desc::after { content: " ↓"; opacity: 1; }
.flag { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; }
.flag.red { background: var(--red-bg); color: var(--red); } .flag.amber { background: var(--amber-bg); color: var(--amber); }
.foot { margin: 16px 0 8px; }

dialog { border: 0; border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px -20px rgba(0,0,0,.4); }
dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 4px; }
.dialog-head h2 { margin: 0; font-size: 16px; }
.dialog-body { padding: 8px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-body label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.dialog-body .wide { grid-column: 1 / -1; }
.dialog-body input, .dialog-body select { padding: 6px 10px; border: 1px solid #8a8a8a; border-radius: 8px; background: #fff; color: var(--ink); }
.dialog-actions { display: flex; justify-content: flex-end; padding: 12px 16px 16px; }

@media (max-width: 900px) { .summary, .insights { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .leak { grid-template-columns: 24px 1fr; }
  .leak .amt { grid-column: 2; text-align: left; }
  .leak p, .leak .fix, .leak details { grid-column: 1 / 3; }
  .dialog-body { grid-template-columns: 1fr; }
}

/* plan */
#plan-banner { margin-bottom: 16px; }
.upsell { display: flex; gap: 16px; align-items: center; justify-content: space-between; background: #fff; border: 1px solid #f0c6b8; border-left: 4px solid var(--red); border-radius: var(--radius); padding: 14px 16px; flex-wrap: wrap; }
.upsell > div { flex: 1 1 320px; }
.locked { color: var(--muted); }
.locked b { color: var(--ink); }
