:root {
  --watcher-navy: #102a56;
  --watcher-navy-deep: #071a2e;
  --watcher-blue: #006fae;
  --watcher-blue-hover: #005a8e;
  --watcher-blue-active: #004d7a;
  --watcher-cyan: #00a8c8;
  --watcher-teal: #00c897;
  --watcher-mint: #7cf6b3;
  --watcher-white: #ffffff;
  --watcher-text: #102a56;
  --watcher-text-secondary: #516074;
  --watcher-text-muted: #56657a;
  --watcher-surface: #ffffff;
  --watcher-surface-soft: #f4f9fc;
  --watcher-surface-tint: #e8f6fa;
  --watcher-border: #d8e3ec;
  --watcher-danger: #b4234b;
  --watcher-danger-soft: #fff0f3;
  --watcher-warning: #8a5a00;
  --watcher-warning-soft: #fff5d6;
  --watcher-success-dark: #006b55;
  --watcher-success-soft: #e6faf3;
  --watcher-gradient: linear-gradient(120deg, #102a56 0%, #006fae 48%, #00a8c8 76%, #00c897 100%);
  --watcher-shadow-sm: 0 8px 24px rgba(16, 42, 86, 0.08);
  --watcher-shadow-lg: 0 18px 50px rgba(7, 26, 46, 0.16);
}

[data-bs-theme="light"] {
  --bs-primary: var(--watcher-blue);
  --bs-primary-rgb: 0, 111, 174;
  --bs-primary-light: var(--watcher-surface-tint);
  --bs-success: var(--watcher-success-dark);
  --bs-info: var(--watcher-cyan);
  --bs-body-bg: var(--watcher-surface-soft);
  --bs-body-color: var(--watcher-text);
  --bs-border-color: var(--watcher-border);
  --bs-text-primary: var(--watcher-text);
  --bs-text-secondary: var(--watcher-text-secondary);
  --bs-text-muted: var(--watcher-text-muted);
}

[data-bs-theme="dark"] {
  --bs-primary: var(--watcher-cyan);
  --bs-primary-rgb: 0, 168, 200;
  --bs-primary-light: rgba(0, 168, 200, 0.16);
  --bs-success: var(--watcher-teal);
  --bs-info: var(--watcher-cyan);
  --bs-body-bg: var(--watcher-navy-deep);
  --bs-body-color: #e9f2f8;
  --bs-border-color: #27415c;
  --bs-dark-bg: var(--watcher-navy-deep);
  --bs-dark-bg-secondary: #0d2440;
  --bs-dark-bg-tertiary: #15314d;
  --bs-dark-bg-elevated: #1b3c59;
  --bs-dark-bg-hover: #214866;
  --bs-text-primary: #f5fbff;
  --bs-text-secondary: #c6d7e4;
  --bs-text-muted: #a9bed0;
}

html,
body {
  background: var(--bs-body-bg);
}

body {
  color: var(--bs-body-color);
  letter-spacing: -0.005em;
}

/* Main application canvas: use all the space available beside the desktop aside. */
.watcher-main-shell {
  flex: 1 1 auto;
  width: auto !important;
  min-width: 0;
  max-width: none !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
  padding-right: 4px !important;
  padding-left: 0.75rem !important;
}

.watcher-main-shell > #kt_content,
.watcher-main-shell .app-container,
.watcher-main-shell .container-xxl {
  width: 100%;
  max-width: none !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
  padding-right: 0 !important;
  padding-left: 0 !important;
}

@media (max-width: 991.98px) {
  .watcher-main-shell {
    padding-right: 1rem !important;
    padding-left: 1rem !important;
  }
}

a:not(.btn):not(.menu-link) {
  color: var(--watcher-blue);
}

a:not(.btn):not(.menu-link):hover {
  color: var(--watcher-blue-hover);
}

.btn:hover,
.menu-link:hover {
  text-decoration: none !important;
}

.header {
  position: relative;
  background: linear-gradient(115deg, var(--watcher-navy) 0%, var(--watcher-blue) 72%, #0089aa 100%) !important;
  box-shadow: 0 8px 28px rgba(7, 26, 46, 0.24) !important;
}

.header::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--watcher-cyan), var(--watcher-teal), var(--watcher-mint));
}

.header .text-muted {
  color: #e9f7fb !important;
}

.logo-responsive {
  display: block;
  width: clamp(150px, 16vw, 180px);
  height: auto !important;
  max-height: 78px !important;
  max-width: 43vw;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.16));
}

.aside {
  background: linear-gradient(180deg, #ffffff 0%, var(--watcher-surface-soft) 100%) !important;
  border-right: 1px solid var(--watcher-border) !important;
}

[data-bs-theme="dark"] .aside {
  background: linear-gradient(180deg, #0d2440 0%, #071a2e 100%) !important;
  border-right-color: #27415c !important;
}

.aside-menu .menu-item .menu-link {
  min-height: 42px;
  color: var(--watcher-text-secondary);
  border-radius: 10px !important;
}

.aside-menu .menu-item .menu-link:hover:not(.active) {
  background: var(--watcher-surface-tint) !important;
  color: var(--watcher-blue) !important;
  text-decoration: none !important;
}

.aside-menu .menu-item .menu-link.active,
.aside-menu .menu-item.here .menu-link {
  background: var(--watcher-blue) !important;
  color: var(--watcher-white) !important;
  box-shadow: 0 8px 18px rgba(0, 111, 174, 0.24);
}

.aside-menu .menu-link.active .menu-title,
.aside-menu .menu-link.active .menu-icon,
.aside-menu .menu-link.active .ki-duotone,
.aside-menu .menu-link.active .ki-duotone path {
  color: #ffffff !important;
  fill: #ffffff !important;
}

[data-bs-theme="dark"] .aside-menu .menu-item .menu-link {
  color: #c6d7e4;
}

[data-bs-theme="dark"] .aside-menu .menu-item .menu-link:hover:not(.active) {
  background: rgba(0, 168, 200, 0.14) !important;
  color: var(--watcher-mint) !important;
}

.btn-primary {
  background: var(--watcher-blue) !important;
  border-color: var(--watcher-blue) !important;
  color: #ffffff !important;
  font-weight: 650;
  box-shadow: 0 6px 16px rgba(0, 111, 174, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background: var(--watcher-blue-hover) !important;
  border-color: var(--watcher-blue-hover) !important;
  color: #ffffff !important;
}

.btn-primary:active,
.btn-primary.active {
  background: var(--watcher-blue-active) !important;
  border-color: var(--watcher-blue-active) !important;
  color: #ffffff !important;
}

.btn-light-primary,
.badge-light-primary {
  background: var(--watcher-surface-tint) !important;
  border-color: #b9e1eb !important;
  color: var(--watcher-blue) !important;
}

.btn-light-primary:hover:not(:disabled) {
  background: #d9f0f5 !important;
  color: var(--watcher-blue-active) !important;
}

/* View toggles: the selected option uses a solid brand blue in both themes. */
.btn-check:checked + .btn.btn-light-primary,
.btn-check:active + .btn.btn-light-primary,
.btn.btn-light-primary.active {
  background: var(--watcher-blue) !important;
  border-color: var(--watcher-blue) !important;
  color: #ffffff !important;
}

.btn-check:checked + .btn.btn-light-primary:hover,
.btn-check:active + .btn.btn-light-primary:hover,
.btn.btn-light-primary.active:hover {
  background: var(--watcher-blue-hover) !important;
  border-color: var(--watcher-blue-hover) !important;
  color: #ffffff !important;
}

.btn-check:checked + .btn.btn-light-primary .ki-duotone,
.btn-check:checked + .btn.btn-light-primary .ki-duotone path,
.btn-check:active + .btn.btn-light-primary .ki-duotone,
.btn-check:active + .btn.btn-light-primary .ki-duotone path,
.btn.btn-light-primary.active .ki-duotone,
.btn.btn-light-primary.active .ki-duotone path {
  color: #ffffff !important;
  fill: #ffffff !important;
}

.btn-info,
.badge-info {
  background: var(--watcher-cyan) !important;
  border-color: var(--watcher-cyan) !important;
  color: var(--watcher-navy) !important;
}

.btn-success,
.badge-success {
  background: var(--watcher-success-dark) !important;
  border-color: var(--watcher-success-dark) !important;
  color: #ffffff !important;
}

.btn-warning,
.badge-warning {
  background: #f6c000 !important;
  color: var(--watcher-navy) !important;
}

.btn-danger,
.badge-danger {
  background: var(--watcher-danger) !important;
  border-color: var(--watcher-danger) !important;
  color: #ffffff !important;
}

.badge-light-success {
  background: var(--watcher-success-soft) !important;
  color: var(--watcher-success-dark) !important;
}

.badge-light-info {
  background: var(--watcher-surface-tint) !important;
  color: var(--watcher-blue) !important;
}

.badge-light-warning {
  background: var(--watcher-warning-soft) !important;
  color: var(--watcher-warning) !important;
}

.badge-light-danger {
  background: var(--watcher-danger-soft) !important;
  color: var(--watcher-danger) !important;
}

.text-primary { color: var(--watcher-blue) !important; }
.text-info { color: var(--watcher-blue) !important; }
.text-success { color: var(--watcher-success-dark) !important; }
.text-muted { color: var(--watcher-text-muted) !important; }

[data-bs-theme="dark"] .text-primary,
[data-bs-theme="dark"] .text-info { color: var(--watcher-mint) !important; }
[data-bs-theme="dark"] .text-success { color: var(--watcher-mint) !important; }
[data-bs-theme="dark"] .text-muted { color: #a9bed0 !important; }

.card {
  border-color: var(--watcher-border);
  box-shadow: var(--watcher-shadow-sm);
}

.agent-card,
.system-card,
.interactive-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.agent-card:hover,
.system-card:hover,
.interactive-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 168, 200, 0.34) !important;
  box-shadow: var(--watcher-shadow-lg) !important;
}

/* Service checks use calm, high-contrast chips instead of bright pastel pills. */
.service-checks-container {
  align-items: center;
}

.badge.service-check-badge {
  min-height: 27px;
  display: inline-flex !important;
  align-items: center;
  padding: 0.35rem 0.6rem !important;
  background: #f7fafc !important;
  color: var(--watcher-navy) !important;
  border: 1px solid var(--watcher-border) !important;
  border-left-width: 4px !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 7px rgba(16, 42, 86, 0.07);
  letter-spacing: 0.015em;
}

.service-check-badge.badge-light-success {
  border-left-color: var(--watcher-success-dark) !important;
}

.service-check-badge.badge-light-warning {
  border-left-color: #b77900 !important;
}

.service-check-badge.badge-light-danger {
  border-left-color: var(--watcher-danger) !important;
}

.service-check-badge.badge-light-info,
.service-check-badge.badge-light-primary {
  border-left-color: var(--watcher-blue) !important;
}

.service-check-badge.badge-light-success .ki-duotone,
.service-check-badge.badge-light-success .ki-duotone path {
  color: var(--watcher-success-dark) !important;
  fill: var(--watcher-success-dark) !important;
}

.service-check-badge.badge-light-warning .ki-duotone,
.service-check-badge.badge-light-warning .ki-duotone path {
  color: #8a5a00 !important;
  fill: #8a5a00 !important;
}

.service-check-badge.badge-light-danger .ki-duotone,
.service-check-badge.badge-light-danger .ki-duotone path {
  color: var(--watcher-danger) !important;
  fill: var(--watcher-danger) !important;
}

[data-bs-theme="dark"] .service-check-badge {
  background: #102a46 !important;
  color: #f5fbff !important;
  border-color: #35627e !important;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.18);
}

[data-bs-theme="dark"] .service-check-badge.badge-light-success {
  border-left-color: var(--watcher-teal) !important;
}

[data-bs-theme="dark"] .service-check-badge.badge-light-warning {
  border-left-color: #f6c000 !important;
}

[data-bs-theme="dark"] .service-check-badge.badge-light-danger {
  border-left-color: #ff7897 !important;
}

[data-bs-theme="dark"] .service-check-badge.badge-light-info,
[data-bs-theme="dark"] .service-check-badge.badge-light-primary {
  border-left-color: var(--watcher-cyan) !important;
}

[data-bs-theme="dark"] .service-check-badge.badge-light-success .ki-duotone,
[data-bs-theme="dark"] .service-check-badge.badge-light-success .ki-duotone path {
  color: var(--watcher-mint) !important;
  fill: var(--watcher-mint) !important;
}

[data-bs-theme="dark"] .service-check-badge.badge-light-warning .ki-duotone,
[data-bs-theme="dark"] .service-check-badge.badge-light-warning .ki-duotone path {
  color: #ffd54a !important;
  fill: #ffd54a !important;
}

[data-bs-theme="dark"] .service-check-badge.badge-light-danger .ki-duotone,
[data-bs-theme="dark"] .service-check-badge.badge-light-danger .ki-duotone path {
  color: #ff9bb5 !important;
  fill: #ff9bb5 !important;
}

[data-bs-theme="dark"] .card {
  background: #0d2440 !important;
  border-color: #27415c !important;
}

[data-bs-theme="dark"] .card:hover {
  transform: none;
  border-color: #27415c;
}

[data-bs-theme="dark"] .agent-card:hover,
[data-bs-theme="dark"] .system-card:hover,
[data-bs-theme="dark"] .interactive-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 246, 179, 0.32) !important;
}

[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-footer {
  background: #102a46 !important;
  border-color: #27415c !important;
}

.form-control,
.form-select {
  border-color: var(--watcher-border);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--watcher-blue) !important;
  box-shadow: 0 0 0 3px rgba(0, 111, 174, 0.16) !important;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--watcher-blue) !important;
  outline-offset: 2px;
}

[data-bs-theme="dark"] :where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline-color: var(--watcher-mint) !important;
}

.table thead th {
  color: var(--watcher-text-secondary);
  background: var(--watcher-surface-soft);
  border-color: var(--watcher-border);
}

[data-bs-theme="dark"] .table thead th {
  color: #dce9f2;
  background: #102a46;
  border-color: #27415c;
}

.progress-bar {
  background: linear-gradient(90deg, var(--watcher-blue), var(--watcher-cyan));
}

.scrolltop {
  background: var(--watcher-blue) !important;
  color: #ffffff !important;
}

.watcher-footer {
  width: 100%;
  margin-top: 1.5rem;
  padding: 1rem 0;
  color: var(--watcher-text-secondary);
  border-top: 1px solid var(--watcher-border);
  font-size: 0.78rem;
}

.watcher-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}

.watcher-footer-brand,
.watcher-footer-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.watcher-footer-brand-mark {
  width: 28px;
  height: 22px;
  object-fit: contain;
}

.watcher-footer strong,
.watcher-footer time {
  color: var(--watcher-text);
  font-weight: 700;
}

.watcher-footer-heart {
  color: var(--watcher-danger);
}

[data-bs-theme="dark"] .watcher-footer {
  color: #a9bed0;
  border-top-color: #27415c;
}

[data-bs-theme="dark"] .watcher-footer strong,
[data-bs-theme="dark"] .watcher-footer time {
  color: #f5fbff;
}

.auth-page-frame > .auth-shell {
  flex: 1 0 auto;
}

.auth-page-frame .watcher-footer {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.8rem 1.5rem 1rem;
  color: #b8c6d8;
  border-top-color: rgba(124, 246, 179, 0.18);
  background: rgba(7, 26, 46, 0.72);
}

.auth-page-frame .watcher-footer strong,
.auth-page-frame .watcher-footer time {
  color: #ffffff;
}

.auth-page-frame .watcher-footer-heart {
  color: var(--watcher-mint);
}

@media (max-width: 767.98px) {
  .watcher-footer-inner,
  .watcher-footer-brand,
  .watcher-footer-meta {
    justify-content: center;
    text-align: center;
  }

  .watcher-footer-inner {
    flex-direction: column;
  }

  .watcher-footer-separator {
    display: none;
  }
}

.modal-content {
  border: 1px solid var(--watcher-border) !important;
  box-shadow: var(--watcher-shadow-lg) !important;
}

.app-toolbar,
.page-title {
  position: relative;
}

.agents-toolbar {
  gap: 1rem;
}

.agents-toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}

.dashboard-toolbar-actions {
  justify-content: flex-end;
}

.watcher-company-filter {
  min-width: 180px;
}

.watcher-brand-panel {
  background:
    linear-gradient(90deg, rgba(7, 26, 46, 0.58), rgba(7, 26, 46, 0.34)),
    var(--watcher-gradient);
  color: #ffffff;
}

@media (max-width: 991.98px) {
  .dashboard-toolbar {
    align-items: stretch !important;
    flex-direction: column;
    gap: 1rem;
  }

  .dashboard-toolbar-actions {
    justify-content: flex-start;
  }

  .agents-toolbar {
    align-items: stretch !important;
    flex-direction: column;
  }

  .agents-toolbar-actions {
    justify-content: flex-start;
  }

  .agents-toolbar-actions form,
  .agents-toolbar-actions .form-select {
    width: 100%;
  }
}

@media (max-width: 575.98px) {
  .logo-responsive {
    width: 122px;
    height: auto !important;
    max-height: 58px !important;
    max-width: 43vw;
  }

  .agents-toolbar-actions > .btn,
  .agents-toolbar-actions > .btn-group {
    flex: 1 1 auto;
  }

  .agents-toolbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .agents-toolbar-actions form,
  .agents-toolbar-actions .form-switch {
    grid-column: 1 / -1;
  }

  .agents-toolbar-actions .btn,
  .agents-toolbar-actions .btn-group,
  .agents-toolbar-actions .form-select {
    width: 100%;
    min-width: 0;
  }

  .agents-toolbar-actions .form-check {
    margin: 0;
  }

  .dashboard-toolbar-actions > * {
    flex: 1 1 145px;
  }
}

/* Consolidated component rules: keep every legacy Metronic surface on the Watcher palette. */
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .modal-body {
  background: #0d2440 !important;
  border-color: #27415c !important;
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
  background: #102a46 !important;
  border-color: #27415c !important;
}

.modal-content {
  border-radius: 1rem !important;
  overflow: hidden;
}

.modal-header,
.modal-footer {
  padding: 1.5rem 2rem;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
  background: #071a2e !important;
  border-color: #27415c !important;
  color: #f5fbff !important;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  background: #0d2440 !important;
  border-color: var(--watcher-mint) !important;
  box-shadow: 0 0 0 3px rgba(124, 246, 179, 0.2) !important;
}

[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus {
  border-color: var(--watcher-blue) !important;
  box-shadow: 0 0 0 3px rgba(0, 111, 174, 0.16) !important;
}

[data-bs-theme="dark"] .form-check-input:checked,
[data-bs-theme="light"] .form-check-input:checked {
  background-color: var(--watcher-blue) !important;
  border-color: var(--watcher-blue) !important;
}

[data-bs-theme="dark"] .btn-light {
  background: #15314d !important;
  border-color: #27415c !important;
  color: #e9f2f8 !important;
}

[data-bs-theme="dark"] .btn-light:hover {
  background: #214866 !important;
  border-color: #35627e !important;
  color: #ffffff !important;
}

[data-bs-theme="dark"] .btn-light-primary {
  background: rgba(0, 168, 200, 0.16) !important;
  border-color: rgba(124, 246, 179, 0.26) !important;
  color: var(--watcher-mint) !important;
}

label.required::after {
  content: " *";
  color: var(--watcher-danger);
  font-weight: 700;
}

pre,
.bg-light-dark {
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--watcher-border);
  overflow-x: auto;
  background: var(--watcher-surface-soft) !important;
}

[data-bs-theme="dark"] pre,
[data-bs-theme="dark"] .bg-light-dark {
  background: #071a2e !important;
  border-color: #27415c !important;
  color: #c6d7e4 !important;
}

.table .dropdown-menu {
  min-width: 200px;
  box-shadow: var(--watcher-shadow-lg);
}

[data-bs-theme="dark"] .table .dropdown-menu {
  background: #0d2440 !important;
  border-color: #27415c !important;
}

[data-bs-theme="dark"] .table .dropdown-item {
  color: #e9f2f8 !important;
}

[data-bs-theme="dark"] .table .dropdown-item:hover {
  background: #214866 !important;
  color: #ffffff !important;
}

.fullscreen-layout {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.fullscreen-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
}

.fullscreen-toolbar {
  position: sticky;
  z-index: 100;
  top: 0;
  background: var(--watcher-surface) !important;
  border-bottom: 1px solid var(--watcher-border) !important;
  box-shadow: var(--watcher-shadow-sm);
}

[data-bs-theme="dark"] .fullscreen-toolbar {
  background: #0d2440 !important;
  border-color: #27415c !important;
}

.fullscreen-content {
  flex: 1;
  width: 100%;
  padding: 1.5rem;
  overflow-x: hidden;
}

.fullscreen-layout #agents-cards-container {
  display: flex;
  flex-wrap: wrap;
  margin-inline: -0.625rem;
}

.fullscreen-layout #agents-cards-container > div {
  flex: 0 0 auto;
  min-width: 400px;
  padding-inline: 0.625rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 2400px) {
  .fullscreen-layout #agents-cards-container > div { width: 16.666667%; }
}

@media (min-width: 2000px) and (max-width: 2399.98px) {
  .fullscreen-layout #agents-cards-container > div { width: 20%; }
}

@media (min-width: 1600px) and (max-width: 1999.98px) {
  .fullscreen-layout #agents-cards-container > div { width: 25%; }
}

@media (min-width: 1200px) and (max-width: 1599.98px) {
  .fullscreen-layout #agents-cards-container > div { width: 33.333333%; }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
  .fullscreen-layout #agents-cards-container > div { width: 50%; }
}

@media (max-width: 767.98px) {
  .fullscreen-content { padding: 1rem; }
  .fullscreen-layout #agents-cards-container > div {
    width: 100%;
    min-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .agent-card:hover,
  .system-card:hover,
  .interactive-card:hover {
    transform: none;
  }
}
