:root {
  --bg: #ffffff; --fg: #15202b; --muted: #5b6876; --line: #e2e6ea; --soft: #f4f6f8; --softer: #fafbfc;
  --accent: #0b7a75; --accent-fg: #ffffff; --accent-soft: #e2f4f2; --focus: #d9eeec;
  --good: #1f845a; --warn: #a35a00; --bad: #c9372c; --info: #5b6876;
  --get: #1f6feb; --post: #1f845a; --put: #a35a00; --patch: #8250df; --delete: #c9372c;
  --code-bg: #f6f8fa;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15191d; --fg: #dde3e8; --muted: #93a1ad; --line: #2c343b; --soft: #1c2227; --softer: #191e22;
    --accent: #3cc4bb; --accent-fg: #0b1513; --accent-soft: #163331; --focus: #1b3836;
    --good: #4bce97; --warn: #f5b84a; --bad: #f87168; --info: #93a1ad;
    --get: #6aa6ff; --post: #4bce97; --put: #f5b84a; --patch: #b392f0; --delete: #f87168;
    --code-bg: #0f1316;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body.dragging::after { content: "Drop the HAR file"; position: fixed; inset: 12px; border: 3px dashed var(--accent); border-radius: 14px; background: color-mix(in srgb, var(--bg) 85%, transparent); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 650; color: var(--accent); pointer-events: none; }
#app { display: flex; flex-direction: column; height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.mono, code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.pad { padding: 6px 12px; }
[hidden] { display: none !important; }

button.primary { background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 7px; padding: 7px 14px; font-weight: 600; }
button.primary.big { padding: 10px 18px; font-size: 14px; }
button.secondary { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 6px 12px; }
button.secondary:hover { border-color: var(--accent); }
button.small { padding: 3px 9px; font-size: 12px; }
button.link { background: none; border: 0; color: var(--accent); padding: 4px 6px; text-decoration: underline; }
button.icon { background: none; border: 0; color: var(--muted); font-size: 16px; padding: 0 6px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }

.top { display: flex; align-items: center; gap: 14px; padding: 9px 16px; border-bottom: 1px solid var(--line); flex: none; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; }
.file { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { border-radius: 12px; padding: 3px 10px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); background: var(--soft); }
.badge.paid { color: var(--good); border-color: var(--good); background: transparent; }
.badge.free { color: var(--muted); }
.pro-tag { font-size: 9px; font-weight: 700; letter-spacing: .06em; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0 4px; }

/* Landing */
.landing { flex: 1; overflow: auto; padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 28px; }
.drop { max-width: 760px; width: 100%; text-align: center; border: 2px dashed var(--line); border-radius: 16px; padding: 44px 32px; background: var(--softer); }
.drop h1 { font-size: 28px; margin: 0 0 10px; }
.lead { font-size: 15px; color: var(--muted); max-width: 600px; margin: 0 auto 22px; }
.actions { display: flex; gap: 10px; justify-content: center; align-items: center; margin-bottom: 10px; }
.how { max-width: 760px; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; padding-left: 20px; margin: 0; }
.how li { color: var(--muted); }
.how b { color: var(--fg); }
.privacy { color: var(--muted); }
.error { color: var(--bad); font-weight: 550; }

/* Workbench */
.bench { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(420px, 46%) 1fr; }
.list-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line); }
.filters { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 1px 9px; font-size: 12px; color: var(--muted); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--fg); font-weight: 600; }
.filters .row { display: flex; gap: 6px; }
.filters input[type=search] { flex: 1; min-width: 0; }
.filters select { max-width: 150px; }
.list-head { display: flex; justify-content: space-between; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--soft); font-size: 12px; }
.rows { flex: 1; overflow-y: auto; }
.row-item { display: grid; grid-template-columns: 18px 52px 34px 1fr auto 52px 58px; gap: 8px; align-items: center; padding: 5px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row-item:hover { background: var(--softer); }
.row-item.focused { background: var(--focus); }
.row-item.picked .url { font-weight: 550; }
.method { font-weight: 700; font-size: 11px; font-family: ui-monospace, Menlo, monospace; }
.m-get { color: var(--get); } .m-post { color: var(--post); } .m-put { color: var(--put); } .m-patch { color: var(--patch); } .m-delete { color: var(--delete); }
.status { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.s2 { color: var(--good); } .s3 { color: var(--muted); } .s4, .s5 { color: var(--bad); }
.url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.url .host { color: var(--muted); margin-right: 1px; }
.type, .size { color: var(--muted); font-size: 11px; text-align: right; }
.tag { font-size: 10px; font-weight: 700; color: var(--patch); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; }
.empty { color: var(--muted); padding: 28px 16px; text-align: center; }

.panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); flex: none; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 10px 8px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }
.count { background: var(--soft); border: 1px solid var(--line); border-radius: 9px; padding: 0 6px; font-size: 11px; color: var(--muted); font-weight: 600; }
.count.warn { background: var(--warn); border-color: var(--warn); color: var(--bg); }
.count.hit { color: var(--accent); border-color: var(--accent); }
.panel-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 16px 16px; }

.endpoint { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.ep-head { display: flex; align-items: center; gap: 12px; }
.ep-title { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: baseline; }
.ep-title code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick { white-space: nowrap; font-weight: 600; }
.ep-opts { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; color: var(--muted); }
.ep-opts input[type=number] { width: 72px; }
.subs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.sub { background: none; border: 0; border-bottom: 2px solid transparent; padding: 4px 8px 6px; color: var(--muted); font-weight: 550; }
.sub.active { color: var(--fg); border-bottom-color: var(--fg); }
.editor-wrap { flex: 1; display: flex; flex-direction: column; gap: 6px; min-height: 260px; }
.editor { flex: 1; width: 100%; resize: none; line-height: 1.5; background: var(--code-bg); min-height: 240px; tab-size: 2; }
.editor-bar { display: flex; gap: 8px; align-items: center; }
.editor-msg { flex: 1; margin: 0; font-size: 12px; }
.editor-msg.ok { color: var(--good); } .editor-msg.error { color: var(--bad); font-weight: 550; }
.note, .callout { background: var(--soft); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 6px; margin: 0 0 10px; }
pre.code { background: var(--code-bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin: 0; overflow: auto; white-space: pre; line-height: 1.5; }
.preview pre.code { max-height: calc(100vh - 290px); }
.request h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 4px; }
.wrap { word-break: break-all; }
table.kv { border-collapse: collapse; width: 100%; }
table.kv th, table.kv td { text-align: left; vertical-align: top; padding: 3px 8px 3px 0; border-bottom: 1px solid var(--line); }
table.kv th { font-weight: 600; white-space: nowrap; width: 1%; font-size: 12px; }
table.kv td { word-break: break-all; }
ul.changes { margin: 0; padding-left: 18px; } ul.changes li { margin: 3px 0; }

.rules .sets { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--soft); border-radius: 8px; margin-bottom: 8px; }
.rule-list { list-style: none; margin: 0 0 8px; padding: 0; border: 1px solid var(--line); border-radius: 8px; }
.rule-list li { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-bottom: 1px solid var(--line); }
.rule-list li:last-child { border-bottom: 0; }
.rule-list li.off .rule-text { color: var(--muted); text-decoration: line-through; }
.rule-text { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.rule-form { background: var(--softer); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.rule-form .row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rule-form .editor-msg { margin-top: 6px; }

.findings { list-style: none; padding: 0; margin: 0; }
.findings li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.f-body { flex: 1; min-width: 0; word-break: break-word; }
.f-line { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 2px; }
.add-rule { font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
.sev { font-size: 10px; font-weight: 700; text-transform: uppercase; border-radius: 4px; padding: 1px 6px; width: 58px; text-align: center; flex: none; }
.sev-high .sev { background: var(--bad); color: var(--bg); }
.sev-medium .sev { background: var(--warn); color: var(--bg); }
.sev-low .sev { border: 1px solid var(--muted); color: var(--muted); }
.sev-info .sev { border: 1px dashed var(--muted); color: var(--muted); }

.export { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.export-opts { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-bottom: 10px; }
.export-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 215px 1fr; gap: 10px; }
.files { list-style: none; margin: 0; padding: 0; overflow: auto; }
.file-btn { width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 5px 8px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-btn.active { background: var(--accent-soft); font-weight: 600; }
.file-view { display: flex; flex-direction: column; min-height: 0; min-width: 0; gap: 6px; }
.file-bar { display: flex; align-items: center; gap: 8px; }
.file-view pre.code { flex: 1; min-height: 0; }
.export-bar { display: flex; align-items: center; gap: 14px; padding-top: 6px; border-top: 1px solid var(--line); }
.export-bar button { white-space: nowrap; flex: none; }

.upsell { max-width: 560px; margin: 10px auto; text-align: center; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--softer); }
.upsell h2 { margin: 0 0 8px; font-size: 19px; }
.perks { text-align: left; display: inline-block; margin: 4px 0 14px; padding-left: 18px; }
.perks li { margin: 4px 0; }
.fine { font-size: 12px; color: var(--muted); }
.notice { color: var(--warn); font-weight: 600; }
.key-form { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 6px 0; }
.key-form input { width: 290px; }
.key-message { width: 100%; margin: 4px 0 0; font-size: 12px; }

@media (max-width: 900px) {
  .bench { grid-template-columns: 1fr; grid-template-rows: 45vh 1fr; }
  .list-pane { border-right: 0; border-bottom: 1px solid var(--line); }
  .how { grid-template-columns: 1fr; }
  .export-main { grid-template-columns: 1fr; }
}
/* Phones (the hosted page): the search box takes its own line and the three selects share the next. */
@media (max-width: 600px) {
  .filters .row { flex-wrap: wrap; }
  .filters input[type=search] { flex-basis: 100%; }
  .filters select { flex: 1; min-width: 0; max-width: none; }
  .key-form input { width: 100%; }
}
