/* NUBO Admin — dark green, matches the app */
:root {
  --bg: #060d0a; --bg-2: #0a1510;
  --surface: rgba(18, 33, 26, .72); --surface-solid: #101d17; --surface-2: #16271f; --surface-3: #1c3127;
  --line: rgba(120, 220, 170, .10); --line-2: rgba(120, 220, 170, .18);
  --text: #eaf5ef; --text-2: #b9cdc3; --muted: #7f9a8c;
  --accent: #3fe38a; --accent-2: #a6e05a; --accent-ink: #03140a; --accent-soft: rgba(63, 227, 138, .12);
  --gold: #f2c35b; --gold-soft: rgba(242, 195, 91, .12);
  --danger: #ff6b6b; --danger-soft: rgba(255, 107, 107, .12);
  --r: 16px; --r-sm: 10px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  --side: 248px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh; background: var(--bg); color: var(--text);
  font: 500 15px/1.55 var(--font); overflow-x: clip;
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(63, 227, 138, .10), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(166, 224, 90, .06), transparent 60%);
  background-attachment: fixed;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 28px; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; margin: 0 0 8px; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 4px; }
p { margin: 0; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-3); color: var(--text); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.ic { width: 18px; height: 18px; flex: none; }
.ic.big { width: 40px; height: 40px; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- layout ---------- */
.app .main { margin-left: var(--side); padding: 32px 40px 120px; max-width: calc(1080px + var(--side)); min-width: 0; }
.bare .main { padding: 0; }
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 20;
  display: flex; flex-direction: column; gap: 24px; padding: 22px 14px 16px;
  background: rgba(8, 17, 13, .86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); padding: 0 8px; }
.brand:hover { text-decoration: none; }
.mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
  font-weight: 800; font-size: 17px; box-shadow: 0 6px 20px rgba(63, 227, 138, .28);
}
.brand-t { display: flex; flex-direction: column; font-weight: 800; letter-spacing: .14em; line-height: 1.1; }
.brand-t small { font-size: 11px; letter-spacing: .02em; font-weight: 600; color: var(--muted); }
.brand.big .mark { width: 44px; height: 44px; font-size: 22px; border-radius: 13px; }
.brand.big .brand-t { font-size: 20px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.l-short { display: none; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px;
  color: var(--text-2); font-weight: 600; white-space: nowrap; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(63, 227, 138, .18); }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 0; border-top: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ava { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); color: var(--accent); font-weight: 800; flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- headers ---------- */
.page-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; margin-bottom: 22px; flex-wrap: wrap; }
.page-h > div { flex: 1 1 420px; min-width: 0; }
.page-h p { max-width: 720px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; margin-bottom: 14px; }
.back:hover { color: var(--text); text-decoration: none; }

.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 30px; margin-bottom: 22px;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; align-items: center;
  background: linear-gradient(135deg, rgba(31, 169, 138, .20), rgba(166, 224, 90, .08) 55%, rgba(16, 29, 23, .6)), var(--surface-solid);
  border: 1px solid var(--line-2);
}
.hero::after { content: ""; position: absolute; width: 420px; height: 420px; right: -140px; top: -200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(63, 227, 138, .22), transparent 65%); pointer-events: none; }
.hero-txt { position: relative; z-index: 1; min-width: 0; }
.hero-txt p { color: var(--text-2); }
.hero-txt p + p { margin-top: 12px; }
.hero-note { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted) !important; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
.eyebrow .ic { width: 15px; height: 15px; }
.stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 14px; background: rgba(6, 13, 10, .55); border: 1px solid var(--line); color: var(--text); min-width: 0; }
a.stat:hover { border-color: var(--line-2); text-decoration: none; background: rgba(6, 13, 10, .75); }
.stat-n { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-n.sm { font-size: 17px; line-height: 1.3; }
.stat-l { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* ---------- cards & rows ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 18px; backdrop-filter: blur(6px); }
.card.flush { overflow-x: auto; }
.group { padding: 0; }
.group-h { padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 14px 28px; padding: 18px 22px; align-items: center; }
.row + .row { border-top: 1px solid var(--line); }
.row.tall { align-items: start; }
.row.dim { opacity: .45; }
.row-info { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.row-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none; background: var(--accent-soft); color: var(--accent); }
.row-ic .ic { width: 20px; height: 20px; }
.row-t { display: block; font-weight: 700; font-size: 15.5px; color: var(--text); }
.row-d { color: var(--muted); font-size: 13.5px; margin-top: 3px; max-width: 460px; }
.row-ctl { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.help { color: var(--muted); font-size: 12.5px; }
.err { color: var(--danger); font-size: 13px; font-weight: 600; }
.has-err .input { border-color: var(--danger); }
.has-err { background: var(--danger-soft); }

/* segmented control (radios) */
.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 13px; background: var(--bg-2); border: 1px solid var(--line); }
.seg-o { flex: 1 1 0; min-width: 0; position: relative; cursor: pointer; }
.seg-many .seg-o { flex: 1 1 calc(50% - 4px); }
.seg-o input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-o span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; height: 100%;
  min-height: 40px; padding: 8px 10px; border-radius: 10px; text-align: center;
  font-size: 13px; font-weight: 700; color: var(--text-2); line-height: 1.25; transition: background .15s, color .15s;
}
.seg-o span em { font-style: normal; font-weight: 600; font-size: 11.5px; color: var(--muted); }
.seg-o:hover span { background: var(--surface-2); color: var(--text); }
.seg-o input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg-o input:checked + span { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 4px 14px rgba(0, 0, 0, .25); }
.seg-on input:checked + span, .seg-proxy input:checked + span, .seg-tcp input:checked + span, .seg-icmp input:checked + span { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); }
.seg-off input:checked + span { background: rgba(255, 107, 107, .16); color: #ffb3b3; }
.inh-o input:checked + span { background: var(--gold-soft); color: var(--gold); }
.inh-o input:checked + span em { color: var(--gold); opacity: .8; }

/* inputs */
.input {
  width: 100%; min-width: 0; background: var(--bg-2); color: var(--text); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 11px 13px; font: 500 14.5px/1.4 var(--font); transition: border-color .15s, box-shadow .15s;
}
.input.mono, textarea.input { font-family: var(--mono); font-size: 13px; }
textarea.input { resize: vertical; min-height: 110px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(63, 227, 138, .15); }
.input::placeholder { color: #557064; }
.inherited .input { opacity: .45; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; flex-wrap: wrap; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw { width: 38px; height: 22px; border-radius: 99px; background: var(--surface-3); position: relative; flex: none; transition: background .15s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #cfe3d8; transition: transform .15s; }
.switch input:checked + .sw { background: var(--gold); }
.switch input:checked + .sw::after { transform: translateX(16px); background: #241a03; }
.switch input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px 6px 8px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font: 600 12.5px var(--font);
}
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip .chip-ic { width: 14px; height: 14px; transition: transform .15s; }
.chip.on { background: var(--accent-soft); border-color: rgba(63, 227, 138, .4); color: var(--accent); }
.chip.on .chip-ic { transform: rotate(45deg); }

/* banner preview — same look as the banner in the app */
.banner-preview {
  display: flex; align-items: center; gap: 14px; margin: 18px 22px 2px; padding: 14px 16px; border-radius: 16px;
  background: linear-gradient(100deg, #1d9c86, #4cbf7a 55%, #a6d84e); color: #fff; max-width: 520px;
  box-shadow: 0 10px 30px rgba(63, 227, 138, .15);
}
.banner-preview.off { filter: saturate(.7); }
.bp-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, .16); flex: none; }
.bp-ic .ic { width: 24px; height: 24px; }
.bp-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.bp-txt b { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-txt small { font-size: 12.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-go { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .7); flex: none; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font: 700 14px var(--font);
  cursor: pointer; white-space: nowrap; transition: transform .1s, background .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { border: 0; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); box-shadow: 0 8px 24px rgba(63, 227, 138, .25); }
.btn.primary:hover { box-shadow: 0 10px 30px rgba(63, 227, 138, .38); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.danger { background: var(--danger-soft); border-color: rgba(255, 107, 107, .3); color: #ffb3b3; }
.btn.danger:hover { background: rgba(255, 107, 107, .22); }
.btn.block { width: 100%; }

/* save bar */
.savebar {
  position: sticky; bottom: 16px; z-index: 10; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 8px; padding: 12px 12px 12px 20px; border-radius: 16px;
  background: rgba(16, 29, 23, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line-2); box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.savebar-t { flex: 1; color: var(--muted); font-weight: 600; font-size: 14px; min-width: 140px; }
.savebar.dirty { border-color: rgba(63, 227, 138, .45); }
.savebar.dirty .savebar-t { color: var(--accent); }

/* flash */
.flash { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 600; }
.flash.ok { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(63, 227, 138, .25); }
.flash.bad { background: var(--danger-soft); color: #ffb3b3; border: 1px solid rgba(255, 107, 107, .3); }

/* search */
.search { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 4px 6px 4px 14px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); max-width: 520px; color: var(--muted); }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); font: 500 14.5px var(--font); padding: 10px 0; }
.search input:focus { outline: none; }
.search:focus-within { border-color: var(--accent); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: rgba(255, 255, 255, .02); }
.tbl th.num { text-align: right; }
.tok { display: block; max-width: 260px; font-family: var(--mono); font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-note { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.pill .ic { width: 13px; height: 13px; }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.tag { display: inline-block; margin: 2px 4px 2px 0; padding: 3px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.change { font-size: 13px; }
.change .old { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, .25); }
.change .arrow { color: var(--muted); margin: 0 4px; }
.change .new { color: var(--text); font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 8px; }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 48px 24px; }
.empty-state p { max-width: 440px; }

.json-box summary { display: flex; align-items: center; gap: 10px; padding: 18px 22px; cursor: pointer; font-weight: 700; list-style: none; }
.json-box summary::-webkit-details-marker { display: none; }
.json { margin: 0; padding: 0 22px 22px; font: 12.5px/1.6 var(--mono); color: var(--text-2); overflow-x: auto; }

/* login */
.login { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; overflow: hidden; }
.login-glow { position: absolute; width: 720px; height: 720px; border-radius: 50%; top: 50%; left: 50%; transform: translate(-50%, -60%);
  background: radial-gradient(circle, rgba(63, 227, 138, .16), transparent 62%); pointer-events: none; }
.login-card { position: relative; width: 100%; max-width: 400px; padding: 32px 28px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line-2); backdrop-filter: blur(14px); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.login-card .brand { padding: 0; margin-bottom: 26px; }
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.login-card .flash { margin: 18px 0 0; }
.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.lbl { font-size: 13px; font-weight: 700; color: var(--text-2); margin-top: 6px; }
.stack .btn { margin-top: 14px; padding: 13px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app .main { margin-left: 0; padding: 18px 16px 110px; }
  .side {
    position: sticky; top: 0; inset: auto; width: auto; flex-direction: row; align-items: center; gap: 10px;
    padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0; }
  .brand-t small { display: none; }
  .side { flex-wrap: wrap; justify-content: space-between; row-gap: 8px; }
  .nav { order: 3; flex: 1 1 100%; flex-direction: row; gap: 4px; }
  .nav a { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; padding: 7px 4px; font-size: 11.5px; text-align: center; }
  .nav a .l-full { display: none; }
  .nav a .l-short { display: block; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .side-foot { border-top: 0; padding: 0; }
  .who { display: none; }
  .row { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .group-h { padding: 16px; }
  .banner-preview { margin: 16px 16px 2px; }
  .hero { padding: 20px; border-radius: 18px; }
  h1 { font-size: 24px; }
}
@media (max-width: 600px) {
  .hide-sm { display: none; }
  .stat-n { font-size: 24px; }
  .seg-o { flex: 1 1 100%; }
  .seg-many .seg-o { flex: 1 1 calc(50% - 4px); }
  .savebar { bottom: 10px; padding: 10px; }
  .savebar .btn.ghost { display: none; }
  .savebar-t { min-width: 0; font-size: 13px; }
  .tok { max-width: 140px; }
}

/* banner "standard" is a normal choice, not a warning */
[data-field="banner_enabled"] .seg-off input:checked + span { background: var(--surface-3); color: var(--text); }
.group { scroll-margin-top: 80px; }

/* phones: table rows become cards, nothing scrolls sideways */
@media (max-width: 600px) {
  .card.flush { overflow-x: visible; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .tbl tr:last-child { border-bottom: 0; }
  .tbl td { padding: 3px 0; border: 0; text-align: left; }
  .tbl td.hide-sm { display: none; }
  .tbl td.right { margin-top: 8px; }
  .tbl td.right .btn { width: 100%; }
  .tok { max-width: 100%; }
}
