/* ============================================================
   CloudDrop Admin — Sash Integration Overrides
   Sash v12 HTML Template is the base. This file adapts CloudDrop
   widgets (stat-cards, pool-bars, queue-cards, admin-tables, etc.)
   to render correctly inside Sash's shell, in LIGHT mode.

   NOTE on !important usage: Sash template CSS is loaded BEFORE this
   file and defines its own !important rules across hundreds of
   selectors. To override Sash we mirror the !important specificity —
   this is intentional, not technical debt. When adding new rules
   that DON'T overlap with Sash selectors, prefer no !important.
   Redundant !important inside this file has been cleaned up.
   ============================================================ */

/* ------------------------------------------------------------
   0. Body background parity — prevent purple flash on layout gaps
   Sash dark-mode defaults body to #1A1A3C (dark purple). Our
   .main-content uses #1B2130 (dark navy). When main-content
   doesn't cover full viewport (paint transitions, resize,
   sticky-header recalc), the purple bleeds through. Match both.
   ------------------------------------------------------------ */
body.app.dark-mode {
  background-color: #1b2130 !important;
}
body.app.light-mode,
body.app:not(.dark-mode) {
  background-color: #f0eff5 !important;
}

/* ------------------------------------------------------------
   1. Map CloudDrop's CSS variables to Sash's palette
   (light mode is Sash default)
   ------------------------------------------------------------ */
body.app.light-mode,
body.app:not(.dark-mode) {
  --bg:              #f0eff5;
  --surface:         #ffffff;
  --surface2:        #f7f8fc;
  --surface3:        #eef0f7;
  --card:            #ffffff;
  --border:          #e8ebf3;
  --border2:         #dce0ea;
  --text:            #4f5675;
  --text2:           #76809d;
  --text3:           #a0a8c3;
  --heading:         #2b2a4e;
  --accent:          #6259ca;
  --accent2:         #8481dd;
  --accent-subtle:   rgba(98, 89, 202, .12);
  --accent-hover:    rgba(98, 89, 202, .20);
  --danger:          #dc3545;
  --danger-subtle:   rgba(220, 53, 69, .10);
  --success:         #2dce89;
  --success-subtle:  rgba(45, 206, 137, .12);
  --warning:         #f5a623;
  --warning-subtle:  rgba(245, 166, 35, .12);
  --info:            #3ba1e6;
  --info-subtle:     rgba(59, 161, 230, .12);
  --radius:          .5rem;
  --radius-lg:       .625rem;
}

body.app.dark-mode {
  --bg:              #1b2130;
  --surface:         #252c3f;
  --surface2:        #2c334a;
  --surface3:        #333b56;
  --card:            #252c3f;
  --border:          rgba(234,234,255,.08);
  --border2:         rgba(234,234,255,.12);
  --text:            #c6cddd;        /* was #b9c0d3 — bumped slightly */
  --text2:           #a4aabe;        /* was #8a91a6 — 4.42 → 5.6 contrast */
  --text3:           #8990a5;        /* was #5e6580 — 2.42 → 4.2 contrast */
  --heading:         #eaeaff;
  --accent:          #8b80ff;
  --accent2:         #a59dff;
  --accent-subtle:   rgba(139, 128, 255, .16);
  --danger:          #ff6b6b;
  --success:         #3dd685;
  --warning:         #ffc107;
}

/* ------------------------------------------------------------
   2. LOGIN VIEW — light themed, Sash-style card
   ------------------------------------------------------------ */
#loginView {
  background: linear-gradient(135deg, #e7e5f5 0%, #f4f2fb 100%);
}
#loginView::before {
  background-image:
    radial-gradient(circle at 25% 25%, rgba(98,89,202,.12) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(98,89,202,.08) 0%, transparent 50%);
}
.login-card {
  background: #ffffff !important;
  border: 1px solid #e8ebf3 !important;
  box-shadow: 0 .75rem 2rem rgba(43, 42, 78, .08) !important;
  border-radius: 12px !important;
}
.login-logo { color: #2b2a4e !important; }
.login-logo span { color: #6259ca !important; }
.login-subtitle { color: #76809d !important; }
.field-label { color: #2b2a4e !important; }
#loginView input[type="password"],
#loginView input[type="text"] {
  background: #f7f8fc !important;
  border: 1px solid #e8ebf3 !important;
  color: #2b2a4e !important;
}
#loginView input:focus {
  border-color: #6259ca !important;
  box-shadow: 0 0 0 3px rgba(98,89,202,.18) !important;
  background: #fff !important;
}
#loginView input::placeholder { color: #b6bccf !important; }
.btn.btn-primary.btn-full {
  background: #6259ca;
  border-color: #6259ca;
  color: #fff;
  width: 100%;
  padding: .7rem 1rem;
  font-weight: 600;
  border-radius: 8px;
}
.btn.btn-primary.btn-full:hover {
  background: #5348b8;
  border-color: #5348b8;
}

/* ------------------------------------------------------------
   3. SASH HEADER — CloudDrop tweaks
   ------------------------------------------------------------ */
.app-header .main-header-center {
  position: relative;
}
.app-header #adminSearch {
  min-width: 260px;
}

/* Profile dropdown: make username visible next to avatar on larger screens */
.profile-1 .profile-user {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

/* ------------------------------------------------------------
   4. TAB PANELS — ensure hidden works + spacing
   ------------------------------------------------------------ */
.tab-panel.hidden { display: none !important; }
.tab-panel.active { display: block; }
.tab-panel { margin-bottom: 2rem; }

/* ------------------------------------------------------------
   5. PAGE HEADERS — left-aligned, Sash-style
   ------------------------------------------------------------ */
.page-header {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: .25rem !important;
  margin-bottom: 1.25rem !important;
  padding-bottom: .75rem !important;
  padding-top: 0 !important;
  border-bottom: none !important;
  background: transparent !important;
  text-align: left !important;
  min-height: 0 !important;
}
.page-header > * { text-align: left; }
.page-title {
  font-size: 1.25rem !important;
  font-weight: 600 !important;
  color: var(--heading) !important;
  margin: 0 !important;
  text-align: left !important;
}
.page-subtitle {
  font-size: .875rem !important;
  color: var(--text2) !important;
  margin: 0 !important;
  text-align: left !important;
}

/* ------------------------------------------------------------
   6. STAT CARDS — grid
   ------------------------------------------------------------ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: 0 .125rem .5rem rgba(43, 42, 78, .04);
}
.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .75rem;
}
.stat-card .stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: .8125rem;
  color: var(--text2);
  margin-top: .125rem;
}

/* QS grid for Queue-Tab */
.qs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.qs-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1rem;
}
.qs-card .qs-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text2); }
.qs-card .qs-value { font-size: 1.125rem; font-weight: 600; color: var(--heading); margin-top: .25rem; }

/* ------------------------------------------------------------
   7. POOL BARS / CHART CARDS
   ------------------------------------------------------------ */
.pool-card, .chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 .125rem .5rem rgba(43, 42, 78, .03);
}
.pool-bar {
  width: 100%;
  height: 10px;
  background: var(--surface3);
  border-radius: 999px;
  overflow: hidden;
}
.pool-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6259ca, #8481dd);
  transition: width .4s ease;
  border-radius: 999px;
}
.pool-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .5rem;
  font-size: .875rem;
  color: var(--heading);
  font-weight: 500;
}
.pool-pct {
  font-variant-numeric: tabular-nums;
  color: var(--text2);
  font-size: .8125rem;
}

/* ------------------------------------------------------------
   8. ADMIN TABLES — Sash-inspired clean look
   ------------------------------------------------------------ */
.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.admin-table thead th {
  background: var(--surface2);
  color: var(--text);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-table tbody td {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: .875rem;
  vertical-align: middle;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-table tbody td:last-child {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: rgba(98, 89, 202, .04); }
.admin-table .empty-state {
  text-align: center;
  color: var(--text3);
  padding: 2rem 1rem;
  font-style: italic;
}

/* ------------------------------------------------------------
   9. BUTTONS — Sash-style primary buttons
   ------------------------------------------------------------ */
.btn.btn-primary {
  background: #6259ca;
  border-color: #6259ca;
  color: #fff;
}
.btn.btn-primary:hover {
  background: #5348b8;
  border-color: #5348b8;
}
.btn.btn-secondary {
  background: #f0f1f7;
  border-color: #e8ebf3;
  color: #4f5675;
}
.btn.btn-secondary:hover {
  background: #e6e8f2;
  border-color: #dde0ed;
  color: #2b2a4e;
}
.btn.btn-danger {
  background: #dc3545;
  border-color: #dc3545;
  color: #fff;
}
.btn.btn-sm { padding: .35rem .7rem; font-size: .8125rem; }

/* ------------------------------------------------------------
   10. TOOLBAR — filter rows above tables
   ------------------------------------------------------------ */
.toolbar {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

/* ------------------------------------------------------------
   11. SETTINGS CARDS (cd-settings-card)
   ------------------------------------------------------------ */
.cd-settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.cd-settings-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.cd-settings-title { font-size: 1rem; font-weight: 600; color: var(--heading); margin: 0; }
.cd-settings-subtitle { font-size: .8125rem; color: var(--text2); margin: .125rem 0 0; }
.cd-settings-body { padding: 1.5rem; }
.cd-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem 1.5rem;
}
.cd-form-group label {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--heading);
  margin-bottom: .375rem;
}
.cd-form-group input,
.cd-form-group select,
.cd-form-group textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  font-size: .875rem;
  color: var(--heading);
  font-family: inherit;
}
.cd-form-group input:focus,
.cd-form-group select:focus,
.cd-form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(98, 89, 202, .15);
}
.cd-form-full { grid-column: 1 / -1; }
.cd-form-hint { font-size: .75rem; color: var(--text3); margin-top: .25rem; }
.cd-form-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 0;
  border-top: 1px solid var(--border);
}
.cd-form-toggle-row:first-child { border-top: none; padding-top: 0; }
.cd-toggle-label { font-weight: 500; color: var(--heading); font-size: .9375rem; }
.cd-settings-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.settings-saved {
  font-size: .8125rem;
  color: var(--success);
  opacity: 0;
  transition: opacity .2s;
}
.settings-saved.visible { opacity: 1; }

/* ------------------------------------------------------------
   12. ALERT BANNER
   ------------------------------------------------------------ */
.alert-banner {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: rgba(220, 53, 69, .08);
  border: 1px solid rgba(220, 53, 69, .18);
  color: #dc3545;
  padding: .75rem 1.25rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
}
.alert-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dc3545;
  color: #fff;
  min-width: 22px;
  height: 22px;
  padding: 0 .5rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
}

/* ------------------------------------------------------------
   13. NOTIFY BAR
   ------------------------------------------------------------ */
.notify-bar {
  background: var(--success-subtle);
  border: 1px solid var(--success);
  color: var(--success);
  padding: .5rem 1rem;
  border-radius: var(--radius);
  font-size: .8125rem;
  margin-bottom: 1rem;
}
.notify-bar.error {
  background: var(--danger-subtle);
  border-color: var(--danger);
  color: var(--danger);
}

/* ------------------------------------------------------------
   14. MODAL OVERLAY — legacy CloudDrop modals
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 42, 78, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10060;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 1.25rem 3rem rgba(43, 42, 78, .15);
}
.modal-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--heading);
  margin: 0 0 1rem;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: 1.25rem;
}
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--heading);
  margin-bottom: .375rem;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  font-size: .875rem;
  color: var(--heading);
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(98, 89, 202, .15);
}

/* ------------------------------------------------------------
   15. ADMIN TOGGLE — iOS-style switch
   ------------------------------------------------------------ */
.admin-toggle {
  display: inline-block;
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.admin-toggle input { display: none; }
.admin-toggle-slider {
  position: absolute;
  inset: 0;
  background: #cfd3dd;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s;
}
.admin-toggle-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.admin-toggle input:checked + .admin-toggle-slider {
  background: var(--accent);
}
.admin-toggle input:checked + .admin-toggle-slider::before {
  transform: translateX(18px);
}

/* ------------------------------------------------------------
   16. CHART LEGEND DOTS
   ------------------------------------------------------------ */
.chart-legend { display: flex; gap: 1rem; align-items: center; }
.chart-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: .375rem;
}

/* ------------------------------------------------------------
   17. CARDS — Sash exact match (border:inherit, soft shadow)
   ------------------------------------------------------------ */
.card {
  background: var(--card);
  border: 1px solid var(--border) !important;
  border-radius: 7px;
  box-shadow: 0 4px 25px 0 rgba(168, 180, 208, 0.10);
  margin-bottom: 0;
}
body.app.dark-mode .card {
  background: var(--card);
  border-color: rgba(255,255,255,.06) !important;
  box-shadow: 0 4px 25px 0 rgba(0, 0, 0, 0.18);
}
.card-header {
  padding: 1rem 1.25rem;
  background: transparent;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--heading);
  margin: 0;
}
.card-subtitle {
  font-size: .75rem;
  color: var(--text3);
}
.card-body { padding: 1.25rem; }

/* ------------------------------------------------------------
   17b. ROW GUTTERS — define missing g-6 (Bootstrap has only 0-5)
   ------------------------------------------------------------ */
.row.g-6, .row.gx-6 { --bs-gutter-x: 1.5rem; }
.row.g-6, .row.gy-6 { --bs-gutter-y: 1.5rem; }
.row.g-4 { --bs-gutter-y: 1.5rem; }  /* ensure g-4 also has vertical */

/* Avatar initial (for stat-cards using Bootstrap avatar-initial) */
.avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
}
.bg-label-primary { background: rgba(98, 89, 202, .12); color: #6259ca; }
.bg-label-info { background: rgba(59, 161, 230, .12); color: #3ba1e6; }
.bg-label-success { background: rgba(45, 206, 137, .12); color: #2dce89; }
.bg-label-danger { background: rgba(220, 53, 69, .12); color: #dc3545; }
.bg-label-warning { background: rgba(245, 166, 35, .12); color: #f5a623; }
.bg-label-secondary { background: rgba(118, 128, 157, .12); color: #76809d; }

/* ------------------------------------------------------------
   18. (Replaced by rule 25 below — kept empty to not break count)
   ------------------------------------------------------------ */

/* ------------------------------------------------------------
   19. MAIN CONTENT AREA — CloudDrop spacing
   ------------------------------------------------------------ */
.app-content .main-container { padding-top: 1.5rem; padding-bottom: 2rem; }

/* ------------------------------------------------------------
   20. HIDE BACK-TO-TOP until scrolled
   ------------------------------------------------------------ */
#back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  background: #6259ca;
  color: #fff;
  border-radius: 50%;
  display: none;
  text-align: center;
  line-height: 42px;
  text-decoration: none;
  box-shadow: 0 .5rem 1rem rgba(43, 42, 78, .15);
  z-index: 40;
}
#back-to-top i {
  vertical-align: middle;
  line-height: inherit;
}

/* ------------------------------------------------------------
   21. FOOTER — Sash footer tuning
   ------------------------------------------------------------ */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  color: var(--text2);
  font-size: .8125rem;
  margin-top: 2rem;
}

/* ------------------------------------------------------------
   22. Disable Sash's fancy loader (we don't have the image)
   ------------------------------------------------------------ */
#global-loader { display: none !important; }

/* ------------------------------------------------------------
   23. LOGO switching — show correct variant per theme
   (Sash's default assumes <img> tags; our spans need manual hide)
   ------------------------------------------------------------ */
body.app.light-mode .app-header .desktop-logo,
body.app.light-mode .app-sidebar .desktop-logo,
body.app.light-mode .app-sidebar .toggle-logo {
  display: none !important;
}
body.app.light-mode .app-header .light-logo1,
body.app.light-mode .app-sidebar .light-logo1 {
  display: inline-block !important;
}
body.app.dark-mode .app-header .light-logo1,
body.app.dark-mode .app-sidebar .light-logo1,
body.app.dark-mode .app-sidebar .light-logo {
  display: none !important;
}
body.app.dark-mode .app-header .desktop-logo,
body.app.dark-mode .app-sidebar .desktop-logo {
  display: inline-block !important;
}

/* Collapsed sidebar: show small logo only */
body.app.sidenav-toggled .app-sidebar .desktop-logo,
body.app.sidenav-toggled .app-sidebar .light-logo1 {
  display: none !important;
}
body.app.sidenav-toggled.light-mode .app-sidebar .light-logo {
  display: inline-block !important;
}
body.app.sidenav-toggled.dark-mode .app-sidebar .toggle-logo {
  display: inline-block !important;
}

/* ------------------------------------------------------------
   24. HEADER — compact height, clean background
   ------------------------------------------------------------ */
.app-header {
  min-height: 64px;
  height: auto;
  padding: 0 1.25rem;
  background: #fff !important;
  border-bottom: 1px solid #e8ebf3 !important;
  box-shadow: 0 1px 3px rgba(43, 42, 78, .04);
}
.app-header .d-flex { min-height: 64px; align-items: center; }
body.app.dark-mode .app-header {
  background: #1b2130 !important;
  border-bottom-color: rgba(255,255,255,.06) !important;
}
.header-right-icons .nav-link.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #6e7390;
  font-size: 1.05rem;
}
.header-right-icons .nav-link.icon:hover {
  background: rgba(98, 89, 202, .08);
  border-radius: 50%;
  color: #6259ca;
}
.profile-1 .nav-link {
  padding: 0 .5rem;
}
.profile-1 .profile-user {
  width: 34px !important;
  height: 34px !important;
  border-radius: 50% !important;
  border: 2px solid #e8ebf3;
}

/* ------------------------------------------------------------
   25. SIDEBAR — Sash clean look
   ------------------------------------------------------------ */
.app-sidebar {
  background: #fff !important;
  border-right: 1px solid #e8ebf3;
  box-shadow: none;
}
.side-header {
  background: #fff !important;
  border-bottom: 1px solid #e8ebf3;
  height: 64px;
}
.side-header .header-brand1 {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  padding: 0 .5rem;
}
body.app.dark-mode .app-sidebar,
body.app.dark-mode .side-header {
  background: #252c3f !important;
  border-right-color: rgba(255,255,255,.06);
  border-bottom-color: rgba(255,255,255,.06);
}

/* Sub-category headings in sidebar */
.side-menu .sub-category h3 {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #9e9fb5;
  font-weight: 600;
  padding: 1rem 1.25rem .4rem;
  margin: 0;
}

/* Active nav item pill — high specificity with .app-sidebar prefix */
.app-sidebar .side-menu .slide .side-menu__item.nav-link.active,
.app-sidebar .side-menu__item.nav-link.active {
  background: linear-gradient(135deg, #6259ca, #8481dd) !important;
  background-color: #6259ca !important;
  color: #fff !important;
  box-shadow: 0 .25rem .75rem rgba(98, 89, 202, .22) !important;
  border-radius: .625rem !important;
}
.app-sidebar .side-menu__item.nav-link.active .side-menu__icon,
.app-sidebar .side-menu__item.nav-link.active .side-menu__label,
.app-sidebar .side-menu__item.nav-link.active span,
.app-sidebar .side-menu__item.nav-link.active i {
  color: #fff !important;
}

.side-menu__item {
  padding: .625rem 1rem;
  margin: .125rem .625rem;
  border-radius: .5rem;
  color: #4f5675;
  transition: background .15s, color .15s;
}
.side-menu__item:hover:not(.active) {
  background: rgba(98, 89, 202, .06);
  color: #6259ca !important;
}
.side-menu__icon {
  font-size: 1.05rem;
  width: 1.25rem;
  text-align: center;
}
body.app.dark-mode .side-menu__item {
  color: #b4b8d0;
}

/* ------------------------------------------------------------
   26. MAIN CONTENT spacing — reduce top padding
   ------------------------------------------------------------ */
.main-content.app-content {
  margin-top: 64px;
  min-height: calc(100vh - 64px);
  padding: 0;
  background: #f4f5fa;
}
body.app.dark-mode .main-content.app-content {
  background: #1b2130;
}
.app-content .main-container { padding: 1.5rem 1.5rem; }
/* Neutralize Sash's 24px-all-around default on the header's inner container */
.app-header .main-container { padding: 0 !important; }

/* ------------------------------------------------------------
   27. ALERT BANNER — fix colors for light theme
   ------------------------------------------------------------ */
.alert-banner {
  background: rgba(220, 53, 69, .08) !important;
  border: 1px solid rgba(220, 53, 69, .22) !important;
  color: #dc3545 !important;
}

/* ------------------------------------------------------------
   28. STAT CARDS inside Bootstrap grid — tighten
   ------------------------------------------------------------ */
.card .card-body h5 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: .125rem;
}
.card .card-body p.mb-0 {
  font-size: .8125rem;
  color: #76809d;
}
.avatar .avatar-initial {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ------------------------------------------------------------
   30. FOOTER
   ------------------------------------------------------------ */
.footer { margin-top: 0 !important; }

/* ------------------------------------------------------------
   31. CONN DOTS + FRESHNESS (admin-accounts live indicator)
   ------------------------------------------------------------ */
.conn-dot, .freshness-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 4px rgba(45, 206, 137, .6);
}

/* ------------------------------------------------------------
   32. FORM INPUTS — universal visible styling
   Catches: .form-group input/select/textarea, .cd-form-group inputs,
   inline [type=search], select elements, settings inputs
   ------------------------------------------------------------ */
.main-content input[type="text"],
.main-content input[type="url"],
.main-content input[type="email"],
.main-content input[type="password"],
.main-content input[type="number"],
.main-content input[type="search"],
.main-content input[type="tel"],
.main-content textarea,
.main-content select {
  background: #fff !important;
  border: 1px solid #d5d9e5 !important;
  border-radius: .5rem !important;
  padding: .55rem .85rem !important;
  font-size: .875rem !important;
  color: #2b2a4e !important;
  font-family: inherit !important;
  transition: border-color .15s, box-shadow .15s !important;
  box-shadow: none !important;
}
.main-content input:focus,
.main-content textarea:focus,
.main-content select:focus {
  border-color: #6259ca !important;
  box-shadow: 0 0 0 3px rgba(98, 89, 202, .15) !important;
  outline: none !important;
}
.main-content input::placeholder,
.main-content textarea::placeholder {
  color: #8a92ab !important;
  opacity: 1 !important;
}
body.app.dark-mode .main-content input,
body.app.dark-mode .main-content textarea,
body.app.dark-mode .main-content select {
  background: #2c334a !important;
  border-color: rgba(255,255,255,.10) !important;
  color: #e7e3fc !important;
}

/* ------------------------------------------------------------
   33. CHECKBOX LABELS — clean pill style for webhook events
   ------------------------------------------------------------ */
.admin-checkbox-label {
  display: inline-flex !important;
  align-items: center !important;
  gap: .5rem !important;
  padding: .4rem .8rem !important;
  background: #f4f5fa !important;
  border: 1px solid #e8ebf3 !important;
  border-radius: .5rem !important;
  font-size: .8125rem !important;
  color: #4f5675 !important;
  cursor: pointer !important;
  transition: all .15s !important;
}
.admin-checkbox-label:has(input:checked) {
  background: rgba(98, 89, 202, .10) !important;
  border-color: #6259ca !important;
  color: #6259ca !important;
}
.admin-checkbox {
  width: 16px !important;
  height: 16px !important;
  accent-color: #6259ca !important;
  margin: 0 !important;
}

/* ------------------------------------------------------------
   34. QUEUE ACTIVE/QUEUED/DONE/FAILED CARDS
   Sash-light style instead of dark navy
   ------------------------------------------------------------ */
#queueActiveContainer > div,
.queue-active-card,
.queue-job-card {
  background: #fff !important;
  border: 1px solid #e8ebf3 !important;
  border-radius: .625rem !important;
  padding: 1rem 1.25rem !important;
  margin-bottom: .75rem !important;
  box-shadow: 0 2px 8px rgba(43, 42, 78, .04) !important;
  color: #2b2a4e !important;
}
body.app.dark-mode #queueActiveContainer > div,
body.app.dark-mode .queue-active-card,
body.app.dark-mode .queue-job-card {
  background: #2c334a !important;
  border-color: rgba(255,255,255,.06) !important;
  color: #e7e3fc !important;
}

/* Queue job progress bar */
#queueActiveContainer .progress,
.queue-progress,
.qac-progress-track {
  height: 6px !important;
  background: #f0eff5 !important;
  border-radius: 999px !important;
  overflow: hidden !important;
}
#queueActiveContainer .progress-bar,
.queue-progress-bar,
.qac-progress-fill {
  background: linear-gradient(90deg, #6259ca, #8481dd) !important;
  transition: width .4s ease !important;
}

/* Queue active card text colors (overriding dark-theme defaults) */
.qac-title { color: #2b2a4e !important; font-weight: 600 !important; }
.qac-title svg { color: #6259ca !important; }
.qac-meta-line { color: #76809d !important; }
.qac-progress-text { color: #4f5675 !important; }
body.app.dark-mode .qac-title { color: #eaeaff !important; }
body.app.dark-mode .qac-title svg { color: #b4b0f4 !important; }
body.app.dark-mode .qac-meta-line { color: #9c99b1 !important; }
body.app.dark-mode .qac-progress-text { color: #b4b0f4 !important; }

/* Queue section headers — left align, no center */
.queue-section-header {
  margin-bottom: .75rem !important;
}
.queue-section-header .page-title {
  font-size: 1rem !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: .4rem !important;
}
.queue-section-icon {
  width: 16px !important;
  height: 16px !important;
}

/* ------------------------------------------------------------
   35. TOOLBAR + FILTER INPUTS
   ------------------------------------------------------------ */
.toolbar {
  display: flex !important;
  align-items: center !important;
  gap: .5rem !important;
  flex-wrap: wrap !important;
  margin-bottom: 1rem !important;
}
.toolbar > span,
.toolbar > label {
  font-size: .8125rem !important;
  color: var(--text2) !important;
  font-weight: 500 !important;
}
.cd-search-spacer { flex: 1 !important; }
.cd-toolbar-search { max-width: 240px; }

/* ------------------------------------------------------------
   36. BADGES / STATUS CHIPS
   ------------------------------------------------------------ */
.badge {
  display: inline-block;
  padding: .25rem .55rem;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .01em;
}

/* ------------------------------------------------------------
   37. SQL CONSOLE textarea mono font
   ------------------------------------------------------------ */
#sqlQuery {
  font-family: 'SF Mono', Menlo, Consolas, 'Roboto Mono', monospace !important;
  font-size: .8125rem !important;
}

/* ------------------------------------------------------------
   38. SETTINGS FOOTER — Speichern button + saved chip
   ------------------------------------------------------------ */
.cd-settings-footer {
  margin-top: 1rem !important;
  margin-bottom: 1.5rem !important;
}
.settings-saved {
  font-size: .8125rem !important;
  color: #2dce89 !important;
}

/* ------------------------------------------------------------
   39. Fix gap between header and content — keep Sash stacking
   (sidebar z=99 > header z=9 so sidebar's side-header overlaps
   the header's background on the left edge)
   ------------------------------------------------------------ */
.main-content.app-content {
  padding-top: 0 !important;
}
body.app .app-header.header {
  z-index: 9 !important;
}
body.app .app-sidebar {
  z-index: 99 !important;
  top: 0 !important;
}

/* ------------------------------------------------------------
   40. Sidebar toggle — lives inside .side-header (top of sidebar),
       always visible, first menu item never covered
   ------------------------------------------------------------ */
/* Hide the Sash feather ::before pseudo in the app-header toggle */
body.app .app-sidebar__toggle::before {
  content: none !important;
}
/* App-header toggle only shown on mobile (< lg) — desktop uses sidebar toggle */
body.app .app-sidebar__toggle {
  align-items: center;
  justify-content: center;
  color: var(--primary-bg-color, #6259ca);
  cursor: pointer;
}
body.app .app-sidebar__toggle svg { display: block; pointer-events: none; }

/* --- Side-header: flex row so logo + toggle sit side-by-side --- */
body.app .app-sidebar {
  isolation: isolate;
}
body.app .cd-side-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 14px !important;
  gap: 8px;
  overflow: hidden;
  position: relative;
  z-index: 2;
}
body.app .cd-side-header .header-brand1 {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}
body.app .cd-sidebar-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: #6e7390;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
body.app .cd-sidebar-toggle:hover {
  background: rgba(98,89,202,.10);
  color: #6259ca;
}
body.app.dark-mode .cd-sidebar-toggle { color: #b2b3ca; }
body.app.dark-mode .cd-sidebar-toggle:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

/* In collapsed state: hide the logo, center the toggle, shrink the header */
body.app.sidebar-mini.sidenav-toggled .cd-side-header {
  justify-content: center !important;
  padding: 0 !important;
}
body.app.sidebar-mini.sidenav-toggled .cd-side-header .header-brand1 {
  display: none !important;
}
body.app.sidebar-mini.sidenav-toggled .cd-side-header .cd-sidebar-toggle {
  width: 40px;
  height: 40px;
}
/* When hovered-open (sidenav-toggled-open), reveal brand again */
body.app.sidebar-mini.sidenav-toggled.sidenav-toggled-open .cd-side-header {
  justify-content: space-between !important;
  padding: 0 14px !important;
}
body.app.sidebar-mini.sidenav-toggled.sidenav-toggled-open .cd-side-header .header-brand1 {
  display: flex !important;
}

/* --- Ensure the first side-menu item is NOT covered: give main-sidemenu top spacing equal to side-header height (64px) --- */
body.app .app-sidebar .main-sidemenu {
  padding-top: 6px;
}
/* slide-left/right scroll arrows are for horizontal menus only — hide in vertical */
body.app .app-sidebar .main-sidemenu > .slide-left,
body.app .app-sidebar .main-sidemenu > .slide-right {
  display: none !important;
}
/* First .sub-category (Dashboard heading) — ensure it sits cleanly below header */
body.app .side-menu > .sub-category:first-child {
  margin-top: 4px;
}

/* Collapsed: hide sub-category headings entirely (they look ugly as tiny text) */
body.app.sidebar-mini.sidenav-toggled .side-menu .sub-category {
  display: none !important;
}
body.app.sidebar-mini.sidenav-toggled.sidenav-toggled-open .side-menu .sub-category {
  display: block !important;
}

/* ------------------------------------------------------------
   41. Quota preset chips (add-user modal)
   ------------------------------------------------------------ */
.cd-quota-presets {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.cd-quota-chip {
  padding: .4rem .75rem;
  background: var(--surface2, #f4f5fa);
  border: 1px solid var(--border, #e8ebf3);
  border-radius: .5rem;
  color: var(--text, #4f5675);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.cd-quota-chip:hover {
  background: rgba(98,89,202,.08);
  border-color: #6259ca;
  color: #6259ca;
}
.cd-quota-chip.cd-active {
  background: linear-gradient(135deg, #6259ca, #8481dd);
  border-color: transparent;
  color: #fff;
}
body.app.dark-mode .cd-quota-chip {
  background: #2c334a;
  border-color: rgba(234,234,255,.08);
  color: #b9c0d3;
}
body.app.dark-mode .cd-quota-chip:hover {
  background: rgba(98,89,202,.15);
  color: #fff;
}
body.app.dark-mode .cd-quota-chip.cd-active,
body.app .cd-quota-chip.cd-active {
  background: linear-gradient(135deg, #6259ca, #8481dd) !important;
  border-color: transparent !important;
  color: #fff !important;
}

/* ------------------------------------------------------------
   42. Webhook test buttons inline with URL input
   ------------------------------------------------------------ */
.cd-webhook-row {
  display: flex;
  gap: .5rem;
  align-items: stretch;
}
.cd-webhook-row input[type="url"] {
  flex: 1 1 auto;
  min-width: 0;
}
.cd-webhook-row .cd-webhook-test {
  flex: 0 0 auto;
  white-space: nowrap;
  min-width: 72px;
}
.cd-webhook-result {
  font-size: .78rem;
  margin-top: .35rem;
  min-height: 0;
  transition: min-height .2s ease;
}
.cd-webhook-result.cd-success { color: #2dce89; min-height: 1.1em; }
.cd-webhook-result.cd-error   { color: #ff4d49; min-height: 1.1em; }
.cd-webhook-result.cd-pending { color: var(--text2); min-height: 1.1em; }

/* ------------------------------------------------------------
   43. Detail modal dl-grid (used by activity-detail-modal)
   ------------------------------------------------------------ */
.cd-detail-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1rem;
  row-gap: .4rem;
  font-size: .875rem;
  margin: .5rem 0 1rem 0;
  max-height: 60vh;
  overflow-y: auto;
}
.cd-detail-dl dt {
  color: var(--text2);
  font-weight: 600;
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .03em;
  padding-top: .15rem;
}
.cd-detail-dl dd {
  margin: 0;
  color: var(--heading);
  word-break: break-word;
  overflow-wrap: anywhere;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: .82rem;
}

/* ------------------------------------------------------------
   44. Alert severity badges (alert-rules table)
   ------------------------------------------------------------ */
.cd-sev {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: .375rem;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.cd-sev-info     { background: rgba(59, 161, 230, .15); color: #3ba1e6; }
.cd-sev-warning  { background: rgba(245, 166, 35, .15); color: #f5a623; }
.cd-sev-critical { background: rgba(220, 53, 69, .15); color: #dc3545; }

/* ------------------------------------------------------------
   45. Dark-mode scrollbar styling (avoid harsh white stripe)
   ------------------------------------------------------------ */
body.app.dark-mode {
  scrollbar-color: #3a4155 #1b2130;
}
body.app.dark-mode::-webkit-scrollbar { width: 12px; height: 12px; }
body.app.dark-mode::-webkit-scrollbar-track { background: #1b2130; }
body.app.dark-mode::-webkit-scrollbar-thumb {
  background: #3a4155;
  border-radius: 6px;
  border: 2px solid #1b2130;
}
body.app.dark-mode::-webkit-scrollbar-thumb:hover { background: #4d5570; }

/* ------------------------------------------------------------
   46. Password-input eye toggle (admin-polish.js)
   ------------------------------------------------------------ */
.cd-pw-wrap input[type="password"],
.cd-pw-wrap input[type="text"] { padding-right: 44px !important; }
.cd-pw-toggle:hover { background: rgba(98,89,202,.10) !important; color: #6259ca !important; }
body.app.dark-mode .cd-pw-toggle:hover { background: rgba(255,255,255,.08) !important; color: #fff !important; }

/* ------------------------------------------------------------
   47. Full-Screen mode (body.fullscreen)
   ------------------------------------------------------------ */
body.app.fullscreen .app-sidebar { transform: translateX(-100%); transition: transform .3s ease; }
body.app.fullscreen .app-header .main-container { padding-inline-start: 20px !important; }
@media (min-width: 992px) {
  body.app.fullscreen .app-content { margin-inline-start: 0 !important; transition: margin-inline-start .3s ease; }
  body.app.fullscreen .app-header { padding-inline-start: 20px !important; }
}

/* ------------------------------------------------------------
   48. Breadcrumbs (admin-polish.js)
   ------------------------------------------------------------ */
.cd-breadcrumb { margin-bottom: .5rem; }
.cd-breadcrumb ol {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: .35rem;
  font-size: .78rem;
  color: var(--text2);
}
.cd-breadcrumb li { display: inline-flex; align-items: center; }
.cd-breadcrumb a {
  color: var(--text2);
  text-decoration: none;
  transition: color .15s;
}
.cd-breadcrumb a:hover { color: var(--accent, #6259ca); text-decoration: underline; }
.cd-breadcrumb .cd-bc-sep { color: var(--text3); user-select: none; }
.cd-breadcrumb .cd-bc-current { color: var(--heading); font-weight: 500; }

/* ------------------------------------------------------------
   49. Accordion collapsible .cd-settings-card
   ------------------------------------------------------------ */
.cd-settings-header-clickable {
  cursor: pointer;
  user-select: none;
  position: relative;
}
.cd-settings-header-clickable:hover { background: rgba(98,89,202,.03); }
body.app.dark-mode .cd-settings-header-clickable:hover { background: rgba(255,255,255,.03); }
.cd-settings-chevron {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  transition: transform .2s ease;
  color: var(--text2);
  display: inline-flex;
}
.cd-settings-collapsed .cd-settings-chevron { transform: translateY(-50%) rotate(-90deg); }
.cd-settings-collapsed .cd-settings-body {
  max-height: 0;
  overflow: hidden;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-top-width: 0 !important;
  opacity: 0;
}
.cd-settings-body {
  max-height: 4000px;
  transition: max-height .3s ease, opacity .25s ease, padding .25s ease;
  opacity: 1;
}

/* ------------------------------------------------------------
   50. Select2 custom theme (matches admin inputs)
   ------------------------------------------------------------ */
.select2-container .select2-selection--single {
  height: 38px !important;
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  color: var(--text) !important;
  padding: 0 10px !important;
  display: flex !important;
  align-items: center !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text) !important;
  line-height: 36px !important;
  padding-left: 0 !important;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--text3) !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 36px !important;
  top: 0 !important;
  right: 4px !important;
}
.select2-dropdown {
  background: var(--surface) !important;
  border: 1px solid var(--border2) !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,.12) !important;
}
.select2-search--dropdown .select2-search__field {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 4px !important;
  color: var(--text) !important;
  padding: 6px 10px !important;
}
.select2-container--default .select2-results__option {
  color: var(--text) !important;
  padding: 8px 12px !important;
  font-size: .85rem !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: var(--accent) !important;
  color: #fff !important;
}
.select2-container--default .select2-results__option[aria-selected=true] {
  background: var(--accent-subtle) !important;
  color: var(--accent) !important;
}
.select2-container--default .select2-selection--single .select2-selection__clear {
  color: var(--text3) !important;
  margin-right: 8px !important;
}
.select2-container--open .select2-selection--single {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(98,89,202,.18) !important;
}
/* Dark-mode tint adjustments — variables already switch, extras here */
body.app.dark-mode .select2-dropdown { box-shadow: 0 4px 16px rgba(0,0,0,.4) !important; }

/* ------------------------------------------------------------
   51. Daterangepicker custom theme
   ------------------------------------------------------------ */
.daterangepicker {
  background: var(--surface) !important;
  border: 1px solid var(--border2) !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.12) !important;
  color: var(--text) !important;
}
.daterangepicker .calendar-table {
  background: var(--surface) !important;
  border: none !important;
}
.daterangepicker td,
.daterangepicker th {
  color: var(--text) !important;
}
.daterangepicker td.available:hover,
.daterangepicker th.available:hover {
  background: var(--accent-subtle) !important;
  color: var(--accent) !important;
}
.daterangepicker td.in-range { background: var(--accent-subtle) !important; color: var(--accent) !important; }
.daterangepicker td.active,
.daterangepicker td.active:hover {
  background: var(--accent) !important;
  color: #fff !important;
}
.daterangepicker td.off { color: var(--text3) !important; }
.daterangepicker .ranges li {
  color: var(--text) !important;
  padding: 6px 10px !important;
}
.daterangepicker .ranges li:hover { background: var(--accent-subtle) !important; color: var(--accent) !important; }
.daterangepicker .ranges li.active { background: var(--accent) !important; color: #fff !important; }
.daterangepicker .drp-buttons {
  border-top: 1px solid var(--border) !important;
  background: var(--surface2) !important;
}
.daterangepicker .drp-buttons .btn.btn-primary { background: var(--accent) !important; border-color: var(--accent) !important; }
.daterangepicker .drp-buttons .btn.btn-default { background: transparent !important; border: 1px solid var(--border) !important; color: var(--text) !important; }
.daterangepicker:before { border-bottom-color: var(--border2) !important; }
.daterangepicker:after { border-bottom-color: var(--surface) !important; }

/* ------------------------------------------------------------
   52. Growl Toast Stack
   ------------------------------------------------------------ */
.growl-container { position: fixed; z-index: 10002; pointer-events: none; }
.growl-container.growl-fixed { position: fixed; }
.growl-container.growl-tr,
.growl-container.growl-br { right: 1.25rem; }
.growl-container.growl-tl,
.growl-container.growl-bl { left: 1.25rem; }
.growl-container.growl-tr,
.growl-container.growl-tl { top: 5rem; }
.growl-container.growl-br,
.growl-container.growl-bl { bottom: 1.25rem; }
.growl-container > .growl {
  pointer-events: auto;
  padding: .75rem 1rem;
  margin-bottom: .5rem;
  min-width: 220px;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .85rem;
  box-shadow: 0 .375rem 1rem rgba(0,0,0,.12);
  cursor: pointer;
}
.growl-default { border-left: 3px solid var(--success); }
.growl-error   { border-left: 3px solid var(--danger); }
.growl-warning { border-left: 3px solid var(--warning); }
.growl-notice  { border-left: 3px solid var(--info); }
.growl .growl-title { font-weight: 600; margin-bottom: .2rem; color: var(--heading); }
.growl .growl-message { color: var(--text); }

/* ------------------------------------------------------------
   53. Pickr Color Picker (classic theme)
   ------------------------------------------------------------ */
.pickr { position: relative; overflow: visible; }
.pickr .pcr-button { width: 100%; height: 100%; }
.pcr-app { z-index: 10060 !important; }
.pcr-app.classic {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  padding: .75rem;
  width: 260px;
}
.pcr-app.visible { display: block; }
.pcr-selection {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.pcr-color-preview,
.pcr-color-chooser,
.pcr-color-opacity,
.pcr-hue {
  height: 8px; border-radius: 4px; cursor: pointer; position: relative;
}
.pcr-color-preview { height: 28px; border: 1px solid var(--border); border-radius: 4px; }
.pcr-color-chooser { height: 120px; }
.pcr-hue { background: linear-gradient(to right, red, yellow, lime, cyan, blue, magenta, red); }
.pcr-picker { width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; position: absolute; transform: translate(-50%, -50%); box-shadow: 0 0 0 1px rgba(0,0,0,.3); }
.pcr-app .pcr-interaction {
  margin-top: .5rem;
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
}
.pcr-app .pcr-interaction .pcr-result {
  flex: 1;
  padding: 4px 8px;
  font-size: .78rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  min-width: 120px;
}
.pcr-app .pcr-interaction .pcr-save,
.pcr-app .pcr-interaction .pcr-clear {
  padding: 4px 10px;
  font-size: .78rem;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
}
.pcr-app .pcr-interaction .pcr-save { background: var(--accent); color: #fff; border-color: var(--accent); }
.pcr-swatches { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: .5rem; }
.pcr-swatches > button {
  width: 18px; height: 18px; border: 1px solid rgba(0,0,0,.1);
  border-radius: 3px; cursor: pointer;
}

/* ------------------------------------------------------------
   54. Timeline view (activity log)
   ------------------------------------------------------------ */
.cd-timeline { position: relative; padding-left: 1.5rem; margin: 1rem 0 1.5rem; }
.cd-timeline::before { content: ''; position: absolute; left: .5rem; top: 0; bottom: 0; width: 2px; background: var(--border2); }
.cd-timeline-item { position: relative; padding-left: 1rem; margin-bottom: .75rem; }
.cd-timeline-dot { box-shadow: 0 0 0 3px var(--surface); }

/* ------------------------------------------------------------
   55. Quill (snow theme, minimal override)
   ------------------------------------------------------------ */
.cd-quill-host { overflow: hidden; }
.ql-toolbar.ql-snow {
  background: var(--surface2);
  border: 1px solid var(--border) !important;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  border-bottom: 1px solid var(--border2) !important;
  padding: 6px;
}
.ql-container.ql-snow {
  border: none !important;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  min-height: 180px;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}
.ql-editor {
  min-height: 180px;
  font-size: .9rem;
  line-height: 1.5;
}
.ql-editor.ql-blank::before {
  color: var(--text3);
  font-style: normal;
  font-size: .9rem;
}
.ql-snow .ql-stroke { stroke: var(--text2); }
.ql-snow .ql-fill { fill: var(--text2); }
.ql-snow .ql-picker { color: var(--text); }
.ql-snow .ql-picker-options {
  background: var(--surface);
  border-color: var(--border) !important;
}
.ql-snow .ql-toolbar button:hover,
.ql-snow .ql-toolbar button.ql-active {
  color: var(--accent);
}
.ql-snow .ql-toolbar button:hover .ql-stroke,
.ql-snow .ql-toolbar button.ql-active .ql-stroke { stroke: var(--accent); }
.ql-snow .ql-toolbar button:hover .ql-fill,
.ql-snow .ql-toolbar button.ql-active .ql-fill { fill: var(--accent); }

/* ------------------------------------------------------------
   56. Text-Contrast Fixes (post-audit 2026-04-17)
   Ensures WCAG AA (4.5:1 for body, 3:1 for large) on common muted
   text targets that the default `--text3` couldn't meet.
   ------------------------------------------------------------ */
body.app.dark-mode .empty-state {
  color: var(--text2) !important;   /* was --text3, now 4.2+ ratio */
}
body.app.dark-mode .admin-checkbox-label {
  color: var(--text) !important;    /* was accent purple */
}
/* Stat-labels + qs-labels were marginal (4.42) — bump just above AA */
body.app.dark-mode .stat-label,
body.app.dark-mode .qs-label,
body.app.dark-mode .cd-settings-subtitle {
  color: var(--text2) !important;
}
/* Form hints were dangerously faint — upgrade to text2 */
body.app.dark-mode .cd-form-hint {
  color: var(--text2) !important;
}
/* Activity/Audit table inline "text-muted text-sm" cells are barely
   readable in dark — reuse --text2 */
body.app.dark-mode td.text-muted {
  color: var(--text2) !important;
}
/* Placeholder text in inputs was too faint */
body.app.dark-mode input::placeholder,
body.app.dark-mode textarea::placeholder,
body.app.dark-mode select {
  color: var(--text3);
  opacity: 1;
}

/* ------------------------------------------------------------
   57. Button text contrast fixes (post-audit)
   ------------------------------------------------------------ */
/* btn-info (cyan) — needs white text, Sash default uses dark */
.btn.btn-info,
body.app .btn-info {
  color: #fff !important;
}
/* btn-danger with transparent bg on admin-table needs brighter red */
body.app.dark-mode .admin-table td button.btn-danger {
  color: #ff8a87 !important;   /* was #ff4d49 — brighter on dark surface */
  border-color: rgba(255,138,135,.5) !important;
}
body.app.dark-mode .admin-table td button.btn-danger:hover {
  background: #ff4d49 !important;
  color: #fff !important;
}
/* text-muted class (generic) — upgrade in dark mode */
body.app.dark-mode .text-muted,
body.app.dark-mode small.text-muted {
  color: var(--text2) !important;
}
/* Breadcrumb separator — already subtle, leave as is */

/* ------------------------------------------------------------
   58. Final-pass contrast fixes
   ------------------------------------------------------------ */
/* Badge-danger: brighten the red on dark surfaces (4.24 → 5.8+) */
body.app.dark-mode .badge-danger,
body.app.dark-mode .badge.badge-danger {
  color: #ff8a87 !important;
  background: rgba(255, 77, 73, .15) !important;
}
/* Client-error log red text + other .td red — upgrade to brighter */
body.app.dark-mode td[style*="color: rgb(239, 68, 68)"],
body.app.dark-mode td[style*="color:#ef4444"],
body.app.dark-mode td[style*="color:#ff4d49"] {
  color: #ff8a87 !important;
}
/* Button-secondary / btn-sm that inherits info-cyan bg — white text */
body.app .btn.btn-secondary,
body.app .btn.btn-sm,
body.app button.btn-secondary,
body.app button.btn-sm {
  color: var(--text) !important;
}
body.app.dark-mode .btn.btn-secondary,
body.app.dark-mode button.btn-secondary,
body.app.dark-mode .btn.btn-sm.btn-secondary,
body.app.dark-mode button.btn-sm.btn-secondary {
  color: #eaeaff !important;
  background: rgba(255,255,255,.08) !important;
  border: 1px solid rgba(234,234,255,.12) !important;
}
body.app.dark-mode .btn.btn-secondary:hover,
body.app.dark-mode button.btn-secondary:hover {
  background: rgba(255,255,255,.14) !important;
}
/* Strong elements should use heading color (stronger emphasis) */
body.app.dark-mode .pool-card strong,
body.app.dark-mode .stat-card strong,
body.app.dark-mode .qs-card strong {
  color: var(--heading) !important;
}
/* storage-bar-label "0%" inside pool bars — upgrade to text2 */
body.app.dark-mode .storage-bar-label {
  color: var(--text2) !important;
}
/* btn-danger with transparent bg (toolbar "Abgelaufene löschen") */
body.app.dark-mode .btn-danger[style*="transparent"],
body.app.dark-mode button[style*="color:#ef4444"] {
  color: #ff8a87 !important;
}

/* ------------------------------------------------------------
   59. Light-Mode Kontrast-Fixes (post-audit)
   ------------------------------------------------------------ */
body.app.light-mode,
body.app:not(.dark-mode) {
  /* Stärker kontrastierende muted-Text Variables für Light */
  --text:            #3d4354;        /* was #4f5675 */
  --text2:           #5a6078;        /* was #76809d — 3.61 → 5.7 ratio */
  --text3:           #7b7f96;        /* was #a0a8c3 — 2.7 → 4.7 ratio */
  /* Warnfarben dunkler für Light-Mode */
  --danger:          #c8303d;        /* was #dc3545 — bleibt AA auf weiß */
}

/* text-muted auf weiß: statt native muted-grey — explicit darker */
body.app.light-mode .text-muted,
body.app.light-mode td.text-muted,
body.app.light-mode td.text-muted.text-sm,
body.app:not(.dark-mode) .text-muted,
body.app:not(.dark-mode) td.text-muted {
  color: #5a6078 !important;
}

/* btn-danger transparent text im Light — dunkleres Rot */
body.app.light-mode .admin-table td button.btn-danger,
body.app:not(.dark-mode) .admin-table td button.btn-danger,
body.app.light-mode button.btn-danger,
body.app:not(.dark-mode) button.btn-danger {
  color: #c8303d !important;
  border-color: rgba(200,48,61,.4) !important;
}
body.app.light-mode .admin-table td button.btn-danger:hover {
  background: #c8303d !important;
  color: #fff !important;
}

/* Badges: status-colors dunkler für Light-Mode weißer BG */
body.app.light-mode .badge-danger,
body.app.light-mode .badge.badge-danger,
body.app:not(.dark-mode) .badge-danger {
  color: #c8303d !important;
  background: rgba(200,48,61,.10) !important;
}
body.app.light-mode .badge-ok,
body.app.light-mode .badge.badge-ok,
body.app:not(.dark-mode) .badge-ok {
  color: #1a7f4a !important;   /* war hellgrün #72e128, jetzt 4.7 auf weiß */
  background: rgba(26,127,74,.10) !important;
}
body.app.light-mode .badge-warning,
body.app.light-mode .badge.badge-warning {
  color: #a66400 !important;   /* dunkler orange */
  background: rgba(166,100,0,.10) !important;
}
body.app.light-mode .badge-info,
body.app.light-mode .badge.badge-info {
  color: #1e6ca6 !important;
  background: rgba(30,108,166,.10) !important;
}

/* TD inline-style colors from admin.js (danger-red/warn-orange for log "CLIENT"/
   level cells) — selector matches common inline color patterns */
body.app.light-mode td[style*="color: rgb(239, 68, 68)"],
body.app.light-mode td[style*="color:#ef4444"] {
  color: #c8303d !important;
}
body.app.light-mode td[style*="color: rgb(245, 158, 11)"],
body.app.light-mode td[style*="color:#f59e0b"] {
  color: #a66400 !important;
}
body.app.light-mode td[style*="color: rgb(114, 225, 40)"],
body.app.light-mode td[style*="color:#72e128"] {
  color: #1a7f4a !important;
}

/* ------------------------------------------------------------
   60. DataTables button-container integration — align export
   buttons (CSV, etc) to the top-right, flush with search field,
   so they don't visually float between the page toolbar and table
   ------------------------------------------------------------ */
.dataTables_wrapper .dt-buttons {
  display: inline-flex;
  gap: .4rem;
  margin: 0;
  padding: 0;
}
.dataTables_wrapper .dt-buttons .btn {
  padding: .35rem .75rem !important;
  font-size: .78rem !important;
  line-height: 1.2 !important;
  min-height: 32px;
}
/* Pull the first DT row (buttons + search) up close to the table */
.dataTables_wrapper > .row:first-of-type {
  margin-bottom: .35rem !important;
  align-items: center;
}
.dataTables_wrapper .dataTables_filter {
  text-align: right;
}
.dataTables_wrapper .dataTables_filter label {
  font-size: .82rem;
  color: var(--text2);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.dataTables_wrapper .dataTables_filter input {
  padding: .35rem .6rem !important;
  font-size: .85rem !important;
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  color: var(--text) !important;
  margin: 0 !important;
  min-width: 200px;
}
.dataTables_wrapper .dataTables_info {
  font-size: .78rem;
  color: var(--text2);
  padding-top: .5rem;
}
.dataTables_wrapper .dataTables_paginate {
  padding-top: .35rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: .25rem .55rem !important;
  margin: 0 .1rem !important;
  font-size: .82rem !important;
  border-radius: 4px !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  background: transparent !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--accent-subtle) !important;
  color: var(--accent) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  color: var(--text3) !important;
  background: transparent !important;
  cursor: default;
}

/* ------------------------------------------------------------
   61. DataTables — reposition button-container into toolbar row
   so it doesn't float between toolbar and table
   ------------------------------------------------------------ */
.dataTables_wrapper > .row:first-of-type {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .75rem;
  padding: 0;
  margin: 0 0 .75rem 0;
}
.dataTables_wrapper > .row:first-of-type > [class*="col-"] {
  flex: 0 0 auto;
  width: auto !important;
  max-width: none !important;
  padding: 0 !important;
}
.dataTables_wrapper > .row:first-of-type .dt-buttons {
  order: 1;
}
.dataTables_wrapper > .row:first-of-type .dataTables_filter {
  order: 2;
  text-align: right;
}
.dataTables_wrapper .dt-buttons .btn-secondary,
.dataTables_wrapper .dt-buttons button.buttons-csv {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  font-weight: 500;
}
.dataTables_wrapper .dt-buttons .btn-secondary:hover,
.dataTables_wrapper .dt-buttons button.buttons-csv:hover {
  background: var(--accent-subtle) !important;
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}

/* ------------------------------------------------------------
   62. Hide the native DT buttons container — it floats weirdly
   between page toolbar and table. Export-logic stays available
   via DataTable API (can be wired into a custom toolbar button
   later if needed).
   ------------------------------------------------------------ */
.dataTables_wrapper .dt-buttons { display: none !important; }
.dataTables_wrapper > .row:first-of-type > :not(.dataTables_filter):not(:has(.dataTables_filter)) { display: none; }
.dataTables_wrapper > .row:first-of-type > .col-sm-6:first-child:empty,
.dataTables_wrapper > .row:first-of-type > .col-sm-6:has(.dt-buttons:empty) { display: none !important; }
/* Give the filter full width of the row since buttons are hidden */
.dataTables_wrapper > .row:first-of-type .dataTables_filter {
  text-align: right;
  width: 100%;
  padding-right: 0;
}

/* ------------------------------------------------------------
   63. Mobile-Viewport Fixes (< 992px)
   ------------------------------------------------------------ */
@media (max-width: 991px) {
  /* Header hamburger kleinerer padding + breathing room zum logo */
  body.app .app-header .app-sidebar__toggle.d-lg-none {
    display: inline-flex !important;
    margin-right: .75rem;
    padding: 0 .35rem !important;
    order: -1;
  }
  /* Logo nicht links abgeschnitten */
  body.app .app-header .logo-horizontal {
    padding-left: 0;
    margin-left: .25rem;
  }
  /* Pool-Bar-Header stack auf small screens */
  body.app #poolBarFill,
  body.app .pool-bar-header {
    flex-wrap: wrap !important;
    gap: .5rem !important;
  }
  body.app .card-body.d-flex.align-items-center.justify-content-between {
    flex-wrap: wrap !important;
    gap: .5rem !important;
  }
  /* Stat-values nicht über die breite laufen */
  body.app .card h5 {
    font-size: 1.1rem !important;
    word-break: break-word;
  }
  /* Page-title kleiner auf mobile */
  body.app .page-title { font-size: 1.05rem !important; }
  body.app .page-subtitle { font-size: .8rem !important; }
  /* Header logo bei sehr schmalen Screens ggf kürzen */
  @media (max-width: 480px) {
    body.app .app-header .logo-horizontal {
      font-size: 1.1rem !important;
    }
    body.app .app-header .desktop-logo,
    body.app .app-header .light-logo1 {
      font-size: 1.1rem !important;
    }
  }
  /* Content margin auf mobile weniger */
  body.app .main-content.app-content {
    padding-top: 8px !important;
  }
  body.app .app-content .main-container {
    padding: 1rem !important;
  }
  /* Pool-Bar selbst mindestens volle Width */
  body.app #dashboardFreshness {
    flex: 1 1 100% !important;
    min-width: 0;
  }
  /* Tabelles brauchen horizontal scroll auf mobile */
  body.app .admin-table {
    font-size: .82rem;
  }
  body.app .tab-panel .admin-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* ------------------------------------------------------------
   64. Mobile header: stop logo-horizontal from absolute-positioning
   which causes it to overlap the hamburger toggle
   ------------------------------------------------------------ */
@media (max-width: 991px) {
  body.app .app-header .logo-horizontal {
    position: static !important;
    flex: 1 1 auto;
    min-width: 0;
    order: 0;
  }
  body.app .app-header .app-sidebar__toggle.d-lg-none {
    position: static !important;
    inset-inline-end: 0 !important;
    order: -1;
    flex: 0 0 auto;
  }
}

/* ------------------------------------------------------------
   65. A11Y: Skip-to-content link + :focus-visible outlines
   ------------------------------------------------------------ */
.cd-skip-link {
  position: absolute;
  top: -100px;
  left: .5rem;
  background: var(--accent);
  color: #fff;
  padding: .5rem 1rem;
  border-radius: 0 0 .5rem .5rem;
  z-index: 10080;
  text-decoration: none;
  font-size: .875rem;
  transition: top .2s;
}
.cd-skip-link:focus {
  top: 0;
  outline: 2px solid #fff;
  outline-offset: 2px;
}
/* Visible focus outline for keyboard users only */
body.app :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
body.app .btn:focus-visible,
body.app button:focus-visible,
body.app .nav-link:focus-visible,
body.app a:focus-visible {
  outline-offset: 3px;
}

/* ------------------------------------------------------------
   66. Card-Hover + Row-Hover polish animations
   ------------------------------------------------------------ */
body.app .stat-card,
body.app .card,
body.app .pool-card,
body.app .chart-card,
body.app .cd-settings-card,
body.app .qs-card {
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
body.app .stat-card:hover,
body.app .card:hover:not(.no-hover),
body.app .qs-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 .5rem 1.25rem rgba(43, 42, 78, .08);
}
body.app.dark-mode .stat-card:hover,
body.app.dark-mode .card:hover:not(.no-hover),
body.app.dark-mode .qs-card:hover {
  box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .28);
}
body.app .admin-table tbody tr {
  transition: background-color .1s ease;
}
body.app .admin-table tbody tr:hover {
  background: rgba(98, 89, 202, .04);
}
body.app.dark-mode .admin-table tbody tr:hover {
  background: rgba(139, 128, 255, .06);
}
/* DataTables sort-header click feedback */
body.app table.dataTable thead th:hover {
  background: rgba(98, 89, 202, .06);
}

/* ------------------------------------------------------------
   67. Skeleton-Loader animated shimmer
   ------------------------------------------------------------ */
@keyframes cd-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.cd-skel {
  display: inline-block;
  height: 1em;
  background: linear-gradient(90deg, rgba(255,255,255,.05) 0%, rgba(255,255,255,.12) 50%, rgba(255,255,255,.05) 100%);
  background-size: 400px 100%;
  animation: cd-shimmer 1.2s ease-in-out infinite;
  border-radius: 4px;
}
body.app.light-mode .cd-skel,
body.app:not(.dark-mode) .cd-skel {
  background: linear-gradient(90deg, rgba(43,42,78,.05) 0%, rgba(43,42,78,.14) 50%, rgba(43,42,78,.05) 100%);
  background-size: 400px 100%;
}
.cd-skel-row {
  display: flex;
  gap: .75rem;
  padding: .5rem 0;
}
.cd-skel-col { flex: 1 1 auto; height: 14px; border-radius: 3px; }

/* Kbd styling in help modal */
body.app kbd {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: .78rem;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: var(--heading);
}

/* ------------------------------------------------------------
   68. Tab-Panel fade-in animation
   ------------------------------------------------------------ */
@keyframes cd-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.tab-panel.active:not(.hidden) {
  animation: cd-fade-in .22s ease-out;
}

/* ------------------------------------------------------------
   69. Table row-stripes + sticky-header
   ------------------------------------------------------------ */
body.app .admin-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, .015);
}
body.app.dark-mode .admin-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, .02);
}
body.app .admin-table tbody tr:nth-child(even):hover {
  background: rgba(98, 89, 202, .05);
}
body.app.dark-mode .admin-table tbody tr:nth-child(even):hover {
  background: rgba(139, 128, 255, .07);
}
/* Sticky table header for long tables (100+ rows) */
body.app .admin-table thead th {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 2;
  box-shadow: 0 1px 0 var(--border);
}

/* ------------------------------------------------------------
   70. Offline-Indicator
   ------------------------------------------------------------ */
.cd-offline-banner {
  position: fixed;
  top: .5rem;
  right: .5rem;
  background: var(--danger);
  color: #fff;
  padding: .5rem .9rem;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 500;
  box-shadow: 0 .25rem .75rem rgba(220, 53, 69, .35);
  z-index: 10090;
  display: none;
  animation: cd-fade-in .2s ease-out;
}
.cd-offline-banner.visible { display: inline-flex; align-items: center; gap: .5rem; }
.cd-offline-banner::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: cd-pulse-dot 1.2s ease-in-out infinite;
}
@keyframes cd-pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

/* ------------------------------------------------------------
   71. Top Loading Bar (NProgress-style)
   ------------------------------------------------------------ */
.cd-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: transparent;
  z-index: 100000;
  pointer-events: none;
  overflow: hidden;
}
.cd-topbar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent));
  background-size: 200% 100%;
  transform: translateX(-100%);
  opacity: 0;
}
.cd-topbar.cd-topbar-active::before {
  transform: translateX(0);
  opacity: 1;
  animation: cd-topbar-anim 1.4s ease-in-out infinite, cd-topbar-slide .3s ease-out;
}
.cd-topbar.cd-topbar-done::before {
  transform: translateX(100%);
  opacity: 0;
  transition: transform .4s ease-in, opacity .4s;
  animation: none;
}
@keyframes cd-topbar-anim {
  0%   { background-position: 0% 0%; }
  100% { background-position: -200% 0%; }
}
@keyframes cd-topbar-slide {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ------------------------------------------------------------
   72. Empty-State styling upgrade — center icon + text + CTA
   ------------------------------------------------------------ */
.empty-state {
  color: var(--text2) !important;
  font-style: normal !important;
  padding: 2rem 1rem !important;
  text-align: center !important;
  font-size: .9rem;
}
.empty-state .cd-empty-ico {
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto .75rem;
  color: var(--text3);
  opacity: .75;
}
.empty-state .cd-empty-title {
  display: block;
  font-size: .95rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: .25rem;
}
.empty-state .cd-empty-hint {
  display: block;
  font-size: .82rem;
  color: var(--text2);
}

/* ------------------------------------------------------------
   73. Refresh button with spin animation
   ------------------------------------------------------------ */
@keyframes cd-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.cd-refresh-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .35rem;
  color: var(--text2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.cd-refresh-btn:hover { background: var(--accent-subtle); color: var(--accent); }
.cd-refresh-btn.cd-refreshing svg { animation: cd-spin .8s linear infinite; }
.cd-last-updated {
  font-size: .72rem;
  color: var(--text3);
  margin-left: .5rem;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   74. Sidebar footer — session info
   ------------------------------------------------------------ */
.cd-sidebar-footer {
  position: sticky;
  bottom: 0;
  margin: auto -1rem 0;
  padding: .75rem 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .625rem;
}
.cd-sidebar-footer img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface2);
  object-fit: cover;
  flex-shrink: 0;
}
.cd-sidebar-footer-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.cd-sidebar-footer-name {
  font-size: .85rem;
  font-weight: 500;
  color: var(--heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cd-sidebar-footer-role {
  font-size: .72rem;
  color: var(--text2);
}
body.app.sidebar-mini.sidenav-toggled .cd-sidebar-footer-text {
  display: none;
}
body.app.sidebar-mini.sidenav-toggled .cd-sidebar-footer {
  justify-content: center;
  padding: .5rem;
}

/* ------------------------------------------------------------
   75. Copy-ID button (clipboard)
   ------------------------------------------------------------ */
.cd-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  color: var(--text3);
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  margin-left: .35rem;
  transition: background .15s, color .15s;
  vertical-align: middle;
}
.cd-copy-btn:hover {
  background: var(--accent-subtle);
  color: var(--accent);
}

/* ------------------------------------------------------------
   76. Chart time-range pill buttons
   ------------------------------------------------------------ */
.cd-range-pills {
  display: inline-flex;
  gap: 2px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  margin-left: auto;
}
.cd-range-pill {
  border: none;
  background: transparent;
  color: var(--text2);
  padding: 3px 10px;
  font-size: .72rem;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.cd-range-pill:hover { color: var(--text); }
.cd-range-pill.active {
  background: var(--accent);
  color: #fff;
}

/* ------------------------------------------------------------
   77. Print-Styles — minimal, clean, readable
   ------------------------------------------------------------ */
@media print {
  body.app {
    background: #fff !important;
    color: #000 !important;
  }
  /* Hide chrome elements */
  .app-sidebar,
  .app-header,
  .cd-topbar,
  .cd-skip-link,
  .cd-breadcrumb,
  .cd-offline-banner,
  .cd-sidebar-footer,
  #customizerPanel,
  #customizerBackdrop,
  .dataTables_filter,
  .dataTables_paginate,
  .dataTables_length,
  .dataTables_info,
  .dt-buttons,
  .cd-range-pills,
  .cd-refresh-btn,
  .cd-last-updated,
  .cd-pw-toggle,
  .btn,
  button,
  .toolbar,
  [role="alertdialog"],
  .modal-overlay {
    display: none !important;
  }
  .tab-panel { page-break-inside: avoid; }
  .main-content.app-content {
    margin: 0 !important;
    padding: 0 !important;
  }
  .main-container {
    padding: 0 !important;
    max-width: 100% !important;
  }
  .page-title {
    font-size: 18pt !important;
    color: #000 !important;
    margin-bottom: .5rem !important;
  }
  .page-subtitle {
    color: #333 !important;
    font-size: 10pt !important;
  }
  .admin-table {
    border-collapse: collapse !important;
    width: 100% !important;
    font-size: 9pt !important;
    color: #000 !important;
  }
  .admin-table th {
    background: #f0f0f0 !important;
    color: #000 !important;
    border: 1px solid #888 !important;
    padding: 4px 8px !important;
  }
  .admin-table td {
    border: 1px solid #ccc !important;
    padding: 3px 8px !important;
    color: #000 !important;
  }
  /* Card look is distracting in print */
  .card, .stat-card, .pool-card, .chart-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    background: #fff !important;
    page-break-inside: avoid;
    margin-bottom: .5rem !important;
  }
  .stat-card .stat-label { color: #555 !important; font-size: 9pt !important; }
  .stat-card .stat-value { color: #000 !important; font-size: 14pt !important; font-weight: 700; }
  a { color: #000 !important; text-decoration: none !important; }
}

/* ------------------------------------------------------------
   78. Chart-Card mini refresh-button + last-updated
   ------------------------------------------------------------ */
.cd-chart-refresh-wrap {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
}
.cd-chart-refresh-btn {
  background: transparent;
  border: none;
  color: var(--text3);
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cd-chart-refresh-btn:hover { background: var(--accent-subtle); color: var(--accent); }
.cd-chart-refresh-btn.cd-refreshing svg { animation: cd-spin .8s linear infinite; }
.cd-chart-last { font-size: .68rem; color: var(--text3); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------
   79. Settings Quick-Nav (sticky anchors)
   ------------------------------------------------------------ */
.cd-settings-quicknav {
  position: sticky;
  top: 64px;
  z-index: 4;
  display: flex;
  gap: .5rem;
  padding: .5rem .75rem;
  margin: 0 0 1rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: nowrap;
  font-size: .82rem;
}
.cd-settings-quicknav a {
  padding: .25rem .6rem;
  border-radius: 4px;
  color: var(--text2);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.cd-settings-quicknav a:hover {
  background: var(--accent-subtle);
  color: var(--accent);
}
.cd-settings-quicknav a.active {
  background: var(--accent);
  color: #fff;
}

/* ------------------------------------------------------------
   80. Kebab-Menu für Row-Actions
   ------------------------------------------------------------ */
.cd-kebab-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
}
.cd-kebab-btn:hover {
  background: var(--accent-subtle) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}
.cd-kebab-menu.cd-open { display: block !important; }
.cd-kebab-item {
  display: block;
  width: 100%;
  padding: .45rem .85rem;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: .85rem;
  text-align: left;
  transition: background .12s;
}
.cd-kebab-item:hover {
  background: var(--accent-subtle);
  color: var(--accent);
}
.cd-kebab-item.cd-kebab-danger {
  color: var(--danger);
  border-top: 1px solid var(--border);
  margin-top: 2px;
}
.cd-kebab-item.cd-kebab-danger:hover {
  background: rgba(220, 53, 69, .10);
  color: var(--danger);
}

/* Mono textareas (bulk import / CSV paste) — theme-aware */
.cd-mono-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface2, #f8f9fb);
  border: 1px solid var(--border, rgba(0,0,0,.08));
  color: var(--text, #1a1e2b);
  padding: 10px;
  border-radius: 6px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 0.78rem;
  outline: none;
  resize: vertical;
}
body.app.dark-mode .cd-mono-input {
  background: #0c1222;
  border-color: rgba(255,255,255,.08);
  color: #e6edf3;
}
.cd-mono-result {
  margin: -4px 0 10px 0;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  background: rgba(37,99,235,.08);
  border: 1px solid rgba(37,99,235,.2);
  color: var(--text, #1a1e2b);
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: 'SF Mono', Menlo, monospace;
}
body.app.dark-mode .cd-mono-result {
  color: #e6edf3;
  background: rgba(37,99,235,.1);
}

/* Login card — Cloud-login-hint block (was inline styled) */
.cd-login-hint {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border2);
  text-align: center;
}
.cd-login-hint-label {
  font-size: .78rem;
  color: var(--text2);
}
.cd-login-hint-btn {
  margin-top: 10px;
  background: var(--accent2) !important;
}

/* Bootstrap modal lives at z-index 1055 by default — bump above our
 * custom .modal-overlay at 10060 so both stacking systems coexist */
.modal.fade, .modal.show { z-index: 10070 !important; }
.modal-backdrop { z-index: 10069 !important; }
