/**
 * Knoxed unified shell — sidebar pages (Plan, Monitor, Infra ops).
 * Uses --wk-* tokens from work.css.
 */

html:has(.knoxed-app) {
  height: 100%;
}

body.knoxed-app {
  margin: 0;
  min-height: 100%;
  height: 100%;
  font: 13px/1.45 var(--wk-font, system-ui, sans-serif);
  background: var(--wk-bg, #0f0f10);
  color: var(--wk-text, #ececee);
  -webkit-font-smoothing: antialiased;
}

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

.knoxed-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

.knoxed-main--work {
  overflow: hidden;
}

/* Related-page link strip (below top bar) */
.infra-page-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--wk-line, var(--line));
  background: color-mix(in srgb, var(--wk-panel, var(--panel)) 92%, var(--wk-accent, var(--accent)) 8%);
}

.infra-page-links a {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  color: var(--wk-text-2, var(--mute));
  border: 1px solid var(--wk-line, var(--line));
  background: var(--wk-surface-1, var(--card-bg));
  transition: border-color 0.12s, color 0.12s;
}

.infra-page-links a:hover {
  color: var(--wk-text, var(--text));
  border-color: var(--wk-accent, var(--accent));
}

.infra-page-links a.active {
  color: var(--wk-accent, var(--accent));
  border-color: color-mix(in srgb, var(--wk-accent, var(--accent)) 45%, var(--wk-line, var(--line)));
  background: var(--wk-accent-soft, rgba(94, 106, 210, 0.12));
}

.knoxed-scanner-link {
  margin-bottom: 4px;
}

.knoxed-content {
  flex: 1;
  overflow: auto;
  padding: 20px 24px 16px;
}

.knoxed-content--flush {
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Sidebar (shared with work) */
.knoxed-sidebar {
  width: var(--wk-sidebar-w, 220px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--wk-panel, #161618);
  border-right: 1px solid var(--wk-line, rgba(255, 255, 255, 0.08));
  padding: 12px 8px;
  overflow-y: auto;
}

.knoxed-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 14px;
  font-weight: 600;
  font-size: 14px;
  color: var(--wk-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.knoxed-team-switcher {
  padding: 0 8px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--wk-line, rgba(255, 255, 255, 0.08));
}

.knoxed-team-select {
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  font: inherit;
  font-size: 12px;
  color: var(--wk-text);
  background: var(--wk-bg, #0f0f10);
  border: 1px solid var(--wk-line);
  border-radius: 6px;
}

.knoxed-team-manage {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  text-decoration: none;
}

.knoxed-team-manage:hover {
  color: var(--wk-text);
}

.knoxed-brand:hover {
  color: var(--wk-text);
  text-decoration: none;
}

.knoxed-sidebar .nav-section {
  margin-bottom: 8px;
}

.knoxed-sidebar .nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wk-mute-2);
  padding: 8px 8px 4px;
}

.knoxed-sidebar a,
.knoxed-sidebar button.knoxed-search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--wk-radius, 6px);
  font: inherit;
  font-size: 13px;
  color: var(--wk-mute);
  text-decoration: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.knoxed-sidebar a:hover,
.knoxed-sidebar button.knoxed-search-btn:hover {
  background: var(--wk-surface-2);
  color: var(--wk-text);
}

.knoxed-sidebar a.active {
  background: var(--wk-surface-3);
  color: var(--wk-text);
  font-weight: 500;
}

.knoxed-sidebar a .wki,
.knoxed-sidebar button .wki {
  color: var(--wk-mute);
}

.knoxed-sidebar a:hover .wki,
.knoxed-sidebar a.active .wki,
.knoxed-sidebar button:hover .wki {
  color: var(--wk-text);
}

.knoxed-sidebar .badge {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--wk-surface-3);
  color: var(--wk-mute);
}

.knoxed-sidebar .nav-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--wk-line);
}

.knoxed-sidebar kbd {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid var(--wk-line);
  border-radius: 4px;
  color: var(--wk-mute-2);
}

/* Top bar */
.knoxed-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--wk-topbar-h, 44px);
  padding: 0 20px;
  background: var(--wk-panel);
  border-bottom: 1px solid var(--wk-line);
}

.knoxed-topbar-title h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.knoxed-topbar-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--wk-mute);
}

.knoxed-topbar-spacer {
  flex: 1;
}

.knoxed-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.knoxed-topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font: inherit;
  font-size: 12px;
  color: var(--wk-mute);
  background: var(--wk-surface-1);
  border: 1px solid var(--wk-line);
  border-radius: var(--wk-radius);
  text-decoration: none;
  cursor: pointer;
}

.knoxed-topbar-btn:hover,
.knoxed-topbar-btn.active {
  color: var(--wk-text);
  border-color: var(--wk-line-strong);
  text-decoration: none;
}

.knoxed-topbar-stamp {
  font-size: 11px;
  color: var(--wk-mute-2);
  white-space: nowrap;
}

.knoxed-notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
  font-size: 9px;
  line-height: 14px;
  text-align: center;
  background: var(--wk-fail);
  color: #fff;
  border-radius: 999px;
}

.knoxed-topbar-bell {
  position: relative;
}

/* Footer — frozen at the bottom of the viewport on every page */
.knoxed-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 12px 24px;
  font-size: 11px;
  color: var(--wk-mute-2);
  border-top: 1px solid var(--wk-line);
  background: var(--wk-panel);
  position: sticky;
  bottom: 0;
  z-index: 10;
}

/* Standalone-page variant: overlays the viewport (intake, login, etc.) */
.knoxed-footer--standalone {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
}

body.knoxed-has-standalone-footer {
  padding-bottom: 52px;
}

/* ── Tree sidebar nav ───────────────────────────────────────── */
.nav-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px;
}
.nav-group + .nav-group { margin-top: 4px; }
.nav-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px 8px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--wk-mute);
  border-radius: 4px;
}
.nav-group-header:hover { background: var(--wk-surface-1); color: var(--wk-text); }
.nav-chevron {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  transition: transform 0.12s ease;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M6 4l4 4-4 4' stroke='black' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M6 4l4 4-4 4' stroke='black' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat;
}
.nav-group.open > .nav-group-header .nav-chevron,
.nav-item--has-children.open > .nav-row .nav-chevron { transform: rotate(90deg); }
.nav-group-children {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0 4px 6px;
}
.nav-group.open > .nav-group-children { display: flex; }
.nav-group-children .nav-link,
.nav-group-children .nav-row > .nav-link,
.nav-group-children .nav-row > .nav-link--button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 4px;
  color: var(--wk-text-2, var(--wk-text));
  text-decoration: none;
  font-size: 13px;
  background: none;
  border: 0;
  width: 100%;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.nav-link:hover, .nav-link--button:hover { background: var(--wk-surface-1); color: var(--wk-text); }
.nav-link.active, .nav-link--button.active { background: var(--wk-accent-soft, rgba(94,106,210,.18)); color: var(--wk-accent); font-weight: 500; }
.nav-link .badge {
  margin-left: auto;
  background: var(--wk-surface-3, rgba(255,255,255,.08));
  color: var(--wk-mute);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
}
.nav-item--has-children { display: flex; flex-direction: column; }
.nav-item--has-children > .nav-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.nav-item--has-children > .nav-row > .nav-link,
.nav-item--has-children > .nav-row > .nav-link--button { flex: 1; min-width: 0; }
.nav-toggle {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0 6px;
  display: flex;
  align-items: center;
  color: var(--wk-mute);
  border-radius: 4px;
}
.nav-toggle:hover { background: var(--wk-surface-1); color: var(--wk-text); }
.nav-children {
  display: none;
  flex-direction: column;
  gap: 1px;
  margin-left: 12px;
  padding: 2px 0 4px 8px;
  border-left: 1px solid var(--wk-line);
}
.nav-item--has-children.open > .nav-children { display: flex; }
.nav-sublink {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--wk-text-2, var(--wk-mute));
  text-decoration: none;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-sublink:hover { background: var(--wk-surface-1); color: var(--wk-text); }
.nav-sublink.active { background: var(--wk-accent-soft, rgba(94,106,210,.18)); color: var(--wk-accent); }
.nav-sublink > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.nav-tag {
  flex-shrink: 0;
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(76,183,130,.18);
  color: var(--wk-ok, #4cb782);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.nav-show-all {
  display: block;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--wk-accent);
  text-decoration: none;
  margin-top: 2px;
}
.nav-show-all:hover { text-decoration: underline; }

.knoxed-footer a {
  color: var(--wk-mute);
  text-decoration: none;
}

.knoxed-footer a:hover {
  color: var(--wk-accent);
}

.knoxed-footer-copy {
  margin-left: auto;
}

/* Page content */
.infra-page {
  max-width: 1200px;
}

.infra-page--wide {
  max-width: none;
}

.infra-page h2 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--wk-text) 45%, var(--wk-mute));
  margin: 24px 0 10px;
}

.infra-page h2:first-child {
  margin-top: 0;
}

.infra-flash {
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: var(--wk-radius);
  border: 1px solid var(--wk-ok);
  background: rgba(76, 183, 130, 0.1);
  color: var(--wk-ok);
  font-size: 13px;
}

.infra-panel {
  background: var(--wk-panel);
  border: 1px solid var(--wk-line);
  border-radius: var(--wk-radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.infra-panel--accent {
  border-color: rgba(94, 106, 210, 0.4);
}

.infra-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.infra-data-table th,
.infra-data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--wk-line);
}

.infra-data-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--wk-text) 50%, var(--wk-mute));
  background: var(--wk-surface-0);
}

.infra-data-table tbody tr:hover td {
  background: var(--wk-surface-0);
}

.infra-data-table .right {
  text-align: right;
}

.infra-data-table a {
  color: var(--wk-text);
  font-weight: 500;
}

.infra-data-table a:hover {
  color: var(--wk-accent);
}

.infra-btn {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--wk-radius);
  border: 1px solid var(--wk-line);
  background: var(--wk-surface-2);
  color: var(--wk-text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.infra-btn:hover {
  background: var(--wk-surface-3);
  text-decoration: none;
}

.infra-btn--primary {
  background: var(--wk-accent);
  border-color: var(--wk-accent);
  color: #fff;
}

.infra-btn--primary:hover {
  background: var(--wk-accent-hover);
}

.infra-form-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 12px;
  align-items: center;
  font-size: 13px;
}

.infra-form-grid label {
  color: var(--wk-mute);
  font-size: 12px;
}

.infra-form-grid input,
.infra-form-grid select,
.infra-form-grid textarea {
  font: inherit;
  font-size: 13px;
  color: var(--wk-text);
  background: var(--wk-panel-2);
  border: 1px solid var(--wk-line);
  border-radius: var(--wk-radius);
  padding: 6px 8px;
}

details.infra-details > summary {
  cursor: pointer;
  color: var(--wk-mute);
  font-size: 13px;
  padding: 4px 0;
}

/* Legacy aliases inside shell */
.knoxed-app .card {
  background: var(--wk-panel);
  border: 1px solid var(--wk-line);
  border-radius: var(--wk-radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.knoxed-app .pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.knoxed-app .pill-ok { background: rgba(76, 183, 130, 0.15); color: var(--wk-ok); }
.knoxed-app .pill-warn { background: rgba(242, 201, 76, 0.15); color: var(--wk-warn); }
.knoxed-app .pill-fail { background: rgba(235, 87, 87, 0.15); color: var(--wk-fail); }
.knoxed-app .pill-info { background: var(--wk-accent-soft); color: var(--wk-accent); }
.knoxed-app .pill-running { background: rgba(88, 166, 255, 0.15); color: #58a6ff; }
.knoxed-app .pill-secondary { background: var(--wk-surface-3); color: var(--wk-mute); }

.infra-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.infra-grid-4 {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.infra-grid-mesh-sites {
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  margin-top: 14px;
}

.infra-host-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.infra-host-card .role {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wk-mute);
}

.infra-host-card .name {
  font-size: 15px;
  font-weight: 600;
  margin: 6px 0 8px;
  color: var(--wk-text);
}

.infra-host-card .meta {
  font-size: 12px;
  color: var(--wk-mute);
}

.infra-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  font-size: 13px;
  margin-bottom: 16px;
  color: var(--wk-mute);
}

.infra-breadcrumb a {
  color: var(--wk-accent);
  text-decoration: none;
}

.infra-breadcrumb a:hover {
  text-decoration: underline;
}

/* Mesh topology + site chips */
.mesh-summary {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  margin: 4px 0 20px;
}

.mesh-summary .num {
  font-size: 24px;
  font-weight: 600;
  color: var(--wk-text);
}

.mesh-summary .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wk-mute);
}

.mesh-diagram {
  padding: 10px 6px;
}

.mesh-diagram svg {
  width: 100%;
  height: auto;
  display: block;
}

a.mesh-node {
  cursor: pointer;
}

.mesh-node-box {
  fill: var(--wk-panel);
  stroke-width: 1.7;
  transition: fill 0.15s;
}

a.mesh-node:hover .mesh-node-box {
  fill: color-mix(in srgb, var(--wk-accent) 12%, var(--wk-panel));
}

.mesh-edge {
  stroke: var(--wk-accent);
  stroke-width: 1.5;
  opacity: 0.3;
}

.mesh-cap {
  fill: var(--wk-mute);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

text.n-role {
  fill: var(--wk-mute);
  font-size: 11px;
  letter-spacing: 0.9px;
}

text.n-name {
  fill: var(--wk-text);
  font-size: 19px;
  font-weight: 600;
}

text.n-ip {
  fill: var(--wk-mute);
  font-size: 12px;
  font-family: ui-monospace, monospace;
}

text.n-meta {
  fill: var(--wk-mute);
  font-size: 12px;
}

.site-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.site-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid var(--wk-line);
  background: var(--wk-surface-0);
  color: var(--wk-text);
  text-decoration: none;
}

.site-chip:hover {
  border-color: var(--wk-accent);
}

.site-chip.primary {
  border-color: rgba(88, 166, 255, 0.45);
}

.site-chip.subdomain,
.site-chip.legacy {
  color: var(--wk-mute);
}

.site-chip.legacy {
  border-style: dashed;
}

.hd {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.hd-up { background: var(--wk-ok); }
.hd-warn { background: var(--wk-warn); }
.hd-down { background: var(--wk-fail); }
.hd-unknown { background: var(--wk-mute); }

.mesh-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0 0;
  color: var(--wk-mute);
  font-size: 12px;
}

.mesh-host-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.mesh-host-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.knoxed-app .muted { color: var(--wk-mute); }

/* Default link accent — overridden for nav, cards, chips */
.knoxed-app a {
  color: var(--wk-accent);
}

.knoxed-sidebar a,
.knoxed-sidebar a:hover,
.knoxed-sidebar a.active,
.knoxed-brand,
.knoxed-brand:hover {
  color: var(--wk-text);
  text-decoration: none;
}

.knoxed-sidebar a:not(.active) {
  color: var(--wk-mute);
}

.knoxed-app a.infra-host-card,
.knoxed-app a.infra-host-card:hover,
.knoxed-app a.infra-panel.infra-host-card,
.knoxed-app a.site-chip,
.knoxed-app a.site-chip:hover,
.knoxed-app a.mesh-node {
  color: var(--wk-text);
  text-decoration: none;
}

.knoxed-app a.infra-host-card .role,
.knoxed-app a.infra-host-card .meta,
.knoxed-app a.site-chip.subdomain,
.knoxed-app a.site-chip.legacy {
  color: var(--wk-mute);
}

.knoxed-footer a {
  color: var(--wk-mute);
}

/* Work shell: list + detail flex inside flush content */
body.knoxed-app--work {
  overflow: hidden;
}

.knoxed-content--flush .work-body,
.knoxed-app .work-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

.knoxed-content--flush .work-body > .work-main,
.knoxed-app .work-main {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.knoxed-content--flush .work-body .work-list {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.knoxed-content--flush .work-body .work-detail {
  flex-shrink: 0;
  min-height: 0;
}

.infra-prd-preview {
  background: var(--wk-panel-2, #1c1c1f);
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--wk-line, rgba(255, 255, 255, 0.08));
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  overflow-x: auto;
}

/* Tablet: compact sidebar, topbar/footer that wrap */
@media (max-width: 900px) {
  .knoxed-sidebar {
    width: 56px;
    padding: 10px 6px;
  }

  .knoxed-sidebar .nav-label,
  .knoxed-sidebar a > span:not(.wki),
  .knoxed-sidebar kbd,
  .knoxed-brand span,
  .knoxed-sidebar .badge {
    display: none;
  }

  /* Hide section-header buttons (Issues/Plan/Monitor/Operate) — they have no icons */
  .knoxed-team-switcher,
  .nav-group-header,
  .nav-toggle,
  .nav-children {
    display: none !important;
  }

  /* Show all group children flat (icon links only, no collapsing) */
  .nav-group-children {
    display: flex !important;
    padding: 2px 0;
  }

  .knoxed-sidebar a,
  .knoxed-sidebar button.knoxed-search-btn {
    justify-content: center;
    min-height: 44px;
    padding: 10px 6px;
  }

  .knoxed-brand {
    justify-content: center;
    padding: 8px 4px 12px;
  }

  .knoxed-topbar {
    flex-wrap: wrap;
    align-items: center;
    min-height: var(--wk-topbar-h, 44px);
    padding: 8px 12px;
    gap: 8px;
    overflow: hidden;
  }

  .knoxed-topbar-title {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
  }

  .knoxed-topbar-title h1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .knoxed-topbar-spacer {
    display: none;
  }

  .knoxed-topbar-actions {
    flex-wrap: wrap;
    max-width: 100%;
    gap: 6px;
  }

  .knoxed-topbar-stamp {
    display: none;
  }

  /* Keep only the notification bell — hide theme toggle and search */
  #theme-toggle,
  #topbar-search {
    display: none;
  }

  .knoxed-topbar-btn {
    min-height: 44px;
    padding: 8px 10px;
    flex-shrink: 0;
  }

  .knoxed-footer {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 10px 16px;
    gap: 8px 14px;
    line-height: 1.5;
  }

  .knoxed-footer-copy {
    margin-left: 0;
    flex: 1 1 100%;
    text-align: left;
  }

  .knoxed-content {
    padding: 16px;
  }

  .knoxed-content--flush .work-body .work-list {
    width: 100%;
    border-right: none;
  }
}

@media (max-width: 640px) {
  .knoxed-topbar-btn span {
    display: none;
  }

  .knoxed-topbar-btn {
    padding: 8px 12px;
  }

  .knoxed-content {
    padding: 12px;
  }

  .infra-page {
    max-width: 100%;
  }

  .infra-form-grid {
    grid-template-columns: 1fr;
  }

  .infra-data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}


/* ── Scrollbars — thin, grey, theme-matched ─────────────────────── */
.knoxed-app ::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.knoxed-app ::-webkit-scrollbar-track {
  background: transparent;
}

.knoxed-app ::-webkit-scrollbar-thumb {
  background: var(--wk-surface-3, rgba(255, 255, 255, 0.12));
  border-radius: 4px;
}

.knoxed-app ::-webkit-scrollbar-thumb:hover {
  background: var(--wk-mute, #8b8b93);
}

.knoxed-app ::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox */
.knoxed-app {
  scrollbar-width: thin;
  scrollbar-color: var(--wk-surface-3, rgba(255, 255, 255, 0.12)) transparent;
}

html.light .knoxed-app ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
}
html.light .knoxed-app ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.35);
}
html.light .knoxed-app {
  scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}

/* Roadmap — filters + Gantt */
.roadmap-filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}

.roadmap-filter-bar select {
  font: inherit;
  font-size: 13px;
}

.roadmap-filter-bar label {
  font-size: 12px;
  color: var(--wk-mute);
}

.rm-section-header {
  background: rgba(94, 106, 210, 0.06);
  color: var(--wk-accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 6px 10px !important;
  border-bottom: 1px solid var(--wk-line);
  border-top: 1px solid var(--wk-line);
}

.roadmap-gantt {
  margin-bottom: 28px;
  background: var(--wk-panel);
  border: 1px solid var(--wk-line);
  border-radius: var(--wk-radius-lg);
  overflow: hidden;
}

.roadmap-gantt__axis {
  position: relative;
  height: 28px;
  margin-left: 168px;
  border-bottom: 1px solid var(--wk-line);
  background: var(--wk-surface-0);
}

.roadmap-gantt__tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--wk-mute-2);
  padding: 8px 4px 0;
  white-space: nowrap;
  pointer-events: none;
}

.roadmap-gantt__body {
  max-height: min(70vh, 520px);
  overflow-y: auto;
}

.roadmap-gantt__row {
  display: flex;
  align-items: stretch;
  min-height: 36px;
  border-bottom: 1px solid var(--wk-line);
}

.roadmap-gantt__row:last-child {
  border-bottom: none;
}

.roadmap-gantt__label {
  flex: 0 0 168px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  border-right: 1px solid var(--wk-line);
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roadmap-gantt__label a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roadmap-gantt__track {
  position: relative;
  flex: 1;
  min-height: 36px;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent calc(25% - 1px),
    var(--wk-surface-0) calc(25% - 1px),
    var(--wk-surface-0) 25%
  );
}

.roadmap-gantt__today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--wk-warn);
  opacity: 0.85;
  pointer-events: none;
  z-index: 2;
}

.roadmap-gantt__bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 22px;
  min-width: 6px;
  border-radius: 4px;
  font-size: 10px;
  line-height: 22px;
  padding: 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  color: #fff;
  z-index: 1;
  box-sizing: border-box;
}

.roadmap-gantt__bar:hover {
  filter: brightness(1.12);
  z-index: 3;
}

.roadmap-gantt__bar-label {
  pointer-events: none;
}

.roadmap-gantt__bar--cycle {
  height: 26px;
  line-height: 26px;
  opacity: 0.55;
  background: rgba(94, 106, 210, 0.35);
  border: 1px solid rgba(94, 106, 210, 0.55);
  color: var(--wk-text);
  z-index: 0;
}

.roadmap-gantt__bar--cycle-active {
  opacity: 0.75;
  background: rgba(76, 183, 130, 0.25);
  border-color: rgba(76, 183, 130, 0.5);
}

.roadmap-gantt__bar--project {
  background: rgba(210, 153, 34, 0.85);
  border: 1px solid rgba(210, 153, 34, 1);
  z-index: 2;
}

.roadmap-gantt__bar--card {
  height: 18px;
  line-height: 18px;
  font-size: 9px;
  z-index: 1;
}

.roadmap-gantt__bar--status-done,
.roadmap-gantt__bar--status-wontfix {
  background: var(--wk-mute);
  opacity: 0.65;
}

.roadmap-gantt__bar--status-in_progress {
  background: var(--wk-warn);
}

.roadmap-gantt__bar--status-blocked {
  background: var(--wk-fail);
}

.roadmap-gantt__bar--status-triaged {
  background: var(--wk-accent);
}

.roadmap-gantt__bar--status-backlog,
.roadmap-gantt__bar--status-todo {
  background: var(--wk-surface-3);
  color: var(--wk-text);
}

.roadmap-gantt__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--wk-mute);
  border-top: 1px solid var(--wk-line);
}

.roadmap-gantt__legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.roadmap-gantt__swatch {
  display: inline-block;
  width: 14px;
  height: 8px;
  border-radius: 2px;
}

.roadmap-gantt__swatch--cycle {
  background: rgba(94, 106, 210, 0.45);
  border: 1px solid rgba(94, 106, 210, 0.7);
}

.roadmap-gantt__swatch--project {
  background: rgba(210, 153, 34, 0.9);
}

.roadmap-gantt__swatch--card {
  background: var(--wk-accent);
}

.roadmap-gantt__swatch--today {
  width: 2px;
  height: 12px;
  border-radius: 0;
  background: var(--wk-warn);
}

@media (max-width: 720px) {
  .roadmap-gantt__axis {
    margin-left: 120px;
  }

  .roadmap-gantt__label {
    flex: 0 0 120px;
  }
}

/* Global dark-themed form controls for all infra pages */
.knoxed-app select,
.knoxed-app input[type="text"],
.knoxed-app input[type="search"],
.knoxed-app input[type="email"],
.knoxed-app input[type="number"],
.knoxed-app input[type="date"],
.knoxed-app input[type="url"],
.knoxed-app textarea {
  font: inherit;
  font-size: 13px;
  color: var(--wk-text, #ececee);
  background: var(--wk-panel-2, #1c1c1f);
  border: 1px solid var(--wk-line, rgba(255,255,255,0.08));
  border-radius: var(--wk-radius, 6px);
  padding: 6px 8px;
  outline: none;
  transition: border-color 0.15s;
}

.knoxed-app select:focus,
.knoxed-app input[type="text"]:focus,
.knoxed-app input[type="search"]:focus,
.knoxed-app input[type="email"]:focus,
.knoxed-app input[type="number"]:focus,
.knoxed-app input[type="date"]:focus,
.knoxed-app input[type="url"]:focus,
.knoxed-app textarea:focus {
  border-color: var(--wk-accent, #5e6ad2);
}

.knoxed-app select option {
  background: var(--wk-panel-2, #1c1c1f);
  color: var(--wk-text, #ececee);
}

.knoxed-app select optgroup {
  background: var(--wk-panel, #161618);
  color: var(--wk-mute, #8b8b93);
}

html.light .knoxed-app select,
html.light .knoxed-app input[type="text"],
html.light .knoxed-app input[type="search"],
html.light .knoxed-app input[type="email"],
html.light .knoxed-app input[type="number"],
html.light .knoxed-app input[type="date"],
html.light .knoxed-app input[type="url"],
html.light .knoxed-app textarea {
  background: #ffffff;
  color: var(--wk-text);
  border-color: var(--wk-line-strong);
}

html.light .knoxed-app select option {
  background: #ffffff;
  color: var(--wk-text);
}

html.light .knoxed-app select optgroup {
  background: var(--wk-panel-2);
  color: var(--wk-mute);
}

html.light .ck-overlay {
  background: rgba(0, 0, 0, 0.35);
}

html.light .ck-panel {
  box-shadow: var(--wk-shadow);
}

html.light .knoxed-topbar-btn:hover,
html.light .knoxed-topbar-btn.active {
  background: var(--wk-surface-2);
}

/* Project detail tabs */
.infra-project-header { margin: 0 0 16px; }
.infra-project-header__title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.infra-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 0;
  padding: 0 0 0;
  border-bottom: 1px solid var(--wk-line, #2a2a2e);
}
.infra-tabs__link {
  display: inline-block;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--wk-mute, #8b8b93);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.infra-tabs__link:hover { color: var(--wk-text, #e8e8ed); }
.infra-tabs__link--active {
  color: var(--wk-text, #e8e8ed);
  border-bottom-color: var(--wk-accent, #58a6ff);
}
.infra-tab-panel { margin-top: 0; border-top: none; border-radius: 0 0 8px 8px; }
.infra-pre {
  white-space: pre-wrap;
  font-size: 12px;
  max-height: 420px;
  overflow: auto;
  padding: 12px;
  background: var(--wk-bg-alt, #1a1a1e);
  border-radius: 6px;
  border: 1px solid var(--wk-line, #2a2a2e);
}
html.light .infra-pre { background: #f6f8fa; }

/* Project vitals (overview tab) */
.proj-vitals-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.proj-vitals-stat {
  background: var(--wk-panel, #1a1a1e);
  border: 1px solid var(--wk-line, #2a2a2e);
  border-radius: 8px;
  padding: 14px 16px;
  text-align: center;
}
.proj-vitals-stat .big { font-size: 28px; font-weight: 700; line-height: 1.1; margin-bottom: 4px; }
.proj-vitals-stat .label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--wk-mute, #8b8b93); }
.proj-vitals-stat.ok .big { color: var(--wk-ok, #3fb950); }
.proj-vitals-stat.warn .big { color: var(--wk-warn, #d29922); }
.proj-vitals-stat.info .big { color: var(--wk-accent, #58a6ff); }
.proj-vitals-heading { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
.proj-vitals-panel { margin-bottom: 16px; }
.proj-progress-track {
  height: 18px;
  background: rgba(255,255,255,.06);
  border-radius: 9px;
  overflow: hidden;
  display: flex;
}
.proj-progress-open { background: var(--wk-warn, #d29922); }
.proj-progress-done { background: var(--wk-ok, #3fb950); }
.proj-progress-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--wk-mute); margin-top: 8px; }
.proj-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 4px; vertical-align: middle; }
.proj-dot-warn { background: var(--wk-warn, #d29922); }
.proj-dot-ok { background: var(--wk-ok, #3fb950); }
.proj-charts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.proj-bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.proj-bar-item { display: grid; grid-template-columns: 100px 1fr 40px; align-items: center; gap: 10px; }
.proj-bar-label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-bar-track { height: 12px; background: rgba(255,255,255,.06); border-radius: 6px; overflow: hidden; }
.proj-bar-fill { height: 100%; background: var(--wk-accent, #58a6ff); border-radius: 6px; min-width: 2px; }
.proj-bar-fill.ok { background: var(--wk-ok, #3fb950); }
.proj-bar-fill.warn { background: var(--wk-warn, #d29922); }
.proj-bar-fill.fail { background: var(--wk-fail, #f85149); }
.proj-bar-count { font-size: 12px; color: var(--wk-mute); text-align: right; font-variant-numeric: tabular-nums; }
.proj-tp-chart { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding-top: 4px; }
.proj-tp-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.proj-tp-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.proj-tp-bar { width: 100%; background: var(--wk-accent, #58a6ff); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .8; }
.proj-tp-bar.current { background: var(--wk-ok, #3fb950); opacity: 1; }
.proj-tp-count { font-size: 11px; font-weight: 600; min-height: 14px; }
.proj-tp-label { font-size: 9px; color: var(--wk-mute); padding-bottom: 4px; }
.proj-actions-panel { margin-bottom: 16px; }
.proj-actions-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
html.light .proj-vitals-stat { background: #fff; }
html.light .proj-bar-track, html.light .proj-progress-track { background: rgba(0,0,0,.06); }
