.nav-group-label {
  margin-top: 14px;
  padding: 0 12px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.b-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.b-toolbar .b-spacer { flex: 1; }

.b-table-pkg th, .b-table-pkg td {
  white-space: nowrap;
  /* Headers align with their left-aligned cells (th defaults to center).
     Columns that want right/center alignment set it inline per-cell. */
  text-align: left;
}

.b-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.b-pill.is-active { background: rgba(34,197,94,0.12); color: var(--success); border-color: rgba(34,197,94,0.35); }
.b-pill.is-inactive { background: rgba(239,68,68,0.10); color: var(--danger); border-color: rgba(239,68,68,0.35); }
.b-pill.is-custom { background: rgba(245,158,11,0.10); color: var(--warning); border-color: rgba(245,158,11,0.35); }
.b-pill.is-scope { text-transform: capitalize; }

.b-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(2,6,23,0.65);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.b-modal {
  width: 100%;
  max-width: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  max-height: 92vh;
}
.b-modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.b-modal-head h3 { margin: 0; font-size: 18px; }
.b-modal-body {
  padding: 18px 20px;
  display: grid; gap: 14px;
  overflow-y: auto;
}
.b-modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.b-field { display: grid; gap: 6px; }
.b-field label { color: var(--text-secondary); font-size: 12px; }
.b-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.b-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.b-input-suffix { position: relative; }
.b-input-suffix input { padding-right: 50px; }
.b-input-suffix .b-suffix {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 12px; pointer-events: none;
}

.b-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
}

.b-coming {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px;
  color: var(--text-secondary);
}
.b-coming h3 { margin: 0 0 8px; color: var(--text-primary); font-size: 18px; }
.b-coming ul { margin: 10px 0 0; padding-left: 20px; line-height: 1.7; }

/* ============================================================
   Section visibility — true single-section navigation (replaces
   app.js's scroll-to-section behavior)
   ============================================================ */
.content-section { display: none !important; }
.content-section.is-active { display: grid !important; gap: 16px; }

/* ============================================================
   Collapsible nav groups
   ============================================================ */
/* Dashboard top item — same left edge + size as group headers */
.nav-link.nav-top {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #eaf1ff;
  padding: 13px 14px;
  margin-bottom: 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
}
.nav-link.nav-top.active {
  background: linear-gradient(90deg, rgba(59,130,246,0.22), rgba(59,130,246,0.04));
  border-color: rgba(96,165,250,0.45);
  color: #fff;
}

.nav-group { margin-bottom: 4px; }
.nav-group-header {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  /* brighter, bigger, bolder */
  color: #cdddf6;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 13px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-shadow: 0 0 10px rgba(96,165,250,0.20);
  transition: background 0.18s ease, color 0.18s ease;
}
.nav-group-header:hover {
  background: var(--bg-hover);
  color: #ffffff;
  text-shadow: 0 0 14px rgba(96,165,250,0.45);
}
.nav-group.open > .nav-group-header {
  color: #ffffff;
  background: rgba(255,255,255,0.03);
}
/* Bigger, brighter dropdown chevron */
.nav-chev {
  transition: transform 0.22s ease;
  font-size: 18px;
  line-height: 1;
  color: var(--accent);
  opacity: 1;
  flex: 0 0 auto;
  margin-left: 8px;
}
.nav-group.open .nav-chev { transform: rotate(90deg); }

.nav-group-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  display: grid;
  gap: 4px;
  padding-left: 10px;
}
.nav-group.open .nav-group-body {
  max-height: 700px;
  margin-top: 4px;
  margin-bottom: 8px;
}
/* sub-links: align under header text, clearer active state */
.nav-group-body .nav-link {
  font-size: 13.5px;
  padding: 9px 12px;
  color: var(--text-secondary);
}
.nav-group-body .nav-link:hover { color: var(--text-primary); }
.nav-group-body .nav-link.active {
  background: linear-gradient(90deg, rgba(59,130,246,0.20), rgba(59,130,246,0.02));
  border-color: rgba(96,165,250,0.40);
  color: #fff;
  font-weight: 600;
}

/* Nested sub-menu (e.g. Telephony › Extensions › SIP / WebRTC) */
.nav-subgroup { margin: 2px 0; }
.nav-subgroup-header {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.18s ease, color 0.18s ease;
}
.nav-subgroup-header:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-subgroup.open > .nav-subgroup-header { color: var(--text-primary); }
.nav-subgroup-header .nav-chev { font-size: 14px; color: var(--text-muted); }
.nav-subgroup.open .nav-subgroup-header .nav-chev { transform: rotate(90deg); color: var(--accent); }
.nav-subgroup-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease;
  display: grid;
  gap: 4px;
  padding-left: 14px;
}
.nav-subgroup.open .nav-subgroup-body { max-height: 320px; margin-top: 4px; }

/* ============================================================
   Download center
   ============================================================ */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.download-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.download-card .dl-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}
.dl-icon.dl-pc { background: rgba(59,130,246,0.15); }
.dl-icon.dl-android { background: rgba(34,197,94,0.15); }
.dl-icon.dl-phone { background: rgba(245,158,11,0.15); }
.download-card h3 { margin: 0; font-size: 17px; color: var(--text-primary); }
.download-card .dl-desc { color: var(--text-secondary); font-size: 13px; line-height: 1.5; flex: 1; }
.download-card .dl-meta { color: var(--text-muted); font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; }
.download-card .dl-actions { margin-top: 6px; }
.download-card .dl-unavailable { color: var(--text-muted); font-size: 12px; font-style: italic; }

/* ============================================================
   Donut wallboard widgets (Dashboard)
   ============================================================ */
.donut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}
.donut-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 16px 18px;
  text-align: center;
  box-shadow: var(--shadow);
}
.donut-card-label {
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 14px;
}
.donut-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto;
}
.donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.donut-bg {
  fill: transparent;
  stroke: rgba(255,255,255,0.06);
  stroke-width: 8;
}
.donut-fg {
  fill: transparent;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s ease, stroke 0.3s ease;
}
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.donut-value {
  font-size: 36px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
  line-height: 1;
}
.donut-unit {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.donut-card-sub {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  flex-wrap: wrap;
}
.donut-card-sub-item { display: inline-flex; align-items: center; gap: 6px; }

/* ============================================================
   SIP Trace terminal
   ============================================================ */
.sip-terminal {
  background: #060d1a;
  border-top: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  max-height: 560px;
  overflow-y: auto;
  padding: 4px 0;
}
.sip-empty { padding: 28px; color: var(--text-muted); text-align: center; }
.sip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  white-space: nowrap;
}
.sip-row:hover { background: rgba(255,255,255,0.03); }
.sip-seq { color: var(--text-muted); min-width: 34px; }
.sip-dir { width: 16px; text-align: center; font-weight: 700; }
.sip-dir.in  { color: var(--success); }
.sip-dir.out { color: var(--accent); }
.sip-transport {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  padding: 1px 6px; border-radius: 5px;
  background: var(--bg-hover); color: var(--text-secondary);
}
.sip-transport.wss, .sip-transport.ws { background: rgba(245,158,11,0.15); color: var(--warning); }
.sip-transport.tls { background: rgba(34,197,94,0.12); color: var(--success); }
.sip-addr { color: var(--text-secondary); min-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.sip-method {
  font-weight: 700; min-width: 92px;
  padding: 1px 8px; border-radius: 5px; text-align: center;
}
.sip-m-INVITE { background: rgba(59,130,246,0.18); color: #93c5fd; }
.sip-m-REGISTER { background: rgba(6,182,212,0.18); color: #67e8f9; }
.sip-m-OPTIONS { background: rgba(148,163,184,0.18); color: #cbd5e1; }
.sip-m-BYE, .sip-m-CANCEL { background: rgba(239,68,68,0.15); color: #fca5a5; }
.sip-m-resp-2 { background: rgba(34,197,94,0.16); color: #86efac; }
.sip-m-resp-4, .sip-m-resp-5, .sip-m-resp-6 { background: rgba(239,68,68,0.16); color: #fca5a5; }
.sip-m-resp-1, .sip-m-resp-3 { background: rgba(245,158,11,0.16); color: #fcd34d; }
.sip-m-other { background: var(--bg-hover); color: var(--text-secondary); }
.sip-fromto { color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; }
.sip-fromto .muted { color: var(--text-muted); }
.sip-raw {
  display: none;
  background: #020812;
  color: #b8c9e6;
  padding: 12px 16px;
  white-space: pre-wrap;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 11.5px;
  line-height: 1.5;
}
.sip-raw.open { display: block; }

/* Drag-and-drop dashboard widgets */
#dashboard-widgets .donut-card { cursor: grab; transition: opacity 0.15s ease, outline 0.15s ease; }
#dashboard-widgets .donut-card:active { cursor: grabbing; }
.donut-card.dragging { opacity: 0.45; }
.donut-card.drag-over { outline: 2px dashed var(--accent); outline-offset: 3px; }

/* ============================================================
   Hamburger / mobile sidebar
   ============================================================ */
.sidebar-toggle {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  margin-right: 12px;
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 99;
}
.sidebar-overlay.is-open { display: block; }

/* ============================================================
   iOS Safari viewport fixes
   ============================================================ */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
}
.sidebar {
  height: 100vh;
  height: 100dvh;
  -webkit-overflow-scrolling: touch;
}
* { -webkit-tap-highlight-color: transparent; }

/* ============================================================
   Mobile breakpoints
   ============================================================ */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    z-index: 100;
    width: 280px;
    box-shadow: 0 0 32px rgba(0,0,0,0.6);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; align-items: center; }
  .topbar { padding: 12px 14px; flex-wrap: wrap; gap: 10px; }
  .topbar h1 { font-size: 18px; line-height: 1.3; }
  .topbar p { display: none; }
  .topbar-actions { flex-wrap: wrap; gap: 6px; width: 100%; justify-content: flex-start; }
  .topbar-actions .btn { font-size: 12px; padding: 8px 10px; }
  .content { padding: 12px; gap: 12px; }
  .panel { border-radius: 10px; }
  /* prevent iOS input-focus zoom */
  input, select, textarea { font-size: 16px !important; }
  .donut-wrap { width: 130px; height: 130px; }
  .donut-value { font-size: 28px; }
}

@media (max-width: 600px) {
  .donut-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .donut-card { padding: 14px 8px 12px; }
  .donut-card-label { font-size: 10px; margin-bottom: 8px; }
  .donut-wrap { width: 110px; height: 110px; }
  .donut-value { font-size: 22px; }
  .donut-card-sub { font-size: 10px; gap: 8px; margin-top: 8px; }
  .data-table { font-size: 11px; }
  .data-table th, .data-table td { padding: 6px 8px; }
  .b-modal { max-width: 95vw; }
  .b-row, .b-row-3 { grid-template-columns: 1fr; }
}

/* Dashboard KPI splits (Phase A/B) */
.kpi-grid-split { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kpi-card .kpi-sub {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  align-items: center;
  flex-wrap: wrap;
}
.kpi-card .kpi-sub-up, .kpi-card .kpi-sub-down {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
.dot-success { background: var(--success); }
.dot-muted   { background: var(--text-muted); }
.dot-warning { background: var(--warning); }
.dot-danger  { background: var(--danger); }


/* ============================================================
   SIP Trace — plain-language split panel
   ============================================================ */
.sip-split { display: flex; gap: 0; border-top: 1px solid var(--border); }
.sip-split-col { flex: 1 1 50%; min-width: 0; display: flex; flex-direction: column; }
.sip-split-col + .sip-split-col { border-left: 1px solid var(--border); }
.sip-split-head { padding: 8px 14px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-secondary); background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--border); display:flex; align-items:center; gap:10px; }
.sip-split-hint { font-weight: 400; text-transform:none; letter-spacing:0; color: var(--text-muted); font-size: 11px; }
.sip-split .sip-terminal { border-top: none; flex: 1; }
.sip-plain { background: #060d1a; max-height: 560px; overflow-y: auto; padding: 8px 0; font-size: 12.5px; }
.diag-outcome { margin: 8px 12px 10px; padding: 12px 14px; border-radius: 8px; font-weight: 600; display:flex; gap:10px; align-items:flex-start; }
.diag-outcome .diag-ic { font-size: 15px; }
.diag-outcome.error { background: rgba(239,68,68,0.12); color:#fca5a5; border:1px solid rgba(239,68,68,0.3); }
.diag-outcome.success { background: rgba(34,197,94,0.12); color:#86efac; border:1px solid rgba(34,197,94,0.3); }
.diag-outcome.info { background: rgba(59,130,246,0.10); color:#93c5fd; border:1px solid rgba(59,130,246,0.25); }
.diag-row { display:flex; gap:10px; padding: 8px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); align-items:flex-start; }
.diag-ic { width: 18px; text-align:center; flex: 0 0 auto; margin-top: 1px; }
.diag-body { min-width: 0; }
.diag-title { font-weight: 600; color: var(--text-primary); display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.diag-detail { color: var(--text-secondary); font-size: 11.5px; margin-top: 2px; line-height: 1.45; }
.diag-src { font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 5px; }
.diag-src.gateway { background: rgba(139,92,246,0.16); color:#c4b5fd; }
.diag-src.sip { background: rgba(6,182,212,0.16); color:#67e8f9; }
.diag-row.error .diag-ic { color:#fca5a5; } .diag-row.error .diag-title { color:#fecaca; }
.diag-row.warn .diag-ic { color:#fcd34d; }
.diag-row.success .diag-ic { color:#86efac; }
.diag-row.info .diag-ic { color:#93c5fd; }
@media (max-width: 1100px){ .sip-split{ flex-direction:column; } .sip-split-col + .sip-split-col{ border-left:none; border-top:1px solid var(--border);} }


/* SIP Trace plain-language — per-call cards */
.diag-call { margin: 8px 12px; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: rgba(255,255,255,0.015); }
.diag-call-head { display:flex; align-items:center; gap:10px; padding: 9px 12px; background: rgba(255,255,255,0.03); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.diag-call-ic { font-size: 14px; }
.diag-call-head.error .diag-call-ic { color:#fca5a5; }
.diag-call-head.success .diag-call-ic { color:#86efac; }
.diag-call-head.warn .diag-call-ic { color:#fcd34d; }
.diag-call-head.info .diag-call-ic { color:#93c5fd; }
.diag-call-title { font-weight: 700; color: var(--text-primary); }
.diag-arrow { color: var(--text-muted); }
.diag-call-chips { display:flex; gap:6px; flex-wrap:wrap; }
.diag-chip { font-size: 10.5px; padding: 1px 7px; border-radius: 5px; background: rgba(139,92,246,0.14); color:#c4b5fd; }
.diag-chip.muted { background: var(--bg-hover); color: var(--text-muted); }
.diag-chip b { font-weight: 700; }
.diag-call-badge { margin-left:auto; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing:.03em; padding: 2px 9px; border-radius: 6px; }
.diag-call-badge.error { background: rgba(239,68,68,0.18); color:#fca5a5; }
.diag-call-badge.success { background: rgba(34,197,94,0.18); color:#86efac; }
.diag-call-badge.warn { background: rgba(245,158,11,0.18); color:#fcd34d; }
.diag-call-badge.info { background: rgba(59,130,246,0.16); color:#93c5fd; }
.diag-call .diag-row:last-child { border-bottom: none; }
