/* ============================================================================
   PNetLab self-created dashboard — design system + shell
   Hand-written, no build step, no !important. Edit freely.
   Design language mirrors the prior pnetlab-enhance-v2 look (teal headers,
   white surfaces, Apple system font, steel-blue accent) but standalone, so
   nothing here has to fight Bootstrap/store specificity.
   ============================================================================ */

:root {
	--pnq-primary:        #25332c;   /* teal-green header/sidebar */
	--pnq-primary-light:  #3c5146;
	--pnq-primary-hover:  #2e3e35;
	--pnq-on-primary:     #e8f0ec;   /* off-white text on teal */
	--pnq-on-primary-dim: #a9bcb1;

	--pnq-bg:             #f4f6f5;   /* page background */
	--pnq-surface:        #ffffff;   /* cards / panels */
	--pnq-surface-2:      #f0f2f1;   /* subtle rows / inputs */
	--pnq-text:           #1d1d1f;
	--pnq-text-muted:     #5a5f5c;   /* AA: 6.5:1 on #fff, 5.8:1 on surface-2 */

	--pnq-accent:         #3c708a;   /* steel-blue */
	--pnq-accent-hover:   #335f74;
	--pnq-accent-soft:    rgba(60, 112, 138, 0.12);

	--pnq-danger:         #b3261e;
	--pnq-danger-soft:    rgba(179, 38, 30, 0.10);
	--pnq-ok:             #2e7d44;
	--pnq-warn:           #c77700;

	--pnq-border:         rgba(0, 0, 0, 0.10);
	--pnq-border-strong:  rgba(0, 0, 0, 0.18);
	--pnq-shadow:         0 1px 3px rgba(0,0,0,0.08), 0 6px 20px rgba(0,0,0,0.06);
	--pnq-radius:         10px;
	--pnq-radius-sm:      7px;

	--pnq-sidebar-w:      230px;
	--pnq-topbar-h:       56px;
	--pnq-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
	--pnq-mono: "SFMono-Regular", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;

	/* --- named tokens for values that used to be raw literals (so the dark
	   override lives in ONE place; light values below are unchanged visually) --- */
	--pnq-on-accent:      #ffffff;               /* ink on accent/primary fills */
	--pnq-folder:         #dfba49;               /* folder glyphs */
	--pnq-knob:           #ffffff;               /* toggle knob */
	--pnq-preview-from:   #f7f9f8;               /* topology / card preview gradient */
	--pnq-preview-to:     #eef1f0;
	--pnq-preview-live-from: #f1f8f3;            /* running-lab preview wash */
	--pnq-preview-live-to:   #e6f1ea;
	--pnq-topo-line:      #9fb0aa;               /* mini-topology preview strokes */
	--pnq-topo-net:       #c2d0ca;
	--pnq-overlay-chip:   rgba(255,255,255,0.85);/* card-check pill on a card */
	--pnq-card-btn:       rgba(255,255,255,0.92);/* floating card action button */
	--pnq-card-btn-hover: #ffffff;
	--pnq-perm-hover:     #e7ecea;               /* permission item hover */
	--pnq-hover-veil:     rgba(0,0,0,0.04);      /* transient drag/hover darken */
	--pnq-overlay-veil:   rgba(244,246,245,0.45);/* full-screen loading scrim */

	--pnq-alert-warn-bg:   #fbf3e3; --pnq-alert-warn-fg:   #6b4600; --pnq-alert-warn-bd:   rgba(199,119,0,0.35);
	--pnq-alert-danger-bg: #fbeae9; --pnq-alert-danger-fg: #7a1a15; --pnq-alert-danger-bd: rgba(179,38,30,0.32);
	--pnq-alert-info-bg:   var(--pnq-accent-soft); --pnq-alert-info-fg: #2a4a5a; --pnq-alert-info-bd: rgba(60,112,138,0.30);

	color-scheme: light;
}

/* ============================================================================
   Dark theme — overrides ONLY token values (re-derived, not inverted). The teal
   chrome stays recognizable; the content ladder deepens (bg darkest → surface →
   surface-2 → chrome lightest). Every component already reads tokens, so there
   are no per-component dark rules. AA verified: text ≥11:1, muted ≥5.5:1,
   accent/ok/warn/danger as ink all ≥4.5:1 on the dark surfaces.
   ============================================================================ */
:root[data-theme="dark"] {
	--pnq-bg:             #161c19;
	--pnq-surface:        #1e2622;
	--pnq-surface-2:      #28312c;
	--pnq-text:           #e6ede9;   /* 13:1 on surface */
	--pnq-text-muted:     #9aaaa2;   /* 5.5:1 on surface-2 (worst case) */

	--pnq-accent:         #6ba3bf;   /* lighter steel-blue: 4.9:1 as ink on surface-2 */
	--pnq-accent-hover:   #78adc7;
	--pnq-accent-soft:    rgba(107,163,191,0.16);
	--pnq-on-accent:      #0f1a20;   /* dark ink on the lightened accent fill (6.4:1) */

	--pnq-danger:         #ef6d64;   /* 4.5–5.2:1 on dark surfaces */
	--pnq-danger-soft:    rgba(239,109,100,0.14);
	--pnq-ok:             #58b06f;   /* 5.0–5.8:1 */
	--pnq-warn:           #e0a24a;   /* 6.0–7.0:1 */

	--pnq-border:         rgba(255,255,255,0.12);
	--pnq-border-strong:  rgba(255,255,255,0.22);
	--pnq-shadow:         0 1px 3px rgba(0,0,0,0.45), 0 6px 20px rgba(0,0,0,0.35);

	--pnq-folder:         #e3c063;
	--pnq-preview-from:   #232b27; --pnq-preview-to:   #1b221e;
	--pnq-preview-live-from: #1d2c22; --pnq-preview-live-to: #17221b;
	--pnq-overlay-chip:   rgba(40,49,44,0.9);
	--pnq-card-btn:       rgba(40,49,44,0.92); --pnq-card-btn-hover: #313c36;
	--pnq-perm-hover:     #313c36;
	--pnq-hover-veil:     rgba(255,255,255,0.05);
	--pnq-overlay-veil:   rgba(10,14,12,0.5);

	--pnq-alert-warn-bg:   rgba(199,119,0,0.15); --pnq-alert-warn-fg:   #e8c07a; --pnq-alert-warn-bd:   rgba(199,119,0,0.42);
	--pnq-alert-danger-bg: rgba(179,38,30,0.18); --pnq-alert-danger-fg: #f2a19b; --pnq-alert-danger-bd: rgba(239,109,100,0.42);
	--pnq-alert-info-bg:   var(--pnq-accent-soft); --pnq-alert-info-fg: #a9cfe0; --pnq-alert-info-bd: rgba(107,163,191,0.38);

	color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
	font-family: var(--pnq-font);
	color: var(--pnq-text);
	background: var(--pnq-bg);
	font-size: 14px;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
a { color: var(--pnq-accent); text-decoration: none; }
a:hover { color: var(--pnq-accent-hover); }
h1, h2, h3 { margin: 0 0 .4em; font-weight: 600; }

/* ---- boot overlay ---------------------------------------------------------- */
.boot {
	position: fixed; inset: 0; z-index: 50;
	display: flex; align-items: center; justify-content: center;
	background: var(--pnq-bg);
}
.boot-spin {
	width: 34px; height: 34px; border-radius: 50%;
	border: 3px solid var(--pnq-accent-soft);
	border-top-color: var(--pnq-accent);
	animation: pnq-spin .8s linear infinite;
}
@keyframes pnq-spin { to { transform: rotate(360deg); } }

/* ---- app shell (grid) ------------------------------------------------------ */
.app {
	display: grid;
	grid-template-columns: var(--pnq-sidebar-w) 1fr;
	grid-template-rows: var(--pnq-topbar-h) 1fr;
	grid-template-areas: "topbar topbar" "sidebar content";
	height: 100vh;
}
.app.is-loading { visibility: hidden; }

/* ---- topbar ---------------------------------------------------------------- */
.topbar {
	grid-area: topbar;
	background: var(--pnq-primary);
	color: var(--pnq-on-primary);
	display: flex; align-items: center; justify-content: space-between;
	padding: 0 18px;
	box-shadow: 0 1px 0 rgba(0,0,0,0.15);
	z-index: 10;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; letter-spacing: .2px; }
.topbar-brand .fa { color: var(--pnq-accent); font-size: 20px; }
.topbar-logo { height: 28px; width: auto; display: block; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { color: var(--pnq-on-primary-dim); font-size: 13px; display: flex; align-items: center; gap: 7px; }
.topbar-user span { color: var(--pnq-on-primary); }
.topbar-logout {
	background: transparent; border: 1px solid transparent; color: var(--pnq-on-primary-dim);
	cursor: pointer; font-size: 16px; padding: 6px 9px; border-radius: var(--pnq-radius-sm);
	transition: background-color .15s ease, color .15s ease;
}
.topbar-logout:hover { background: var(--pnq-primary-hover); color: #fff; }

/* ---- sidebar --------------------------------------------------------------- */
.sidebar {
	grid-area: sidebar;
	background: var(--pnq-primary);
	display: flex; flex-direction: column;
	padding: 12px 10px;
	gap: 2px;
	overflow: auto;
}
.sidebar-spacer { flex: 1 1 auto; }
.nav-item {
	display: flex; align-items: center; gap: 12px;
	color: #ffffff;
	padding: 10px 12px; border-radius: var(--pnq-radius-sm);
	font-size: 14px; font-weight: 500;
	transition: background-color .15s ease, color .15s ease;
	cursor: pointer;
}
.nav-item .fa { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover { background: var(--pnq-primary-hover); color: #fff; }
.nav-item.active { background: var(--pnq-primary-light); color: #fff; box-shadow: inset 3px 0 0 var(--pnq-accent); }
.nav-item--ghost { color: var(--pnq-on-primary-dim); font-weight: 400; font-size: 13px; opacity: .85; }
.nav-item--ghost:hover { opacity: 1; }

/* ---- content area ---------------------------------------------------------- */
.content { grid-area: content; overflow: auto; padding: 22px 24px; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.view-title { font-size: 20px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.view-title .fa { color: var(--pnq-accent); }

/* ---- cards ----------------------------------------------------------------- */
.card {
	background: var(--pnq-surface);
	border: 1px solid var(--pnq-border);
	border-radius: var(--pnq-radius);
	box-shadow: var(--pnq-shadow);
	padding: 18px 20px;
	margin-bottom: 18px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ---- buttons --------------------------------------------------------------- */
.btn {
	display: inline-flex; align-items: center; gap: 7px;
	font: inherit; font-weight: 500; font-size: 13.5px;
	padding: 8px 14px; border-radius: var(--pnq-radius-sm);
	border: 1px solid var(--pnq-border-strong); background: var(--pnq-surface); color: var(--pnq-text);
	cursor: pointer; transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
	white-space: nowrap;
}
.btn:hover { background: var(--pnq-surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .fa { font-size: 13px; }
/* Primary action reads as "PNetLab blue" — the steel-blue accent is the product's
   action colour (AA: #fff on #3c708a = 5.4:1, on hover #335f74 = 6.9:1). */
.btn-primary { background: var(--pnq-accent); border-color: var(--pnq-accent); color: var(--pnq-on-accent); }
.btn-primary:hover { background: var(--pnq-accent-hover); border-color: var(--pnq-accent-hover); }
.btn-accent { background: var(--pnq-accent); border-color: var(--pnq-accent); color: var(--pnq-on-accent); }
.btn-accent:hover { background: var(--pnq-accent-hover); }
.btn-danger { background: var(--pnq-surface); border-color: var(--pnq-danger); color: var(--pnq-danger); }
.btn-danger:hover { background: var(--pnq-danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--pnq-text-muted); }
.btn-ghost:hover { background: var(--pnq-surface-2); color: var(--pnq-text); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-icon { padding: 7px 9px; }

/* ---- toolbar --------------------------------------------------------------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1 1 auto; }

/* ---- forms ----------------------------------------------------------------- */
.input, select.input, textarea.input {
	font: inherit; width: 100%;
	padding: 8px 11px; border-radius: var(--pnq-radius-sm);
	border: 1px solid var(--pnq-border-strong); background: var(--pnq-surface); color: var(--pnq-text);
	transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, select.input:focus, textarea.input:focus {
	outline: none; border-color: var(--pnq-accent); box-shadow: 0 0 0 3px var(--pnq-accent-soft);
}
.field { margin-bottom: 13px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--pnq-text-muted); margin-bottom: 5px; }

/* ---- tables ---------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--pnq-border); }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--pnq-text-muted); font-weight: 600; }
.table tbody tr { transition: background-color .12s ease; }
.table tbody tr:hover { background: var(--pnq-surface-2); }
.table .row-actions { text-align: right; white-space: nowrap; opacity: 0; transition: opacity .12s ease; }
.table tbody tr:hover .row-actions { opacity: 1; }

/* ---- misc utilities -------------------------------------------------------- */
.muted { color: var(--pnq-text-muted); }
.mono { font-family: var(--pnq-mono); font-size: 12.5px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--pnq-accent-soft); color: var(--pnq-accent); }
.badge-ok { background: rgba(46,125,68,0.12); color: var(--pnq-ok); }
.badge-warn { background: rgba(199,119,0,0.12); color: var(--pnq-warn); }
.badge-off { background: var(--pnq-surface-2); color: var(--pnq-text-muted); }
.empty { text-align: center; color: var(--pnq-text-muted); padding: 40px 20px; }
.empty .fa { font-size: 30px; opacity: .4; display: block; margin-bottom: 10px; }
.spin { display: inline-block; animation: pnq-spin .8s linear infinite; }

/* ---- toasts ---------------------------------------------------------------- */
.toast-host { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 10px; }
.toast {
	display: flex; align-items: center; gap: 9px;
	background: var(--pnq-surface); color: var(--pnq-text);
	border: 1px solid var(--pnq-border);
	border-radius: var(--pnq-radius-sm); box-shadow: var(--pnq-shadow);
	padding: 11px 15px; font-size: 13.5px; min-width: 240px; max-width: 380px;
	animation: pnq-toast-in .22s ease;
}
.toast .fa { font-size: 15px; color: var(--pnq-accent); }
.toast-ok { border-color: rgba(46,125,68,0.35); } .toast-ok .fa { color: var(--pnq-ok); }
.toast-error { border-color: rgba(179,38,30,0.35); } .toast-error .fa { color: var(--pnq-danger); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .25s ease, transform .25s ease; }
@keyframes pnq-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- alerts / callouts (system component; replaces inline one-offs) --------- */
/* Full-border tint + leading icon — no side-stripe. Text colours are AA-dark on
   their tint. Use: <div class="alert alert-warn"><i class="fa fa-…"></i>
   <div><div class="alert-title">…</div>…</div></div>. */
.alert {
	display: flex; align-items: flex-start; gap: 10px;
	padding: 12px 14px; margin-bottom: 18px;
	border: 1px solid var(--pnq-border); border-radius: var(--pnq-radius-sm);
	background: var(--pnq-surface-2); color: var(--pnq-text);
	font-size: 13.5px; line-height: 1.5;
}
.alert > .fa { flex: 0 0 auto; margin-top: 1px; font-size: 15px; }
.alert-title { font-weight: 600; margin-bottom: 2px; }
.alert-warn { background: var(--pnq-alert-warn-bg); border-color: var(--pnq-alert-warn-bd); color: var(--pnq-alert-warn-fg); }
.alert-warn > .fa { color: var(--pnq-warn); }
.alert-danger { background: var(--pnq-alert-danger-bg); border-color: var(--pnq-alert-danger-bd); color: var(--pnq-alert-danger-fg); }
.alert-danger > .fa { color: var(--pnq-danger); }
.alert-info { background: var(--pnq-alert-info-bg); border-color: var(--pnq-alert-info-bd); color: var(--pnq-alert-info-fg); }
.alert-info > .fa { color: var(--pnq-accent); }

/* ---- modal ----------------------------------------------------------------- */
.modal-backdrop {
	position: fixed; inset: 0; z-index: 70;
	background: rgba(10, 14, 12, 0.55);
	display: flex; align-items: center; justify-content: center;
	padding: 20px; animation: pnq-fade .15s ease;
}
.modal {
	background: var(--pnq-surface); border-radius: var(--pnq-radius);
	box-shadow: 0 12px 48px rgba(0,0,0,0.28);
	width: 100%; max-width: 440px; max-height: 90vh; overflow: auto;
	animation: pnq-modal-in .18s ease;
}
.modal-lg { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--pnq-border); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { background: none; border: none; font-size: 18px; color: var(--pnq-text-muted); cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--pnq-text); }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--pnq-border); }
@keyframes pnq-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pnq-modal-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }

/* ---- loading overlay ------------------------------------------------------- */
.load-overlay {
	position: fixed; inset: 0; z-index: 65;
	background: var(--pnq-overlay-veil);
	display: flex; align-items: center; justify-content: center;
}

/* ---- breadcrumb ------------------------------------------------------------ */
.breadcrumb2 { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 14px; }
.crumb { cursor: pointer; color: var(--pnq-accent); padding: 3px 6px; border-radius: 5px; display: inline-flex; align-items: center; gap: 6px; }
.crumb:hover { background: var(--pnq-accent-soft); }
.crumb.is-current { color: var(--pnq-text); cursor: default; font-weight: 600; }
.crumb.is-current:hover { background: transparent; }
.crumb-sep { color: var(--pnq-text-muted); opacity: .6; }

/* ---- file manager ---------------------------------------------------------- */
.fm-table { width: 100%; border-collapse: collapse; }
.fm-table th, .fm-table td { padding: 9px 12px; border-bottom: 1px solid var(--pnq-border); vertical-align: middle; }
.fm-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--pnq-text-muted); font-weight: 600; text-align: left; }
.fm-table tbody tr { transition: background-color .12s ease; }
.fm-table tbody tr:hover { background: var(--pnq-surface-2); }
.fm-check { width: 34px; text-align: center; }
.fm-name { cursor: pointer; display: inline-flex; align-items: center; gap: 9px; font-weight: 500; color: var(--pnq-text); word-break: break-all; }
.fm-name:hover { color: var(--pnq-accent); }
.fm-name .fa-folder { color: var(--pnq-folder); }
.fm-name .fa-folder-open-o { color: var(--pnq-folder); }
.fm-name .fa-file-o, .fm-name .fa-flask { color: var(--pnq-accent); }
.fm-name .fa-level-up { color: var(--pnq-text-muted); }
.fm-mtime { color: var(--pnq-text-muted); font-size: 12.5px; white-space: nowrap; text-align: right; }
.fm-actions { text-align: right; white-space: nowrap; opacity: 0; transition: opacity .12s ease; }
.fm-table tbody tr:hover .fm-actions { opacity: 1; }
.fm-actions .btn { margin-left: 4px; }

/* ---- bulk action bar ------------------------------------------------------- */
.bulkbar {
	display: flex; align-items: center; gap: 10px;
	background: var(--pnq-primary); color: var(--pnq-on-primary);
	border-radius: var(--pnq-radius); padding: 10px 14px; margin-bottom: 14px;
	box-shadow: var(--pnq-shadow); animation: pnq-toast-in .18s ease;
}
.bulkbar .count { font-weight: 600; }
.bulkbar .spacer { flex: 1 1 auto; }
.bulkbar .btn { background: var(--pnq-primary-light); border-color: transparent; color: #fff; }
.bulkbar .btn:hover { background: var(--pnq-primary-hover); }
.bulkbar .btn-danger { background: transparent; border-color: rgba(255,255,255,0.4); color: #fff; }

.input.invalid { border-color: var(--pnq-danger); box-shadow: 0 0 0 3px var(--pnq-danger-soft); }

/* ---- gauges (System page) -------------------------------------------------- */
.gauge { margin-bottom: 16px; }
.gauge:last-child { margin-bottom: 0; }
.gauge-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.gauge-head .label { font-weight: 600; }
.gauge-head .val { font-variant-numeric: tabular-nums; color: var(--pnq-text-muted); font-size: 13px; }
.gauge-bar { height: 10px; border-radius: 999px; background: var(--pnq-surface-2); overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 999px; background: var(--pnq-accent); transition: width .4s ease, background-color .3s ease; }
.gauge-fill.warn { background: var(--pnq-warn); }
.gauge-fill.danger { background: var(--pnq-danger); }

/* ---- stat tiles ------------------------------------------------------------ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: 12px; }
.stat { background: var(--pnq-surface-2); border-radius: var(--pnq-radius-sm); padding: 14px; text-align: center; }
.stat-num { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-num.live { color: var(--pnq-accent); }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--pnq-text-muted); margin-top: 4px; }

/* ---- key/value rows + switches --------------------------------------------- */
.kv { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--pnq-border); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--pnq-text-muted); }
.kv .v { font-weight: 600; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--pnq-border-strong); border-radius: 999px; transition: background-color .2s ease; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: var(--pnq-knob); border-radius: 50%; transition: transform .2s ease; }
.switch input:checked + .slider { background: var(--pnq-accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:disabled + .slider { opacity: .5; cursor: progress; }

/* ---- focus-visible (keyboard) — a clear ring on every control; never remove -- */
/* Inputs already ring via :focus (accent border + soft glow). These cover the
   controls that had no keyboard-focus affordance: buttons, toggles, nav, tabs,
   file-manager action buttons, breadcrumbs, the modal close glyph. */
.btn:focus-visible,
.view-toggle button:focus-visible,
.tabs .tab:focus-visible,
.crumb:focus-visible,
.modal-close:focus-visible,
.rl-card-actions .rl-act:focus-visible,
.switch input:focus-visible + .slider {
	outline: 2px solid var(--pnq-accent);
	outline-offset: 2px;
}
/* Click-<span>/<div> primary interactions (file-manager names, card names,
   card previews/bodies) are now keyboard-operable (App.clickable) — give them
   the same ring. */
.fm-name:focus-visible,
.card-meta .nm:focus-visible,
.card-preview:focus-visible,
.folder-card .card-body:focus-visible,
.rl-card-body:focus-visible {
	outline: 2px solid var(--pnq-accent);
	outline-offset: 2px;
	border-radius: 5px;
}
/* On the teal chrome the accent ring reads best inset so it isn't clipped. */
.nav-item:focus-visible,
.sidebar-version:focus-visible,
.topbar-logout:focus-visible {
	outline: 2px solid var(--pnq-accent);
	outline-offset: -2px;
}

/* ---- card / grid view (Labs) ----------------------------------------------- */
.view-toggle { display: inline-flex; border: 1px solid var(--pnq-border-strong); border-radius: var(--pnq-radius-sm); overflow: hidden; }
.view-toggle button { border: none; background: var(--pnq-surface); padding: 7px 11px; cursor: pointer; color: var(--pnq-text-muted); font-size: 14px; }
.view-toggle button:hover { background: var(--pnq-surface-2); }
.view-toggle button.active { background: var(--pnq-primary); color: #fff; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 16px; }
.lab-card, .folder-card { position: relative; background: var(--pnq-surface); border: 1px solid var(--pnq-border); border-radius: var(--pnq-radius); box-shadow: var(--pnq-shadow); overflow: hidden; transition: box-shadow .15s ease, transform .15s ease; }
.lab-card:hover, .folder-card:hover { box-shadow: 0 6px 22px rgba(0,0,0,0.13); transform: translateY(-1px); }
.card-preview { height: 142px; background: linear-gradient(180deg, var(--pnq-preview-from), var(--pnq-preview-to)); display: flex; align-items: center; justify-content: center; cursor: pointer; border-bottom: 1px solid var(--pnq-border); overflow: hidden; }
.card-preview svg { width: 100%; height: 100%; display: block; }
/* CSS wins over the SVG presentation attributes labs.js sets, so the mini-
   topology preview themes with the tokens (attributes are the light fallback). */
.card-preview svg line { stroke: var(--pnq-topo-line); }
.card-preview svg circle { fill: var(--pnq-topo-net); }
.card-preview .ph { font-size: 30px; color: var(--pnq-text-muted); opacity: .5; }
.card-meta { padding: 11px 12px 4px; display: flex; align-items: center; gap: 8px; }
.card-meta .nm { flex: 1 1 auto; font-weight: 600; word-break: break-word; cursor: pointer; line-height: 1.3; }
.card-meta .nm:hover { color: var(--pnq-accent); }
.card-sub { padding: 0 12px 11px; font-size: 12px; color: var(--pnq-text-muted); }
.folder-card .card-body { padding: 26px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; }
.folder-card .card-body > .fa { font-size: 42px; color: var(--pnq-folder); }
.folder-card .card-body > .fa-level-up { color: var(--pnq-text-muted); }
.folder-card .nm { font-weight: 600; text-align: center; word-break: break-word; }
.card-check { position: absolute; top: 8px; left: 8px; z-index: 2; background: var(--pnq-overlay-chip); border-radius: 5px; padding: 3px 5px; line-height: 0; opacity: 0; transition: opacity .12s ease; cursor: pointer; }
.lab-card:hover .card-check, .folder-card:hover .card-check, .card-check.on { opacity: 1; }
.card-actions { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 72%; opacity: 0; transition: opacity .12s ease; }
.lab-card:hover .card-actions, .folder-card:hover .card-actions { opacity: 1; }
.card-actions .btn { background: var(--pnq-card-btn); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.card-actions .btn:hover { background: var(--pnq-card-btn-hover); }
/* Running Labs card view: status area in place of a topology preview. */
.rl-card-body { height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; cursor: pointer; border-bottom: 1px solid var(--pnq-border); background: linear-gradient(180deg, #f7f9f8, #eef1f0); }
.rl-card-body .fa { font-size: 28px; color: var(--pnq-accent); opacity: .85; }
.rl-card-body.is-running .fa { color: var(--pnq-ok); }
/* Running Labs card actions: an always-visible bottom bar (Open/Stop/Destroy). */
.rl-card-actions { display: flex; border-top: 1px solid var(--pnq-border); }
.rl-card-actions .rl-act { flex: 1 1 0; border: none; background: transparent; padding: 9px 0; cursor: pointer; color: var(--pnq-text-muted); display: flex; align-items: center; justify-content: center; transition: background-color .12s ease, color .12s ease; }
.rl-card-actions .rl-act + .rl-act { border-left: 1px solid var(--pnq-border); }
.rl-card-actions .rl-act .fa { font-size: 15px; line-height: 1; }
.rl-card-actions .rl-act:hover { background: var(--pnq-surface-2); color: var(--pnq-text); }
.rl-card-actions .rl-act-open:hover { color: var(--pnq-accent); }
.rl-card-actions .rl-act-destroy { color: var(--pnq-danger); }
.rl-card-actions .rl-act-destroy:hover { background: var(--pnq-danger-soft); color: var(--pnq-danger); }

/* ---- signature header: shared rule + neutral count chip (bolder rollout) ---- */
/* One rule style + one neutral count chip, reused across every main view so the
   content area carries the identity consistently. Running Labs pioneered the
   language (.rl-livecount below is the live-state green variant of the chip);
   .vh-chip is the quiet steel-blue variant for a static inventory count. */
.view-head.vh-ruled { border-bottom: 2px solid rgba(60,112,138,0.28); padding-bottom: 14px; }
.vh-chip {
	display: inline-flex; align-items: center; gap: 7px;
	padding: 5px 12px; border-radius: 999px;
	font-weight: 600; font-size: 13px; line-height: 1;
	background: var(--pnq-accent-soft); color: var(--pnq-accent);
	border: 1px solid rgba(60,112,138,0.30);
}
.vh-chip > .fa { font-size: 12px; }
.vh-chip .n { font-size: 15px; font-variant-numeric: tabular-nums; }

/* ---- Running Labs — live-state treatment (bolder-within-identity) ----------- */
/* Signature header: the shared thin steel-blue rule (.vh-ruled), plus a live-
   count chip beside the title. */
.rl-livecount {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 5px 13px; border-radius: 999px;
	font-weight: 600; font-size: 13px; line-height: 1;
	background: rgba(46,125,68,0.12); color: var(--pnq-ok);
	border: 1px solid rgba(46,125,68,0.30);
}
.rl-livecount .n { font-size: 15px; font-variant-numeric: tabular-nums; }
.rl-livecount.is-idle { background: var(--pnq-surface-2); color: var(--pnq-text-muted); border-color: var(--pnq-border); }

/* A running lab reads as alive: a pulsing status dot + a green edge on the card. */
.rl-pulse { position: relative; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--pnq-ok); }
.rl-pulse::after {
	content: ""; position: absolute; inset: 0; border-radius: 50%;
	background: var(--pnq-ok); opacity: .55;
	animation: rl-pulse 1.8s ease-out infinite;
}
@keyframes rl-pulse { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(2.6); opacity: 0; } }
.rl-livecount.is-idle .rl-pulse, .rl-livecount.is-idle .rl-pulse::after { background: var(--pnq-text-muted); animation: none; opacity: .5; }

/* A "running" pill with the pulse dot — replaces the flat 11px green badge. */
.rl-run-badge {
	display: inline-flex; align-items: center; gap: 7px;
	padding: 3px 10px 3px 9px; border-radius: 999px;
	font-weight: 600; font-size: 11.5px; line-height: 1.4;
	background: rgba(46,125,68,0.14); color: var(--pnq-ok);
}

/* Running card: green edge + faint green wash on the status area. */
.rl-card.is-live { border-color: rgba(46,125,68,0.48); box-shadow: 0 1px 3px rgba(46,125,68,0.10), 0 6px 20px rgba(0,0,0,0.06); }
.rl-card.is-live .rl-card-body { background: linear-gradient(180deg, #f1f8f3, #e6f1ea); }
.rl-card.is-live .rl-card-body > .fa { color: var(--pnq-ok); }

@media (prefers-reduced-motion: reduce) {
	.rl-pulse::after { animation: none; opacity: .5; }
}

/* A Labs card that maps to a running session reuses the same green live edge. */
.lab-card.is-live { border-color: rgba(46,125,68,0.48); box-shadow: 0 1px 3px rgba(46,125,68,0.10), 0 6px 20px rgba(0,0,0,0.06); }

/* ---- inline running-node summary (System) — replaces the stat-tile grid ----- */
.node-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; }
.node-summary .ns-total { display: inline-flex; align-items: baseline; gap: 8px; }
.node-summary .ns-total .n { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.node-summary .ns-total .n.live { color: var(--pnq-ok); }
.node-summary .ns-sep { align-self: stretch; width: 1px; background: var(--pnq-border); }
.node-summary .ns-items { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.node-summary .ns-item { display: inline-flex; align-items: baseline; gap: 6px; font-size: 13px; color: var(--pnq-text-muted); }
.node-summary .ns-item .ns-n { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; color: var(--pnq-text); }
.node-summary .ns-item.is-live .ns-n { color: var(--pnq-ok); }

/* ---- grouped catalog section header (Devices / Images) --------------------- */
.group-head { display: flex; align-items: center; gap: 8px; margin: 20px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--pnq-border); font-weight: 600; font-size: 13.5px; }
.group-head:first-child { margin-top: 2px; }
.group-head > .fa { color: var(--pnq-accent); }
.group-head .gh-count { margin-left: auto; font-weight: 500; font-size: 12.5px; color: var(--pnq-text-muted); }

/* ---- Danger zone (System power / disk) — escalated, danger-framed hierarchy - */
.danger-zone-head { display: flex; align-items: center; gap: 8px; margin: 28px 0 12px; padding-bottom: 8px; border-bottom: 1px solid rgba(179,38,30,0.32); color: var(--pnq-danger); font-weight: 600; font-size: 14px; }
.danger-zone-head > .fa { font-size: 15px; }
.card.is-danger { border-color: rgba(179,38,30,0.30); }
.card.is-danger > .card-title { color: var(--pnq-danger); }

/* ---- tile cards (Images grid / Docker Devices) ----------------------------- */
.tile-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tile { position: relative; background: var(--pnq-surface); border: 1px solid var(--pnq-border); border-radius: var(--pnq-radius); box-shadow: var(--pnq-shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s ease, transform .15s ease; }
.tile:hover { box-shadow: 0 6px 22px rgba(0,0,0,0.12); transform: translateY(-1px); }
.tile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.tile-icon { text-align: center; font-size: 34px; color: var(--pnq-accent); padding: 4px 0; }
.tile-icon img { height: 48px; width: auto; display: inline-block; }
.tile-name { font-weight: 600; word-break: break-word; font-size: 13.5px; line-height: 1.3; }
.tile-des { font-size: 12.5px; color: var(--pnq-text-muted); flex: 1 1 auto; }
.tile-des.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.dev-log { font-family: var(--pnq-mono); font-size: 11.5px; color: var(--pnq-text-muted); white-space: pre-wrap; max-height: 90px; overflow: auto; background: var(--pnq-surface-2); border-radius: 6px; padding: 8px; display: none; }

/* ---- progress bar (jobs) --------------------------------------------------- */
.progress { height: 10px; border-radius: 999px; background: var(--pnq-surface-2); overflow: hidden; margin: 12px 0 6px; }
.progress-bar { height: 100%; width: 0; background: var(--pnq-accent); border-radius: 999px; transition: width .4s ease; }
.progress-bar.done { background: var(--pnq-ok); }
.progress-bar.err { background: var(--pnq-danger); }

/* ---- lab import progress panel (replaces the full-screen spinner) ---------- */
.import-progress {
	position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
	width: min(440px, 92vw); z-index: 61;
	background: var(--pnq-surface); border: 1px solid var(--pnq-border);
	border-radius: var(--pnq-radius); box-shadow: var(--pnq-shadow);
	padding: 14px 18px;
}
.import-progress-title { font-size: 14px; font-weight: 600; color: var(--pnq-text); display: flex; align-items: center; gap: 8px; }
.import-progress-title .fa { color: var(--pnq-accent); }
.import-progress .progress { margin: 10px 0 4px; }
.import-progress-label { font-size: 12px; }

/* ---- checklist (import) ---------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.checklist { border: 1px solid var(--pnq-border); border-radius: var(--pnq-radius-sm); overflow: hidden; margin-bottom: 14px; }
.checklist-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--pnq-surface-2); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--pnq-text-muted); }
.checklist-body { max-height: 300px; overflow: auto; }
.checklist-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--pnq-border); }
.checklist-item:hover { background: var(--pnq-surface-2); }
.checklist-item .ci-name { flex: 1 1 auto; word-break: break-all; }
.checklist-item .ci-meta { color: var(--pnq-text-muted); font-size: 12.5px; white-space: nowrap; }

/* ---- sidebar version footer ------------------------------------------------ */
.sidebar-version { display: flex; align-items: center; gap: 10px; color: #ffffff; padding: 10px 12px; border-radius: var(--pnq-radius-sm); cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.sidebar-version:hover { background: var(--pnq-primary-hover); color: #fff; }
.sidebar-version.active { background: var(--pnq-primary-light); color: #fff; box-shadow: inset 3px 0 0 var(--pnq-accent); }
.sidebar-version .fa { font-size: 15px; width: 18px; text-align: center; }
.sidebar-version .sv-text { display: flex; flex-direction: column; line-height: 1.25; font-size: 12px; min-width: 0; }
.sidebar-version .sv-text strong { font-size: 13px; color: inherit; }
.sidebar-version .sv-text span { color: rgba(255, 255, 255, 0.82); overflow: hidden; text-overflow: ellipsis; }
.sidebar-version.active .sv-text span { color: #cfe0d8; }

/* ---- version page ---------------------------------------------------------- */
.ver-banner { padding: 4px 0 16px; border-bottom: 1px solid var(--pnq-border); margin-bottom: 8px; }
.ver-big { font-size: 22px; font-weight: 700; }

/* ---- tabs ------------------------------------------------------------------ */
.tabs { display: inline-flex; gap: 4px; background: var(--pnq-surface-2); border-radius: var(--pnq-radius-sm); padding: 3px; }
.tabs .tab { border: none; background: transparent; padding: 7px 16px; border-radius: 6px; cursor: pointer; font: inherit; font-weight: 500; font-size: 13.5px; color: var(--pnq-text-muted); }
.tabs .tab:hover { color: var(--pnq-text); }
.tabs .tab.active { background: var(--pnq-surface); color: var(--pnq-text); box-shadow: var(--pnq-shadow); }

/* ---- permission grid (role editor) ----------------------------------------- */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; margin-top: 6px; }
.perm-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--pnq-surface-2); border-radius: 6px; cursor: pointer; font-size: 13px; }
.perm-item:hover { background: var(--pnq-perm-hover); }

/* (Apple-glass surface layer removed — flat opaque surfaces per the base
   rules above. Identity stays in the teal chrome + steel-blue accent, not
   blur; the glass default also eroded text contrast against the tint.) */

/* ---- responsive ------------------------------------------------------------ */
@media (max-width: 760px) {
	.app {
		grid-template-columns: 1fr;
		grid-template-rows: var(--pnq-topbar-h) auto 1fr;
		grid-template-areas: "topbar" "sidebar" "content";
	}
	.sidebar { flex-direction: row; flex-wrap: wrap; padding: 8px; }
	.sidebar-spacer { display: none; }
	.nav-item span { display: none; }
	.nav-item--ghost span { display: inline; }
	.topbar-user span { display: none; }
}
