:root {
  --bg: #0e1116; --bg2: #151a21; --bg3: #1c232c; --bg4: #232c38;
  --line: #2a323d; --line2: #353f4d;
  --fg: #e4e9f0; --fg2: #aab4c2; --fg3: #6f7d8f;
  --accent: #4f8cff; --accent2: #2f6fe0;
  --green: #3fb950; --red: #f85149; --yellow: #d29922; --purple: #a371f7; --cyan: #39c5cf;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 13px; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c3440; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* buttons / inputs */
.btn { background: var(--bg4); color: var(--fg); border: 1px solid var(--line2); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; font-size: 12px; transition: .12s; }
.btn:hover { background: #2b3340; border-color: #44505f; }
.btn.primary { background: var(--accent2); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent); }
.btn.danger { color: var(--red); border-color: #5a2b2b; }
.btn.danger:hover { background: #2a1a1a; }
.btn.sm { padding: 3px 8px; font-size: 11px; }
.btn.green { background: #1c3b25; border-color: #2c5a38; color: #7ee29a; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea { background: var(--bg); color: var(--fg); border: 1px solid var(--line2);
  border-radius: 6px; padding: 7px 9px; font-size: 12px; font-family: inherit; outline: none; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { font-family: var(--mono); resize: vertical; }
label { display: block; color: var(--fg2); font-size: 11px; margin: 8px 0 3px; text-transform: uppercase; letter-spacing: .04em; }
.row { display: flex; gap: 8px; align-items: center; }
.muted { color: var(--fg3); }
.pill { display: inline-block; padding: 1px 7px; border-radius: 20px; font-size: 11px; background: var(--bg3); border: 1px solid var(--line2); }

/* layout */
.login-wrap { display: flex; height: 100%; align-items: center; justify-content: center; }
.login-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 32px; width: 340px; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.logo-dot { color: var(--accent); }

.shell { display: grid; grid-template-columns: 230px 1fr; height: 100%; }
.sidebar { background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.sidebar .brand { padding: 14px 16px; font-size: 16px; font-weight: 700; border-bottom: 1px solid var(--line); }
.sidebar .sect { padding: 10px 12px 4px; font-size: 10px; color: var(--fg3); text-transform: uppercase; letter-spacing: .08em; }
.proj-list { overflow-y: auto; max-height: 30%; }
.proj { padding: 7px 14px; cursor: pointer; display: flex; justify-content: space-between; gap: 6px; border-left: 2px solid transparent; }
.proj:hover { background: var(--bg3); }
.proj.active { background: var(--bg3); border-left-color: var(--accent); }
.nav { padding: 4px 8px; overflow-y: auto; flex: 1; }
.nav .item { padding: 8px 12px; border-radius: 6px; cursor: pointer; color: var(--fg2); display: flex; justify-content: space-between; }
.nav .item:hover { background: var(--bg3); color: var(--fg); }
.nav .item.active { background: var(--bg4); color: #fff; }
.nav .item .badge { background: var(--accent2); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 10px; }
.nav .item .badge.warn { background: var(--yellow); }
.sidebar .foot { padding: 10px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--fg3); display: flex; justify-content: space-between; align-items: center; }

.main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.workbody { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.tabs.project { background: var(--bg2); padding-left: 14px; gap: 4px; }
.tabs.project .ptitle { padding: 7px 14px 7px 0; font-weight: 600; color: var(--fg); border-right: 1px solid var(--line); margin-right: 6px; }
.toolbar { display: flex; gap: 8px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--bg2); flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.toolbar input.search { max-width: 320px; }
.content { flex: 1; overflow: auto; padding: 16px; }
.content.flush { padding: 0; }

/* traffic */
.split { display: grid; grid-template-rows: 1fr; height: 100%; }
.split.with-inspector { grid-template-columns: 1fr 0; }
.traffic { display: grid; grid-template-columns: 1fr; grid-template-rows: 1fr; height: 100%; min-height: 0; }
.flow-table-wrap { overflow: auto; height: 100%; }
table.flows { width: 100%; border-collapse: collapse; font-size: 12px; }
table.flows th { position: sticky; top: 0; background: var(--bg2); text-align: left; padding: 6px 8px; color: var(--fg3);
  font-weight: 500; border-bottom: 1px solid var(--line); font-size: 11px; white-space: nowrap; z-index: 1; }
table.flows td { padding: 4px 8px; border-bottom: 1px solid #1b212a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
table.flows tr { cursor: pointer; }
table.flows tr:hover td { background: var(--bg2); }
table.flows tr.sel td { background: #1d2735 !important; }
table.flows tr.pending td { opacity: .6; font-style: italic; }
.mono { font-family: var(--mono); }
.method { font-weight: 600; }
.m-GET { color: var(--green); } .m-POST { color: var(--yellow); } .m-PUT { color: var(--cyan); }
.m-DELETE { color: var(--red); } .m-PATCH { color: var(--purple); }
.sc-2 { color: var(--green); } .sc-3 { color: var(--cyan); } .sc-4 { color: var(--yellow); } .sc-5 { color: var(--red); }

/* inspector drawer */
.inspector { position: fixed; top: 0; right: 0; width: 56%; max-width: 920px; height: 100%; background: var(--bg2);
  border-left: 1px solid var(--line2); box-shadow: -20px 0 40px rgba(0,0,0,.4); display: flex; flex-direction: column; z-index: 50; }
.inspector .ins-head { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.tabs { display: flex; gap: 2px; padding: 6px 10px 0; border-bottom: 1px solid var(--line); }
.tab { padding: 7px 13px; cursor: pointer; color: var(--fg2); border-bottom: 2px solid transparent; font-size: 12px; }
.tab.active { color: #fff; border-bottom-color: var(--accent); }
.ins-body { flex: 1; overflow: auto; padding: 12px 14px; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 2px 12px; font-size: 12px; }
.kv .k { color: var(--cyan); font-family: var(--mono); word-break: break-all; }
.kv .v { font-family: var(--mono); word-break: break-all; color: var(--fg); }
pre.body { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto;
  font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: none; }
.startline { font-family: var(--mono); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin-bottom: 10px; word-break: break-all; }

/* cards / grids */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.card h3 { margin: 0 0 8px; font-size: 14px; }
.tablelike { width: 100%; border-collapse: collapse; }
.tablelike th { text-align: left; color: var(--fg3); font-weight: 500; padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 11px; }
.tablelike td { padding: 7px 8px; border-bottom: 1px solid #1b212a; }
.status-running { color: var(--green); } .status-stopped { color: var(--fg3); } .status-error { color: var(--red); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot.running { background: var(--green); } .dot.stopped { background: var(--fg3); } .dot.error { background: var(--red); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--bg2); border: 1px solid var(--line2); border-radius: 12px; padding: 20px; width: 460px; max-height: 88vh; overflow: auto; }
.modal h2 { margin: 0 0 12px; font-size: 17px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* breakpoint banner */
.bp-banner { background: linear-gradient(90deg, #3a2a12, #2a2410); border: 1px solid #6a4d1c; border-radius: 8px;
  padding: 8px 12px; margin: 10px 16px 0; display: flex; align-items: center; gap: 10px; }
.bp-banner .pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--yellow); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }

.toast { position: fixed; bottom: 18px; right: 18px; background: var(--bg4); border: 1px solid var(--line2);
  padding: 10px 14px; border-radius: 8px; z-index: 200; max-width: 380px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast.err { border-color: #5a2b2b; }
.empty { color: var(--fg3); text-align: center; padding: 40px; }
.steps { line-height: 1.7; }
.steps code { background: var(--bg); padding: 1px 6px; border-radius: 4px; font-family: var(--mono); }
.tag-toggle { display:inline-flex; align-items:center; gap:6px; cursor:pointer; padding:5px 10px; border:1px solid var(--line2); border-radius:6px; }
.tag-toggle.on { background:#1c3b25; border-color:#2c5a38; color:#7ee29a; }
