:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --line: #d9dee7;
  --text: #202631;
  --muted: #657080;
  --primary: #176b87;
  --primary-strong: #0f4f64;
  --accent: #8a5a12;
  --danger: #b42318;
  --success: #13795b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

.topbar {
  align-items: center;
  background: #2a579a;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
}

.brand img {
  height: 44px;
  object-fit: contain;
}

.nav {
  display: flex;
  gap: 8px;
}

.nav a {
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  padding: 8px 10px;
  transition: background 0.2s;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.link:hover {
  color: var(--primary-strong);
}

.page {
  margin: 0 auto;
  max-width: 1280px;
  padding: 26px;
}

.toolbar {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 18px;
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.muted {
  color: var(--muted);
  margin: 4px 0 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 26px;
  padding: 18px;
}

.panel.narrow {
  max-width: 720px;
}

.form-grid {
  align-items: end;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(260px, 1fr) 240px auto;
}

.form-stack {
  display: grid;
  gap: 16px;
}

label span {
  display: block;
  font-weight: 700;
  margin-bottom: 7px;
}

input[type="file"],
input[type="text"],
select {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-height: 42px;
  padding: 8px 10px;
  width: 100%;
}

.button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
  text-decoration: none;
  white-space: nowrap;
}

.button.primary {
  background: var(--primary);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--primary-strong);
}

.button.secondary {
  background: #ffffff;
  border-color: var(--line);
  color: var(--primary);
}

.section {
  margin-top: 22px;
}

.group-list {
  display: grid;
  gap: 14px;
}

.group-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.group-head {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.group-head h3 {
  font-size: 18px;
  letter-spacing: 0;
  margin: 0;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 840px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef3f5;
  color: #384252;
  font-size: 13px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.pad {
  padding: 18px;
}

.messages {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.message {
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-weight: 500;
  border: 1px solid transparent;
}
.message.success {
  background: #edf7f3;
  border-color: #b7dfd0;
  color: #0e5d46;
}
.message.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 5px;
}

.stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  margin-bottom: 20px;
}

.stats > div, .stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.stats strong,
.stats span {
  display: block;
}

.stats strong {
  font-size: 24px;
}

.stats span {
  color: var(--muted);
}

.results table {
  min-width: 1180px;
}

.badge {
  background: #eef0f3;
  border-radius: 999px;
  color: #3d4653;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
}

.badge.problem {
  background: #fde8e6;
  color: var(--danger);
}

.badge.resolved {
  background: #e5f5ee;
  color: var(--success);
}

.tags {
  min-width: 180px;
}

.tags span {
  display: block;
  margin-bottom: 4px;
}

details summary {
  color: var(--primary);
  cursor: pointer;
  font-weight: 700;
}

.notification {
  display: grid;
  gap: 8px;
  grid-template-columns: 100px minmax(220px, 1fr);
  margin: 12px 0 0;
}

.notification dt {
  color: var(--muted);
  font-weight: 700;
}

.notification dd {
  margin: 0;
}

pre {
  background: #f4f6f8;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: Consolas, "Courier New", monospace;
  margin: 0;
  max-width: 560px;
  overflow-x: auto;
  padding: 10px;
  white-space: pre-wrap;
}

/* Email Chips UI */
.email-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.email-input-wrap input {
  flex: 1;
  margin-bottom: 0;
}
.email-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.email-chip {
  background: #eef0f3;
  border: 1px solid #d9dee7;
  border-radius: 4px;
  color: #3d4653;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  padding: 4px 8px;
  gap: 6px;
}
.email-chip .remove {
  background: transparent;
  border: none;
  color: #a0aab8;
  cursor: pointer;
  font-weight: bold;
  padding: 0;
  line-height: 1;
}
.email-chip .remove:hover {
  color: var(--danger);
}

/* Switch UI for checkboxes */
.toggle-switch {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 50px !important;
  height: 26px !important;
  background: #aaa;
  border-radius: 50px;
  position: relative;
  cursor: pointer;
  outline: none;
  transition: background 0.3s;
  display: block;
  margin: 0 !important;
  padding: 0 !important;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle-switch:checked {
  background: #61A0FF !important; /* Azul como pidió */
}
.toggle-switch:checked::after {
  left: 27px;
}

/* Ant Design React Layout Adaption */
.ant-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  overflow-x: hidden;
}

.ant-sider {
  width: 256px;
  background: #111827;
  transition: width 0.2s;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.ant-sider.collapsed {
  width: 80px;
}

.ant-sider-top {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 16px;
  flex-shrink: 0;
}

.ant-sider-logo-wrap {
  display: flex;
  justify-content: center;
  padding: 10px 16px 20px;
  transition: all 0.2s;
}

.ant-sider-logo-wrap .sider-logo {
  max-width: 220px;
  max-height: 75px;
  object-fit: contain;
}

.ant-sider.collapsed .ant-sider-logo-wrap {
  opacity: 0;
  height: 0;
  padding: 0;
  overflow: hidden;
  margin: 0;
}

.ant-sider-search-wrap {
  padding: 16px;
  transition: all 0.2s;
}

.ant-sider.collapsed .ant-sider-search-wrap {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  height: 0;
  padding: 0 16px;
}

.ant-search-icon-wrap {
  position: relative;
}

.ant-search-icon-wrap input {
  background: #1f2937;
  border: none;
  color: white;
  width: 100%;
  border-radius: 6px;
  padding: 8px 12px 8px 36px;
  outline: none;
  min-height: 38px;
}

.ant-search-icon-wrap input::placeholder {
  color: #9ca3af;
}

.ant-search-icon-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  fill: #9ca3af;
  width: 16px;
  height: 16px;
}

.ant-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ant-menu-item {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  color: #9ca3af;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.3s, background 0.3s;
  white-space: nowrap;
  overflow: hidden;
}

.ant-menu-item:hover, .ant-menu-item.active {
  color: white;
  background: #1f2937;
}

.ant-menu-submenu-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  color: #9ca3af;
  cursor: pointer;
  transition: color 0.3s, background 0.3s;
  user-select: none;
}

.ant-menu-submenu-title:hover {
  color: white;
  background: #1f2937;
}

.ant-menu-submenu-title-left {
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
}

.ant-menu-submenu-title-left svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
  margin-right: 16px;
}

.ant-menu-submenu-arrow {
  width: 12px;
  height: 12px;
  fill: currentColor;
  transition: transform 0.3s;
}

.ant-menu-submenu.open > .ant-menu-submenu-title .ant-menu-submenu-arrow {
  transform: rotate(180deg);
}

.ant-menu-submenu .ant-menu-sub {
  display: none;
  background: #111827;
  list-style: none;
  padding: 0;
  margin: 0;
}

.ant-menu-submenu.open > .ant-menu-sub {
  display: block;
}

.ant-menu-sub .ant-menu-item {
  padding-left: 48px;
}

.ant-menu-sub .ant-menu-submenu-title {
  padding-left: 48px;
}

.ant-menu-sub .ant-menu-sub .ant-menu-item {
  padding-left: 72px;
}

.ant-sider.collapsed .ant-menu-submenu-arrow {
  display: none;
}

.ant-sider.collapsed .ant-menu-submenu-title {
  padding: 12px 0;
  justify-content: center;
}

.ant-sider.collapsed .ant-menu-submenu-title-left svg {
  margin-right: 0;
}

.ant-sider.collapsed .ant-menu-submenu-title-left span {
  display: none;
}

.ant-sider.collapsed .ant-menu-sub {
  display: none !important;
}

.ant-menu-item svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
  margin-right: 16px;
}

.ant-sider.collapsed .ant-menu-item {
  padding: 12px 0;
  justify-content: center;
}

.ant-sider.collapsed .ant-menu-item svg {
  margin-right: 0;
}

.ant-sider.collapsed .ant-menu-item span {
  display: none;
}

.ant-layout-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: #1a4175;
  height: 64px;
  flex-shrink: 0;
}

.ant-header-left, .ant-header-right {
  display: flex;
  align-items: center;
}

.ant-toggle-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 20px;
  width: 64px;
  height: 64px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -20px;
}

.ant-toggle-btn:hover {
  background: rgba(255,255,255,0.1);
}

.ant-toggle-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.ant-brand-text {
  color: white;
  font-weight: bold;
  font-size: 18px;
  margin-left: 10px;
}

.ant-header-right {
  gap: 20px;
  color: white;
}

.ant-header-right a {
  color: white;
  text-decoration: none;
  font-weight: 500;
}

.ant-header-right a:hover {
  opacity: 0.8;
}

.ant-content {
  margin: 24px 16px;
  padding: 24px;
  background: #f9fafb;
  border-radius: 8px;
  flex: 1;
  overflow-y: auto;
}

@media (max-width: 760px) {
  .topbar,
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    gap: 10px;
    padding: 14px 18px;
  }

  .page {
    padding: 18px;
  }

  .form-grid,
  .stats {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 22px;
  }
}

/* Sidebar Live Search */
.ant-search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 16px;
  right: 16px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 6px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 4px;
}

.ant-search-result-item {
  padding: 10px 12px;
  border-bottom: 1px solid #374151;
  cursor: pointer;
  transition: background 0.2s;
}

.ant-search-result-item:last-child {
  border-bottom: none;
}

.ant-search-result-item:hover {
  background: #374151;
}

.result-name {
  color: white;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-base {
  color: #9ca3af;
  font-size: 11px;
}

.ant-search-result-empty {
  padding: 12px;
  color: #9ca3af;
  font-size: 13px;
  text-align: center;
}
/* Loading Spinner & Overlay */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(17, 25, 38, 0.8);
  backdrop-filter: blur(4px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  color: white;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-weight: 500;
  letter-spacing: 0.05em;
}
