/* RotaTech NINO AI Premium — Dark/Light Responsive Stylesheet (WCAG 2.2 AA) */
.rt-nino-app {
  --nino-bg: #0b1220;
  --nino-surface: #121c30;
  --nino-surface-2: #192640;
  --nino-border: #263859;
  --nino-text: #eef4ff;
  --nino-muted: #9eb2d1;
  --nino-accent: #38bdf8;
  --nino-accent-2: #0284c7;
  --nino-ok: #22c55e;
  --nino-warn: #f59e0b;
  --nino-danger: #ef4444;
  background: var(--nino-bg);
  color: var(--nino-text);
  border: 1px solid var(--nino-border);
  border-radius: 16px;
  padding: 20px;
  max-width: 1080px;
  margin: 18px auto;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.rt-nino-app[data-theme="light"] {
  --nino-bg: #f8fafc;
  --nino-surface: #ffffff;
  --nino-surface-2: #f1f5f9;
  --nino-border: #cbd5e1;
  --nino-text: #0f172a;
  --nino-muted: #475569;
  --nino-accent: #0369a1;
  --nino-accent-2: #075985;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.rt-nino-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--nino-border);
}

.rt-nino-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rt-nino-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}

.rt-nino-title {
  margin: 0;
  font-size: 1.25rem;
  color: var(--nino-text);
}

.rt-nino-subtitle {
  margin: 2px 0 0;
  font-size: 0.86rem;
  color: var(--nino-muted);
}

.rt-nino-header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rt-nino-pill, .rt-nino-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.rt-nino-pill--fb { background: rgba(56, 189, 248, 0.16); color: var(--nino-accent); border: 1px solid var(--nino-accent); }
.rt-nino-pill--perf { background: rgba(34, 197, 94, 0.16); color: #22c55e; border: 1px solid #22c55e; }
.rt-nino-pill--auto { background: rgba(245, 158, 11, 0.16); color: #f59e0b; border: 1px solid #f59e0b; }
.rt-nino-pill--off { background: rgba(239, 68, 68, 0.16); color: #ef4444; border: 1px solid #ef4444; }
.rt-nino-badge { background: rgba(56, 189, 248, 0.16); color: #0284c7; border: 1px solid #38bdf8; }

.rt-nino-lang-group {
  display: inline-flex;
  background: var(--nino-surface);
  border: 1px solid var(--nino-border);
  border-radius: 8px;
  overflow: hidden;
}

.rt-nino-chip {
  background: transparent;
  color: var(--nino-muted);
  border: 0;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.rt-nino-chip.is-active {
  background: var(--nino-accent-2);
  color: #fff;
}

.rt-nino-privacy-bar {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--nino-surface);
  border-left: 4px solid var(--nino-accent);
  font-size: 0.84rem;
  color: var(--nino-muted);
}
.rt-nino-privacy-bar strong { color: var(--nino-text); }

.rt-nino-notice {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
}
.rt-nino-notice--warn {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid #f59e0b;
  color: inherit;
}

.rt-nino-selector-panel {
  margin-top: 14px;
  background: var(--nino-surface);
  border: 1px solid var(--nino-border);
  border-radius: 12px;
  padding: 12px 14px;
}
.rt-nino-selector-summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--nino-text);
}
.rt-nino-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.rt-nino-selector-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--nino-muted);
}
.rt-nino-selector-grid select,
.rt-nino-selector-grid input {
  background: var(--nino-surface-2);
  color: var(--nino-text);
  border: 1px solid var(--nino-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.86rem;
}
.rt-nino-selector-warn {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid var(--nino-danger);
  color: var(--nino-text);
  font-size: 0.82rem;
}

.rt-nino-categories {
  margin-top: 14px;
}
.rt-nino-categories__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--nino-muted);
  margin-bottom: 8px;
}
.rt-nino-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 8px;
}
.rt-nino-cat-btn {
  text-align: left;
  background: var(--nino-surface);
  color: var(--nino-text);
  border: 1px solid var(--nino-border);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.rt-nino-cat-btn:hover,
.rt-nino-cat-btn.is-selected {
  border-color: var(--nino-accent);
  background: var(--nino-surface-2);
}

.rt-nino-messages {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 180px;
  max-height: 520px;
  overflow-y: auto;
  padding: 12px;
  background: var(--nino-surface);
  border: 1px solid var(--nino-border);
  border-radius: 12px;
}

.rt-nino-msg {
  padding: 12px 14px;
  border-radius: 12px;
  max-width: 92%;
  line-height: 1.55;
  font-size: 0.92rem;
}
.rt-nino-msg--user {
  align-self: flex-end;
  background: var(--nino-accent-2);
  color: #fff;
}
.rt-nino-msg--ai {
  align-self: flex-start;
  background: var(--nino-surface-2);
  border: 1px solid var(--nino-border);
  color: var(--nino-text);
}
.rt-nino-msg__meta {
  font-size: 0.75rem;
  color: var(--nino-muted);
  margin-bottom: 6px;
  font-weight: 700;
}
.rt-nino-msg--user .rt-nino-msg__meta { color: rgba(255,255,255,0.82); }
.rt-nino-msg__body { white-space: pre-wrap; word-break: break-word; }

.rt-nino-sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--nino-border);
  font-size: 0.8rem;
}
.rt-nino-sources a { color: var(--nino-accent); text-decoration: underline; }

.rt-nino-msg__actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rt-nino-composer {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rt-nino-composer textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--nino-surface);
  color: var(--nino-text);
  border: 1px solid var(--nino-border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 62px;
}
.rt-nino-composer__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.rt-nino-composer__btns { display: flex; gap: 8px; margin-left: auto; }
.rt-nino-filter-tag {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--nino-surface-2);
  border: 1px solid var(--nino-accent);
  color: var(--nino-accent);
}

.rt-nino-btn {
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rt-nino-btn--primary { background: var(--nino-accent-2); color: #fff; }
.rt-nino-btn--primary:hover { filter: brightness(1.08); }
.rt-nino-btn--ghost { background: var(--nino-surface); color: var(--nino-text); border-color: var(--nino-border); }
.rt-nino-btn--danger { background: var(--nino-danger); color: #fff; }
.rt-nino-btn--sm { padding: 5px 10px; font-size: 0.76rem; }
.rt-nino-link-btn { background: none; border: 0; color: var(--nino-accent); cursor: pointer; text-decoration: underline; font-size: 0.8rem; }

.rt-nino-app [hidden] { display: none !important; }
.rt-nino-app :focus-visible { outline: 2px solid var(--nino-accent); outline-offset: 2px; }
.rt-nino-composer { padding-bottom: 42px; }

/* Forum card */
.rt-nino-forum-card {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.rt-nino-forum-card h3 { margin: 6px 0 4px; color: #fff; font-size: 1.1rem; }
.rt-nino-forum-card p { margin: 0; color: #cbd5e1; font-size: 0.88rem; max-width: 720px; }

/* WP Admin Control Center */
.rt-nino-admin-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.rt-nino-kpi {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
}
.rt-nino-kpi__label { display: block; font-size: 12px; color: #475569; margin-bottom: 4px; }
.rt-nino-kpi__val { font-size: 15px; color: #0f172a; }
.rt-nino-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 18px;
}
.rt-nino-admin-card {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 16px 20px;
}
.rt-nino-admin-out {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 8px;
  max-height: 280px;
  overflow: auto;
  font-size: 12px;
}

@media (max-width: 600px) {
  .rt-nino-app { padding: 14px; border-radius: 12px; }
  .rt-nino-cat-grid { grid-template-columns: repeat(2, 1fr); }
  .rt-nino-selector-grid { grid-template-columns: 1fr 1fr; }
  .rt-nino-msg { max-width: 100%; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .rt-nino-app { padding: 12px; margin: 8px auto; }
  .rt-nino-header { gap: 8px; padding-bottom: 8px; }
  .rt-nino-cat-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .rt-nino-messages { max-height: 220px; min-height: 110px; }
  .rt-nino-composer { padding-bottom: 18px; }
}


/* === Technical Facts Engine PRO — Structured Answer UI (Etapa 8F.3.1, WCAG AA, Light & Dark) === */
.rt-nino-engine-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(14, 116, 144, 0.14);
  color: #0e7490;
  border: 1px solid rgba(14, 116, 144, 0.35);
}
.rt-nino-engine-badge--performance_grounded {
  background: rgba(21, 128, 61, 0.14);
  color: #15803d;
  border-color: rgba(21, 128, 61, 0.35);
}
.rt-nino-engine-badge--conflict_guard,
.rt-nino-engine-badge--safety_shield,
.rt-nino-engine-badge--emergency_stop {
  background: rgba(185, 28, 28, 0.14);
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.35);
}
.rt-nino-app[data-theme="dark"] .rt-nino-engine-badge {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.4);
}
.rt-nino-app[data-theme="dark"] .rt-nino-engine-badge--performance_grounded {
  background: rgba(74, 222, 128, 0.16);
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.4);
}
.rt-nino-app[data-theme="dark"] .rt-nino-engine-badge--conflict_guard,
.rt-nino-app[data-theme="dark"] .rt-nino-engine-badge--safety_shield {
  background: rgba(248, 113, 113, 0.18);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.45);
}
.rt-nino-struct-section {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.06);
}
.rt-nino-struct-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  opacity: 0.85;
}
.rt-nino-cfg-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rt-nino-cfg-pill {
  font-size: 0.76rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.25);
  font-weight: 600;
}
.rt-nino-spec-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.rt-nino-spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.rt-nino-spec-table th,
.rt-nino-spec-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  vertical-align: top;
}
.rt-nino-spec-val {
  font-weight: 700;
  white-space: nowrap;
}
.rt-nino-cond-box ul,
.rt-nino-warn-box ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.84rem;
}
.rt-nino-warn-box {
  border-color: rgba(217, 119, 6, 0.45);
  background: rgba(217, 119, 6, 0.09);
}
.rt-nino-struct-main {
  white-space: pre-wrap;
  line-height: 1.55;
}
