:root {
  --sidebar-bg: #0c2340;
  --sidebar-hover: #163a6b;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --page-bg: #f1f5f9;
  --text: #1e293b;
  --login-bg: #07162c;
  --login-card: #0c2340;
  --login-green: #12b76a;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, sans-serif; background: var(--page-bg); color: var(--text); }

/* Login — mẫu fmLogin.html */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--login-bg) url("../image/hinhnen.png") center/cover no-repeat;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 410px;
  background: var(--login-card);
  border: 1px solid rgba(30, 58, 138, 0.5);
  border-radius: 16px;
  padding: 44px 40px 28px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.45);
  color: #fff;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo { width: 144px; height: auto; object-fit: contain; margin-bottom: 12px; }
.login-title-blue {
  margin: 0;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #38bdf8;
}
.login-title-sub {
  margin: 6px 0 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cbd5e1;
}
.login-form { width: 100%; }
.login-field { margin-bottom: 16px; }
.login-field label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 6px;
}
.login-field input {
  width: 100%;
  border: 1px solid rgba(100, 116, 139, 0.45);
  border-radius: 8px;
  padding: 12px 14px;
  background: #1e2e4a;
  color: #f1f5f9;
  font-size: 14px;
  font-weight: 600;
}
.login-field input:focus {
  outline: none;
  box-shadow: 0 0 0 2px #0ea5e9;
}
.login-field input::placeholder { color: #64748b; font-weight: 500; }
.login-pwd-wrap { position: relative; }
.login-pwd-wrap input { padding-right: 42px; }
.login-pwd-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  z-index: 2;
}
.login-pwd-toggle:hover { color: #e2e8f0; }
.login-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 12px;
}
.login-remember { display: flex; align-items: center; gap: 6px; cursor: pointer; margin: 0; }
.login-remember input { width: 14px; height: 14px; accent-color: var(--login-green); }
.login-forgot { color: #94a3b8; text-decoration: none; }
.login-forgot:hover { color: #e2e8f0; }
.login-advanced { margin-bottom: 12px; color: #64748b; font-size: 11px; }
.login-advanced summary { cursor: pointer; }
.btn-login-green {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 12px;
  background: var(--login-green);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 20px rgba(18, 183, 106, 0.25);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-login-green:hover { background: #10a35e; }
.login-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(30, 58, 138, 0.4);
  text-align: center;
  font-size: 10px;
  color: #94a3b8;
  letter-spacing: 0.06em;
}

/* Shell */
.app-shell { display: flex; min-height: 100vh; height: 100vh; overflow: hidden; }
.sidebar {
  width: 256px;
  background: var(--sidebar-bg);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
}
.sidebar-brand-col {
  padding: 0 10px 6px;
  text-align: center;
  border-bottom: 1px solid rgba(30, 58, 138, 0.6);
}
.sidebar-logo {
  width: 120px;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  object-position: top center;
}
.sidebar-brand-col h2 {
  margin: -2px 0 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1.25;
}
.sidebar-brand-col h3 {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #bfdbfe;
  line-height: 1.25;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 2px 0 8px; }
.sidebar-nav > .nav-link:first-child { margin-top: 0; }
.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  margin: 2px 8px;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 12px;
  border: none;
  background: none;
  width: calc(100% - 16px);
  text-align: left;
  cursor: pointer;
}
.sidebar .nav-link:hover { background: #1e3a8a; color: #fff; }
.sidebar .nav-link.active { background: var(--accent); color: #fff; font-weight: 600; }
.sidebar .nav-link.sub { padding-left: 28px; font-size: 11px; color: #94a3b8; margin-left: 16px; width: calc(100% - 24px); }
.sidebar .nav-link.sub .dot { font-size: 4px; }
.sidebar .nav-link.nav-toggle { justify-content: space-between; }
.sidebar .nav-link.nav-toggle .chev { font-size: 10px; opacity: 0.7; }
.sidebar .nav-link.nav-disabled { opacity: 0.55; cursor: not-allowed; }
.sub-nav { display: none; }
.sub-nav.open { display: block; }
.sidebar-foot {
  padding: 16px;
  border-top: 1px solid rgba(51, 65, 85, 0.8);
  text-align: center;
}
.sidebar-user { font-size: 11px; color: #e2e8f0; margin-bottom: 4px; }
.sidebar-mac { color: #64748b; margin-bottom: 8px; }
.sidebar-mac code { color: #38bdf8; }
.somics-mark { display: block; color: #64748b; font-size: 9px; font-weight: 700; letter-spacing: 0.1em; margin-bottom: 8px; }
.btn-logout {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  background: #e11d48;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-logout:hover { background: #be123c; }

.main-content.workspace {
  flex: 1;
  padding: 16px;
  overflow: auto;
  background: var(--page-bg);
  min-width: 0;
}
.screen { display: none; }
.screen.active { display: block; height: 100%; }

/* Dashboard — giamsattructuyen */
.dash-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-shrink: 0; }
.dash-title { margin: 0; font-size: 14px; font-weight: 900; color: #1e293b; letter-spacing: 0.04em; text-transform: uppercase; }
.dash-actions { display: flex; gap: 8px; }
.btn-emergency {
  background: #203cc4;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.btn-emergency:hover { background: #1a32a3; color: #fff; }
.btn-emergency i { animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.btn-dash-options {
  background: #203cc4;
  color: #fff;
  border: none;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.btn-dash-options:hover { background: #1a32a3; color: #fff; }

/* Modal Tùy chọn — chất lượng âm thanh */
.opt-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.opt-modal {
  background: #fff;
  border-radius: 8px;
  width: min(420px, 96vw);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.opt-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}
.opt-modal-head h5 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}
.opt-modal-close {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 18px;
  line-height: 1;
  padding: 4px;
}
.opt-modal-close:hover { color: #64748b; }
.opt-modal-body { padding: 20px 20px 8px; }
.opt-bitrate-list { display: flex; flex-direction: column; gap: 14px; }
.opt-bitrate-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  cursor: pointer;
  font-size: 14px;
  color: #334155;
}
.opt-bitrate-item input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #2563eb;
  cursor: pointer;
}
.opt-bitrate-label { user-select: none; }
.opt-note {
  margin: 18px 0 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}
.opt-modal-foot {
  padding: 14px 20px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn-opt-cancel {
  background: #fff;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  padding: 8px 18px;
}
.btn-opt-cancel:hover { background: #f8fafc; }
.btn-opt-ok {
  background: #2563eb;
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  padding: 8px 22px;
}
.btn-opt-ok:hover { background: #1d4ed8; color: #fff; }
.btn-opt-ok:disabled { opacity: 0.65; }
.btn-dash-options.btn-sm {
  font-size: 11px;
  padding: 7px 12px;
}

.dash-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 1200px) { .dash-metrics { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .dash-metrics { grid-template-columns: 1fr; } }

.metric-card {
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.metric-card-link {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.metric-card-link:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}
.metric-card-link.metric-green:hover { border-color: #6ee7b7; box-shadow: 0 4px 14px rgba(5, 150, 105, 0.15); }
.metric-card-link.metric-red:hover { border-color: #fca5a5; box-shadow: 0 4px 14px rgba(220, 38, 38, 0.12); }
.metric-card-link:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}
button.metric-card {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}
.metric-card.metric-split { justify-content: space-between; }
.metric-green { background: #ecfdf5; border-color: #bbf7d0; }
.metric-red { background: #fef2f2; border-color: #fecaca; }
.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.bg-blue-soft { background: #eff6ff; color: #2563eb; }
.bg-sky-soft { background: #f0f9ff; color: #0284c7; }
.bg-purple-soft { background: #faf5ff; color: #9333ea; }
.bg-violet-soft { background: #f5f3ff; color: #7c3aed; }
.metric-label { font-size: 10px; font-weight: 700; color: #64748b; text-transform: uppercase; line-height: 1.2; }
.metric-value { font-size: 22px; font-weight: 900; color: #334155; line-height: 1.1; margin-top: 4px; }
.metric-sub-right { font-size: 10px; color: #059669; font-weight: 600; text-align: right; line-height: 1.5; }
.metric-sub-right.red { color: #e11d48; }
.metric-warn { font-size: 20px; color: #f43f5e; }

.dash-main { display: flex; gap: 12px; min-height: calc(100vh - 240px); }
.dash-map-panel {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 480px;
}
.panel-title { font-size: 12px; font-weight: 800; color: #1e293b; margin-bottom: 10px; border-bottom: 1px solid #e2e8f0; padding-bottom: 8px; }
.dash-side-panel {
  width: 320px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 16px;
  overflow-y: auto;
}
.side-title { font-size: 14px; font-weight: 900; color: #1e293b; border-bottom: 2px solid #e2e8f0; padding-bottom: 8px; text-transform: uppercase; }
.side-block { padding: 10px 0; }
.side-row { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; }
.side-row strong { color: #2563eb; }
.side-sub { font-size: 11px; margin: 4px 0 0 12px; color: #64748b; font-weight: 600; }
.device-catalog-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-top: 1px solid #e2e8f0;
}
.device-catalog-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 9px 8px 9px 0;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.device-catalog-item:hover { background: #f8fafc; }
.device-catalog-item.active { background: #ebf5ff; }
.device-catalog-bar {
  flex: 0 0 4px;
  align-self: stretch;
  min-height: 28px;
  border-radius: 0 2px 2px 0;
}
.device-catalog-bar.on { background: #22c55e; }
.device-catalog-bar.off { background: #ef4444; }
.device-catalog-bar.power { background: #f97316; }
.device-catalog-item i {
  font-size: 14px;
  margin-top: 2px;
  flex-shrink: 0;
  width: 16px;
  color: #94a3b8;
}
.device-catalog-name {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  line-height: 1.45;
  word-break: break-word;
}

/* Cụm loa — bảng toàn màn hình */
.cl-main-panel { width: 100%; min-width: 0; }

.dash-dev-overlay {
  position: fixed; inset: 0; z-index: 2500; background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.dash-dev-dialog {
  background: #fff; border-radius: 12px; width: min(920px, 100%); max-height: 92vh;
  overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 24px 48px rgba(0,0,0,.2);
}
.dash-dev-head-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; background: #0c2340; color: #fff;
}
.dash-dev-head-bar h5 { margin: 0; font-size: 14px; font-weight: 800; }
.dash-dev-hero {
  padding: 20px 22px; color: #fff;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}
.dash-dev-hero.offline { background: linear-gradient(135deg, #64748b 0%, #475569 100%); }
.dash-dev-hero-icon {
  width: 72px; height: 72px; border-radius: 12px; background: rgba(255,255,255,.95);
  display: flex; align-items: center; justify-content: center; font-size: 32px;
  color: #059669; margin-bottom: 14px; float: left; margin-right: 18px;
}
.dash-dev-hero.offline .dash-dev-hero-icon { color: #64748b; }
.dash-dev-hero-top { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.dash-dev-name { margin: 0; font-size: 18px; font-weight: 900; flex: 1 1 auto; }
.dash-dev-badge {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; white-space: nowrap;
}
.dash-dev-badge.on { background: rgba(255,255,255,.25); color: #fff; }
.dash-dev-badge.idle { background: rgba(255,255,255,.15); color: #e2e8f0; }
.dash-dev-badge.off { background: rgba(0,0,0,.2); color: #f1f5f9; }
.dash-dev-badge.power { background: rgba(232, 93, 4, .92); color: #fff; }
.dash-dev-hero.powerloss { background: linear-gradient(135deg, #9a3412 0%, #c2410c 55%, #ea580c 100%); }
.dash-dev-hero-icon.speaker-on { color: #bbf7d0; filter: drop-shadow(0 0 8px rgba(187, 247, 208, 0.85)); }
.dash-dev-hero.playing { background: linear-gradient(135deg, #15803d 0%, #16a34a 100%); }
.dash-dev-maps { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; clear: both; }
.btn-gmaps {
  background: #fff !important; color: #047857 !important; font-weight: 700; font-size: 11px;
  border: none; border-radius: 6px; padding: 6px 12px;
}
.btn-gmaps-dir {
  background: rgba(255,255,255,.2) !important; color: #fff !important; font-weight: 700; font-size: 11px;
  border: 1px solid rgba(255,255,255,.45); border-radius: 6px; padding: 6px 12px;
}
.btn-gmaps:hover { background: #ecfdf5 !important; }
.btn-gmaps-dir:hover { background: rgba(255,255,255,.35) !important; }
.dash-dev-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 16px;
  clear: both;
}
.dash-dev-field .lbl { display: block; font-size: 10px; font-weight: 700; opacity: .85; text-transform: uppercase; }
.dash-dev-field .val { display: block; font-size: 13px; font-weight: 600; word-break: break-word; }
.dash-dev-field-vol { min-width: 200px; }
.dash-vol-control {
  display: flex; align-items: center; gap: 8px; margin-top: 4px;
}
.dash-vol-control .fa-volume-up { flex: 0 0 auto; font-size: 13px; color: rgba(255,255,255,.92); }
.dash-vol-slider {
  flex: 1 1 auto; min-width: 72px; height: 4px; margin: 0;
  accent-color: #fff; cursor: pointer;
}
.dash-vol-slider:disabled { opacity: 0.45; cursor: not-allowed; }
.dash-vol-val { flex: 0 0 auto; min-width: 36px; font-weight: 700; font-size: 12px; color: #fff; }
.dash-dev-body { padding: 16px 22px; overflow-y: auto; }
.dash-dev-play {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px 14px;
}
.dash-dev-play-label { font-weight: 800; font-size: 12px; color: #059669; margin-bottom: 6px; }
.dash-dev-audio {
  width: 100%; height: 40px; border-radius: 8px;
  background: #fff;
}
.dash-dev-audio-hint { line-height: 1.45; }
.dash-dev-play-url summary { cursor: pointer; user-select: none; }

.dash-dev-audio-monitor {
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 12px 14px;
}
.dash-audio-vu-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dash-audio-vu {
  flex: 1; height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden;
}
.dash-audio-vu-fill {
  height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: width 0.4s ease;
}
.dash-audio-vu-val { min-width: 28px; font-weight: 800; font-size: 13px; color: #166534; }
.dash-audio-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dash-audio-chip {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  border: 1px solid #cbd5e1; background: #f8fafc; color: #64748b;
}
.dash-audio-chip.on { background: #dcfce7; border-color: #86efac; color: #166534; }
.dash-audio-chip.off { background: #f1f5f9; border-color: #e2e8f0; color: #94a3b8; }
.dash-audio-warn { font-size: 12px; line-height: 1.45; padding: 8px 10px; border-radius: 6px; }
.dash-audio-warn.warn { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.dash-audio-warn.alert { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.rssi-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.rssi-excellent { background: #16a34a; color: #fff; }
.rssi-good { background: #eab308; color: #1e293b; }
.rssi-fair { background: #f97316; color: #fff; }
.rssi-poor { background: #991b1b; color: #fff; }
.signal-carrier { color: #475569; font-weight: 600; }
.signal-line .rssi-badge { margin-top: 2px; }
.signal-cell { min-width: 120px; }
.dev-map { flex: 1; min-height: 400px; border-radius: 8px; border: 1px solid #e2e8f0; }

/* Editorial / forms */
.page-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.breadcrumb-somics { font-size: 12px; color: #64748b; margin-bottom: 8px; }
.breadcrumb-somics a { color: #2563eb; text-decoration: none; }
.bytech-tabs .nav-link { color: #2c5282; border: 1px solid #cbd5e1; border-radius: 0; background: #f0f4f8; margin-right: 2px; font-size: 12px; }
.bytech-tabs .nav-link.active { color: #fff; background: #2563eb; border-color: #2563eb; font-weight: 600; }
.btn-somics-blue { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-somics-blue:hover { background: #1d4ed8; color: #fff; }
.em-region-picker {
  position: relative;
  max-width: 480px;
}
.em-region-picker-trigger {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  width: 100%;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.em-region-picker-trigger:hover,
.em-region-picker-trigger:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}
.em-region-picker-label { font-size: 14px; color: #495057; }
.em-region-picker-value {
  font-size: 15px;
  font-weight: 700;
  color: #6c757d;
  flex: 1;
}
.em-region-picker-value.is-selected { color: #1e40af; }
.em-region-picker-chevron {
  color: #6c757d;
  font-size: 12px;
  margin-left: auto;
}
.em-region-picker-panel {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}
.em-region-picker-panel.open { display: block; }
.em-region-picker-province-wrap {
  padding: 8px;
  border-bottom: 1px solid #eee;
}
.em-region-picker-search-wrap {
  padding: 8px;
  border-bottom: 1px solid #eee;
}
.em-region-picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
}
.em-region-picker-item {
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
}
.em-region-picker-item:hover { background: #eff6ff; }
.em-region-picker-item.selected {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 600;
}
.em-region-picker-empty {
  padding: 14px;
  font-size: 13px;
  color: #6c757d;
  text-align: center;
}
.em-region-province-hint { font-size: 13px; color: #6c757d; }
.em-init-banner {
  max-width: 960px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: #9a3412;
}
.em-workflow-hint { background: #eff6ff; border-left: 4px solid #2563eb; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; border-radius: 0 6px 6px 0; }
.em-config-bar { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; margin-bottom: 12px; }
.em-config-bar span { background: #fff; border: 1px solid #dee2e6; border-radius: 4px; padding: 6px 10px; }
.em-bulletin-list { max-height: 280px; overflow-y: auto; border: 1px solid #dee2e6; border-radius: 6px; background: #fff; }
.em-bulletin-row { display: flex; border-bottom: 1px solid #eee; }
.em-bulletin-row.selected { background: #eff6ff; }
.em-bulletin-body { flex: 1; text-align: left; border: none; background: transparent; padding: 10px 12px; font-size: 13px; cursor: pointer; }
.em-bulletin-del { margin: 6px 8px; align-self: center; }
.editorial-table thead { background: #0c2340; color: #fff; }
.ed-col-actions-wrap { white-space: nowrap; width: 1%; }
.ed-col-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: nowrap;
}
.ed-col-actions .btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
}
.ed-act-play {
  color: #2563eb;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
}
.ed-act-play:hover {
  background: #dbeafe;
  color: #1d4ed8;
}
.ed-act-submit {
  color: #fff;
  border: 1px solid #1d4ed8;
  background: #2563eb;
}
.ed-act-submit:hover {
  background: #1d4ed8;
  color: #fff;
}
.ed-act-unapprove {
  color: #15803d;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
}
.ed-act-unapprove:hover {
  background: #dcfce7;
  color: #166534;
}
.ed-act-del {
  color: #dc2626;
  border: 1px solid #fecaca;
  background: #fef2f2;
}
.ed-act-del:hover {
  background: #fee2e2;
  color: #b91c1c;
}
.upload-zone { border: 2px dashed #cbd5e0; border-radius: 8px; padding: 28px; text-align: center; background: #f8fafc; }
.em-result-ok { color: #155724; background: #d4edda; padding: 12px; border-radius: 4px; }
.em-result-err { color: #721c24; background: #f8d7da; padding: 12px; border-radius: 4px; }

/* Danh sách thiết bị */
.dev-page { font-size: 13px; }
.dev-page-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.dev-page-top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dev-table-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.dev-col-dropdown-hidden .btn#btnDevColToggle { display: none; }
.dev-col-dropdown-hidden .dev-col-menu { right: 0; left: auto; }
.dev-table {
  border-collapse: collapse;
  width: 100%;
  table-layout: auto;
}
.dev-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #0c2340 !important;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  padding: 9px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}
.dev-table tbody td {
  border: 1px solid #dee2e6 !important;
  padding: 8px 10px;
  vertical-align: middle;
  font-size: 12px;
  background: #fff;
  line-height: 1.35;
}
.dev-table tbody tr:nth-child(even) td { background: #f8fafc; }
.dev-table tbody tr:hover td { background: #eff6ff; }
.dev-table-wrap { max-height: calc(100vh - 280px); overflow: auto; border: 1px solid #94a3b8; border-radius: 8px; background: #fff; }

.dev-col-stt { width: 44px; min-width: 44px; text-align: center; }
.dev-col-name { min-width: 130px; max-width: 200px; }
.dev-col-imei { min-width: 128px; white-space: nowrap; }
.dev-col-play_status { min-width: 88px; text-align: center; }
/* Badge trạng thái — pill (mẫu Đang kết nối), màu theo nghĩa trạng thái */
.dev-table .dev-status-badge {
  display: inline-block;
  min-width: 88px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  text-align: center;
  border: none;
}
.dev-badge-conn-on { background: #198754; color: #fff; }
.dev-badge-conn-off { background: #dc3545; color: #fff; }
.dev-badge-conn-power { background: #e85d04; color: #fff; }
.dev-badge-play-on { background: #16a34a; color: #fff; }
.dev-badge-play-window { background: #ffedd5; color: #c2410c; border: 1px solid #fdba74; }
.dev-badge-play-wait { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }
.dev-badge-play-pending { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.dev-badge-play-loading { background: #e5e7eb; color: #374151; border: 1px solid #d1d5db; }
.dev-badge-temp-ok { background: #0ea5e9; color: #fff; min-width: 64px; }
.dev-badge-temp-warn { background: #f59e0b; color: #fff; min-width: 64px; }
.dev-badge-temp-hot { background: #dc2626; color: #fff; min-width: 64px; }
.dev-col-conn { min-width: 108px; text-align: center; }
.dev-col-volume { min-width: 148px; }
.dev-col-speaker { width: 48px; min-width: 48px; text-align: center; }
.dev-col-area { min-width: 150px; max-width: 220px; }
.dev-col-temp { min-width: 68px; text-align: center; white-space: nowrap; }
.dev-col-network { min-width: 120px; }
.dev-col-overdue { min-width: 72px; text-align: center; }
.dev-col-expiry { min-width: 92px; white-space: nowrap; }
.dev-col-updated { min-width: 108px; white-space: nowrap; font-size: 11px !important; }
.dev-col-contractor { min-width: 88px; font-size: 11px !important; }
.dev-col-manufacturer { min-width: 88px; font-size: 11px !important; }
.dev-col-config { min-width: 120px; max-width: 160px; font-size: 11px !important; }
.dev-col-software { min-width: 76px; font-size: 11px !important; }
.dev-col-hardware { min-width: 76px; font-size: 11px !important; }
.dev-col-actions { min-width: 100px; text-align: center; white-space: nowrap; }

.dev-imei-code {
  font-size: 11px;
  color: #be123c;
  background: #fff1f2;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #fecdd3;
}
.dev-name-link { font-weight: 700; text-decoration: none; color: #2563eb; display: inline-block; max-width: 220px; word-break: break-word; }
.dev-col-area .dev-area-cell { display: inline-flex; align-items: flex-start; gap: 4px; max-width: 240px; white-space: normal; }
.dev-col-network .signal-carrier { display: block; margin-bottom: 4px; font-size: 11px; line-height: 1.3; }
.dev-col-network .rssi-badge { display: inline-block; margin-top: 2px; }
.dev-vol-cell { min-width: 168px; }
.dev-vol-control {
  display: flex; align-items: center; gap: 6px; min-width: 150px;
}
.dev-vol-control .fa-volume-up { flex: 0 0 auto; font-size: 13px; }
.dev-vol-slider {
  flex: 1 1 auto; width: 72px; min-width: 56px; height: 4px; margin: 0;
  accent-color: #0d6efd; cursor: pointer;
}
.dev-vol-slider:disabled { opacity: 0.45; cursor: not-allowed; }
.dev-vol-val { flex: 0 0 auto; min-width: 34px; font-weight: 600; font-size: 11px; color: #334155; }
.dev-speaker-led { display: inline-flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; }
.dev-speaker-led.on { color: #16a34a; filter: drop-shadow(0 0 4px rgba(22, 163, 74, 0.55)); }
.dev-speaker-led.off { color: #94a3b8; }

/* Quản lý bản tin */
.bt-table-wrap { max-height: calc(100vh - 300px); overflow: auto; border: 1px solid #94a3b8; border-radius: 8px; background: #fff; }
.bt-table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
}
.bt-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #0c2340 !important;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  padding: 8px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
}
.bt-table tbody td {
  border: 1px solid #dee2e6 !important;
  padding: 7px 6px;
  font-size: 11px;
  vertical-align: middle;
  background: #fff;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bt-table tbody tr:nth-child(even) td { background: #f8fafc; }
.bt-table tbody tr:hover td { background: #eff6ff; }

.bt-col-stt { width: 36px; text-align: center; }
.bt-col-title { width: 16%; text-align: left; }
.bt-col-area { width: 14%; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-col-time { width: 17%; text-align: center; font-size: 10px !important; line-height: 1.3; }
.bt-col-repeat { width: 9%; text-align: center; }
.bt-col-creator { width: 11%; text-align: center; font-size: 10px !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-col-status { width: 11%; text-align: center; }
.bt-status-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bt-status-cell .badge { font-size: 11px; }
.bt-played-at { display: block; font-size: 10px; color: #64748b; line-height: 1.2; white-space: nowrap; }
.bt-col-actions { width: 68px; text-align: center; white-space: nowrap; }

.bt-title-link {
  font-weight: 600;
  text-decoration: none;
  color: #2563eb;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bt-col-time .bt-time-line { display: block; white-space: nowrap; }
.bt-col-time .bt-time-day { display: block; font-size: 10px; color: #64748b; }
.bt-area-text { display: inline-block; max-width: calc(100% - 28px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.bt-table .btn-sm { padding: 2px 6px; font-size: 11px; }
.bt-table .badge { font-size: 10px; padding: 3px 6px; }
.bt-modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 2100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.bt-modal {
  background: #fff; border-radius: 10px; width: min(720px, 96vw); max-height: 92vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.bt-modal-wide { width: min(900px, 96vw); }
.bt-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid #e2e8f0; }
.bt-modal-head h5 { margin: 0; font-size: 16px; font-weight: 700; }
.bt-modal-close { border: none; background: transparent; font-size: 18px; color: #64748b; }
.bt-modal-body { padding: 16px 18px; overflow-y: auto; }
#modalBtProgram .bt-modal-body,
#modalBtDirect .bt-modal-body,
#modalBtAdd .bt-modal-body,
#modalBtRelay .bt-modal-body { overflow: visible; }
#modalBtProgram .bt-modal,
#modalBtDirect .bt-modal,
#modalBtAdd .bt-modal,
#modalBtRelay .bt-modal { overflow-y: auto; }
.bt-prog-add-wrap { position: relative; z-index: 30; }
.bt-prog-add-bar { position: relative; z-index: 30; margin-top: 8px; padding-top: 8px; border-top: 1px solid #e2e8f0; }
.ed-add-menu.bt-prog-add-menu { min-width: 260px; }
.bt-modal .ed-add-menu { z-index: 2200; }
#btProgAddMenu.ed-add-menu { bottom: calc(100% + 4px); top: auto; right: 0; left: auto; }
.bt-play-times-wrap .bt-play-time-row .bt-time-picker { max-width: 100%; }
.bt-play-time-add { width: 28px; height: 28px; padding: 0; line-height: 1; }
.bt-modal-foot { padding: 12px 18px; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; gap: 8px; }

.bt-badge-paused {
  background: #fce7f3;
  color: #db2777;
  font-weight: 600;
}

.bt-col-actions-icons {
  white-space: nowrap;
}
.bt-col-actions-icons .btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 2px;
  border-radius: 6px;
}
.btn-bt-play {
  color: #2563eb;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
}
.btn-bt-play:hover:not(:disabled) {
  background: #dbeafe;
  color: #1d4ed8;
}
.btn-bt-unapprove {
  color: #15803d;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
}
.btn-bt-unapprove:hover {
  background: #dcfce7;
  color: #166534;
}

.bt-listen-overlay {
  z-index: 3100;
  align-items: center;
  justify-content: center;
}
.bt-listen-modal {
  background: #fff;
  border-radius: 12px;
  width: min(420px, 92vw);
  padding: 20px 22px 18px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
}
.bt-listen-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.bt-listen-head h5 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  text-transform: uppercase;
}
.bt-listen-art {
  width: 120px;
  height: 120px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a5b4fc;
  font-size: 42px;
}
.bt-listen-audio {
  border-radius: 8px;
  background: #f8fafc;
}
.dash-dev-field-play .val {
  display: flex;
  align-items: center;
}
.dash-dev-field-play .btn-bt-play {
  width: 36px;
  height: 36px;
}

.dash-dev-field-monitor .val {
  display: flex;
  align-items: center;
  margin-top: 2px;
}
.dash-dev-field-monitor .btn-bt-play {
  width: 36px;
  height: 36px;
}

/* LED Level 2×13 nằm ngang */
.dash-dev-field-level-audio {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}
.led-level-wrap { line-height: 0; width: 100%; max-width: 220px; }
.led-level-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  grid-template-rows: repeat(2, 12px);
  gap: 2px;
  padding: 4px;
  background: #0a0a0a;
  border: 1px solid #9ca3af;
  border-radius: 2px;
  box-sizing: border-box;
  width: 100%;
}
.led-cell {
  background: #1f1f1f;
  border: 1px solid #000;
  box-sizing: border-box;
  min-width: 0;
}
.led-cell.on.zone-g { background: #4ade80; }
.led-cell.on.zone-gd { background: #22c55e; }
.led-cell.on.zone-gd2 { background: #166534; }
.led-cell.on.zone-y { background: #a16207; }
.led-cell.on.zone-r { background: #991b1b; }
.dash-monitor-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.dash-monitor-wrap .lbl {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.85;
  text-transform: uppercase;
}
.dash-monitor-wrap .btn-bt-play {
  width: 36px;
  height: 36px;
}

.bt-listen-foot {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.bt-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.bt-confirm-box {
  background: #fff;
  border-radius: 8px;
  width: min(420px, 96vw);
  padding: 28px 24px 20px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.bt-confirm-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #dbeafe;
  color: #64748b;
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bt-confirm-box h5 { font-weight: 700; margin-bottom: 8px; }
.bt-confirm-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.bt-confirm-actions .btn-cancel {
  min-width: 110px;
  border: 1px solid #2563eb;
  color: #2563eb;
  background: #fff;
}
.bt-confirm-actions .btn-ok {
  min-width: 110px;
  background: #ef4444;
  border: none;
  color: #fff;
  font-weight: 600;
}
.bt-act-toggle.btn-outline-secondary { color: #475569; border-color: #cbd5e1; }
.bt-time-input { min-height: 34px; }
.bt-time-input[type="date"],
.bt-time-input[type="time"],
.bt-time-input[type="datetime-local"] {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 10px;
  background: #fff;
}
.bt-hms-group {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 220px;
}
.bt-hms-part {
  width: 64px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.bt-hms-sep {
  font-weight: 700;
  color: #64748b;
}
.bt-time-picker {
  position: relative;
  max-width: 280px;
}
.bt-time-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 0.875rem;
  text-align: left;
}
.bt-time-picker-trigger:hover {
  border-color: #94a3b8;
}
.bt-time-picker-display {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #0f172a;
}
.bt-time-picker-icon {
  color: #64748b;
  font-size: 0.85rem;
}
.bt-time-picker-panel {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 2100;
  min-width: 240px;
  padding: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.15);
}
.bt-time-picker-panel.open {
  display: block;
}
.bt-time-picker-cols {
  display: flex;
  gap: 4px;
}
.bt-time-picker-col {
  flex: 1;
  min-width: 0;
  position: relative;
}
.bt-time-picker-viewport {
  height: 160px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  position: relative;
}
.bt-time-picker-viewport::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 36px;
  border-top: 2px solid #2563eb;
  border-bottom: 2px solid #2563eb;
  background: rgba(37, 99, 235, 0.1);
  pointer-events: none;
  z-index: 1;
}
.bt-time-picker-scroll {
  display: flex;
  flex-direction: column;
}
.bt-tp-spacer {
  height: 64px;
  flex-shrink: 0;
}
.bt-tp-item {
  height: 36px;
  line-height: 36px;
  text-align: center;
  scroll-snap-align: center;
  cursor: pointer;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  user-select: none;
  font-size: 0.95rem;
  transition: color 0.12s, font-weight 0.12s, transform 0.12s;
  position: relative;
  z-index: 2;
}
.bt-tp-item:hover {
  color: #475569;
}
.bt-tp-item.active {
  color: #1e3a8a;
  font-weight: 800;
  font-size: 1.15rem;
  transform: scale(1.06);
}
.em-datetime-block .bt-time-picker,
.bt-modal-body .bt-time-picker {
  max-width: 100%;
}
.em-datetime-block .bt-time-picker-ok {
  min-height: 36px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.dev-name-link { font-weight: 700; text-decoration: none; }
.dev-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; flex-wrap: wrap; }
.dev-modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 2000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.dev-modal {
  background: #fff; border-radius: 12px; width: min(920px, 100%); max-height: 90vh; overflow: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,.15);
}
.dev-modal-wide { width: min(1040px, 100%); }
.dev-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid #e2e8f0; }
.dev-modal-head h5 { margin: 0; font-weight: 800; }
.dev-modal-body { padding: 16px 18px; }
.dev-modal-toolbar { padding: 10px 18px; text-align: right; border-bottom: 1px solid #f1f5f9; }
.dev-modal-foot { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid #e2e8f0; padding-top: 12px; }

.dev-toolbar-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
.dev-col-dropdown { position: relative; display: inline-block; }
.dev-col-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 1200;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 10px 12px;
  min-width: 220px;
  max-height: 360px;
  overflow-y: auto;
}
.dev-col-menu.open { display: block; }
.dev-col-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.dev-col-item input { accent-color: #2563eb; }
.dev-act-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  margin: 0 2px;
  text-decoration: none;
  font-size: 13px;
}
.dev-act-btn.dev-act-info { background: #dbeafe; color: #2563eb; }
.dev-act-btn.dev-act-edit { background: #fef3c7; color: #d97706; }
.dev-act-btn.dev-act-map { background: #dbeafe; color: #2563eb; }
.dev-act-btn.dev-act-map.disabled { opacity: 0.4; pointer-events: none; }
.dev-act-btn.dev-act-del { background: #fee2e2; color: #dc2626; }
.dev-area-cell { white-space: nowrap; }
.dev-page-group { flex-wrap: wrap; }

/* Biên tập — panel & modal upload audio */
.role-commune .ed-side-nav { display: none; }
.role-commune .ed-main {
  border-left: 1px solid #e2e8f0;
  border-radius: 10px;
}
.ed-layout {
  display: flex;
  gap: 0;
  min-height: 480px;
  align-items: flex-start;
}
.ed-side-nav {
  flex: 0 0 220px;
  background: linear-gradient(180deg, #14532d 0%, #166534 100%);
  border-radius: 10px 0 0 10px;
  padding: 8px 0;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}
.ed-side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: #ecfdf5;
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}
.ed-side-link i {
  width: 18px;
  text-align: center;
  font-size: 12px;
  opacity: 0.9;
}
.ed-side-link:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.ed-side-link.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 700;
}
.ed-main {
  flex: 1;
  min-width: 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: none;
  border-radius: 0 10px 10px 0;
  padding: 12px;
}
.ed-live-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
@media (max-width: 900px) {
  .ed-layout { flex-direction: column; }
  .ed-side-nav {
    flex: none;
    width: 100%;
    border-radius: 10px 10px 0 0;
    display: flex;
    flex-wrap: wrap;
    padding: 6px;
    gap: 4px;
  }
  .ed-side-link {
    width: auto;
    flex: 1 1 45%;
    border-radius: 6px;
    padding: 8px 10px;
  }
  .ed-main {
    border-left: 1px solid #e2e8f0;
    border-radius: 0 0 10px 10px;
  }
}
.ed-panel-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.ed-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ed-panel-head h4 { margin: 0; font-size: 16px; font-weight: 900; color: #1e293b; }
.ed-add-dropdown { position: relative; }
.ed-add-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 220px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 40;
  overflow: hidden;
}
.ed-add-menu.open { display: block; }
.ed-add-menu a {
  display: block;
  padding: 10px 14px;
  font-size: 12px;
  color: #334155;
  text-decoration: none;
}
.ed-add-menu a:hover { background: #f1f5f9; }

.ed-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ed-modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  font-size: 12px;
}
.ed-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}
.ed-modal-head h3 { margin: 0; font-size: 14px; font-weight: 700; color: #1e293b; }
.ed-modal-close {
  border: none;
  background: none;
  color: #64748b;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}
.ed-modal-close:hover { color: #dc2626; }
.ed-modal-body { padding: 20px; }
.ed-modal-body label { font-weight: 700; color: #475569; font-size: 12px; margin-bottom: 4px; }
.ed-field-valid { position: relative; }
.ed-valid-icon {
  display: none;
  position: absolute;
  right: 10px;
  bottom: 10px;
  color: #16a34a;
  font-size: 13px;
}
.ed-field-valid.valid .ed-valid-icon { display: block; }
.ed-drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  background: #f8fafc;
  color: #64748b;
  transition: background 0.15s, border-color 0.15s;
}
.ed-drop-zone.dragover { background: #eff6ff; border-color: #2563eb; }
.ed-drop-zone i { font-size: 32px; color: #cbd5e1; margin-bottom: 8px; }
.ed-drop-zone p { margin: 0; font-size: 12px; }
.ed-pick-file { color: #2563eb; font-weight: 700; cursor: pointer; }
.ed-queue-wrap { margin-top: 16px; border-top: 1px solid #e2e8f0; padding-top: 12px; }
.ed-queue-wrap h6 {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #475569;
  margin-bottom: 10px;
}
.ed-queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 8px;
}
.ed-queue-meta { flex: 1; min-width: 0; text-align: left; }
.ed-queue-meta strong {
  display: block;
  font-size: 12px;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ed-queue-meta small { font-size: 10px; color: #94a3b8; font-weight: 600; }
.ed-queue-progress { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ed-progress-track {
  width: 96px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.ed-progress-fill {
  height: 100%;
  background: #2563eb;
  border-radius: 999px;
  width: 0%;
  transition: width 0.2s ease;
}
.ed-progress-pct { font-size: 10px; font-weight: 700; color: #2563eb; width: 36px; text-align: center; }
.ed-queue-del {
  border: none;
  background: none;
  color: #ef4444;
  cursor: pointer;
  padding: 4px;
}
.ed-queue-del:hover { color: #b91c1c; }
.ed-queue-totals {
  display: flex;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  margin-top: 8px;
}
.ed-queue-totals strong { color: #2563eb; }
.ed-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}
.ed-modal-wide { max-width: 760px; }
.ed-tts-textarea { resize: vertical; min-height: 140px; line-height: 1.5; }
.ed-char-count { font-size: 10px; color: #64748b; text-align: right; margin-top: 4px; font-weight: 600; }
.ed-char-count.warn { color: #dc2626; }
.ed-radio-row { display: flex; gap: 16px; font-size: 12px; font-weight: 600; color: #475569; }
.ed-radio-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; margin: 0; }
.ed-tts-progress {
  margin-top: 16px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.ed-progress-track-lg { height: 8px; width: 100%; }

/* FOTA / firmware admin */
.fw-stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  height: 100%;
}
.fw-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 6px;
}
.fw-stat-val {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}
.fw-ver {
  font-weight: 700;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
}
.fw-ver-ok {
  background: #dcfce7;
  color: #166534;
}
.fw-ver-old {
  background: #fef3c7;
  color: #92400e;
}
.fw-row-offline {
  opacity: 0.55;
}
.fw-table .fw-actions {
  text-align: center;
  white-space: nowrap;
}
.fw-mac-code {
  font-size: 11px;
  color: #475569;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}
.fw-mqtt-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
}
.fw-mqtt-ok { color: #16a34a; }
.fw-mqtt-ready { color: #22c55e; opacity: 0.85; }
.fw-mqtt-off { color: #cbd5e1; }
.fw-col-status { min-width: 88px; }
.fw-status {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}
.fw-status-sent { color: #0f172a; }
.fw-status-done { color: #166534; }
.fw-status-fail { color: #dc2626; }
.fw-status-empty { color: #94a3b8; font-weight: 400; }

/* Danh sách Cụm loa — địa bàn phát */
.cl-page { position: relative; }
.cl-page-title {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1e293b;
}
.cl-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.cl-stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 992px) { .cl-stat-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .cl-stat-cards { grid-template-columns: 1fr; } }
.cl-stat {
  border-radius: 10px;
  padding: 14px 18px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.cl-stat .lbl { font-size: 13px; font-weight: 600; opacity: 0.95; }
.cl-stat .num { font-size: 28px; font-weight: 900; line-height: 1.1; margin-top: 4px; }
.cl-stat-blue { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.cl-stat-green { background: linear-gradient(135deg, #16a34a, #15803d); }
.cl-stat-red { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.cl-stat-orange { background: linear-gradient(135deg, #ea580c, #c2410c); }
.cl-stat-legend { font-size: 11px; margin-top: 8px; opacity: 0.95; }
.cl-stat-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; }
.cl-stat-legend .dot.on { background: #bbf7d0; }
.cl-stat-legend .dot.off { background: #94a3b8; }
.cl-bulk-vol {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 6px 12px;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.08);
}
.cl-vol-speaker { font-size: 18px; color: #2563eb; flex-shrink: 0; }
.cl-vol-slider { width: 110px; min-width: 80px; height: 4px; margin: 0; accent-color: #2563eb; cursor: pointer; }
.cl-vol-num { width: 48px; text-align: center; font-weight: 700; padding: 4px 6px; }
.cl-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.cl-action-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.cl-control-wrap { position: relative; display: inline-block; }
.cl-table-wrap { background: #fff; border-radius: 8px; border: 1px solid #e2e8f0; }
.cl-table thead th { background: #f8fafc; font-size: 11px; text-transform: uppercase; white-space: nowrap; }
.cl-conn-icons { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 14px; }
.cl-conn-icons i { width: 18px; text-align: center; }
.cl-device-code { display: inline-block; margin-top: 4px; background: #eff6ff; color: #1d4ed8; padding: 2px 6px; border-radius: 4px; }
.cl-device-cell { min-width: 140px; }
.cl-device-link {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.cl-device-link:hover .cl-device-name { color: #2563eb; }
.cl-device-name {
  display: block;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
}
.cl-control-pop {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  left: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
  padding: 14px;
  min-width: 420px;
}
.cl-control-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.cl-control-btn {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 88px;
  padding: 10px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.cl-control-btn:nth-child(4),
.cl-control-btn:nth-child(5) {
  grid-column: span 3;
}
.cl-control-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}
.cl-control-icon i { font-size: 26px; color: #2563eb; }
.cl-control-label {
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  text-align: center;
  line-height: 1.35;
}
.cl-control-btn.danger .cl-control-icon i { color: #dc2626; }
.cl-control-btn.play .cl-control-icon i { color: #2563eb; }
.cl-control-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.cl-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cl-modal {
  background: #fff;
  border-radius: 12px;
  width: min(920px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}
.cl-modal-wide { width: min(980px, 100%); }
.cl-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
}
.cl-modal-head h5 { margin: 0; font-weight: 800; }

/* —— Số hoá âm thanh IP (Barix Instreamer style) —— */
.dg-page { padding: 0 4px 24px; }
.dg-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.dg-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .dg-layout { grid-template-columns: 1fr; }
}
.dg-side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px;
  position: sticky;
  top: 12px;
}
.dg-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
}
.dg-nav-item i { width: 18px; color: #64748b; }
.dg-nav-item:hover { background: #f1f5f9; }
.dg-nav-item.active { background: #eff6ff; color: #1d4ed8; }
.dg-nav-item.active i { color: #2563eb; }
.dg-main { min-width: 0; }
.dg-control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dg-card-wide { grid-column: 1 / -1; }
@media (max-width: 768px) {
  .dg-control-grid { grid-template-columns: 1fr; }
  .dg-card-wide { grid-column: auto; }
}
.dg-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.dg-card-head {
  background: #f8fafc;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 14px;
}
.dg-status-box {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.dg-box-idle { background: #e2e8f0; color: #64748b; }
.dg-box-encoding { background: #22c55e; color: #fff; }
.dg-box-wait { background: #f59e0b; color: #fff; }
.dg-status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.dg-pill-on { background: #dcfce7; color: #166534; }
.dg-pill-off { background: #fee2e2; color: #991b1b; }
.dg-pill-warn { background: #fef3c7; color: #92400e; }
.dg-pill-idle { background: #e0e7ff; color: #3730a3; }
.dg-onair-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dg-onair-led {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #cbd5e1;
  border: 1px solid #94a3b8;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}
.dg-onair-led.on {
  background: #ef4444;
  border-color: #b91c1c;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.85), 0 0 16px rgba(239, 68, 68, 0.35);
  animation: dg-onair-pulse 1.2s ease-in-out infinite;
}
@keyframes dg-onair-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.dg-box-starting { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.dg-pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 10px;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 11px;
}
.dg-pipe-step {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #64748b;
  font-weight: 600;
}
.dg-pipe-step.active { background: #fef3c7; color: #92400e; }
.dg-pipe-step.ok { background: #dcfce7; color: #166534; }
.dg-pipe-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  font-size: 10px;
  font-weight: 800;
}
.dg-pipe-arrow { color: #94a3b8; font-weight: 700; }
.dg-input-row { display: flex; flex-wrap: wrap; gap: 8px; }
.dg-input-pill {
  border: 2px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.dg-input-pill.active {
  border-color: #22c55e;
  background: #f0fdf4;
  color: #166534;
}
.dg-input-indicators { display: flex; gap: 8px; }
.dg-ind {
  width: 48px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  color: #94a3b8;
  background: #f1f5f9;
}
.dg-ind.on {
  border-color: #22c55e;
  background: #22c55e;
  color: #fff;
}
.dg-vu-bar {
  height: 10px;
  background: #1e293b;
  border-radius: 2px;
  margin-bottom: 6px;
  overflow: hidden;
}
.dg-vu-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #eab308 70%, #ef4444);
  border-radius: 2px;
  transition: width 0.3s;
}
.dg-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dg-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.dg-modal {
  background: #fff;
  border-radius: 12px;
  width: min(640px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}
.dg-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
}
.dg-modal-body { padding: 16px; }
.dg-modal-foot { display: flex; justify-content: flex-end; gap: 8px; }

