:root {
  --bg-color: #0b0c10;
  --bg-elevated: #151821;
  --bg-elevated-soft: #1b1f2b;
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, 0.18);
  --accent-hover: #77a6ff;
  --danger: #ff4f4f;
  --danger-soft: rgba(255, 79, 79, 0.18);
  --text-primary: #f8f8f8;
  --text-muted: #a1a6b2;
  --border-subtle: #252938;
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.45);

  --header-height: 64px;
  --sidebar-width: 240px;
  --border-radius-lg: 14px;
  --border-radius-xl: 18px;
  --transition-fast: 0.18s ease-out;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #1b2640 0, #05060a 45%, #000 100%);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */

.app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  background: linear-gradient(90deg, #10121a, #151821);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
  position: relative;
  z-index: 20;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

.app-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.app-logo-img {
  width: 36px;
  height: 36px;
  border-radius: 999px; /* ensures it stays round */
  object-fit: cover;
  display: block;
  box-shadow: 0 0 18px rgba(79, 140, 255, 0.35);
}


.app-logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #6aa8ff, #3050ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 0 18px rgba(79, 140, 255, 0.7);
}

/* Logo image (top-left) */
.app-logo-img {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  object-fit: cover;
  display: block;
  box-shadow: 0 0 18px rgba(79, 140, 255, 0.35);
}

/* Iframe content area */
.content-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: transparent;
  border-radius: 18px; /* matches your card rounding vibe */
}


.app-logo-text {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dynamic-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(12, 15, 25, 0.9);
  border: 1px solid rgba(79, 140, 255, 0.35);
  box-shadow: 0 0 18px rgba(79, 140, 255, 0.25);
  pointer-events: auto;
  max-width: 60%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== USER DROPDOWN ===== */

.user-dropdown {
  position: relative;
  margin-left: 1.5rem;
}

.user-button {
  border: none;
  background: transparent;
  padding: 0.35rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.user-button:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
}

.user-button svg {
  width: 32px;
  height: 32px;
  display: block;
}

.dropdown-menu {
  position: absolute;
  top: 120%;
  right: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  padding: 0.35rem;
  display: none;
}

.dropdown-menu.open {
  display: block;
}

.dropdown-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.dropdown-item svg {
  width: 16px;
  height: 16px;
}

.dropdown-item:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ===== LAYOUT ===== */

.app-shell {
  flex: 1;
  display: flex;
  min-height: 0;
}

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #11131b, #070812);
  border-right: 1px solid var(--border-subtle);
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 0 0.5rem 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  background: rgba(31, 39, 59, 1);
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.nav-item span {
  flex: 1;
}

.nav-item::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  margin-right: 0.5rem;
  background: rgba(196, 9, 9, 0.08);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.nav-item.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
  box-shadow: 0 0 20px rgba(79, 140, 255, 0.45);
}

.nav-item.active::before {
  background: var(--accent);
}

/* ===== MAIN CONTENT ===== */

.main-content {
  flex: 1;
  padding: 1.25rem 1.75rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: auto;
}

.content-card {
  background: radial-gradient(circle at top left, rgba(79, 140, 255, 0.08), transparent 60%),
    var(--bg-elevated-soft);
  border-radius: var(--border-radius-xl);
  border: 1px solid var(--border-subtle);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-soft);
}

.page-title {
  text-align: center;
  font-size: 1.4rem;
  margin: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.page-subtitle {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  text-align: center;
  color: var(--text-muted);
}

/* Give the status page (and any page) vertical spacing between sections */
.page-inner{
  display: flex;
  flex-direction: column;
  gap: 10px;           /* <- change to 20/24 if you want more */
  padding: 1.25rem 1.75rem 1.75rem;
}


/* Placeholder content styling */

.placeholder-block {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: var(--border-radius-lg);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ===== MODAL ===== */
.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;              /* <-- IMPORTANT */
  align-items: center;
  justify-content: center;
  z-index: 9999;              /* keep above header */
  padding: 18px;
}

/* remove/ignore .modal-backdrop.open entirely */

.modal {
  width: 600px;
  max-width: 90%;
  background: var(--bg-elevated);
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
  padding: 1.25rem 1.5rem 1.1rem;
  box-shadow: var(--shadow-soft);
}

.modal h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.modal p {
  margin: 0;
  margin-bottom: 1rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.modal-actions {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.modal-foot #z_hint{
  margin: 10px 0;
}


.btn {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast),
    transform var(--transition-fast);
}

.btn-outline {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: transparent;
}

.btn-danger:hover {
  background: #ff6a6a;
  box-shadow: 0 0 18px rgba(255, 79, 79, 0.6);
  transform: translateY(-1px);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .app-shell {
    flex-direction: column;
  }

  .main-content {
    padding: 1rem;
  }

  .dynamic-text {
    max-width: 80%;
  }
}

/* Status page container inside iframe */
.page-doc { margin: 0; background: transparent; }


/* Status layout helpers */
.status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.status-device-name { font-size: 1.25rem; font-weight: 700; }
.status-device-meta { color: var(--text-muted); font-size: 0.85rem; }
.status-top-right { display: flex; align-items: center; gap: 0.6rem; }
.status-state { color: var(--text-primary); font-weight: 600; }

/* 3-up grid under the KPIs */
.status-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 1100px) {
  .status-grid { grid-template-columns: 1fr; }
}

/* Make an item span the full width of the 3-column status grid */
.status-grid-full{
  grid-column: 1 / -1;
}


/* KPI cards */
.kpi-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 1rem;
}
@media (max-width: 950px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.kpi-card {
  background: var(--bg-elevated-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-xl);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-soft);
}
.kpi-label { color: var(--text-muted); letter-spacing: 0.12em; font-size: 0.72rem; text-transform: uppercase; margin-bottom: 0.4rem; }
.kpi-value { font-size: 1.4rem; font-weight: 700; }
.kpi-row { display: flex; align-items: baseline; gap: 0.4rem; }
.kpi-suffix { color: var(--text-muted); font-size: 0.85rem; }
.kpi-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Donuts */
.donut-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.donut { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem; padding-top: 0.25rem; }
.donut-svg { width: 110px; height: 110px; transform: rotate(-90deg); }
.donut-bg { fill: none; stroke: rgba(255,255,255,0.12); stroke-width: 6; }
.donut-fg {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 0 1000;
  transition: stroke-dasharray 250ms ease-out;
}
.fg-emerald { stroke: #35d39c; }
.fg-sky { stroke: #4f8cff; }
.fg-purple { stroke: #b57aff; }
.donut-label { color: var(--text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; }
.donut-value { font-size: 0.95rem; font-weight: 700; }

/* Pills (if you don't already have these) */
.pill { padding: 0.2rem 0.6rem; border-radius: 999px; border: 1px solid rgba(255,255,255,0.12); font-size: 0.78rem; }
.pill-ok { background: rgba(53, 211, 156, 0.16); color: #7ff0c8; border-color: rgba(53, 211, 156, 0.35); }
.pill-warn { background: rgba(255, 193, 7, 0.14); color: #ffd27a; border-color: rgba(255, 193, 7, 0.3); }
.pill-bad { background: rgba(255, 79, 79, 0.14); color: #ff9a9a; border-color: rgba(255, 79, 79, 0.3); }
.pill-info { background: rgba(79, 140, 255, 0.14); color: #a8c6ff; border-color: rgba(79, 140, 255, 0.3); }
.pill-neutral { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }

/* If your iframe needs full height */
.content-frame { width: 100%; height: 100%; border: none; display: block; background: transparent; }

/* ===== Services grid ===== */
.services-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.service-item{
  display: grid;
  grid-template-columns: 1.2fr 1.3fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.20);
}

.service-name{
  font-weight: 650;
  color: var(--text-primary);
}

.service-meta{
  color: var(--text-muted);
  font-size: 0.9rem;
}

.service-status{
  display: flex;
  justify-content: flex-end;
}

/* Narrow screens */
@media (max-width: 520px){
  .service-item{
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }
  .service-meta{
    grid-column: 1 / -1;
  }
  .service-status{
    grid-row: 1 / 2;
  }
}

/* ===== Cloud grid ===== */
.cloud-grid{
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px 14px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.20);
}

.cloud-k{
  color: var(--text-muted);
  font-size: 0.9rem;
}

.cloud-v{
  color: var(--text-primary);
  font-weight: 600;
  justify-self: end;
  text-align: right;
}

.cloud-actions{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

/* ===== Events header grid ===== */
.events-head{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.events-subtitle{
  margin-top: 2px;
  font-size: 0.9rem;
}

.events-empty{
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.18);
  color: var(--text-muted);
  text-align: center;
}

.alert{
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.25);
  padding: 12px 14px;
  margin-bottom: 12px; /* space before the table header */
}

.alert-title{
  font-weight: 700;
  margin-bottom: 4px;
}

.alert-msg{
  color: var(--text-muted);
  font-size: 0.92rem;
}

.alert-danger{
  border-color: rgba(255,79,79,0.35);
  background: rgba(255,79,79,0.10);
}

/* network page */

/* Tabs */
/* ---------- Tabs ---------- */
.tabs { display: grid; gap: 12px; }
.tabs-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  padding-bottom: 10px;
  flex-wrap: wrap;
}
.tab-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
}
.tab-btn:hover { background: rgba(255,255,255,0.06); }
.tab-btn.is-active {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.20);
}
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ---------- Network layout ---------- */
.stack { display: grid; gap: 14px; }

.net-card {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  border-radius: 16px;
  padding: 14px;
}

.net-grid { display: grid; gap: 10px 12px; align-items: center; }
.net-grid-3 { grid-template-columns: 160px 1fr 140px; }
.net-grid-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

.net-label, .net-k {
  color: rgba(255,255,255,0.70);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.net-field { grid-column: span 1; width: 300px; }
.net-actions { display: flex; justify-content: flex-end; }
.net-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* place value cells nicely across 12-col grid */
.net-k { grid-column: span 3; }
.net-v { grid-column: span 9; }

.net-footer {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
  padding-top: 6px;
}

/* ---------- Inputs (to match app.css dark theme) ---------- */
.input {
  width: 100%;
  height: 36px;
  border-radius: 12px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(10,14,24,0.6);
  color: rgba(255,255,255,0.92);
}
.input:focus { outline: none; border-color: rgba(255,255,255,0.25); }
.input-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
input.copy { cursor: pointer; }

/* ---------- Optional tokens (if not already in app.css) ---------- */
:root{
  --ok: #22c55e;
  --danger: #ef4444;
  --accent: #3b82f6;
  --muted: rgba(255,255,255,0.55);
}

/* Dot (if your status page already defines these, skip) */
.dot { display:inline-block; width:10px; height:10px; border-radius:999px; margin-right:8px; background: #64748b; }
.dot-ok { background: var(--ok); }
.dot-bad { background: var(--danger); }
.dot-warn { background: #f59e0b; }

/* Field block used in Network rows */
.field { display: grid; gap: 6px; }
.field-label {
  font-size: 12px;
  color: rgba(255,255,255,0.70);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* Common row grids */
.net-row2{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.net-row3{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.net-row4{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.inline{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

@media (max-width: 1100px){
  .net-row4{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px){
  .net-row3{ grid-template-columns: 1fr; }
  .net-row2{ grid-template-columns: 1fr; }
  .net-row4{ grid-template-columns: 1fr; }
}

/* Zones page helpers */
.zones-mode{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.mode-btn.is-active{
  border-color: rgba(16,185,129,.75); /* emerald-ish */
  box-shadow: 0 0 0 2px rgba(16,185,129,.15) inset;
}

.zones-filters{
  display:grid;
  gap:12px;
  grid-template-columns: 1.4fr 0.7fr 0.7fr;
  align-items:end;
  margin-top:12px;
}

@media (max-width: 900px){
  .zones-filters{ grid-template-columns: 1fr; }
}

.btn-xs{
  padding: 6px 10px;
  font-size: 12px;
}

/* Zones toolbar helper (optional) */
.field .inline {
  align-items: center;
}

/* ===== Zones: Mode section grid ===== */
.zones-mode-grid{
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 14px;
  margin-top: 12px;
  align-items: start;
}

.zones-mode-actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.zones-mode-status{
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  border-radius: 14px;
  padding: 12px;
}

/* ===== Zones: Tools + filters grid ===== */
.zones-tools-grid{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  margin-top: 12px;
  align-items: end;
}

.zones-tools-left{
  display: grid;
  grid-template-columns: 1.6fr 0.8fr 0.8fr 0.9fr;
  gap: 12px;
  align-items: end;
}

.zones-tools-right{
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.mini-field{
  display: grid;
  gap: 6px;
}

.zones-audio-row{
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: end; /* ensures button aligns with the bottoms of selects */
}

/* On smaller screens stack cleanly */
@media (max-width: 900px){
  .zones-audio-row{
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  #zm_aes67_test{
    width: 100%;
  }
}



/* ===== Zones: Editor grid ===== */
.zones-editor-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.zones-editor-full{
  grid-column: 1 / -1;
}

/* Responsive */
@media (max-width: 1100px){
  .zones-mode-grid{ grid-template-columns: 1fr; }
  .zones-tools-grid{ grid-template-columns: 1fr; }
  .zones-tools-left{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .zones-tools-right{ justify-content: flex-start; }
}

@media (max-width: 720px){
  .zones-tools-left{ grid-template-columns: 1fr; }
  .zones-editor-grid{ grid-template-columns: 1fr; }
}

/* Zones: tidy header actions */
.zones-actions{
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* System Mode: buttons row */
.zones-mode-actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* Status pill block in the header */
.zones-mode-status{
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  border-radius: 14px;
  padding: 10px 12px;
  min-width: 260px;
}

/* On small widths, let status stack nicely */
@media (max-width: 900px){
  .zones-mode-status{ min-width: 0; width: 100%; margin-top: 10px; }
  .card-head.row-between{ align-items: flex-start; }
}

/* Make the card a positioning context */
.zones-mode-card{
  position: relative;
}

/* Pin to top-right */
.zones-mode-status--topright{
  position: absolute;
  top: 14px;
  right: 14px;
  margin: 0;
}

/* Ensure the header text doesn’t run under the status block */
.zones-mode-card .card-head{
  padding-right: 320px; /* adjust if your status block is wider/narrower */
}

/* Responsive: stack status normally on small screens */
@media (max-width: 900px){
  .zones-mode-status--topright{
    position: static;
    margin-bottom: 10px;
  }
  .zones-mode-card .card-head{
    padding-right: 0;
  }
}


.content-card .card-head .card-title .zones-actions .zones-tools-grid{
  margin-bottom: 12px;
  margin-top: 12px;
  
}

.td-actions{ text-align:right; white-space:nowrap; }

.td-wrap{ white-space:normal; word-break:break-word; }

.td-mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

.btn-xs{ padding:6px 10px; font-size:12px; }


.zone-subcard{
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  border-radius: 16px;
  padding: 12px;
}

.subcard-head{
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.subcard-title{
  font-weight: 700;
  font-size: 14px;
}

.zone-services-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.svc-toggle{
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.12);
}

.svc-title{ font-weight: 700; font-size: 13px; }
.svc-desc{ font-size: 12px; line-height: 1.3; }

.zone-audio-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (max-width: 900px){
  .zone-services-grid{ grid-template-columns: 1fr; }

/* ===== New Service Toggle Buttons (Checkbox Style) ===== */
.service-toggle-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.18s ease-out;
  flex: 1;
  min-width: 200px;
}

.service-toggle-btn:hover {
  border-color: rgba(79, 140, 255, 0.4);
  background: rgba(79, 140, 255, 0.08);
}

.service-toggle-btn input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.service-toggle-btn input[type="checkbox"]:checked {
  accent-color: var(--accent);
}

.service-toggle-btn input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.service-toggle-btn:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.7;
}

.service-toggle-btn:has(input:checked) {
  border-color: rgba(79, 140, 255, 0.6);
  background: rgba(79, 140, 255, 0.12);
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.15) inset;
}

.service-btn-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.service-btn-content strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.service-btn-content .muted {
  font-size: 12px;
  line-height: 1.3;
}

/* ===== Service Status Grid ===== */
.service-status-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.service-status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.service-status-item .status-label {
  font-weight: 600;
  min-width: 60px;
  color: var(--text-muted);
}

.service-status-item .pill {
  font-size: 11px;
  padding: 4px 10px;
}
}

/* Excel-like grid */
.table-grid{
  width: 100%;
  table-layout: fixed;               /* critical for column alignment */
  border-collapse: separate;
  border-spacing: 0;
}

.table-grid th,
.table-grid td{
  vertical-align: middle;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  border-right: 1px solid rgba(255,255,255,0.06); /* grid lines */
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-grid th:last-child,
.table-grid td:last-child{
  border-right: none;
}

.table-grid thead th{
  position: sticky;                  /* optional but very “excel” */
  top: 0;
  background: rgba(12,16,26,0.92);
  backdrop-filter: blur(6px);
  z-index: 1;
}

.th-actions{ text-align: right; }

.td-actions{
  text-align: right;
  white-space: nowrap;
}

.ta-left  { text-align: left; }
.ta-center{ text-align: center; }
.ta-right { text-align: right; }


/* Members should wrap instead of forcing columns to shift */
.td-wrap{
  white-space: normal;
  word-break: break-word;
}

/* Optional: make ID/Source look like “spreadsheet values” */
.td-mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Groups editor layout */
.groups-editor-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 900px){
  .groups-editor-grid{ grid-template-columns: 1fr; }
}

/* Zone assignment list */
.group-zones-toolbar{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

@media (max-width: 720px){
  .group-zones-toolbar{ grid-template-columns: 1fr; }
}

.group-zone-list{
  max-height: 260px;            /* scrollable list */
  overflow: auto;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(0,0,0,0.12);
  padding: 8px;
}

.group-zone-item{
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
}

.group-zone-item:hover{
  background: rgba(255,255,255,0.03);
}

.group-zone-meta{
  font-size: 12px;
}

.badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  font-size: 12px;
}

.ta-center{ text-align:center; }
.ta-right{ text-align:right; }

.page-grid{
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 12px;
}

@media (max-width: 1100px){
  .page-grid{ grid-template-columns: 1fr; }
}

.targets-tools{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

@media (max-width: 900px){
  .targets-tools{ grid-template-columns: 1fr; }
}

.targets-lists{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 900px){
  .targets-lists{ grid-template-columns: 1fr; }
}

.pick-list{
  max-height: 420px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(0,0,0,0.12);
  padding: 8px;
}

.pick-item{
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
}

.pick-item:hover{ background: rgba(255,255,255,0.03); }

.pick-meta{ font-size: 12px; }

.pick-list--selected .pick-item{
  background: rgba(255,255,255,0.03);
}

.btn-row{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.method-grid{
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 12px;
}

@media (max-width: 900px){
  .method-grid{ grid-template-columns: 1fr; }
}

/* Schedule layout */
.schedule-grid{
  display:grid;
  grid-template-columns: 1.35fr 1fr;
  gap:12px;
}
@media (max-width: 1100px){
  .schedule-grid{ grid-template-columns: 1fr; }
}

.calendar-head{
  display:grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap:8px;
  padding: 4px 2px 10px;
}
.calendar-dow{
  font-size:12px;
  color: rgba(255,255,255,0.72);
  text-align:center;
}

.calendar-grid{
  display:grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap:8px;
}

.cal-cell{
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  background: rgba(0,0,0,0.10);
  min-height: 120px;
  padding: 8px 10px;
  cursor: pointer;
}
.cal-cell:hover{ background: rgba(255,255,255,0.03); }

.cal-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.cal-day{
  font-weight: 600;
  font-size: 13px;
}
.cal-muted{ color: rgba(255,255,255,0.45); }

.cal-chips{
  margin-top: 8px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.cal-chip{
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  background: rgba(255,255,255,0.03);
}
.cal-chip small{ color: rgba(255,255,255,0.65); }
.cal-chip-audio{ border-color: rgba(80, 190, 255, 0.35); }
.cal-chip-video{ border-color: rgba(180, 120, 255, 0.35); }
.cal-chip-disabled{ opacity: 0.45; }

.agenda-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.agenda-item{
  border:1px solid rgba(255,255,255,0.08);
  border-radius:16px;
  padding:10px 12px;
  background: rgba(0,0,0,0.10);
}
.agenda-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.agenda-title{ font-weight: 650; }
.agenda-meta{ font-size: 12px; color: rgba(255,255,255,0.65); margin-top:4px; }
.agenda-actions{ display:flex; gap:8px; align-items:center; }

.modal-wide{ max-width: 980px; width: min(980px, 95vw); }

.sch-form-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 900px){
  .sch-form-grid{ grid-template-columns: 1fr; }
}

.sch-weekdays{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}
.chk{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  font-size: 12px;
  color: rgba(255,255,255,0.82);
}

.spacer { height: 12px; }  /* change 12px to whatever gap you want */
.spacer-sm { height: 8px; }
.spacer-md { height: 12px; }
.spacer-lg { height: 20px; }

.video-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:10px;
}
@media (max-width: 1000px){
  .video-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.video-tile{
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.10);
  min-height: 110px;
}
.video-tile video{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}
.video-tile .tag{
  position:absolute;
  left:8px;
  bottom:8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.12);
}

/* PIP stage */
.pip-stage{
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  height: 420px;
}

.pip-main{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
  background: rgba(0,0,0,0.25);
}

.pip-local{
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 180px;
  height: 120px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.25);
}

.pip-thumbs{
  position: absolute;
  left: 12px;
  bottom: 12px;
  right: 210px; /* leaves space for local PIP tile */
  display:flex;
  gap:10px;
  overflow-x:auto;
  padding: 8px;
  border-radius: 14px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(6px);
}

.pip-thumb{
  flex: 0 0 auto;
  width: 150px;
  height: 90px;
  border-radius: 12px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  position: relative;
  cursor: pointer;
}
.pip-thumb video{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}
.pip-thumb .tag{
  position:absolute;
  left:8px;
  bottom:8px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.12);
}

/* Excel-like strict table behavior */
.table-fixed{ table-layout: fixed; width: 100%; }
.table-tight td, .table-tight th{ padding-top: 10px; padding-bottom: 10px; }

/* Cell alignment helpers */
.cell-left{ text-align: left; }
.cell-center{ text-align: center; }
.cell-right{ text-align: right; }
.cell-mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

/* Prevent row height jumps from long text */
.cell-clip{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Actions stay in-grid and non-wrapping */
.cell-actions{
  display: inline-flex;
  gap: 8px;
  justify-content: flex-end;
  white-space: nowrap;
}

.progress{
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.12);
}
.progress-bar{
  height: 100%;
  width: 0%;
  background: rgba(99,102,241,0.9);
}

.hidden{ display: none !important; }

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
}

.btn-icon:hover {
  color: var(--text-primary);
}

/* Small button variant */
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* Data table styles */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
  background: var(--bg-elevated-soft);
}

/* Spinner for loading states */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Warning/OK color variants */
.dot-ok { background: #4ade80; box-shadow: 0 0 8px rgba(74, 222, 128, 0.5); }
.dot-warn { background: #facc15; box-shadow: 0 0 8px rgba(250, 204, 21, 0.5); }
.dot-bad, .dot-danger { background: #f87171; box-shadow: 0 0 8px rgba(248, 113, 113, 0.5); }

/* Additional button variants */
.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #ff6b6b;
}

.btn-success {
  background: #4ade80;
  color: #0b0c10;
}

.btn-success:hover {
  background: #5ee891;
}

/* ===== LIVEKIT CLASSROOM SESSION STYLES ===== */

/* Connection Quality Indicator */
.conn-quality {
  display: inline-flex;
  gap: 2px;
  align-items: flex-end;
  height: 16px;
  padding: 2px;
}

.conn-quality .quality-bar {
  width: 4px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: background 0.2s, height 0.2s;
}

.conn-quality .quality-bar:nth-child(1) { height: 4px; }
.conn-quality .quality-bar:nth-child(2) { height: 7px; }
.conn-quality .quality-bar:nth-child(3) { height: 10px; }
.conn-quality .quality-bar:nth-child(4) { height: 13px; }

.conn-quality.quality-excellent .quality-bar { background: #4ade80; }
.conn-quality.quality-good .quality-bar:nth-child(-n+3) { background: #4ade80; }
.conn-quality.quality-fair .quality-bar:nth-child(-n+2) { background: #facc15; }
.conn-quality.quality-poor .quality-bar:nth-child(1) { background: #f87171; }

/* Icon buttons */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.btn-icon svg {
  flex-shrink: 0;
}

.btn-icon.active {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.btn-icon.active:hover {
  background: #ff6b6b;
}

.btn-icon.hand-raised {
  background: #facc15;
  border-color: #facc15;
  color: #0b0c10;
}

/* Speaker indicator overlay */
.speaker-indicator {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(74, 222, 128, 0.9);
  color: #0b0c10;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  animation: pulse-speaker 1.5s ease-in-out infinite;
}

@keyframes pulse-speaker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Screen share badge */
.screen-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}

/* Participant list */
.participant-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.participant-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.participant-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.participant-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.participant-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.participant-name.is-you {
  color: var(--accent);
}

.participant-badges {
  display: flex;
  gap: 4px;
  align-items: center;
}

.participant-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
}

.participant-badge.role-teacher {
  background: rgba(250, 204, 21, 0.2);
  color: #facc15;
}

.participant-badge.role-admin {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

.participant-badge.hand-raised {
  background: rgba(250, 204, 21, 0.3);
  color: #facc15;
}

.participant-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.participant-actions .btn-xs {
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.participant-muted {
  opacity: 0.5;
}

/* Speaking indicator on participant */
.participant-item.speaking {
  border-color: #4ade80;
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.3);
}

/* Chat messages */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-message-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.chat-message-sender {
  font-weight: 600;
  color: var(--accent);
}

.chat-message-time {
  color: var(--text-muted);
}

.chat-message-body {
  font-size: 13px;
  line-height: 1.4;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  word-wrap: break-word;
}

.chat-message.is-self .chat-message-body {
  background: var(--accent-soft);
  border-color: rgba(79, 140, 255, 0.3);
}

.chat-message.is-system .chat-message-body {
  background: rgba(250, 204, 21, 0.1);
  border-color: rgba(250, 204, 21, 0.2);
  font-style: italic;
  color: var(--text-muted);
}

/* Raised hands list */
.hand-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.2);
  border-radius: 6px;
  margin-bottom: 6px;
}

.hand-item-name {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hand-item-name::before {
  content: "✋";
}

/* Active speaker highlight on thumbnail */
.pip-thumb.speaking {
  border-color: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.4);
}

/* 3-column grid for device selection */
.net-row3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .net-row3 {
    grid-template-columns: 1fr;
  }

  .session-layout {
    flex-direction: column !important;
  }

  .session-sidebar {
    max-width: none !important;
  }
}

/* Recording indicator */
.btn-icon.recording {
  background: var(--danger);
  border-color: var(--danger);
  animation: pulse-record 1s ease-in-out infinite;
}

@keyframes pulse-record {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Hidden utility */
.hidden {
  display: none !important;
}
