:root {
  --bg: #0b0f17;
  --panel: #121826;
  --panel-2: #19202f;
  --line: #232c3d;
  --txt: #e6ebf2;
  --muted: #8a97ab;
  --brand: #4f8cff;
  --brand-2: #6ee7b7;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: grid;
  grid-template-columns: 248px 1fr;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--txt);
  background: radial-gradient(1200px 600px at 80% -10%, #16203a 0%, var(--bg) 55%);
}

/* ---------- sidebar ---------- */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.brand-mark { font-size: 26px; }
.brand strong { display: block; font-size: 17px; letter-spacing: .3px; }
.brand small { color: var(--muted); }
nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  background: none; border: 0; color: var(--muted);
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  font-size: 14.5px; text-align: left; transition: .15s;
}
.nav-item:hover { background: var(--panel-2); color: var(--txt); }
.nav-item.active { background: linear-gradient(90deg, rgba(79,140,255,.18), transparent); color: #fff; box-shadow: inset 2px 0 0 var(--brand); }
.nav-item span { width: 20px; text-align: center; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 6px; }
.side-foot small { color: var(--muted); font-size: 12px; word-break: break-all; }

/* ---------- content ---------- */
.content { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 26px; border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 20px; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.view { padding: 26px; overflow: auto; }

/* ---------- bits ---------- */
.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--txt);
  padding: 9px 14px; border-radius: 10px; cursor: pointer; font-size: 14px; transition: .15s;
}
.btn:hover { border-color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: none; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--txt); border-color: var(--line); }
.btn-danger { color: var(--err); border-color: transparent; }
.btn-danger:hover { border-color: var(--err); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.pill { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-align: center; text-transform: uppercase; letter-spacing: .4px; }
.pill-ok { background: rgba(52,211,153,.15); color: var(--ok); }
.pill-warn { background: rgba(251,191,36,.15); color: var(--warn); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot-off { background: var(--err); }
.loading { color: var(--muted); padding: 40px; text-align: center; }

/* cards grid */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; transition: .15s;
}
.card:hover { border-color: #2f3c55; transform: translateY(-2px); box-shadow: var(--shadow); }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card p { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; min-height: 38px; }
.card .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.app-ico { font-size: 26px; margin-bottom: 8px; }

/* address banner */
.addr-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(100deg, rgba(79,140,255,.16), rgba(110,231,183,.08));
  border: 1px solid #2c3a55; border-radius: var(--radius); padding: 18px 22px; margin-bottom: 22px;
}
.addr-label { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.addr-main { font-size: 20px; font-weight: 700; }
.addr-sub { display: flex; gap: 16px; margin-top: 6px; color: var(--muted); font-size: 13px; }
.addr-code { color: var(--brand-2); }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat .v small { font-size: 14px; font-weight: 500; color: var(--muted); }

/* table */
.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; background: var(--panel-2); }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-mine td { background: rgba(79,140,255,.06); }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--panel-2); color: var(--muted); }
.tag-ok { background: rgba(52,211,153,.14); color: var(--ok); }
.tag-mine { background: rgba(79,140,255,.16); color: var(--brand); }
.empty { color: var(--muted); padding: 40px; text-align: center; }
.muted { color: var(--muted); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(5,8,14,.7); display: grid; place-items: center; z-index: 50; backdrop-filter: blur(3px); }
.modal.hidden { display: none; }
.modal-card { width: min(620px, 92vw); max-height: 88vh; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; overflow: auto; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input[type=text] { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--txt); font-size: 14px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.switch { display: flex; align-items: center; gap: 10px; }

/* terminal */
.term {
  background: #05080e; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; font: 12.5px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}
.term .l-cmd { color: #cfe1ff; }
.term .l-ok { color: var(--ok); }
.term .l-err { color: var(--err); }
.term .l-am { color: var(--warn); }
.term .l-dim { color: var(--muted); }
.term .l-done { color: var(--brand-2); font-weight: 700; }
