/* =============================================================================
   OTS SIGNAGE DARK THEME (REBUILT)
   February 4, 2026
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  color-scheme: dark;

  --ots-bg: #0b111a;
  --ots-surface: #141c2b;
  --ots-surface-2: #1b2436;
  --ots-surface-3: #222c3f;
  --ots-border: #2c3a54;
  --ots-border-soft: #243047;
  --ots-text: #e6eefb;
  --ots-text-muted: #a9b6cc;
  --ots-text-faint: #8d99b4;
  --ots-primary: #e87800;
  --ots-primary-rgb: 232, 120, 0;
  --ots-primary-2: #c46500;
  --ots-success: #2ad4a4;
  --ots-warning: #f4b860;
  --ots-danger: #ff6b6b;
  --ots-info: #5ec0ff;

  --ots-shadow-lg: 0 14px 30px rgba(0, 0, 0, 0.35);
  --ots-shadow-md: 0 8px 18px rgba(0, 0, 0, 0.25);
  --ots-shadow-sm: 0 3px 8px rgba(0, 0, 0, 0.2);

  --ots-radius-sm: 4px;
  --ots-radius-md: 8px;
  --ots-radius-lg: 12px;

  --ots-transition: 160ms ease;

  /* Modal pop-ups */
  --modal-backdrop-bg: rgba(2, 6, 23, 0.55);
  --modal-backdrop-blur: 6px;
  --modal-bg: #141c2b;
  --modal-border: #2c3a54;
  --modal-radius: 12px;
  --modal-shadow: 0 24px 64px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --modal-header-bg: #0f172a;
  --modal-header-border: #2c3a54;
  --modal-header-text: #f1f5f9;
  --modal-body-bg: #141c2b;
  --modal-body-text: #e2e8f0;
  --modal-footer-bg: #0f172a;
  --modal-footer-border: #2c3a54;
  --modal-close-color: #64748b;
  --modal-close-hover: #f1f5f9;
  --modal-input-bg: #0b111a;
  --modal-input-border: #2c3a54;
  --modal-input-text: #e6eefb;
  --modal-input-focus-border: #e87800;
  --modal-input-focus-ring: rgba(var(--ots-primary-rgb), 0.2);
}

/* =============================================================================
   GLOBAL
   ============================================================================= */

html,
body {
  background: var(--ots-bg);
  color: var(--ots-text);
}

body {
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

a,
.nav-link,
.sidebar a {
  color: var(--ots-text);
  text-decoration: none;
  transition: color var(--ots-transition), background var(--ots-transition);
}

a:hover,
.nav-link:hover,
.sidebar a:hover {
  color: var(--ots-primary);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--ots-text);
  font-weight: 600;
}

small,
.text-muted {
  color: var(--ots-text-muted) !important;
}

hr {
  border-color: var(--ots-border);
}

/* ---------- Accessibility: focus-visible ---------- */
*:focus-visible {
  outline: 2px solid var(--ots-primary);
  outline-offset: 2px;
}

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.nav-link:focus-visible {
  outline: 2px solid var(--ots-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(var(--ots-primary-rgb), 0.25);
}

.ots-sidebar li a:focus-visible {
  outline: 2px solid var(--ots-primary);
  outline-offset: -2px;
  border-radius: var(--ots-radius-sm);
}

.sidebar-group-toggle:focus-visible {
  outline: 2px solid var(--ots-primary);
  outline-offset: -2px;
  border-radius: var(--ots-radius-sm);
}

table tbody tr:focus-within {
  outline: 1px solid var(--ots-primary);
  outline-offset: -1px;
}

/* =============================================================================
   LAYOUT WRAPPERS
   ============================================================================= */

#page-wrapper,
#content-wrapper,
.page-content {
  background: var(--ots-bg);
}

.page-content {
  padding-top: 24px;
}

/* =============================================================================
   NAVBAR / TOPBAR
   ============================================================================= */

.navbar,
.navbar-default {
  background: var(--ots-surface-2);
  border: 1px solid var(--ots-border);
  box-shadow: var(--ots-shadow-sm);
}

/* Horizontal nav mode: remove sidebar margins from #content-wrapper */
.navbar.navbar-expand-lg ~ #content-wrapper {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  padding-left: 20px !important;
  padding-right: 20px !important;
}

.navbar.navbar-expand-lg ~ #content-wrapper .page-content {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.navbar.navbar-expand-lg ~ #content-wrapper .page-content .row {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.navbar.navbar-expand-lg ~ #content-wrapper .page-content [class*="col-"] {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.navbar.navbar-expand-lg ~ #content-wrapper .page-content > .row > .col-sm-12 {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.navbar.navbar-expand-lg ~ #content-wrapper,
.navbar.navbar-expand-lg ~ #content-wrapper .page-content {
  background: var(--ots-bg) !important;
  color: var(--ots-text) !important;
}

.navbar-brand,
.navbar-brand .xibo-logo {
  color: var(--ots-text);
}

.navbar-nav > li > a,
.navbar-nav > .active > a,
.navbar-nav > .open > a {
  color: var(--ots-text) !important;
  background: transparent !important;
}

.navbar-nav > li > a:hover {
  color: var(--ots-primary) !important;
}

.navbar-toggler,
.navbar-toggler-side {
  color: var(--ots-text);
  border: 1px solid var(--ots-border);
}

/* Topbar nav refinements (dark) */
.ots-topbar.navbar-nav {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  gap: 6px;
  height: auto;
  align-items: center;
}

.ots-topbar .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ots-text);
  font-weight: 600;
  transition: background var(--ots-transition), color var(--ots-transition);
}

.ots-topbar .nav-link:hover,
.ots-topbar .nav-item.open .nav-link,
.ots-topbar .nav-item.active .nav-link {
  background: rgba(var(--ots-primary-rgb), 0.18);
  color: var(--ots-primary);
}

.ots-topbar .dropdown-menu {
  border-radius: 12px;
  padding: 8px;
  box-shadow: var(--ots-shadow-md);
}

.ots-topbar .dropdown-item,
.ots-topbar .dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  padding: 8px 10px;
}

.ots-topbar-icon {
  width: 16px;
  text-align: center;
  opacity: 0.85;
  font-size: 13px;
}

/* =============================================================================
   SIDEBAR
   ============================================================================= */

#sidebar-wrapper {
  background: var(--ots-surface);
  border-right: 1px solid var(--ots-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* OTS sidebar override marker */
.ots-sidebar-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--ots-surface);
}

/* Sidebar Header */
.ots-sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--ots-border);
  background: var(--ots-surface);
}

.ots-brand-logo {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--ots-primary-rgb), 0.15);
  border: 1px solid rgba(var(--ots-primary-rgb), 0.3);
  border-radius: var(--ots-radius-sm);
  font-size: 18px;
  color: var(--ots-primary);
  flex-shrink: 0;
}

.ots-brand-text {
  flex: 1;
  min-width: 0;
}

.ots-brand-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ots-text);
  letter-spacing: 0.5px;
}

.ots-sidebar-close {
  background: none;
  border: none;
  color: var(--ots-text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--ots-transition);
  flex-shrink: 0;
}

.ots-sidebar-close:hover {
  color: var(--ots-text);
}

/* Sidebar Content */
.ots-sidebar {
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 12px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.ots-sidebar li {
  margin: 0;
  padding: 0;
}

/* Dark-mode repair overrides: ensure sidebar doesn't draw a vertical divider */
#sidebar-wrapper,
.ots-sidebar {
  border-right: none !important;
  box-shadow: none !important;
}

/* Hide pseudo-elements that might draw a divider */
.ots-sidebar::before,
.ots-sidebar::after,
#sidebar-wrapper::before,
#sidebar-wrapper::after,
#page-wrapper::before,
#page-wrapper::after {
  content: none !important;
  display: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Sidebar Main Item */
.ots-sidebar li.sidebar-main > a {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 8px;
  padding: 10px 12px;
  border-radius: var(--ots-radius-sm);
  color: var(--ots-text);
  text-decoration: none;
  transition: background var(--ots-transition), color var(--ots-transition);
  font-size: 14px;
  font-weight: 500;
}

.ots-sidebar li.sidebar-main > a:hover {
  background: rgba(var(--ots-primary-rgb), 0.12);
  color: var(--ots-primary);
}

.ots-sidebar li.sidebar-main > a.active {
  background: rgba(var(--ots-primary-rgb), 0.2);
  color: var(--ots-primary);
}

/* Sidebar Section (Collapsible) */
.ots-sidebar li.sidebar-section > a.sidebar-section-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 8px;
  padding: 10px 12px;
  border-radius: var(--ots-radius-sm);
  color: var(--ots-text);
  text-decoration: none;
  transition: background var(--ots-transition), color var(--ots-transition);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  width: calc(100% - 16px);
}

.ots-sidebar li.sidebar-section > a.sidebar-section-toggle:hover {
  background: rgba(var(--ots-primary-rgb), 0.12);
  color: var(--ots-primary);
}

.ots-sidebar li.sidebar-section > a.sidebar-section-toggle.active {
  background: rgba(var(--ots-primary-rgb), 0.12);
  color: var(--ots-primary);
}

.ots-section-toggle-icon {
  margin-left: auto;
  font-size: 12px;
  transition: transform var(--ots-transition);
}

.ots-sidebar li.sidebar-section > a.sidebar-section-toggle.active .ots-section-toggle-icon {
  transform: rotate(180deg);
}

/* Sidebar Subsection */
.ots-sidebar .sidebar-subsection {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  display: none;
  background: rgba(var(--ots-primary-rgb), 0.05);
}

.ots-sidebar .sidebar-subsection.active {
  display: block;
}

.ots-sidebar .sidebar-subsection li {
  margin: 0;
  padding: 0;
}

/* Sidebar List Item */
.ots-sidebar li.sidebar-list > a {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 12px 2px 28px;
  padding: 8px 12px;
  border-radius: 4px;
  color: var(--ots-text-secondary);
  text-decoration: none;
  transition: background var(--ots-transition), color var(--ots-transition);
  font-size: 13px;
}

.ots-sidebar li.sidebar-list > a:hover {
  background: rgba(var(--ots-primary-rgb), 0.12);
  color: var(--ots-primary);
}

.ots-sidebar li.sidebar-list > a.active {
  background: rgba(var(--ots-primary-rgb), 0.15);
  color: var(--ots-primary);
}

/* Navigation Icons and Text */

/* ==========================================================================
   FORCE DARK BACKGROUND FALLBACKS
   Ensure no white areas appear when scrolling or when elements overflow.
   This uses high-specificity selectors and !important to override stray
   light-background rules from other stylesheets.
   ========================================================================== */

html, body, #page-wrapper, .ots-main, .ots-content, .page-content, .container {
  background-color: var(--color-background) !important;
  background: none !important;
  color: var(--color-text-primary) !important;
}

/* Remove or neutralise any pseudo-elements that may paint a light background */
html::before, html::after, body::before, body::after, #page-wrapper::before, #page-wrapper::after {
  background: transparent !important;
  content: none !important;
}

/* Ensure fixed/backdrop layers are dark where appropriate */
.modal-backdrop,
.modal,
.modal-open,
.ots-shell,
.ots-footer {
  background-color: var(--color-background) !important;
}

/* Defensive: override any explicit white panel backgrounds that leak outside their container */
.card, .panel, .panel-body, .dashboard-card, .content-card, .ots-sidebar li.sidebar-list.active > a {
  background-color: var(--color-surface) !important;
  color: var(--color-text-primary) !important;
}
.ots-nav-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0.85;
  font-size: 14px;
  flex-shrink: 0;
}

.ots-nav-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Spacer */
.sidebar-spacer {
  height: 12px;
  margin-top: auto;
}

/* Sidebar Footer */
.ots-sidebar-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--ots-border);
  background: var(--ots-surface);
}

.ots-user-section {
  flex: 1;
  min-width: 0;
}

.ots-user-role {
  font-size: 11px;
  color: var(--ots-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.ots-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ots-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ots-user-profile-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  color: var(--ots-text-secondary);
  text-decoration: none;
  transition: background var(--ots-transition), color var(--ots-transition);
  font-size: 16px;
  flex-shrink: 0;
}

.ots-user-profile-link:hover {
  background: rgba(var(--ots-primary-rgb), 0.12);
  color: var(--ots-primary);
}

#sidebar-wrapper .sidebar-main a:hover,
#sidebar-wrapper .sidebar-list a:hover {
  background: rgba(var(--ots-primary-rgb), 0.12);
  color: var(--ots-primary);
}

#sidebar-wrapper .sidebar-title a {
  padding: 12px 18px 6px;
  color: var(--ots-text-faint);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* =============================================================================
   WIDGETS / CARDS
   ============================================================================= */

.widget,
.card,
.panel,
.modal-content {
  background: var(--ots-surface-2);
  border: 1px solid var(--ots-border);
  border-radius: var(--ots-radius-md);
  box-shadow: var(--ots-shadow-sm);
}

.widget-title,
.panel-heading,
.card-header,
.modal-header {
  background: var(--ots-surface-3);
  border-bottom: 1px solid var(--ots-border);
  color: var(--ots-text);
}

.widget-body,
.panel-body,
.card-body,
.modal-body {
  color: var(--ots-text);
}

/* =============================================================================
   BUTTONS
   ============================================================================= */

.btn,
button,
input[type="button"],
input[type="submit"] {
  border-radius: var(--ots-radius-sm);
  border: 1px solid transparent;
  transition: background var(--ots-transition), border var(--ots-transition), color var(--ots-transition);
}

.btn-default,
.btn-secondary {
  background: var(--ots-surface-3);
  color: var(--ots-text);
  border-color: var(--ots-border);
}

.btn-default:hover,
.btn-secondary:hover {
  background: var(--ots-surface-2);
  border-color: var(--ots-primary);
  color: var(--ots-primary);
}

.btn-primary {
  background: var(--ots-primary);
  border-color: var(--ots-primary-2);
  color: #0b1020;
}

.btn-primary:hover {
  background: var(--ots-primary-2);
  border-color: var(--ots-primary-2);
  color: #0b1020;
}

.btn-success {
  background: var(--ots-success);
  border-color: var(--ots-success);
  color: #041410;
}

.btn-warning {
  background: var(--ots-warning);
  border-color: var(--ots-warning);
  color: #1c1200;
}

.btn-danger {
  background: var(--ots-danger);
  border-color: var(--ots-danger);
  color: #220707;
}

.btn-info {
  background: var(--ots-info);
  border-color: var(--ots-info);
  color: #07101a;
}

/* =============================================================================
   FORMS
   ============================================================================= */

.form-control,
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
select,
textarea {
  background: var(--ots-surface);
  color: var(--ots-text);
  border: 1px solid var(--ots-border);
  border-radius: var(--ots-radius-sm);
  box-shadow: none;
}

.form-control:focus,
input[type="text"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--ots-primary);
  box-shadow: 0 0 0 2px rgba(var(--ots-primary-rgb), 0.2);
  outline: none;
}

.input-group-addon {
  background: var(--ots-surface-3);
  border: 1px solid var(--ots-border);
  color: var(--ots-text-muted);
}

/* =============================================================================
   TABLES / DATATABLES
   ============================================================================= */

.table,
.table > thead > tr > th,
.table > tbody > tr > td {
  color: var(--ots-text);
  border-color: var(--ots-border);
}

.table-striped > tbody > tr:nth-of-type(odd) {
  background: rgba(var(--ots-primary-rgb), 0.04);
}

.table-hover > tbody > tr:hover {
  background: rgba(var(--ots-primary-rgb), 0.08);
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  color: var(--ots-text-muted) !important;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: var(--ots-surface) !important;
  color: var(--ots-text) !important;
  border: 1px solid var(--ots-border) !important;
}

.dataTables_wrapper table {
  color: var(--ots-text);
}

/* =============================================================================
   DROPDOWNS / MENUS
   ============================================================================= */

.dropdown-menu {
  background: var(--ots-surface-2);
  border: 1px solid var(--ots-border);
  box-shadow: var(--ots-shadow-md);
}

.dropdown-item,
.dropdown-menu > li > a {
  color: var(--ots-text);
}

.dropdown-item:hover,
.dropdown-menu > li > a:hover {
  background: rgba(var(--ots-primary-rgb), 0.12);
  color: var(--ots-primary);
}

/* =============================================================================
   ALERTS / BADGES
   ============================================================================= */

.alert {
  border-radius: var(--ots-radius-sm);
  border: 1px solid var(--ots-border);
}

.alert-success {
  background: rgba(42, 212, 164, 0.15);
  color: var(--ots-success);
}

.alert-warning {
  background: rgba(244, 184, 96, 0.15);
  color: var(--ots-warning);
}

.alert-danger {
  background: rgba(255, 107, 107, 0.15);
  color: var(--ots-danger);
}

.alert-info {
  background: rgba(94, 192, 255, 0.15);
  color: var(--ots-info);
}

.badge,
.label {
  background: var(--ots-surface-3);
  color: var(--ots-text);
  border: 1px solid var(--ots-border);
}

/* =============================================================================
   TABS / PAGINATION
   ============================================================================= */

.nav-tabs {
  border-bottom: 1px solid var(--ots-border);
}

.nav-tabs > li > a {
  color: var(--ots-text-muted);
  border: 1px solid transparent;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:focus,
.nav-tabs > li.active > a:hover {
  background: var(--ots-surface-2);
  color: var(--ots-text);
  border: 1px solid var(--ots-border);
  border-bottom-color: transparent;
}

.pagination > li > a,
.pagination > li > span {
  background: var(--ots-surface-2);
  border: 1px solid var(--ots-border);
  color: var(--ots-text);
}

.pagination > li > a:hover,
.pagination > li > span:hover {
  background: var(--ots-surface-3);
  color: var(--ots-primary);
}

.pagination > .active > a,
.pagination > .active > span {
  background: var(--ots-primary);
  border-color: var(--ots-primary-2);
  color: #0b1020;
}

/* =============================================================================
   MODALS
   ============================================================================= */

/* --- Content wrapper --- */
.modal-content {
  border-radius: var(--ots-radius-lg);
  background-color: var(--modal-bg, var(--ots-surface)) !important;
  color: var(--modal-body-text, var(--ots-text)) !important;
  border: 1px solid var(--modal-border, var(--ots-border)) !important;
  box-shadow: var(--modal-shadow, var(--ots-shadow-lg)) !important;
  overflow: hidden;
}

/* --- Transparent parents --- */
.modal,
.modal-header,
.modal-body,
.modal-footer {
  color: var(--modal-body-text, var(--ots-text)) !important;
}

/* --- Header --- */
.modal-header {
  background-color: var(--modal-header-bg, var(--ots-surface)) !important;
  border-bottom: 1px solid var(--modal-header-border, var(--ots-border)) !important;
  padding: 16px 20px !important;
}

.modal-title,
.modal-header h4,
.modal-header h5 {
  color: var(--modal-header-text, var(--ots-text)) !important;
  font-weight: 600;
}

/* --- Body --- */
.modal-body {
  background-color: var(--modal-body-bg, var(--ots-surface)) !important;
  color: var(--modal-body-text, var(--ots-text)) !important;
  padding: 20px !important;
}

/* --- Backdrop --- */
.modal-backdrop,
.modal-backdrop.show,
.modal-backdrop.in {
  background-color: var(--modal-backdrop-bg, rgba(0, 0, 0, 0.3)) !important;
  backdrop-filter: blur(var(--modal-backdrop-blur, 4px)) !important;
  -webkit-backdrop-filter: blur(var(--modal-backdrop-blur, 4px)) !important;
  opacity: 1 !important;
}

/* --- Footer --- */
.modal-footer {
  background-color: var(--modal-footer-bg, transparent) !important;
  border-top: 1px solid var(--modal-footer-border, var(--ots-border)) !important;
  padding: 12px 20px !important;
}

/* Footer buttons — secondary / cancel */
.modal-footer .btn,
.modal-footer button {
  background: var(--modal-body-bg, var(--ots-surface-3)) !important;
  color: var(--modal-body-text, var(--ots-text)) !important;
  border: 1px solid var(--modal-border, var(--ots-border)) !important;
  box-shadow: none !important;
  border-radius: var(--ots-radius-sm) !important;
  transition: background var(--ots-transition),
              color var(--ots-transition),
              border-color var(--ots-transition);
}

.modal-footer .btn:hover,
.modal-footer button:hover {
  background: rgba(var(--ots-primary-rgb), 0.08) !important;
  color: var(--ots-primary) !important;
  border-color: var(--ots-primary) !important;
}

/* Footer buttons — primary / submit */
.modal-footer .btn.btn-primary,
.modal-footer button.btn-primary {
  background: var(--ots-primary) !important;
  color: #0b1020 !important;
  border-color: var(--ots-primary-2) !important;
  font-weight: 600;
}

.modal-footer .btn.btn-primary:hover,
.modal-footer button.btn-primary:hover {
  background: var(--ots-primary-2) !important;
  color: #ffffff !important;
}

/* Footer buttons — danger */
.modal-footer .btn.btn-danger {
  background: var(--ots-danger) !important;
  color: #ffffff !important;
  border-color: var(--ots-danger) !important;
}

/* --- Form controls inside modals --- */
.modal-body .form-control,
.modal-body input[type="text"],
.modal-body input[type="number"],
.modal-body input[type="email"],
.modal-body input[type="password"],
.modal-body textarea,
.modal-body select {
  background-color: var(--modal-input-bg, var(--ots-bg)) !important;
  border: 1px solid var(--modal-input-border, var(--ots-border)) !important;
  border-radius: var(--ots-radius-sm) !important;
  color: var(--modal-input-text, var(--ots-text)) !important;
}

.modal-body .form-control:focus,
.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
  border-color: var(--modal-input-focus-border, var(--ots-primary)) !important;
  box-shadow: 0 0 0 3px var(--modal-input-focus-ring, rgba(var(--ots-primary-rgb), 0.2)) !important;
  outline: none !important;
}

/* --- Bootstrap Tagsinput / Tokenfield inside modals --- */
.modal-body .bootstrap-tagsinput,
.modal-body .tagsinput,
.modal-body .tokenfield {
  background-color: var(--modal-input-bg, var(--ots-bg)) !important;
  border: 1px solid var(--modal-input-border, var(--ots-border)) !important;
  border-radius: var(--ots-radius-sm) !important;
  color: var(--modal-input-text, var(--ots-text)) !important;
  min-height: 36px;
  padding: 4px 8px !important;
  box-shadow: none !important;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.modal-body .bootstrap-tagsinput:focus-within,
.modal-body .tagsinput:focus-within,
.modal-body .tokenfield:focus-within {
  border-color: var(--modal-input-focus-border, var(--ots-primary)) !important;
  box-shadow: 0 0 0 3px var(--modal-input-focus-ring, rgba(var(--ots-primary-rgb), 0.2)) !important;
}

.modal-body .bootstrap-tagsinput input,
.modal-body .tagsinput input,
.modal-body .tokenfield input.token-input {
  background: transparent !important;
  color: var(--modal-input-text, var(--ots-text)) !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  margin: 0 !important;
  padding: 2px 4px !important;
}

.modal-body .bootstrap-tagsinput input::placeholder,
.modal-body .tagsinput input::placeholder,
.modal-body .tokenfield input.token-input::placeholder {
  color: var(--ots-text-faint, #7f8aa3) !important;
}

.modal-body .bootstrap-tagsinput .tag,
.modal-body .bootstrap-tagsinput .badge,
.modal-body .tagsinput .tag,
.modal-body .tokenfield .token {
  background: rgba(var(--ots-primary-rgb), 0.18) !important;
  border: 1px solid rgba(var(--ots-primary-rgb), 0.35) !important;
  color: var(--ots-primary, #e87800) !important;
  border-radius: 999px !important;
  padding: 2px 8px !important;
  font-size: 0.8rem;
  line-height: 1.5;
}

.modal-body .bootstrap-tagsinput .tag [data-role="remove"],
.modal-body .bootstrap-tagsinput .badge [data-role="remove"],
.modal-body .tokenfield .token .close {
  color: var(--ots-primary, #e87800) !important;
  opacity: 0.7;
  margin-left: 4px;
  cursor: pointer;
}

.modal-body .bootstrap-tagsinput .tag [data-role="remove"]:hover,
.modal-body .bootstrap-tagsinput .badge [data-role="remove"]:hover,
.modal-body .tokenfield .token .close:hover {
  opacity: 1;
}

/* Global bootstrap-tagsinput theming (outside modals too) */
.bootstrap-tagsinput,
.tagsinput,
.tokenfield {
  background-color: var(--modal-input-bg, var(--ots-bg)) !important;
  border: 1px solid var(--modal-input-border, var(--ots-border)) !important;
  border-radius: var(--ots-radius-sm) !important;
  color: var(--modal-input-text, var(--ots-text)) !important;
  box-shadow: none !important;
}

.bootstrap-tagsinput input,
.tagsinput input,
.tokenfield input.token-input {
  background: transparent !important;
  color: var(--modal-input-text, var(--ots-text)) !important;
}

.bootstrap-tagsinput .tag,
.bootstrap-tagsinput .badge,
.tagsinput .tag,
.tokenfield .token {
  background: rgba(var(--ots-primary-rgb), 0.18) !important;
  border: 1px solid rgba(var(--ots-primary-rgb), 0.35) !important;
  color: var(--ots-primary, #e87800) !important;
  border-radius: 999px !important;
}

/* --- Close button --- */
.modal-header .close,
.modal-header [data-dismiss="modal"] {
  color: var(--modal-close-color, var(--ots-text-muted)) !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

.modal-header .close:hover,
.modal-header [data-dismiss="modal"]:hover {
  color: var(--modal-close-hover, var(--ots-text)) !important;
}

/* =============================================================================
   HELP PANE / MISC
   ============================================================================= */

#help-pane {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

#help-pane .help-pane-container {
  position: relative;
  width: 400px;
  flex-direction: column;
  align-items: flex-start;
  border-radius: 4px;
  border: 1px solid var(--ots-border);
  background: var(--ots-surface-2);
  overflow: hidden;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

#help-pane .help-pane-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50px;
  background: var(--ots-primary);
  color: #0b1020;
  cursor: pointer;
}

#help-pane .help-pane-btn:hover {
  background: var(--ots-primary-2);
}

#help-pane .help-pane-btn i {
  font-size: 24px;
  color: #fff;
}

/* =============================================================================
   OTS DASHBOARD MESSAGE
   ============================================================================= */

.ots-dashboard-message {
  margin: 16px 0 24px;
  padding: 12px 16px;
  border-radius: var(--ots-radius-md);
  background: rgba(var(--ots-primary-rgb), 0.16);
  border: 1px solid rgba(var(--ots-primary-rgb), 0.45);
  color: var(--ots-text);
}

.ots-dashboard-message__title {
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 12px;
  margin-bottom: 4px;
}

.ots-dashboard-message__body {
  font-size: 13px;
  color: var(--ots-text-muted);
}

/* =============================================================================
   LOGIN / SIGN-IN PAGE
   Styles to match the requested sign-in card: centered panel, dark glass
   surface, orange accent, soft shadow and modern inputs.
   ============================================================================= */

:root {
  --login-accent: #e87800;
  --login-panel-bg: var(--ots-surface-2);
}

body.login, body.login-page, .xibo-login, #login, .login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--ots-bg);
}

body.login-page .container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.login-card,
.login-panel,
.auth-card,
.xibo-login-box,
#login-box {
  width: 100%;
  max-width: 520px;
  border-radius: 12px;
  padding: 36px 40px 34px;
  background: var(--ots-surface-2);
  border: 1px solid var(--ots-border);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  color: var(--ots-text);
}

.login-card .login-logo,
.login-panel .login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.login-card .login-logo .logo-icon,
.login-panel .login-logo .logo-icon {
  width: 92px;
  height: 92px;
  border-radius: 10px;
  background: var(--login-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}

/* Brand text next to logo on login */
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}

.login-brand .login-logo {
  width: 72px;
  height: 72px;
  display: inline-block;
}

.login-brand-text {
  color: var(--ots-text);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.login-card h1,
.login-panel h1 {
  text-align: center;
  margin: 8px 0 6px 0;
  font-size: 28px;
  font-weight: 700;
}

.login-card .lead,
.login-panel .lead {
  text-align: center;
  color: rgba(226,232,240,0.74);
  margin-bottom: 18px;
  font-size: 0.95rem;
}

.login-card .form-group,
.login-panel .form-group {
  margin-bottom: 14px;
}

.login-card input[type="text"],
.login-card input[type="email"],
.login-card input[type="password"],
.login-card .form-control,
.login-panel input[type="text"],
.login-panel input[type="email"],
.login-panel input[type="password"] {
  width: 100%;
  background: rgba(11, 18, 33, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: var(--ots-text);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.98rem;
  line-height: 1.25;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.login-card input:focus,
.login-panel input:focus,
.login-card .form-control:focus {
  outline: none;
  border-color: rgba(255,138,0,0.85);
  background: rgba(11, 18, 33, 0.75);
  box-shadow: 0 10px 26px rgba(0,0,0,0.38), 0 0 0 5px rgba(255,138,0,0.08);
}

.login-card input::placeholder,
.login-panel input::placeholder {
  color: rgba(255,255,255,0.58);
}

.login-card input + input,
.login-card input + .form-control,
.login-panel input + input {
  margin-top: 10px;
}

.login-card .form-control[disabled],
.login-card input[disabled] {
  opacity: 0.7;
}

.login-card .btn-signin,
.login-panel .btn-signin,
.login-card .btn-primary.login,
.login-panel .btn-primary.login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: #f8fafc;
  color: #0b1221 !important;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.8);
  font-weight: 600;
  box-shadow: 0 10px 22px rgba(2,6,23,0.35);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.login-card .btn-signin .icon,
.login-panel .btn-signin .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.login-card .btn-signin:hover,
.login-panel .btn-signin:hover {
  background: #ffffff;
  border-color: rgba(255,255,255,0.95);
  transform: translateY(-1px);
}

.login-card .btn-signin:focus,
.login-panel .btn-signin:focus {
  outline: none;
  box-shadow: 0 10px 24px rgba(0,0,0,0.32), 0 0 0 5px rgba(255,138,0,0.18);
  border-color: rgba(255,138,0,0.45);
}

.login-card .forgot-link,
.login-panel .forgot-link {
  display: block;
  text-align: right;
  margin-top: 8px;
  color: var(--ots-text-muted);
}

/* Small screens: compress card padding */
@media (max-width: 520px) {
  .login-card, .login-panel { padding: 24px; border-radius: 8px; }
  .login-card .login-logo .logo-icon { width: 72px; height: 72px; }
}

/* Static orange accent bar — brand anchor at the bottom of the login page */
body.login-page::after {
  content: '';
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--login-accent);
  z-index: 10;
}

/* Bring the login card above the background */
.login-card,
.login-panel,
.auth-card,
.xibo-login-box,
#login-box {
  position: relative;
  z-index: 2;


/* EXTRA DEFENSIVE: ensure no white background shows through on long pages */
html, body, #page-wrapper, .ots-shell, .ots-main, #content-wrapper, .content-wrapper, .ots-content, .page-content, .container, .container-fluid, .dashboard-page, .dashboard, .dashboard-card, .content-card, .page {
  background-color: var(--color-background) !important;
  background-image: none !important;
  background-repeat: no-repeat !important;
  color: var(--color-text-primary) !important;
  min-height: 100vh !important;
}

/* Neutralise any inline styles or late-loaded styles that set white backgrounds */
*[style] {
  background-color: inherit !important;
}

/* Provide a small utility to detect offending elements visually (useful while debugging) */
body.debug-white-areas * {
  outline: 1px solid rgba(255,0,0,0.04) !important;
}

/* Strong fallback for modals/backdrops */
.modal-backdrop, .modal, .modal-open, .ots-footer, .page-footer {
  background-color: var(--color-background) !important;
}

/* Ensure the root html background is also forced dark at the highest level */
html[style], body[style] {
  background-color: var(--color-background) !important;
}

/* =============================================================================
   OTS UPLOAD MODAL – Dark-mode refinements
   Supplements override-styles.twig which uses CSS variables for auto theming.
   These rules guarantee the upload modal stays dark when override-dark.css loads.
   ============================================================================= */
.ots-upload-content {
  background: var(--ots-surface, #141c2b);
  border-color: var(--ots-border, #2c3a54);
}
.ots-upload-header {
  background: var(--ots-bg, #0b111a);
  border-bottom-color: var(--ots-border, #2c3a54);
}
.ots-upload-title {
  color: var(--ots-text, #e6eefb);
}
.ots-upload-body {
  background: var(--ots-surface, #141c2b);
  color: var(--ots-text, #e6eefb);
}
.ots-upload-dropzone {
  border-color: var(--ots-border, #2c3a54);
  background: rgba(232,120,0,0.03);
}
.ots-upload-dropzone:hover,
.ots-upload-dropzone:focus-visible {
  border-color: var(--ots-primary, #e87800);
  background: rgba(232,120,0,0.07);
}
.ots-upload-dropzone--over {
  border-color: var(--ots-primary, #e87800) !important;
  background: rgba(232,120,0,0.12) !important;
}
.ots-upload-file-item {
  background: var(--ots-bg, #0b111a);
  border-color: var(--ots-border-soft, #243047);
}
.ots-upload-file-name {
  color: var(--ots-text, #e6eefb);
}
.ots-upload-file-meta {
  color: var(--ots-text-muted, #a9b6cc);
}
.ots-upload-footer {
  background: var(--ots-bg, #0b111a);
  border-top-color: var(--ots-border, #2c3a54);
}
.ots-upload-btn-cancel {
  color: var(--ots-text-muted, #a9b6cc);
  border-color: var(--ots-border, #2c3a54);
}
.ots-upload-btn-cancel:hover {
  background: rgba(255,255,255,0.06);
  color: var(--ots-text, #e6eefb);
}
.ots-upload-option {
  background: rgba(232,120,0,0.04);
  border-color: rgba(232,120,0,0.08);
  color: var(--ots-text, #e6eefb);
}
.ots-upload-option small {
  color: var(--ots-text-muted, #a9b6cc);
}
