:root {
  --bg: #0b0d12;
  --panel: #14171f;
  --panel2: #1a1e28;
  --line: #232837;
  --line2: #2c3245;
  --text: #e8ecf3;
  --dim: #8b93a7;
  --pink: #ff2f8e;         /* uniswap accent */
  --blue: #4d8dff;         /* aave-ish accent */
  --green: #35d68f;
  --amber: #f5b04c;
  --red: #ff6b6b;
  --radius: 16px;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, "Segoe UI", Inter, Roboto, sans-serif; }
a { color: var(--blue); text-decoration: none; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.center { text-align: center; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ───────── top nav ───────── */
.topnav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px; border-bottom: 1px solid var(--line);
  background: rgba(11,13,18,.85); backdrop-filter: blur(10px);
}
.brand { font-weight: 800; font-size: 17px; letter-spacing: .3px; white-space: nowrap; }
.brand span { color: var(--pink); }
.tabs { display: flex; gap: 4px; flex: 1; justify-content: center; }
.tab {
  background: none; border: 0; color: var(--dim); font-size: 15px; font-weight: 600;
  padding: 8px 16px; border-radius: 10px; cursor: pointer;
}
.tab:hover { color: var(--text); background: var(--panel2); }
.tab.active { color: var(--text); background: var(--panel2); }
.net { display: flex; align-items: center; gap: 8px; }
.pill {
  padding: 3px 10px; border: 1px solid var(--line2); border-radius: 999px;
  font-size: 12px; font-family: var(--mono); color: var(--text);
}
.pill.dim { color: var(--dim); }

/* ───────── buttons / chips ───────── */
.btn {
  border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 700; font-size: 15px;
  cursor: pointer; color: #fff; transition: filter .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.pink { background: var(--pink); }
.btn.blue { background: var(--blue); }
.btn.ghost { background: transparent; border: 1px solid var(--line2); color: var(--text); }
.btn.big { width: 100%; padding: 14px; font-size: 16px; border-radius: 14px; }
.btn.wide { width: 100%; margin-top: 10px; }
.chipbtn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line2);
  border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.chipbtn:hover { border-color: var(--blue); }
.chipbtn.active { background: var(--blue); border-color: var(--blue); color: #06121f; }
.chip {
  padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--panel2); border: 1px solid var(--line2); font-family: var(--mono);
}
.chip.normal, .chip.NORMAL { color: var(--green); border-color: var(--green); }
.chip.thin, .chip.THIN, .chip.ELEVATED { color: var(--amber); border-color: var(--amber); }
.chip.deep, .chip.DEEP, .chip.CRITICAL { color: var(--red); border-color: var(--red); }

/* ───────── cards / layout ───────── */
main { max-width: 1080px; margin: 0 auto; padding: 20px 20px 60px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-top: 16px;
}
.card-title { font-weight: 700; margin-bottom: 10px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 12px; margin-top: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.s-label { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .8px; }
.s-val { font-size: 22px; font-weight: 700; font-family: var(--mono); margin-top: 2px; }
.s-sub { font-size: 12px; margin-top: 2px; }
.vaultgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px,1fr)); gap: 16px; align-items: start; }
.vaultgrid .card { margin-top: 16px; }

/* ───────── swap widget (uniswap-style) ───────── */
.swap-wrap { max-width: 430px; margin: 20px auto 0; display: grid; gap: 14px; }
.swap-card { padding: 16px; border-radius: 20px; }
.swap-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 12px; }
.swap-box {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
}
.swap-box.out { margin-top: -6px; border-radius: 14px; }
.swap-meta { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.swap-row { display: flex; gap: 10px; align-items: center; }
.swap-row input {
  flex: 1; background: none; border: 0; outline: none; color: var(--text);
  font-size: 24px; font-family: var(--mono); min-width: 0;
}
.swap-row input:disabled { color: var(--dim); }
.toksel {
  background: var(--panel); color: var(--text); border: 1px solid var(--line2);
  border-radius: 12px; padding: 8px 10px; font-weight: 700; font-size: 15px; cursor: pointer;
}
.flip-row { display: flex; justify-content: center; margin: 6px 0; }
#flipBtn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--panel2); color: var(--text); font-size: 16px; cursor: pointer; z-index: 1;
}
#flipBtn:hover { border-color: var(--pink); color: var(--pink); }
.swap-info { margin: 12px 2px 14px; display: grid; gap: 6px; font-size: 13.5px; }
.swap-info > div { display: flex; justify-content: space-between; }
.swap-info b { font-family: var(--mono); }

/* mini oracle under swap */
.mini-oracle .mini-head { display: flex; gap: 8px; align-items: center; font-size: 13.5px; margin-bottom: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); display: inline-block; }
.dot.warn { background: var(--amber); } .dot.crit { background: var(--red); }
.mini-bar { position: relative; height: 10px; background: var(--panel2); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.mini-fill { height: 100%; width: 0%; background: linear-gradient(90deg,#2c8f63,var(--green)); transition: width .4s; }
.mini-bar i { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--amber); }
.mini-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; }
.sim { display: flex; gap: 6px; align-items: center; color: var(--dim); font-size: 12px; }

/* ───────── vault tabs (aave-style) ───────── */
.vtabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel2); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.vtab {
  border: 0; background: none; color: var(--dim); padding: 9px; font-weight: 700; font-size: 14px;
  border-radius: 9px; cursor: pointer;
}
.vtab.active { background: var(--blue); color: #06121f; }
.field { margin-bottom: 12px; }
.flabel { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.frow {
  display: flex; gap: 8px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px;
}
.frow input {
  flex: 1; background: none; border: 0; outline: none; color: var(--text);
  font-size: 20px; font-family: var(--mono); min-width: 0;
}

/* utilization bar */
.util-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.util-bar { position: relative; height: 14px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.util-fill { height: 100%; width: 0%; background: linear-gradient(90deg,#2c8f63,var(--green)); transition: width .4s; }
.util-fill.warn { background: linear-gradient(90deg,#8f6a2c,var(--amber)); }
.util-fill.crit { background: linear-gradient(90deg,#8f2c2c,var(--red)); }
.util-bar i { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--amber); z-index: 2; }
.util-scale { display: flex; justify-content: space-between; margin-top: 3px; }

/* gauge (bands) */
.gauge { position: relative; height: 26px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-top: 8px; }
.gauge .fill { position: absolute; inset: 0 auto 0 0; width: 0%; background: linear-gradient(90deg,#2c6fb3,var(--blue)); opacity: .85; transition: width .5s; }
.gauge .marker { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--amber); z-index: 2; }
.gauge .marker.deep { background: var(--green); }

/* faucet */
.faucetgrid { display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 12px; }
.fcard { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 6px; }

/* ───────── data tables ───────── */
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; color: var(--dim); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); font-size: 12px; }
table.data td { padding: 7px 8px; border-bottom: 1px solid #1b2029; }
table.data td:first-child { color: var(--dim); font-family: var(--mono); }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 11px;
  font-weight: 700; font-family: var(--mono); letter-spacing: .3px;
}
.badge.firewall { background: #2a1220; color: var(--pink); }
.badge.band { background: #10202f; color: var(--blue); }
.badge.vault { background: #0f2419; color: var(--green); }
.badge.pool { background: #1f1d2b; color: #b9a8ff; }
.badge.risk { background: #241a0e; color: var(--amber); }

/* status banner */
.status {
  position: sticky; top: 60px; z-index: 15; margin: 10px auto 0; max-width: 1020px;
  padding: 10px 16px; border-radius: 12px; font-size: 14px;
  background: var(--panel); border: 1px solid var(--line2);
}
.status.ok { border-color: var(--green); color: var(--green); }
.status.err { border-color: var(--red); color: var(--red); }
.status.busy { border-color: var(--amber); color: var(--amber); }

footer { margin-top: 40px; text-align: center; font-size: 13px; color: var(--dim); }
input::placeholder { color: #4a5164; }

/* contracts table */
td.mono { font-family: var(--mono); font-size: 12px; color: var(--dim); word-break: break-all; }

/* mini faucet strip (swap view) */
.mini-faucet .row { margin-top: 6px; }
.mini-faucet .row span.mono { font-family: var(--mono); font-size: 13px; }
