:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface2: #f9fafb;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent2: #1d4ed8;
  --good: #16a34a;
  --bad: #dc2626;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 12px 28px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --radius2: 12px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial;
  background: var(--bg);
  color: var(--text);
}

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  padding: 18px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 10px 16px 10px;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: white;
  background: linear-gradient(135deg, var(--accent), #60a5fa);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
}

.brandTitle {
  font-weight: 800;
  font-size: 16px;
  line-height: 1.2;
}

.brandSub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
  padding: 6px 6px 12px 6px;
}

.navItem {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-weight: 600;
}

.navItem:hover {
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.10);
}

.navItem.active {
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.20);
  color: var(--accent2);
}

.navIcon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  opacity: 0.9;
}

.sidebarFooter {
  padding: 12px 10px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 251, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.pageTitle {
  font-weight: 900;
  font-size: 18px;
}

.pageSub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.badge {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(22, 163, 74, 0.25);
  font-size: 12px;
  font-weight: 700;
  color: var(--good);
  background: rgba(22, 163, 74, 0.08);
}

.badge.bad {
  border-color: rgba(220, 38, 38, 0.25);
  color: var(--bad);
  background: rgba(220, 38, 38, 0.07);
}

.content {
  padding: 18px 22px 32px 22px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}

.page {
  display: none;
  gap: 16px;
}

.page.active {
  display: grid;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.cardHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.cardActions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

h2 {
  margin: 0;
  font-size: 16px;
}

label span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

textarea { resize: vertical; }

.btn {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.btn:hover {
  filter: brightness(0.98);
}

.btn.primary {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent2);
}

.btn.primary:hover {
  background: rgba(37, 99, 235, 0.16);
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.full { grid-column: 1 / -1; }

.tableWrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  margin-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

thead th {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  color: #334155;
  background: var(--surface2);
  position: sticky;
  top: 0;
}

tbody td {
  padding: 10px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

tbody tr:nth-child(odd) {
  background: rgba(248, 250, 252, 0.7);
}


tbody tr.clickable {
  cursor: pointer;
}

tbody tr.clickable:hover {
  background: rgba(37, 99, 235, 0.10);
}

.kv {
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  overflow: hidden;
}

.kvRow {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  align-items: center;
}

.kvRow:last-child {
  border-bottom: none;
}

.kvKey {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.kvVal {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
}


.result {
  margin-top: 12px;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 12px;
  border-radius: var(--radius2);
  border: 1px solid var(--line);
  background: #f1f5f9;
  color: var(--text);
}

.result.error {
  border-color: rgba(220, 38, 38, 0.35);
  background: #fef2f2;
  color: #991b1b;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

.kpiGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.kpi {
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  padding: 12px;
  background: var(--surface2);
}

.kpiLabel {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.kpiValue {
  font-size: 22px;
  font-weight: 900;
  margin-top: 6px;
}

.list {
  margin: 10px 0 0 0;
  padding-left: 18px;
  color: #334155;
}

.callout {
  margin-top: 12px;
  border: 1px dashed rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.06);
  border-radius: var(--radius2);
  padding: 12px;
  color: #1e40af;
}

.footer {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
}

@media (max-width: 980px) {
  .kpiGrid { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr; }
  .sidebar {
    width: 240px;
  }
}

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: relative;
    height: auto;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .nav {
    grid-template-columns: 1fr 1fr;
  }
}


/* Tunnel URLs helpers */
.btn.xs{padding:6px 10px;font-size:12px;line-height:1;border-radius:10px}
.h3{margin:0 0 10px 0;font-size:14px;color:#1f2937}


.cmdBlock { min-width: 0; }
.cmdHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.cmdPre {
  margin-top: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow-x: auto;
  max-width: 100%;
}

.cmdArea {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow-x: auto;
  resize: vertical;
  min-height: 84px;
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--fg);
}
.jsonBox {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow-x: auto;
  max-width: 100%;
}
.callout .mono, .kvVal.mono, .hint .mono { overflow-wrap: anywhere; }
@media (max-width: 1100px) {
  .content { max-width: 100%; }
}
