:root {
  --itsos-bg: #f4f7fb;
  --itsos-surface: #ffffff;
  --itsos-surface-muted: #eef3f8;
  --itsos-border: #d7e0ea;
  --itsos-text: #1d2733;
  --itsos-text-muted: #5b6977;
  --itsos-link: #2d7dd2;
  --itsos-shadow: 0 12px 30px rgba(18, 38, 63, 0.08);
}

html[data-theme="dark"] {
  --itsos-bg: #0f1722;
  --itsos-surface: #182231;
  --itsos-surface-muted: #223246;
  --itsos-border: #30465f;
  --itsos-text: #e7edf5;
  --itsos-text-muted: #9caec2;
  --itsos-link: #78b7ff;
  --itsos-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .content-wrapper,
html[data-theme="dark"] .main-panel,
html[data-theme="dark"] .main-content,
html[data-theme="dark"] .container-user,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .well,
html[data-theme="dark"] .breadcrumb,
html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .dataTables_wrapper .dataTables_filter input,
html[data-theme="dark"] .dataTables_wrapper .dataTables_length select,
html[data-theme="dark"] .ui-dialog,
html[data-theme="dark"] .ui-widget-content,
html[data-theme="dark"] .fc-theme-standard .fc-scrollgrid,
html[data-theme="dark"] .fc .fc-popover,
html[data-theme="dark"] .fc-theme-standard .fc-list,
html[data-theme="dark"] .jumbotron,
html[data-theme="dark"] fieldset {
  background-color: var(--itsos-surface) !important;
  color: var(--itsos-text) !important;
}

html[data-theme="dark"] body {
  background: radial-gradient(circle at top, #1d2b3d 0%, #0f1722 50%, #0a1119 100%) !important;
  color: var(--itsos-text) !important;
}

html[data-theme="dark"] a {
  color: var(--itsos-link);
}

html[data-theme="dark"] a:hover,
html[data-theme="dark"] a:focus {
  color: #9dcbff;
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .container-user,
html[data-theme="dark"] .ui-dialog,
html[data-theme="dark"] .fixed-plugin .card {
  border: 1px solid var(--itsos-border) !important;
  box-shadow: var(--itsos-shadow) !important;
}

html[data-theme="dark"] .panel-default > .panel-heading,
html[data-theme="dark"] .panel-heading,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .ui-dialog-titlebar,
html[data-theme="dark"] .breadcrumb,
html[data-theme="dark"] .timeline .timeline-header,
html[data-theme="dark"] .fc-theme-standard .fc-list-day-cushion,
html[data-theme="dark"] .fc-theme-standard .fc-popover-header {
  background: var(--itsos-surface-muted) !important;
  color: var(--itsos-text) !important;
  border-color: var(--itsos-border) !important;
}

html[data-theme="dark"] .timeline,
html[data-theme="dark"] .timeline .timeline-body,
html[data-theme="dark"] .timeline.timeline-avatar {
  background-color: var(--itsos-surface) !important;
  color: var(--itsos-text) !important;
  border-color: var(--itsos-border) !important;
}

html[data-theme="dark"] .timeline {
  box-shadow: var(--itsos-shadow) !important;
}

html[data-theme="dark"] .timeline a {
  color: var(--itsos-link) !important;
}

html[data-theme="dark"] .timeline a:hover,
html[data-theme="dark"] .timeline a:focus {
  color: #9dcbff !important;
}

html[data-theme="dark"] .timeline .timeline-header:before {
  border-color: transparent var(--itsos-surface-muted) transparent transparent !important;
}

html[data-theme="dark"] .timeline-task:before,
html[data-theme="dark"] .timeline-avatar:before,
html[data-theme="dark"] .timeline-avatar:after,
html[data-theme="dark"] .timeline-task:after {
  background-color: var(--itsos-border) !important;
  border-color: var(--itsos-border) !important;
}

html[data-theme="dark"] .navbar,
html[data-theme="dark"] .navbar-default,
html[data-theme="dark"] .nav-tabs > li > a,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .table > thead > tr > th,
html[data-theme="dark"] .table > tbody > tr > th,
html[data-theme="dark"] .table > tfoot > tr > th,
html[data-theme="dark"] .table > thead > tr > td,
html[data-theme="dark"] .table > tbody > tr > td,
html[data-theme="dark"] .table > tfoot > tr > td,
html[data-theme="dark"] .fc-theme-standard td,
html[data-theme="dark"] .fc-theme-standard th,
html[data-theme="dark"] .table-bordered,
html[data-theme="dark"] .table-bordered > thead > tr > th,
html[data-theme="dark"] .table-bordered > tbody > tr > th,
html[data-theme="dark"] .table-bordered > tfoot > tr > th,
html[data-theme="dark"] .table-bordered > thead > tr > td,
html[data-theme="dark"] .table-bordered > tbody > tr > td,
html[data-theme="dark"] .table-bordered > tfoot > tr > td {
  border-color: var(--itsos-border) !important;
}

html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd),
html[data-theme="dark"] .table-hover > tbody > tr:hover,
html[data-theme="dark"] .fc .fc-list-event:hover td {
  background-color: rgba(120, 183, 255, 0.08) !important;
}

html[data-theme="dark"] .table > thead > tr > th,
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] small,
html[data-theme="dark"] .help-block,
html[data-theme="dark"] .breadcrumb > .active,
html[data-theme="dark"] .dataTables_info,
html[data-theme="dark"] .dataTables_paginate,
html[data-theme="dark"] .fc .fc-toolbar-title,
html[data-theme="dark"] .fc .fc-col-header-cell-cushion,
html[data-theme="dark"] .fc .fc-daygrid-day-number {
  color: var(--itsos-text-muted) !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .select2-selection,
html[data-theme="dark"] .ui-widget input,
html[data-theme="dark"] .ui-widget select,
html[data-theme="dark"] .ui-widget textarea,
html[data-theme="dark"] .ui-widget button {
  background-color: #101927 !important;
  color: var(--itsos-text) !important;
  border-color: var(--itsos-border) !important;
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #7f93a8 !important;
}

html[data-theme="dark"] .btn-default,
html[data-theme="dark"] .btn-light,
html[data-theme="dark"] .dt-button,
html[data-theme="dark"] .fc .fc-button-primary {
  background: #223246 !important;
  color: var(--itsos-text) !important;
  border-color: var(--itsos-border) !important;
}

html[data-theme="dark"] .btn-default:hover,
html[data-theme="dark"] .btn-light:hover,
html[data-theme="dark"] .dt-button:hover,
html[data-theme="dark"] .fc .fc-button-primary:hover {
  background: #2a3d53 !important;
  color: #fff !important;
}

html[data-theme="dark"] .pagination > li > a,
html[data-theme="dark"] .pagination > li > span {
  background-color: var(--itsos-surface) !important;
  border-color: var(--itsos-border) !important;
  color: var(--itsos-text) !important;
}

html[data-theme="dark"] .pagination > .active > a,
html[data-theme="dark"] .pagination > .active > span,
html[data-theme="dark"] .pagination > .active > a:hover,
html[data-theme="dark"] .pagination > .active > span:hover,
html[data-theme="dark"] .pagination > .active > a:focus,
html[data-theme="dark"] .pagination > .active > span:focus {
  background-color: #305f8d !important;
  border-color: #3f79b0 !important;
}

html[data-theme="dark"] .nav > li > a:hover,
html[data-theme="dark"] .nav > li > a:focus,
html[data-theme="dark"] .dropdown-menu > li > a:hover,
html[data-theme="dark"] .dropdown-menu > li > a:focus,
html[data-theme="dark"] .list-group-item:hover {
  background-color: rgba(120, 183, 255, 0.08) !important;
  color: var(--itsos-text) !important;
}

html[data-theme="dark"] hr,
html[data-theme="dark"] .horizontal.dark,
html[data-theme="dark"] .panel-footer,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .nav-tabs,
html[data-theme="dark"] .page-header {
  border-color: var(--itsos-border) !important;
}

html[data-theme="dark"] .modal-backdrop.in {
  opacity: 0.7;
}

html[data-theme="dark"] img[src$=".svg"]:not(.theme-no-filter),
html[data-theme="dark"] .navbar-brand img:not(.theme-no-filter) {
  filter: brightness(0.92) contrast(1.05);
}

.itsos-theme-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10050;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(25, 47, 73, 0.15);
  background: rgba(255, 255, 255, 0.92);
  color: #16304d;
  box-shadow: 0 14px 34px rgba(18, 38, 63, 0.16);
  backdrop-filter: blur(12px);
  font-size: 13px;
  font-weight: 600;
}

.itsos-theme-toggle:hover,
.itsos-theme-toggle:focus {
  color: #16304d;
  text-decoration: none;
}

html[data-theme="dark"] .itsos-theme-toggle {
  background: rgba(24, 34, 49, 0.95);
  color: var(--itsos-text);
  border-color: var(--itsos-border);
  box-shadow: var(--itsos-shadow);
}

.itsos-theme-toggle__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(45, 125, 210, 0.12);
}

html[data-theme="dark"] .itsos-theme-toggle__icon {
  background: rgba(120, 183, 255, 0.14);
}

@media (max-width: 767px) {
  .itsos-theme-toggle {
    right: 12px;
    bottom: 12px;
    padding: 10px 12px;
  }

  .itsos-theme-toggle__label {
    display: none;
  }
}

html[data-theme="dark"] #ticket_principal,
html[data-theme="dark"] #ticket_principal .container,
html[data-theme="dark"] #ticket_principal .row,
html[data-theme="dark"] #ticket_principal .card,
html[data-theme="dark"] #ticket_principal .card-body,
html[data-theme="dark"] #ticket_principal .panel,
html[data-theme="dark"] #ticket_principal .panel-body,
html[data-theme="dark"] #ticket_principal .timeline,
html[data-theme="dark"] #ticket_principal .timeline-body,
html[data-theme="dark"] #ticket_principal .timeline-header,
html[data-theme="dark"] #ticket_principal fieldset,
html[data-theme="dark"] #ticket_principal .breadcrumb,
html[data-theme="dark"] #ticket_principal .form-control,
html[data-theme="dark"] #ticket_principal .nav-tabs > li > a,
html[data-theme="dark"] #ticket_principal .modal-content {
  color: var(--itsos-text) !important;
}

html[data-theme="dark"] #ticket_principal .panel.panel-default,
html[data-theme="dark"] #ticket_principal .panel-body,
html[data-theme="dark"] #ticket_principal .card,
html[data-theme="dark"] #ticket_principal .card-body,
html[data-theme="dark"] #ticket_principal .timeline-body,
html[data-theme="dark"] #ticket_principal .timeline-header,
html[data-theme="dark"] #ticket_principal #tickets-container,
html[data-theme="dark"] #ticket_principal .ticket-section,
html[data-theme="dark"] #ticket_principal fieldset,
html[data-theme="dark"] #ticket_principal #modalGuardarCambios .modal-content {
  background: var(--itsos-surface) !important;
  border-color: var(--itsos-border) !important;
}

html[data-theme="dark"] #ticket_principal .card-body.bg-default {
  background: linear-gradient(180deg, #1c2a3b 0%, #152131 100%) !important;
}

html[data-theme="dark"] #ticket_principal .timeline-task:before,
html[data-theme="dark"] #ticket_principal .timeline-avatar:before,
html[data-theme="dark"] #ticket_principal .timeline-avatar:after,
html[data-theme="dark"] #ticket_principal .timeline-task:after {
  background-color: var(--itsos-border) !important;
  border-color: var(--itsos-border) !important;
}

html[data-theme="dark"] #ticket_principal .timeline-body,
html[data-theme="dark"] #ticket_principal .timeline-header {
  box-shadow: var(--itsos-shadow) !important;
}

html[data-theme="dark"] #ticket_principal .text-muted,
html[data-theme="dark"] #ticket_principal small,
html[data-theme="dark"] #ticket_principal .help-block,
html[data-theme="dark"] #ticket_principal .listaitems > li,
html[data-theme="dark"] #ticket_principal .breadcrumb > .active,
html[data-theme="dark"] #ticket_principal p.d-inline.text-muted {
  color: var(--itsos-text-muted) !important;
}

html[data-theme="dark"] #ticket_principal .listaitems > li + li:before {
  color: var(--itsos-border) !important;
}

html[data-theme="dark"] #ticket_principal .nav-tabs > li.active > a,
html[data-theme="dark"] #ticket_principal .nav-tabs > li.active > a:hover,
html[data-theme="dark"] #ticket_principal .nav-tabs > li.active > a:focus,
html[data-theme="dark"] #ticket_principal .nav-tabs > li > a:hover,
html[data-theme="dark"] #ticket_principal .nav-tabs > li > a:focus {
  background: var(--itsos-surface-muted) !important;
  border-color: var(--itsos-border) !important;
  color: var(--itsos-text) !important;
}

html[data-theme="dark"] #ticket_principal #tickets-container .ticket-section,
html[data-theme="dark"] #ticket_principal #tickets-container li {
  border-color: var(--itsos-border) !important;
}

html[data-theme="dark"] #ticket_principal #tickets-container h5,
html[data-theme="dark"] #ticket_principal #tickets-container b,
html[data-theme="dark"] #ticket_principal #tickets-container span,
html[data-theme="dark"] #ticket_principal #tickets-container p {
  color: var(--itsos-text) !important;
}

html[data-theme="dark"] #ticket_principal #tickets-container a,
html[data-theme="dark"] #ticket_principal #tickets-container a[style] {
  color: #8ec5ff !important;
}

html[data-theme="dark"] #ticket_principal #blur-skeleton {
  filter: blur(4px) brightness(0.7) !important;
  opacity: 0.75 !important;
}

html[data-theme="dark"] #ticket_principal .btn-link {
  color: #8ec5ff !important;
}

html[data-theme="dark"] #ticket_principal audio,
html[data-theme="dark"] #ticket_principal video,
html[data-theme="dark"] #ticket_principal iframe {
  background: #0f1722 !important;
  border-radius: 8px;
}

html[data-theme="dark"] #ticket_principal #alerta-validar-ticket {
  background: linear-gradient(135deg, #352914, #4a3717) !important;
  color: #f8e7b3 !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] #ticket_principal #alerta-validar-ticket div,
html[data-theme="dark"] #ticket_principal #alerta-validar-ticket span {
  color: inherit !important;
}

html[data-theme="dark"] #ticket_principal #icono-alerta-validar,
html[data-theme="dark"] #ticket_principal #scrollToTopBtn {
  background-color: #20344a !important;
  color: var(--itsos-text) !important;
  box-shadow: var(--itsos-shadow) !important;
}

html[data-theme="dark"] #ticket_principal .btn-default,
html[data-theme="dark"] #ticket_principal .buttons-html5.btn.btn-default {
  background: #223246 !important;
  border-color: var(--itsos-border) !important;
  color: var(--itsos-text) !important;
}

html[data-theme="dark"] #ticket_principal .btn-default:hover,
html[data-theme="dark"] #ticket_principal .buttons-html5.btn.btn-default:hover {
  background: #2a3d53 !important;
  color: #fff !important;
}

html[data-theme="dark"] #ticket_principal .modal-header,
html[data-theme="dark"] #ticket_principal .modal-footer {
  background: var(--itsos-surface-muted) !important;
  border-color: var(--itsos-border) !important;
}

html[data-theme="dark"] #ticket_principal .close {
  color: var(--itsos-text) !important;
  opacity: 0.85;
}

#ticket_principal .ticket-warning-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff6d8;
  border: 1px solid #efd58a;
  color: #6d5200;
}

#ticket_principal .ticket-warning-note span,
#ticket_principal .ticket-warning-note strong {
  color: inherit;
}

html[data-theme="dark"] #ticket_principal .ticket-warning-note,
html[data-theme="dark"] #ticket_principal #mensaje_aviso_finalizar {
  background: linear-gradient(135deg, #352914, #4a3717) !important;
  border-color: #7a5e24 !important;
  color: #f8e7b3 !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] #ticket_principal .ticket-warning-note span,
html[data-theme="dark"] #ticket_principal .ticket-warning-note strong,
html[data-theme="dark"] #ticket_principal #mensaje_aviso_finalizar span,
html[data-theme="dark"] #ticket_principal #mensaje_aviso_finalizar strong {
  color: inherit !important;
}
