/* ── Flash messages ──────────────────────────────────────────── */

.flash {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: 0.6rem;
  position: relative;
  padding-right: 2.5rem;
  box-shadow: var(--shadow-xs);
}
.flash-success { background: var(--success-15); color: var(--success); border: 1px solid rgba(38,194,129,0.25); }
.flash-error   { background: var(--danger-15);  color: var(--danger);  border: 1px solid rgba(235,87,87,0.25); }
.flash-info    { background: var(--brand-10);   color: var(--brand);   border: 1px solid var(--brand-25); }

/* ── Auth pages ──────────────────────────────────────────────── */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* Gradient glow + dot grid */
.auth-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 65% 55% at 50% -5%, var(--brand-15) 0%, transparent 70%),
    radial-gradient(ellipse 40% 35% at 85% 85%, rgba(38,194,129,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.auth-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 1.75rem; }
.auth-logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 800;
}
.auth-logo h1 span { color: var(--brand); }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.85rem; color: var(--text-muted); }
.auth-footer a { color: var(--brand); font-weight: 600; }

.auth-topbar { position: fixed; top: 1rem; right: 1rem; display: flex; gap: 0.5rem; z-index: 10; }
.auth-topbar .theme-btn-home { font-size: 0.8rem; padding: 0.35rem 0.6rem; text-decoration: none; }
.auth-card-centered { text-align: center; max-width: 460px; }
.auth-emoji { font-size: 3rem; margin-bottom: 1rem; }
.auth-forgot-link { text-align: right; margin: -0.25rem 0 0.75rem; }
.auth-forgot-link a { font-size: 0.82rem; color: var(--text-muted); }

/* ── Auth split-screen (login) ──────────────────────────────────
   El rail de marca ancla home + toggle de tema a un header real
   en vez de dejarlos como botones fijos flotando sobre la página. */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 38%) 1fr;
  background: var(--bg);
}

.auth-rail {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 1.5rem 2.25rem 2.25rem;
}
.auth-rail::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 65% 55% at 50% -5%, var(--brand-15) 0%, transparent 70%),
    radial-gradient(ellipse 40% 35% at 85% 85%, rgba(38,194,129,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.auth-rail::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

.auth-rail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}
.auth-rail-brand {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--text);
  text-decoration: none;
}
.auth-rail-brand:hover { text-decoration: none; opacity: 0.85; }
.auth-rail-brand span { color: var(--brand); }

.auth-rail-body {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  padding-bottom: 2rem;
}
.auth-rail-tagline {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
  max-width: 18ch;
  margin: 0;
}
.auth-rail-tagline em { color: var(--brand); font-style: normal; }

.meter { position: relative; height: 3.3rem; }
.meter-row {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  opacity: 0;
  animation: meterCycle 12s infinite both;
}
.meter-row:nth-child(1) { animation-delay: 0s; }
.meter-row:nth-child(2) { animation-delay: 3s; }
.meter-row:nth-child(3) { animation-delay: 6s; }
.meter-row:nth-child(4) { animation-delay: 9s; }
.meter-text {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
}
@keyframes meterCycle {
  0%, 100% { opacity: 0; }
  2%  { opacity: 1; }
  23% { opacity: 1; }
  27% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .meter-row { animation: none; opacity: 0; }
  .meter-row:first-child { position: relative; opacity: 1; }
}

.auth-form-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

@media (max-width: 959px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-rail {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    gap: 0;
  }
  .auth-rail-body { display: none; }
}

/* ── Utility classes ─────────────────────────────────────────── */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.78rem; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-brand { color: var(--brand); }
.font-mono { font-family: "JetBrains Mono", monospace; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ── Theme toggle ────────────────────────────────────────────── */

.theme-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  display: flex; align-items: center;
  transition: background 0.15s, color 0.15s;
}
.theme-btn:hover { background: var(--border); color: var(--text); }

/* ── Breadcrumb ──────────────────────────────────────────────── */

.breadcrumb { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); text-decoration: none; }
.breadcrumb-sep { color: var(--border); }

/* ── Empty state ─────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 52px; height: 52px;
  margin: 0 auto 1.25rem;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; margin-bottom: 1.25rem; }

/* ── Copy field ──────────────────────────────────────────────── */

.copy-field { display: flex; align-items: center; gap: 0.5rem; }
.copy-field .form-input { font-family: "JetBrains Mono", monospace; font-size: 0.82rem; }

/* ── Key-value grid ──────────────────────────────────────────── */

.kv-grid { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.5rem; font-size: 0.875rem; }
.kv-label { color: var(--text-muted); font-weight: 600; white-space: nowrap; font-size: 0.82rem; }

/* ── Smooth theme transitions ────────────────────────────────── */

body, .sidebar, .card, .stat-card, .auth-card, header, footer {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.2s ease;
}

/* ── Focus visible ───────────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 5px;
}
:focus:not(:focus-visible) { outline: none; }

/* ── Skip link ───────────────────────────────────────────────── */

.skip-link {
  position: absolute;
  top: -100%; left: 0;
  background: var(--brand);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 8px 0;
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 10000;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; }

/* ── Scrollbar ───────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Password toggle ─────────────────────────────────────────── */

.input-with-action { position: relative; }
.input-with-action .form-input { padding-right: 2.75rem; }
.input-action-btn {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 0.25rem;
  display: flex; align-items: center;
  border-radius: 4px; transition: color 0.15s;
}
.input-action-btn:hover { color: var(--text); }

/* ── Flash close ─────────────────────────────────────────────── */

.flash-close {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: currentColor; opacity: 0.6;
  font-size: 1.1rem; line-height: 1;
  padding: 0.2rem 0.4rem; border-radius: 4px;
  transition: opacity 0.15s;
}
.flash-close:hover { opacity: 1; }

/* ── Password strength ───────────────────────────────────────── */

.pwd-strength { display: flex; gap: 3px; margin-top: 0.4rem; }
.pwd-strength-bar {
  height: 3px; flex: 1; border-radius: 2px;
  background: var(--border); transition: background 0.3s;
}
.pwd-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

