/* Corporate look for the admin panel: one navy accent, neutral greys, compact controls.
   Loaded last so it overrides the older per-page colours. Dark mode keeps its own rules. */
:root {
  --c-navy: #1b2a41;
  --c-navy-2: #24364f;
  --c-accent: #2f5d8a;
  --c-accent-hover: #264d73;
  --c-bg: #f5f6f8;
  --c-surface: #ffffff;
  --c-border: #dfe3e8;
  --c-text: #1f2933;
  --c-muted: #6b7785;
  --c-ok: #2e7d4f;
  --c-err: #b23b3b;
  --c-warn: #a86b12;
  --radius: 6px;
}

body:not(.dark-mode) { background: var(--c-bg); color: var(--c-text); }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }

/* ---- sidebar ---- */
body:not(.dark-mode) #sidebar { background: var(--c-navy) !important; border-right: 0 !important; }
body:not(.dark-mode) #sidebar h2 { color: #fff !important; font-size: 15px; letter-spacing: .3px; }
body:not(.dark-mode) #sidebar > button,
body:not(.dark-mode) #sidebar .submenu button { color: #c9d3df !important; background: transparent !important; font-size: 14px; }
body:not(.dark-mode) #sidebar > button:hover,
body:not(.dark-mode) #sidebar .submenu button:hover,
body:not(.dark-mode) #sidebar .submenu button.active { background: var(--c-navy-2) !important; color: #fff !important; }

/* ---- buttons: one size, one primary colour ---- */
.btn, button.btn-primary, button.btn-secondary, button.btn-success, button.btn-danger, button.btn-info, button.btn-warning {
  font-size: 14px !important;
  line-height: 1.3 !important;
  padding: 7px 14px !important;
  border-radius: var(--radius) !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}
.btn-sm { padding: 4px 10px !important; font-size: 13px !important; }
.btn-primary, .btn-success, .btn-info { background: var(--c-accent) !important; border-color: var(--c-accent) !important; color: #fff !important; }
.btn-primary:hover, .btn-success:hover, .btn-info:hover { background: var(--c-accent-hover) !important; border-color: var(--c-accent-hover) !important; }
.btn-secondary, .btn-light, .btn-warning { background: #fff !important; border: 1px solid var(--c-border) !important; color: var(--c-text) !important; }
.btn-secondary:hover, .btn-light:hover, .btn-warning:hover { background: #eef1f4 !important; }
.btn-danger { background: #fff !important; border: 1px solid #e3c2c2 !important; color: var(--c-err) !important; }
.btn-danger:hover { background: #fbeeee !important; }

/* ---- cards / tables ---- */
body:not(.dark-mode) .card,
body:not(.dark-mode) .content-section,
body:not(.dark-mode) .panel { border-radius: 8px; border-color: var(--c-border); box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
body:not(.dark-mode) table thead th { background: #f0f2f5 !important; color: var(--c-muted) !important; font-weight: 600; font-size: 13px; }

/* ---- status badges: small, muted ---- */
.status-badge { display: inline-block; padding: 2px 8px !important; border-radius: 10px !important; font-size: 12px !important; font-weight: 500 !important; }
.status-badge.active { background: #e7f3ec !important; color: var(--c-ok) !important; }
.status-badge.inactive { background: #f1f2f4 !important; color: var(--c-muted) !important; }

/* ---- device list filter chips (were large coloured boxes) ---- */
#deviceStats { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; font-size: 13px; line-height: 1.2;
  background: var(--c-surface); color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: 16px; cursor: pointer;
}
.filter-chip b { font-weight: 600; margin-left: 2px; }
.filter-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-muted); }
.filter-chip.online .dot { background: var(--c-ok); }
.filter-chip.offline .dot { background: var(--c-err); }
.filter-chip.registered .dot { background: var(--c-accent); }
.filter-chip:hover { background: #eef1f4; }
.filter-chip.is-active { border-color: var(--c-accent); background: #eaf0f6; }
.filter-chip.add { margin-left: auto; background: var(--c-accent); color: #fff; border-color: var(--c-accent); }
.filter-chip.add:hover { background: var(--c-accent-hover); }
body.dark-mode .filter-chip { background: #2a2a2b; color: #ddd; border-color: #444; }
body.dark-mode .filter-chip.is-active { background: #33404f; }

/* ---- pairing dialog ---- */
.pair-modal { position: fixed; inset: 0; z-index: 3000; background: rgba(15, 23, 35, .55); align-items: center; justify-content: center; padding: 16px; }
.pair-card { width: 100%; max-width: 400px; background: #fff; color: var(--c-text); border-radius: 10px; padding: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.pair-head { display: flex; align-items: center; justify-content: space-between; }
.pair-head h3 { margin: 0; font-size: 18px; }
.pair-x { background: none; border: 0; font-size: 24px; line-height: 1; color: var(--c-muted); cursor: pointer; }
.pair-help { color: var(--c-muted); font-size: 13px; margin: 8px 0 14px; }
.pair-card label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; }
.pair-card input { width: 100%; padding: 9px 10px; border: 1px solid var(--c-border); border-radius: var(--radius); font-size: 15px; }
#pairCodeInput { font-size: 22px; letter-spacing: 4px; text-align: center; font-family: Consolas, monospace; }
#pairVideo { width: 100%; margin-top: 12px; border-radius: var(--radius); background: #000; }
.pair-status { min-height: 18px; font-size: 13px; margin-top: 10px; }
.pair-status.ok { color: var(--c-ok); }
.pair-status.err { color: var(--c-err); }
.pair-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.pair-actions button { padding: 8px 14px; border-radius: var(--radius); font-size: 14px; cursor: pointer; }
.pair-actions .btn-primary { background: var(--c-accent); color: #fff; border: 1px solid var(--c-accent); }
.pair-actions .btn-secondary { background: #fff; color: var(--c-text); border: 1px solid var(--c-border); }
body.dark-mode .pair-card { background: #252526; color: #ddd; }
body.dark-mode .pair-card input { background: #1e1e1e; color: #ddd; border-color: #444; }

/* ================= phone layout ================= */
@media (max-width: 768px) {
  #topbar { display: flex !important; flex-wrap: wrap !important; align-items: center !important; gap: 6px !important; padding: 8px 10px !important; min-height: 0 !important; height: auto !important; }
  #topbar .topbar-left { flex: 1 1 auto; min-width: 0; }
  #topbar .page-title { font-size: 16px !important; margin: 0 !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #webUiClock { display: none !important; }
  #topbar .topbar-right { flex: 1 0 100%; display: flex !important; flex-wrap: nowrap !important; align-items: center; justify-content: flex-end; gap: 6px !important; margin: 0 !important; padding: 0 !important; }
  #topbar .topbar-right > * { margin: 0 !important; }
  #topbar .language-selector { margin-right: auto !important; padding: 2px !important; border-radius: 6px !important; }
  #topbar .lang-btn { padding: 4px 8px !important; font-size: 12px !important; border-radius: 4px !important; min-height: 0 !important; }
  #topbar .lang-btn span { display: none; }
  #topbar .lang-btn img { width: 18px; }
  #topbar #publishBtn, #topbar .notification-bell, #topbar #theme-toggle-btn, #topbar .topbar-help-btn, #topbar .user-menu-btn {
    width: 36px !important; height: 36px !important; min-width: 36px !important; padding: 0 !important;
    display: inline-flex !important; align-items: center; justify-content: center;
    font-size: 16px !important; border-radius: 6px !important; border: 1px solid var(--c-border) !important; background: #fff !important; box-shadow: none !important;
  }
  #topbar #publishBtn:not(.has-changes) { display: none !important; }
  #topbar #publishBtn.has-changes { background: var(--c-warn) !important; color: #fff !important; }
  #topbar .topbar-help-btn { font-size: 0 !important; }
  #topbar .topbar-help-btn i { font-size: 16px; }
  #topbar .user-menu-btn .user-name, #topbar .user-menu-btn .dropdown-arrow { display: none !important; }
  #topbar .user-menu, #topbar .theme-switcher, #topbar .notification-center { border: 0 !important; padding: 0 !important; }

  /* content: one column, full-width controls */
  #content { padding: 10px !important; }
  #content h1, #content h2 { font-size: 20px !important; color: var(--c-text) !important; }
  #content input[type="text"], #content input[type="search"], #content input[type="number"], #content input[type="email"],
  #content input[type="password"], #content input[type="date"], #content input[type="datetime-local"], #content select, #content textarea {
    width: 100% !important; max-width: 100% !important; min-width: 0 !important; margin-left: 0 !important; margin-right: 0 !important;
    font-size: 15px !important; padding: 8px 10px !important; height: auto !important; box-sizing: border-box;
  }
  #content input[type="color"] { width: 44px !important; }
  #content button, #content .btn { font-size: 14px !important; padding: 8px 12px !important; min-height: 36px; }
  #deviceStats .filter-chip.add { margin-left: 0; }
  .card, .content-section { padding: 12px !important; }
}

/* ---- room / guest (check-in) dialog: two columns, compact ---- */
#updateRoomModal { max-width: 760px !important; padding: 20px 22px !important; border-color: var(--c-border) !important; border-radius: 10px !important; box-shadow: 0 12px 40px rgba(16,24,40,.25) !important; }
#updateRoomModal h3 { font-size: 18px; font-weight: 600; color: var(--c-text); }
#updateRoomModal .room-form { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; align-content: start; }
#updateRoomModal .room-form > div { margin-bottom: 12px !important; min-width: 0; }
#updateRoomModal .room-form > #updateChannelPackageWrap,
#updateRoomModal .room-form > #updateDeviceChannelListWrap,
#updateRoomModal .room-form > #updateUsageModeWrap,
#updateRoomModal .room-form > div:nth-last-child(-n+2) { grid-column: 1 / -1; }
#updateRoomModal label { font-size: 12px !important; font-weight: 600 !important; color: var(--c-muted); text-transform: none; margin-bottom: 4px !important; }
#updateRoomModal input[type="text"], #updateRoomModal input[type="datetime-local"], #updateRoomModal select:not([multiple]) {
  height: 38px; padding: 6px 10px !important; border: 1px solid var(--c-border) !important; border-radius: 6px !important; font-size: 14px !important; background: #fff;
}
#updateRoomModal select[multiple] { border: 1px solid var(--c-border) !important; border-radius: 6px !important; font-size: 14px !important; min-height: 96px; }
#updateRoomModal select[multiple] option:checked { background: #dbe6f1 linear-gradient(0deg, #dbe6f1, #dbe6f1); color: var(--c-text); }
#updateRoomModal input:focus, #updateRoomModal select:focus { outline: none; border-color: var(--c-accent) !important; box-shadow: 0 0 0 3px rgba(47,93,138,.15); }
#updateRoomModal input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--c-accent); }
body.dark-mode #updateRoomModal input, body.dark-mode #updateRoomModal select { background: #1e1e1e; color: #ddd; border-color: #444 !important; }
@media (max-width: 640px) {
  #updateRoomModal .room-form { grid-template-columns: 1fr; }
  #updateRoomModal { width: 96% !important; padding: 16px !important; }
}

/* page titles + sidebar tree lines */
body:not(.dark-mode) #content h1, body:not(.dark-mode) #content h2 { color: var(--c-text) !important; }
/* a closed submenu kept its padding + left border, which showed as a short "|" under each group */
#sidebar .submenu:not(.open) { padding-top: 0 !important; padding-bottom: 0 !important; margin-bottom: 0 !important; border-left-color: transparent !important; }
#sidebar .submenu:not(.open)::before { display: none !important; }

/* older button classes used across the panel (.add / .btn-save were bright green, .delete red) */
#content button.add, #content .btn-save, .channel-card button.add, .channel-card .btn-save, button.btn-save {
  background: var(--c-accent) !important; border: 1px solid var(--c-accent) !important; color: #fff !important;
  border-radius: var(--radius) !important; box-shadow: none !important; font-weight: 500 !important;
}
#content button.add:hover, button.btn-save:hover { background: var(--c-accent-hover) !important; }
#content button.delete, .channel-card button.delete {
  background: #fff !important; border: 1px solid #e3c2c2 !important; color: var(--c-err) !important; border-radius: var(--radius) !important; box-shadow: none !important;
}
#content button.action, .channel-card button.action { background: #fff !important; border: 1px solid var(--c-border) !important; color: var(--c-text) !important; border-radius: var(--radius) !important; }

/* ================= dark theme: same corporate palette, no white leftovers ================= */
body.dark-mode {
  --c-bg: #0f1722; --c-surface: #172130; --c-surface-2: #1d2939; --c-border: #2a3646;
  --c-text: #e3e8ef; --c-muted: #93a1b3; --c-accent: #4a7fb5; --c-accent-hover: #5b8fc4;
  --c-ok: #4caf7a; --c-err: #e06c6c; --c-warn: #d9a441;
  background: var(--c-bg) !important; color: var(--c-text) !important;
}
body.dark-mode #sidebar { background: #111a26 !important; border-right: 1px solid var(--c-border) !important; background-image: none !important; }
body.dark-mode #sidebar > button, body.dark-mode #sidebar .submenu button {
  background: transparent !important; color: #c3cdd9 !important; border: 1px solid transparent !important; box-shadow: none !important;
}
body.dark-mode #sidebar > button:hover, body.dark-mode #sidebar .submenu button:hover, body.dark-mode #sidebar .submenu button.active { background: var(--c-surface-2) !important; color: #fff !important; }
body.dark-mode #topbar { background: #111a26 !important; border-bottom: 1px solid var(--c-border) !important; }
body.dark-mode #content, body.dark-mode #main-wrapper { background: var(--c-bg) !important; }

/* surfaces */
body.dark-mode .card, body.dark-mode .channel-card, body.dark-mode .overview-card, body.dark-mode .content-section,
body.dark-mode .panel, body.dark-mode .modal-content, body.dark-mode [class*="-card"]:not(.filter-chip) {
  background: var(--c-surface) !important; border-color: var(--c-border) !important; color: var(--c-text) !important; box-shadow: none !important;
}
body.dark-mode .card-header { background: var(--c-surface-2) !important; border-color: var(--c-border) !important; color: var(--c-text) !important; }
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3, body.dark-mode h4, body.dark-mode h5 { color: var(--c-text) !important; }
body.dark-mode table thead th { background: var(--c-surface-2) !important; color: var(--c-muted) !important; border-color: var(--c-border) !important; }
body.dark-mode table td { border-color: var(--c-border) !important; color: var(--c-text); }
body.dark-mode table tbody tr:hover td { background: #1b2635 !important; }

/* any inline white box left in older views */
body.dark-mode #content [style*="background:#fff"], body.dark-mode #content [style*="background: #fff"],
body.dark-mode #content [style*="background:#ffffff"], body.dark-mode #content [style*="background: white"],
body.dark-mode #content [style*="background:#f9f9f9"], body.dark-mode #content [style*="background:#fcfcfc"],
body.dark-mode #content [style*="background:#f8fafc"], body.dark-mode #content [style*="background:#f6f8fa"],
body.dark-mode #content [style*="background: #f9f9f9"], body.dark-mode #content [style*="background-color: #fff"],
body.dark-mode #content [style*="background-color:#fff"], body.dark-mode #content [style*="background:#eef2f6"] {
  background: var(--c-surface-2) !important; color: var(--c-text) !important; border-color: var(--c-border) !important;
}

/* form controls */
body.dark-mode input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), body.dark-mode select, body.dark-mode textarea, body.dark-mode .form-input, body.dark-mode .form-control {
  background: #0f1825 !important; color: var(--c-text) !important; border-color: var(--c-border) !important;
}
body.dark-mode input::placeholder, body.dark-mode textarea::placeholder { color: #6c7a8c !important; }
body.dark-mode input[type="file"]::file-selector-button { background: var(--c-surface-2); color: var(--c-text); border: 1px solid var(--c-border); border-radius: 4px; }
body.dark-mode select[multiple] option:checked { background: #2a4565 linear-gradient(0deg, #2a4565, #2a4565) !important; color: #fff !important; }

/* buttons: secondary / outline variants must not stay white */
body.dark-mode .btn-secondary, body.dark-mode .btn-light, body.dark-mode .btn-warning, body.dark-mode button.action, body.dark-mode #content button.action,
body.dark-mode .channel-card button.action, body.dark-mode .pair-actions .btn-secondary, body.dark-mode .filter-chip {
  background: var(--c-surface-2) !important; color: var(--c-text) !important; border: 1px solid var(--c-border) !important;
}
body.dark-mode .btn-secondary:hover, body.dark-mode .btn-light:hover, body.dark-mode button.action:hover { background: #26354a !important; }
body.dark-mode .btn-danger, body.dark-mode #content button.delete { background: transparent !important; color: var(--c-err) !important; border-color: #5a2f35 !important; }
body.dark-mode #content button:not(.add):not(.btn-primary):not(.btn-save):not(.filter-chip):not(.dd-btn):not([class*="tab"]):not(.lang-btn) {
  background-color: var(--c-surface-2); color: var(--c-text); border-color: var(--c-border);
}
body.dark-mode .btn-primary, body.dark-mode #content button.add, body.dark-mode .btn-save, body.dark-mode .btn-info, body.dark-mode .btn-success { background: var(--c-accent) !important; border-color: var(--c-accent) !important; color: #fff !important; }

/* overview: muted card titles + quick actions in the corporate colours (both themes) */
.overview-card h3, .overview-card .card-title, .overview-card [class*="title"] { letter-spacing: .04em; }
#content .btn-info, #content .btn-success { background: var(--c-accent) !important; border-color: var(--c-accent) !important; color: #fff !important; }
#content .btn-secondary { font-weight: 500 !important; }

/* top bar icon buttons: one shape and size (bell, theme, info, user) */
#topbar .notification-bell, #topbar #theme-toggle-btn, #topbar .topbar-help-btn {
  width: 34px !important; height: 34px !important; min-width: 34px !important; padding: 0 !important; margin: 0 2px !important;
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  border-radius: 8px !important; border: 1px solid var(--c-border) !important; background: var(--c-surface, #fff) !important;
  color: var(--c-text) !important; font-size: 15px !important; line-height: 1 !important; box-shadow: none !important;
}
#topbar .topbar-help-btn { font-size: 0 !important; }
#topbar .topbar-help-btn i { font-size: 15px !important; color: var(--c-muted) !important; }


#topbar .notification-bell:hover, #topbar #theme-toggle-btn:hover, #topbar .topbar-help-btn:hover { border-color: var(--c-accent) !important; }
body.dark-mode #topbar .notification-bell, body.dark-mode #topbar #theme-toggle-btn, body.dark-mode #topbar .topbar-help-btn,
body.dark-mode #topbar .user-menu-btn, body.dark-mode #topbar #publishBtn:not(.has-changes) { background: var(--c-surface-2) !important; border-color: var(--c-border) !important; color: var(--c-text) !important; }
body.dark-mode #topbar .language-selector { background: var(--c-surface-2) !important; border: 1px solid var(--c-border) !important; }
body.dark-mode #topbar .lang-btn { color: var(--c-text) !important; }

/* dark: remaining inline white / light boxes (network card, older views) */
body.dark-mode #content [style*="background: white"], body.dark-mode #content [style*="background:white"], body.dark-mode #overview-view [style*="background:#fff"], body.dark-mode #overview-view [style*="background: #fff"], body.dark-mode [id$="-view"] [style*="background:#fff"], body.dark-mode [id$="-view"] [style*="background: #fff"], body.dark-mode [id$="-view"] [style*="background:#f8f9fa"], body.dark-mode [id$="-view"] [style*="background:#f9f9f9"],
body.dark-mode #content [style*="background-color: white"], body.dark-mode #content [style*="background-color:white"],
body.dark-mode #content [style*="background: #fafafa"], body.dark-mode #content [style*="background:#fafafa"],
body.dark-mode #content [style*="background: #f8f9fa"], body.dark-mode #content [style*="background:#f8f9fa"],
body.dark-mode #content [style*="background: #f5f5f5"], body.dark-mode #content [style*="background:#f5f5f5"] {
  background: var(--c-surface-2) !important; color: var(--c-text) !important; border-color: var(--c-border) !important;
}
:root { --c-surface-2: #f3f5f8; }

/* top bar info (panel guide) button: a clean "i" drawn as SVG instead of the icon-font glyph (that one sat as a
   second circle inside the square button) */
#topbar .topbar-help-btn i, #topbar .topbar-help-btn .fas, #topbar .topbar-help-btn svg { display: none !important; }
#topbar .topbar-help-btn {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='5.6' r='1.7' fill='%236b7785'/%3E%3Crect x='10.4' y='9' width='3.2' height='10.5' rx='1.4' fill='%236b7785'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: center !important; background-size: 18px 18px !important;
}
body.dark-mode #topbar .topbar-help-btn {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='5.6' r='1.7' fill='%23c3cdd9'/%3E%3Crect x='10.4' y='9' width='3.2' height='10.5' rx='1.4' fill='%23c3cdd9'/%3E%3C/svg%3E") !important;
}
/* style.css drew a 'ⓘ' character with ::before: that was the second circle */
#topbar .topbar-help-btn::before, #topbar .topbar-help-btn::after { content: none !important; display: none !important; }


/* ---- system management tabs (Ağ / PMS / Yayın / Entegrasyonlar) ---- */
.sys-tabs { display: flex; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--c-border); overflow-x: auto; }
.sys-tab { border: 0 !important; background: none !important; padding: 10px 14px !important; font-weight: 600 !important; font-size: 14px !important;
  color: var(--c-muted) !important; border-bottom: 3px solid transparent !important; border-radius: 0 !important; cursor: pointer; white-space: nowrap; box-shadow: none !important; }
.sys-tab:hover { color: var(--c-text) !important; }
.sys-tab.on { color: var(--c-accent) !important; border-bottom-color: var(--c-accent) !important; }

/* ---- integrations page ---- */
.int-page { padding: 22px !important; border-radius: 10px !important; }
.int-page .int-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-top: 12px; }
.int-page section { position: relative; background: var(--c-surface, #fff); border: 1px solid var(--c-border); border-radius: 10px; padding: 18px 18px 16px 18px; }
.int-page section.int-wide { grid-column: 1 / -1; }
.int-page section h4 { margin: 0 0 6px; padding-left: 44px; min-height: 34px; display: flex; align-items: center; font-size: 15px !important; font-weight: 700; color: var(--c-text) !important; }
.int-page section[data-ic]::before { content: attr(data-ic); position: absolute; left: 18px; top: 18px; width: 34px; height: 34px; border-radius: 8px;
  background: var(--c-surface-2, #f3f5f8); display: flex; align-items: center; justify-content: center; font-size: 17px; }
.int-page section > p { color: var(--c-muted) !important; font-size: 13px; margin: 2px 0 12px; line-height: 1.5; }
.int-page section label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--c-muted); margin: 0 0 10px; }
.int-page section label:has(input[type="checkbox"]) { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--c-text); font-weight: 500; }
.int-page section input:not([type="checkbox"]), .int-page section select { width: 100% !important; box-sizing: border-box; height: 36px; padding: 6px 10px !important; font-size: 14px !important;
  border: 1px solid var(--c-border) !important; border-radius: 6px !important; background: var(--c-surface, #fff); color: var(--c-text); }
.int-page section input:focus, .int-page section select:focus { outline: none; border-color: var(--c-accent) !important; box-shadow: 0 0 0 3px rgba(47,93,138,.15); }
.int-page section [id^="integration-"]:not(input):not(select) { margin-top: 10px !important; padding: 10px 12px; border-radius: 8px; background: var(--c-surface-2, #f3f5f8); font-size: 13px; color: var(--c-muted) !important; }
.int-page section [id^="integration-"] h4, .int-page section [id^="integration-"] strong { padding-left: 0 !important; min-height: 0 !important; font-size: 13px !important; }
.int-page section small { color: var(--c-muted); }
.int-page .int-save { margin-top: 18px; display: flex; gap: 10px; align-items: center; padding-top: 14px; border-top: 1px solid var(--c-border); }
.int-page a { color: var(--c-accent); }
body.dark-mode .int-page section { background: var(--c-surface) !important; }

/* Viewing analytics: scoped dashboard layout, compact reporting and theme-aware charts. */
.vs-page{--vs-blue:var(--c-accent);--vs-teal:#278879;--vs-fill:#f4f7fb;--vs-line:#e7ecf2;width:100%;max-width:none;min-width:0;margin:0;color:var(--c-text);font-size:13px}
body.dark-mode .vs-page{--vs-blue:var(--c-accent);--vs-teal:#75d5c3;--vs-fill:#1c2a3c;--vs-line:#29384d}
.vs-page *{box-sizing:border-box}.vs-page [hidden]{display:none!important}
.vs-page svg{width:18px;height:18px;flex-shrink:0}.vs-page button{font-family:inherit;cursor:pointer;transition:background .15s,border-color .15s}
.vs-page button:disabled{opacity:.4;cursor:default}.vs-page button:focus-visible,.vs-page input:focus-visible,.vs-page summary:focus-visible,.vs-heat:focus-visible{outline:3px solid var(--vs-blue);outline-offset:3px}
.vs-page .vs-head{display:flex;justify-content:space-between;align-items:center;gap:20px;margin:0 0 22px}.vs-eyebrow{font-size:10px;font-weight:700;letter-spacing:1.8px;color:var(--vs-blue);margin-bottom:6px}
#content .vs-page .vs-head h2{font-size:28px!important;line-height:1.2;letter-spacing:-.8px;font-weight:700;margin:0 0 8px}
.vs-head p{color:var(--c-muted);margin:0;font-size:13px}.vs-head-actions{display:flex;gap:8px;align-items:center}.vs-updated{font-size:11px;color:var(--c-muted);margin-right:8px}
#content .vs-page .vs-button{border:1px solid var(--c-border);border-radius:7px;background:var(--c-surface);color:var(--c-text);min-height:34px;padding:7px 11px;display:inline-flex;gap:7px;align-items:center;justify-content:center;font-size:12px;font-weight:600;box-shadow:none;margin:0}
#content .vs-page .vs-button:hover:not(:disabled){border-color:var(--vs-blue);background:var(--vs-fill)}
#content .vs-page .vs-export{background:var(--vs-blue);color:#fff;border-color:var(--vs-blue)}body.dark-mode #content .vs-page .vs-export{color:#0e1a2b}
.vs-toolbar{padding:14px 16px;border:1px solid var(--c-border);border-radius:10px;background:var(--c-surface);display:flex;flex-wrap:wrap;align-items:center;gap:18px;margin-bottom:20px}
.vs-filter-block{display:flex;align-items:center;gap:9px}.vs-filter-label{color:var(--c-muted);font-size:11px;font-weight:600}.vs-type{margin-left:auto}
.vs-page .vs-group{display:flex;border:1px solid var(--c-border);border-radius:6px;overflow:hidden;background:var(--vs-fill)}
#content .vs-page .vs-seg{border:0;border-right:1px solid var(--c-border);border-radius:0;padding:7px 11px;min-height:32px;background:transparent;color:var(--c-muted);font-size:12px;font-weight:600;white-space:nowrap;box-shadow:none;margin:0}
#content .vs-page .vs-seg:last-child{border-right:0}#content .vs-page .vs-seg.on{background:var(--vs-blue);color:#fff}body.dark-mode #content .vs-page .vs-seg.on{color:#0e1a2b}
.vs-date-fields{display:flex;align-items:center;gap:8px}.vs-date-fields label{font-size:10px;color:var(--c-muted);display:flex;gap:7px;align-items:center;margin:0}
.vs-page .vs-date-fields input{width:128px;min-width:0;padding:5px 7px;border:1px solid var(--c-border);border-radius:6px;font:inherit;font-size:11px;background:var(--c-surface);color:var(--c-text);height:33px;color-scheme:light}body.dark-mode .vs-page input[type=date]{color-scheme:dark}
.vs-date-fields>span{color:var(--c-muted);font-size:11px}.vs-status{padding:15px 18px;border:1px solid var(--c-border);background:var(--vs-fill);border-radius:8px;color:var(--c-muted);margin:0 0 18px;line-height:1.6}.vs-status.vs-error{border-color:var(--c-err);color:var(--c-err)}
.vs-page .vs-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:0 0 20px}.vs-page .vs-kpi{padding:17px 19px 16px;background:var(--c-surface);border:1px solid var(--c-border);border-radius:10px;position:relative;overflow:hidden}
.vs-kpi:first-child:before{content:'';position:absolute;left:0;top:19px;bottom:19px;width:3px;background:var(--vs-blue);border-radius:0 3px 3px 0}.vs-kpi-top{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:12px;font-weight:500;color:var(--c-muted)}.vs-kpi-top svg{width:17px;height:17px;color:var(--vs-blue)}
.vs-page .vs-kv{font-size:29px;line-height:1.2;letter-spacing:-.8px;font-weight:700;font-variant-numeric:tabular-nums;margin:10px 0;color:var(--c-text)}.vs-kpi-note{font-size:10px;color:var(--c-muted);line-height:1.5}
.vs-page .vs-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:18px}.vs-page .vs-card{border:1px solid var(--c-border);border-radius:10px;background:var(--c-surface);padding:20px;min-width:0;box-shadow:0 2px 5px rgba(23,42,69,.02)}
.vs-trend{grid-column:span 8}.vs-ranking{grid-column:span 4}.vs-hourly{grid-column:span 6}.vs-density{grid-column:span 6}.vs-details{grid-column:1/-1}
.vs-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:20px}
#content .vs-page h3{margin:0 0 5px;font-size:14px!important;line-height:1.35;font-weight:650;letter-spacing:-.15px;color:var(--c-text)}.vs-card-head p,.vs-detail-head p{margin:0;font-size:11px;color:var(--c-muted);line-height:1.5}
.vs-badge{white-space:nowrap;color:var(--c-muted);background:var(--vs-fill);border:1px solid var(--vs-line);border-radius:5px;padding:4px 7px;font-size:10px;font-weight:500}
.vs-page .vs-cv{height:235px;position:relative}.vs-page .vs-cv-small{height:185px}.vs-chart-foot{font-size:10px;color:var(--c-muted);border-top:1px solid var(--vs-line);padding-top:12px;margin-top:16px;line-height:1.5}
.vs-rank-row{display:flex;align-items:flex-start;gap:12px;margin:0 0 17px}.vs-rank-row:last-child{margin-bottom:0}.vs-rank-num{font-size:11px;font-weight:600;color:var(--c-muted);padding-top:1px;width:18px;font-variant-numeric:tabular-nums}.vs-rank-row:first-child .vs-rank-num{color:var(--vs-blue)}.vs-rank-main{flex:1;min-width:0}.vs-rank-main>div:first-child{display:flex;align-items:baseline;justify-content:space-between;gap:8px}.vs-rank-main strong{font-weight:600;font-size:12px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.vs-rank-main span{font-size:11px;font-weight:600;white-space:nowrap;font-variant-numeric:tabular-nums}.vs-rank-track{height:4px;background:var(--vs-fill);border-radius:4px;overflow:hidden;margin:7px 0 5px}.vs-rank-track i{display:block;height:100%;background:var(--vs-blue);border-radius:4px}.vs-rank-main small{display:block;color:var(--c-muted);font-size:10px}.vs-rank-main small b{float:right;font-weight:500}
.vs-page .vs-heat{overflow-x:auto;padding-bottom:3px}.vs-page .vs-hrow{display:grid;grid-template-columns:27px repeat(24,minmax(8px,1fr));gap:3px;margin-bottom:4px;min-width:390px}.vs-page .vs-hrow span{font-size:9px;color:var(--c-muted);align-self:center}.vs-page .vs-hrow i{font-size:9px;font-style:normal;color:var(--c-muted)}.vs-page .vs-hrow b{display:block;height:16px;border-radius:3px;outline:none;background:var(--vs-fill)}
.vs-page .vs-hrow .vs-level-1{background:#e3edf9}.vs-page .vs-hrow .vs-level-2{background:#c3d6f2}.vs-page .vs-hrow .vs-level-3{background:#91b2e4}.vs-page .vs-hrow .vs-level-4{background:#5e8ed0}.vs-page .vs-hrow .vs-level-5{background:#386cbd}
body.dark-mode .vs-page .vs-hrow .vs-level-1{background:#263954}body.dark-mode .vs-page .vs-hrow .vs-level-2{background:#345078}body.dark-mode .vs-page .vs-hrow .vs-level-3{background:#426da5}body.dark-mode .vs-page .vs-hrow .vs-level-4{background:#588bd0}body.dark-mode .vs-page .vs-hrow .vs-level-5{background:#77a9f7}
.vs-heat-key{display:flex;gap:4px;align-items:center;justify-content:flex-end;margin-top:12px;color:var(--c-muted);font-size:9px}.vs-heat-key i{width:12px;height:7px;border-radius:2px;background:var(--vs-blue)}.vs-heat-key i:nth-of-type(1){opacity:.15}.vs-heat-key i:nth-of-type(2){opacity:.3}.vs-heat-key i:nth-of-type(3){opacity:.5}.vs-heat-key i:nth-of-type(4){opacity:.75}.vs-heat-key span{margin:0 4px}
.vs-page .vs-details{padding:0;overflow:hidden}.vs-detail-head{display:flex;align-items:center;justify-content:space-between;padding:19px 20px 15px;gap:14px}.vs-search{display:flex;gap:7px;align-items:center;border:1px solid var(--c-border);border-radius:6px;padding:0 9px;margin:0;color:var(--c-muted);background:var(--c-surface)}.vs-search svg{width:15px;height:15px}.vs-page .vs-search input{border:0!important;background:transparent!important;outline:none!important;box-shadow:none;padding:8px 0;color:var(--c-text);font:inherit;font-size:11px;width:190px}.vs-search:focus-within{outline:2px solid var(--vs-blue);outline-offset:2px}
.vs-detail-tabs{display:flex;gap:22px;padding:0 20px;border-bottom:1px solid var(--vs-line)}#content .vs-page .vs-tab{padding:9px 0 11px;background:transparent;border:0;border-bottom:2px solid transparent;border-radius:0;color:var(--c-muted);font-size:12px;font-weight:600;margin:0;box-shadow:none}#content .vs-page .vs-tab.on{border-color:var(--vs-blue);color:var(--vs-blue)}.vs-tab span{background:var(--vs-fill);border-radius:4px;padding:2px 5px;font-size:9px;margin-left:4px}
.vs-table-scroll{overflow-x:auto}.vs-page .vs-table{width:100%;border-collapse:collapse;font-size:11px;table-layout:auto;margin:0;min-width:560px}.vs-page .vs-table th{background:var(--vs-fill)!important;color:var(--c-muted)!important;padding:0 16px;border:0!important;border-bottom:1px solid var(--vs-line)!important;text-transform:none;font-weight:500;white-space:nowrap}
#content .vs-page .vs-table th button{padding:10px 0;background:transparent;border:0;color:inherit;font-size:10px;font-weight:600;margin:0;box-shadow:none;white-space:nowrap}.vs-table th button span{font-size:10px;opacity:.6;margin-left:5px}.vs-page .vs-table td{padding:11px 16px;border:0;border-bottom:1px solid var(--vs-line);color:var(--c-text);vertical-align:middle;height:42px}.vs-page .vs-table tr:last-child td{border-bottom:0}.vs-page .vs-table td:first-child,.vs-page .vs-table th:first-child{padding-left:20px}.vs-table tbody tr:hover{background:var(--vs-fill)}.vs-table td strong{font-weight:600}.vs-table .vs-numeric{font-variant-numeric:tabular-nums;white-space:nowrap}.vs-content-type{display:inline-block;font-size:8px;padding:1px 4px;background:var(--vs-fill);border:1px solid var(--vs-line);border-radius:3px;margin-left:8px;color:var(--c-muted)}
.vs-share{display:inline-block;width:55px;height:4px;background:var(--vs-fill);border-radius:3px;overflow:hidden;vertical-align:middle;margin-right:7px}.vs-share span{display:block;height:100%;background:var(--vs-blue);border-radius:3px}.vs-share-value{font-size:10px;font-variant-numeric:tabular-nums;white-space:nowrap}.vs-table-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;border-top:1px solid var(--vs-line);padding:11px 20px;color:var(--c-muted);font-size:10px}.vs-table-footer>div{display:flex;align-items:center;gap:10px}.vs-table-footer .vs-button{min-height:28px!important;font-size:10px!important;padding:4px 9px!important}.vs-no-rows{text-align:center;padding:35px 15px!important;color:var(--c-muted)!important}
.vs-method{font-size:11px;color:var(--c-muted);margin:18px 0 6px;padding:0 2px}.vs-method summary{cursor:pointer;font-size:11px;font-weight:500;display:list-item}.vs-method p{max-width:1000px;line-height:1.8;margin:10px 0 0}
@media(min-width:1600px){.vs-page .vs-cv{height:260px}.vs-page .vs-cv-small{height:190px}}
@media(max-width:1250px){.vs-type{margin-left:0}.vs-toolbar{gap:12px}.vs-date-fields label{flex-direction:column;align-items:flex-start;gap:2px}.vs-date-fields>span{margin-top:12px}.vs-date-fields .vs-button{align-self:flex-end}.vs-rank-row{gap:8px}.vs-page .vs-kv{font-size:25px}.vs-kpi-note{font-size:9px}.vs-hourly{grid-column:span 5}.vs-density{grid-column:span 7}}
@media(max-width:1000px){.vs-trend{grid-column:span 7}.vs-ranking{grid-column:span 5}.vs-hourly,.vs-density{grid-column:span 6}.vs-page .vs-card{padding:16px}.vs-page .vs-details{padding:0}.vs-page .vs-head{align-items:flex-start}.vs-updated{display:none}.vs-page .vs-hrow{min-width:350px}.vs-page .vs-kpis{gap:10px}.vs-page .vs-kpi{padding:14px}.vs-kpi-note{min-height:27px}}
@media(max-width:760px){.vs-page .vs-grid{grid-template-columns:minmax(0,1fr);gap:14px}.vs-trend,.vs-ranking,.vs-hourly,.vs-density,.vs-details{grid-column:1}.vs-page .vs-kpis{grid-template-columns:repeat(2,minmax(0,1fr));margin-bottom:14px}.vs-kpi-note{min-height:0}.vs-page .vs-head{flex-wrap:wrap;gap:12px;margin-bottom:16px}#content .vs-page .vs-head h2{font-size:25px!important}.vs-head-actions{width:100%;justify-content:flex-end}.vs-toolbar{padding:12px;gap:13px}.vs-date-fields{order:3;width:100%;flex-wrap:wrap}.vs-date-fields label{flex:1;min-width:100px}.vs-page .vs-date-fields input{width:100%;font-size:12px}.vs-type{margin-left:auto}.vs-filter-label{display:none}.vs-page .vs-seg{padding:7px 10px!important}.vs-page .vs-cv{height:210px}.vs-page .vs-cv-small{height:180px}.vs-detail-head{align-items:flex-start;flex-direction:column;padding:16px}.vs-search{width:100%}.vs-page .vs-search input{width:100%}.vs-table-footer{padding:10px 12px}.vs-page .vs-hrow{min-width:390px}}
@media(prefers-reduced-motion:reduce){.vs-page *{transition:none!important}}

/* Keep legacy table colours from leaking into this report. */
.vs-page .vs-table{font-size:12px;background:var(--c-surface)!important}
.vs-page .vs-table td{background:var(--c-surface)!important}
.vs-page .vs-table tbody tr:nth-child(even) td{background:var(--vs-fill)!important}
.vs-page .vs-table tbody tr:hover td{background:var(--vs-fill)!important}
#content .vs-page .vs-table th button{font-size:11px}
.vs-page .vs-table td:first-child{min-width:175px;max-width:300px}
.vs-page .vs-table td:first-child strong{display:inline-block;max-width:230px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}
.vs-page .vs-table td:last-child{max-width:300px;overflow:hidden;text-overflow:ellipsis}
@media(max-width:760px){.vs-page .vs-table td:first-child{min-width:175px}.vs-page .vs-table{min-width:670px}.vs-page .vs-table td:first-child strong{max-width:190px}}

/* Preserve filter selection against the legacy dark-mode button selector. */
#content .vs-page .vs-seg.on{background:var(--vs-blue)!important;color:#fff!important}
#content .vs-page .vs-export{background:var(--vs-blue)!important;color:#fff!important;border-color:var(--vs-blue)!important}
body.dark-mode #content .vs-page .vs-seg.on,body.dark-mode #content .vs-page .vs-export{color:#fff!important}

/* Fit analytics to the existing panel content instead of a centred standalone page. */
#content > .vs-page{width:100%;max-width:none;margin:0}
.vs-page .vs-eyebrow{display:none}
.vs-page .vs-head{gap:14px;margin-bottom:14px}
#content .vs-page .vs-head h2{font-size:23px!important;letter-spacing:-.4px;margin-bottom:4px}
.vs-page .vs-head p{font-size:12px}
.vs-page .vs-toolbar{padding:10px 12px;margin-bottom:14px;gap:12px}
.vs-page .vs-kpis{gap:12px;margin-bottom:14px}
.vs-page .vs-kpi{padding:13px 16px}
.vs-page .vs-kv{font-size:26px;margin:7px 0}
.vs-page .vs-grid{gap:14px}
.vs-page .vs-card{padding:16px}
.vs-page .vs-card-head{margin-bottom:14px}
.vs-page .vs-cv{height:200px}
.vs-page .vs-cv-small{height:165px}
.vs-page .vs-rank-row{margin-bottom:12px}
.vs-page .vs-chart-foot{margin-top:12px;padding-top:10px}
.vs-page .vs-details{padding:0}
@media(min-width:1600px){.vs-page .vs-trend{grid-column:span 8}.vs-page .vs-ranking{grid-column:span 4}}
@media(max-width:760px){.vs-page .vs-head-actions{width:auto;margin-left:auto}.vs-page .vs-toolbar{gap:12px}.vs-page .vs-kpi{padding:13px 12px}.vs-page .vs-kv{font-size:23px}.vs-page .vs-cv{height:190px}.vs-page .vs-cv-small{height:165px}}

/* Statistics reset confirmation. */
.vs-page .vs-head-actions{flex-wrap:wrap;justify-content:flex-end;max-width:100%}
#content .vs-page .vs-reset{color:var(--c-err)!important;border-color:var(--c-border);background:var(--c-surface)}
#content .vs-page .vs-reset:hover:not(:disabled){border-color:var(--c-err);background:var(--vs-fill)}
.vs-reset-dialog{width:min(480px,calc(100vw - 32px));max-height:calc(100vh - 40px);overflow:auto;margin:auto;padding:24px;border:1px solid var(--c-border);border-radius:12px;background:var(--c-surface);color:var(--c-text);box-shadow:0 24px 70px #0005;font:14px/1.6 "Segoe UI",system-ui,sans-serif}
.vs-reset-dialog::backdrop{background:rgba(10,20,35,.6)}
.vs-reset-dialog h3{font-size:19px!important;font-weight:650;margin:0 0 12px;color:var(--c-text)}
.vs-reset-dialog p{margin:0 0 14px;color:var(--c-muted);font-size:13px}
.vs-reset-dialog .vs-reset-warning{color:var(--c-text);padding:10px 12px;background:var(--c-surface-2);border-radius:7px}
.vs-reset-dialog [hidden]{display:none!important}.vs-reset-dialog #vsResetError{color:var(--c-err)}
.vs-reset-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}
.vs-reset-actions button{min-height:36px;display:inline-flex;align-items:center;justify-content:center;gap:7px;cursor:pointer;font-family:inherit}

.vs-reset-actions button:disabled{opacity:.5;cursor:wait}.vs-reset-actions button:focus-visible{outline:3px solid var(--c-accent);outline-offset:3px}

/* Analytics actions share the panel button system and theme palette. */
#content .vs-page .vs-head-actions .vs-button,#content .vs-page #vsApply{min-height:36px;border-radius:var(--radius)!important;font-size:14px!important;font-weight:500!important}
#content .vs-page .vs-button.btn-primary{background:var(--c-accent)!important;border-color:var(--c-accent)!important;color:#fff!important}
#content .vs-page .vs-button.btn-primary:hover:not(:disabled){background:var(--c-accent-hover)!important;border-color:var(--c-accent-hover)!important}
#content .vs-page .vs-button.btn-secondary{background:var(--c-surface)!important;border-color:var(--c-border)!important;color:var(--c-text)!important}
#content .vs-page .vs-button.btn-secondary:hover:not(:disabled){background:var(--c-surface-2)!important;border-color:var(--c-accent)!important}
#content .vs-page .vs-button.btn-danger:hover:not(:disabled),.vs-reset-dialog .btn-danger:hover:not(:disabled){background:var(--c-err)!important;border-color:var(--c-err)!important;color:#fff!important}
.vs-reset-dialog .btn:focus-visible{outline:3px solid var(--c-accent);outline-offset:3px}

/* Device inventory: keep nationality and language visible, group technical metadata. */
#devices-container .devices-table-wrapper{width:100%;max-width:100%;max-height:none;overflow:auto}
#devices-container .devices-compact-table{width:100%;min-width:1000px;table-layout:fixed;border-collapse:collapse;margin:0;font-size:11px}
#devices-container .devices-compact-table th,#devices-container .devices-compact-table td{padding:7px 4px!important;white-space:normal!important;overflow-wrap:anywhere;vertical-align:middle;line-height:1.45}
#devices-container .devices-compact-table th{font-size:10px!important;font-weight:600!important;letter-spacing:0!important;text-transform:none!important}
#devices-container .devices-compact-table td{font-size:11px!important}
#devices-container .devices-compact-table td.device-nationality,#devices-container .devices-compact-table td.device-language{font-weight:600;color:var(--c-text)}
#devices-container .device-cell-id{display:block;font:9px/1.4 Consolas,monospace;color:var(--c-muted);background:transparent;margin-top:4px;overflow-wrap:anywhere}
#devices-container .devices-compact-table small{font-size:9px;color:var(--c-muted)}
#devices-container .device-cell-network,#devices-container .device-cell-network code{font:9px/1.5 Consolas,monospace;color:var(--c-text);background:transparent}
#devices-container .device-cell-stay div+div{margin-top:4px}
#devices-container .devices-compact-table td.device-cell-seen{font-size:9px!important;color:var(--c-muted)}
#devices-container .device-compact-status{display:inline-flex;align-items:center;gap:4px;font-size:10px;font-weight:600;cursor:pointer}
#devices-container .device-compact-status:before{content:'';width:5px;height:5px;border-radius:50%;background:var(--c-err);flex-shrink:0}
#devices-container .device-compact-status.online{color:var(--c-ok)}#devices-container .device-compact-status.online:before{background:var(--c-ok)}
#devices-container .device-compact-status.disabled{color:var(--c-warn)}#devices-container .device-compact-status.disabled:before{background:var(--c-warn)}
#devices-container .devices-compact-table .device-actions--table{display:grid!important;grid-template-columns:repeat(3,22px);gap:3px;justify-content:center}
#devices-container .devices-compact-table .device-action{width:22px!important;min-width:0!important;height:24px!important;padding:0!important;margin:0!important;display:inline-flex;align-items:center;justify-content:center;font-size:11px!important;border-radius:4px!important}
#devices-container .devices-compact-table .device-action i{font-size:11px!important}
#devices-container .device-card-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 14px;margin:0 0 16px}
#devices-container .device-card-field{min-width:0}
#devices-container .device-card-field>span{display:block;font-size:10px;color:var(--c-muted);margin-bottom:3px}
#devices-container .device-card-field>strong{display:block;font-size:12px;font-weight:500;color:var(--c-text);white-space:normal;overflow-wrap:anywhere;line-height:1.45}
#dd table.dd-kv{font-size:12px}#dd table.dd-kv td{padding:4px 0;overflow-wrap:anywhere}
@media(min-width:1600px){#devices-container .devices-compact-table td{font-size:12px!important}#devices-container .devices-compact-table th{font-size:11px!important}}
@media(max-width:1250px){#devices-container .devices-compact-table{min-width:980px}#devices-container .devices-compact-table th,#devices-container .devices-compact-table td{padding:6px 3px!important}}

#devices-container .device-card{min-width:0;max-width:100%;box-sizing:border-box}
#devices-container .device-card .device-id-badge{display:inline-block;max-width:100%;white-space:normal;overflow-wrap:anywhere}
#devices-container .device-card>div:first-child>div{min-width:0}
#devices-container .device-card .device-actions{display:flex;flex-wrap:wrap;gap:6px}
@media(max-width:760px){#devices-container .device-card{padding:14px}#devices-container .device-card .device-actions .device-action{flex:1 1 42px!important;min-width:32px;padding:7px!important;font-size:11px!important}#devices-container .device-card-fields{gap:9px 12px}}

/* Account transfer follows the panel theme and keeps the financial scope visible. */
.folio-auth-overlay{overflow:auto}
.folio-auth-overlay form{background:var(--c-surface)!important;color:var(--c-text)!important;max-height:calc(100vh - 24px);overflow:auto;border:1px solid var(--c-border)}
.folio-auth-overlay h3{color:var(--c-text)!important}
.folio-transfer-summary{display:grid;grid-template-columns:1fr;gap:4px;background:var(--c-surface-2);padding:12px 14px;border-radius:8px;border:1px solid var(--c-border);margin-bottom:12px}
.folio-transfer-summary span{font-size:11px;color:var(--c-muted)}.folio-transfer-summary strong{font-size:14px;color:var(--c-text)}
.folio-transfer-label{display:flex;flex-direction:column;gap:6px;font-size:12px;font-weight:600;margin:12px 0}
.folio-transfer-label select{width:100%;min-height:38px;background:var(--c-surface);color:var(--c-text);border:1px solid var(--c-border);border-radius:6px}
.folio-transfer-note{font-size:12px;line-height:1.6;color:var(--c-muted)}
.folio-auth-overlay button:disabled{opacity:.5;cursor:wait}

/* Uniform theme-coloured action glyphs, sized for an intentional two-row toolbar. */
#devices-container .devices-compact-table{min-width:1100px}
#devices-container .devices-compact-table .device-actions--table{display:grid!important;grid-template-columns:repeat(3,34px);grid-auto-rows:34px;gap:5px!important;align-items:center;justify-content:center;width:max-content;margin:0 auto}
#devices-container .devices-compact-table .device-action{width:34px!important;height:34px!important;min-width:34px!important;min-height:34px!important;padding:0!important;line-height:1!important;flex:none!important;box-sizing:border-box;transform:none!important;vertical-align:middle;border-radius:6px!important}
#devices-container .device-action-icon{display:block;width:18px;height:18px;flex:0 0 18px;margin:0;vertical-align:middle;color:inherit}
#devices-container .devices-compact-table .device-action:hover{transform:none!important;box-shadow:none!important}
#devices-container .devices-compact-table td:last-child{padding:7px 4px!important;text-align:center}
#devices-container .device-action{background:var(--c-surface)!important;color:var(--c-accent)!important;border-color:var(--c-border)!important}
#devices-container .device-action:hover{background:var(--c-surface-2)!important;border-color:var(--c-accent)!important}
#devices-container .device-action--danger{color:var(--c-err)!important}
#devices-container .device-action--warning{color:var(--c-warn)!important}
#devices-container .device-action--success{color:var(--c-ok)!important}
@media(max-width:1250px){#devices-container .devices-compact-table{min-width:1100px}}
@media(max-width:760px){#devices-container .device-card .device-actions .device-action{min-height:40px!important;min-width:40px!important}}

.folio-auth-overlay .form-input{width:100%;box-sizing:border-box;min-height:38px;padding:8px 10px;border:1px solid var(--c-border);border-radius:6px;background:var(--c-surface);color:var(--c-text);font:inherit}
.folio-auth-overlay .form-input:focus{outline:2px solid var(--c-accent);outline-offset:1px}

/* Per-device menu overrides sit beside the existing identity and playback settings. */
#dd .dd-menu-card{grid-column:1/-1}
#dd .dd-menu-help{font-size:12px;line-height:1.6;color:var(--c-muted);margin:0 0 12px}
#dd .dd-menu-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
#dd .dd-menu-grid label{display:flex;flex-direction:column;gap:5px;font-size:12px;color:var(--c-text);min-width:0}
#dd .dd-menu-grid select.dd-i{font-size:12px;padding:6px 8px;min-height:34px}
#dd .dd-menu-status{font-size:12px;color:var(--c-muted);line-height:1.6;margin-top:12px;min-height:18px}
@media(max-width:860px){#dd .dd-menu-grid{grid-template-columns:repeat(2,minmax(0,1fr))}#dd .dd-menu-card h4{flex-wrap:wrap}}
@media(max-width:440px){#dd .dd-menu-grid{grid-template-columns:minmax(0,1fr)}}

/* Device settings use the same surface and button palette as the surrounding panel. */
#dd{background:var(--c-bg)!important;color:var(--c-text)!important}
#dd .dd-tabs,#dd .dd-foot,#dd .dd-card{background:var(--c-surface)!important;border-color:var(--c-border)!important;color:var(--c-text)!important}
#dd .dd-btn{background:var(--c-surface-2)!important;border-color:var(--c-border)!important;color:var(--c-text)!important}
#dd .dd-btn.pri{background:var(--c-accent)!important;border-color:var(--c-accent)!important;color:#fff!important}
#dd .dd-btn.pri:hover:not(:disabled){background:var(--c-accent-hover)!important}
#dd .dd-btn.dan{color:var(--c-err)!important}

/* Message preview follows the current admin theme. */
#dd .dd-prev{background:var(--c-bg,#f5f6f8);border:1px solid var(--c-border,#dfe3e8)}
#dd .dd-prev .card{background:var(--c-surface,#fff);color:var(--c-text,#1f2933);border-color:var(--c-border,#dfe3e8)}
#dd .dd-prev .card b{color:var(--c-text,#1f2933)}
#dd .dd-prev .card span{background:var(--c-accent,#2f5d8a);color:#fff}
#messagesList{color:var(--c-text,#1f2933)}
#messagesList > div{border-color:var(--c-border,#dfe3e8)!important}
#messagesList > div > div > div:first-child{color:var(--c-text,#1f2933)!important}

/* ---- Custom menu buttons + page designer (js/custom-menu.js) ---- */
.cm-root { padding: 16px; }
.cm-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.cm-head h2 { margin: 0; }
.cm-muted { color: var(--c-muted); font-size: 13px; }
.cm-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }
.cm-spacer { flex: 1; }
.cm-status { margin: 8px 0; font-size: 13px; min-height: 0; }
.cm-status.ok { padding: 8px 12px; border-radius: var(--radius); background: rgba(46, 125, 80, .1); color: var(--c-ok, #2e7d50); }
.cm-status.err { padding: 8px 12px; border-radius: var(--radius); background: rgba(192, 57, 43, .1); color: var(--c-err, #c0392b); }
.cm-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.cm-card { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); }
.cm-card.is-off { opacity: .55; }
.cm-card-icon, .cm-icon-preview { width: 48px; height: 48px; border-radius: var(--radius); background: #1b2433; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.cm-card-icon img, .cm-icon-preview img { max-width: 36px; max-height: 36px; }
.cm-icon-default { color: #c9a66b; font-size: 24px; }
.cm-card-body { flex: 1; min-width: 0; }
.cm-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cm-switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; cursor: pointer; }
.cm-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.cm-switch span { position: absolute; inset: 0; border-radius: 22px; background: var(--c-border); transition: background .15s; }
.cm-switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.cm-switch input:checked + span { background: var(--c-accent); }
.cm-switch input:checked + span::after { transform: translateX(18px); }
.cm-switch input:focus-visible + span { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.cm-empty { padding: 26px; text-align: center; color: var(--c-muted); border: 1px dashed var(--c-border); border-radius: var(--radius); margin-top: 8px; }
.cm-sub { margin: 22px 0 6px; font-size: 16px; }
.cm-pages { display: flex; flex-direction: column; gap: 6px; }
.cm-page-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); }
.cm-page-dot { width: 18px; height: 18px; border-radius: 4px; border: 3px solid; flex-shrink: 0; }
.cm-dialog { border: 1px solid var(--c-border); border-radius: 10px; padding: 0; width: min(620px, 94vw); background: var(--c-surface); color: var(--c-text); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.cm-dialog-wide { width: min(1280px, 97vw); }
.cm-dialog::backdrop { background: rgba(10, 16, 26, .55); }
.cm-dialog-head, .cm-dialog-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--c-border); }
.cm-dialog-head h3 { margin: 0; flex: 1; font-size: 17px; }
.cm-dialog-foot { border-bottom: 0; border-top: 1px solid var(--c-border); justify-content: flex-end; }
.cm-dialog-err { flex: 1; color: var(--c-err, #c0392b); font-size: 13px; }
.cm-dialog-body { padding: 14px 16px; max-height: 76vh; overflow: auto; }
.cm-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; }
.cm-field > span { color: var(--c-muted); font-weight: 600; }
.cm-field input, .cm-field select, .cm-field textarea, .cm-block input, .cm-block textarea { width: 100%; box-sizing: border-box; padding: 7px 9px; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); color: var(--c-text); font: inherit; }
.cm-field input[type="color"] { height: 34px; padding: 2px; }
.cm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.cm-grid3 { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 0 10px; }
.cm-more { margin-bottom: 10px; font-size: 13px; }
.cm-more summary { cursor: pointer; color: var(--c-accent); margin-bottom: 8px; }
.cm-icon-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cm-icon-row select { flex: 1; min-width: 160px; }
.cm-designer { display: grid; grid-template-columns: minmax(330px, 420px) 1fr; gap: 18px; align-items: start; }
.cm-designer-right { position: sticky; top: 0; }
.cm-langs { display: flex; gap: 4px; margin-bottom: 10px; }
.cm-lang { padding: 5px 14px; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); color: var(--c-text); cursor: pointer; font-weight: 600; }
.cm-lang.active { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.cm-blocks { display: flex; flex-direction: column; gap: 8px; }
.cm-block { border: 1px solid var(--c-border); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 6px; background: var(--c-surface); }
.cm-block-head { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.cm-block .btn-sm { padding: 3px 9px !important; }
.cm-info-edit { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; }
.cm-thumb { height: 40px; border-radius: 4px; }
.cm-add { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.cm-preview-label { margin-bottom: 6px; }
.cm-preview { container-type: inline-size; width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; border: 1px solid var(--c-border); box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
/* TV page (mirrors Android CustomPageActivity): sizes in cqw so the preview scales like a 1920x1080 screen */
.cmp-screen { position: relative; width: 100%; height: 100%; background-size: cover; background-position: center; color: #f2f2f2; font-family: "Segoe UI", Roboto, Arial, sans-serif; }
.cmp-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, .15)); }
.cmp-inner { position: relative; height: 100%; box-sizing: border-box; padding: 4.2cqw 6cqw; overflow: hidden; display: flex; flex-direction: column; gap: 1.1cqw; }
.cmp-title { font-size: 3.4cqw; font-weight: 700; line-height: 1.15; }
.cmp-bar { width: 6cqw; height: .3cqw; border-radius: 1px; margin-bottom: .6cqw; }
.cmp-h { font-size: 2.1cqw; font-weight: 600; margin-top: .6cqw; }
.cmp-t { font-size: 1.45cqw; line-height: 1.5; margin: 0; max-width: 62cqw; color: #e6e6e6; }
.cmp-img { margin: 0; display: flex; flex-direction: column; gap: .5cqw; }
.cmp-img img, .cmp-img-ph { max-width: 42cqw; max-height: 22cqw; border-radius: .5cqw; object-fit: cover; }
.cmp-img-ph { width: 30cqw; height: 15cqw; border: .15cqw dashed rgba(255, 255, 255, .4); display: flex; align-items: center; justify-content: center; font-size: 1.3cqw; color: rgba(255, 255, 255, .6); }
.cmp-img figcaption { font-size: 1.15cqw; color: rgba(255, 255, 255, .65); }
.cmp-info { max-width: 52cqw; display: flex; flex-direction: column; }
.cmp-row { display: flex; justify-content: space-between; gap: 2cqw; padding: .7cqw 0; border-bottom: .1cqw solid; font-size: 1.45cqw; }
.cmp-row span { color: rgba(255, 255, 255, .6); }
.cmp-row b { font-weight: 600; text-align: right; }
.cmp-qr { display: flex; align-items: center; gap: 1.6cqw; }
.cmp-qr-box { width: 11cqw; height: 11cqw; background: #fff; color: #111; border-radius: .5cqw; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: .6cqw; box-sizing: border-box; overflow: hidden; }
.cmp-qr-box b { font-size: 2.6cqw; letter-spacing: .2cqw; }
.cmp-qr-box small { font-size: .75cqw; word-break: break-all; text-align: center; color: #555; }
.cmp-qr > span { font-size: 1.35cqw; color: rgba(255, 255, 255, .8); }
body.dark-mode .cm-dialog { background: var(--c-surface); color: var(--c-text); }
body.dark-mode .cm-card-icon, body.dark-mode .cm-icon-preview { background: #0d141e; }
body.dark-mode .cm-status.ok { background: rgba(76, 175, 122, .12); }
body.dark-mode .cm-status.err { background: rgba(224, 108, 108, .12); }
@media (max-width: 900px) { .cm-designer { grid-template-columns: 1fr; } .cm-card { flex-wrap: wrap; } .cm-grid3 { grid-template-columns: 1fr 1fr; } }
