:root{
  --surface: rgba(var(--tone-1),0.58);
  --surface-elevated: rgba(var(--tone-1),0.82);
  --surface-muted: rgba(var(--tone-0),0.18);
  --text-strong: rgba(var(--tone-text-hi),0.98);
  --text-muted: rgba(var(--tone-text-mid),0.78);
  --text-soft: rgba(var(--tone-text-mid),0.62);
  --border-subtle: rgba(148,163,184,0.18);
  --border-strong: rgba(96,165,250,0.28);
  --shadow-sm: 0 10px 30px rgba(2,6,23,0.18);
  --shadow-md: 0 22px 60px rgba(2,6,23,0.26);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  /* unified token source (dark) */
  --font-sans:"Sora","Plus Jakarta Sans","Noto Sans SC","Segoe UI",ui-sans-serif,system-ui,-apple-system,sans-serif;
  --font-title:"Rajdhani","Sora","Noto Sans SC","Segoe UI",ui-sans-serif,system-ui,-apple-system,sans-serif;
  --font-mono:"JetBrains Mono","SFMono-Regular",Menlo,Monaco,Consolas,monospace;

  --tone-0:9,12,19;
  --tone-1:16,22,34;
  --tone-2:26,36,54;
  --tone-3:14,20,32;
  --tone-line:170,196,232;
  --tone-text-hi:237,245,255;
  --tone-text-mid:174,196,224;

  --bg:#090c13;
  --bg2:#0d1220;
  --glass-bg:rgba(16,22,34,0.72);
  --glass-bg-hover:rgba(22,31,46,0.86);
  --glass-border:rgba(126,168,221,0.24);
  --glass-border-highlight:rgba(126,168,221,0.4);
  --surface:var(--glass-bg);
  --surface-strong:rgba(16,22,34,0.92);
  --surface-2:rgba(24,33,50,0.72);
  --text:#edf5ff;
  --muted:#9ab0cd;
  --line:rgba(126,168,221,0.24);
  --line-strong:rgba(126,168,221,0.4);
  --ok:#25d07f;
  --bad:#ff5b6e;
  --warn:#ffb11a;
  --accent:#2f8fff;
  --accent2:#12c8ff;
  --bg-flow-1:rgba(47,143,255,0.22);
  --bg-flow-2:rgba(18,200,255,0.16);
  --bg-flow-3:rgba(98,131,255,0.12);
  --bg-flow-4:rgba(37,208,127,0.09);
  --bg-noise-opacity:0.055;
  --bg-noise-blend:overlay;
  --logo-shadow:0 12px 28px rgba(4,10,25,0.56);
  --btn-shadow:0 10px 22px rgba(10,88,188,0.4);
  --btn-shadow-hover:0 14px 30px rgba(10,88,188,0.52);
  --menu-backdrop:rgba(6,12,25,0.56);
  --hero-grad-1:rgba(22,146,255,0.2);
  --hero-grad-2:rgba(18,200,255,0.15);
  --hero-grad-3:rgba(43,123,255,0.1);
  --hero-surface-top:rgba(17,24,38,0.85);
  --hero-surface-bot:rgba(12,17,28,0.72);
  --hero-line:rgba(130,187,255,0.22);

  --radius:18px;
  --radius-sm:12px;
  --radius-xs:10px;
  --radius-pill:999px;
  --space-1:4px;
  --space-2:8px;
  --space-3:12px;
  --space-4:16px;
  --space-5:20px;
  --space-6:24px;
  --space-7:28px;
  --space-8:32px;
  --container:1520px;

  /* sticky offsets (topbar height + breathing space) */
  /* iOS notch safe-area support */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --sticky-top: calc(88px + var(--safe-top));

  /* motion */
  --motion-fast:140ms;
  --motion-base:180ms;
  --motion-expand:240ms;
  --ease-standard:cubic-bezier(0.2,0.7,0.2,1);
  --ease-emphasis:cubic-bezier(0.2,0.75,0.2,1);
  --hover-lift:-1px;
  --press-lift:0px;

  /* effects */
  --shadow:0 14px 38px rgba(3,8,20,0.5);
  --glow:0 0 0 1px rgba(136,182,244,0.18),0 18px 54px rgba(4,10,25,0.58);
}

:root[data-theme="light"]{
  --tone-0:243,247,255;
  --tone-1:255,255,255;
  --tone-2:232,240,252;
  --tone-3:223,233,247;
  --tone-line:23,60,105;
  --tone-text-hi:16,33,57;
  --tone-text-mid:64,86,118;

  --bg:#eff5ff;
  --bg2:#e7f0fd;
  --glass-bg:rgba(255,255,255,0.84);
  --glass-bg-hover:rgba(255,255,255,0.96);
  --glass-border:rgba(23,60,105,0.17);
  --glass-border-highlight:rgba(23,60,105,0.3);
  --surface:var(--glass-bg);
  --surface-strong:rgba(255,255,255,0.96);
  --surface-2:rgba(239,246,255,0.88);
  --text:#102139;
  --muted:#466084;
  --line:rgba(23,60,105,0.17);
  --line-strong:rgba(23,60,105,0.3);
  --accent:#1672ef;
  --accent2:#0aa7dc;
  --ok:#119b63;
  --warn:#bb7b00;
  --bad:#cf3045;

  --bg-flow-1:rgba(22,114,239,0.16);
  --bg-flow-2:rgba(10,167,220,0.14);
  --bg-flow-3:rgba(18,117,255,0.1);
  --bg-flow-4:rgba(30,164,123,0.07);
  --bg-noise-opacity:0.025;
  --bg-noise-blend:multiply;
  --logo-shadow:0 8px 20px rgba(15,23,42,0.12);
  --btn-shadow:0 8px 18px rgba(22,114,239,0.25);
  --btn-shadow-hover:0 11px 24px rgba(22,114,239,0.32);
  --menu-backdrop:rgba(15,23,42,0.10);
  --hero-grad-1:rgba(22,114,239,0.14);
  --hero-grad-2:rgba(10,167,220,0.12);
  --hero-grad-3:rgba(22,114,239,0.08);
  --hero-surface-top:rgba(255,255,255,0.97);
  --hero-surface-bot:rgba(239,246,255,0.88);
  --hero-line:rgba(23,60,105,0.2);

  --shadow:0 10px 26px rgba(18,38,66,0.14);
  --glow:0 0 0 1px rgba(23,60,105,0.08),0 12px 28px rgba(18,38,66,0.12);
}

*{box-sizing:border-box}

html,body{height:100%}
html{color-scheme:dark}
html[data-theme="light"]{color-scheme:light}

body{
  margin:0;
  font-family:var(--font-sans);
  color:var(--text);
  background: var(--bg);
  min-height:100vh;
  line-height:1.35;
  overflow-x:hidden;
}

/* =========================
   Flowing background (fixed, seamless)
   ========================= */
.bg-flow,
.bg-noise{
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:0;
}

.bg-flow{
  inset:-25%;
  background:
    radial-gradient(1200px 680px at 14% 18%, var(--bg-flow-1), transparent 60%),
    radial-gradient(980px 680px at 88% 14%, var(--bg-flow-2), transparent 62%),
    radial-gradient(980px 680px at 40% 88%, var(--bg-flow-3), transparent 62%),
    radial-gradient(1100px 760px at 78% 78%, var(--bg-flow-4), transparent 65%);
  filter: saturate(110%) contrast(105%);
  transform: translate3d(0,0,0);
  animation: bgFlow 18s ease-in-out infinite;
}

.bg-noise{
  opacity:var(--bg-noise-opacity);
  mix-blend-mode: var(--bg-noise-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  background-size: 240px 240px;
}

@keyframes bgFlow{
  0%{transform: translate3d(-1.8%, -1.2%, 0) scale(1.03);}
  50%{transform: translate3d(1.6%, -2.4%, 0) scale(1.06);}
  100%{transform: translate3d(1.2%, 1.6%, 0) scale(1.04);}
}

@media (prefers-reduced-motion: reduce){
  .bg-flow{animation:none}
}

@media (max-width: 720px){
  :root{ --sticky-top: calc(58px + var(--safe-top)); }

  .netmon-toolbar .help{ display:none; }
  .netmon-meta{ display:none; }
  .netmon-events-bar{ height:16px; }
  .netmon-event{ min-width:12px; }
  .netmon-event, .netmon-evt-row{ touch-action: manipulation; }
}

@media (max-width: 420px){
  :root{ --sticky-top: calc(54px + var(--safe-top)); }
}

a{color:inherit}

/* Top bar */
.skip-link{
  position:fixed;
  left:16px;
  top:12px;
  z-index:120;
  padding:10px 14px;
  border-radius:999px;
  background:rgba(15,23,42,0.96);
  color:#f8fafc;
  border:1px solid rgba(96,165,250,0.36);
  box-shadow:var(--shadow-sm);
  transform:translateY(-140%);
  transition:transform .18s ease, opacity .18s ease;
  opacity:0;
}
.skip-link:focus{
  transform:translateY(0);
  opacity:1;
}
.page-shell{
  position:relative;
  z-index:1;
}
.page-frame{
  position:relative;
}
.page-content{
  display:flex;
  flex-direction:column;
  gap:var(--space-6);
  min-height:calc(100vh - 180px);
}
.page-head-status{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:10px;
}
.toolbar-panel{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  padding:12px 14px;
  border:1px solid var(--border-subtle);
  border-radius:var(--radius-md);
  background:linear-gradient(180deg, rgba(var(--tone-0),0.22), rgba(var(--tone-0),0.14));
  box-shadow:var(--shadow-sm);
}
.topbar{
  position:sticky;top:0;z-index:20;
  display:flex;align-items:center;justify-content:space-between;
  gap:12px;
  padding: calc(12px + var(--safe-top)) 16px 12px 16px;
  background:
    radial-gradient(130% 180% at 0% 0%, var(--hero-grad-1), transparent 58%),
    radial-gradient(110% 140% at 100% 100%, var(--hero-grad-2), transparent 64%),
    linear-gradient(180deg, rgba(var(--tone-1),0.92), rgba(var(--tone-1),0.82));
  border-bottom:1px solid var(--line);
  backdrop-filter:blur(18px);
  box-shadow:var(--shadow);
}
.brand{display:flex;align-items:center;gap:10px;text-decoration:none}
.logo{
  width:34px;height:34px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;
  background:rgba(var(--tone-2),0.45);
  border:1px solid rgba(var(--tone-line),0.10);
  box-shadow:var(--logo-shadow);
  overflow:hidden;
}
.logo-img{width:28px;height:28px;display:block}
.brand-text{display:flex;flex-direction:column;gap:0}
.brand-name{font-weight:850;letter-spacing:0.3px}
.brand-sub{font-size:12px;color:var(--muted)}
.top-actions{display:flex;align-items:center;gap:10px;min-width:0}
.nav{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.nav-link{
  color:var(--muted);
  text-decoration:none;
  padding:7px 10px;
  border-radius:12px;
  border:1px solid transparent;
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard),
    color var(--motion-base) var(--ease-standard);
}
.nav-link:hover{
  transform:translateY(var(--hover-lift));
  border-color:var(--line);
  background:var(--surface-2);
  color:var(--text);
}
.nav-link:active{transform:translateY(var(--press-lift))}
.nav-link.active{
  color:var(--text);
  border-color:rgba(59,130,246,0.38);
  background:rgba(59,130,246,0.16);
  box-shadow:0 0 0 1px rgba(59,130,246,0.18) inset;
}

/* Nav: desktop vs mobile (hamburger) */
.nav-desktop{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.nav-mobile{display:none}
.nav-mobile .menu-item.active{
  background:rgba(59,130,246,0.16);
  border-color:rgba(59,130,246,0.34);
  color:var(--text);
}

@media (max-width: 640px){
  .nav{gap:8px}
  .nav-desktop{display:none}
  .nav-mobile{display:inline-block}
}


/*
  NOTE
  ----
  Don't create a stacking context on the main container.
  Otherwise, fixed modals rendered inside <main> can be trapped *under* the sticky topbar.
*/
.container{max-width:var(--container);margin:0 auto;padding:14px 16px calc(14px + var(--safe-bottom)) 16px;position:relative}
.footer{max-width:var(--container);margin:0 auto;padding:12px 16px calc(12px + var(--safe-bottom)) 16px;color:var(--muted);font-size:12px;position:relative}

/* Layout helpers */
.row{display:flex;gap:12px;align-items:center}
.col{flex:1;min-width:0}
.right{display:flex;gap:8px;justify-content:flex-end;align-items:center;flex-wrap:wrap}
/* Legacy layout aliases (still used by fallback templates) */
.row.between{justify-content:space-between}
.mt{margin-top:12px}
.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.tabs{display:flex;gap:8px;flex-wrap:wrap}
.tab{
  appearance:none;
  border:1px solid rgba(148,163,184,0.18);
  background:rgba(var(--tone-0),0.12);
  color:var(--muted);
  padding:7px 10px;
  border-radius:10px;
  cursor:pointer;
  font-size:12px;
}
.tab.active{
  color:var(--text);
  border-color:rgba(59,130,246,0.42);
  background:rgba(59,130,246,0.16);
}
.tab-panel.hidden,.hidden{display:none !important}
.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(10,14,30,0.68);
  backdrop-filter:blur(8px);
  z-index:48;
}
.topology{
  min-height:320px;
  border:1px solid var(--line);
  border-radius:12px;
  background:rgba(var(--tone-1),0.36);
  overflow:auto;
}
.pre{
  margin:0;
  white-space:pre-wrap;
  word-break:break-word;
  color:rgba(var(--tone-text-mid),0.88);
}

.page-head{
  position:relative;
  padding:18px 20px;
  border:1px solid var(--border-subtle);
  border-radius:var(--radius-lg);
  background:
    radial-gradient(120% 130% at 0% 0%, rgba(59,130,246,0.16), transparent 58%),
    linear-gradient(180deg, rgba(var(--tone-1),0.82), rgba(var(--tone-0),0.28));
  box-shadow:var(--shadow-sm);
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
  padding:10px 12px;
  border:1px solid rgba(148,163,184,0.18);
  border-radius:16px;
  background:
    radial-gradient(120% 140% at 0% 0%, var(--hero-grad-1), transparent 62%),
    linear-gradient(180deg, rgba(var(--tone-0),0.24), rgba(var(--tone-0),0.16));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.page-title{display:flex;flex-direction:column;gap:6px;min-width:0}
.meta{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.meta-item{color:var(--muted);font-size:12px}

.center-wrap{
  width:100%;
  margin:12px auto 0 auto;
}
.center-wrap.sm{max-width:560px}
.center-wrap.lg{max-width:860px}
.auth-head{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-bottom:12px;
}
.auth-head .auth-sub{
  color:var(--muted);
  font-size:12px;
  line-height:1.5;
}
.auth-head .auth-meta{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}
main.container .center-wrap > .card.center-card{
  padding:18px;
}

@media (max-width: 640px){
  .page-head{flex-direction:column;align-items:stretch;}
  .page-head .right{justify-content:flex-start;}
  /* Mobile: make dropdown menu full-width to prevent it from popping outside viewport */
  .page-head .right details.menu{flex:1 1 100%; width:100%;}
  .page-head .right details.menu summary{width:100%; text-align:center;}
  .center-wrap{margin-top:10px}
  main.container .center-wrap > .card.center-card{padding:14px}
}
@media (max-width: 520px){
  .page-head .right{
    width:100%;
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(132px, 1fr));
    gap:8px;
  }
  .page-head .right > *{min-width:0}
  .page-head .right > .btn,
  .page-head .right > a.btn,
  .page-head .right > details.menu > summary{
    width:100%;
    justify-content:center;
  }
  .page-head{
    padding:9px 10px;
  }
}
@media (max-width: 760px){
  .grid2{grid-template-columns:1fr}
}

/* Typography */
.h1{margin:0;font-size:22px;letter-spacing:0.2px}
.h2{margin:0;font-size:15px;letter-spacing:0.2px}
.muted{color:var(--muted)}
.muted.sm{font-size:11px}
.mono{font-family:ui-monospace,Menlo,Monaco,Consolas,monospace}
.truncate{max-width:520px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* Cards */
.card{
  border:1px solid var(--border-subtle);
  border-radius:var(--radius-lg);
  background:linear-gradient(180deg, var(--surface-elevated), rgba(var(--tone-0),0.18));
  box-shadow:var(--shadow-sm);
  background:
    radial-gradient(130% 150% at 0% 0%, var(--hero-grad-1), transparent 58%),
    radial-gradient(120% 140% at 100% 100%, var(--hero-grad-2), transparent 66%),
    linear-gradient(180deg, var(--hero-surface-top), var(--hero-surface-bot));
  border:1px solid var(--hero-line);
  border-radius:var(--radius);
  padding:14px;
  backdrop-filter:blur(18px);
  box-shadow:var(--glow);
}
.card.compact{padding:12px}
.card-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:10px}
.card-title{font-weight:800;letter-spacing:0.2px}
.card-sub{margin-top:4px;font-size:12px;color:var(--muted)}

.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px;margin-top:12px}

/*
  Prevent horizontal overflow in CSS grid layouts.

  Grid items default to `min-width:auto` (min-content sizing). If any child
  contains long unbreakable text (e.g. a long domain / IP / UA), the item's
  min-content size can exceed the grid track width and force the whole grid
  wider than the viewport.

  By setting `min-width:0` we allow the item to shrink within the track.
*/
.grid > *{min-width:0;}

/* =========================
   Website management UI
   ========================= */
.hero-card{
  display:flex;
  gap:16px;
  align-items:center;
  justify-content:space-between;
  padding:18px;
  border-radius:20px;
  border:1px solid rgba(148,163,184,0.18);
  background: radial-gradient(1400px 400px at 0% 0%, rgba(59,130,246,0.14), transparent 60%),
              linear-gradient(180deg, rgba(var(--tone-1),0.72), rgba(var(--tone-0),0.72));
  box-shadow: var(--glow);
}
.hero-left{display:flex;flex-direction:column;gap:8px;min-width:0}
.hero-title{font-size:24px;font-weight:900;letter-spacing:0.2px}
.hero-sub{color:var(--muted);font-size:12px;line-height:1.5}
.hero-metrics{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px}
.hero-right{display:flex;gap:10px;flex-wrap:wrap}

.stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px;margin-top:12px}
.stat-card{padding:12px;border-radius:16px;border:1px solid rgba(148,163,184,0.18);background:rgba(var(--tone-0),0.22)}
.stat-label{color:var(--muted);font-size:11px;margin-bottom:6px}
.stat-value{font-size:20px;font-weight:900}

.panel{
  padding:12px;
  border-radius:16px;
  border:1px solid rgba(148,163,184,0.20);
  background:
    radial-gradient(120% 130% at 0% 0%, var(--hero-grad-1), transparent 66%),
    linear-gradient(180deg, rgba(var(--tone-0),0.28), rgba(var(--tone-0),0.18));
}
.panel + .panel{margin-top:10px}
.panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.panel-title{font-weight:800}
.panel-sub{color:var(--muted);font-size:12px;margin-top:4px}
.panel-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}

.kv-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px}
.kv-item{padding:10px;border-radius:14px;border:1px solid rgba(148,163,184,0.16);background:rgba(var(--tone-0),0.18)}
.kv-label{color:var(--muted);font-size:11px}
.kv-value{margin-top:6px;font-weight:700;word-break:break-word}

.form-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.form-grid .col{min-width:0}

.toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.toolbar .input{max-width:220px}

.site-table .muted-row{color:var(--muted);font-size:12px}

.file-path{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.file-path a{color:var(--text);text-decoration:none}
.file-path .sep{color:var(--muted)}

@media (max-width: 980px){
  .hero-card{flex-direction:column;align-items:flex-start}
  .hero-right{width:100%;justify-content:flex-start}
  .form-grid{grid-template-columns:1fr}
  .websites-grid{grid-template-columns:1fr !important;}
}

/* =========================
   Websites: premium layout
   ========================= */

.websites-layout{
  display:grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap:12px;
  margin-top:12px;
}

.websites-side{
  position:sticky;
  top: var(--sticky-top);
  align-self:start;
}

.websites-side .section-sub{max-width:44ch;}

@media (max-width: 980px){
  .websites-layout{grid-template-columns:1fr;}
  .websites-side{position:static;}
}

.node-acc{
  border:1px solid rgba(148,163,184,0.18);
  border-radius:16px;
  background: rgba(var(--tone-0),0.16);
  overflow:hidden;
}
.node-acc + .node-acc{ margin-top:10px; }
.node-acc > summary{
  cursor:pointer;
  list-style:none;
  padding:12px 12px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.node-acc > summary::-webkit-details-marker{ display:none; }
.node-acc:hover{ border-color: rgba(59,130,246,0.32); background: rgba(59,130,246,0.06); }

.node-acc-title{ font-weight:900; letter-spacing:0.2px; }
.node-acc-sub{ color: var(--muted); font-size:12px; margin-top:4px; }
.node-acc-right{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }

.node-acc-body{
  padding: 0 12px 12px 12px;
  border-top:1px solid rgba(148,163,184,0.14);
  background: rgba(var(--tone-3),0.18);
}

.node-actions{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
  margin-top:10px;
}

.node-actions .action-box{
  border:1px solid rgba(148,163,184,0.16);
  background: rgba(var(--tone-0),0.10);
  border-radius:14px;
  padding:10px;
}

.node-actions .action-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.node-actions .action-title{ font-weight:850; font-size:12px; }
.node-actions .action-sub{ color:var(--muted); font-size:11px; margin-top:4px; line-height:1.45; }

.node-actions .action-form{ margin-top:10px; display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.node-actions .action-form .help{ margin:0; }

@media (max-width: 640px){
  .node-actions .action-form{ flex-direction:column; align-items:stretch; }
  .node-actions .action-form .btn{ width:100%; justify-content:center; }
}

.sites-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin-top:10px;
}

.sites-toolbar-left{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.sites-toolbar-right{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

.site-search{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 0 10px;
  border-radius: 999px;
  border:1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-0),0.20);
  min-height: 34px;
  flex: 1 1 320px;
  max-width: 520px;
}

.site-search input{
  border:none;
  outline:none;
  background:transparent;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
}

.site-search .ico{ color: rgba(var(--tone-text-mid),0.55); font-size: 12px; }
.site-search .clear{
  appearance:none;
  border:none;
  background:transparent;
  color: rgba(var(--tone-text-mid),0.55);
  cursor:pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  visibility:hidden;
}
.site-search .clear:hover{ color: rgba(var(--tone-text-mid),0.85); }

.site-cards{
  margin-top:12px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:10px;
}

@media (max-width: 980px){
  .site-cards{ grid-template-columns: 1fr; }
}

.site-card{
  background: rgba(var(--tone-1),0.70);
  border:1px solid rgba(148,163,184,0.18);
  border-radius: 18px;
  padding: 12px;
  box-shadow: var(--glow);
  backdrop-filter: blur(18px);
  min-width:0;
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-base) var(--ease-standard),
    box-shadow var(--motion-base) var(--ease-standard);
}

.site-card:hover{
  transform: translateY(var(--hover-lift));
  border-color: rgba(34,211,238,0.35);
  box-shadow: 0 0 0 1px rgba(34,211,238,0.12), 0 24px 80px rgba(0,0,0,0.55);
}
.site-card:active{transform: translateY(var(--press-lift));}

.site-card-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.site-card-title{ font-weight: 950; letter-spacing:0.2px; word-break:break-word; }
.site-card-sub{ margin-top:4px; color: var(--muted); font-size:12px; line-height:1.45; overflow-wrap:anywhere; }
.site-card-actions{ display:flex; gap:8px; align-items:center; flex-shrink:0; }
.site-card-badges{ display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }

.site-card-kv{
  margin-top:10px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}

.site-card-kv .kv{
  border:1px solid rgba(148,163,184,0.14);
  background: rgba(var(--tone-3),0.22);
  border-radius: 14px;
  padding: 10px;
  min-width:0;
}

.site-card-kv .k{ color: var(--muted); font-size:11px; }
.site-card-kv .v{ margin-top:6px; font-weight: 800; font-size:12px; overflow-wrap:anywhere; }

@media (max-width: 520px){
  .site-card-kv{ grid-template-columns: 1fr; }
}

/* =========================
   Website management (v5)
   - Cleaner / more consistent with dashboard cards
   - Mobile-friendly: no off-screen UI / no fixed side column
   ========================= */

.site-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap:10px;
}

.site-tile{
  position:relative;
  padding:12px;
  border-radius:18px;
  background: rgba(var(--tone-1),0.70);
  border:1px solid rgba(148,163,184,0.18);
  box-shadow: var(--glow);
  backdrop-filter: blur(18px);
  overflow:hidden;
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-base) var(--ease-standard),
    box-shadow var(--motion-base) var(--ease-standard);
}

.site-tile::before{
  content:"";
  position:absolute;
  left:-1px;
  top:-1px;
  bottom:-1px;
  width:4px;
  border-radius:18px 0 0 18px;
  background: rgba(148,163,184,0.20);
}

.site-tile[data-status="running"]::before{
  background: linear-gradient(180deg, rgba(34,197,94,0.95), rgba(34,197,94,0.25));
}
.site-tile[data-status="creating"]::before{
  background: linear-gradient(180deg, rgba(245,158,11,0.95), rgba(245,158,11,0.25));
}
.site-tile[data-status="error"]::before{
  background: linear-gradient(180deg, rgba(239,68,68,0.95), rgba(239,68,68,0.25));
}

.site-tile:hover{
  transform: translateY(var(--hover-lift));
  border-color: rgba(34,211,238,0.35);
  box-shadow: 0 0 0 1px rgba(34,211,238,0.12), 0 24px 80px rgba(0,0,0,0.55);
}
.site-tile:active{transform: translateY(var(--press-lift));}

.site-tile[data-health="fail"]{ border-color: rgba(239,68,68,0.35); }

.site-top{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.site-left{ min-width:0; }
.site-name{ font-weight:950; letter-spacing:0.2px; word-break:break-word; }
.site-domain{ margin-top:4px; color: var(--muted); font-size:12px; line-height:1.45; overflow-wrap:anywhere; }
.site-right{ display:flex; gap:8px; align-items:center; flex-shrink:0; flex-wrap:wrap; justify-content:flex-end; }

.site-meta{ display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }

.site-kpis{
  margin-top:10px;
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:10px;
}

.site-kpi{
  border:1px solid rgba(148,163,184,0.14);
  background: rgba(var(--tone-3),0.22);
  border-radius:14px;
  padding:10px;
  min-width:0;
}
.site-kpi .k{ color: var(--muted); font-size:11px; }
.site-kpi .v{ margin-top:6px; font-weight:800; font-size:12px; overflow-wrap:anywhere; }

@media (max-width: 720px){
  .site-kpis{ grid-template-columns: 1fr; }
}

@media (max-width: 520px){
  .site-top{ flex-wrap:wrap; }
  .site-right{ width:100%; justify-content:flex-end; }
}

/* Site detail: certificate error panel should not push table layout on narrow screens */
.site-cert-error-details{
  max-width:min(460px, 100%);
}
.site-cert-error-details summary{
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* Websites page: website nodes accordion */
.wm-acc{ padding:0; }
.wm-acc-summary{
  cursor:pointer;
  list-style:none;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  padding:14px;
}
.wm-acc-summary::-webkit-details-marker{ display:none; }
.wm-acc[open] .wm-acc-summary{
  border-bottom:1px solid rgba(148,163,184,0.14);
  background: rgba(148,163,184,0.06);
}
.wm-acc-title{ font-weight:900; letter-spacing:0.2px; }
.wm-acc-sub{ margin-top:4px; color:var(--muted); font-size:12px; line-height:1.45; }
.wm-acc-right{ display:flex; align-items:center; gap:8px; flex-shrink:0; flex-wrap:wrap; }
.wm-acc-body{ padding:14px; }

.node-lite{
  padding:12px;
  border-radius:18px;
  background: rgba(var(--tone-1),0.66);
  border:1px solid rgba(148,163,184,0.18);
  box-shadow: var(--glow);
  backdrop-filter: blur(18px);
}
.node-lite-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.node-lite-left{ min-width:0; }
.node-lite-name{ font-weight:950; letter-spacing:0.2px; }
.node-lite-url{ margin-top:4px; color: var(--muted); font-size:12px; overflow-wrap:anywhere; }
.node-lite-actions{ display:flex; align-items:center; gap:8px; flex-shrink:0; }
.node-lite-meta{ color: rgba(var(--tone-text-mid),0.82); font-size:12px; }
.node-lite-badges{ margin-top:10px; display:flex; flex-wrap:wrap; gap:8px; }

/* =========================
   Website management PRO (v7)
   - Denser, more "console"-like
   - Better space utilization on wide screens
   ========================= */

.wm-layout{
  display:grid;
  grid-template-columns: minmax(0,1fr) 420px;
  gap:12px;
  margin-top:12px;
}

.wm-card{padding:12px; border-radius:18px;}

.wm-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}

.wm-card-title{font-weight:950; letter-spacing:0.2px;}
.wm-card-sub{margin-top:4px; font-size:12px; color:var(--muted); line-height:1.45;}

.wm-card-tools{display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end;}

.wm-fav-card{margin-top:12px;}
.wm-fav-grid{
  margin-top:10px;
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:10px;
}
.wm-fav-item{
  border:1px solid rgba(148,163,184,0.2);
  border-radius:14px;
  background:rgba(var(--tone-3),0.2);
  overflow:hidden;
}
.wm-fav-main{
  width:100%;
  text-align:left;
  border:none;
  color:inherit;
  background:transparent;
  padding:10px;
  cursor:pointer;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.wm-fav-main:hover{
  background:rgba(59,130,246,0.08);
}
.wm-fav-main-top{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.wm-fav-star{
  color:#f59e0b;
  font-size:14px;
  line-height:1;
}
.wm-fav-name{
  font-weight:850;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.wm-fav-path{
  font-size:11px;
  color:rgba(var(--tone-text-mid),0.78);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.wm-fav-meta{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
  font-size:11px;
  color:var(--muted);
}
.wm-fav-actions{
  padding:0 10px 10px;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.wm-fav-unstar{
  color:rgba(254,202,202,0.95);
  border-color:rgba(248,113,113,0.32);
  background:rgba(248,113,113,0.08);
}
.wm-fav-unstar:hover{
  background:rgba(248,113,113,0.14);
}
.wm-fav-empty{
  border:1px dashed rgba(148,163,184,0.3);
  border-radius:12px;
  padding:14px;
  color:var(--muted);
  font-size:12px;
}
.wm-favorite-modal-inner{
  width:min(1360px, calc(100vw - 24px));
}
.wm-favorite-modal-body{
  padding:12px;
}
.wm-favorite-frame{
  width:100%;
  height:calc(100vh - 170px);
  height:calc(100dvh - 170px);
  min-height:520px;
  border:1px solid rgba(148,163,184,0.24);
  border-radius:14px;
  background:rgba(var(--tone-1),0.52);
}

.wm-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin-top:10px;
}

.wm-sites{margin-top:10px; display:flex; flex-direction:column; gap:8px;}

.wm-site-row{
  position:relative;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  padding:10px 10px 10px 14px;
  border-radius:16px;
  border:1px solid rgba(148,163,184,0.16);
  background: rgba(var(--tone-3),0.22);
  overflow:hidden;
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard);
}

.wm-site-row::before{
  content:"";
  position:absolute;
  left:0;
  top:8px;
  bottom:8px;
  width:3px;
  border-radius:999px;
  background: rgba(148,163,184,0.28);
}

.wm-site-row[data-status="running"]::before{ background: linear-gradient(180deg, rgba(34,197,94,0.95), rgba(34,197,94,0.25)); }
.wm-site-row[data-status="creating"]::before{ background: linear-gradient(180deg, rgba(245,158,11,0.95), rgba(245,158,11,0.25)); }
.wm-site-row[data-status="error"]::before{ background: linear-gradient(180deg, rgba(239,68,68,0.95), rgba(239,68,68,0.25)); }

.wm-site-row:hover{
  transform: translateY(var(--hover-lift));
  border-color: rgba(34,211,238,0.32);
  background: rgba(59,130,246,0.06);
}
.wm-site-row:active{transform: translateY(var(--press-lift));}

.wm-site-row[data-health="fail"]{ border-color: rgba(239,68,68,0.34); }

.wm-site-left{min-width:0; flex:1 1 auto;}

.wm-site-line1{display:flex; align-items:center; gap:8px; flex-wrap:wrap;}
.wm-site-name{font-weight:950; letter-spacing:0.2px;}

.wm-site-line2{display:flex; align-items:center; gap:8px; margin-top:4px; flex-wrap:wrap;}
.wm-site-domain{color: rgba(var(--tone-text-mid),0.78); font-size:12px; overflow-wrap:anywhere;}
.wm-site-hint{color: var(--muted); font-size:12px;}

.wm-site-right{display:flex; align-items:flex-start; gap:10px; flex:0 0 auto; flex-wrap:wrap; justify-content:flex-end;}

.wm-site-kpis{display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end;}
.wm-kpi{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:5px 8px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,0.14);
  background: rgba(var(--tone-0),0.16);
  color: rgba(var(--tone-text-mid),0.82);
  font-size:11px;
}

.wm-site-actions{display:flex; align-items:center; gap:8px;}

.wm-node-list{margin-top:10px; display:flex; flex-direction:column; gap:8px;}
.wm-node-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  padding:10px;
  border-radius:16px;
  border:1px solid rgba(148,163,184,0.16);
  background: rgba(var(--tone-3),0.20);
}
.wm-node-name{font-weight:950; letter-spacing:0.2px;}
.wm-node-url{margin-top:4px; color:var(--muted); font-size:12px; overflow-wrap:anywhere;}
.wm-node-meta{margin-top:6px; color:rgba(var(--tone-text-mid),0.82); font-size:12px;}
.wm-node-badges{margin-top:8px; display:flex; flex-wrap:wrap; gap:8px;}
.wm-node-quick{margin-top:10px; display:flex; align-items:center; gap:8px; flex-wrap:wrap;}
.wm-node-quick form{margin:0;}
.wm-node-actions{display:flex; align-items:center; gap:8px; flex-shrink:0;}

@media (max-width: 1160px){
  .wm-layout{grid-template-columns: 1fr;}
}

@media (max-width: 640px){
  .wm-layout{gap:10px;}
  .wm-card{padding:10px;}
  .wm-fav-grid{grid-template-columns:1fr;}
  .wm-favorite-modal-inner{width:min(1360px, calc(100vw - 12px));}
  .wm-favorite-modal-body{padding:8px;}
  .wm-favorite-frame{height:calc(100vh - 140px);height:calc(100dvh - 140px);min-height:360px;}
  .wm-card-head{flex-wrap:wrap;}
  .wm-card-tools{width:100%; justify-content:flex-start;}
  .wm-toolbar{flex-direction:column; align-items:stretch;}
  .wm-toolbar .dash-filters{width:100%;}
  .wm-toolbar .dash-search{width:100%;}

  .wm-site-row{
    flex-direction:column;
    align-items:stretch;
    gap:8px;
    padding:10px 10px 10px 12px;
  }
  .wm-site-left,
  .wm-site-right{
    width:100%;
    min-width:0;
  }
  .wm-site-line1{
    gap:6px;
  }
  .wm-site-line2{
    display:block;
    margin-top:6px;
    line-height:1.45;
  }
  .wm-site-domain{
    display:block;
    max-width:100%;
    white-space:normal;
    overflow-wrap:anywhere;
    word-break:break-word;
  }
  .wm-site-hint{
    display:inline-block;
    margin-top:3px;
  }
  .wm-site-right{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:start;
    gap:8px;
  }
  .wm-site-kpis{
    justify-content:flex-start;
    flex-wrap:nowrap;
    overflow-x:auto;
    padding-bottom:2px;
    scrollbar-width:none;
  }
  .wm-site-kpis::-webkit-scrollbar{display:none;}
  .wm-kpi{
    padding:4px 8px;
    flex:0 0 auto;
  }
  .wm-site-actions{
    margin-left:0;
    justify-self:end;
  }

  .wm-node-row{
    flex-direction:column;
    align-items:stretch;
    gap:8px;
  }
  .wm-node-quick{
    margin-top:8px;
  }
  .wm-node-actions{
    justify-content:flex-end;
  }
}

/* Websites: create-site modal */
.wm-create-modal{
  z-index: 70;
}

.wm-create-inner{
  width: min(980px, calc(100vw - 40px));
}

.wm-create-head .title-wrap{
  min-width: 0;
  max-width: min(72ch, 100%);
}

.wm-create-body{
  padding: 12px 14px 14px;
}

.wm-create-section{
  background: rgba(var(--tone-3),0.24);
}

.wm-create-grid{
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#wmCreateProxyRow{
  display: none;
}

.wm-create-actions{
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 900px){
  .wm-create-inner{
    width: min(980px, calc(100vw - 24px));
  }
}

@media (max-width: 720px){
  .wm-create-modal{
    padding: 10px;
    align-items: flex-end;
  }

  .wm-create-inner{
    width: 100%;
    max-height: calc(100vh - 10px);
    max-height: calc(100dvh - 10px);
    border-radius: 16px;
  }

  .wm-create-body{
    padding: 10px 12px 14px;
  }

  .wm-create-grid{
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .wm-create-actions{
    position: sticky;
    bottom: 0;
    padding-top: 10px;
    padding-bottom: max(0px, var(--safe-bottom));
    background: linear-gradient(180deg, rgba(var(--tone-1),0), rgba(var(--tone-1),0.92) 38%, rgba(var(--tone-1),0.96));
  }

  .wm-create-actions .btn{
  border-radius:var(--radius-sm);
    flex: 1 1 auto;
    min-width: 0;
  }
}

@media (max-width: 420px){
  .wm-create-head .h2{
    font-size: 15px;
  }
}

/* =========================
   Site subpages (detail / diagnose / files)
   - Compact two-column layout
   - Dense data tables
   ========================= */

.site-layout{
  display:grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap:12px;
  margin-top:12px;
}

.site-stack{
  display:flex;
  flex-direction:column;
  gap:12px;
  min-width:0;
}

@media (max-width: 1160px){
  .site-layout{grid-template-columns: 1fr;}
}

.site-layout.site-layout-detail{
  grid-template-columns:minmax(0,1.08fr) minmax(0,0.92fr);
  align-items:start;
}

.site-layout.site-layout-diagnose{
  grid-template-columns:minmax(0,1.12fr) minmax(0,0.88fr);
  align-items:start;
}

.site-layout.site-layout-detail .site-danger-card{
  border-color:rgba(248,113,113,0.20);
  background:linear-gradient(180deg, rgba(239,68,68,0.08), rgba(var(--tone-0),0.28));
}

.site-layout.site-layout-detail .site-danger-card .section-title{
  color:rgba(254,202,202,0.96);
}

@media (max-width: 1280px){
  .site-layout.site-layout-detail{grid-template-columns:1fr;}
  .site-layout.site-layout-diagnose{grid-template-columns:1fr;}
}

.kv-lines{
  display:grid;
  gap:8px;
  margin-top:10px;
}

.kvline .v.wrap{
  white-space:normal;
  overflow:visible;
  text-overflow:clip;
  overflow-wrap:anywhere;
}

.table.dense th,
.table.dense td{
  padding:6px 8px;
}

.table.dense th{ font-size:11px; }
.table.dense td{ font-size:12px; }

.table.dense .pill.xs{
  padding:3px 7px;
  font-size:10px;
}

.diag-side-stack{gap:10px}
.diag-mini-card{padding:10px}
.diag-mini-stats{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:8px;
}
.diag-feed{
  display:flex;
  flex-direction:column;
  gap:6px;
  max-height:250px;
  overflow:auto;
  padding-right:2px;
}
.diag-feed-item{
  border:1px solid rgba(148,163,184,0.16);
  background:rgba(var(--tone-3),0.22);
  border-radius:12px;
  padding:8px 10px;
}
.diag-feed-main{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.diag-feed-time{
  color:rgba(var(--tone-text-mid),0.92);
  font-size:12px;
}
.diag-feed-meta{
  color:rgba(var(--tone-text-mid),0.82);
  font-size:11px;
}
.diag-feed-action{
  color:rgba(var(--tone-text-mid),0.90);
  font-size:12px;
  font-weight:700;
}
.diag-feed-sub{
  margin-top:5px;
  font-size:11px;
  color:var(--muted);
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.diag-feed-error{
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

@media (max-width: 1160px){
  .diag-feed{max-height:none}
}

/* Site sub-navigation (shared across subpages) */
.subnav-bar{
  margin-top:10px;
  position:sticky;
  top: var(--sticky-top);
  z-index: 15;
}

.subnav{
  display:flex;
  gap:8px;
  flex-wrap:nowrap;
  overflow:auto;
  padding:10px;
  border-radius: 18px;
  border:1px solid rgba(148,163,184,0.18);
  background:
    radial-gradient(120% 140% at 0% 0%, var(--hero-grad-1), transparent 62%),
    linear-gradient(180deg, rgba(var(--tone-0),0.34), rgba(var(--tone-0),0.24));
  backdrop-filter: blur(16px);
  box-shadow: var(--glow);
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar{ display:none; }

.subnav a{
  white-space:nowrap;
  text-decoration:none;
  padding: 8px 10px;
  border-radius: 999px;
  border:1px solid transparent;
  color: rgba(var(--tone-text-mid),0.78);
  font-size:12px;
}

.subnav a:hover{ background: rgba(148,163,184,0.10); border-color: rgba(148,163,184,0.16); color: var(--text); }
.subnav a.active{ background: rgba(59,130,246,0.14); border-color: rgba(59,130,246,0.36); color: rgba(var(--tone-text-mid),0.95); }

/* Wizard layout (site new/edit) */
.wizard-layout{
  display:grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap:12px;
  margin-top:12px;
}

.wizard-side{
  position:sticky;
  top: var(--sticky-top);
  align-self:start;
}

.wizard-steps{display:flex; flex-direction:column; gap:8px; margin-top:8px;}
.wizard-step{
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding: 10px;
  border-radius: 16px;
  border:1px solid rgba(148,163,184,0.16);
  background: rgba(var(--tone-3),0.18);
}
.wizard-step .n{
  width:26px; height:26px; min-width:26px;
  border-radius: 999px;
  display:flex; align-items:center; justify-content:center;
  font-weight: 950;
  background: rgba(59,130,246,0.16);
  border:1px solid rgba(59,130,246,0.28);
}
.wizard-step .t{ font-weight: 900; font-size: 12px; }
.wizard-step .d{ color: var(--muted); font-size: 11px; margin-top:4px; line-height:1.45; }

@media (max-width: 980px){
  .wizard-layout{ grid-template-columns: 1fr; }
  .wizard-side{ position:static; }
  .wizard-steps{ flex-direction:row; overflow:auto; padding-bottom:6px; scrollbar-width:none; }
  .wizard-steps::-webkit-scrollbar{ display:none; }
  .wizard-step{ min-width: 240px; }
}

/* =========================
   Dashboard: compact node tile grid
   ========================= */
.grid.node-grid{
  /* denser cards, more columns on wide screens */
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:9px;
  margin-top:8px;
}
/* Dashboard: filters + search */
.dashboard-toolbar{
  padding:12px 14px;
  border:1px solid var(--border-subtle);
  border-radius:var(--radius-md);
  background:linear-gradient(180deg, rgba(var(--tone-1),0.74), rgba(var(--tone-0),0.12));
  box-shadow:var(--shadow-sm);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin: 0 0 6px 0;
  padding: 10px 12px;
  border-radius: 16px;
  border:1px solid rgba(148,163,184,0.18);
  background:
    radial-gradient(120% 130% at 0% 0%, var(--hero-grad-1), transparent 66%),
    linear-gradient(180deg, rgba(var(--tone-0),0.24), rgba(var(--tone-0),0.14));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.dash-filters{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.dash-group{
  grid-column:1/-1;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.dash-group-items{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:9px;
}

.chip{
  appearance:none;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 7px 10px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-0),0.16);
  color: var(--muted);
  font-size:12px;
  cursor:pointer;
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard),
    color var(--motion-base) var(--ease-standard);
}

.chip strong{color: var(--text); font-weight:850;}

.chip:hover{transform: translateY(var(--hover-lift)); border-color: rgba(59,130,246,0.35); background: rgba(59,130,246,0.08); color: var(--text);}
.chip:active{transform: translateY(var(--press-lift));}

.chip.active,
.chip[aria-selected="true"]{
  border-color: rgba(59,130,246,0.50);
  background: rgba(59,130,246,0.12);
  color: rgba(var(--tone-text-mid),0.92);
}

.dash-search{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 0 10px;
  border-radius: 999px;
  border:1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-0),0.20);
  min-height: 34px;
  flex: 1 1 320px;
  max-width: 520px;
}

.dash-search-ico{color: rgba(var(--tone-text-mid),0.55); font-size: 12px;}
.dash-search-input{
  border:none;
  outline:none;
  background:transparent;
  padding: 0;
  flex: 1 1 auto;
  width: 220px;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
}

.dash-search-clear{
  appearance:none;
  border:none;
  background:transparent;
  color: rgba(var(--tone-text-mid),0.55);
  cursor:pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  visibility:hidden;
}

.dash-search-clear:hover{color: rgba(var(--tone-text-mid),0.85);}


/* Dashboard groups */
.dash-group-head{
  grid-column:1/-1;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:7px 10px 5px 10px;
  border:1px solid rgba(148,163,184,0.14);
  border-radius:14px;
  background:
    radial-gradient(120% 130% at 0% 0%, rgba(56,189,248,0.10), transparent 72%),
    linear-gradient(180deg, rgba(var(--tone-0),0.18), rgba(var(--tone-0),0.10));
  transition:
    border-color var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard),
    opacity var(--motion-base) var(--ease-standard);
}
.dash-group-right{display:flex;align-items:center;gap:8px;flex:0 0 auto;}
.dash-group-left{display:flex;align-items:center;gap:10px;min-width:0;flex:1 1 auto;}
.dash-group-name{font-size:12px;font-weight:850;letter-spacing:0.2px;color:rgba(var(--tone-text-mid),0.92);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;padding:2px 6px;border-radius:999px;}
.dash-group-name:hover{background:rgba(148,163,184,0.08);}
.dash-group-name:focus{outline:2px solid rgba(34,211,238,0.45);outline-offset:2px;}
.dash-group-line{height:1px;flex:1 1 auto;border-radius:999px;background:rgba(148,163,184,0.18);}
.dash-group-count{flex:0 0 auto;white-space:nowrap;}

.dash-group-toggle{
  opacity: .9;
  transition: transform var(--motion-fast) var(--ease-standard), opacity var(--motion-base) var(--ease-standard);
}

/* Collapsed groups should still feel "present" */
.dash-group-head.collapsed{opacity:.95}
.dash-group-head.collapsed .dash-group-count{color:rgba(var(--tone-text-mid),0.70)}

.dash-group-head.collapsed .dash-group-toggle{
  transform: rotate(-90deg);
}

.dash-group.collapsed .dash-group-items{
  display:none;
}

@media (max-width: 520px){
  .dash-group-head{flex-wrap:wrap;gap:8px;}
  .dash-group-left{width:100%;}
  .dash-group-line{display:none;}
}

.node-tile{
  position:relative;
  min-width:0;
  max-width:100%;
  overflow:hidden;
  padding:9px;
  border-radius:14px;
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard);
}

.node-tile::before{
  content:"";
  position:absolute;
  left:0;
  top:10px;
  bottom:10px;
  width:2px;
  border-radius:999px;
  opacity:.35;
  background:rgba(148,163,184,0.28);
}

.node-tile[data-online="1"]::before{
  opacity:.9;
  background:linear-gradient(180deg, rgba(34,197,94,0.00), rgba(34,197,94,0.75), rgba(34,211,238,0.35));
}

.node-tile:hover{
  transform: translateY(var(--hover-lift));
  border-color: rgba(59,130,246,0.34);
  background: rgba(59,130,246,0.06);
}
.node-tile:active{transform: translateY(var(--press-lift));}

.node-top{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.node-left{min-width:0}
.node-name{font-size:14px;font-weight:850;letter-spacing:0.2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.node-host{margin-top:4px;font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.node-right{display:flex;align-items:center;gap:8px;flex-shrink:0}
.node-right .btn.icon{flex:0 0 auto}
.node-state{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--muted);padding:6px 8px;border-radius:999px;border:1px solid rgba(148,163,184,0.16);background:rgba(var(--tone-0),0.14)}
.node-dot{width:8px;height:8px;border-radius:999px;display:inline-block;box-shadow:0 0 0 3px rgba(148,163,184,0.10) inset}
.node-dot.online{background:var(--ok)}
.node-dot.offline{background:#64748b}
.node-state.online{color:rgba(34,197,94,0.9);border-color:rgba(34,197,94,0.22);background:rgba(34,197,94,0.06)}
.node-state.offline{color:rgba(148,163,184,0.85)}

/* Compact meta line (uptime + last seen) */
.node-meta{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:8px;
  color: rgba(var(--tone-text-mid),0.60);
  font-size:11px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.node-meta-item{display:inline-flex;gap:6px;align-items:center;min-width:0;}
.node-meta-item .mono{color: rgba(var(--tone-text-mid),0.90);}
.node-meta-sep{opacity:.55;}

/* Traffic / rate in two tight rows */
.node-metrics{display:flex;flex-direction:column;gap:6px;margin-top:8px;min-width:0;}
.metric{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  min-width:0;
  max-width:100%;
  overflow:hidden;
  padding:6px 8px;
  border-radius:12px;
  border:1px solid rgba(var(--tone-line),0.06);
  background:rgba(var(--tone-2),0.36)
}
.metric .k{font-size:11px;color:var(--muted);flex:0 0 auto;min-width:0}
.metric .v{font-size:11px;color:rgba(var(--tone-text-hi),0.95);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1 1 auto;min-width:0;text-align:right}

.node-kpis{display:flex;justify-content:space-between;gap:10px;margin-top:10px}
.kpi{display:flex;flex-direction:column;gap:3px;min-width:0}
.kpi .k{font-size:10px;color:rgba(var(--tone-text-mid),0.55)}
.kpi .v{font-size:12px;color:rgba(var(--tone-text-mid),0.92);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.node-lines{display:grid;gap:8px;margin-top:10px}
.kvline{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:6px 8px;border-radius:12px;border:1px solid rgba(var(--tone-line),0.06);background:rgba(var(--tone-2),0.36)}
.kvline .k{font-size:11px;color:var(--muted);min-width:0}
.kvline .v{font-size:11px;color:rgba(var(--tone-text-hi),0.95);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}

.node-bars{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:10px}
.mbar{padding:6px 8px;border-radius:12px;border:1px solid rgba(var(--tone-line),0.06);background:rgba(var(--tone-2),0.32)}
.mbar .head{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:10px;color:var(--muted);margin-bottom:6px}
.mbar .head .mono{max-width:72px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mini-progress{height:6px;border-radius:999px;background:rgba(0,0,0,0.25);border:1px solid rgba(var(--tone-line),0.06);overflow:hidden}
.mini-fill{height:100%;width:0%;border-radius:999px;background:linear-gradient(90deg, rgba(59,130,246,0.90), rgba(34,211,238,0.88))}

@media (max-width: 720px){
  .grid.node-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .dash-group-items{grid-template-columns:repeat(2,minmax(0,1fr));}
}

@media (max-width: 520px){
  .grid.node-grid{grid-template-columns:1fr;}
  .dash-group-items{grid-template-columns:1fr;}
  /* Mobile dashboard: stacked + swipeable filter chips */
  .dashboard-toolbar{flex-direction:column;align-items:stretch;gap:10px;}
  .dash-filters{flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;padding-bottom:2px;}
  .dash-filters::-webkit-scrollbar{display:none}
  .chip{flex:0 0 auto}
  .dash-search{flex:1 1 100%; max-width:none;}

  /* Mobile node tile: denser */
  .node-tile{padding:8px;border-radius:14px;}
  .node-top{flex-wrap:wrap;}
  .node-right{width:100%; justify-content:flex-end; gap:6px; flex-wrap:wrap; min-width:0;}
  .node-state{padding:5px 7px;}

  /* Put traffic + rate side-by-side on mobile */
  .node-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;}
  .metric{padding:6px 8px;}

  /* CPU/MEM/DISK: show as compact inline chips (hide progress bar) */
  .node-bars{display:flex;gap:6px;margin-top:8px;}
  .mbar{flex:1 1 0;padding:6px 8px;}
  .mbar .head{margin-bottom:0;}
  .mini-progress{display:none;}

  .node-meta{flex-wrap:wrap; white-space:normal;}
  .node-meta-sep{display:none;}
  .mbar .head .mono{max-width:none}
}

@media (max-width: 390px){
  /* Extra-narrow phones: single-column metrics to avoid clipping */
  .node-metrics{grid-template-columns:1fr;}
}

/* Pills */
.pill{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;font-size:12px;border:1px solid var(--line);color:var(--muted);background:var(--surface-2)}
.pill.xs{padding:4px 8px;font-size:11px}
.pill.ok{color:var(--ok);border-color:rgba(34,197,94,0.35);background:rgba(34,197,94,0.08)}
.pill.bad{color:var(--bad);border-color:rgba(239,68,68,0.35);background:rgba(239,68,68,0.08)}
.pill.warn{color:var(--warn);border-color:rgba(245,158,11,0.35);background:rgba(245,158,11,0.10)}
.pill.ghost{color:var(--text);border-color:rgba(var(--tone-line),0.14);background:rgba(var(--tone-line),0.06)}

/* pill buttons (e.g. +N expand) */
button.pill{cursor:pointer;font:inherit}
button.pill:active{transform:translateY(var(--press-lift))}

/* Buttons */
.btn{
  appearance:none;
  display:inline-flex;align-items:center;justify-content:center;
  gap:6px;
  min-height:36px;
  padding:8px 12px;
  border-radius:12px;
  font-size:13px;
  font-weight:650;
  letter-spacing:0.2px;
  text-decoration:none;
  cursor:pointer;
  color:#fff;
  border:1px solid rgba(148,163,184,0.22);
  background:linear-gradient(135deg, rgba(59,130,246,0.96), rgba(34,211,238,0.92));
  box-shadow:var(--btn-shadow);
  transition:
    transform var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard),
    border-color var(--motion-base) var(--ease-standard),
    opacity var(--motion-base) var(--ease-standard);
}
.btn:hover{transform:translateY(var(--hover-lift));box-shadow:var(--btn-shadow-hover)}
.btn:active{transform:translateY(var(--press-lift))}
.btn:disabled{opacity:.55;cursor:not-allowed;transform:none}
.btn.primary{background:linear-gradient(135deg, rgba(34,211,238,0.96), rgba(59,130,246,0.90));border-color:rgba(34,211,238,0.42)}
.btn.ghost{background:rgba(148,163,184,0.10);border:1px solid rgba(148,163,184,0.28);color:var(--text);box-shadow:none}
.btn.secondary{background:rgba(var(--tone-1),0.56);border:1px solid rgba(148,163,184,0.30);color:var(--text);box-shadow:none}
.btn.danger{background:linear-gradient(135deg, rgba(248,113,113,0.92), rgba(239,68,68,0.92));border:1px solid rgba(248,113,113,0.42)}

.btn.sm{min-height:32px;padding:6px 10px;border-radius:11px;font-size:12px}
.btn.xs{min-height:28px;padding:5px 10px;border-radius:11px;font-size:12px}

.btn.icon{padding:0;width:30px;min-width:30px;height:30px;min-height:30px;border-radius:11px;justify-content:center}
.btn.icon.xs{width:28px;min-width:28px;height:28px;min-height:28px;border-radius:10px;font-size:12px}

/* Header theme switch button */
.btn.xs.theme-toggle{
  min-height:30px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
  padding:5px 10px;
}
.btn.xs.theme-toggle .theme-toggle-ico{
  width:14px;
  text-align:center;
  line-height:1;
}
.btn.xs.theme-toggle .theme-toggle-text{font-size:12px}

@media (max-width: 640px){
  .btn.xs.theme-toggle{
    padding:0;
    width:28px;
    min-width:28px;
    height:28px;
    min-height:28px;
  }
  .btn.xs.theme-toggle .theme-toggle-text{display:none}
}

/* Menus */
details.menu{position:relative}
details.menu summary{list-style:none}
details.menu summary::-webkit-details-marker{display:none}
.menu-pop{
  position:absolute;right:0;top:calc(100% + 8px);
  min-width:190px;
  max-width:min(360px, calc(100vw - 24px));
  background:rgba(var(--tone-1),0.94);
  border:1px solid var(--line);
  border-radius:14px;
  padding:8px;
  box-shadow:var(--shadow);
  backdrop-filter:blur(18px);
  z-index:60;
}
.menu-item{
  width:100%;
  display:flex;align-items:center;justify-content:space-between;
  gap:10px;
  padding:9px 10px;
  border-radius:12px;
  border:1px solid transparent;
  background:transparent;
  color:var(--text);
  cursor:pointer;
  text-decoration:none;
  font-size:12px;
  overflow-wrap:anywhere;
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard),
    color var(--motion-base) var(--ease-standard);
}
.menu-item:hover{transform:translateY(var(--hover-lift));background:rgba(148,163,184,0.12);border-color:rgba(148,163,184,0.24)}
.menu-item:active{transform:translateY(var(--press-lift))}
.menu-sep{height:1px;background:rgba(148,163,184,0.16);margin:6px 4px}

/*
  Menus
  -----
  Use a global portal (JS) so popovers never get clipped by overflow containers
  and never fly off-screen.
*/

/* Menu portal (injected by JS) */
.menu-portal{
  position:fixed;
  inset:0;
  z-index:45; /* above topbar (20), below modal (50) */
  pointer-events:none;
}

.menu-portal .menu-backdrop{
  position:absolute;
  inset:0;
  background: var(--menu-backdrop);
  backdrop-filter: blur(2px);
  pointer-events:auto;
  display:none;
}

/* When a menu pop is portaled, it becomes fixed-position within the viewport */
.menu-portal .menu-pop{
  position:fixed;
  pointer-events:auto;
  top:0;
  left:0;
  right:auto;
  bottom:auto;
}

/* Bottom sheet mode (mobile/tablet) */
.menu-portal .menu-pop.sheet{
  left:12px;
  right:12px;
  bottom: calc(12px + var(--safe-bottom));
  top:auto;
  min-width:0;
  max-width:none;
  max-height: min(62vh, calc(100vh - var(--sticky-top) - 24px));
  max-height: min(62vh, calc(100dvh - var(--sticky-top) - 24px));
  overflow:auto;
  border-radius:18px;
  overscroll-behavior: contain;
}

/* Tables */
.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
.table{width:100%;border-collapse:separate;border-spacing:0}
.table th,.table td{padding:10px 10px;border-bottom:1px solid var(--border-subtle);text-align:left;font-size:13px;vertical-align:top}
.table th{color:var(--text-soft);font-weight:800;background:rgba(var(--tone-0),0.14)}
.table tr:hover td{background:rgba(148,163,184,0.06)}
.table.no-sticky thead th{
  position:static;
  top:auto;
  z-index:auto;
  background: rgba(var(--tone-0),0.98);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}

/* File manager */
.fm-card{padding:14px}
.fm-pathbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  padding-bottom:10px;
  border-bottom:1px solid var(--line);
}
.fm-crumbs{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.fm-crumb-trail{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.fm-crumb-trail a{
  text-decoration:none;
  padding:4px 8px;
  border-radius:10px;
  border:1px solid rgba(148,163,184,0.22);
  background:rgba(148,163,184,0.08);
}
.fm-crumb-trail .sep{color:var(--muted)}
.fm-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-top:12px;
}
.fm-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.fm-upload-form{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.fm-mkdir{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.fm-file-input{display:none}
.fm-selection{white-space:nowrap}
.fm-divider{width:1px;height:26px;background:var(--line);margin:0 4px}
.fm-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.fm-search{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.fm-search .input{min-width:220px;max-width:280px}
.fm-subbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin-top:10px;
}
.fm-table th.fm-sel,.fm-table td.fm-sel{width:40px;text-align:center}
.fm-check{width:16px;height:16px;cursor:pointer}
.fm-name-wrap{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.fm-row.is-favorite{
  background:rgba(245,158,11,0.08);
}
.fm-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:40px;
  padding:3px 8px;
  border-radius:999px;
  font-size:11px;
  border:1px solid rgba(148,163,184,0.24);
  background:rgba(148,163,184,0.12);
  color:var(--text);
}
.fm-badge.dir{background:rgba(34,197,94,0.12);border-color:rgba(34,197,94,0.35)}
.fm-badge.file{background:rgba(59,130,246,0.12);border-color:rgba(59,130,246,0.35)}
.fm-link{text-decoration:none;color:var(--text)}
.fm-link:hover{text-decoration:underline}
.fm-actions-cell{white-space:normal}
.fm-inline-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:6px;
  flex-wrap:wrap;
}
.fm-inline-form{margin:0}
.fm-act-btn{
  min-height:26px;
  padding:4px 10px;
}
.fm-fav-toggle{
  min-width:34px;
  font-size:15px;
  line-height:1;
  padding:2px 8px;
}
.fm-fav-toggle.active{
  color:#f59e0b;
  border-color:rgba(245,158,11,0.45);
  background:rgba(245,158,11,0.12);
}
.fm-fav-toggle.active:hover{
  background:rgba(245,158,11,0.18);
}
.fm-row-share-links{
  margin-top:8px;
  display:none;
  flex-direction:column;
  gap:6px;
}
.fm-row-share-links.has-links{display:flex}
.fm-row-share-link{
  border:1px solid rgba(148,163,184,0.18);
  border-radius:10px;
  background:rgba(var(--tone-3),0.24);
  padding:6px 8px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
}
.fm-row-share-main{
  min-width:0;
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}
.fm-row-share-url{
  max-width:min(420px, 52vw);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.fm-row-share-meta{
  color:var(--muted);
  font-size:11px;
}
.fm-row-share-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;flex-shrink:0}
.fm-act-danger{
  color:rgba(254,202,202,0.95);
  border-color:rgba(248,113,113,0.32);
  background:rgba(248,113,113,0.08);
}
.fm-act-danger:hover{
  background:rgba(248,113,113,0.14);
  border-color:rgba(248,113,113,0.45);
}
.btn.disabled{opacity:.55;cursor:not-allowed;pointer-events:none}
.input.sm{padding:8px 10px;font-size:12px;border-radius:10px}

.fm-upload-modal .modal-body{display:flex;flex-direction:column;gap:10px}
.fm-upload-mode{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.fm-mode-btn.active{
  background:rgba(59,130,246,0.18);
  border-color:rgba(59,130,246,0.45);
  box-shadow:0 0 0 1px rgba(59,130,246,0.25) inset;
}
.fm-upload-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
#fmModalFolderMeta{
  padding:8px 10px;
  border:1px dashed rgba(148,163,184,0.28);
  border-radius:10px;
  background:rgba(var(--tone-3),0.22);
  min-height:32px;
}
.fm-upload-list{
  border:1px solid var(--line);
  border-radius:12px;
  background:rgba(var(--tone-1),0.55);
  padding:8px 10px;
  max-height:240px;
  overflow:auto;
  font-size:12px;
}
.fm-upload-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:4px 0;
  border-bottom:1px dashed rgba(148,163,184,0.15);
}
.fm-upload-item:last-child{border-bottom:none}
.fm-upload-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:70%}
.fm-upload-size{color:var(--muted);flex-shrink:0}
.fm-upload-stats{margin-top:2px}

.fm-share-modal .modal-body{display:flex;flex-direction:column;gap:10px}
.fm-share-picks{
  border:1px solid var(--line);
  border-radius:12px;
  background:rgba(var(--tone-1),0.55);
  padding:8px 10px;
  max-height:220px;
  overflow:auto;
  font-size:12px;
}
.fm-share-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:5px 0;
  border-bottom:1px dashed rgba(148,163,184,0.15);
}
.fm-share-item:last-child{border-bottom:none}
.fm-share-ttl{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.fm-share-ttl .input{width:120px}
.fm-share-link-row{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.fm-share-link-row .input{flex:1 1 300px;min-width:220px}
.fm-share-history-wrap{display:flex;flex-direction:column;gap:6px}
.fm-share-history{
  border:1px solid var(--line);
  border-radius:12px;
  background:rgba(var(--tone-1),0.45);
  padding:8px;
  max-height:220px;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.fm-share-history-row{
  border:1px solid rgba(148,163,184,0.18);
  border-radius:10px;
  background:rgba(var(--tone-3),0.24);
  padding:8px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.fm-share-history-info{min-width:0;display:flex;flex-direction:column;gap:4px}
.fm-share-history-top{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.fm-share-history-url{
  max-width:min(780px, 68vw);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.fm-share-history-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;flex-shrink:0}
.fm-share-status{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:52px;
  border-radius:999px;
  padding:2px 8px;
  border:1px solid rgba(148,163,184,0.25);
  font-size:11px;
}
.fm-share-status.active{
  color:rgba(187,247,208,0.95);
  border-color:rgba(34,197,94,0.45);
  background:rgba(34,197,94,0.15);
}
.fm-share-status.expired{
  color:rgba(254,240,138,0.95);
  border-color:rgba(245,158,11,0.45);
  background:rgba(245,158,11,0.14);
}
.fm-share-status.revoked{
  color:rgba(254,202,202,0.95);
  border-color:rgba(248,113,113,0.42);
  background:rgba(248,113,113,0.14);
}
.fm-share-status.invalid{
  color:rgba(203,213,225,0.95);
  border-color:rgba(148,163,184,0.35);
  background:rgba(148,163,184,0.12);
}

@media (max-width: 860px){
  .fm-toolbar{align-items:flex-start}
  .fm-search .input{min-width:180px}
}

@media (max-width: 640px){
  .fm-pathbar{gap:8px}
  .fm-toolbar{flex-direction:column;align-items:stretch}
  .fm-tools{justify-content:flex-start}
  .fm-search{width:100%}
  .fm-search .input{flex:1 1 auto;min-width:0}
  .fm-actions{width:100%}
  .fm-inline-actions{justify-content:flex-start;align-items:stretch}
  .fm-inline-actions .btn,
  .fm-inline-actions .fm-inline-form{
    flex:1 1 calc(50% - 6px);
    min-width:0;
  }
  .fm-inline-form .btn{width:100%}
  .fm-act-btn{min-height:32px}
  .fm-table th:nth-child(4),
  .fm-table td:nth-child(4){display:none;}
  .fm-row-share-link{flex-direction:column}
  .fm-row-share-url{max-width:100%}
  .fm-row-share-actions{width:100%}
  .fm-share-link-row{flex-direction:column;align-items:stretch}
  .fm-share-link-row .input{min-width:0;flex:1 1 auto}
  .fm-share-ttl .input{width:100px}
  .fm-share-history-row{flex-direction:column}
  .fm-share-history-url{max-width:100%}
  .fm-share-history-actions{width:100%}
}

.rules-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
  margin-top:8px;
  align-items:start;
}
@media (min-width: 1880px){
  .rules-grid{
    grid-template-columns:repeat(2, minmax(0,1fr));
  }
  .rules-grid .rule-card.health-expanded{
    grid-column:1 / -1;
  }
}

/* Bulk operations bar */
.bulk-bar{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
  padding:4px 6px;
  border:1px solid rgba(148,163,184,0.20);
  border-radius:12px;
  background:rgba(148,163,184,0.08);
}
.bulk-bar .pill{margin-right:2px;}

/* Rule selection checkbox */
.rule-select{
  width:16px;
  height:16px;
  cursor:pointer;
}
.rule-select:disabled{cursor:not-allowed;opacity:0.5}

/* Rule meta */
.fav-btn.active{color:var(--warn);border-color:rgba(245,158,11,0.35);background:rgba(245,158,11,0.12)}
.rule-remark{margin-top:4px;color:var(--muted);font-size:11px;line-height:1.25;overflow-wrap:anywhere;word-break:break-word}

/* Rule traffic / connections history (node page) */
.hist-panel{
  margin-top:12px;
  border-top:1px solid var(--line);
  padding-top:12px;
}
.hist-panel > summary{
  list-style:none;
  cursor:pointer;
  user-select:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(148,163,184,0.06);
}
.hist-panel > summary::-webkit-details-marker{display:none;}
.hist-panel[open] > summary{background:rgba(148,163,184,0.08);}
.hist-head-left{display:flex;flex-direction:column;gap:2px;}
.hist-title{font-weight:900;letter-spacing:0.2px;}
.hist-sub{font-size:12px;color:var(--muted);}
.hist-body{margin-top:10px;}
.hist-controls{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:flex-end;
}
.hist-ctrl{min-width:200px;}
.hist-ctrl-actions{min-width:160px;}
.hist-ctrl-kpi{flex:1;min-width:220px;}
.hist-kpis{display:flex;gap:8px;flex-wrap:wrap;align-items:center;}
.hist-charts{
  margin-top:10px;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
@media (max-width: 1024px){
  .hist-charts{grid-template-columns:1fr;}
}
.hist-chart{
  position:relative;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(var(--tone-1),0.55);
  padding:10px;
}
.hist-chart-head{display:flex;justify-content:space-between;align-items:baseline;gap:10px;margin-bottom:6px;}
.hist-chart-head .name{font-weight:900;}
.hist-chart-head .hint{color:var(--muted);font-size:12px;}
.hist-canvas{
  width:100%;
  height:160px;
  display:block;
  border-radius:12px;
  background:rgba(0,0,0,0.06);
}
.hist-canvas.small{height:120px;}
.hist-legend{display:flex;gap:10px;flex-wrap:wrap;margin-top:6px;font-size:12px;color:var(--muted);}
.hist-leg{display:inline-flex;gap:6px;align-items:center;}
.hist-leg .dot{width:10px;height:10px;border-radius:999px;display:inline-block;background:var(--accent);}
.hist-leg .dot.dl{background:var(--accent2);}
.hist-leg .dot.ul{background:var(--accent);}
.hist-leg .dot.conn{background:var(--ok);}
.hist-tooltip{
  position:absolute;
  pointer-events:none;
  z-index:20;
  padding:6px 8px;
  border-radius:12px;
  background:rgba(var(--tone-1),0.92);
  border:1px solid rgba(var(--tone-line),0.12);
  box-shadow:var(--shadow);
  color:var(--text);
  font-size:12px;
  max-width:260px;
}
.hist-tooltip .t{color:var(--muted);font-size:11px;margin-bottom:2px;}
.hist-tooltip .k{display:flex;justify-content:space-between;gap:10px;}
.hist-tooltip .k .name{color:var(--muted);}
.hist-tooltip .k .val{font-variant-numeric: tabular-nums;}

/* Inline action buttons (no dropdown) */
.action-inline{display:inline-flex;align-items:center;justify-content:flex-end;gap:10px}
.rules-actions{display:flex;gap:6px;flex-wrap:nowrap;justify-content:flex-end}

.rule-card{
  position:relative;
  overflow:hidden;
  background:
    radial-gradient(140% 140% at 0% 0%, rgba(59,130,246,0.10), transparent 56%),
    linear-gradient(180deg, rgba(var(--tone-1),0.76), rgba(var(--tone-0),0.62));
  border:1px solid rgba(var(--tone-line),0.16);
  border-radius:13px;
  padding:10px;
  backdrop-filter:blur(18px);
  box-shadow:
    0 10px 28px rgba(2,6,23,0.20),
    inset 0 1px 0 rgba(255,255,255,0.06);
  transition:
    border-color var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-base) var(--ease-standard);
}
.rule-card:hover{
  transform:translateY(var(--hover-lift));
  border-color:rgba(59,130,246,0.28);
  box-shadow:
    0 14px 32px rgba(2,6,23,0.24),
    inset 0 1px 0 rgba(255,255,255,0.08);
}
.rule-card:active{transform:translateY(var(--press-lift));}
.rule-card::before{
  content:"";
  position:absolute;
  left:0;
  top:7px;
  bottom:7px;
  width:2px;
  border-radius:3px;
  background:rgba(148,163,184,0.38);
}
.rule-card.tone-ok::before{background:rgba(34,197,94,0.72)}
.rule-card.tone-warn::before{background:rgba(245,158,11,0.78)}
.rule-card.tone-bad::before{background:rgba(239,68,68,0.82)}
.rule-card.tone-warn{
  border-color:rgba(245,158,11,0.34);
  background:
    radial-gradient(140% 130% at 0% 0%, rgba(245,158,11,0.14), transparent 58%),
    linear-gradient(180deg, rgba(var(--tone-1),0.78), rgba(var(--tone-0),0.62));
}
.rule-card.tone-bad{
  border-color:rgba(239,68,68,0.40);
  background:
    radial-gradient(140% 130% at 0% 0%, rgba(239,68,68,0.16), transparent 58%),
    linear-gradient(180deg, rgba(var(--tone-1),0.78), rgba(var(--tone-0),0.62));
}
.rule-card.health-expanded{
  box-shadow:
    0 0 0 1px rgba(59,130,246,0.24) inset,
    0 14px 34px rgba(2,6,23,0.26),
    inset 0 1px 0 rgba(255,255,255,0.08);
}
.rule-head{display:flex;justify-content:space-between;gap:8px;align-items:flex-start}
.rule-left{min-width:0;flex:1 1 auto}
.rule-topline{display:flex;gap:8px;align-items:center;margin-bottom:3px}
.rule-idx{color:var(--muted);font-size:11px}
.rule-listen{font-size:14px;font-weight:820;line-height:1.2;word-break:break-all}
.rule-sub{margin-top:2px;display:flex;align-items:center;gap:6px}
.rule-source{
  margin-top:4px;
  display:flex;
  gap:6px;
  align-items:center;
  min-width:0;
}
.rule-source-label{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:1px 6px;
  border-radius:999px;
  border:1px solid rgba(59,130,246,0.28);
  color:rgba(var(--tone-text-mid),0.86);
  background:rgba(59,130,246,0.10);
  flex:0 0 auto;
}
.rule-source-value{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:rgba(var(--tone-text-mid),0.86);
}
.rule-forward{margin-top:6px;display:flex;flex-wrap:wrap;gap:6px;align-items:flex-start}
.rule-forward .forward-label{color:var(--muted);font-size:11px;line-height:1.6;white-space:nowrap}
.rule-right{
  display:flex;
  flex-direction:row;
  gap:6px;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
  flex-shrink:0;
}
.rule-right .rule-kpi{
  font-variant-numeric:tabular-nums;
  letter-spacing:0.01em;
}
.rule-health-block{margin-top:6px}
.rule-actions{display:flex;gap:5px;justify-content:flex-end;margin-top:8px}
.rule-card .pill.xs{
  padding:3px 7px;
  font-size:11px;
  line-height:1.1;
}
.rule-card .btn.xs{
  min-height:26px;
  padding:4px 8px;
  border-radius:9px;
  font-size:11px;
}
.rule-card .btn.icon{
  width:28px;
  min-width:28px;
  height:28px;
  min-height:28px;
  border-radius:9px;
}
.rule-card.compact .rule-head{
  flex-direction:column;
  align-items:stretch;
  gap:7px;
}
.rule-card.compact .rule-right{
  flex-direction:row;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-start;
}

.rule-health-shell{display:flex;flex-direction:column;gap:7px;min-width:0}
.rule-health-summary{
  display:flex;
  gap:8px;
  align-items:flex-start;
  justify-content:space-between;
  border:1px solid rgba(148,163,184,0.22);
  border-radius:10px;
  padding:7px 8px;
  background:
    linear-gradient(180deg, rgba(148,163,184,0.09), rgba(148,163,184,0.05));
}
.rule-health-summary-main{min-width:0;flex:1 1 auto}
.rule-health-summary-actions{flex:0 0 auto;display:flex;align-items:flex-start}
.rule-health-main{display:flex;flex-wrap:wrap;gap:6px;align-items:center;min-width:0}
.rule-health-main .health-target{max-width:520px}
.rule-health-badges{display:flex;flex-wrap:wrap;gap:5px}
.rule-health-note{font-size:11px;color:var(--muted);line-height:1.3}
.rule-health-toggle{white-space:nowrap}
.rule-health-details{
  border:1px solid rgba(148,163,184,0.20);
  border-radius:10px;
  padding:8px;
  background:
    linear-gradient(180deg, rgba(15,23,42,0.14), rgba(15,23,42,0.10));
  display:flex;
  flex-direction:column;
  gap:7px;
  animation:detailFadeIn var(--motion-base) var(--ease-standard);
}
.rule-health-details-flow{
  display:flex;
  flex-direction:column;
  gap:7px;
}
.rule-health-details-grid{
  display:grid;
  grid-template-columns:minmax(0, 1fr);
  gap:8px;
  align-items:start;
}
.rule-health-details-col{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:7px;
}
.rule-health-details-col-rich{
  order:0;
}
.rule-health-empty{font-size:12px}
.rule-health-items{display:flex;flex-direction:column;gap:6px}
.rule-health-item{
  border:1px solid rgba(148,163,184,0.16);
  border-radius:9px;
  padding:6px 7px;
  background:rgba(15,23,42,0.12);
}
.rule-health-item-main{display:flex;gap:6px;flex-wrap:wrap;align-items:center;min-width:0}
.rule-health-item-reason{margin-top:4px;font-size:11px;color:var(--muted);line-height:1.32}
.rule-health-advanced{display:flex;flex-direction:column;gap:7px}
.rule-health-actions{display:flex;justify-content:flex-end;margin-top:2px}
.rule-health-shell.mobile .rule-health-main .health-target{max-width:100%;white-space:normal;word-break:break-all}
.rule-health-shell.mobile .rule-health-note{display:block}
@keyframes detailFadeIn{
  from{opacity:0;transform:translateY(-4px)}
  to{opacity:1;transform:translateY(0)}
}
@media (prefers-reduced-motion: reduce){
  .rule-health-details{animation:none}
}
@media (max-width: 1360px){
  .rule-health-details-grid{grid-template-columns:1fr}
}

/* Health badges */
.health-target{max-width:420px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.trace-target-btn{
  border:0;
  background:transparent;
  padding:0;
  margin:0;
  cursor:pointer;
  color:inherit;
  text-align:left;
}
.trace-target-btn:hover{
  color:var(--accent);
  text-decoration:underline;
  text-underline-offset:2px;
}
.trace-target-btn:focus-visible{
  outline:2px solid rgba(59,130,246,0.48);
  outline-offset:2px;
  border-radius:6px;
}
.health-target-line{display:inline-flex;gap:5px;align-items:center;min-width:0;max-width:100%}
.health-meta-stack{display:flex;flex-direction:column;gap:2px;min-width:0;max-width:100%}
.health-meta-stack .health-target-line{max-width:100%}
.health-avail{font-size:11px;color:var(--muted);white-space:nowrap;opacity:0.95}
.health-rtt{font-size:11px;color:var(--muted);white-space:nowrap;opacity:0.95}
.health-sub{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:320px;opacity:0.92}
.health-sub-line{max-width:100%}
.health-reason{font-size:11px;color:var(--muted)}
.adaptive-info{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin-top:6px}

/* Forms */
.form{display:flex;flex-direction:column;gap:10px;margin-top:10px}
.label{font-size:12px;color:var(--muted)}
.help{font-size:12px;color:var(--muted);margin-top:6px}
.help.compact{margin-top:4px;font-size:11px;line-height:1.35}

/* =========================
   Settings page (console-like redesign)
   ========================= */
.settings-hero{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-top:12px;
  border-radius:18px;
  padding:14px;
  background:
    radial-gradient(1200px 420px at 0% 0%, rgba(59,130,246,0.18), transparent 60%),
    linear-gradient(180deg, rgba(var(--tone-1),0.74), rgba(var(--tone-0),0.70));
}
.settings-hero-left{min-width:0;display:flex;flex-direction:column;gap:6px;}
.settings-hero-title{font-size:18px;font-weight:900;letter-spacing:0.2px;}
.settings-hero-sub{color:var(--muted);font-size:12px;line-height:1.45;max-width:58ch;}
.settings-hero-right{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  min-width:min(560px, 100%);
}
.settings-hero-stat{
  border:1px solid rgba(148,163,184,0.20);
  background:rgba(var(--tone-0),0.22);
  border-radius:12px;
  padding:8px 10px;
  min-width:0;
}
.settings-hero-stat .k{font-size:11px;color:var(--muted);}
.settings-hero-stat .v{
  margin-top:4px;
  font-size:12px;
  font-weight:850;
  color:rgba(var(--tone-text-hi),0.95);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.settings-console{
  margin-top:12px;
  display:grid;
  grid-template-columns:minmax(250px, 320px) minmax(0, 1fr);
  gap:12px;
  align-items:start;
}

.settings-side{
  position:sticky;
  top:calc(var(--sticky-top) + 2px);
  max-height:calc(100vh - var(--sticky-top) - 14px);
  max-height:calc(100dvh - var(--sticky-top) - 14px);
  overflow:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  scrollbar-gutter:stable both-edges;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:12px;
}

.settings-side-nav{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.settings-nav-chip{
  text-decoration:none;
}

.settings-side-nav .settings-nav-chip{
  width:100%;
  justify-content:space-between;
}

.settings-nav-chip.active,
.settings-nav-chip[aria-selected="true"]{
  border-color: rgba(59,130,246,0.50);
  background: rgba(59,130,246,0.12);
  color: rgba(var(--tone-text-mid),0.96);
}

.settings-side-divider{
  height:1px;
  border-radius:999px;
  background:rgba(148,163,184,0.22);
  margin:2px 0;
}

.settings-side-kv{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.settings-main{
  min-width:0;
}

.settings-form{
  margin-top:0;
  gap:12px;
}

.settings-toolbar{
  position:sticky;
  top:calc(var(--sticky-top) + 2px);
  z-index:14;
  margin:0;
  padding:10px;
  border:1px solid rgba(148,163,184,0.18);
  border-radius:16px;
  background:rgba(var(--tone-1),0.76);
  backdrop-filter:blur(16px);
  box-shadow:var(--glow);
}

.settings-filters{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.settings-card{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.settings-card .section-head{margin-bottom:2px}

.settings-panel{
  position:relative;
  border-radius:18px;
  padding:14px 14px 14px 16px;
  scroll-margin-top:calc(var(--sticky-top) + 84px);
}

.settings-panel::before{
  content:"";
  position:absolute;
  left:0;
  top:12px;
  bottom:12px;
  width:3px;
  border-radius:999px;
  background:rgba(148,163,184,0.34);
}

.settings-panel[data-accent="1"]::before{background:linear-gradient(180deg, rgba(59,130,246,0.95), rgba(34,211,238,0.50));}
.settings-panel[data-accent="2"]::before{background:linear-gradient(180deg, rgba(14,165,233,0.95), rgba(34,197,94,0.45));}
.settings-panel[data-accent="3"]::before{background:linear-gradient(180deg, rgba(234,179,8,0.95), rgba(245,158,11,0.45));}
.settings-panel[data-accent="4"]::before{background:linear-gradient(180deg, rgba(245,158,11,0.95), rgba(59,130,246,0.45));}
.settings-panel[data-accent="5"]::before{background:linear-gradient(180deg, rgba(34,197,94,0.95), rgba(45,212,191,0.48));}
.settings-panel[data-accent="6"]::before{background:linear-gradient(180deg, rgba(244,114,182,0.92), rgba(59,130,246,0.50));}

.settings-field-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:10px;
}

.settings-field{
  min-width:0;
}

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

.settings-check{
  display:flex;
  align-items:flex-start;
  gap:8px;
  width:100%;
  padding:8px 10px;
  border:1px solid rgba(148,163,184,0.16);
  border-radius:12px;
  background:rgba(var(--tone-0),0.16);
  color:rgba(var(--tone-text-mid),0.90);
  font-size:12px;
  line-height:1.45;
}

.settings-check:hover{
  border-color:rgba(59,130,246,0.35);
  background:rgba(59,130,246,0.08);
}

.settings-check input{
  margin-top:2px;
  width:14px;
  height:14px;
  accent-color:var(--accent);
}

.settings-bottom-pad{
  height:120px;
}

.settings-action-dock{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  z-index:30;
  padding:10px 16px calc(10px + var(--safe-bottom)) 16px;
  pointer-events:none;
}

.settings-action-inner{
  max-width:var(--container);
  margin:0 auto;
  border:1px solid rgba(59,130,246,0.26);
  border-radius:16px;
  background:linear-gradient(180deg, rgba(var(--tone-1),0.92), rgba(var(--tone-1),0.86));
  backdrop-filter:blur(18px);
  box-shadow:var(--shadow);
  padding:10px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  pointer-events:auto;
}

.settings-action-meta{
  display:flex;
  flex-direction:column;
  gap:3px;
  min-width:0;
}

.settings-action-title{
  font-size:13px;
  font-weight:900;
  letter-spacing:0.2px;
}

.settings-action-sub{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.settings-action-buttons{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

#settingsSaveBtn{
  min-height:40px;
  min-width:118px;
}

@media (max-width: 1180px){
  .settings-console{
    grid-template-columns:1fr;
  }
  .settings-side{
    position:static;
    max-height:none;
    overflow:visible;
    scrollbar-gutter:auto;
  }
}

@media (max-width: 760px){
  .settings-hero{
    flex-direction:column;
  }
  .settings-hero-right{
    min-width:0;
    width:100%;
    grid-template-columns:1fr;
  }
  .settings-toolbar{
    top:calc(var(--sticky-top) + 4px);
  }
  .settings-filters{
    flex-wrap:nowrap;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
  }
  .settings-filters::-webkit-scrollbar{display:none}
  .settings-nav-chip{
    width:auto;
    flex:0 0 auto;
  }
  .settings-field-grid{
    grid-template-columns:1fr;
  }
  .settings-action-inner{
    flex-direction:column;
    align-items:stretch;
  }
  .settings-action-buttons{
    width:100%;
  }
  .settings-action-buttons .btn{
    flex:1 1 auto;
    min-width:0;
  }
  .settings-bottom-pad{
    height:156px;
  }
}
.input,.select,textarea,.textarea{
  min-height:42px;
  border-color:var(--border-subtle);
  border-radius:var(--radius-sm);
  background:var(--surface);
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.04);
  width:100%;
  background:rgba(var(--tone-1),0.56);
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px 12px;
  color:var(--text);
  outline:none;
  line-height:1.35;
}
textarea,.textarea{min-height:90px;resize:vertical}


/* =========================
   Form sections + advanced params
   ========================= */

.form-section{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:12px 12px;
  border-radius:16px;
  border:1px solid rgba(148,163,184,0.18);
  background:
    radial-gradient(120% 130% at 0% 0%, rgba(56,189,248,0.11), transparent 68%),
    linear-gradient(180deg, rgba(var(--tone-0),0.18), rgba(var(--tone-0),0.12));
}

/* Mode strip (mode cards shown inside rule modal) */
.mode-strip{
  padding: 10px 12px;
  border-radius: 16px;
  border:1px solid rgba(148,163,184,0.18);
  background:
    radial-gradient(120% 130% at 0% 0%, rgba(56,189,248,0.10), transparent 70%),
    linear-gradient(180deg, rgba(var(--tone-0),0.18), rgba(var(--tone-0),0.12));
}

/* Rule modal: make the first row compact & focused */
.base-top-row{align-items:flex-end}
.listen-col{flex:1.15; min-width:260px}
.status-col{flex:0 0 190px; max-width:190px}
.peer-col{flex:1.55; min-width:240px}

.section-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}

.section-title{
  font-weight: 900;
  font-size: 13px;
  letter-spacing:0.2px;
}

.section-sub{
  margin-top:3px;
  font-size:12px;
  color: var(--muted);
  line-height:1.45;
}

.site-ssl-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.site-ssl-actions form{margin:0}

@media (max-width: 720px){
  .site-ssl-actions{width:100%;justify-content:flex-start}
}

.input-group{
  display:flex;
  align-items:stretch;
  width:100%;
  border:1px solid var(--line);
  border-radius:12px;
  background:rgba(var(--tone-1),0.56);
  overflow:hidden;
}

.input-prefix{
  display:flex;
  align-items:center;
  padding:10px 10px;
  border-right:1px solid var(--line);
  background:rgba(var(--tone-0),0.10);
  color: rgba(var(--tone-text-mid),0.82);
  white-space:nowrap;
}

.input-group .input{
  border:0;
  border-radius:0;
  background:transparent;
}

.input-group .input:focus{
  outline:none;
}

/* Advanced parameters (collapsible) */
.advanced-details{
  margin-top: 10px;
  border-radius: 16px;
  border:1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-0),0.10);
  overflow:hidden;
}

.advanced-details > summary{
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
  user-select:none;
  list-style:none;
}

.advanced-details > summary::-webkit-details-marker{ display:none; }

.advanced-details > summary::after{
  content: '▾';
  font-size: 12px;
  color: rgba(var(--tone-text-mid),0.72);
  transform: translateY(-1px);
  transition: transform var(--motion-fast) var(--ease-standard);
}

.advanced-details[open] > summary::after{
  transform: rotate(-180deg) translateY(1px);
}

.advanced-details[open] > summary{
  background: rgba(59,130,246,0.10);
  border-bottom:1px solid rgba(148,163,184,0.18);
}

.adv-title{
  font-weight: 900;
  font-size: 12px;
  letter-spacing:0.2px;
}

.adv-hint{
  margin-top:2px;
  font-size: 11px;
  color: var(--muted);
}

.adv-body{
  padding: 12px 12px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.adv-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.adv-subtitle{
  font-weight: 900;
  font-size: 12px;
  letter-spacing:0.2px;
  margin: 0;
  padding-top: 4px;
}

/* =========================
   Rule modal: tunnel mode switcher
   ========================= */

.mode-switch{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap:10px;
}

.mode-card{
  text-align:left;
  border:1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-0),0.18);
  border-radius: 16px;
  padding: 10px 12px;
  color: var(--text);
  cursor:pointer;
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard),
    box-shadow var(--motion-base) var(--ease-standard);
}

.mode-card:hover{
  transform: translateY(var(--hover-lift));
  border-color: rgba(59,130,246,0.35);
  background: rgba(59,130,246,0.08);
}
.mode-card:active{transform: translateY(var(--press-lift));}

.mode-card:focus{
  outline: 2px solid rgba(59,130,246,0.45);
  outline-offset: 2px;
}

.mode-card.active{
  border-color: rgba(59,130,246,0.60);
  background: rgba(59,130,246,0.10);
  box-shadow: 0 0 0 1px rgba(59,130,246,0.18) inset;
}

.mode-card-head{
  display:flex;
  gap:10px;
  align-items:flex-start;
}

.mode-ico{
  width:34px;
  height:34px;
  border-radius: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(59,130,246,0.14);
  border:1px solid rgba(59,130,246,0.22);
  font-size: 18px;
  flex:0 0 auto;
}

.mode-title{
  font-weight: 900;
  font-size: 13px;
  letter-spacing:0.2px;
}

.mode-sub{
  margin-top:2px;
  font-size: 12px;
  color: var(--muted);
  line-height:1.35;
}

.mode-tags{
  margin-top:8px;
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.mode-tag{
  font-size: 11px;
  padding:4px 8px;
  border-radius: 999px;
  border:1px solid rgba(148,163,184,0.16);
  background: rgba(var(--tone-0),0.14);
  color: rgba(var(--tone-text-mid),0.86);
}

.mode-guide{
  margin-top: 10px;
  padding: 12px 12px;
  border-radius: 16px;
  border:1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-0),0.12);
}

.mode-guide-head{
  display:flex;
  gap:10px;
  align-items:flex-start;
}

.mode-guide-title{
  font-weight: 900;
  font-size: 13px;
  letter-spacing:0.2px;
}

.mode-guide-desc{
  margin-top:3px;
  font-size:12px;
  color: var(--muted);
  line-height:1.45;
}

.mode-diagram{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border:1px dashed rgba(148,163,184,0.22);
  background: rgba(var(--tone-1),0.28);
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: rgba(var(--tone-text-mid),0.92);
}

.mode-steps{
  margin-top: 10px;
  display:grid;
  gap:6px;
}

.mode-step{
  display:flex;
  gap:10px;
  align-items:flex-start;
  font-size:12px;
  color: rgba(var(--tone-text-mid),0.88);
  line-height:1.45;
}

.mode-step .num{
  width:20px;
  height:20px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:11px;
  font-weight:800;
  background: rgba(59,130,246,0.18);
  border:1px solid rgba(59,130,246,0.22);
  color: rgba(var(--tone-text-mid),0.92);
  flex:0 0 auto;
  margin-top:1px;
}

.mode-preview{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border:1px solid rgba(34,197,94,0.18);
  background: rgba(34,197,94,0.06);
  color: rgba(var(--tone-text-mid),0.92);
  font-size: 12px;
}

/* =========================
   Rule modal: split screens (Intro vs Params)
   ========================= */

.rule-screen-tabs{
  display:flex;
  gap:6px;
  padding:6px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-0),0.14);
  width:fit-content;
  margin-top: 8px;
}

.rule-tab{
  border:1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding:8px 12px;
  border-radius:999px;
  cursor:pointer;
  font-size:12px;
  font-weight:900;
  line-height:1;
}

.rule-tab:hover{
  background: rgba(148,163,184,0.08);
}

.rule-tab.active{
  background: rgba(59,130,246,0.14);
  border-color: rgba(59,130,246,0.24);
  color: rgba(var(--tone-text-mid),0.92);
}

.rule-screen{ margin-top: 12px; }
.rule-intro-head{ margin-bottom: 8px; }

.mode-compact-bar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border-radius:16px;
  border:1px solid rgba(148,163,184,0.18);
  background:
    radial-gradient(120% 130% at 0% 0%, rgba(56,189,248,0.10), transparent 70%),
    linear-gradient(180deg, rgba(var(--tone-0),0.20), rgba(var(--tone-0),0.12));
}

.mode-compact-left{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  min-width:0;
}

@media (max-width: 860px){
  .mode-switch{ grid-template-columns: 1fr; }
  .mode-ico{ width:32px; height:32px; }
}

/* Modals */
.modal{
  position:fixed;inset:0;z-index:50;
  background:rgba(10,14,30,0.68);
  display:flex;align-items:center;justify-content:center;
  padding:22px;
  overflow:auto;
  min-height:100vh;
  min-height:100dvh;
}
#traceRouteModal{padding:10px;}
.modal-inner{
  width:920px;max-width:100%;
  max-height:calc(100vh - 44px);
  max-height:calc(100dvh - 44px);
  overflow:auto;
  background:
    radial-gradient(120% 140% at 0% 0%, var(--hero-grad-1), transparent 60%),
    radial-gradient(120% 120% at 100% 100%, var(--hero-grad-2), transparent 66%),
    linear-gradient(180deg, rgba(var(--tone-1),0.92), rgba(var(--tone-1),0.82));
  border:1px solid var(--hero-line);
  border-radius:18px;
  padding:18px;
  box-shadow:var(--shadow);
  backdrop-filter:blur(18px);
}

.trace-route-modal-inner{
  width:min(1500px, 100%);
  max-height:min(97vh, calc(100vh - 10px));
  max-height:min(97vh, calc(100dvh - 10px));
  padding:12px 12px 10px;
}
.trace-route-modal-inner #traceRouteHint{
  margin-top:4px !important;
  font-size:10px;
}
.trace-route-modal-inner #traceRouteMeta{
  margin-top:5px !important;
}
.trace-route-modal-inner #traceRouteError{
  margin-top:5px !important;
  font-size:11px;
}
.trace-route-modal-inner .trace-route-chart-card{
  margin-top:6px !important;
}
.trace-route-modal-inner .trace-route-table-wrap{
  margin-top:6px !important;
}
.trace-route-meta{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:5px;
}
.trace-route-meta .pill.xs{
  padding:2px 6px;
  font-size:10px;
}
.trace-route-chart-card{
  border:1px solid var(--line);
  border-radius:12px;
  background:rgba(var(--tone-1),0.55);
  padding:6px;
}
.trace-route-chart-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
  margin-bottom:2px;
}
.trace-route-chart-head .name{font-weight:900;}
.trace-route-canvas.hist-canvas.small{
  height:68px;
}
.trace-route-table-wrap{
  overflow-x:auto;
  overflow-y:visible;
  border:1px solid var(--line);
  border-radius:10px;
  background:rgba(var(--tone-1),0.38);
}
.trace-route-table{
  min-width:980px;
  border-collapse:separate;
  border-spacing:0;
  table-layout:fixed;
}
.trace-route-table thead th{
  position:static;
  top:auto;
  z-index:auto;
  background:rgba(var(--tone-0),0.92);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.trace-route-table th,
.trace-route-table td{
  white-space:nowrap;
  vertical-align:middle;
  padding:3px 6px;
  font-size:11px;
  line-height:1.1;
}
.trace-route-table th:nth-child(1),
.trace-route-table td:nth-child(1){
  width:44px;
}
.trace-route-table th:nth-child(4),
.trace-route-table td:nth-child(4){
  width:72px;
}
.trace-route-table th:nth-child(5),
.trace-route-table td:nth-child(5),
.trace-route-table th:nth-child(6),
.trace-route-table td:nth-child(6),
.trace-route-table th:nth-child(7),
.trace-route-table td:nth-child(7){
  width:92px;
}
.trace-route-table th:nth-child(2),
.trace-route-table td:nth-child(2){
  min-width:190px;
  max-width:280px;
  overflow:hidden;
  text-overflow:ellipsis;
}
.trace-route-table th:nth-child(3),
.trace-route-table td:nth-child(3){
  min-width:170px;
  max-width:250px;
  overflow:hidden;
  text-overflow:ellipsis;
}
.trace-route-table th:nth-child(8),
.trace-route-table td:nth-child(8){
  min-width:160px;
  max-width:220px;
  overflow:hidden;
  text-overflow:ellipsis;
}
.trace-route-table td .pill.xs{
  padding:1px 6px;
  font-size:9px;
}
.trace-route-host,
.trace-route-samples{
  display:inline-block;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  vertical-align:bottom;
}
.trace-route-samples{
  max-width:200px;
}
@media (max-width: 920px){
  .trace-route-modal-inner{
    max-height:min(99vh, calc(100vh - 4px));
    max-height:min(99vh, calc(100dvh - 4px));
    padding:10px;
  }
  .trace-route-canvas.hist-canvas.small{ height:58px; }
  .trace-route-table-wrap{ overflow:auto; }
  .trace-route-table{
    min-width:700px;
  }
  .trace-route-table th:nth-child(2),
  .trace-route-table td:nth-child(2),
  .trace-route-table th:nth-child(3),
  .trace-route-table td:nth-child(3){
    min-width:150px;
    max-width:210px;
  }
  .trace-route-table th:nth-child(8),
  .trace-route-table td:nth-child(8){
    display:none;
  }
}

.code-block{
  margin:12px 0 0 0;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(var(--tone-1),0.56);
  color:var(--text);
  font-family:ui-monospace,Menlo,Monaco,Consolas,monospace;
  font-size:12px;
  white-space:pre-wrap;
  word-break:break-all;
}

.flash{margin:12px 0;padding:12px 14px;border-radius:12px;border:1px solid rgba(245,158,11,0.40);background:rgba(251,191,36,0.15);color:#fbbf24}
.form-error{color:var(--warn);font-size:12px}
.divider{height:1px;background:var(--line);margin:12px 0}
.kv{display:flex;gap:10px;flex-wrap:wrap}
.kv .item{padding:10px 12px;border-radius:12px;border:1px solid var(--line);background:var(--surface-2)}

/* Toast */
.toast{
  border:1px solid var(--border-strong);
  border-radius:var(--radius-md);
  box-shadow:var(--shadow-md);
  position:fixed;
  right:16px;
  bottom:16px;
  min-width:240px;
  max-width:420px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(148,163,184,0.24);
  background:rgba(var(--tone-1),0.92);
  color:var(--text);
  box-shadow:var(--shadow);
  backdrop-filter:blur(18px);
  display:none;
  z-index:80;
}

/* Responsive refinements */
@media (max-width: 720px){
  .topbar{padding:10px 12px}
  .brand-sub{display:none}
  .container{padding:12px 12px}
  .footer{display:none}
  .row{flex-wrap:wrap}
  .right{width:auto}
  .card{padding:12px}
  .modal-inner{padding:14px}
  .toast{left:12px;right:12px;bottom:12px;min-width:auto}
  .table th,.table td{font-size:12px;padding:7px 8px;}
  .table td,.table th{overflow-wrap:anywhere;word-break:break-word;}

  /* Prevent iOS focus zoom and keep touch targets consistent on forms */
  .input,.select,textarea,.textarea{font-size:16px;}
  .input.sm,.select.sm{font-size:15px;}
  .btn,.btn.sm,.btn.xs{min-height:36px;}

  /* Modal form rows often contain inline max-width/min-width; collapse safely on phone */
  .modal .form .row,
  .modal .form-section .row,
  .modal .adv-body .row{
    align-items:stretch !important;
    gap:10px !important;
  }
  .modal .form .row > .col,
  .modal .form-section .row > .col,
  .modal .adv-body .row > .col{
    width:100%;
    min-width:0 !important;
    max-width:none !important;
    flex:1 1 100% !important;
  }
  .modal .form .row-end,
  .modal .form .row-end-sm,
  .modal .form .row-end-12,
  .modal .form-section .row-end,
  .modal .form-section .row-end-sm,
  .modal .form-section .row-end-12,
  .modal .adv-body .row-end,
  .modal .adv-body .row-end-sm,
  .modal .adv-body .row-end-12{
    justify-content:flex-start !important;
  }
  .modal .form .row-end .btn,
  .modal .form .row-end-sm .btn,
  .modal .form .row-end-12 .btn,
  .modal .form-section .row-end .btn,
  .modal .form-section .row-end-sm .btn,
  .modal .form-section .row-end-12 .btn,
  .modal .adv-body .row-end .btn,
  .modal .adv-body .row-end-sm .btn,
  .modal .adv-body .row-end-12 .btn{
    flex:1 1 auto;
    min-width:0;
    justify-content:center;
  }

  /* Keep long labels and value text readable across all cards/panels */
  .card-title,.section-title,.meta-item,.label,.help,.h1,.h2{overflow-wrap:anywhere;}
}

@media (max-width: 420px){
  .btn{min-height:36px}
  .btn.xs{min-height:32px}
  .logo{width:32px;height:32px}
  .h1{font-size:20px}
}

.toast.error{border-color:rgba(248,113,113,0.42);background:rgba(45,14,20,0.88);color:#fecaca}

/* =========================
   Node page split layout
   ========================= */
.split-layout{
  display:grid;
  grid-template-columns: 280px 1fr;
  gap: 10px;
  align-items:start;
}

.node-sidebar{
  position:sticky;
  top: calc(var(--sticky-top) + 12px);
  padding: 0;
  overflow:hidden;
}

.node-sidebar .card-header{
  padding: 12px 12px 8px;
}

.node-sidebar .card-title{
  font-size: 15px;
}

.node-list{
  padding: 8px;
  display:flex;
  flex-direction:column;
  gap: 8px;
  max-height: calc(100vh - 176px);
  max-height: calc(100dvh - 176px);
  overflow:auto;
}

/* Grouped node list */
.node-group{display:flex; flex-direction:column; gap:6px;}
.node-group-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid rgba(var(--tone-line),0.08);
  background: rgba(var(--tone-2),0.34);
  transition:
    border-color var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard),
    opacity var(--motion-base) var(--ease-standard);
}
.node-group-name{font-weight:900; font-size: 12px; color: rgba(var(--tone-text-hi),0.92);cursor:pointer;padding:2px 6px;border-radius:999px;}
.node-group-name:hover{background:rgba(var(--tone-line),0.06);}
.node-group-name:focus{outline:2px solid rgba(34,211,238,0.45);outline-offset:2px;}
.node-group-tools{display:flex;align-items:center;gap:8px;}
.node-group-toggle{padding:4px 6px;line-height:1;transition: transform var(--motion-fast) var(--ease-standard);}
.node-group-count{font-variant-numeric: tabular-nums;}
.node-group-items{display:flex; flex-direction:column; gap:6px;}
.node-group-divider{display:none;}

.node-group.collapsed .node-group-items{display:none;}
.node-group.collapsed .node-group-toggle{transform: rotate(-90deg);}

.node-item-row{
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
}

.node-item-row .node-item{
  flex:1 1 auto;
  min-width:0;
}

.node-item{
  display:flex;
  gap: 10px;
  align-items:center;
  padding: 8px 9px;
  border: 1px solid rgba(148,163,184,0.16);
  border-radius: 12px;
  background: rgba(var(--tone-0),0.16);
  text-decoration:none;
  color: var(--text);
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard);
}

.node-item:hover{
  transform: translateY(var(--hover-lift));
  border-color: rgba(59,130,246,0.35);
  background: rgba(59,130,246,0.08);
}
.node-item:active{transform: translateY(var(--press-lift));}

.node-item.active{
  border-color: rgba(59,130,246,0.55);
  background: rgba(59,130,246,0.10);
}
.node-item-row.direct-enabled .node-item{
  border-color: rgba(16,185,129,0.48);
  box-shadow: 0 0 0 1px rgba(16,185,129,0.20) inset;
}

.node-sidebar .node-info{min-width:0; flex:1 1 auto;}
.node-sidebar .node-name{font-weight:700; font-size: 14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.node-sidebar .node-name-text{display:inline-block; max-width:140px; vertical-align:middle; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.node-sidebar .node-direct-pill{margin-left:6px; vertical-align:middle; background:rgba(16,185,129,0.18); border-color:rgba(16,185,129,0.45); color:#065f46;}
.node-sidebar .node-meta{font-size: 12px; color: var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:2px;}

.node-sidebar .dot{width:8px; height:8px; border-radius:999px; display:inline-block; flex:0 0 auto; box-shadow:0 0 0 3px rgba(148,163,184,0.12) inset;}
.node-sidebar .dot.online{background:#22c55e;}
.node-sidebar .dot.offline{background:#64748b;}

.sidebar-foot{padding: 8px 10px 12px; border-top: 1px solid rgba(148,163,184,0.14);} 
.w100{width:100%;}

.node-main{min-width:0;}
.node-main > .card{padding:16px;}
.node-main section{margin:0;}

/* Node header title: keep compact, avoid long names breaking layout */
.node-head .card-title{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.node-title{max-width:360px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:inline-block}
.node-direct-badge{
  background: linear-gradient(90deg, rgba(16,185,129,0.26), rgba(5,150,105,0.16));
  border-color: rgba(16,185,129,0.55);
  color:#065f46;
  font-weight:800;
  box-shadow: 0 0 0 1px rgba(16,185,129,0.22) inset, 0 0 14px rgba(16,185,129,0.16);
}
.node-tools{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;
  overflow-x:auto;
  scrollbar-width:thin;
  padding-bottom:2px;
}
.node-tools::-webkit-scrollbar{height:6px}
.node-tools > *{flex:0 0 auto}
.node-tools .btn{white-space:nowrap}
.node-tools > .btn,
.node-tools > details.menu > summary{
  min-height:34px;
  padding:6px 12px;
  border-radius:12px;
  font-size:13px;
}
.node-tools .toolbar-main-cta{
  border-color:rgba(34,211,238,0.46);
  box-shadow:0 0 0 1px rgba(34,211,238,0.24) inset, 0 16px 30px rgba(34,211,238,0.16);
}
.node-tools .toolbar-mini .menu-pop{min-width:280px}
.node-tools .toolbar-mini-search .menu-pop{min-width:340px}
.toolbar-mini-form{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.toolbar-mini-search-input{min-width:300px}
.toolbar-mini-filter-select{min-width:220px}

.summary-bar{
  margin: 0 14px 12px;
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.summary-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 8px 10px;
  border-radius: 999px;
  border:1px solid rgba(148,163,184,0.16);
  background: rgba(var(--tone-0),0.14);
  font-size: 12px;
  color: var(--muted);
}
.summary-pill strong{color: var(--text); font-weight:800;}

.auto-restart-card{
  margin: 0 14px 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-0), 0.12);
}
.auto-restart-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.auto-restart-title{
  font-size:13px;
  font-weight:800;
  color: var(--text);
}
.auto-restart-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:10px;
}
.auto-restart-item .k{
  font-size:11px;
  color: var(--muted);
}
.auto-restart-item .v{
  margin-top:4px;
  font-size:13px;
  font-weight:700;
  color: var(--text);
  overflow-wrap:anywhere;
}
.auto-restart-foot{
  margin-top:10px;
}

/* Make action column compact */
.rules-actions{display:flex; gap:6px; justify-content:flex-end;}
.icon-btn{
  width:30px;
  height:30px;
  border-radius: 10px;
}

@media (max-width: 980px){
  .split-layout{grid-template-columns: 1fr;}
  .node-sidebar{position:relative; top:0;}
  .node-sidebar{padding:12px;}
  .node-sidebar .card-header{padding:0 0 10px;}
  .node-list{
    padding:0;
    flex-direction:row;
    gap:8px;
    max-height:none;
    overflow:auto;
    scroll-snap-type:x proximity;
    -webkit-overflow-scrolling:touch;
  }
  /* Keep horizontal scroll experience on mobile while preserving group order */
  .node-group{display:contents;}
  .node-group-head{display:none;}
  .node-group-items{display:contents;}
  .node-group-divider{display:block; width:1px; height:44px; background:rgba(148,163,184,0.14); align-self:center; border-radius:999px; flex:0 0 auto;}
  .node-item-row{min-width:238px; flex:0 0 auto; scroll-snap-align:start;}
  .node-item{min-width:0; flex:1 1 auto; scroll-snap-align:none;}
  .sidebar-foot{display:none;}
  .node-tools .toolbar-mini-search .menu-pop{min-width:300px;}
  .toolbar-mini-search-input{min-width:240px;}
  .auto-restart-grid{grid-template-columns:1fr;}
}

@media (max-width: 520px){
  .node-tools{gap:8px}
  .node-tools{width:100%;}
  .node-tools .btn{flex:0 0 auto;}
  .node-tools details.menu{flex:0 0 auto;}
  .node-tools .toolbar-mini .menu-pop{min-width:min(300px, calc(100vw - 24px));}
  .toolbar-mini-search-input,.toolbar-mini-filter-select{min-width:0; width:100%;}
  .node-item-row{min-width:206px;}
  .node-item{min-width:0; padding: 9px; border-radius: 12px;}
  .node-group-divider{height:40px;}
  .node-sidebar .node-meta{display:none;}
  .icon-btn{width:28px;height:28px;border-radius: 9px;}
}

/* Node page: phone layout fixes (avoid title/meta becoming ultra-narrow) */
@media (max-width: 640px){
  .node-head{flex-wrap:wrap; gap:10px;}
  .node-head-left{flex:1 1 100%;}
  .node-head-right{flex:1 1 100%; justify-content:flex-start !important;}
  .node-main .meta{flex-wrap:wrap;}

  /* Mobile toolbar: no horizontal clipping; show all controls in a 2-col grid */
  .node-tools{
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:8px;
    width:100%;
    overflow:visible;
    padding-bottom:0;
    align-items:stretch;
  }
  .node-tools > *{
    min-width:0;
    width:100%;
  }
  .node-tools > .btn,
  .node-tools > details.menu > summary{
    width:100%;
    justify-content:center;
    text-align:center;
  }
  .node-tools > details.menu{width:100%;}
  .node-tools .toolbar-main-cta{grid-column:1 / -1; order:1;}
  .node-tools .toolbar-mini-search{order:2;}
  .node-tools .toolbar-mini-filter{order:3;}
  .node-tools .toolbar-select-toggle{order:4;}
  .node-tools .toolbar-command{order:5;}
  .node-tools .toolbar-rules{order:6;}
  .node-tools .toolbar-node{order:7;}
  .node-tools #bulkBar{
    grid-column:1 / -1;
    order:8;
    justify-content:flex-start;
    overflow-x:auto;
  }
  .node-tools .toolbar-mini .menu-pop{
    min-width:min(320px, calc(100vw - 24px));
  }
}



/* Remote targets chips */
.remote-wrap{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.remote-wrap.expanded{flex-direction:column;flex-wrap:nowrap;align-items:flex-start}
.remote-chip{
  display:inline-flex;
  align-items:center;
  padding:6px 8px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,0.16);
  background: rgba(var(--tone-0),0.18);
  color: var(--text);
  max-width: 260px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:12px;
}

/* Inline expand area (+N -> multi-line) */
.remote-extra{flex-basis:100%;display:flex;flex-direction:column;gap:6px;margin-top:6px;padding-left:2px;overflow:hidden}
.remote-line{display:flex;flex-wrap:wrap;gap:6px}

/* Table header glass + sticky */
.table thead th{
  position:static;
  top:auto;
  z-index:1;
  background: rgba(var(--tone-0),0.98);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  border-bottom:1px solid rgba(148,163,184,0.18);
}

/* Opt-in sticky header (avoid global overlap/ghosting on long rows). */
.table.sticky-head thead th{
  position:sticky;
  top:var(--sticky-top);
  z-index:3;
}

/* Node rules table: keep header static to avoid stacking glitches. */
.node-main .table thead th{
  position:static;
  top:auto;
  z-index:1;
  background: rgba(var(--tone-0),0.98);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}

.table tbody tr:nth-child(2n) td{background: rgba(148,163,184,0.015);}
.table tbody tr:hover td{background: rgba(148,163,184,0.06);}

/* Tunnel groups: board monitor v2 */
.tg-board-shell{
  padding:10px;
  --tg-empty-border:rgba(148,163,184,0.32);
  --tg-empty-bg:rgba(2,8,23,0.38);
  --tg-card-border:rgba(56,189,248,0.24);
  --tg-card-bg:
    radial-gradient(130% 155% at 0% 0%, rgba(56,189,248,0.16), transparent 56%),
    radial-gradient(120% 136% at 100% 100%, rgba(59,130,246,0.14), transparent 62%),
    linear-gradient(180deg, rgba(6,12,28,0.92), rgba(3,9,22,0.90));
  --tg-card-shadow:0 0 0 1px rgba(125,211,252,0.08) inset, 0 22px 48px rgba(0,7,20,0.50);
  --tg-card-accent:linear-gradient(180deg, rgba(56,189,248,0.95), rgba(59,130,246,0.36));
  --tg-card-border-ok:rgba(16,185,129,0.40);
  --tg-card-border-warn:rgba(245,158,11,0.44);
  --tg-card-border-bad:rgba(239,68,68,0.48);
  --tg-card-accent-ok:linear-gradient(180deg, rgba(16,185,129,0.95), rgba(45,212,191,0.38));
  --tg-card-accent-warn:linear-gradient(180deg, rgba(245,158,11,0.95), rgba(251,191,36,0.38));
  --tg-card-accent-bad:linear-gradient(180deg, rgba(248,113,113,0.95), rgba(239,68,68,0.38));

  --tg-index-border:rgba(148,163,184,0.30);
  --tg-index-bg:rgba(148,163,184,0.12);
  --tg-index-text:rgba(var(--tone-text-mid),0.90);
  --tg-title:#eef6ff;

  --tg-neutral-border:rgba(148,163,184,0.32);
  --tg-neutral-bg:rgba(148,163,184,0.12);
  --tg-neutral-text:rgba(var(--tone-text-mid),0.92);
  --tg-ok-border:rgba(16,185,129,0.44);
  --tg-ok-bg:rgba(16,185,129,0.16);
  --tg-ok-text:rgba(110,255,202,0.98);
  --tg-warn-border:rgba(245,158,11,0.45);
  --tg-warn-bg:rgba(245,158,11,0.16);
  --tg-warn-text:rgba(255,225,159,0.98);
  --tg-bad-border:rgba(248,113,113,0.48);
  --tg-bad-bg:rgba(248,113,113,0.16);
  --tg-bad-text:rgba(255,201,201,0.98);

  --tg-kv-border:rgba(125,211,252,0.24);
  --tg-kv-bg:rgba(15,23,42,0.34);
  --tg-kv-k:rgba(var(--tone-text-mid),0.78);
  --tg-kv-v:rgba(232,244,255,0.98);
  --tg-kv-disabled-border:rgba(248,113,113,0.32);
  --tg-kv-disabled-bg:rgba(248,113,113,0.14);

  --tg-health-border:rgba(125,211,252,0.24);
  --tg-health-bg:
    radial-gradient(120% 130% at 0% 0%, rgba(14,165,233,0.12), transparent 68%),
    linear-gradient(180deg, rgba(15,23,42,0.36), rgba(15,23,42,0.24));

  --tg-stat-border:rgba(148,163,184,0.26);
  --tg-stat-bg:rgba(15,23,42,0.36);
  --tg-stat-text:rgba(var(--tone-text-mid),0.92);
  --tg-stat-strong:rgba(236,246,255,0.98);
  --tg-stat-info-border:rgba(56,189,248,0.40);
  --tg-stat-info-bg:rgba(56,189,248,0.16);
  --tg-stat-warn-border:rgba(245,158,11,0.42);
  --tg-stat-warn-bg:rgba(245,158,11,0.16);

  --tg-member-border:rgba(148,163,184,0.26);
  --tg-member-bg:
    radial-gradient(120% 140% at 0% 0%, rgba(56,189,248,0.10), transparent 66%),
    linear-gradient(180deg, rgba(15,23,42,0.54), rgba(15,23,42,0.30));
  --tg-member-ok-shadow:0 0 0 1px rgba(16,185,129,0.13) inset;
  --tg-member-warn-shadow:0 0 0 1px rgba(245,158,11,0.14) inset;
  --tg-member-bad-shadow:0 0 0 1px rgba(239,68,68,0.16) inset;
  --tg-member-name:#ecf6ff;

  --tg-online-border:rgba(148,163,184,0.30);
  --tg-online-bg:rgba(15,23,42,0.48);
  --tg-online-text:rgba(var(--tone-text-mid),0.94);
  --tg-online-on-border:rgba(34,197,94,0.48);
  --tg-online-on-bg:rgba(22,163,74,0.18);
  --tg-online-on-text:rgba(132,255,217,0.99);
  --tg-online-on-shadow:0 0 16px rgba(22,163,74,0.22);
  --tg-online-off-border:rgba(248,113,113,0.40);
  --tg-online-off-bg:rgba(127,29,29,0.20);
  --tg-online-off-text:rgba(255,208,208,0.95);

  --tg-focus-border:rgba(125,211,252,0.22);
  --tg-focus-bg:rgba(15,23,42,0.34);
  --tg-focus-k:rgba(var(--tone-text-mid),0.74);
  --tg-focus-v:rgba(236,246,255,0.98);
  --tg-focus-v-util:rgba(210,245,255,0.98);
  --tg-track-bg:rgba(51,65,85,0.66);
  --tg-track-fill:linear-gradient(90deg, rgba(34,211,238,0.95), rgba(59,130,246,0.95));
  --tg-track-shadow:0 0 14px rgba(34,211,238,0.32);

  --tg-chip-border:rgba(148,163,184,0.26);
  --tg-chip-bg:rgba(15,23,42,0.34);
  --tg-chip-text:rgba(var(--tone-text-mid),0.92);
  --tg-chip-soft-border:rgba(125,211,252,0.22);
  --tg-chip-soft-text:rgba(218,233,250,0.90);
  --tg-chip-active-border:rgba(34,197,94,0.40);
  --tg-chip-active-bg:rgba(22,163,74,0.16);
  --tg-chip-active-text:rgba(132,255,217,0.98);
  --tg-chip-loss-ok-border:rgba(34,197,94,0.40);
  --tg-chip-loss-ok-bg:rgba(34,197,94,0.16);
  --tg-chip-loss-ok-text:rgba(132,255,217,0.98);
  --tg-chip-loss-warn-border:rgba(245,158,11,0.42);
  --tg-chip-loss-warn-bg:rgba(245,158,11,0.16);
  --tg-chip-loss-warn-text:rgba(255,225,159,0.98);
  --tg-chip-loss-bad-border:rgba(248,113,113,0.44);
  --tg-chip-loss-bad-bg:rgba(248,113,113,0.16);
  --tg-chip-loss-bad-text:rgba(255,201,201,0.98);
  --tg-mobile-sep:rgba(148,163,184,0.18);

  --tg-rule-shell-border:rgba(125,211,252,0.22);
  --tg-rule-shell-bg:
    radial-gradient(120% 130% at 0% 0%, rgba(14,165,233,0.12), transparent 70%),
    linear-gradient(180deg, rgba(15,23,42,0.28), rgba(15,23,42,0.20));
  --tg-rule-filter-border:rgba(148,163,184,0.30);
  --tg-rule-filter-bg:rgba(15,23,42,0.34);
  --tg-rule-item-border:rgba(125,211,252,0.20);
  --tg-rule-item-bg:
    radial-gradient(120% 130% at 0% 0%, rgba(56,189,248,0.10), transparent 72%),
    linear-gradient(180deg, rgba(15,23,42,0.32), rgba(15,23,42,0.24));
  --tg-rule-item-hover-border:rgba(56,189,248,0.34);
  --tg-rule-item-shadow:0 0 0 1px rgba(15,23,42,0.22) inset, 0 10px 24px rgba(2,8,23,0.18);
  --tg-rule-item-open-shadow:0 0 0 1px rgba(56,189,248,0.18) inset, 0 16px 34px rgba(2,8,23,0.26);
  --tg-rule-tone-ok:linear-gradient(180deg, rgba(34,197,94,0.90), rgba(16,185,129,0.34));
  --tg-rule-tone-warn:linear-gradient(180deg, rgba(245,158,11,0.94), rgba(251,191,36,0.38));
  --tg-rule-tone-bad:linear-gradient(180deg, rgba(239,68,68,0.95), rgba(248,113,113,0.38));
  --tg-rule-listen-bg:linear-gradient(180deg, rgba(2,8,23,0.34), rgba(15,23,42,0.16));
  --tg-rule-listen-border:rgba(56,189,248,0.26);
  --tg-rule-listen-text:rgba(236,246,255,0.98);
  --tg-rule-kpi-border:rgba(125,211,252,0.22);
  --tg-rule-kpi-bg:rgba(15,23,42,0.28);
  --tg-rule-kpi-key:rgba(var(--tone-text-mid),0.78);
  --tg-rule-kpi-value:rgba(236,246,255,0.98);
  --tg-rule-kpi-sub:rgba(var(--tone-text-mid),0.88);
  --tg-rule-kpi-track-bg:rgba(51,65,85,0.72);
  --tg-rule-kpi-track-fill:linear-gradient(90deg, rgba(34,211,238,0.94), rgba(59,130,246,0.94));
  --tg-rule-kpi-track-shadow:0 0 12px rgba(34,211,238,0.26);
  --tg-rule-top3-track-bg:rgba(51,65,85,0.72);
  --tg-rule-top3-track-fill:linear-gradient(90deg, rgba(34,197,94,0.94), rgba(14,165,233,0.94));
  --tg-rule-top3-track-shadow:0 0 10px rgba(14,165,233,0.22);
  --tg-rule-expand-border:rgba(148,163,184,0.34);
  --tg-rule-expand-bg:rgba(15,23,42,0.34);
  --tg-rule-expand-arrow:rgba(218,233,250,0.94);
  --tg-rule-status-on-border:rgba(34,197,94,0.44);
  --tg-rule-status-on-bg:rgba(22,163,74,0.18);
  --tg-rule-status-on-text:rgba(132,255,217,0.98);
  --tg-rule-status-off-border:rgba(248,113,113,0.44);
  --tg-rule-status-off-bg:rgba(127,29,29,0.20);
  --tg-rule-status-off-text:rgba(255,208,208,0.95);
  --tg-rule-sync-border:rgba(148,163,184,0.28);
  --tg-rule-sync-bg:rgba(15,23,42,0.36);
  --tg-rule-sync-text:rgba(218,233,250,0.92);
  --tg-rule-remotes-bg:rgba(15,23,42,0.30);
  --tg-rule-remotes-border:rgba(148,163,184,0.26);
  --tg-rule-json-bg:rgba(2,8,23,0.44);
  --tg-rule-json-border:rgba(148,163,184,0.26);
  --tg-rule-json-text:rgba(214,230,247,0.92);
}

:root[data-theme="light"] .tg-board-shell{
  --tg-empty-border:rgba(148,163,184,0.44);
  --tg-empty-bg:linear-gradient(180deg, rgba(255,255,255,0.95), rgba(241,245,249,0.92));
  --tg-card-border:rgba(59,130,246,0.28);
  --tg-card-bg:
    radial-gradient(130% 155% at 0% 0%, rgba(59,130,246,0.12), transparent 60%),
    radial-gradient(120% 136% at 100% 100%, rgba(14,165,233,0.10), transparent 66%),
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(244,248,253,0.94));
  --tg-card-shadow:0 0 0 1px rgba(255,255,255,0.75) inset, 0 14px 30px rgba(15,23,42,0.10);
  --tg-card-accent:linear-gradient(180deg, rgba(59,130,246,0.90), rgba(14,165,233,0.38));
  --tg-card-border-ok:rgba(22,163,74,0.40);
  --tg-card-border-warn:rgba(217,119,6,0.44);
  --tg-card-border-bad:rgba(220,38,38,0.42);
  --tg-card-accent-ok:linear-gradient(180deg, rgba(22,163,74,0.90), rgba(16,185,129,0.34));
  --tg-card-accent-warn:linear-gradient(180deg, rgba(217,119,6,0.92), rgba(251,191,36,0.36));
  --tg-card-accent-bad:linear-gradient(180deg, rgba(220,38,38,0.90), rgba(248,113,113,0.36));

  --tg-index-border:rgba(148,163,184,0.44);
  --tg-index-bg:rgba(226,232,240,0.82);
  --tg-index-text:#475569;
  --tg-title:#0f172a;

  --tg-neutral-border:rgba(148,163,184,0.46);
  --tg-neutral-bg:rgba(226,232,240,0.70);
  --tg-neutral-text:#334155;
  --tg-ok-border:rgba(22,163,74,0.46);
  --tg-ok-bg:rgba(34,197,94,0.17);
  --tg-ok-text:#15803d;
  --tg-warn-border:rgba(217,119,6,0.46);
  --tg-warn-bg:rgba(251,191,36,0.22);
  --tg-warn-text:#92400e;
  --tg-bad-border:rgba(220,38,38,0.44);
  --tg-bad-bg:rgba(254,202,202,0.56);
  --tg-bad-text:#b91c1c;

  --tg-kv-border:rgba(148,163,184,0.44);
  --tg-kv-bg:rgba(255,255,255,0.88);
  --tg-kv-k:#64748b;
  --tg-kv-v:#0f172a;
  --tg-kv-disabled-border:rgba(220,38,38,0.40);
  --tg-kv-disabled-bg:rgba(254,226,226,0.64);

  --tg-health-border:rgba(148,163,184,0.42);
  --tg-health-bg:
    radial-gradient(120% 130% at 0% 0%, rgba(59,130,246,0.10), transparent 70%),
    linear-gradient(180deg, rgba(255,255,255,0.95), rgba(242,247,253,0.94));

  --tg-stat-border:rgba(148,163,184,0.44);
  --tg-stat-bg:rgba(255,255,255,0.90);
  --tg-stat-text:#334155;
  --tg-stat-strong:#0f172a;
  --tg-stat-info-border:rgba(59,130,246,0.40);
  --tg-stat-info-bg:rgba(59,130,246,0.14);
  --tg-stat-warn-border:rgba(217,119,6,0.44);
  --tg-stat-warn-bg:rgba(251,191,36,0.20);

  --tg-member-border:rgba(148,163,184,0.40);
  --tg-member-bg:
    radial-gradient(120% 140% at 0% 0%, rgba(59,130,246,0.08), transparent 68%),
    linear-gradient(180deg, rgba(255,255,255,0.95), rgba(243,247,253,0.93));
  --tg-member-ok-shadow:0 0 0 1px rgba(22,163,74,0.16) inset;
  --tg-member-warn-shadow:0 0 0 1px rgba(217,119,6,0.16) inset;
  --tg-member-bad-shadow:0 0 0 1px rgba(220,38,38,0.16) inset;
  --tg-member-name:#0f172a;

  --tg-online-border:rgba(148,163,184,0.44);
  --tg-online-bg:rgba(248,250,252,0.95);
  --tg-online-text:#334155;
  --tg-online-on-border:rgba(22,163,74,0.46);
  --tg-online-on-bg:rgba(34,197,94,0.16);
  --tg-online-on-text:#15803d;
  --tg-online-on-shadow:0 0 10px rgba(34,197,94,0.16);
  --tg-online-off-border:rgba(220,38,38,0.42);
  --tg-online-off-bg:rgba(254,226,226,0.62);
  --tg-online-off-text:#b91c1c;

  --tg-focus-border:rgba(148,163,184,0.42);
  --tg-focus-bg:rgba(255,255,255,0.92);
  --tg-focus-k:#64748b;
  --tg-focus-v:#0f172a;
  --tg-focus-v-util:#0b4a7a;
  --tg-track-bg:rgba(148,163,184,0.34);
  --tg-track-fill:linear-gradient(90deg, rgba(14,165,233,0.95), rgba(37,99,235,0.95));
  --tg-track-shadow:0 0 10px rgba(37,99,235,0.22);

  --tg-chip-border:rgba(148,163,184,0.42);
  --tg-chip-bg:rgba(255,255,255,0.92);
  --tg-chip-text:#334155;
  --tg-chip-soft-border:rgba(100,116,139,0.40);
  --tg-chip-soft-text:#1e293b;
  --tg-chip-active-border:rgba(22,163,74,0.46);
  --tg-chip-active-bg:rgba(34,197,94,0.18);
  --tg-chip-active-text:#15803d;
  --tg-chip-loss-ok-border:rgba(22,163,74,0.46);
  --tg-chip-loss-ok-bg:rgba(34,197,94,0.18);
  --tg-chip-loss-ok-text:#15803d;
  --tg-chip-loss-warn-border:rgba(217,119,6,0.44);
  --tg-chip-loss-warn-bg:rgba(251,191,36,0.24);
  --tg-chip-loss-warn-text:#92400e;
  --tg-chip-loss-bad-border:rgba(220,38,38,0.42);
  --tg-chip-loss-bad-bg:rgba(254,202,202,0.60);
  --tg-chip-loss-bad-text:#b91c1c;
  --tg-mobile-sep:rgba(148,163,184,0.34);

  --tg-rule-shell-border:rgba(148,163,184,0.42);
  --tg-rule-shell-bg:
    radial-gradient(120% 130% at 0% 0%, rgba(59,130,246,0.10), transparent 72%),
    linear-gradient(180deg, rgba(255,255,255,0.95), rgba(244,248,253,0.94));
  --tg-rule-filter-border:rgba(148,163,184,0.42);
  --tg-rule-filter-bg:rgba(255,255,255,0.92);
  --tg-rule-item-border:rgba(148,163,184,0.38);
  --tg-rule-item-bg:
    radial-gradient(120% 130% at 0% 0%, rgba(59,130,246,0.08), transparent 74%),
    linear-gradient(180deg, rgba(255,255,255,0.95), rgba(243,247,253,0.94));
  --tg-rule-item-hover-border:rgba(59,130,246,0.38);
  --tg-rule-item-shadow:0 0 0 1px rgba(255,255,255,0.82) inset, 0 10px 22px rgba(15,23,42,0.09);
  --tg-rule-item-open-shadow:0 0 0 1px rgba(59,130,246,0.20) inset, 0 16px 32px rgba(37,99,235,0.14);
  --tg-rule-tone-ok:linear-gradient(180deg, rgba(22,163,74,0.90), rgba(16,185,129,0.34));
  --tg-rule-tone-warn:linear-gradient(180deg, rgba(217,119,6,0.92), rgba(251,191,36,0.36));
  --tg-rule-tone-bad:linear-gradient(180deg, rgba(220,38,38,0.90), rgba(248,113,113,0.36));
  --tg-rule-listen-bg:linear-gradient(180deg, rgba(255,255,255,0.96), rgba(241,245,249,0.92));
  --tg-rule-listen-border:rgba(59,130,246,0.32);
  --tg-rule-listen-text:#0f172a;
  --tg-rule-kpi-border:rgba(148,163,184,0.44);
  --tg-rule-kpi-bg:rgba(255,255,255,0.92);
  --tg-rule-kpi-key:#64748b;
  --tg-rule-kpi-value:#0f172a;
  --tg-rule-kpi-sub:#334155;
  --tg-rule-kpi-track-bg:rgba(148,163,184,0.34);
  --tg-rule-kpi-track-fill:linear-gradient(90deg, rgba(14,165,233,0.94), rgba(37,99,235,0.94));
  --tg-rule-kpi-track-shadow:0 0 8px rgba(37,99,235,0.18);
  --tg-rule-top3-track-bg:rgba(148,163,184,0.34);
  --tg-rule-top3-track-fill:linear-gradient(90deg, rgba(22,163,74,0.90), rgba(14,165,233,0.90));
  --tg-rule-top3-track-shadow:0 0 8px rgba(16,185,129,0.16);
  --tg-rule-expand-border:rgba(148,163,184,0.44);
  --tg-rule-expand-bg:rgba(255,255,255,0.94);
  --tg-rule-expand-arrow:#334155;
  --tg-rule-status-on-border:rgba(22,163,74,0.44);
  --tg-rule-status-on-bg:rgba(34,197,94,0.16);
  --tg-rule-status-on-text:#15803d;
  --tg-rule-status-off-border:rgba(220,38,38,0.42);
  --tg-rule-status-off-bg:rgba(254,226,226,0.62);
  --tg-rule-status-off-text:#b91c1c;
  --tg-rule-sync-border:rgba(148,163,184,0.44);
  --tg-rule-sync-bg:rgba(255,255,255,0.92);
  --tg-rule-sync-text:#334155;
  --tg-rule-remotes-bg:rgba(255,255,255,0.90);
  --tg-rule-remotes-border:rgba(148,163,184,0.40);
  --tg-rule-json-bg:rgba(248,250,252,0.92);
  --tg-rule-json-border:rgba(148,163,184,0.40);
  --tg-rule-json-text:#1e293b;
}
.tg-board{
  display:grid;
  gap:12px;
}
.tg-board-empty{
  padding:24px 14px;
  border-radius:14px;
  border:1px dashed var(--tg-empty-border);
  background:var(--tg-empty-bg);
  text-align:center;
}
.tg-group-card{
  position:relative;
  overflow:hidden;
  border-radius:16px;
  border:1px solid var(--tg-card-border);
  padding:12px;
  background:var(--tg-card-bg);
  box-shadow:var(--tg-card-shadow);
}
.tg-group-card::before{
  content:"";
  position:absolute;
  left:0;
  top:10px;
  bottom:10px;
  width:3px;
  border-radius:999px;
  background:var(--tg-card-accent);
}
.tg-group-card[data-state="ok"]{
  border-color:var(--tg-card-border-ok);
}
.tg-group-card[data-state="ok"]::before{
  background:var(--tg-card-accent-ok);
}
.tg-group-card[data-state="warn"]{
  border-color:var(--tg-card-border-warn);
}
.tg-group-card[data-state="warn"]::before{
  background:var(--tg-card-accent-warn);
}
.tg-group-card[data-state="bad"]{
  border-color:var(--tg-card-border-bad);
}
.tg-group-card[data-state="bad"]::before{
  background:var(--tg-card-accent-bad);
}
.tg-group-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.tg-group-main{
  min-width:0;
}
.tg-group-title-line{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  min-width:0;
}
.tg-group-index{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:28px;
  height:22px;
  padding:0 8px;
  border-radius:999px;
  border:1px solid var(--tg-index-border);
  background:var(--tg-index-bg);
  color:var(--tg-index-text);
  font-size:11px;
  font-weight:800;
}
.tg-group-name{
  min-width:0;
  max-width:420px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:19px;
  font-weight:920;
  letter-spacing:0.2px;
  color:var(--tg-title);
}
.tg-group-state{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--tg-neutral-border);
  background:var(--tg-neutral-bg);
  color:var(--tg-neutral-text);
  font-size:11px;
  font-weight:850;
  white-space:nowrap;
}
.tg-group-state.ok{
  border-color:var(--tg-ok-border);
  background:var(--tg-ok-bg);
  color:var(--tg-ok-text);
}
.tg-group-state.warn{
  border-color:var(--tg-warn-border);
  background:var(--tg-warn-bg);
  color:var(--tg-warn-text);
}
.tg-group-state.bad{
  border-color:var(--tg-bad-border);
  background:var(--tg-bad-bg);
  color:var(--tg-bad-text);
}
.tg-group-state.ghost{
  color:var(--tg-neutral-text);
}
.tg-group-online{
  white-space:nowrap;
}
.tg-group-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:6px;
  flex-wrap:wrap;
}
.tg-group-config-scroll{
  margin-top:10px;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:thin;
}
.tg-group-config{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:max-content;
  padding-bottom:2px;
}
.tg-kv{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--tg-kv-border);
  background:var(--tg-kv-bg);
  white-space:nowrap;
  font-size:11px;
}
.tg-kv .k{
  color:var(--tg-kv-k);
}
.tg-kv .v{
  color:var(--tg-kv-v);
  font-weight:860;
}
.tg-kv.is-disabled{
  border-color:var(--tg-kv-disabled-border);
  background:var(--tg-kv-disabled-bg);
}
.tg-health-panel{
  margin-top:12px;
  border:1px solid var(--tg-health-border);
  border-radius:12px;
  padding:10px;
  background:var(--tg-health-bg);
}
.tg-health-panel.tg-health-empty{
  padding:10px 12px;
}
.tg-health-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.tg-health-title{
  font-size:12px;
  font-weight:860;
  letter-spacing:0.02em;
}
.tg-health-pills{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  justify-content:flex-end;
}
.tg-stat{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 9px;
  border-radius:999px;
  border:1px solid var(--tg-stat-border);
  background:var(--tg-stat-bg);
  font-size:11px;
  color:var(--tg-stat-text);
}
.tg-stat strong{
  color:var(--tg-stat-strong);
  font-weight:860;
}
.tg-stat.info{
  border-color:var(--tg-stat-info-border);
  background:var(--tg-stat-info-bg);
}
.tg-stat.warn{
  border-color:var(--tg-stat-warn-border);
  background:var(--tg-stat-warn-bg);
}
.tg-health-grid{
  margin-top:8px;
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:8px;
}
.tg-member-card{
  border:1px solid var(--tg-member-border);
  border-radius:12px;
  padding:9px;
  background:var(--tg-member-bg);
  display:flex;
  flex-direction:column;
  gap:8px;
}
.tg-member-card.is-ok{
  border-color:var(--tg-ok-border);
  box-shadow:var(--tg-member-ok-shadow);
}
.tg-member-card.is-warn{
  border-color:var(--tg-warn-border);
  box-shadow:var(--tg-member-warn-shadow);
}
.tg-member-card.is-bad{
  border-color:var(--tg-bad-border);
  box-shadow:var(--tg-member-bad-shadow);
}
.tg-member-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
}
.tg-member-name-wrap{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}
.tg-member-name{
  min-width:0;
  max-width:200px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:17px;
  font-weight:900;
  color:var(--tg-member-name);
}
.tg-quality{
  display:inline-flex;
  align-items:center;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid var(--tg-neutral-border);
  background:var(--tg-neutral-bg);
  color:var(--tg-neutral-text);
  font-size:11px;
  font-weight:820;
}
.tg-quality.ok{
  border-color:var(--tg-ok-border);
  background:var(--tg-ok-bg);
  color:var(--tg-ok-text);
}
.tg-quality.warn{
  border-color:var(--tg-warn-border);
  background:var(--tg-warn-bg);
  color:var(--tg-warn-text);
}
.tg-quality.bad{
  border-color:var(--tg-bad-border);
  background:var(--tg-bad-bg);
  color:var(--tg-bad-text);
}
.tg-quality.ghost{
  color:var(--tg-neutral-text);
}
.tg-online-state{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:52px;
  height:24px;
  padding:0 10px;
  border-radius:999px;
  border:1px solid var(--tg-online-border);
  background:var(--tg-online-bg);
  font-size:11px;
  font-weight:860;
  letter-spacing:0.2px;
  white-space:nowrap;
  color:var(--tg-online-text);
}
.tg-online-state.is-online{
  color:var(--tg-online-on-text);
  border-color:var(--tg-online-on-border);
  background:var(--tg-online-on-bg);
  box-shadow:var(--tg-online-on-shadow);
}
.tg-online-state.is-offline{
  color:var(--tg-online-off-text);
  border-color:var(--tg-online-off-border);
  background:var(--tg-online-off-bg);
}
.tg-member-focus-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:7px;
}
.tg-focus-item{
  min-width:0;
  border:1px solid var(--tg-focus-border);
  border-radius:10px;
  background:var(--tg-focus-bg);
  padding:7px 8px;
}
.tg-focus-k{
  font-size:11px;
  color:var(--tg-focus-k);
  line-height:1.2;
}
.tg-focus-v{
  margin-top:3px;
  font-size:14px;
  font-weight:860;
  color:var(--tg-focus-v);
  line-height:1.2;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.tg-focus-util .tg-focus-v{
  color:var(--tg-focus-v-util);
}
.tg-util-track{
  margin-top:6px;
  height:4px;
  border-radius:999px;
  background:var(--tg-track-bg);
  overflow:hidden;
}
.tg-util-track > span{
  display:block;
  height:100%;
  border-radius:999px;
  background:var(--tg-track-fill);
  box-shadow:var(--tg-track-shadow);
}
.tg-member-pills{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.tg-member-metrics{
  opacity:0.96;
}
.tg-member-context{
  opacity:0.86;
}
.tg-chip{
  display:inline-flex;
  align-items:center;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid var(--tg-chip-border);
  background:var(--tg-chip-bg);
  color:var(--tg-chip-text);
  font-size:11px;
  line-height:1.25;
  white-space:nowrap;
}
.tg-chip.soft{
  border-color:var(--tg-chip-soft-border);
  color:var(--tg-chip-soft-text);
}
.tg-chip.active{
  border-color:var(--tg-chip-active-border);
  background:var(--tg-chip-active-bg);
  color:var(--tg-chip-active-text);
}
.tg-chip.loss-ok{
  border-color:var(--tg-chip-loss-ok-border);
  background:var(--tg-chip-loss-ok-bg);
  color:var(--tg-chip-loss-ok-text);
}
.tg-chip.loss-warn{
  border-color:var(--tg-chip-loss-warn-border);
  background:var(--tg-chip-loss-warn-bg);
  color:var(--tg-chip-loss-warn-text);
}
.tg-chip.loss-bad{
  border-color:var(--tg-chip-loss-bad-border);
  background:var(--tg-chip-loss-bad-bg);
  color:var(--tg-chip-loss-bad-text);
}
.tg-member-err{
  margin-top:2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.tg-health-foot{
  margin-top:8px;
}
.tg-rule-shell{
  border:1px solid var(--tg-rule-shell-border);
  background:var(--tg-rule-shell-bg);
}
.tg-rule-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.tg-rule-head-main{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.tg-rule-head-meta{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}
.tg-rule-hint{
  display:inline-flex;
  align-items:center;
  height:22px;
  padding:0 9px;
  border-radius:999px;
  border:1px solid var(--tg-rule-filter-border);
  background:var(--tg-rule-filter-bg);
  color:var(--tg-neutral-text);
  font-size:11px;
  font-weight:700;
}
.tg-rule-head-actions{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.tg-rule-filters{
  margin-top:10px;
  display:grid;
  grid-template-columns:repeat(5, minmax(0, 1fr));
  gap:8px;
}
.tg-rule-filters .select,
.tg-rule-filters .input{
  border-color:var(--tg-rule-filter-border);
  background:var(--tg-rule-filter-bg);
}
.tg-rule-list{
  margin-top:10px;
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:10px;
  align-items:start;
}
.tg-rule-empty{
  grid-column:1 / -1;
  border:1px dashed var(--tg-rule-filter-border);
  border-radius:12px;
  padding:14px 12px;
  text-align:center;
}
.tg-rule-item{
  position:relative;
  border:1px solid var(--tg-rule-item-border);
  border-radius:12px;
  background:var(--tg-rule-item-bg);
  overflow:hidden;
  box-shadow:var(--tg-rule-item-shadow);
  transition:
    border-color var(--motion-base) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard);
}
.tg-rule-item::before{
  content:"";
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  width:4px;
  background:linear-gradient(180deg, rgba(56,189,248,0.9), rgba(59,130,246,0.34));
  opacity:.9;
}
.tg-rule-item.tone-ok::before{ background:var(--tg-rule-tone-ok); }
.tg-rule-item.tone-warn::before{ background:var(--tg-rule-tone-warn); }
.tg-rule-item.tone-bad::before{ background:var(--tg-rule-tone-bad); }
.tg-rule-item.tone-warn{
  border-color:var(--tg-warn-border);
}
.tg-rule-item.tone-bad{
  border-color:var(--tg-bad-border);
}
.tg-rule-item[open]{
  border-color:var(--tg-rule-item-hover-border);
  transform:translateY(var(--hover-lift));
  box-shadow:var(--tg-rule-item-open-shadow);
}
.tg-rule-item:hover{
  border-color:var(--tg-rule-item-hover-border);
  transform:translateY(var(--hover-lift));
  box-shadow:var(--tg-rule-item-open-shadow);
}
.tg-rule-item:active{transform:translateY(var(--press-lift));}
.tg-rule-summary{
  list-style:none;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  padding:11px;
  cursor:pointer;
}
.tg-rule-summary::-webkit-details-marker{display:none}
.tg-rule-main{min-width:0;flex:1 1 auto}
.tg-rule-line1{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.tg-rule-group{
  font-size:16px;
  font-weight:900;
  color:var(--tg-member-name);
}
.tg-rule-status{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:44px;
  height:22px;
  padding:0 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:860;
  border:1px solid var(--tg-neutral-border);
  color:var(--tg-neutral-text);
  background:var(--tg-neutral-bg);
}
.tg-rule-status.is-enabled{
  border-color:var(--tg-rule-status-on-border);
  background:var(--tg-rule-status-on-bg);
  color:var(--tg-rule-status-on-text);
}
.tg-rule-status.is-disabled{
  border-color:var(--tg-rule-status-off-border);
  background:var(--tg-rule-status-off-bg);
  color:var(--tg-rule-status-off-text);
}
.tg-rule-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:44px;
  height:22px;
  padding:0 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  border:1px solid var(--tg-stat-info-border);
  background:var(--tg-stat-info-bg);
  color:var(--tg-focus-v-util);
}
.tg-rule-badge.is-favorite{
  border-color:var(--tg-warn-border);
  background:var(--tg-warn-bg);
  color:var(--tg-warn-text);
}
.tg-rule-line2{
  margin-top:6px;
  display:block;
  padding:6px 8px;
  border-radius:10px;
  border:1px solid var(--tg-rule-listen-border);
  background:var(--tg-rule-listen-bg);
  color:var(--tg-rule-listen-text);
  font-size:28px;
  line-height:1.08;
  font-weight:900;
  letter-spacing:.02em;
  word-break:break-all;
}
.tg-rule-line3{
  margin-top:7px;
}
.tg-rule-line4{
  margin-top:4px;
  display:block;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  opacity:0.92;
}
.tg-rule-kpi-grid{
  margin-top:8px;
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:6px;
}
.tg-rule-kpi-card{
  border:1px solid var(--tg-rule-kpi-border);
  background:var(--tg-rule-kpi-bg);
  border-radius:10px;
  padding:6px 8px;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.tg-rule-kpi-card .k{
  font-size:11px;
  color:var(--tg-rule-kpi-key);
  font-weight:760;
}
.tg-rule-kpi-card strong{
  font-size:17px;
  line-height:1.1;
  font-weight:900;
  color:var(--tg-rule-kpi-value);
}
.tg-rule-kpi-card .sub{
  font-size:11px;
  color:var(--tg-rule-kpi-sub);
}
.tg-rule-kpi-track{
  display:block;
  margin-top:2px;
  height:6px;
  border-radius:999px;
  background:var(--tg-rule-kpi-track-bg);
  overflow:hidden;
}
.tg-rule-kpi-track i{
  display:block;
  height:100%;
  border-radius:999px;
  background:var(--tg-rule-kpi-track-fill);
  box-shadow:var(--tg-rule-kpi-track-shadow);
}
.tg-rule-health{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:44px;
  height:22px;
  padding:0 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:860;
  border:1px solid var(--tg-neutral-border);
  color:var(--tg-neutral-text);
  background:var(--tg-neutral-bg);
}
.tg-rule-health.ok{
  border-color:var(--tg-ok-border);
  background:var(--tg-ok-bg);
  color:var(--tg-ok-text);
}
.tg-rule-health.warn{
  border-color:var(--tg-warn-border);
  background:var(--tg-warn-bg);
  color:var(--tg-warn-text);
}
.tg-rule-health.bad{
  border-color:var(--tg-bad-border);
  background:var(--tg-bad-bg);
  color:var(--tg-bad-text);
}
.tg-rule-runtime{
  margin-top:7px;
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.tg-rule-runtime-pill{
  display:inline-flex;
  align-items:center;
  gap:5px;
  height:24px;
  padding:0 9px;
  border-radius:999px;
  border:1px solid var(--tg-stat-border);
  background:var(--tg-stat-bg);
  color:var(--tg-stat-text);
  font-size:11px;
  font-weight:780;
}
.tg-rule-runtime-pill strong{
  color:var(--tg-stat-strong);
}
.tg-rule-runtime-pill.info{
  border-color:var(--tg-stat-info-border);
  background:var(--tg-stat-info-bg);
}
.tg-rule-runtime-pill.warn{
  border-color:var(--tg-stat-warn-border);
  background:var(--tg-stat-warn-bg);
}
.tg-rule-top3-head{
  margin-top:8px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  font-size:12px;
  font-weight:820;
  color:var(--tg-member-name);
}
.tg-rule-top3{
  margin-top:6px;
  display:grid;
  grid-template-columns:1fr;
  gap:6px;
}
.tg-rule-top3-item{
  border:1px solid var(--tg-focus-border);
  background:var(--tg-focus-bg);
  border-radius:9px;
  padding:7px 8px;
}
.tg-rule-top3-name-wrap{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:7px;
}
.tg-rule-top3-name{
  font-size:12px;
  font-weight:860;
  color:var(--tg-member-name);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.tg-rule-top3-online{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:42px;
  height:21px;
  padding:0 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:760;
  border:1px solid var(--tg-online-border);
  background:var(--tg-online-bg);
  color:var(--tg-online-text);
}
.tg-rule-top3-online.is-online{
  border-color:var(--tg-online-on-border);
  background:var(--tg-online-on-bg);
  color:var(--tg-online-on-text);
}
.tg-rule-top3-online.is-offline{
  border-color:var(--tg-online-off-border);
  background:var(--tg-online-off-bg);
  color:var(--tg-online-off-text);
}
.tg-rule-top3-util-track{
  margin-top:5px;
  height:5px;
  border-radius:999px;
  background:var(--tg-rule-top3-track-bg);
  overflow:hidden;
}
.tg-rule-top3-util-track span{
  display:block;
  height:100%;
  border-radius:999px;
  background:var(--tg-rule-top3-track-fill);
  box-shadow:var(--tg-rule-top3-track-shadow);
}
.tg-rule-top3-metrics{
  margin-top:6px;
  display:flex;
  flex-wrap:wrap;
  gap:5px;
}
.tg-rule-top3-metric{
  display:inline-flex;
  align-items:center;
  height:21px;
  padding:0 8px;
  border-radius:999px;
  border:1px solid var(--tg-chip-soft-border);
  color:var(--tg-chip-soft-text);
  background:var(--tg-chip-bg);
  font-size:11px;
}
.tg-rule-top3-metric.util{
  border-color:var(--tg-stat-info-border);
  color:var(--tg-focus-v-util);
}
.tg-rule-top3-empty{
  border:1px dashed var(--tg-focus-border);
  border-radius:10px;
  padding:8px;
  text-align:center;
}
.tg-rule-meta{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:6px;
  flex-shrink:0;
  min-width:108px;
}
.tg-rule-saving{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:64px;
  height:22px;
  padding:0 9px;
  border-radius:999px;
  border:1px solid var(--tg-stat-info-border);
  background:var(--tg-stat-info-bg);
  color:var(--tg-focus-v-util);
  font-size:11px;
  font-weight:760;
}
.tg-rule-sync{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:88px;
  height:22px;
  padding:0 9px;
  border-radius:999px;
  border:1px solid var(--tg-rule-sync-border);
  background:var(--tg-rule-sync-bg);
  color:var(--tg-rule-sync-text);
  font-size:11px;
  font-weight:760;
}
.tg-rule-time{
  text-align:right;
}
.tg-rule-expand{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:24px;
  height:24px;
  border-radius:999px;
  border:1px solid var(--tg-rule-expand-border);
  background:var(--tg-rule-expand-bg);
}
.tg-rule-expand::before{
  content:"";
  width:8px;
  height:8px;
  border-right:2px solid var(--tg-rule-expand-arrow);
  border-bottom:2px solid var(--tg-rule-expand-arrow);
  transform:rotate(45deg) translateY(-1px);
  transition:transform var(--motion-fast) var(--ease-standard);
}
.tg-rule-item[open] .tg-rule-expand::before{
  transform:rotate(225deg) translateY(-1px);
}
.tg-rule-detail{
  margin-top:2px;
  padding:9px 10px 10px;
  border-top:1px solid var(--tg-rule-filter-border);
  background:linear-gradient(180deg, rgba(2,8,23,0.02), transparent 38%);
}
.tg-rule-detail-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:9px;
}
.tg-rule-detail-col{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.tg-rule-kv{
  display:flex;
  align-items:flex-start;
  gap:8px;
  border:1px solid var(--tg-focus-border);
  background:var(--tg-focus-bg);
  border-radius:9px;
  padding:6px 8px;
}
.tg-rule-kv .k{
  min-width:84px;
  color:var(--tg-focus-k);
  font-size:11px;
  font-weight:800;
}
.tg-rule-kv .v{
  min-width:0;
  color:var(--tg-focus-v);
  font-size:12px;
  line-height:1.35;
  word-break:break-all;
  font-weight:700;
}
.tg-rule-remotes-title{
  font-size:12px;
  color:var(--tg-focus-k);
  font-weight:760;
}
.tg-rule-remotes{
  border:1px solid var(--tg-rule-remotes-border);
  border-radius:10px;
  background:var(--tg-rule-remotes-bg);
  padding:8px;
  max-height:130px;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.tg-rule-snapshot-wrap{
  margin-top:8px;
}
.tg-rule-snapshot-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.tg-rule-snapshot{
  margin-top:6px;
  border:1px solid var(--tg-rule-json-border);
  border-radius:10px;
  background:var(--tg-rule-json-bg);
  color:var(--tg-rule-json-text);
  padding:8px;
  max-height:210px;
  overflow:auto;
  font-size:11px;
  line-height:1.35;
  white-space:pre-wrap;
  word-break:break-all;
}
.tg-rule-member-table-wrap{
  margin-top:8px;
}
.tg-rule-member-table-scroll{
  margin-top:6px;
  border:1px solid var(--tg-rule-remotes-border);
  border-radius:10px;
  background:var(--tg-rule-remotes-bg);
  overflow:auto;
}
.tg-rule-member-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:860px;
}
.tg-rule-member-table thead th{
  position:sticky;
  top:0;
  background:var(--tg-rule-json-bg);
  color:var(--tg-kv-k);
  font-size:11px;
  text-align:left;
  padding:7px 8px;
  border-bottom:1px solid var(--tg-rule-remotes-border);
  white-space:nowrap;
}
.tg-rule-member-table tbody td{
  padding:7px 8px;
  font-size:12px;
  border-bottom:1px solid var(--tg-rule-remotes-border);
  color:var(--text);
  max-width:260px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.tg-rule-member-table tbody tr:last-child td{
  border-bottom:none;
}
.tg-rule-member-table tbody td.name{
  font-weight:760;
  color:var(--tg-member-name);
}
.tg-rule-cell-state{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:42px;
  height:20px;
  padding:0 7px;
  border-radius:999px;
  border:1px solid var(--tg-online-border);
  background:var(--tg-online-bg);
  color:var(--tg-online-text);
  font-size:11px;
  font-weight:760;
}
.tg-rule-cell-state.is-online{
  border-color:var(--tg-online-on-border);
  background:var(--tg-online-on-bg);
  color:var(--tg-online-on-text);
}
.tg-rule-cell-state.is-offline{
  border-color:var(--tg-online-off-border);
  background:var(--tg-online-off-bg);
  color:var(--tg-online-off-text);
}
.tg-rule-actions{
  margin-top:8px;
  display:flex;
  gap:6px;
  justify-content:flex-end;
  flex-wrap:wrap;
}
.tg-rule-actions .btn.pri-main{
  border-color:var(--tg-rule-item-hover-border);
  box-shadow:0 0 0 1px rgba(59,130,246,0.16) inset;
}
.tg-rule-actions .btn.pri-state{
  border-color:var(--tg-ok-border);
}
.tg-rule-actions .btn.danger{
  border-color:var(--tg-rule-status-off-border);
  color:var(--tg-rule-status-off-text);
  background:var(--tg-rule-status-off-bg);
}
.tg-rule-pager{
  margin-top:10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  padding-top:8px;
  border-top:1px solid var(--tg-rule-filter-border);
}
.tg-rule-page-stat{
  color:var(--muted);
  font-size:12px;
}
.tg-rule-page-controls{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}
.tg-rule-page-total{
  min-width:64px;
  text-align:center;
  font-size:12px;
  color:var(--text);
}
.tg-rule-page-jump-label{
  font-size:12px;
  color:var(--muted);
}
#tgRulePageJump{
  width:74px;
  min-width:74px;
  text-align:center;
}
@media (max-width: 1199px){
  .tg-health-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
  .tg-rule-filters{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
  .tg-rule-list{
    grid-template-columns:repeat(auto-fit, minmax(340px, 1fr));
  }
  .tg-rule-detail-grid{
    grid-template-columns:1fr;
  }
  .tg-rule-line2{
    font-size:24px;
  }
  .tg-rule-kpi-card strong{
    font-size:16px;
  }
}
@media (max-width: 900px){
  .tg-group-top{
    flex-direction:column;
    align-items:stretch;
  }
  .tg-group-actions{
    justify-content:flex-start;
  }
  .tg-health-head{
    flex-direction:column;
    align-items:flex-start;
    gap:8px;
  }
  .tg-health-pills{
    justify-content:flex-start;
  }
}
@media (max-width: 767px){
  .tg-health-grid{
    grid-template-columns:1fr;
  }
  .tg-group-actions{
    margin-top:8px;
    padding-top:8px;
    border-top:1px solid var(--tg-mobile-sep);
    justify-content:flex-end;
  }
  .tg-rule-head{
    flex-direction:column;
    align-items:flex-start;
  }
  .tg-rule-head-actions{
    width:100%;
    justify-content:flex-start;
  }
  .tg-rule-filters{
    grid-template-columns:1fr;
  }
  .tg-rule-list{
    grid-template-columns:1fr;
  }
  .tg-rule-summary{
    flex-direction:column;
    align-items:stretch;
  }
  .tg-rule-kpi-grid{
    grid-template-columns:1fr;
  }
  .tg-rule-meta{
    flex-direction:row;
    justify-content:space-between;
    align-items:center;
    min-width:0;
  }
  .tg-rule-actions{
    justify-content:flex-start;
    padding-top:8px;
    border-top:1px solid var(--tg-mobile-sep);
  }
  .tg-rule-pager{
    flex-direction:column;
    align-items:flex-start;
  }
  .tg-rule-actions .btn.pri-main{ order:1; }
  .tg-rule-actions .btn.pri-state{ order:2; }
  .tg-rule-actions .btn.pri-danger{ order:6; }
}
@media (max-width: 520px){
  .tg-member-focus-grid{
    grid-template-columns:1fr;
  }
  .tg-rule-line2{
    font-size:21px;
  }
  .tg-rule-kv{
    flex-direction:column;
    gap:3px;
  }
}

/* Intranet health detail styles (reused in per-rule health details) */
.intra-health-summary{
  margin-bottom:10px;
}
.intra-health-list{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}
.intra-health-row{
  min-width:0;
}
.intra-health-main{
  min-width:0;
}
.intra-health-name{
  font-size:12px;
  color:var(--text);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.intra-health-meta{
  margin-top:2px;
  font-size:11px;
  color:var(--muted);
}
.intra-health-pills{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  justify-content:flex-start;
}
.intra-health-extra{
  margin-top:6px;
  display:flex;
  flex-direction:column;
  gap:7px;
}
.intra-extra-block{
  border:1px solid rgba(148,163,184,0.22);
  background:
    linear-gradient(180deg, rgba(148,163,184,0.10), rgba(148,163,184,0.05));
  border-radius:10px;
  padding:7px;
}
.intra-extra-title{
  font-size:11px;
  color:var(--muted);
  margin-bottom:5px;
  letter-spacing:0.04em;
}
.intra-extra-pills{
  display:flex;
  flex-wrap:wrap;
  gap:5px;
}
.intra-group-members{
  margin-top:7px;
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(210px, 1fr));
  gap:7px;
}
.intra-group-member{
  border:1px solid rgba(148,163,184,0.20);
  background:rgba(15,23,42,0.16);
  border-radius:9px;
  padding:6px 7px;
}
.intra-group-member.active{
  border-color:rgba(16,185,129,0.52);
  background:rgba(16,185,129,0.10);
}
.intra-group-member-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:6px;
}
.intra-group-member-name{
  min-width:0;
  font-size:12px;
  color:var(--text);
  font-weight:760;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.intra-group-member-pills{
  margin-top:5px;
  display:flex;
  flex-wrap:wrap;
  gap:4px;
}
.intra-group-member-err{
  margin-top:5px;
  font-size:11px;
  color:var(--muted);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.intra-route-card{
  border:1px solid rgba(148,163,184,0.20);
  background:rgba(15,23,42,0.16);
  border-radius:9px;
  padding:6px 7px;
}
.intra-route-card + .intra-route-card{
  margin-top:0;
}
.intra-route-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:6px;
  margin-bottom:5px;
}
.intra-route-title{
  font-size:12px;
  color:var(--text);
  font-weight:760;
}
.intra-route-body{
  display:flex;
  flex-direction:column;
  gap:5px;
}
.intra-route-row{
  display:grid;
  grid-template-columns:minmax(170px, 1fr) auto;
  gap:6px;
  align-items:center;
  min-width:0;
  border:1px solid rgba(148,163,184,0.16);
  border-radius:8px;
  padding:4px 6px;
  background:rgba(15,23,42,0.10);
}
.intra-route-row.active{
  border-color:rgba(16,185,129,0.48);
  background:rgba(16,185,129,0.10);
}
.intra-route-target{
  font-size:12px;
  color:var(--text);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.intra-route-metrics{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:4px;
  min-width:0;
}
@media (max-width: 1024px){
  .intra-health-list{ grid-template-columns:1fr; }
  .intra-route-row{
    grid-template-columns:1fr;
    align-items:flex-start;
  }
  .intra-route-metrics{
    justify-content:flex-start;
  }
}

/* Light theme: boost contrast for rule health / intranet advanced blocks */
:root[data-theme="light"] .rule-health-summary{
  border-color:rgba(148,163,184,0.34);
  background:linear-gradient(180deg, rgba(255,255,255,0.97), rgba(248,251,255,0.95));
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.92);
}

:root[data-theme="light"] .rule-health-details{
  border-color:rgba(148,163,184,0.36);
  background:linear-gradient(180deg, rgba(245,249,255,0.96), rgba(238,244,252,0.94));
}

:root[data-theme="light"] .rule-health-item{
  border-color:rgba(148,163,184,0.34);
  background:rgba(255,255,255,0.90);
}

:root[data-theme="light"] .intra-health-extra{
  gap:10px;
}

:root[data-theme="light"] .intra-extra-block{
  border-color:rgba(148,163,184,0.40);
  background:
    radial-gradient(130% 160% at 0% 0%, rgba(59,130,246,0.10), transparent 70%),
    linear-gradient(180deg, rgba(255,255,255,0.97), rgba(248,251,255,0.95));
  box-shadow:0 8px 18px rgba(15,23,42,0.07), inset 0 1px 0 rgba(255,255,255,0.95);
}

:root[data-theme="light"] .intra-extra-title{
  color:#334155;
  font-weight:820;
  letter-spacing:0.02em;
}

:root[data-theme="light"] .intra-route-card,
:root[data-theme="light"] .intra-group-member{
  border-color:rgba(148,163,184,0.40);
  background:linear-gradient(180deg, rgba(248,251,255,0.96), rgba(242,247,253,0.94));
}

:root[data-theme="light"] .intra-route-row{
  border-color:rgba(148,163,184,0.38);
  background:rgba(255,255,255,0.92);
}

:root[data-theme="light"] .intra-route-row.active,
:root[data-theme="light"] .intra-group-member.active{
  border-color:rgba(16,185,129,0.56);
  background:linear-gradient(180deg, rgba(220,252,231,0.80), rgba(209,250,229,0.62));
  box-shadow:0 0 0 1px rgba(16,185,129,0.18) inset;
}

:root[data-theme="light"] .intra-route-title,
:root[data-theme="light"] .intra-group-member-name,
:root[data-theme="light"] .intra-route-target{
  color:#0f172a;
  font-weight:800;
}

:root[data-theme="light"] .intra-health-meta,
:root[data-theme="light"] .intra-group-member-err{
  color:#475569;
}

:root[data-theme="light"] .intra-health-extra .pill.xs{
  border-color:rgba(148,163,184,0.42);
  background:rgba(248,250,252,0.94);
  color:#1f2937;
}

:root[data-theme="light"] .intra-health-extra .pill.xs.ghost{
  border-color:rgba(148,163,184,0.46);
  background:rgba(226,232,240,0.72);
  color:#1e293b;
}

:root[data-theme="light"] .intra-health-extra .pill.xs.ok{
  border-color:rgba(22,163,74,0.52);
  background:rgba(34,197,94,0.18);
  color:#15803d;
  font-weight:740;
}

:root[data-theme="light"] .intra-health-extra .pill.xs.warn{
  border-color:rgba(217,119,6,0.48);
  background:rgba(251,191,36,0.24);
  color:#92400e;
  font-weight:740;
}

:root[data-theme="light"] .intra-health-extra .pill.xs.bad{
  border-color:rgba(220,38,38,0.45);
  background:rgba(254,202,202,0.52);
  color:#b91c1c;
  font-weight:740;
}

/* ---------------- Node System Card ---------------- */
.sys-card{
  margin: 12px 16px 6px 16px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(var(--tone-line),0.035), rgba(var(--tone-line),0.02));
  border: 1px solid rgba(var(--tone-line),0.06);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  backdrop-filter: blur(10px);
}

/* Mini system card inside node tiles (Dashboard) */
.card.compact .sys-card.mini{ margin: 10px 0 0 0; padding: 12px 12px; border-radius: 16px; }
.sys-card.mini .sys-grid{ grid-template-columns: 1fr; gap: 12px; }
.sys-card.mini .sys-row{ padding: 7px 9px; }
.sys-card.mini .sys-k{ font-size: 11px; }
.sys-card.mini .sys-v{ font-size: 12px; }
.sys-card.mini .sys-bar{ padding: 7px 9px; }
.sys-card.mini .sys-bar-head{ font-size: 11px; }
.sys-card.mini .progress{ height: 9px; }

@media (min-width: 1100px){
  /* Dashboard node tiles are narrow even on large screens; keep single-column to avoid overflow */
  .sys-card.mini .sys-grid{ grid-template-columns: 1fr; }
}

.sys-grid{
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.sys-kv{
  display: grid;
  gap: 8px;
}

.sys-row{
  display:flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(var(--tone-line),0.02);
  border: 1px solid rgba(var(--tone-line),0.05);
}

.sys-k{ color: rgba(var(--tone-line),0.62); font-size: 12px; white-space:nowrap; }
.sys-v{ color: rgba(var(--tone-line),0.92); font-size: 13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.sys-bars{
  display:grid;
  gap: 10px;
  align-content: start;
}

.sys-bar{ padding: 8px 10px; border-radius: 14px; background: rgba(var(--tone-line),0.02); border: 1px solid rgba(var(--tone-line),0.05); }
.sys-bar-head{ display:flex; justify-content: space-between; align-items:center; margin-bottom: 8px; color: rgba(var(--tone-line),0.72); font-size:12px; }

.progress{ height: 10px; border-radius: 999px; background: rgba(0,0,0,0.25); border: 1px solid rgba(var(--tone-line),0.06); overflow:hidden; }
.progress-fill{ height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, rgba(121,97,255,0.9), rgba(90,238,199,0.9)); }

@media (max-width: 980px){
  .sys-card{ margin: 10px 12px 6px 12px; padding: 12px 12px; }
  .sys-grid{ grid-template-columns: 1fr; }
  .sys-row{ padding: 7px 9px; }
}

/* =========================
   Premium modal + Agent update UI
   ========================= */

body.modal-open{ overflow:hidden; }

.modal{
  background: rgba(7,10,20,0.72);
  backdrop-filter: blur(10px);
}

.modal-inner.modal-pro{
  position:relative;
  padding:0;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  /* keep within modal padding (default modal padding is 22px) */
  max-height: calc(100vh - 44px);
  max-height: calc(100dvh - 44px);
  background: linear-gradient(180deg, rgba(var(--tone-1),0.88), rgba(var(--tone-1),0.72));
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 20px;
  box-shadow: var(--glow);
}

.modal-inner.modal-pro::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  border-radius:20px;
  box-shadow: 0 0 0 1px rgba(var(--tone-line),0.06) inset;
}

.modal-pro .modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 14px;
  border-bottom:1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-0),0.18);
  backdrop-filter: blur(18px);
}

.modal-pro .modal-head .title-wrap{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.modal-pro .modal-head .h2{ font-size:16px; font-weight:900; letter-spacing:0.3px; }

.modal-pro .modal-body{
  padding:10px 14px 12px;
  overflow:auto;
}

/* callout */
.au-callout{
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(148,163,184,0.16);
  background: rgba(var(--tone-0),0.12);
}

.au-callout-ico{
  width:34px;
  height:34px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(59,130,246,0.16);
  border:1px solid rgba(59,130,246,0.24);
  color: rgba(var(--tone-text-mid),0.92);
  flex: 0 0 auto;
}

.au-callout-title{ font-weight:900; font-size:12px; letter-spacing:0.2px; }
.au-callout-sub{ margin-top:4px; font-size:12px; color: var(--muted); line-height:1.45; }

/* hero */
.au-hero{ margin-top:12px; }
.au-top{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.au-target{ min-width: 220px; }
.au-ver{ font-size:18px; font-weight:950; letter-spacing:0.3px; }

.au-progress{
  height:6px;
  border-radius:999px;
  background: rgba(0,0,0,0.22);
  border:1px solid rgba(var(--tone-line),0.07);
  overflow:hidden;
  margin-top:8px;
}

.au-progress-fill{
  height:100%;
  width:0%;
  border-radius:999px;
  background: linear-gradient(90deg, rgba(59,130,246,0.95), rgba(34,211,238,0.92));
  box-shadow: 0 0 0 1px rgba(var(--tone-line),0.08) inset;
}

.backup-full-modal{
  width: min(760px, calc(100vw - 36px));
  max-height: calc(100vh - 100px);
  max-height: calc(100dvh - 100px);
}

.backup-full-error{
  margin-top:8px;
  font-size:12px;
  color:var(--bad);
  white-space:pre-wrap;
  min-height:18px;
}

.backup-full-counts{
  margin-top:10px;
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap:8px;
}

.backup-full-count{
  padding:8px 10px;
  border-radius:12px;
  border:1px solid rgba(148,163,184,0.16);
  background: rgba(var(--tone-0),0.14);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.backup-full-count .k{
  color:rgba(var(--tone-text-mid),0.78);
  font-size:12px;
}

.backup-full-count .v{
  font-weight:900;
  font-size:13px;
}

.backup-full-steps{
  margin-top:10px;
  display:grid;
  gap:8px;
}

.backup-full-step{
  padding:8px 10px;
  border-radius:12px;
  border:1px solid rgba(148,163,184,0.16);
  background: rgba(var(--tone-0),0.14);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.backup-full-step .left{
  min-width:0;
  display:flex;
  align-items:center;
  gap:8px;
}

.backup-full-step .label{
  font-weight:800;
  font-size:12px;
  white-space:nowrap;
}

.backup-full-step .detail{
  color:var(--muted);
  font-size:12px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.backup-full-step .status{
  flex:0 0 auto;
  font-size:11px;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,0.20);
  color:rgba(var(--tone-text-mid),0.88);
}

.backup-full-step.pending .status{
  border-color:rgba(148,163,184,0.24);
  color:rgba(203,213,225,0.86);
}

.backup-full-step.running .status{
  border-color:rgba(59,130,246,0.32);
  color:rgba(147,197,253,0.96);
  background:rgba(59,130,246,0.10);
}

.backup-full-step.done .status{
  border-color:rgba(34,197,94,0.32);
  color:rgba(74,222,128,0.96);
  background:rgba(34,197,94,0.10);
}

.backup-full-step.failed .status{
  border-color:rgba(248,113,113,0.36);
  color:rgba(252,165,165,0.96);
  background:rgba(248,113,113,0.10);
}

.backup-full-events{
  margin-top:10px;
  border:1px solid rgba(148,163,184,0.16);
  border-radius:12px;
  background: rgba(var(--tone-0),0.12);
  max-height:220px;
  overflow:auto;
  padding:6px 8px;
  display:grid;
  gap:6px;
}

.backup-full-event{
  display:grid;
  grid-template-columns: 86px 54px 1fr;
  gap:8px;
  align-items:start;
  font-size:12px;
  line-height:1.35;
  padding:4px 2px;
}

.backup-full-event .ts{
  color:var(--muted);
  font-size:11px;
  white-space:nowrap;
}

.backup-full-event .lv{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:0.2px;
  color:rgba(var(--tone-text-mid),0.86);
}

.backup-full-event .lv.warn{ color:rgba(250,204,21,0.95); }
.backup-full-event .lv.error{ color:rgba(252,165,165,0.98); }

.backup-full-event .msg{
  min-width:0;
  color:rgba(var(--tone-text),0.95);
  white-space:pre-wrap;
  word-break:break-word;
}

.restore-full-modal{
  width: min(780px, calc(100vw - 36px));
  max-height: calc(100vh - 100px);
  max-height: calc(100dvh - 100px);
}

.restore-full-error{
  margin-top:8px;
  font-size:12px;
  color:var(--bad);
  white-space:pre-wrap;
  min-height:18px;
}

.restore-full-summary{
  margin:10px 0 0 0;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(148,163,184,0.16);
  background:rgba(var(--tone-0),0.14);
  color:rgba(var(--tone-text-mid),0.88);
  font-size:12px;
  line-height:1.5;
  white-space:pre-wrap;
  word-break:break-word;
  min-height:84px;
}

.au-meta{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-top:10px; }
.au-stats{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

.pill-stat{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-0),0.14);
  font-size:12px;
  color: rgba(var(--tone-text-mid),0.86);
}

.pill-stat strong{ font-weight:950; color: var(--text); }
.pill-stat.ok{ border-color: rgba(34,197,94,0.28); background: rgba(34,197,94,0.08); }
.pill-stat.bad{ border-color: rgba(248,113,113,0.30); background: rgba(248,113,113,0.08); }
.pill-stat.warn{ border-color: rgba(245,158,11,0.34); background: rgba(245,158,11,0.10); }
.pill-stat.info{ border-color: rgba(59,130,246,0.34); background: rgba(59,130,246,0.10); }
.pill-stat.muted{ opacity:0.85; }

/* list */
.au-list-card{ margin-top:12px; padding:0; overflow:hidden; }
.au-list-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 12px; border-bottom:1px solid rgba(148,163,184,0.16); background: rgba(var(--tone-0),0.14); }
.au-list{ max-height: 380px; overflow:auto; }

.au-item{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:10px 12px; border-bottom:1px solid rgba(148,163,184,0.12); }
.au-item:last-child{ border-bottom:none; }

.au-left{ flex:1; min-width:0; display:flex; flex-direction:column; gap:6px; }
.au-name{ font-weight:900; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.au-sub{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }

.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-0),0.12);
  font-size:11px;
  color: rgba(var(--tone-text-mid),0.88);
}
.badge.ok{ border-color: rgba(34,197,94,0.30); background: rgba(34,197,94,0.10); }
.badge.bad{ border-color: rgba(248,113,113,0.32); background: rgba(248,113,113,0.10); }
.badge.warn{ border-color: rgba(245,158,11,0.36); background: rgba(245,158,11,0.12); }
.badge.info{ border-color: rgba(59,130,246,0.40); background: rgba(59,130,246,0.12); }
.badge.muted{ opacity:0.75; }

.kv-mini{ padding:4px 8px; border-radius:999px; border:1px solid rgba(148,163,184,0.14); background: rgba(148,163,184,0.06); font-size:11px; color: rgba(var(--tone-text-mid),0.78); }

.au-right{ flex:0 0 auto; max-width:360px; min-width:140px; text-align:right; }
.au-msg{ font-size:12px; color: var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

@media (max-width: 720px){
  .modal-inner.modal-pro{ max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .au-item{ flex-direction:column; align-items:stretch; }
  .au-right{ text-align:left; max-width:none; min-width:0; }
  .au-msg{ white-space:normal; }
  .au-list{ max-height: 56vh; }
}

/* =========================
   Agent Update Modal — Dense / Premium
   ========================= */
/* Agent update should feel like a modal popup (not a full-page view) */
#agentUpdateModal.modal{
  padding:18px;
  align-items:center;
}

.au-modal{
  width: min(1080px, calc(100vw - 36px));
  height: min(860px, calc(100vh - 96px));
  height: min(860px, calc(100dvh - 96px));
  max-height: calc(100vh - 96px);
  max-height: calc(100dvh - 96px);
  overflow:hidden;
}
.au-modal .modal-head{ padding:10px 14px; }
.au-modal .modal-body.au-body{
  padding:12px 14px 14px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.au-hero{
  margin-top:0;
  position: relative;
  border: 1px solid rgba(125,211,252,0.26);
  background:
    radial-gradient(110% 120% at 10% 0%, rgba(56,189,248,0.20), transparent 55%),
    radial-gradient(80% 100% at 100% 100%, rgba(59,130,246,0.18), transparent 64%),
    linear-gradient(180deg, rgba(var(--tone-0),0.28), rgba(var(--tone-0),0.16));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 10px 28px rgba(2,6,23,0.30);
  overflow: hidden;
}

.au-hero::after{
  content:"";
  position:absolute;
  inset:-1px;
  border-radius:inherit;
  pointer-events:none;
  background: linear-gradient(120deg, rgba(125,211,252,0.14), transparent 35%, transparent 65%, rgba(96,165,250,0.12));
}

.au-hero-grid{
  display:grid;
  grid-template-columns: minmax(0,1fr) 220px;
  gap:14px;
  align-items:start;
}
.au-hero-left{ display:flex; flex-direction:column; gap:4px; min-width:0; }
.au-hero-right{ display:flex; flex-direction:column; align-items:flex-end; gap:8px; flex:0 0 auto; }
.au-hero-right .btn{ min-width:122px; }

.au-target{ min-width:0; }
.au-stage-line{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.au-state-badge{ min-width:72px; }
.au-ver{
  margin-top:4px;
  font-size:28px;
  line-height:1.05;
  font-weight:950;
  letter-spacing:0.02em;
  color: rgba(186,230,253,0.98);
}
:root[data-theme="light"] .au-ver{
  color: rgba(29,78,216,0.92);
}
.au-summary{
  margin-top:6px;
  opacity:0.92;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.au-modal .au-progress{
  height: 10px;
  border-color: rgba(125,211,252,0.22);
  background: rgba(2,6,23,0.26);
}

.au-modal .au-progress-fill{
  position: relative;
  background: linear-gradient(90deg, rgba(56,189,248,0.94), rgba(96,165,250,0.92) 55%, rgba(34,211,238,0.96));
  transition: width 220ms ease;
}

.au-modal .au-progress-fill::after{
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  left:-40%;
  width:36%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.44), transparent);
  animation: panelUpdateSheen 2.4s linear infinite;
}

.au-segbar{
  margin-top:8px;
  height:7px;
  border-radius:999px;
  overflow:hidden;
  display:flex;
  gap:1px;
  background: rgba(2,6,23,0.24);
  border:1px solid rgba(125,211,252,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.au-seg{ height:100%; }
.au-seg.done{ background: rgba(34,197,94,0.80); }
.au-seg.running,
.au-seg.installing{ background: rgba(245,158,11,0.78); }
.au-seg.accepted{ background: rgba(14,165,233,0.74); }
.au-seg.delivered,
.au-seg.sent{ background: rgba(59,130,246,0.78); }
.au-seg.retrying{ background: rgba(251,191,36,0.74); }
.au-seg.failed{ background: rgba(248,113,113,0.82); }
.au-seg.expired{ background: rgba(239,68,68,0.60); }
.au-seg.offline{ background: rgba(148,163,184,0.52); }
.au-seg.queued{ background: rgba(148,163,184,0.34); }
.au-seg.other{ background: rgba(var(--tone-text-mid),0.18); }

.au-under{
  margin-top: 8px;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
}

.au-status{ margin-top:0; }

.au-percent{
  font-size: 30px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0.02em;
  color: rgba(186,230,253,0.98);
}

:root[data-theme="light"] .au-percent{
  color: rgba(29,78,216,0.88);
}

.au-meta2{ justify-content:space-between; align-items:center; margin-top:10px; }
.au-search{ flex:0 0 280px; max-width: 40%; }
.au-search-input{ padding:7px 9px; border-radius:12px; min-height:32px; }

/* tighter chips in update modal */
.au-modal .pill-stat{
  padding:5px 10px;
  font-size:11px;
  border-color: rgba(148,163,184,0.26);
  background: rgba(var(--tone-0),0.24);
}

.pill-stat{ cursor:pointer; user-select:none; }
.pill-stat:hover{ border-color: rgba(125,211,252,0.40); }
.pill-stat.active{
  border-color: rgba(56,189,248,0.46);
  color: rgba(240,249,255,0.99);
  background: rgba(14,165,233,0.28);
  box-shadow: inset 0 0 0 1px rgba(56,189,248,0.18);
  transform:none;
}

.au-modal .au-list-card{ margin-top:0; }
.au-list-card{
  padding:0;
  overflow:hidden;
  flex:1;
  display:flex;
  flex-direction:column;
  min-height:0;
  border:1px solid rgba(148,163,184,0.18);
  background: linear-gradient(180deg, rgba(var(--tone-0),0.20), rgba(var(--tone-0),0.10));
}
.au-grid-head{
  display:grid;
  grid-template-columns: 2.1fr 0.8fr 0.8fr 1.1fr;
  gap:10px;
  align-items:center;
  padding:9px 12px;
  border-bottom:1px solid rgba(148,163,184,0.20);
  background: rgba(var(--tone-0),0.24);
  font-size:11px;
  color: rgba(var(--tone-text-mid),0.86);
  letter-spacing:0.08em;
  text-transform:uppercase;
}
.au-col-r{ text-align:right; }
.au-modal .au-list{ max-height:none; }
.au-list{
  flex:1;
  overflow:auto;
  padding:8px;
  background: rgba(2,6,23,0.10);
}

.au-group{
  border:1px solid rgba(148,163,184,0.18);
  border-radius:12px;
  overflow:hidden;
  margin-bottom:8px;
  background: rgba(var(--tone-0),0.14);
}
.au-group:last-child{ margin-bottom:0; }
.au-group > summary{
  list-style:none;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:8px 11px;
  background: linear-gradient(180deg, rgba(var(--tone-0),0.20), rgba(var(--tone-0),0.14));
  border-bottom:1px solid rgba(148,163,184,0.14);
}
.au-group > summary::-webkit-details-marker{ display:none; }
.au-group-title{ font-weight:900; font-size:12px; letter-spacing:0.2px; }
.au-group-meta{ display:flex; align-items:center; gap:8px; }
.au-group-body{
  padding:8px;
  display:grid;
  gap:8px;
}

.au-row{
  display:grid;
  grid-template-columns: 2.1fr 0.8fr 0.8fr 1.1fr;
  gap:10px;
  align-items:center;
  padding:9px 10px;
  border:1px solid rgba(148,163,184,0.22);
  border-radius:10px;
  background: linear-gradient(180deg, rgba(var(--tone-0),0.24), rgba(var(--tone-0),0.14));
}
.au-row > .au-node:only-child{ grid-column:1 / -1; }

.au-status-cell{ display:flex; justify-content:flex-end; align-items:center; gap:8px; }
.au-status-cell .badge{
  min-width:72px;
  justify-content:center;
  font-weight:800;
  letter-spacing:0.01em;
}
.au-row:hover{
  border-color: rgba(125,211,252,0.32);
  background: linear-gradient(180deg, rgba(var(--tone-0),0.28), rgba(var(--tone-0),0.18));
}

.au-node-name{ font-weight:900; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.au-node-meta{ margin-top:4px; display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.au-dot{ width:8px; height:8px; border-radius:999px; background: rgba(148,163,184,0.55); box-shadow: 0 0 0 2px rgba(var(--tone-0),0.7); }
.au-dot.on{ background: rgba(34,197,94,0.85); }
.au-dot.off{ background: rgba(248,113,113,0.80); }

.au-ver-cell{ font-size:12px; color: rgba(var(--tone-text-mid),0.92); text-align:right; white-space:nowrap; }
.au-msg-cell{
  text-align:right;
  font-size:12px;
  color: var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

:root[data-theme="light"] .au-modal .au-progress{
  border-color: rgba(148,163,184,0.30);
  background: rgba(226,232,240,0.80);
}

:root[data-theme="light"] .au-modal .au-list-card{
  border-color: rgba(148,163,184,0.34);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(241,245,252,0.96));
}

:root[data-theme="light"] .au-list{
  background: rgba(248,251,255,0.74);
}

:root[data-theme="light"] .au-group{
  border-color: rgba(148,163,184,0.34);
  background: rgba(255,255,255,0.90);
}

:root[data-theme="light"] .au-row{
  border-color: rgba(148,163,184,0.36);
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,251,255,0.92));
}

@media (max-width: 840px){
  .au-search{ flex:1; max-width:none; }
}

@media (max-width: 720px){
  #agentUpdateModal.modal{ padding:12px; align-items:stretch; }
  .au-modal{ width: calc(100vw - 24px); height: calc(100vh - 24px); height: calc(100dvh - 24px); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .au-modal .modal-body.au-body{ overflow:auto; }
  .au-list-card{ flex:0 0 auto; min-height:auto; }
  .au-grid-head{ display:none; }
  .au-list{ padding:8px; }
  .au-group-body{ padding:8px; }
  .au-row{ grid-template-columns: 1fr; gap:8px; padding:10px 11px; }
  .au-msg-cell{ text-align:left; white-space:normal; }
  .au-ver-cell{ text-align:left; }
  .au-hero-grid{ grid-template-columns: 1fr; }
  .au-hero-right{ align-items:stretch; }
  .au-hero-right .btn{ width:100%; }
  .au-under{ align-items:center; }
  .au-percent{ font-size:24px; }
  .au-search{ flex:1; max-width:none; }
}

/* Panel self-update modal */
#panelUpdateModal.modal{
  padding: 18px;
  align-items: center;
}

.panel-update-modal{
  width: min(980px, calc(100vw - 36px));
  height: min(860px, calc(100vh - 96px));
  height: min(860px, calc(100dvh - 96px));
  max-height: calc(100vh - 96px);
  max-height: calc(100dvh - 96px);
  overflow: hidden;
}

.panel-update-modal .modal-body.panel-update-body{
  padding: 12px 14px 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-update-hero{
  position: relative;
  border: 1px solid rgba(125,211,252,0.26);
  background:
    radial-gradient(110% 120% at 10% 0%, rgba(56,189,248,0.20), transparent 55%),
    radial-gradient(80% 100% at 100% 100%, rgba(59,130,246,0.18), transparent 64%),
    linear-gradient(180deg, rgba(var(--tone-0),0.28), rgba(var(--tone-0),0.16));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 10px 28px rgba(2,6,23,0.30);
  overflow: hidden;
}

.panel-update-hero::after{
  content:"";
  position:absolute;
  inset:-1px;
  border-radius:inherit;
  pointer-events:none;
  background: linear-gradient(120deg, rgba(125,211,252,0.14), transparent 35%, transparent 65%, rgba(96,165,250,0.12));
}

.panel-update-hero-grid{
  display:grid;
  grid-template-columns: minmax(0,1fr) 220px;
  gap: 14px;
  align-items: start;
}

.panel-update-main{ min-width:0; }

.panel-update-stage-line{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.panel-update-stage-line .h2{ margin:0; }

.panel-update-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:64px;
  padding:4px 10px;
  border-radius:999px;
  font-size:11px;
  font-weight:900;
  letter-spacing:0.08em;
  text-transform:uppercase;
  border:1px solid rgba(148,163,184,0.28);
  color: rgba(var(--tone-text-mid),0.90);
  background: rgba(148,163,184,0.12);
}

.panel-update-badge.info{
  border-color: rgba(56,189,248,0.36);
  color: rgba(125,211,252,0.96);
  background: rgba(14,165,233,0.18);
}

.panel-update-badge.warn{
  border-color: rgba(251,191,36,0.44);
  color: rgba(253,230,138,0.98);
  background: rgba(245,158,11,0.20);
}

.panel-update-badge.ok{
  border-color: rgba(74,222,128,0.42);
  color: rgba(134,239,172,0.98);
  background: rgba(34,197,94,0.18);
}

.panel-update-badge.bad{
  border-color: rgba(252,165,165,0.44);
  color: rgba(254,202,202,0.98);
  background: rgba(239,68,68,0.20);
}

.panel-update-meta{
  margin-top: 6px;
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-update-track{
  height: 10px;
  border-color: rgba(125,211,252,0.22);
  background: rgba(2,6,23,0.26);
}

.panel-update-track .au-progress-fill{
  position: relative;
  background: linear-gradient(90deg, rgba(56,189,248,0.94), rgba(96,165,250,0.92) 55%, rgba(34,211,238,0.96));
  transition: width 220ms ease;
}

.panel-update-track .au-progress-fill::after{
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  left:-40%;
  width:36%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.44), transparent);
  animation: panelUpdateSheen 2.4s linear infinite;
}

@keyframes panelUpdateSheen{
  0%{ left:-40%; }
  100%{ left:104%; }
}

.panel-update-under{
  margin-top: 8px;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
}

.panel-update-status{
  margin-top: 0;
}

.panel-update-percent{
  font-size: 30px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0.02em;
  color: rgba(186,230,253,0.98);
}

.panel-update-side{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:10px;
}

.panel-update-side .btn{ min-width: 122px; }

.panel-update-error{
  margin-top: 6px;
  min-height: 18px;
  font-size: 12px;
  color: var(--bad);
  white-space: pre-wrap;
}

.panel-update-log-card{
  display:flex;
  flex-direction:column;
  min-height:0;
  flex:1;
  overflow:hidden;
  border:1px solid rgba(148,163,184,0.18);
  background: linear-gradient(180deg, rgba(var(--tone-0),0.20), rgba(var(--tone-0),0.10));
}

.panel-update-log-tools{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}

.panel-update-view-btn{
  border:1px solid rgba(148,163,184,0.30);
  background: rgba(var(--tone-0),0.26);
  color: rgba(var(--tone-text-hi),0.96);
  border-radius:999px;
  padding:4px 10px;
  font-size:11px;
  font-weight:800;
  letter-spacing:0.03em;
  cursor:pointer;
}

.panel-update-view-btn:hover{
  border-color: rgba(125,211,252,0.40);
}

.panel-update-view-btn.active{
  border-color: rgba(56,189,248,0.46);
  color: rgba(240,249,255,0.99);
  background: rgba(14,165,233,0.28);
  box-shadow: inset 0 0 0 1px rgba(56,189,248,0.18);
}

.panel-update-log-pretty,
.panel-update-log{
  margin-top: 10px;
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 12px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(56,189,248,0.10), transparent 56%),
    linear-gradient(180deg, rgba(2,6,23,0.30), rgba(2,6,23,0.20));
  padding: 10px;
  min-height: 0;
  max-height: 100%;
  flex:1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.panel-update-log{
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
  font-size: 12px;
}

.panel-update-log-empty{
  color: var(--muted);
  font-size: 12px;
  padding: 10px 8px;
}

.panel-update-line{
  display:grid;
  grid-template-columns: 66px minmax(0,1fr);
  gap:10px;
  align-items:flex-start;
  padding: 10px 11px;
  margin-bottom: 8px;
  border: 1px solid rgba(148,163,184,0.26);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(var(--tone-0),0.26), rgba(var(--tone-0),0.16));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.panel-update-line:last-child{
  margin-bottom: 0;
}

.panel-update-line-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height: 22px;
  min-width: 62px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(148,163,184,0.34);
  color: rgba(var(--tone-text-hi),0.96);
  background: rgba(148,163,184,0.18);
  text-shadow: 0 1px 0 rgba(2,6,23,0.20);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

.panel-update-line-text{
  min-width:0;
  font-size:14px;
  font-weight: 580;
  line-height:1.5;
  color: rgba(var(--tone-text-hi),0.96);
  white-space: pre-wrap;
  word-break: break-word;
}

.panel-update-line.hint{
  border-color: rgba(56,189,248,0.28);
  background: rgba(14,165,233,0.12);
}
.panel-update-line.hint .panel-update-line-badge{
  border-color: rgba(56,189,248,0.44);
  background: rgba(56,189,248,0.22);
  color: rgba(224,242,254,0.98);
}

.panel-update-line.info{
  border-color: rgba(96,165,250,0.26);
  background: rgba(59,130,246,0.10);
}
.panel-update-line.info .panel-update-line-badge{
  border-color: rgba(96,165,250,0.40);
  background: rgba(96,165,250,0.22);
  color: rgba(224,231,255,0.98);
}

.panel-update-line.progress{
  border-color: rgba(34,211,238,0.30);
  background: rgba(6,182,212,0.12);
}
.panel-update-line.progress .panel-update-line-badge{
  border-color: rgba(34,211,238,0.44);
  background: rgba(34,211,238,0.24);
  color: rgba(236,254,255,0.99);
}

.panel-update-line.ok{
  border-color: rgba(74,222,128,0.30);
  background: rgba(34,197,94,0.12);
}
.panel-update-line.ok .panel-update-line-badge{
  border-color: rgba(74,222,128,0.44);
  background: rgba(74,222,128,0.24);
  color: rgba(240,253,244,0.98);
}

.panel-update-line.bad{
  border-color: rgba(252,165,165,0.34);
  background: rgba(239,68,68,0.14);
}
.panel-update-line.bad .panel-update-line-badge{
  border-color: rgba(252,165,165,0.48);
  background: rgba(252,165,165,0.26);
  color: rgba(255,241,242,0.98);
}

:root[data-theme="light"] .panel-update-log-pretty,
:root[data-theme="light"] .panel-update-log{
  border-color: rgba(148,163,184,0.34);
  background:
    radial-gradient(140% 150% at 0% 0%, rgba(59,130,246,0.08), transparent 58%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(241,245,252,0.96));
}

:root[data-theme="light"] .panel-update-line{
  border-color: rgba(148,163,184,0.38);
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,251,255,0.92));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    0 1px 2px rgba(15,23,42,0.05);
}

:root[data-theme="light"] .panel-update-line-badge{
  color: rgba(15,23,42,0.92);
  text-shadow: none;
}

:root[data-theme="light"] .panel-update-line-text{
  color: rgba(15,23,42,0.92);
}

@media (max-width: 720px){
  #panelUpdateModal.modal{
    padding: 12px;
    align-items: stretch;
  }
  .panel-update-modal{
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    height: calc(100dvh - 24px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }
  .panel-update-modal .modal-body.panel-update-body{
    overflow:auto;
  }
  .panel-update-hero-grid{
    grid-template-columns: 1fr;
  }
  .panel-update-side{
    align-items:stretch;
  }
  .panel-update-side .btn{
    width:100%;
  }
  .panel-update-under{
    align-items:center;
  }
  .panel-update-percent{
    font-size:24px;
  }
  .panel-update-log-tools{
    justify-content:flex-start;
  }
}

/* =========================
   NetMon page (network fluctuation monitor)
   ========================= */

/* NetMon: head actions (mobile tidy) */
.netmon-head-menu{ display:none; }
@media (max-width: 640px){
  .netmon-head-extra{ display:none; }
  .netmon-head-menu{ display:inline-block; }
  .netmon-head-actions{ width:100%; flex-wrap:nowrap; }
  .netmon-head-actions #netmonNewBtn{ flex:1; }
}

/* NetMon: toolbar responsive grid */
@media (max-width: 720px){
  .netmon-toolbar .row{
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap:10px;
    align-items:stretch;
  }
  .netmon-toolbar .row > .col{
    width:100%;
    max-width:none !important;
    min-width:0 !important;
  }
  .netmon-toolbar .col.nm-search,
  .netmon-toolbar .col.nm-status,
  .netmon-toolbar .col.nm-refresh{
    grid-column: 1 / -1;
  }
  .netmon-toolbar .help{ display:none; }
  .netmon-toolbar input.input,
  .netmon-toolbar select.select{
    width:100%;
  }
}
@media (max-width: 420px){
  .netmon-toolbar .row{ grid-template-columns: 1fr; }
}

/* NetMon: card header & actions (mobile) */
.netmon-actions-desktop{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:8px;
}
@media (min-width: 680px){
  .netmon-actions-desktop{ flex-direction:row; align-items:center; }
}
.netmon-actions-mobile{
  display:none;
  align-items:center;
  gap:8px;
  justify-content:flex-end;
}
@media (max-width: 720px){
  .netmon-actions-desktop{ display:none; }
  .netmon-actions-mobile{ display:flex; }
  .netmon-chart-card .card-header.netmon-card-head{
    flex-direction:column;
    align-items:stretch;
    gap:10px;
  }
  .netmon-chart-card .card-header.netmon-card-head .netmon-actions{
    width:100%;
    justify-content:flex-end;
  }
}

/* Mobile: keep pills/legend in one tidy row (scrollable) */
@media (max-width: 720px){
  .netmon-stats-wrap,
  .netmon-legend-wrap{
    flex-wrap:nowrap;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    padding-bottom:2px;
  }
  .netmon-stats-wrap::-webkit-scrollbar,
  .netmon-legend-wrap::-webkit-scrollbar{ display:none; }
  .netmon-pill,
  .netmon-legend-item{ flex:0 0 auto; }
}

/* Mobile: slightly denser plot */
@media (max-width: 420px){
  .netmon-canvas{ height: 200px; }
  .netmon-nav-canvas{ height: 40px; }
}

/* Mobile: realtime button doesn't cover too much */
@media (max-width: 720px){
  .netmon-realtime-btn{ top: 12px; right: 12px; }
  .netmon-events-list{ max-height: 140px; }
}

/* Menu item danger (for destructive ops in mobile overflow menu) */
.menu-item.danger{ color: rgba(254,202,202,0.95); }
.menu-item.danger:hover{
  background: rgba(248,113,113,0.10);
  border-color: rgba(248,113,113,0.22);
}

.node-list.netmon-form{
  padding: 10px 12px 12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  max-height: calc(100vh - 208px);
  max-height: calc(100dvh - 208px);
  overflow:auto;
}

@media (max-width: 980px){
  .node-list.netmon-form{
    flex-direction:column;
    gap:10px;
    overflow:visible;
    scroll-snap-type:none;
    -webkit-overflow-scrolling:auto;
  }
}

.netmon-nodes{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.netmon-group{
  border: 1px solid rgba(148,163,184,0.14);
  border-radius: 12px;
  padding: 10px;
  background: rgba(15,23,42,0.18);
}

.netmon-group-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}

.netmon-group-name{
  font-weight:900;
  font-size:13px;
}

.netmon-group-items{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.netmon-node{
  display:flex;
  align-items:center;
  gap:8px;
  cursor:pointer;
  user-select:none;
}

.netmon-node input{ transform: translateY(1px); }

/* NetMon: node list online dot */
.netmon-node .dot{
  width:8px;
  height:8px;
  border-radius:999px;
  display:inline-block;
  flex:0 0 auto;
  box-shadow:0 0 0 3px rgba(148,163,184,0.12) inset;
}
.netmon-node .dot.online{ background:#22c55e; }
.netmon-node .dot.offline{ background:#64748b; }

/* NetMon: toolbar & card actions */
.netmon-toolbar{ padding: 12px; }
.netmon-actions{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:8px;
}
@media (min-width: 680px){
  .netmon-actions{
    flex-direction:row;
    align-items:center;
  }
}
.netmon-chart-card.netmon-disabled{
  opacity: 0.65;
  filter: saturate(0.9);
}
.netmon-chart-card.netmon-disabled .netmon-canvas{
  background: rgba(var(--tone-3),0.28);
}

.netmon-node-name{
  font-weight:800;
  font-size:13px;
  max-width: 160px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.netmon-charts{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.netmon-chart-card .netmon-canvas-wrap{
  padding: 0 12px 12px;
  position: relative;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.netmon-canvas{
  width: 100%;
  height: 220px;
  display:block;
  border-radius: 12px;
  background: rgba(var(--tone-3),0.38);
  border: 1px solid rgba(148,163,184,0.12);

  cursor: grab;
  touch-action: none;
}

.netmon-canvas.is-dragging{
  cursor: grabbing;
}

.netmon-canvas.is-boxing{
  cursor: crosshair;
}

.netmon-nav-canvas{
  width: 100%;
  height: 44px;
  display:block;
  border-radius: 10px;
  background: rgba(var(--tone-3),0.28);
  border: 1px solid rgba(148,163,184,0.12);
  cursor: ew-resize;
  touch-action: none;
}

.netmon-nav-canvas.is-dragging{
  cursor: grabbing;
}

.netmon-realtime-btn{
  position:absolute;
  top: 18px;
  right: 18px;
  z-index: 6;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}

.netmon-chart-card.netmon-history{
  outline: 1px solid rgba(148,163,184,0.18);
  outline-offset: 0;
}

/* Shared-link focus highlight */
.netmon-chart-card.netmon-focus{
  outline: 1px solid rgba(56,189,248,0.38);
  box-shadow: 0 0 0 1px rgba(56,189,248,0.12) inset, 0 24px 70px rgba(0,0,0,0.50);
  animation: netmonFocusGlow 2.2s ease-out;
}
@keyframes netmonFocusGlow{
  0%{ box-shadow: 0 0 0 1px rgba(56,189,248,0.22) inset, 0 0 0 rgba(56,189,248,0.0); }
  35%{ box-shadow: 0 0 0 1px rgba(56,189,248,0.22) inset, 0 40px 110px rgba(56,189,248,0.18); }
  100%{ box-shadow: 0 0 0 1px rgba(56,189,248,0.10) inset, var(--glow); }
}

/* Level accents (threshold status) */
.netmon-chart-card.netmon-level-ok{
  border-color: rgba(34,197,94,0.28);
  box-shadow: 0 0 0 1px rgba(34,197,94,0.10) inset, var(--glow);
}
.netmon-chart-card.netmon-level-warn{
  border-color: rgba(245,158,11,0.28);
  box-shadow: 0 0 0 1px rgba(245,158,11,0.12) inset, var(--glow);
}
.netmon-chart-card.netmon-level-crit{
  border-color: rgba(248,113,113,0.30);
  box-shadow: 0 0 0 1px rgba(248,113,113,0.14) inset, var(--glow);
}

.netmon-legend{ margin-top: 10px; }

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

.netmon-legend-item{
  appearance:none;
  border: 1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-3),0.18);
  padding: 4px 10px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  gap:6px;
  font-size:12px;
  color: rgba(var(--tone-text-mid),0.92);
  cursor:pointer;
  user-select:none;
  white-space:nowrap;
}

.netmon-legend-item:hover{
  background: rgba(148,163,184,0.10);
}

.netmon-legend-item.off{
  opacity: 0.45;
}

/* Legend auxiliary actions */
.netmon-legend-item.aux{
  border-style: dashed;
  opacity: 0.80;
}
.netmon-legend-item.aux:hover{
  opacity: 1;
}

.netmon-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(var(--tone-0),0.65);
}

.netmon-tooltip{
  position:absolute;
  z-index: 5;
  min-width: 160px;
  max-width: 280px;
  max-height: 320px;
  overflow:auto;
  background: rgba(var(--tone-3),0.92);
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  pointer-events:none;
}

/* Tooltip (multi-series) */
.netmon-tt-top{ margin-bottom: 8px; }
.netmon-tt-title{ font-weight: 900; font-size: 12px; }
.netmon-tt-sub{ font-size: 11px; margin-top: 2px; }

.netmon-tt-table{ display:flex; flex-direction:column; gap:6px; }
.netmon-tt-row{
  display:grid;
  grid-template-columns: 10px 1fr auto auto;
  gap: 6px;
  align-items:center;
}
.netmon-tt-name{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.netmon-tt-delta{ font-size: 11px; }
.netmon-tt-val{ justify-self:end; font-weight: 900; }
.netmon-tt-val.bad{ color: rgba(248,113,113,0.95); }
.netmon-tt-err{
  font-size: 11px;
  padding-left: 16px;
  margin-top: -4px;
  margin-bottom: 4px;
  opacity: 0.86;
  white-space: normal;
}

.netmon-tt-meta{
  font-size: 11px;
  padding-left: 16px;
  margin-top: -4px;
  margin-bottom: 4px;
  opacity: 0.78;
  white-space: normal;
}

/* Abnormal events timeline */
.netmon-events{
  padding: 0 12px 12px;
  display:flex;
  flex-direction:column;
  gap: 8px;
}

.netmon-events-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}

.netmon-events-bar{
  position: relative;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(var(--tone-3),0.18);
  border: 1px solid rgba(148,163,184,0.16);
  box-shadow: inset 0 1px 0 rgba(var(--tone-line),0.03);
}

.netmon-event{
  appearance: none;
  border: 0;
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 8px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.92;
  box-shadow: 0 0 0 1px rgba(var(--tone-line),0.06) inset;
}

.netmon-event.warn{
  background: linear-gradient(90deg, rgba(245,158,11,0.22), rgba(245,158,11,0.62));
}
.netmon-event.crit{
  background: linear-gradient(90deg, rgba(248,113,113,0.22), rgba(248,113,113,0.64));
}

.netmon-event:hover{
  opacity: 1;
  transform: translateY(-1px);
}

.netmon-events-list{
  display:flex;
  flex-direction:column;
  gap:6px;
  max-height: 180px;
  overflow: auto;
  padding-right: 2px;
}

.netmon-events-summary{
  border: 1px dashed rgba(148,163,184,0.18);
  background: rgba(var(--tone-3),0.10);
  padding: 6px 10px;
  border-radius: 10px;
}

.netmon-evt-row{
  display:grid;
  grid-template-columns: 8px 50px 1fr auto auto;
  gap: 8px;
  align-items:center;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,0.14);
  background: rgba(var(--tone-3),0.10);
 cursor:pointer; }

.netmon-evt-row.warn{ border-color: rgba(245,158,11,0.22); }
.netmon-evt-row.crit{ border-color: rgba(248,113,113,0.24); }

.netmon-evt-dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(var(--tone-0),0.65);
}
.netmon-evt-dot.warn{ background: rgba(245,158,11,0.92); }
.netmon-evt-dot.crit{ background: rgba(248,113,113,0.92); }

.netmon-evt-time{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.netmon-evt-meta{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

@media (max-width: 820px){
  .netmon-evt-row{ grid-template-columns: 8px 52px 1fr 64px; }
  .netmon-evt-meta{ display:none; }
  .netmon-evt-row .btn[data-action="jump"]{ display:none; }
  .netmon-evt-row .btn[data-action="detail"]{ display:inline-flex; justify-self:end; height:26px; padding:0 10px; border-radius:999px; }
  .netmon-evt-row:active{ background:rgba(var(--tone-line),0.04); }
}



/* NetMon events (compact summary) */
.netmon-events-badges{ display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.netmon-events-foot{ min-height: 16px; }

/* Compact badge (NetMon local) */
.nm-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-3),0.12);
  font-size:11px;
  color: rgba(var(--tone-text-mid),0.88);
  letter-spacing: 0.02em;
}
.nm-badge.crit{ border-color: rgba(248,113,113,0.32); background: rgba(248,113,113,0.10); }
.nm-badge.warn{ border-color: rgba(245,158,11,0.36); background: rgba(245,158,11,0.12); }
.nm-badge.ok{ border-color: rgba(34,197,94,0.30); background: rgba(34,197,94,0.10); }
.nm-badge.ghost{ opacity:0.80; }

.nm-pill{
  display:inline-flex;
  align-items:baseline;
  gap:6px;
  border:1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-3),0.14);
  padding:4px 10px;
  border-radius:999px;
}
.nm-pill .k{ font-size:11px; color: var(--muted); letter-spacing:0.02em; }
.nm-pill .v{ font-size:12px; font-weight:900; color: rgba(var(--tone-text-mid),0.95); }
.nm-pill.warn{ border-color: rgba(245,158,11,0.40); background: rgba(120,53,15,0.14); }
.nm-pill.crit{ border-color: rgba(248,113,113,0.45); background: rgba(127,29,29,0.16); }
.nm-pill.ok{ border-color: rgba(34,197,94,0.38); background: rgba(20,83,45,0.12); }
.nm-pill.ghost{ opacity:0.80; }

/* Abnormal Center modal */
.modal.netmon-ab-modal{
  z-index: 9999;
  padding: 12px;
  align-items: stretch;
  overflow: hidden;
}
.netmon-ab-inner{
  max-width: 1120px;
  width: min(1120px, calc(100vw - 24px));
  height: calc(100vh - 24px);
  height: calc(100dvh - 24px);
  max-height: none;
  padding: 14px 14px 12px;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.netmon-ab-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom: 8px; }
.netmon-ab-head .h2{ font-size: 18px; letter-spacing: 0.02em; }
.netmon-ab-summary{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom: 10px; }
.netmon-ab-body{
  flex: 1;
  min-height: 0;
  display:grid;
  grid-template-columns: 420px 1fr;
  gap: 12px;
  align-items:stretch;
}
.netmon-ab-list{
  min-height: 0;
  border: 1px solid rgba(148,163,184,0.14);
  border-radius: 14px;
  background: rgba(var(--tone-3),0.10);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.netmon-ab-tools{
  display:flex;
  gap:8px;
  padding: 10px;
  border-bottom: 1px solid rgba(148,163,184,0.12);
  background: rgba(var(--tone-0),0.10);
}
.netmon-ab-tools .input.sm{ height: 30px; }
.netmon-ab-listbox{
  flex: 1;
  min-height: 0;
  overflow:auto;
}

.netmon-ab-row{
  display:grid;
  grid-template-columns: 56px 1.2fr 64px 1fr;
  gap: 10px;
  align-items:center;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(148,163,184,0.10);
  cursor:pointer;
  user-select:none;
}
.netmon-ab-row:last-child{ border-bottom:none; }
.netmon-ab-row:hover{ background: rgba(148,163,184,0.06); }
.netmon-ab-row:active{ background: rgba(148,163,184,0.08); }
.netmon-ab-row.sel{
  background: rgba(56,189,248,0.09);
  box-shadow: 0 0 0 1px rgba(56,189,248,0.18) inset;
  border-left: 3px solid rgba(56,189,248,0.55);
  padding-left: 7px;
}
.netmon-ab-row .lv{ font-weight: 950; letter-spacing: 0.06em; }
.netmon-ab-row .lv.crit{ color: rgba(248,113,113,0.95); }
.netmon-ab-row .lv.warn{ color: rgba(245,158,11,0.95); }
.netmon-ab-row .time{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.netmon-ab-row .meta{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.netmon-ab-detail{
  min-height: 0;
  border: 1px solid rgba(148,163,184,0.14);
  border-radius: 14px;
  background: rgba(var(--tone-3),0.10);
  padding: 10px;
  overflow:auto;
}
.netmon-ab-detail-title{ font-size: 12px; font-weight: 950; margin-bottom: 8px; }

.netmon-ab-hint{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.14);
  background: rgba(var(--tone-0),0.12);
  margin-bottom: 10px;
}
.netmon-ab-hint .dot{ width: 8px; height: 8px; border-radius: 999px; }
.netmon-ab-hint.ok{ border-color: rgba(34,197,94,0.28); background: rgba(34,197,94,0.08); }
.netmon-ab-hint.ok .dot{ background: rgba(34,197,94,0.92); }
.netmon-ab-hint.warn{ border-color: rgba(245,158,11,0.34); background: rgba(245,158,11,0.10); }
.netmon-ab-hint.warn .dot{ background: rgba(245,158,11,0.92); }
.netmon-ab-hint.crit{ border-color: rgba(248,113,113,0.30); background: rgba(248,113,113,0.08); }
.netmon-ab-hint.crit .dot{ background: rgba(248,113,113,0.92); }
.netmon-ab-hint .txt{ font-size: 12px; font-weight: 900; letter-spacing: 0.01em; }

.netmon-ab-kpis{ display:flex; flex-wrap:wrap; gap: 8px; margin-bottom: 10px; }

.n-dot{
  display:inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-right: 6px;
  box-shadow: 0 0 0 2px rgba(var(--tone-0),0.65);
}
.n-dot.online{ background: rgba(34,197,94,0.92); }
.n-dot.offline{ background: rgba(148,163,184,0.60); }

.netmon-ab-tablewrap{ margin-top: 6px; overflow:auto; border: 1px solid rgba(148,163,184,0.12); border-radius: 12px; }
.netmon-ab-table{ width:100%; border-collapse: collapse; }
.netmon-ab-table th,
.netmon-ab-table td{ padding: 8px 10px; border-bottom: 1px solid rgba(148,163,184,0.10); font-size: 12px; }
.netmon-ab-table thead th{
  position: sticky;
  top: 0;
  background: rgba(var(--tone-3),0.80);
  backdrop-filter: blur(8px);
  font-size: 11px;
  color: rgba(148,163,184,0.90);
  letter-spacing: 0.04em;
}
.netmon-ab-table tbody tr.crit td{ color: rgba(var(--tone-text-mid),0.95); }
.netmon-ab-table tbody tr.warn td{ color: rgba(var(--tone-text-mid),0.92); }

.netmon-ab-actions{ display:flex; justify-content:flex-end; gap: 8px; padding-top: 10px; }

@media (max-width: 900px){
  .netmon-ab-body{ grid-template-columns: 1fr; grid-template-rows: 0.90fr 1.10fr; }
  .netmon-ab-row{ grid-template-columns: 56px 1fr 64px; }
  .netmon-ab-row .meta{ display:none; }
}
@media (max-width: 720px){
  .modal.netmon-ab-modal{ padding: 0; }
  .netmon-ab-inner{
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 18px 18px 0 0;
  }
}
/* Stats pills */
.netmon-stats{ margin-top: 8px; }
.netmon-stats-wrap{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
}
.netmon-pill{
  display:flex;
  align-items:baseline;
  gap: 6px;
  border: 1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-3),0.14);
  padding: 4px 10px;
  border-radius: 999px;
}
.netmon-pill .k{ font-size: 11px; color: var(--muted); letter-spacing: 0.02em; }
.netmon-pill .v{ font-size: 12px; font-weight: 900; color: rgba(var(--tone-text-mid),0.95); }
.netmon-pill.warn{ border-color: rgba(245,158,11,0.40); background: rgba(120,53,15,0.14); }
.netmon-pill.crit{ border-color: rgba(248,113,113,0.45); background: rgba(127,29,29,0.16); }
.netmon-pill.ok{ border-color: rgba(34,197,94,0.38); background: rgba(20,83,45,0.12); }

/* Fullscreen */
body.netmon-noscroll{ overflow:hidden; }
.netmon-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  z-index: 998;
}
.netmon-chart-card.netmon-fullscreen{
  position: fixed;
  inset: 76px 18px 18px 18px;
  z-index: 999;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,0.60);
}
.netmon-chart-card.netmon-fullscreen .netmon-canvas{
  height: calc(100vh - 440px);
  height: calc(100dvh - 440px);
}
.netmon-chart-card.netmon-fullscreen .netmon-events-list{ max-height: 260px; }
@media (max-width: 720px){
  .netmon-chart-card.netmon-fullscreen{ inset: 62px 10px 10px 10px; }
  .netmon-chart-card.netmon-fullscreen .netmon-canvas{ height: calc(100vh - 460px); height: calc(100dvh - 460px); }
}

/* =========================
   NetMon Kiosk (share minimal)
   ========================= */
body.netmon-kiosk .topbar,
body.netmon-kiosk .footer{ display:none; }
body.netmon-kiosk .container{ max-width:none; padding: 10px; }
body.netmon-kiosk .page-head,
body.netmon-kiosk .netmon-toolbar{ display:none !important; }
body.netmon-kiosk .netmon-charts{ margin-top: 0; }
body.netmon-kiosk .netmon-events-row{ display:none; }

/* =========================
   NetMon Wallboard (NOC / TV screen)
   ========================= */
body.netmon-wall .topbar,
body.netmon-wall .footer{ display:none; }
body.netmon-wall .container{ max-width:none; padding: 12px; }

.badge.crit{ border-color: rgba(248,113,113,0.32); background: rgba(248,113,113,0.10); }

.netmon-wallbar{
  position: sticky;
  top: 10px;
  z-index: 60;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 14px;
  padding: 12px 12px 10px;
  border: 1px solid rgba(148,163,184,0.16);
  border-radius: 14px;
  background: rgba(var(--tone-3),0.72);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 60px rgba(0,0,0,0.40);
}
.netmon-wall-left{ display:flex; flex-direction:column; gap:2px; }
.netmon-wall-clock{
  font-size: 26px;
  font-weight: 950;
  letter-spacing: 0.06em;
  line-height: 1.0;
}
.netmon-wall-mid{ flex:1; display:flex; justify-content:center; }
.netmon-wall-badges{ display:flex; gap:10px; flex-wrap:wrap; justify-content:center; }
.netmon-wall-right{ display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; justify-content:flex-end; }
.netmon-wall-ctrl{ display:flex; flex-direction:column; gap:4px; }

body.netmon-wall .netmon-charts{ display:grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }
body.netmon-wall .netmon-chart-card .netmon-canvas{ height: 180px; }
body.netmon-wall .netmon-nav-canvas{ height: 32px; }
body.netmon-wall .netmon-actions{ display:none; }
body.netmon-wall .netmon-events-list{ display:none; }
body.netmon-wall .netmon-events{ padding-bottom: 10px; }
body.netmon-wall .netmon-realtime-btn{ display:none !important; }

.netmon-wall-focus{
  outline: 1px solid rgba(56,189,248,0.40);
  box-shadow: 0 0 0 1px rgba(56,189,248,0.14) inset, 0 42px 140px rgba(56,189,248,0.18);
  transform: translateY(-1px);
}

@media (max-width: 720px){
  body.netmon-wall .netmon-charts{ grid-template-columns: 1fr; }
  .netmon-wallbar{ top: 0; border-radius: 12px; }

  /* Mobile wallbar: turn the control cluster into a clean grid */
  .netmon-wallbar{
    flex-direction:column;
    align-items:stretch;
    gap: 10px;
  }
  .netmon-wall-mid{ justify-content:flex-start; }
  .netmon-wall-right{
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items:stretch;
    justify-content:stretch;
  }
  .netmon-wall-right > *{ min-width:0; }
  .netmon-wall-ctrl{ width:100%; }
  .netmon-wall-ctrl input,
  .netmon-wall-ctrl select{ width:100% !important; }

  /* Buttons: make key actions full width */
  body.netmon-wall #netmonRefreshBtn,
  body.netmon-wall #netmonWallFullscreen,
  body.netmon-wall .netmon-wall-right a.btn.secondary{
    grid-column: 1 / -1;
  }
}

/* =========================
   NetMon Event Detail Modal
   ========================= */
.netmon-evt-hint{
  border: 1px solid rgba(148,163,184,0.18);
  background: rgba(var(--tone-3),0.28);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: inset 0 1px 0 rgba(var(--tone-line),0.03);
}
.netmon-evt-hint strong{ font-weight: 950; }

.netmon-evt-kpis{ display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }

.netmon-evt-table td{ font-size: 13px; }
.netmon-evt-table tr.crit td{ background: rgba(248,113,113,0.06); }
.netmon-evt-table tr.warn td{ background: rgba(245,158,11,0.05); }
.netmon-evt-table .n-dot{
  width:8px; height:8px; border-radius:999px; display:inline-block; margin-right:8px;
  box-shadow: 0 0 0 2px rgba(var(--tone-0),0.65);
}
.netmon-evt-table .n-dot.online{ background: rgba(34,197,94,0.92); }
.netmon-evt-table .n-dot.offline{ background: rgba(100,116,139,0.92); }
.netmon-evt-table .bad{ color: rgba(248,113,113,0.95); font-weight: 900; }
.netmon-evt-table .warnc{ color: rgba(245,158,11,0.95); font-weight: 900; }

/* Audit filters/table: keep desktop density while removing mobile crowding/misalignment */
.audit-filter-row{
  gap:10px;
  align-items:flex-end;
  flex-wrap:wrap;
}
.audit-filter-row > .col{
  min-width:140px;
  flex:1 1 180px;
}
.audit-table .audit-detail-cell{
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* Audit table: avoid global sticky header offset causing header drift/misalignment */
.audit-table thead th{
  position: static;
  top: auto;
  z-index: auto;
  background: rgba(var(--tone-0),0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.audit-toolbar{
  gap:10px;
}

@media (max-width: 760px){
  .audit-filter-row > .col{
    min-width:0 !important;
    max-width:none !important;
    flex:1 1 100% !important;
  }
  .audit-toolbar{
    flex-direction:column;
    align-items:stretch;
  }
  .audit-toolbar .dash-filters{
    flex-wrap:nowrap;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    padding-bottom:2px;
  }
  .audit-toolbar .dash-filters::-webkit-scrollbar{ display:none; }
  .audit-toolbar-actions{
    width:100%;
    justify-content:flex-start;
  }
  .audit-toolbar-actions .btn{
    flex:1 1 calc(50% - 6px);
    min-width:0;
  }
}

@media (max-width: 520px){
  .audit-toolbar-actions .btn{
    flex:1 1 100%;
  }
}

/* =========================
   Logs Workspace (Console Pro)
   ========================= */
.log-console-hero{
  padding: 14px;
  border-radius: 18px;
}

.log-console-summary{
  display:grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items:start;
}

.log-kpi-grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.log-kpi{
  border:1px solid rgba(148,163,184,0.16);
  background: rgba(var(--tone-3),0.22);
  border-radius: 14px;
  padding: 10px;
  min-width:0;
}

.log-kpi-label{
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.log-kpi-value{
  margin-top: 6px;
  font-size: 18px;
  font-weight: 900;
  color: rgba(var(--tone-text-hi),0.95);
  letter-spacing: 0.02em;
  overflow-wrap:anywhere;
}

.log-console-actions{
  align-items:flex-start;
}

.log-toolbar-grid{
  margin-top: 12px;
  display:grid;
  grid-template-columns: minmax(180px, 220px) minmax(120px, 170px) minmax(150px, 200px) minmax(320px, 1fr);
  gap: 10px;
  align-items:end;
}

.log-field{
  min-width:0;
}

.log-field-search .dash-search{
  max-width:none;
}

.log-search-box{
  width:100%;
}

.log-filter-bar{
  margin-top: 12px;
  margin-bottom: 0;
  gap: 12px;
}

.log-toggle-group{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap:wrap;
}

.log-toggle{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  font-size: 12px;
  color: rgba(var(--tone-text-mid),0.88);
  border: 1px solid rgba(148,163,184,0.16);
  background: rgba(var(--tone-0),0.12);
  border-radius: 999px;
  padding: 6px 10px;
}

.log-toggle input{
  margin:0;
  transform: translateY(0.5px);
}

.log-source-meta{
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border:1px solid rgba(148,163,184,0.14);
  background: rgba(var(--tone-0),0.10);
}

.log-hint{
  min-height: 18px;
  margin-top: 8px;
  color: rgba(var(--tone-text-mid),0.80);
}

.log-hint.error{
  color: var(--bad);
}

.log-console-layout{
  margin-top: 12px;
  display:grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 12px;
}

.log-stream-card{
  min-width:0;
  padding: 12px;
}

.log-stream-wrap{
  margin-top: 8px;
  border:1px solid rgba(148,163,184,0.14);
  border-radius: 14px;
  background: rgba(var(--tone-3),0.40);
  min-height: 460px;
  max-height: 72vh;
  overflow:auto;
}

.log-lines{
  display:flex;
  flex-direction:column;
  gap: 0;
}

.log-empty{
  color: var(--muted);
  font-size: 12px;
  padding: 14px;
}

.log-row{
  appearance:none;
  width:100%;
  display:grid;
  grid-template-columns: 62px 170px 72px minmax(0, 1fr);
  gap: 10px;
  align-items:center;
  text-align:left;
  border:0;
  border-bottom: 1px solid rgba(148,163,184,0.10);
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  cursor:pointer;
}

.log-row:hover{
  background: rgba(59,130,246,0.10);
}

.log-row.active{
  background: rgba(59,130,246,0.16);
  box-shadow: inset 0 0 0 1px rgba(59,130,246,0.26);
}

.log-row:last-child{
  border-bottom:0;
}

.log-row-idx{
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.log-row-time{
  font-size: 11px;
  color: rgba(var(--tone-text-mid),0.86);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-variant-numeric: tabular-nums;
}

.log-row-level{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height: 22px;
  border-radius: 999px;
  border:1px solid rgba(148,163,184,0.18);
  background: rgba(148,163,184,0.12);
  color: var(--text);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.log-row-level.error{
  color: rgba(248,113,113,0.95);
  border-color: rgba(248,113,113,0.38);
  background: rgba(127,29,29,0.20);
}

.log-row-level.warn{
  color: rgba(245,158,11,0.95);
  border-color: rgba(245,158,11,0.42);
  background: rgba(120,53,15,0.18);
}

.log-row-level.info{
  color: rgba(96,165,250,0.98);
  border-color: rgba(96,165,250,0.38);
  background: rgba(30,64,175,0.18);
}

.log-row-level.debug{
  color: rgba(var(--tone-text-mid),0.92);
  border-color: rgba(148,163,184,0.26);
  background: rgba(71,85,105,0.16);
}

.log-row-level.trace{
  color: rgba(var(--tone-text-mid),0.90);
  border-color: rgba(148,163,184,0.24);
  background: rgba(30,41,59,0.22);
}

.log-row-level.other{
  color: var(--muted);
  border-color: rgba(148,163,184,0.22);
  background: rgba(148,163,184,0.10);
}

.log-row-msg{
  font-size: 12px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  color: rgba(var(--tone-text-mid),0.95);
}

.log-lines.wrap .log-row-msg{
  white-space:pre-wrap;
  word-break:break-word;
  overflow:visible;
  text-overflow:clip;
}

.log-row.level-error{ border-left: 2px solid rgba(248,113,113,0.38); }
.log-row.level-warn{ border-left: 2px solid rgba(245,158,11,0.34); }
.log-row.level-info{ border-left: 2px solid rgba(96,165,250,0.30); }
.log-row.level-debug{ border-left: 2px solid rgba(148,163,184,0.24); }
.log-row.level-trace{ border-left: 2px solid rgba(148,163,184,0.20); }
.log-row.level-other{ border-left: 2px solid transparent; }

.log-row-msg mark{
  background: rgba(34,211,238,0.22);
  color: rgba(var(--tone-text-hi),0.98);
  border-radius: 4px;
  padding: 0 2px;
}

.log-detail-card{
  min-width:0;
  padding: 12px;
  position: sticky;
  top: var(--sticky-top);
  align-self:start;
}

.log-detail-empty{
  margin-top: 10px;
  border:1px dashed rgba(148,163,184,0.22);
  border-radius: 12px;
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
}

.log-detail-grid{
  margin-top: 6px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.log-detail-item{
  border:1px solid rgba(148,163,184,0.14);
  background: rgba(var(--tone-3),0.18);
  border-radius: 12px;
  padding: 8px;
}

.log-detail-item .k{
  font-size: 11px;
  color: var(--muted);
}

.log-detail-item .v{
  margin-top: 4px;
  font-size: 12px;
  font-weight: 800;
  color: rgba(var(--tone-text-hi),0.95);
  overflow-wrap:anywhere;
}

.log-detail-block{
  margin-top: 10px;
}

.log-detail-label{
  font-size: 11px;
  font-weight: 800;
  color: rgba(var(--tone-text-mid),0.88);
  margin-bottom: 6px;
}

.log-detail-text,
.log-detail-context{
  margin:0;
  border:1px solid rgba(148,163,184,0.14);
  border-radius: 12px;
  background: rgba(var(--tone-3),0.26);
  color: rgba(var(--tone-text-mid),0.94);
  padding: 10px;
  font-size: 12px;
  line-height: 1.45;
  white-space:pre-wrap;
  word-break:break-word;
  overflow:auto;
}

.log-detail-text{
  min-height: 120px;
  max-height: 220px;
}

.log-detail-context{
  min-height: 120px;
  max-height: 260px;
}

@media (max-width: 1320px){
  .log-kpi-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .log-toolbar-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .log-field-search{
    grid-column: 1 / -1;
  }
}

@media (max-width: 1080px){
  .log-console-summary{
    grid-template-columns: 1fr;
  }

  .log-console-actions{
    justify-content:flex-start;
  }

  .log-console-layout{
    grid-template-columns: 1fr;
  }

  .log-detail-card{
    position: static;
  }
}

@media (max-width: 760px){
  .log-row{
    grid-template-columns: 54px 130px 64px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .log-row-time{
    font-size: 10px;
  }

  .log-row-msg{
    font-size: 11px;
  }

  .log-detail-grid{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px){
  .log-kpi-grid{
    grid-template-columns: 1fr;
  }

  .log-toolbar-grid{
    grid-template-columns: 1fr;
  }

  .log-filter-bar{
    flex-direction:column;
    align-items:stretch;
  }

  .log-toggle-group{
    width:100%;
  }

  .log-row{
    grid-template-columns: 48px 1fr;
    grid-template-areas:
      "idx level"
      "time time"
      "msg msg";
    gap: 4px 8px;
  }

  .log-row-idx{ grid-area: idx; }
  .log-row-level{ grid-area: level; justify-self:end; }
  .log-row-time{ grid-area: time; }
  .log-row-msg{ grid-area: msg; }
}

/* =========================
   Project Prism UI Overrides
   ========================= */

body{
  background:var(--bg);
  color:var(--text);
}

.bg-flow{
  inset:-35%;
  background:
    radial-gradient(1200px 1200px at 10% 14%, var(--bg-flow-1), transparent 65%),
    radial-gradient(1200px 1200px at 88% 10%, var(--bg-flow-2), transparent 66%),
    radial-gradient(1200px 1200px at 20% 88%, var(--bg-flow-3), transparent 68%),
    radial-gradient(1200px 1200px at 86% 78%, var(--bg-flow-4), transparent 70%);
  filter:blur(80px) saturate(150%);
  animation:bgFlowPrism 20s ease-in-out infinite;
}

@keyframes bgFlowPrism{
  0%{transform:translate3d(-3%, -2%, 0) scale(1.06);}
  33%{transform:translate3d(2%, -4%, 0) scale(1.10);}
  66%{transform:translate3d(-1%, 3%, 0) scale(1.08);}
  100%{transform:translate3d(3%, 2%, 0) scale(1.07);}
}

.topbar{
  position:sticky;
  top:calc(10px + var(--safe-top));
  width:min(var(--container), calc(100% - 32px));
  margin:calc(16px + var(--safe-top)) auto 0;
  padding:12px 20px;
  border-radius:24px;
  border:1px solid var(--glass-border);
  background:var(--glass-bg);
  backdrop-filter:blur(24px) saturate(150%);
  -webkit-backdrop-filter:blur(24px) saturate(150%);
  box-shadow:var(--glow);
}

.topbar + .container{
  margin-top:14px;
}

.nav-link{
  border-radius:999px;
}

.nav-link.active{
  border-color:var(--glass-border-highlight);
  background:rgba(59,130,246,0.20);
}

.menu-portal .menu-pop.sheet{
  left:8px;
  right:8px;
  bottom:0;
  top:auto;
  min-width:0;
  max-width:none;
  max-height:60vh;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  border-radius:24px 24px 0 0;
  padding-bottom:calc(10px + var(--safe-bottom));
}

.card,
.panel,
.modal-inner{
  border-radius:24px;
  border:1px solid var(--glass-border);
  background:var(--glass-bg);
  backdrop-filter:blur(24px) saturate(150%);
  -webkit-backdrop-filter:blur(24px) saturate(150%);
  box-shadow:var(--glow);
}

.btn{
  min-height:36px;
  padding:8px 16px;
  border-radius:12px;
  font-weight:600;
}

.btn.sm{
  min-height:32px;
  padding:6px 12px;
}

.btn.xs{
  min-height:30px;
  padding:6px 10px;
}

.btn:hover{
  transform:translateY(var(--hover-lift));
}

.btn:active{
  transform:translateY(var(--press-lift));
}

.input,
.select,
textarea,
.textarea{
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(0,0,0,0.15);
  transition:
    border-color var(--motion-base) var(--ease-standard),
    box-shadow var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard);
}

:root[data-theme="light"] .input,
:root[data-theme="light"] .select,
:root[data-theme="light"] textarea,
:root[data-theme="light"] .textarea{
  border-color:rgba(148,163,184,0.28);
  background:rgba(15,23,42,0.05);
}

.input:focus,
.select:focus,
textarea:focus,
.textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(59,130,246,0.25);
}

.dash-filters{
  padding:6px;
  border-radius:16px;
  background:rgba(0,0,0,0.15);
  gap:6px;
}

:root[data-theme="light"] .dash-filters{
  background:rgba(15,23,42,0.08);
}

.dash-filters .chip{
  border-radius:12px;
  border:1px solid transparent;
  background:transparent;
  color:var(--muted);
  box-shadow:none;
  white-space:nowrap;
}

.dash-filters .chip.active,
.dash-filters .chip[aria-selected="true"]{
  background:var(--glass-bg);
  border-color:var(--glass-border-highlight);
  color:var(--text);
  box-shadow:0 2px 8px rgba(0,0,0,0.10);
}

.grid.node-grid{
  grid-template-columns:repeat(auto-fit, minmax(300px, 1fr));
  gap:20px;
}
.dash-group-items{
  grid-template-columns:repeat(auto-fit, minmax(300px, 1fr));
  gap:20px;
}

.node-dot.online{
  width:8px;
  height:8px;
  box-shadow:0 0 10px var(--ok);
}

.mini-progress{
  height:6px;
  background:rgba(0,0,0,0.30);
}

.mini-fill{
  background:linear-gradient(90deg, var(--accent), #8B5CF6);
}

.table th,
.table td{
  border-left:none;
  border-right:none;
}

.table thead th{
  position:static;
  top:auto;
  z-index:1;
  background:rgba(13,15,20,0.98);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  text-transform:uppercase;
  letter-spacing:0.08em;
  font-size:12px;
}

:root[data-theme="light"] .table thead th{
  background:rgba(241,245,249,0.98);
}

.node-main .table thead th{
  position:static;
  top:auto;
  z-index:1;
}

/* Hard guard: default tables never use sticky headers unless explicitly opted-in. */
.table:not(.sticky-head) thead th{
  position:static !important;
  top:auto !important;
  z-index:1 !important;
  transform:none !important;
}
.table.sticky-head thead th{
  position:sticky !important;
  top:var(--sticky-top);
  z-index:3;
}
.table tbody tr:hover td{
  background:rgba(255,255,255,0.06);
}

:root[data-theme="light"] .table tbody tr:hover td{
  background:rgba(30,41,59,0.06);
}

.settings-console{
  grid-template-columns:280px minmax(0, 1fr);
}

.settings-side{
  top:var(--sticky-top);
}

.settings-action-dock{
  position:fixed;
  left:50%;
  right:auto;
  bottom:30px;
  transform:translateX(-50%);
  width:auto;
  padding:0;
  z-index:50;
  pointer-events:auto;
}

.settings-action-inner{
  width:auto;
  min-width:min(760px, calc(100vw - 32px));
  border-radius:999px;
  padding:14px 24px;
}

.modal,
.modal-backdrop{
  background:rgba(0,0,0,0.50);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}

.modal-inner{
  border:1px solid var(--glass-border);
}

.modal .modal-body{
  overflow-y:auto;
}

body.modal-open{
  overflow:hidden;
}

body.page-login .container,
body.page-setup .container{
  min-height:100vh;
  min-height:100dvh;
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding-top:24px;
  padding-bottom:calc(24px + var(--safe-bottom));
}

body.page-login .page-head,
body.page-setup .page-head,
body.page-login .footer,
body.page-setup .footer{
  display:none;
}

body.page-login .center-wrap.sm,
body.page-setup .center-wrap.sm{
  width:100%;
  max-width:380px;
  margin:0 auto;
}

body.page-login .auth-head,
body.page-setup .auth-head{
  align-items:center;
  text-align:center;
  margin-bottom:18px;
}

body.page-login .auth-head::before,
body.page-setup .auth-head::before{
  content:"";
  width:80px;
  height:80px;
  border-radius:50%;
  background:linear-gradient(135deg, #3B82F6, #22D3EE);
  border:1px solid rgba(255,255,255,0.24);
  box-shadow:0 12px 30px rgba(59,130,246,0.36);
  animation:fadeInScale 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.page-login .card.center-card,
body.page-setup .card.center-card{
  padding:40px 30px;
}

@keyframes fadeInScale{
  0%{opacity:0;transform:scale(0.88);}
  100%{opacity:1;transform:scale(1);}
}

@media (max-width: 1180px){
  .settings-console{
    grid-template-columns:1fr;
  }
}

@media (max-width: 768px){
  :root{
    --sticky-top: calc(82px + var(--safe-top));
  }

  .topbar{
    width:calc(100% - 16px);
    margin:calc(8px + var(--safe-top)) auto 0;
    padding:10px 12px;
    border-radius:18px;
  }

  .nav-desktop{display:none}
  .nav-mobile{display:inline-block}

  .grid.node-grid{
    grid-template-columns:1fr;
    gap:16px;
  }
  .dash-group-items{
    grid-template-columns:1fr;
    gap:16px;
  }

  .dash-filters{
    flex-wrap:nowrap;
    overflow-x:auto;
    white-space:nowrap;
    scrollbar-width:none;
    -webkit-overflow-scrolling:touch;
  }

  .dash-filters::-webkit-scrollbar{
    display:none;
  }

  .dash-filters .chip{
    flex:0 0 auto;
  }

  .settings-side{
    position:static;
    max-height:none;
    overflow:visible;
  }

  .settings-side-nav{
    flex-direction:row;
    overflow-x:auto;
    white-space:nowrap;
    scrollbar-width:none;
    -webkit-overflow-scrolling:touch;
    padding-bottom:2px;
  }

  .settings-side-nav::-webkit-scrollbar{
    display:none;
  }

  .settings-side-nav .settings-nav-chip{
    flex:0 0 auto;
    width:auto;
  }

  .settings-action-dock{
    left:16px;
    right:16px;
    width:calc(100% - 32px);
    transform:none;
    bottom:max(16px, var(--safe-bottom));
  }

  .settings-action-inner{
    min-width:0;
    width:100%;
    border-radius:20px;
    flex-direction:column;
    align-items:stretch;
  }

  .settings-action-buttons{
    width:100%;
    flex-direction:column;
  }

  .settings-action-buttons .btn{
    width:100%;
    flex:1 1 auto;
  }

  .modal{
    padding:12px;
  }

  .modal-inner{
    width:calc(100% - 24px);
    max-width:calc(100% - 24px);
    max-height:calc(100vh - 24px);
    max-height:calc(100dvh - 24px);
    padding:20px;
  }
}

@media (max-width: 640px){
  .btn,
  .btn.sm,
  .btn.xs{
    min-height:44px;
  }

  .input,
  .select,
  textarea,
  .textarea{
    min-height:44px;
  }

  .modal .form .row-end .btn,
  .modal .form .row-end-sm .btn,
  .modal .form .row-end-12 .btn,
  .modal .form-section .row-end .btn,
  .modal .form-section .row-end-sm .btn,
  .modal .form-section .row-end-12 .btn,
  .modal .adv-body .row-end .btn,
  .modal .adv-body .row-end-sm .btn,
  .modal .adv-body .row-end-12 .btn{
    width:100%;
    flex:1 1 auto;
  }

  body.page-login .container,
  body.page-setup .container{
    padding:16px 12px calc(16px + var(--safe-bottom));
  }

  body.page-login .card.center-card,
  body.page-setup .card.center-card{
    padding:26px 18px;
  }
}

@media (max-width: 420px){
  :root{
    --sticky-top: calc(74px + var(--safe-top));
  }
}

@media (prefers-reduced-motion: reduce){
  :root{
    --motion-fast:1ms;
    --motion-base:1ms;
    --motion-expand:1ms;
    --hover-lift:0px;
    --press-lift:0px;
  }

  *,
  *::before,
  *::after{
    animation-duration:1ms !important;
    animation-iteration-count:1 !important;
    transition-duration:1ms !important;
    scroll-behavior:auto !important;
  }

  .bg-flow,
  .au-modal .au-progress-fill::after,
  .panel-update-track .au-progress-fill::after,
  body.page-login .auth-head::before{
    animation:none !important;
  }
}

/* =========================
   Nexus Unified UI V2
   - Single-source runtime tokens
   - App shell
   - Component consistency
   ========================= */
body{font-family:var(--font-sans);letter-spacing:0.01em;}
.h1,.h2,.brand-name,.card-title,.section-title{font-family:var(--font-title);letter-spacing:0.02em;}
.mono{font-family:var(--font-mono);}

/* App shell */
.app-shell{position:relative;}
.app-body{
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:var(--space-4);
  align-items:start;
}
.app-main{min-width:0;display:flex;flex-direction:column;gap:var(--space-4);}

.page-head{
  margin-bottom:0;
  padding:14px 16px;
  border:1px solid var(--line);
  border-radius:18px;
  background:
    radial-gradient(140% 160% at 0% 0%, var(--hero-grad-1), transparent 62%),
    radial-gradient(150% 150% at 100% 100%, var(--hero-grad-2), transparent 66%),
    linear-gradient(180deg, var(--hero-surface-top), var(--hero-surface-bot));
  box-shadow:var(--glow);
}

.page-kpi-band{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
  gap:10px;
}
.page-kpi{
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px;
  background:rgba(var(--tone-3),0.36);
}
.page-kpi-k{font-size:11px;color:var(--muted);}
.page-kpi-v{margin-top:4px;font-size:20px;font-family:var(--font-title);font-weight:700;color:var(--text);}
.page-section-shell{
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:14px 16px;
}
.page-section-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.page-section-meta{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.dense-card-grid{
  gap:12px;
}
.dense-list-shell{
  gap:10px;
}
.dense-detail-shell{
  gap:12px;
  align-items:start;
}
.page-section-shell .table-wrap{
  margin-top:0;
}
.page-section-head .card-title,
.page-section-head .section-title,
.page-section-head .wm-card-title{
  color:var(--text-strong);
}
.empty-state{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:14px 16px;
  border:1px dashed var(--border-subtle);
  border-radius:var(--radius-md);
  background:rgba(var(--tone-0),0.14);
  color:var(--text-muted);
  font-size:12px;
  line-height:1.5;
}
.empty-state.compact{
  padding:10px 12px;
  border-radius:var(--radius-sm);
}
.action-group{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.status-cluster{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.table-shell{
  border-color:var(--border-strong);
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.02);
}
.table-shell .table thead th{
  background:rgba(var(--tone-0),0.22);
}
.danger-panel{
  border-color:rgba(255,91,110,0.26);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255,91,110,0.10), transparent 58%),
    linear-gradient(180deg, rgba(var(--tone-1),0.88), rgba(var(--tone-0),0.20));
}
.danger-panel .section-title,
.danger-panel .card-title{
  color:#fecaca;
}
.dashboard-content-shell .dash-group{
  margin-top:0;
}
.dashboard-content-shell .dash-group-items{
  gap:10px;
}
.wm-list-shell .wm-sites{
  margin-top:0;
}

/* Unified components */
.card,
.panel,
.modal-inner{
  border-radius:18px;
  border:1px solid var(--line);
  background:
    radial-gradient(130% 150% at 0% 0%, var(--hero-grad-1), transparent 60%),
    linear-gradient(180deg,rgba(var(--tone-1),0.86),rgba(var(--tone-0),0.8));
  box-shadow:var(--glow);
}

.btn{
  min-height:36px;
  border-radius:12px;
  font-weight:680;
  letter-spacing:0.02em;
  border:1px solid rgba(47,143,255,0.4);
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  box-shadow:var(--btn-shadow);
}
.btn.primary{background:linear-gradient(135deg,var(--accent),var(--accent2));border-color:rgba(47,143,255,0.5);}
.btn.secondary{background:rgba(var(--tone-2),0.48);border-color:var(--line-strong);color:var(--text);box-shadow:none;}
.btn.ghost{background:rgba(var(--tone-2),0.22);border-color:var(--line);color:var(--text);box-shadow:none;}
.btn.danger{background:linear-gradient(135deg,rgba(255,91,110,0.9),rgba(226,64,76,0.9));border-color:rgba(255,91,110,0.45);}

.table th,.table td{border-bottom:1px solid var(--line);}
.table thead th{
  letter-spacing:0.08em;
  text-transform:uppercase;
  font-size:11px;
  color:var(--muted);
}

.input,.select,textarea,.textarea{
  border:1px solid var(--line);
  background:rgba(var(--tone-0),0.28);
  color:var(--text);
}
.input:focus,.select:focus,textarea:focus,.textarea:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(47,143,255,0.2);}

.pill{border-color:var(--line);background:rgba(var(--tone-2),0.3);color:var(--muted);}
.pill.ok{color:var(--ok);border-color:rgba(37,208,127,0.46);background:rgba(37,208,127,0.12);}
.pill.warn{color:var(--warn);border-color:rgba(255,177,26,0.45);background:rgba(255,177,26,0.14);}
.pill.bad{color:var(--bad);border-color:rgba(255,91,110,0.45);background:rgba(255,91,110,0.12);}

.flash{border-color:rgba(255,177,26,0.46);background:rgba(255,177,26,0.16);color:var(--warn);}
.flash.ok{border-color:rgba(37,208,127,0.44);background:rgba(37,208,127,0.14);color:var(--ok);}
.flash.bad{border-color:rgba(255,91,110,0.46);background:rgba(255,91,110,0.16);color:var(--bad);}

/* Utility classes to replace inline styles */
.is-hidden{display:none !important;}
.is-collapsed{max-height:0 !important;overflow:hidden !important;}
.mt-6{margin-top:6px !important;}
.mt-8{margin-top:8px !important;}
.mt-10{margin-top:10px !important;}
.mt-12{margin-top:12px !important;}
.mt-14{margin-top:14px !important;}
.m-0{margin:0 !important;}
.mb-12{margin-bottom:12px !important;}
.w-100{width:100% !important;}
.w-90{width:90px !important;}
.maxw-560{max-width:560px !important;}
.maxw-130{max-width:130px !important;}
.maxw-140{max-width:140px !important;}
.maxw-160{max-width:160px !important;}
.maxw-170{max-width:170px !important;}
.maxw-180{max-width:180px !important;}
.maxw-190{max-width:190px !important;}
.maxw-200{max-width:200px !important;}
.maxw-220{max-width:220px !important;}
.maxw-240{max-width:240px !important;}
.maxw-260{max-width:260px !important;}
.maxw-360{max-width:360px !important;}
.maxw-720{max-width:720px !important;}
.maxw-760{max-width:760px !important;}
.maxw-860{max-width:860px !important;}
.maxw-980{max-width:980px !important;}
.minw-0{min-width:0 !important;}
.minw-110{min-width:110px !important;}
.minw-120{min-width:120px !important;}
.minw-130{min-width:130px !important;}
.minw-140{min-width:140px !important;}
.minw-150{min-width:150px !important;}
.minw-160{min-width:160px !important;}
.minw-164{min-width:164px !important;}
.minw-220{min-width:220px !important;}
.gap-6{gap:6px !important;}
.gap-8{gap:8px !important;}
.gap-10{gap:10px !important;}
.gap-12{gap:12px !important;}
.gap-14{gap:14px !important;}
.wrap{flex-wrap:wrap !important;}
.items-center{align-items:center !important;}
.items-start{align-items:flex-start !important;}
.items-end{align-items:flex-end !important;}
.justify-between{justify-content:space-between !important;}
.justify-end{justify-content:flex-end !important;}
.justify-start{justify-content:flex-start !important;}
.text-bad{color:var(--bad) !important;}
.text-ok{color:var(--ok) !important;}
.text-muted{color:var(--muted) !important;}
.ov-anywhere{overflow-wrap:anywhere !important;word-break:break-word !important;}
.fs-16{font-size:16px !important;}
.lh-16{line-height:1.6 !important;}
.flex-1{flex:1 !important;}
.d-flex{display:flex !important;}
.flex-auto{flex:0 0 auto !important;}
.inline-check{transform:translateY(1px);}
.row-end{display:flex;gap:10px;justify-content:flex-end;margin-top:14px;flex-wrap:wrap;}
.row-end-sm{display:flex;gap:10px;justify-content:flex-end;margin-top:6px;flex-wrap:wrap;}
.row-end-12{display:flex;gap:10px;justify-content:flex-end;margin-top:12px;flex-wrap:wrap;}
.row-between{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;}
.row-gap12{display:flex;gap:12px;flex-wrap:wrap;}
.row-gap10{display:flex;gap:10px;flex-wrap:wrap;}
.grid-col-full{grid-column:1 / -1 !important;}
.pre-wrap{white-space:pre-wrap !important;}
.maxh-180{max-height:180px !important;}
.of-auto{overflow:auto !important;}
.minh-60vh{min-height:60vh !important;}
.cursor-pointer{cursor:pointer !important;}

@media (max-width: 768px){
  :root{--sticky-top:calc(78px + var(--safe-top));}
  .container{padding:12px;}
  .topbar{padding:10px 12px;}
  .page-head{padding:12px;}
  .page-head .right{display:grid;grid-template-columns:repeat(auto-fit,minmax(132px,1fr));width:100%;}
  .page-head .right > *{width:100%;}
}

@media (max-width: 420px){
  :root{--sticky-top:calc(70px + var(--safe-top));}
}

/* ---- extracted from panel/templates/users.html ---- */

.um-hero{
  margin-bottom:12px;
  padding:14px;
  border-radius:18px;
  border:1px solid rgba(var(--tone-line),0.16);
  background:linear-gradient(180deg, rgba(var(--tone-1),0.72), rgba(var(--tone-0),0.68));
  box-shadow: var(--glow);
  animation: um-fade-up var(--motion-expand) var(--ease-emphasis) both;
}

.um-hero-grid{
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  gap:10px;
  align-items:start;
}

.um-head-main{
  display:flex;
  flex-direction:column;
  gap:8px;
  min-width:0;
  align-items:flex-start;
}

.um-title-row{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
}

.um-head-sub{
  color:rgba(var(--tone-text-mid),0.90);
  max-width:940px;
  line-height:1.42;
  font-size:12px;
}

.um-stat-chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:2px;
}

.um-stat-chip{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:8px 14px;
  border-radius:999px;
  border:1px solid rgba(var(--tone-line),0.18);
  background:rgba(var(--tone-0),0.28);
  color:rgba(var(--tone-text-mid),0.94);
  font-size:12px;
  font-weight:760;
  line-height:1;
  white-space:nowrap;
}

.um-stat-chip.primary{
  border-color:rgba(96,165,250,0.56);
  background:rgba(59,130,246,0.14);
}

.um-stat-chip strong{
  font-size:18px;
  line-height:1;
  letter-spacing:0.2px;
  color:var(--text);
}

.um-hero-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  justify-content:flex-end;
  align-self:flex-start;
}

.um-hero-actions .btn{
  min-width:108px;
}

#umFormModal{
  padding:14px;
}

.um-form-modal{
  width:min(1280px, 100%);
  max-width:100%;
  max-height:min(94vh, calc(100vh - 20px));
  border-radius:20px;
  border:1px solid rgba(var(--tone-line),0.18);
  background:
    radial-gradient(740px 220px at 0% 0%, rgba(59,130,246,0.10), transparent 64%),
    linear-gradient(180deg, rgba(var(--tone-1),0.84), rgba(var(--tone-0),0.84));
  box-shadow:var(--shadow);
}

.um-form-modal .form{
  margin-top:10px;
  max-height:calc(100vh - 172px);
  overflow:auto;
  padding-right:6px;
}

.um-section{
  border:1px solid rgba(var(--tone-line),0.14);
  border-radius:14px;
  background:rgba(var(--tone-1),0.36);
  padding:12px;
}

.um-section + .um-section{
  margin-top:10px;
}

.um-section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:9px;
}

.um-section-title{
  font-size:13px;
  font-weight:760;
  letter-spacing:0.16px;
}

.um-switch{
  display:inline-flex;
  align-items:center;
  gap:7px;
  color:var(--text);
  font-size:13px;
}

.um-inline-actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}

.um-mode-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:8px;
  margin-top:8px;
}

.um-mode-card{
  display:flex;
  gap:8px;
  align-items:flex-start;
  border:1px solid rgba(var(--tone-line),0.16);
  border-radius:11px;
  padding:10px;
  cursor:pointer;
  background:rgba(var(--tone-2),0.26);
  transition:
    border-color var(--motion-base) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard),
    background var(--motion-base) var(--ease-standard);
}

.um-mode-card:hover{
  border-color:rgba(59,130,246,0.40);
  background:rgba(var(--tone-2),0.42);
  transform:translateY(var(--hover-lift));
}
.um-mode-card:active{transform:translateY(var(--press-lift));}

.um-mode-card.off{
  opacity:0.56;
}

.um-mode-title{
  font-size:13px;
  font-weight:700;
}

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

.um-node-list{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  max-height:320px;
  overflow:auto;
  padding-right:2px;
}

.um-node-chip{
  appearance:none;
  border:1px solid rgba(var(--tone-line),0.16);
  background:rgba(var(--tone-2),0.30);
  color:var(--muted);
  border-radius:999px;
  padding:6px 10px;
  font-size:12px;
  cursor:pointer;
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard),
    color var(--motion-base) var(--ease-standard);
}

.um-node-chip:hover{
  transform:translateY(var(--hover-lift));
  color:var(--text);
  border-color:rgba(59,130,246,0.38);
}
.um-node-chip:active{transform:translateY(var(--press-lift));}

.um-node-chip.active{
  color:var(--text);
  border-color:rgba(59,130,246,0.42);
  background:rgba(59,130,246,0.18);
  box-shadow:0 0 0 1px rgba(59,130,246,0.22) inset;
}

.um-role-preview{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.um-perm-tag{
  display:inline-flex;
  align-items:center;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid rgba(var(--tone-line),0.16);
  color:var(--muted);
  background:rgba(var(--tone-0),0.22);
  font-size:11px;
}

.um-table-card{
  margin-top:12px;
  padding:14px;
  border-radius:18px;
  border:1px solid rgba(var(--tone-line),0.16);
  background:
    radial-gradient(880px 220px at 100% -6%, rgba(59,130,246,0.08), transparent 64%),
    linear-gradient(180deg, rgba(var(--tone-1),0.76), rgba(var(--tone-0),0.72));
  box-shadow:var(--glow);
  animation: um-fade-up var(--motion-expand) var(--ease-emphasis) both;
  animation-delay:.05s;
}

.um-table-toolbar{
  display:grid;
  grid-template-columns:minmax(300px, 1.65fr) repeat(2, minmax(160px, 0.88fr));
  gap:8px;
  margin-bottom:10px;
}

.um-search{
  position:relative;
}

.um-search::before{
  content:"⌕";
  position:absolute;
  left:10px;
  top:50%;
  transform:translateY(-50%);
  color:var(--muted);
  font-size:12px;
  pointer-events:none;
}

.um-search .input{
  padding-left:30px;
}

.um-table-wrap{
  border:1px solid rgba(var(--tone-line),0.14);
  border-radius:14px;
  background:rgba(var(--tone-0),0.18);
}

.um-table{
  min-width:1080px;
}

.um-table thead th{
  background:rgba(var(--tone-0),0.86);
  color:rgba(var(--tone-text-mid),0.88);
  font-size:12px;
  font-weight:760;
  letter-spacing:0.12px;
}

.um-table td{
  vertical-align:middle;
}

.um-table-user{
  display:flex;
  flex-direction:column;
  gap:2px;
}

.um-table-user-meta{
  color:var(--muted);
  font-size:11px;
}

.um-node-scope{
  font-family:ui-monospace,Menlo,Monaco,Consolas,monospace;
}

.um-tunnel-badges{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.um-tunnel-tag{
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  border:1px solid rgba(var(--tone-line),0.14);
  padding:2px 8px;
  font-size:11px;
  color:var(--muted);
  background:rgba(var(--tone-2),0.26);
}

.um-tunnel-tag.ok{
  color:var(--ok);
  border-color:rgba(34,197,94,0.34);
  background:rgba(34,197,94,0.12);
}

.um-tunnel-tag.bad{
  color:var(--bad);
  border-color:rgba(239,68,68,0.34);
  background:rgba(239,68,68,0.12);
}

.um-row-actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}

.um-msg{
  min-height:18px;
  color:var(--muted);
}

.um-msg.bad{
  color:var(--bad);
}

.um-empty{
  text-align:center;
  color:var(--muted);
  padding:20px 8px;
}

.um-quick-note{
  line-height:1.6;
}

@keyframes um-fade-up{
  from{ opacity:0; transform:translateY(5px); }
  to{ opacity:1; transform:translateY(0); }
}

@media (max-width: 1180px){
  .um-stat-chip strong{
    font-size:17px;
  }
}

@media (max-width: 980px){
  .um-hero-grid{
    grid-template-columns:1fr;
  }
  .um-hero-actions{
    justify-content:flex-start;
  }
  .um-table-toolbar{
    grid-template-columns:1fr;
  }
  .um-mode-grid{
    grid-template-columns:1fr;
  }
}

@media (max-width: 760px){
  #umFormModal{
    padding:10px;
  }
  .um-form-modal{
    max-height:min(96vh, calc(100vh - 10px));
    max-height:min(96vh, calc(100dvh - 10px));
    padding:12px;
  }
  .um-form-modal .form{
    max-height:calc(100vh - 140px);
    max-height:calc(100dvh - 140px);
  }
  .um-stat-chip{
    padding:8px 12px;
  }
  .um-stat-chip strong{
    font-size:16px;
  }
  .um-table{
    min-width:0;
  }
  .um-table thead{
    display:none;
  }
  .um-table tbody{
    display:block;
    padding:8px;
  }
  .um-table tbody tr{
    display:block;
    padding:10px;
    border-radius:12px;
    border:1px solid rgba(var(--tone-line),0.12);
    background:rgba(var(--tone-1),0.38);
  }
  .um-table tbody tr + tr{
    margin-top:8px;
  }
  .um-table tbody td{
    display:grid;
    grid-template-columns:90px minmax(0, 1fr);
    gap:10px;
    align-items:start;
    padding:6px 0;
    border-bottom:1px dashed rgba(var(--tone-line),0.12);
    font-size:12px;
  }
  .um-table tbody td:last-child{
    border-bottom:none;
    padding-bottom:0;
  }
  .um-table tbody td::before{
    content:attr(data-label);
    color:var(--muted);
    font-size:11px;
    line-height:1.4;
    padding-top:1px;
  }
  .um-table tbody td[colspan]{
    display:block;
    text-align:center;
    border-bottom:none;
    padding:8px 2px;
  }
  .um-table tbody td[colspan]::before{
    content:none;
  }
  .um-table-user,
  .um-tunnel-badges,
  .um-row-actions{
    justify-content:flex-start;
  }
}

@media (max-width: 540px){
  .um-hero-actions .btn{
    min-width:0;
  }
}


/* ---- extracted from panel/templates/remote_storage.html ---- */

.rs-list-card{
  margin-top:12px;
}
.rs-toolbar{
  margin-top:10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.rs-sites{
  margin-top:10px;
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(520px, 1fr));
  gap:10px;
}
.rs-item{
  position:relative;
  border:1px solid rgba(148,163,184,0.16);
  border-radius:16px;
  background:rgba(var(--tone-3),0.22);
  padding:10px 10px 10px 14px;
  display:flex;
  flex-direction:column;
  gap:9px;
  min-width:0;
  overflow:hidden;
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard);
}
.rs-item::before{
  content:"";
  position:absolute;
  left:0;
  top:8px;
  bottom:8px;
  width:3px;
  border-radius:999px;
  background:rgba(148,163,184,0.28);
}
.rs-item[data-rs-status="ok"]::before{
  background:linear-gradient(180deg, rgba(34,197,94,0.95), rgba(34,197,94,0.22));
}
.rs-item[data-rs-status="warn"]::before{
  background:linear-gradient(180deg, rgba(245,158,11,0.95), rgba(245,158,11,0.24));
}
.rs-item[data-rs-status="bad"]::before{
  background:linear-gradient(180deg, rgba(239,68,68,0.95), rgba(239,68,68,0.24));
}
.rs-item:hover{
  transform:translateY(var(--hover-lift));
  border-color:rgba(34,211,238,0.30);
  background:rgba(59,130,246,0.05);
}
.rs-item:active{transform:translateY(var(--press-lift));}
.rs-item-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.rs-item-main{
  min-width:0;
  flex:1 1 auto;
}
.rs-title-line{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.rs-name{
  font-weight:950;
  letter-spacing:0.2px;
}
.rs-endpoint{
  margin-top:4px;
  color:rgba(var(--tone-text-mid),0.80);
  font-size:12px;
  overflow-wrap:anywhere;
}
.rs-item-badges{
  display:flex;
  align-items:flex-start;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.rs-body{
  display:block;
}
.rs-main{
  min-width:0;
}
.rs-meta-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:8px;
}
.rs-meta-row{
  border:1px solid rgba(var(--tone-line),0.12);
  border-radius:11px;
  background:rgba(var(--tone-0),0.15);
  padding:7px 9px;
  min-width:0;
}
.rs-meta-k{
  font-size:11px;
  color:var(--muted);
}
.rs-meta-v{
  margin-top:3px;
  font-size:12px;
  color:rgba(var(--tone-text-mid),0.94);
  overflow-wrap:anywhere;
}
.rs-note{
  margin-top:2px;
}
.rs-side{
  margin-top:9px;
  border-top:1px dashed rgba(var(--tone-line),0.16);
  padding-top:9px;
  display:grid;
  grid-template-columns:minmax(220px, 1fr) auto;
  gap:8px 10px;
  align-items:start;
  min-width:0;
}
.rs-side .input{
  width:100%;
  min-width:0;
}
.rs-action-row{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
  min-width:0;
}
.rs-action-row form{
  margin:0;
}
.rs-readonly-form{
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  gap:8px;
  align-items:center;
}
.rs-cmd-box{
  margin-top:8px;
  border:1px solid rgba(var(--tone-line),0.14);
  border-radius:12px;
  background:rgba(var(--tone-1),0.32);
}
.rs-cmd-box > summary{
  list-style:none;
  cursor:pointer;
  padding:8px 10px;
  color:rgba(var(--tone-text-mid),0.92);
  font-size:12px;
  font-weight:700;
}
.rs-cmd-box[open] > summary{
  border-bottom:1px solid rgba(var(--tone-line),0.12);
}
.rs-cmd-box > summary::-webkit-details-marker{
  display:none;
}
.rs-cmd-wrap{
  padding:10px;
}
.rs-cmd-box textarea{
  min-height:58px;
  max-height:120px;
}
.rs-filter-empty{
  display:none;
  margin-top:8px;
  border:1px dashed rgba(var(--tone-line),0.18);
  border-radius:12px;
  padding:10px;
  color:var(--muted);
  font-size:12px;
}
.rs-filter-empty.show{
  display:block;
}
.rs-field-hidden{
  display:none !important;
}
.rs-form-modal{
  padding:14px;
}
.rs-form-modal-inner{
  width:min(1280px, 100%);
}
.rs-form-modal .modal-body{
  padding:10px 14px 14px;
}
.rs-form-modal-foot{
  justify-content:flex-end;
  gap:8px;
}
@media (max-width: 980px){
  .rs-sites{
    grid-template-columns:1fr;
  }
  .rs-meta-grid{
    grid-template-columns:repeat(2, minmax(0,1fr));
  }
  .rs-side{
    grid-template-columns:1fr;
    gap:8px;
  }
  .rs-action-row{
    justify-content:flex-start;
  }
}
@media (max-width: 760px){
  .rs-toolbar{
    flex-direction:column;
    align-items:stretch;
  }
  .rs-toolbar .dash-filters{
    width:100%;
    flex-wrap:nowrap;
    overflow-x:auto;
    padding-bottom:2px;
    scrollbar-width:none;
  }
  .rs-toolbar .dash-filters::-webkit-scrollbar{
    display:none;
  }
  .rs-toolbar .chip{
    flex:0 0 auto;
  }
  .rs-toolbar .dash-search{
    width:100%;
    max-width:none;
  }
  .rs-meta-grid{
    grid-template-columns:1fr;
  }
  .rs-action-row{
    justify-content:flex-start;
  }
  .rs-action-row form,
  .rs-action-row .btn{
    flex:1 1 auto;
  }
  .rs-readonly-form{
    grid-template-columns:1fr;
  }
}

/* Diversion Center V2 */
.dcv2-head{
  border-color:rgba(56,189,248,0.22);
}
.dcv2-head .meta-item{
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,0.22);
  background:rgba(var(--tone-0),0.18);
}
.dcv2-head .meta-item.ok{
  color:var(--ok);
  border-color:rgba(37,208,127,0.42);
  background:rgba(37,208,127,0.11);
}
.dcv2-head .meta-item.warn{
  color:var(--warn);
  border-color:rgba(255,177,26,0.40);
  background:rgba(255,177,26,0.12);
}
.dcv2-head .meta-item.bad{
  color:var(--bad);
  border-color:rgba(255,91,110,0.42);
  background:rgba(255,91,110,0.11);
}

.dcv2-mode-tabs{
  margin-top:12px;
}
.dcv2-mode-tabs .chip{
  text-decoration:none;
}

.dcv2-overview-card{
  border-color:rgba(56,189,248,0.20);
  background:
    radial-gradient(140% 180% at 0% 0%, rgba(56,189,248,0.08), transparent 56%),
    linear-gradient(180deg, rgba(var(--tone-1),0.30), rgba(var(--tone-1),0.20));
}
.dcv2-overview-main{
  display:grid;
  gap:12px;
}
.dcv2-overview-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}

.dcv2-section-copy{
  max-width:72ch;
  line-height:1.5;
  color:var(--text-muted);
}
.dcv2-summary-grid{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.dcv2-summary-grid > .pill{
  display:inline-flex;
  align-items:center;
  min-height:28px;
}
.dcv2-subtoolbar{
  padding:8px 10px;
  border-radius:12px;
  border-color:rgba(148,163,184,0.14);
  background:rgba(var(--tone-0),0.10);
  box-shadow:none;
}
.dcv2-subtoolbar .dash-filters{
  width:100%;
}
.dcv2-touch-grid{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.dcv2-touch-grid > .btn,
.dcv2-touch-grid > .dash-filters{
  min-height:40px;
}

.dcv2-card .btn.primary{
  background:linear-gradient(135deg, rgba(14,165,233,0.98), rgba(37,99,235,0.96));
  border-color:rgba(56,189,248,0.42);
  box-shadow:0 12px 28px rgba(14,165,233,0.22);
}
.dcv2-card .btn.primary:hover{
  box-shadow:0 14px 32px rgba(37,99,235,0.28);
}
.dcv2-card .btn.secondary{
  background:rgba(var(--tone-1),0.72);
  border-color:rgba(148,163,184,0.28);
  color:var(--text);
  box-shadow:none;
}
.dcv2-card .btn.secondary:hover{
  background:rgba(var(--tone-1),0.86);
  border-color:rgba(96,165,250,0.28);
}
.dcv2-card .btn.ghost{
  background:rgba(var(--tone-0),0.10);
  border-color:rgba(148,163,184,0.20);
  color:var(--text-muted);
}
.dcv2-card .btn.ghost:hover{
  background:rgba(59,130,246,0.08);
  border-color:rgba(59,130,246,0.24);
  color:var(--text);
  box-shadow:none;
}
.dcv2-table thead th{
  color:var(--text-strong);
  background:rgba(var(--tone-0),0.26);
  border-bottom:1px solid rgba(96,165,250,0.18);
  box-shadow:inset 0 -1px 0 rgba(96,165,250,0.14);
}
.dcv2-table tbody tr:nth-child(2n) td{
  background:rgba(var(--tone-0),0.05);
}
.dcv2-table tbody tr:hover td{
  background:rgba(59,130,246,0.08);
}
:root[data-theme="light"] .dcv2-card{
  background:linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,248,255,0.92));
  border-color:rgba(23,60,105,0.14);
  box-shadow:0 10px 24px rgba(18,38,66,0.08);
}
:root[data-theme="light"] .dcv2-card .btn.ghost{
  background:rgba(23,60,105,0.05);
  border-color:rgba(23,60,105,0.16);
  color:rgba(25,45,74,0.92);
}
:root[data-theme="light"] .dcv2-section-copy{
  color:rgba(32,52,78,0.84);
}
:root[data-theme="light"] .dcv2-table thead th{
  background:rgba(232,240,252,0.96);
  color:rgba(16,33,57,0.96);
  border-bottom-color:rgba(23,60,105,0.14);
}
:root[data-theme="light"] .dcv2-table tbody tr:nth-child(2n) td{
  background:rgba(239,246,255,0.64);
}
:root[data-theme="light"] .dcv2-table tbody tr:hover td{
  background:rgba(22,114,239,0.08);
}
:root[data-theme="light"] .dcv2-subtoolbar{
  background:rgba(239,246,255,0.88);
  border-color:rgba(23,60,105,0.12);
}

.dcv2-situation-grid{
  display:grid;
  grid-template-columns:minmax(280px,1.5fr) repeat(4,minmax(160px,1fr));
  gap:10px;
}
.dcv2-situation-item{
  border:1px solid rgba(148,163,184,0.16);
  background:rgba(var(--tone-1),0.24);
  border-radius:12px;
  padding:10px;
  min-width:0;
}
.dcv2-situation-item .mono{
  margin-top:4px;
}
.dcv2-situation-item .muted{
  margin-top:4px;
}
.dcv2-situation-node{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.dcv2-layout{
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:12px;
  margin-top:12px;
}
.dcv2-editor-shell{
  display:grid;
  grid-template-columns:minmax(0,1.55fr) minmax(340px,0.95fr);
  gap:12px;
  margin-top:12px;
  align-items:start;
}
.dcv2-editor-main,
.dcv2-editor-side,
.dcv2-editor-col{
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:12px;
}
.dcv2-editor-shell.is-disabled,
.dcv2-editor-col.is-disabled{
  opacity:.58;
  pointer-events:none;
}

.dcv2-observe-col{
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:12px;
  align-content:start;
}
.dcv2-observe-grid{
  display:grid;
  grid-template-columns:repeat(12,minmax(0,1fr));
  gap:12px;
  margin-top:12px;
  align-items:start;
}
.dcv2-card-span-5{
  grid-column:span 5;
}
.dcv2-card-span-7{
  grid-column:span 7;
}
.dcv2-card-span-12{
  grid-column:1 / -1;
}
.dcv2-observe-card{
  min-height:0;
}
.dcv2-summary-badges{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  justify-content:flex-end;
}
.dcv2-hit-summary{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.dcv2-card .card-title{
  font-size:15px;
  font-weight:800;
}

.dcv2-advanced{
  border:1px solid rgba(148,163,184,0.18);
  border-radius:12px;
  background:rgba(var(--tone-0),0.16);
  padding:8px 10px;
}
.dcv2-advanced > summary{
  cursor:pointer;
  user-select:none;
  font-weight:700;
  color:var(--text);
}
.dcv2-advanced-body{
  margin-top:8px;
  padding-top:4px;
}

.dcv2-outbound-list,
.dcv2-rule-list{
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:10px;
}

.dcv2-ob-card{
  border:1px solid rgba(148,163,184,0.20);
  background:
    radial-gradient(130% 180% at 0% 0%, rgba(56,189,248,0.09), transparent 60%),
    linear-gradient(180deg, rgba(var(--tone-1),0.34), rgba(var(--tone-1),0.24));
  border-radius:14px;
  padding:10px;
}
.dcv2-ob-top{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.dcv2-ob-top-left{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
  min-width:0;
}
.dcv2-ob-actions{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}

.dcv2-rule-toolbar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}
.dcv2-rule-toolbar .input{
  min-width:260px;
  flex:1 1 260px;
}
.dcv2-rule-toolbar .select{
  min-width:180px;
}

.dcv2-rule-row{
  border:1px solid rgba(148,163,184,0.20);
  border-radius:14px;
  padding:10px;
  background:
    radial-gradient(130% 180% at 0% 0%, rgba(59,130,246,0.09), transparent 58%),
    linear-gradient(180deg, rgba(var(--tone-1),0.34), rgba(var(--tone-1),0.24));
  cursor:grab;
}
.dcv2-rule-row:active{
  cursor:grabbing;
}
.dcv2-rule-row.is-filter-hidden{
  display:none;
}
.dcv2-rule-row:focus{
  outline:none;
  border-color:rgba(56,189,248,0.45);
  box-shadow:0 0 0 2px rgba(56,189,248,0.18);
}
.dcv2-rule-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.dcv2-rule-head-left,
.dcv2-rule-head-right{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}
.dcv2-rule-handle{
  display:inline-flex;
  width:24px;
  height:24px;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  border:1px solid rgba(148,163,184,0.24);
  background:rgba(var(--tone-0),0.20);
  color:var(--muted);
}
.dcv2-rule-sel{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:12px;
}

.dcv2-health-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:8px;
}
.dcv2-health-item{
  border:1px solid rgba(148,163,184,0.18);
  border-radius:12px;
  padding:8px 10px;
  background:rgba(var(--tone-0),0.16);
}
.dcv2-health-main{
  display:flex;
  gap:6px;
  align-items:center;
  flex-wrap:wrap;
}
.dcv2-health-metrics{
  margin-top:8px;
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:8px;
}
.dcv2-health-metric{
  border:1px solid rgba(148,163,184,0.14);
  border-radius:10px;
  padding:6px 8px;
  background:rgba(var(--tone-3),0.18);
}
.dcv2-health-metric > span{
  display:block;
  font-size:11px;
  color:var(--muted);
}
.dcv2-health-metric > strong{
  display:block;
  margin-top:4px;
  font-size:12px;
  color:rgba(var(--tone-text-hi),0.96);
}

.dcv2-log-toolbar{
  display:flex;
  align-items:center;
  gap:8px;
}
.dcv2-log-toolbar .input{
  min-width:220px;
  flex:1 1 220px;
}
.dcv2-log-meta{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.dcv2-log-filter-bar{
  margin-bottom:0;
}
.dcv2-log-console-layout{
  display:grid;
  grid-template-columns:minmax(0,1.35fr) minmax(320px,0.85fr);
  gap:12px;
}
.dcv2-log-stream-card{
  min-width:0;
  border:1px solid rgba(148,163,184,0.16);
  border-radius:14px;
  background:rgba(var(--tone-3),0.18);
  overflow:hidden;
}
.dcv2-log-stream-wrap{
  min-height:340px;
  max-height:520px;
  overflow:auto;
}
.dcv2-log-detail-card{
  min-width:0;
  border:1px solid rgba(148,163,184,0.16);
  border-radius:14px;
  background:rgba(var(--tone-3),0.18);
  padding:10px;
}
.dcv2-log-hidden{
  display:none;
}
.dcv2-observe-card .log-row{
  grid-template-columns:56px 162px 72px minmax(0,1fr);
  padding:8px 10px;
}
.dcv2-observe-card .log-row-msg{
  font-size:12px;
}
.dcv2-observe-card .log-detail-text,
.dcv2-observe-card .log-detail-context{
  margin:0;
  max-height:180px;
  overflow:auto;
}

.dcv2-publish{
  margin-top:0;
  position:sticky;
  top:12px;
  bottom:auto;
  z-index:12;
  border-color:rgba(56,189,248,0.24);
  backdrop-filter:blur(14px);
}
.dcv2-publish-main{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.dcv2-publish-status{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}
.dcv2-publish-actions{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.dcv2-risk-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}
.dcv2-risk-block{
  border:1px solid rgba(148,163,184,0.18);
  border-radius:12px;
  padding:8px 10px;
  background:rgba(var(--tone-0),0.16);
}
.dcv2-risk-title{
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}
.dcv2-risk-list{
  margin:0;
  padding:0 0 0 16px;
  display:grid;
  gap:4px;
}

.dcv2-modal-inner{
  width:min(760px,100%);
}
.dcv2-modal-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.dcv2-conflict-diff{
  border:1px solid rgba(148,163,184,0.18);
  border-radius:12px;
  background:rgba(var(--tone-0),0.16);
  padding:8px 10px;
}
.dcv2-conflict-diff > summary{
  cursor:pointer;
  user-select:none;
  font-weight:700;
}

.dcv2-table td,
.dcv2-table th{
  white-space:nowrap;
}
.dcv2-table td:first-child,
.dcv2-table th:first-child{
  white-space:normal;
}

.text-warn{
  color:var(--warn);
}

@media (max-width: 1340px){
  .dcv2-editor-shell{
    grid-template-columns:minmax(0,1fr);
  }
  .dcv2-publish{
    position:static;
  }
  .dcv2-observe-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .dcv2-card-span-5,
  .dcv2-card-span-7,
  .dcv2-card-span-12{
    grid-column:auto;
  }
  .dcv2-log-console-layout{
    grid-template-columns:minmax(0,1fr);
  }
}

@media (max-width: 980px){
  .dcv2-situation-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .dcv2-situation-node{
    grid-column:1 / -1;
  }
  .dcv2-observe-grid{
    grid-template-columns:minmax(0,1fr);
  }
}

@media (max-width: 860px){
  .dcv2-situation-grid{
    grid-template-columns:minmax(0,1fr);
  }
  .dcv2-rule-toolbar .input{
    min-width:0;
    flex:1 1 100%;
  }
  .dcv2-overview-actions{
    justify-content:flex-start;
  }
  .dcv2-publish-main{
    flex-direction:column;
    align-items:stretch;
  }
  .dcv2-publish-actions{
    justify-content:flex-start;
  }
  .dcv2-risk-grid{
    grid-template-columns:minmax(0,1fr);
  }
  .dcv2-health-metrics{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media (max-width: 640px){
  .dcv2-card.page-section-shell,
  .dcv2-overview-card.page-section-shell{
    padding:12px;
    gap:10px;
  }
  .dcv2-section-copy{
    max-width:none;
  }
  .dcv2-overview-actions,
  .dcv2-log-toolbar,
  .dcv2-rule-toolbar{
    width:100%;
    align-items:stretch;
  }
  .dcv2-overview-actions .pill,
  .dcv2-overview-actions .btn,
  .dcv2-log-toolbar > *,
  .dcv2-rule-toolbar > *,
  .dcv2-touch-grid > .btn,
  .dcv2-touch-grid > .dash-filters{
    width:100%;
  }
  .dcv2-summary-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(136px,1fr));
    gap:6px;
    width:100%;
  }
  .dcv2-summary-grid > .pill{
    width:100%;
    justify-content:space-between;
  }
  .dcv2-subtoolbar{
    padding:8px;
  }
  .dcv2-touch-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(140px,1fr));
    width:100%;
  }
  .dcv2-touch-grid .dash-filters{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
  }
  .dcv2-log-stream-wrap{
    min-height:280px;
    max-height:360px;
  }
}

@media (max-width: 560px){
  .dcv2-health-metrics{
    grid-template-columns:minmax(0,1fr);
  }
  .dcv2-observe-card .log-row{
    grid-template-columns:46px 1fr;
    grid-template-areas:
      "idx level"
      "time time"
      "msg msg";
    gap:4px 8px;
  }
  .dcv2-observe-card .log-row-idx{ grid-area: idx; }
  .dcv2-observe-card .log-row-level{ grid-area: level; justify-self:end; }
  .dcv2-observe-card .log-row-time{ grid-area: time; }
  .dcv2-observe-card .log-row-msg{ grid-area: msg; }
}

.page-head .meta{
  gap:10px;
}
.page-head .meta-item{
  border:1px solid rgba(148,163,184,0.14);
  background:rgba(var(--tone-0),0.20);
  border-radius:999px;
  padding:6px 10px;
}
.card-header,
.card-title{
  color:var(--text-strong);
}
.card-sub,
.help,
.muted{
  color:var(--text-muted);
}
.dashboard-toolbar .dash-search,
.toolbar-panel .dash-search{
  min-height:44px;
  border-radius:var(--radius-sm);
  border:1px solid var(--border-subtle);
  background:var(--surface);
}
.chip{
  border-color:var(--border-subtle);
  background:rgba(var(--tone-0),0.18);
}
.chip.active,
.chip[aria-selected="true"]{
  border-color:rgba(96,165,250,0.42);
  background:rgba(59,130,246,0.16);
  color:var(--text-strong);
}
.table-wrap{
  border:1px solid var(--border-subtle);
  border-radius:var(--radius-md);
  background:rgba(var(--tone-0),0.08);
}
.table thead th:first-child{
  border-top-left-radius:var(--radius-sm);
}
.table thead th:last-child{
  border-top-right-radius:var(--radius-sm);
}
.btn:focus-visible,
.input:focus,
.select:focus,
textarea:focus,
.textarea:focus,
.chip:focus-visible,
.nav-link:focus-visible,
.skip-link:focus{
  outline:2px solid rgba(96,165,250,0.62);
  outline-offset:2px;
}
@media (max-width: 760px){
  .page-content{
    gap:var(--space-4);
  }
  .page-section-shell{
    padding:12px;
  }
  .page-section-head{
    flex-direction:column;
    align-items:stretch;
  }
  .page-section-meta{
    justify-content:flex-start;
  }
  .dense-detail-shell{
    gap:10px;
  }
  .action-group,
  .status-cluster{
    justify-content:flex-start;
  }
  .page-head,
  .dashboard-toolbar,
  .toolbar-panel{
    padding:12px;
  }
}
