/* ══════════════════════════════════════════════════════════════
   evidentia.css — Design system · Auxiliar Contable GIFAN
   Paleta: Navy calido + Cyan moderno + Amber acento
   Tipografía: Inter (texto) + JetBrains Mono (códigos/RFCs/cuentas)
   ══════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --azul:      #1a3a5c;
  --azul-mid:  #2563eb;
  --teal:      #0891b2;
  --teal-light:#ecfeff;
  --accent:    #f59e0b;
  --accent-light: #fef3c7;
  --bg:        #f8fafc;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --ink:       #0f172a;
  --ink-mid:   #475569;
  --muted:     #94a3b8;
  --success:   #16a34a;
  --warning:   #f59e0b;
  --error:     #dc2626;
  --mono:      'JetBrains Mono', monospace;
  --sans:      'Inter', -apple-system, sans-serif;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 4px rgba(15,23,42,.06);
  --shadow:    0 2px 12px rgba(15,23,42,.08);
  --shadow-lg: 0 4px 24px rgba(15,23,42,.12);
}

/* ── Dark mode ─────────────────────────────────────────────── */
[data-theme="dark"] {
  --azul:      #60a5fa;
  --azul-mid:  #93bbfd;
  --teal:      #22d3ee;
  --teal-light:#083344;
  --accent:    #fbbf24;
  --accent-light: #422006;
  --bg:        #0f172a;
  --surface:   #1e293b;
  --border:    #334155;
  --ink:       #f1f5f9;
  --ink-mid:   #cbd5e1;
  --muted:     #64748b;
  --success:   #4ade80;
  --warning:   #fbbf24;
  --error:     #f87171;
  --shadow-sm: 0 1px 4px rgba(0,0,0,.3);
  --shadow:    0 2px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 4px 24px rgba(0,0,0,.5);
}

/* ── Reset base ──────────────────────────────────────────────  */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Tipografía ──────────────────────────────────────────────  */
h1, h2, h3, h4 { font-weight: 600; color: var(--azul); line-height: 1.25; letter-spacing: -0.025em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); font-size: 0.87rem; }

/* ── Header ──────────────────────────────────────────────────  */
#main-header {
  background: rgba(26, 58, 92, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.18);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
[data-theme="dark"] #main-header {
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 0;
}

/* Brand */
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
  margin-right: 32px;
}

.header-brand:hover { text-decoration: none; }

.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0891b2, #f59e0b);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(8,145,178,0.3);
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  display: block;
  line-height: 1.15;
  color: #fff;
}

.brand-sub {
  font-size: 10px;
  opacity: 0.55;
  display: block;
  color: #fff;
}

/* ── Navegación por modos ────────────────────────────────────  */
.mode-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.mode-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,.6);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 9999px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.01em;
  text-decoration: none;
}

.mode-pill:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
  text-decoration: none;
}

.mode-pill.active {
  background: rgba(255,255,255,.18);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}

.mode-icon { font-size: 14px; }

/* ── Header right ────────────────────────────────────────────  */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

/* Estado Odoo */
.odoo-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
  color: rgba(255,255,255,.7);
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.12);
  transition: all 0.15s;
  text-decoration: none;
}

.odoo-status:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  text-decoration: none;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  transition: background 0.3s;
  flex-shrink: 0;
}

.status-dot.connected { background: #00E676; box-shadow: 0 0 6px #00E67688; }
.status-dot.error     { background: #ef5350; }

/* User chip */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,.85);
}

.btn-logout {
  font-size: 11px;
  color: rgba(255,255,255,.45);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 4px;
  padding: 3px 9px;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-logout:hover {
  color: #fff;
  border-color: rgba(255,255,255,.4);
  text-decoration: none;
}

/* ── Flash messages ──────────────────────────────────────────  */
.flash-container {
  max-width: 1280px;
  margin: 12px auto 0;
  padding: 0 24px;
}

.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 6px;
  border: 1px solid;
}

.flash-error   { background: #fff5f5; border-color: #ffcdd2; color: var(--error); }
.flash-success { background: #f1f8e9; border-color: #c5e1a5; color: var(--success); }
.flash-info    { background: var(--teal-light); border-color: #b2dfdb; color: var(--teal); }

/* ── Contenido principal ─────────────────────────────────────  */
#main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - 56px);
}

/* ── Page layout ─────────────────────────────────────────────  */
.page-container { }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-title { font-size: 1.5rem; }
.page-sub   { font-size: 13px; color: var(--muted); margin-top: 2px; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Cards ───────────────────────────────────────────────────  */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.card-compact { padding: 16px 20px; }
.card-title   { font-size: 14px; font-weight: 700; color: var(--azul);
                margin-bottom: 16px; }
.card-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; }

/* ── Botones ─────────────────────────────────────────────────  */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--sans);
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--azul), var(--azul-mid));
  color: #fff;
  border: none;
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--azul-mid), var(--azul));
  box-shadow: 0 4px 12px rgba(37,99,235,.25);
}

.btn-secondary {
  background: #fff;
  color: var(--azul);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg); border-color: var(--azul); }

.btn-teal {
  background: var(--teal);
  color: #fff;
}
.btn-teal:hover:not(:disabled) { background: #016a6f; }

.btn-danger {
  background: #fff5f5;
  color: var(--error);
  border-color: #ffcdd2;
}
.btn-danger:hover:not(:disabled) { background: #ffebee; }

/* ── Inputs ──────────────────────────────────────────────────  */
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.input:focus {
  border-color: var(--azul-mid);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.input-sm { max-width: 260px; }

select.input { cursor: pointer; }

/* ── Layouts ─────────────────────────────────────────────────  */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ── Form group ──────────────────────────────────────────────  */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--azul);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}

/* ── Filter bar ──────────────────────────────────────────────  */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-pills { display: flex; gap: 4px; }

.pill {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink-mid);
  transition: all 0.15s;
}

.pill:hover  { border-color: var(--teal); color: var(--teal); }
.pill.active { background: var(--teal); color: #fff; border-color: var(--teal); }

.pill-count {
  display: inline-block;
  background: rgba(0,0,0,.12);
  border-radius: 10px;
  padding: 0 5px;
  font-size: 10px;
  margin-left: 3px;
}

.pill.active .pill-count { background: rgba(255,255,255,.25); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-mid);
  cursor: pointer;
}

/* ── Status indicators ───────────────────────────────────────  */
.status-hint {
  font-size: 12px;
  color: var(--muted);
}

.action-hint {
  font-size: 12px;
  color: var(--muted);
}

/* ── Empty state ─────────────────────────────────────────────  */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 13px;
}

.empty-state p { margin-bottom: 14px; }

/* ── Metrics row ─────────────────────────────────────────────  */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--azul);
  font-family: var(--mono);
}

/* ── Steps grid (dashboard) ──────────────────────────────────  */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 700px) {
  .steps-grid { grid-template-columns: 1fr; }
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink);
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
  cursor: pointer;
}

.step-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--teal);
  text-decoration: none;
  color: var(--ink);
}

.step-disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.step-number {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--azul);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.step-icon  { font-size: 28px; margin: 4px 0; }
.step-title { font-size: 15px; font-weight: 700; color: var(--azul); }
.step-desc  { font-size: 12px; color: var(--muted); flex: 1; }
.step-cta   { font-size: 12px; font-weight: 600; color: var(--teal); margin-top: 4px; }

/* ── Button variants adicionales ─────────────────────────────  */
.btn-success {
  background: var(--success);
  color: #fff;
  border-color: transparent;
}
.btn-success:hover:not(:disabled) { background: #1b5e20; }
.btn-success:disabled { opacity: 0.75; cursor: default; }

/* ── Toast notifications ──────────────────────────────────────  */
#toast-container {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 340px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px 15px;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,48,87,.18);
  font-size: 13px;
  font-weight: 500;
  pointer-events: all;
  transform: translateX(110%);
  opacity: 0;
  transition: transform 0.22s cubic-bezier(.25,.8,.25,1), opacity 0.22s;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  line-height: 1.45;
}

.toast.toast-show { transform: translateX(0); opacity: 1; }
.toast.toast-hide { transform: translateX(110%); opacity: 0; }

.toast-success { background: #f1f8e9; border-color: #a5d6a7; color: #1b5e20; }
.toast-error   { background: #fff5f5; border-color: #ef9a9a; color: #b71c1c; }
.toast-info    { background: var(--teal-light); border-color: #80cbc4; color: #00695c; }
.toast-warning { background: #fff8e1; border-color: #ffe082; color: #e65100; }

.toast-icon  { font-size: 14px; flex-shrink: 0; margin-top: 1px; font-style: normal; }
.toast-msg   { flex: 1; }
.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  opacity: 0.45;
  padding: 0;
  line-height: 1;
  color: inherit;
  transition: opacity 0.15s;
  margin-top: 1px;
  font-family: var(--sans);
}
.toast-close:hover { opacity: 0.85; }

.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.toast-success .toast-progress { background: var(--success); }
.toast-error   .toast-progress { background: var(--error); }
.toast-info    .toast-progress { background: var(--teal); }
.toast-warning .toast-progress { background: var(--warning); }

/* ── Confirm modal ────────────────────────────────────────────  */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 35, 0.48);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeOverlay 0.15s ease;
}

@keyframes fadeOverlay { from { opacity: 0; } to { opacity: 1; } }

.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px 28px 22px;
  max-width: 420px;
  width: calc(100% - 40px);
  box-shadow: 0 8px 40px rgba(0,48,87,.22);
  animation: slideModal 0.18s cubic-bezier(.25,.8,.25,1);
}

@keyframes slideModal {
  from { opacity: 0; transform: scale(.96) translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--azul);
  margin-bottom: 8px;
}

.modal-body {
  font-size: 13px;
  color: var(--ink-mid);
  line-height: 1.6;
  margin-bottom: 22px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ══════════════════════════════════════════════════════════════
   Micro-interacciones & Animaciones
   ══════════════════════════════════════════════════════════════ */

/* ── Transiciones globales ──────────────────────────────────── */
.card, .metric-card, .step-card {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.2s;
}

.btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

/* ── Cards hover ────────────────────────────────────────────── */
.card:hover, .metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ── Skeleton loading ───────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg,
    var(--border) 25%, rgba(255,255,255,.4) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}

/* ── Fade in up ─────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeInUp 0.4s ease-out both;
}

/* ── Status dot pulse ───────────────────────────────────────── */
.status-dot.connected {
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
}

/* ── Focus visible ring ─────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--azul-mid);
  outline-offset: 2px;
}

/* ── Scroll suave ───────────────────────────────────────────── */
html { scroll-behavior: smooth; }

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

/* ══════════════════════════════════════════════════════════════
   Dark mode — ajustes de componentes
   ══════════════════════════════════════════════════════════════ */
[data-theme="dark"] .flash-error   { background: #3b1111; border-color: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .flash-success { background: #052e16; border-color: #166534; color: #86efac; }
[data-theme="dark"] .flash-info    { background: #083344; border-color: #155e75; color: #67e8f9; }
[data-theme="dark"] .toast-success { background: #052e16; border-color: #166534; color: #86efac; }
[data-theme="dark"] .toast-error   { background: #3b1111; border-color: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .toast-info    { background: #083344; border-color: #155e75; color: #67e8f9; }
[data-theme="dark"] .toast-warning { background: #422006; border-color: #92400e; color: #fde68a; }
[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, 0.6); }
[data-theme="dark"] .modal-dialog  { box-shadow: 0 8px 40px rgba(0,0,0,.5); }
[data-theme="dark"] .btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
[data-theme="dark"] .btn-secondary:hover:not(:disabled) { background: var(--bg); }
[data-theme="dark"] .btn-danger    { background: #3b1111; border-color: #7f1d1d; }
[data-theme="dark"] .pill          { background: var(--surface); border-color: var(--border); color: var(--ink-mid); }

/* ── Dark mode toggle button ────────────────────────────────── */
.theme-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  padding: 5px 8px;
  cursor: pointer;
  color: rgba(255,255,255,.6);
  font-size: 14px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  line-height: 1;
}
.theme-toggle:hover {
  color: #fff;
  border-color: rgba(255,255,255,.35);
}
