/* ==========================================================================
   bcv-smc · UI calcada del dashboard de OpenWA (mismos tokens, medidas y componentes)
   Tipografía Plus Jakarta Sans / JetBrains Mono (OFL) servidas localmente.
   ========================================================================== */
@font-face { font-family: "Plus Jakarta Sans Variable"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(/static/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plus Jakarta Sans Variable"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(/static/fonts/plus-jakarta-sans-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono Variable"; font-style: normal; font-display: swap; font-weight: 100 800;
  src: url(/static/fonts/jetbrains-mono-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---- Tokens (claro) ---- */
:root {
  --primary: #25d366; --primary-text: #17813e; --primary-hover: #1da851; --primary-soft: #25d3661f;
  --bg-light: #f8fafc; --bg-white: #fff; --bg-card: #fff;
  --text-primary: #0f172a; --text-secondary: #475569; --text-muted: #64748b; --border: #e2e8f0;
  --error: #ef4444; --success: #22c55e; --warning: #f59e0b; --info: #2563eb;
  --error-text: #c63838; --success-text: #157c3b; --warning-text: #986207;
  --shadow-sm: 0 1px 2px 0 #0000000d;
  --shadow-md: 0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;
  --shadow-lg: 0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;
  --radius: 10px;
  color-scheme: light;
}
/* ---- Tokens (oscuro): por preferencia del sistema o forzado con data-theme="dark" ---- */
:root[data-theme="dark"] {
  --primary-text: #25d366; --primary-soft: color-mix(in srgb, #25d366 18%, transparent);
  --bg-light: #0f172a; --bg-white: #1e293b; --bg-card: #1e293b;
  --text-primary: #f1f5f9; --text-secondary: #cbd5e1; --text-muted: #94a3b8; --border: #334155;
  --error-text: #f77b7b; --success-text: #22c55e; --warning-text: #f59e0b; --info: #60a5fa;
  --shadow-sm: 0 1px 2px 0 #0000004d;
  --shadow-md: 0 4px 6px -1px #0000004d, 0 2px 4px -2px #0000004d;
  --shadow-lg: 0 10px 15px -3px #0006, 0 4px 6px -4px #0006;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --primary-text: #25d366; --primary-soft: color-mix(in srgb, #25d366 18%, transparent);
    --bg-light: #0f172a; --bg-white: #1e293b; --bg-card: #1e293b;
    --text-primary: #f1f5f9; --text-secondary: #cbd5e1; --text-muted: #94a3b8; --border: #334155;
    --error-text: #f77b7b; --success-text: #22c55e; --warning-text: #f59e0b; --info: #60a5fa;
    --shadow-sm: 0 1px 2px 0 #0000004d;
    --shadow-md: 0 4px 6px -1px #0000004d, 0 2px 4px -2px #0000004d;
    --shadow-lg: 0 10px 15px -3px #0006, 0 4px 6px -4px #0006;
    color-scheme: dark;
  }
}

/* ---- Base ---- */
:root { font-family: "Plus Jakarta Sans Variable", "Plus Jakarta Sans", system-ui, Avenir, Helvetica, Arial, sans-serif; font-weight: 400; line-height: 1.6;
  color: var(--text-primary); background-color: var(--bg-light); font-synthesis: none; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html { background-color: var(--bg-light); }
*, *::before, *::after { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; }
a { color: var(--primary-text); font-weight: 500; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { color: var(--text-primary); letter-spacing: -0.025em; margin: 0; font-size: 1.875rem; font-weight: 700; line-height: 1.3; }
h2 { color: var(--text-primary); margin: 0; font-size: 1.25rem; font-weight: 700; }
h3 { color: var(--text-primary); margin: 0; font-size: 1rem; font-weight: 600; }
p { margin: 0; }
.eyebrow { color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin: 0; font-size: 0.8125rem; font-weight: 600; }
code, .mono { background: var(--bg-light); color: var(--text-primary); border-radius: 4px; padding: 0.125rem 0.375rem; font-family: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.875em; }
button { cursor: pointer; border: 1px solid transparent; border-radius: 8px; padding: 0.6em 1.2em; font-family: inherit; font-size: 1em; font-weight: 500; transition: border-color 0.25s; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--primary, #25d366); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---- Botones ---- */
.btn-primary, .btn-secondary, .btn-danger { align-items: center; gap: 0.5rem; padding: 0.75rem 1.25rem; font-size: 0.9375rem; font-weight: 600; transition: all 0.2s; display: inline-flex; border-radius: 8px; cursor: pointer; text-decoration: none; justify-content: center; }
.btn-primary { background: var(--primary); color: #0f172a; border: none; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); text-decoration: none; }
.btn-secondary { background: var(--bg-light); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-white); border-color: var(--text-muted); color: var(--text-primary); text-decoration: none; }
.btn-danger { background: var(--error); color: #fff; border: none; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-primary:disabled, .btn-secondary:disabled, .btn-danger:disabled, .is-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-sm { cursor: pointer; background: var(--bg-light); border: 1px solid var(--border); color: var(--text-secondary); border-radius: 6px; padding: 0.375rem 0.75rem; font-size: 0.75rem; font-weight: 500; transition: all 0.2s; display: inline-flex; align-items: center; text-decoration: none; }
.btn-sm:hover { background: var(--bg-white); border-color: var(--text-muted); text-decoration: none; }
.btn-icon { background: var(--bg-light); border: 1px solid var(--border); cursor: pointer; width: 36px; height: 36px; color: var(--text-secondary); border-radius: 8px; flex-shrink: 0; justify-content: center; align-items: center; padding: 0; transition: all 0.2s; display: flex; }

/* ---- Campos ---- */
.field label, .modal-body > label { color: var(--text-secondary); margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 600; display: block; }
.field input[type=text], .field input[type=date], .field input[type=password], .field input[type=number], .field input[type=search], .field select {
  border: 1px solid var(--border); background: var(--bg-light); color: var(--text-primary); border-radius: 8px; width: 100%; padding: 0.75rem 1rem; font-family: inherit; font-size: 0.9375rem; transition: all 0.2s; }
.field input:focus, .field select:focus { border-color: var(--primary); background: var(--bg-white); outline: none; box-shadow: 0 0 0 3px #25d3661a; }
.field select, select.select { appearance: none; cursor: pointer; padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 0.75rem center; background-repeat: no-repeat; background-size: 16px; }
.field select:hover { border-color: var(--primary); }
.check { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8125rem; font-weight: 500; color: var(--text-secondary); background: var(--bg-light); border: 1px solid var(--border); border-radius: 8px; padding: 0.35rem 0.65rem; cursor: pointer; }
.check input { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; }
.check:has(input:checked) { background: #25d36614; border-color: #25d36673; color: var(--text-primary); }

/* ---- Layout: sidebar + contenido ---- */
.layout { min-height: 100vh; display: flex; }
.sidebar { background: var(--bg-white); border-right: 1px solid var(--border); z-index: 100; flex-direction: column; width: 260px; height: 100vh; transition: width 0.3s ease, transform 0.3s ease; display: flex; position: fixed; }
.sidebar.collapsed { width: 72px; }
.sidebar-header { border-bottom: 1px solid var(--border); align-items: center; gap: 0.75rem; min-height: 72px; padding: 1.5rem; display: flex; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 1.5rem 1rem; }
.sidebar-logo { object-fit: contain; flex-shrink: 0; width: 28px; height: 28px; }
.mobile-brand .sidebar-logo { width: 24px; height: 24px; }
.sidebar-brand { white-space: nowrap; flex-direction: column; display: flex; overflow: hidden; }
.sidebar.collapsed .sidebar-brand, .sidebar.collapsed .nav-item span, .sidebar.collapsed .theme-toggle-btn span:not(.appearance-button-cue), .sidebar.collapsed .logout-btn span { display: none; }
.brand-name { color: var(--text-primary); letter-spacing: -0.01em; font-size: 1.125rem; font-weight: 800; line-height: 1.4; }
.brand-version { letter-spacing: 0.02em; color: var(--text-muted); opacity: 0.7; margin-top: 1px; font-size: 0.625rem; font-weight: 500; }
.collapse-toggle { background: var(--bg-white); border: 1px solid var(--border); cursor: pointer; width: 28px; height: 28px; color: var(--text-secondary); z-index: 101; border-radius: 50%; justify-content: center; align-items: center; padding: 0; transition: all 0.2s; display: flex; position: absolute; top: 36px; right: -14px; box-shadow: 0 2px 8px #0000001a; }
.collapse-toggle:hover { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px #25d3664d; }
.collapse-toggle svg { width: 16px; height: 16px; transition: transform 0.2s; }
.sidebar.collapsed .collapse-toggle svg { transform: rotate(180deg); }
.sidebar-nav { flex-direction: column; flex: 1; gap: 0.25rem; padding: 1rem 0.75rem; display: flex; overflow-y: auto; }
.sidebar.collapsed .sidebar-nav { padding: 1rem 0.5rem; }
.nav-item { color: var(--text-secondary); border-radius: var(--radius); white-space: nowrap; align-items: center; gap: 0.75rem; padding: 0.7rem 1rem; font-size: 0.875rem; font-weight: 500; text-decoration: none; transition: all 0.2s; display: flex; overflow: hidden; }
.nav-item svg { flex-shrink: 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0.7rem; }
.nav-item:hover { background: var(--bg-light); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary-text); }
.nav-item.active svg { color: var(--primary-text); }
.sidebar-footer { border-top: 1px solid var(--border); flex-direction: column; gap: 0.5rem; padding: 0.75rem; display: flex; }
.sidebar.collapsed .sidebar-footer { padding: 0.75rem 0.5rem; }
.theme-toggle-btn, .logout-btn { color: var(--text-secondary); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; white-space: nowrap; background: transparent; align-items: center; gap: 0.75rem; padding: 0.6rem 0.9rem; font-size: 0.875rem; font-weight: 500; transition: all 0.2s; display: flex; overflow: hidden; width: 100%; font-family: inherit; text-align: left; }
.appearance-button-cue { width: 24px; height: 24px; color: inherit; flex-shrink: 0; justify-content: center; align-items: center; display: inline-flex; position: relative; }
.sidebar.collapsed .theme-toggle-btn, .sidebar.collapsed .logout-btn { justify-content: center; padding: 0.6rem; }
.theme-toggle-btn:hover { background: var(--bg-light); color: var(--text-primary); }
.logout-btn:hover { color: var(--error-text); background: #ef44441f; border-color: #ef44444d; }
.sidebar-footer form { margin: 0; }
.main-content { background: var(--bg-light); flex: 1; width: calc(100% - 260px); min-height: 100vh; margin-left: 260px; transition: margin-left 0.3s ease, width 0.3s ease; overflow-x: hidden; }
.main-content.expanded { width: calc(100% - 72px); margin-left: 72px; }
.mobile-header, .sidebar-overlay { display: none; }
@media (width <= 767px) {
  .mobile-header { background: var(--bg-white); border-bottom: 1px solid var(--border); z-index: 90; justify-content: space-between; align-items: center; height: 56px; padding: 0 1rem; display: flex; position: fixed; top: 0; left: 0; right: 0; }
  .mobile-menu-btn { width: 40px; height: 40px; color: var(--text-primary); cursor: pointer; border-radius: var(--radius); border: none; justify-content: center; align-items: center; padding: 0; transition: background 0.2s; display: flex; background: transparent; }
  .mobile-menu-btn svg { color: var(--text-primary); stroke: var(--text-primary); }
  .mobile-menu-btn:hover { background: var(--bg-light); }
  .mobile-brand { align-items: center; gap: 0.5rem; display: flex; }
  .mobile-brand .brand-name { font-size: 1rem; }
  .mobile-spacer { width: 40px; }
  .sidebar { width: 280px; transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 2px 0 20px #0000001a; }
  .sidebar.collapsed { width: 280px; }
  .sidebar.collapsed .sidebar-brand, .sidebar.collapsed .nav-item span, .sidebar.collapsed .theme-toggle-btn span:not(.appearance-button-cue), .sidebar.collapsed .logout-btn span { display: inline; }
  .sidebar.collapsed .sidebar-brand { display: flex; }
  .sidebar.collapsed .nav-item, .sidebar.collapsed .theme-toggle-btn, .sidebar.collapsed .logout-btn { justify-content: flex-start; padding: 0.7rem 1rem; }
  .sidebar-overlay { z-index: 95; background: #00000080; animation: fadeIn 0.2s ease; position: fixed; inset: 0; }
  .sidebar-overlay.show { display: block; }
  .main-content, .main-content.expanded { width: 100%; margin-left: 0; padding-top: 56px; }
  .collapse-toggle { display: none; }
}
@keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } }

/* ---- Cabecera de página ---- */
.page { box-sizing: border-box; width: 100%; padding: 2rem; }
.page-header { grid-template-columns: 1fr auto; grid-template-areas: "title actions" "subtitle subtitle"; align-items: center; column-gap: 1rem; width: 100%; margin-bottom: 2rem; display: grid; }
.page-header__title-group { grid-area: title; align-items: center; gap: 0.75rem; min-width: 0; display: flex; flex-wrap: wrap; }
.page-header__actions { grid-area: actions; justify-self: end; align-items: center; gap: 0.75rem; display: flex; }
.page-header__subtitle { color: var(--text-muted); grid-area: subtitle; margin: 0.5rem 0 0; font-size: 0.9375rem; line-height: 1.5; }

/* ---- Tarjetas y estadísticas ---- */
.card { background: var(--bg-white); box-shadow: var(--shadow-sm); border: 1px solid var(--border); border-radius: 12px; width: 100%; padding: 1.5rem; }
.card + .card, .stats-grid + .card, .card + .stats-grid { margin-top: 1.5rem; }
.section-header { justify-content: space-between; align-items: center; margin-bottom: 1.5rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.section-subtitle { color: var(--text-muted); font-size: 0.875rem; }
.stats-grid { grid-template-columns: repeat(4, 1fr); gap: 1.5rem; width: 100%; margin-bottom: 1.5rem; display: grid; }
.stat-card { background: var(--bg-white); box-shadow: var(--shadow-sm); border: 1px solid var(--border); border-radius: 12px; min-width: 0; padding: 1.5rem; transition: transform 0.2s, box-shadow 0.2s; position: relative; overflow: hidden; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card--wide { grid-column: span 2; }
.stat-header { justify-content: space-between; align-items: center; margin-bottom: 0.75rem; display: flex; }
.stat-icon { color: var(--text-muted); z-index: 2; position: relative; }
.stat-watermark { opacity: 0.04; width: 96px; height: 96px; color: var(--text-primary); pointer-events: none; z-index: 1; position: absolute; bottom: -15px; right: -10px; transform: rotate(-15deg); }
.stat-label { text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); z-index: 2; font-size: 0.75rem; font-weight: 600; position: relative; }
.stat-value { color: var(--text-primary); z-index: 2; font-size: 2rem; font-weight: 700; position: relative; font-variant-numeric: tabular-nums; line-height: 1.3; word-break: break-word; }
.stat-card--wide .stat-value { font-size: 2.5rem; }
.stat-card:not(.stat-card--wide) .stat-value { font-size: 1.5rem; }
.stat-detail { color: var(--text-muted); z-index: 2; margin-top: 0.5rem; font-size: 0.75rem; line-height: 1.35; position: relative; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem 1.5rem; }
.kv dt { color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.7rem; font-weight: 700; margin: 0 0 0.25rem; }
.kv dd { margin: 0; font-size: 0.9375rem; color: var(--text-primary); }
.nota-fuente { color: var(--text-muted); font-size: 0.8125rem; line-height: 1.5; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.aviso { border-radius: 8px; padding: 0.875rem 1rem; font-size: 0.875rem; margin-bottom: 1.5rem; background: #3b82f61a; border: 1px solid #3b82f64d; color: var(--text-primary); }
.error-banner { background: #ef44441a; border: 1px solid #ef44444d; border-radius: 8px; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; padding: 1rem; display: flex; color: var(--error-text); font-size: 0.9375rem; }
.empty-state { text-align: center; color: var(--text-muted); padding: 3rem 1rem; font-size: 0.9375rem; }

/* ---- Insignias ---- */
.status-badge, .status-pill { border-radius: 9999px; white-space: nowrap; display: inline-block; width: fit-content; }
.status-badge { text-transform: uppercase; letter-spacing: 0.025em; padding: 0.375rem 0.75rem; font-size: 0.6875rem; font-weight: 700; }
.status-pill { padding: 0.25rem 0.75rem; font-size: 0.75rem; font-weight: 500; }
.tone-ok { color: var(--primary-text); background: #25d3661a; }
.tone-info { color: var(--info); background: #3b82f61a; }
.tone-warn { color: var(--warning-text); background: #f59e0b26; }
.tone-error { color: var(--error-text); background: #ef444426; }
.tone-muted { background: var(--bg-light); color: var(--text-muted); }
.permission-badge { color: var(--info); white-space: nowrap; background: #3b82f61f; border-radius: 4px; padding: 0.25rem 0.5rem; font-size: 0.6875rem; font-weight: 500; }

/* ---- Tablas ---- */
.table-container { background: var(--bg-white); box-shadow: var(--shadow-sm); border: 1px solid var(--border); border-radius: 12px; width: 100%; overflow-x: auto; }
.data-table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
.data-table thead th { background: var(--bg-light); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); text-align: start; padding: 1.125rem 1.5rem; font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.data-table tbody td { border-bottom: 1px solid var(--border); vertical-align: middle; padding: 1.125rem 1.5rem; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #25d3660d; }
.data-table tbody tr:nth-child(2n) { background: #94a3b814; }
.data-table tbody tr:nth-child(2n):hover { background: #25d3660d; }
.data-table .num, .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.data-table th.num { text-align: right; }
.table-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.5rem; border-top: 1px solid var(--border); flex-wrap: wrap; color: var(--text-muted); font-size: 0.8125rem; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.pagination .btn-sm { min-width: 2rem; justify-content: center; }
.pagination .btn-sm.active { background: var(--primary); border-color: var(--primary); color: #0f172a; font-weight: 700; }
.pagination .gap { align-self: center; padding: 0 0.25rem; color: var(--text-muted); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; align-items: end; }
.filters .actions { display: flex; gap: 0.5rem; }
.filters .actions > * { flex: 1; }
.monedas { margin-top: 1rem; }
.monedas > summary { cursor: pointer; font-size: 0.875rem; color: var(--text-secondary); font-weight: 600; }
.monedas-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

/* ---- Login (calcado de la pantalla de acceso) ---- */
.login-container { background: var(--bg-light); flex-direction: column; justify-content: center; align-items: center; width: 100%; min-height: 100vh; padding: 2rem; display: flex; }
.login-card { background: var(--bg-white); box-shadow: var(--shadow-lg); text-align: center; border-radius: 12px; width: 100%; max-width: 420px; padding: 3rem; }
.login-logo { flex-direction: column; justify-content: center; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; display: flex; }
.logo-icon { width: 96px; height: 96px; }
.version-info { color: var(--text-muted); font-size: 0.75rem; font-weight: 500; }
.login-form { text-align: start; }
.input-group { margin-bottom: 1.5rem; }
.input-group label { color: var(--text-primary); margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 500; display: block; }
.input-wrapper { position: relative; }
.input-wrapper input { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-white); color: var(--text-primary); width: 100%; padding: 0.75rem 3rem 0.75rem 1rem; font-family: inherit; font-size: 1rem; transition: border-color 0.2s, box-shadow 0.2s; }
.input-wrapper input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px #25d3661a; }
.toggle-visibility { color: var(--text-muted); cursor: pointer; background: transparent; border: none; padding: 0.25rem; position: absolute; top: 50%; right: 0.75rem; transform: translateY(-50%); display: flex; }
.toggle-visibility:hover { color: var(--text-secondary); }
.connect-btn { color: #fff; background: var(--primary); border-radius: var(--radius); cursor: pointer; border: none; width: 100%; padding: 0.875rem 1.5rem; font-size: 1rem; font-weight: 600; transition: background 0.2s; font-family: inherit; }
.connect-btn:hover:not(:disabled) { background: var(--primary-hover); }
.login-help { color: var(--text-secondary); margin-top: 1.5rem; font-size: 0.875rem; }
.login-footer { color: var(--text-muted); text-align: center; flex-direction: column; align-items: center; gap: 0.75rem; margin-top: 2rem; font-size: 0.75rem; display: flex; }
.error-message { color: var(--error-text); margin-bottom: 1.25rem; font-size: 0.875rem; text-align: left; background: #ef44441a; border: 1px solid #ef44444d; border-radius: 8px; padding: 0.75rem 1rem; }
.form-card { max-width: 480px; }
.reglas { color: var(--text-muted); font-size: 0.8125rem; padding-left: 1.1rem; margin: 0.5rem 0 1.25rem; }

/* ---- Toasts ---- */
.toast-container { z-index: 9999; flex-direction: column; gap: 0.75rem; max-width: 400px; display: flex; position: fixed; bottom: 1.5rem; right: 1.5rem; }
.toast { background: var(--bg-card); border-left: 4px solid; border-radius: 12px; align-items: flex-start; gap: 0.75rem; padding: 1rem 1.25rem; animation: slideIn 0.3s ease-out; display: flex; box-shadow: 0 10px 40px #0000001f, 0 4px 12px #00000014; }
.toast-success { border-color: #22c55e; } .toast-error { border-color: #ef4444; } .toast-warning { border-color: #f59e0b; } .toast-info { border-color: #3b82f6; }
.toast-content { flex: 1; min-width: 0; }
.toast-title { color: var(--text-primary); font-size: 0.9375rem; font-weight: 600; line-height: 1.4; }
.toast-message { color: var(--text-secondary); margin-top: 0.25rem; font-size: 0.8125rem; line-height: 1.5; }
.toast-close { width: 24px; height: 24px; color: var(--text-muted); cursor: pointer; background: transparent; border: none; border-radius: 6px; flex-shrink: 0; justify-content: center; align-items: center; padding: 0; display: flex; }
.toast-close:hover { background: var(--bg-light); color: var(--text-secondary); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ---- Responsivo (mismos cortes que OpenWA: 1024 / 768 / 480) ---- */
@media (width <= 1024px) { .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; } .stat-card--wide { grid-column: span 2; } }
@media (width <= 768px) {
  h1 { font-size: 1.5rem; }
  .page { padding: 1rem; }
  .page-header { grid-template-columns: 1fr; grid-template-areas: "title" "subtitle" "actions"; column-gap: 0; margin-bottom: 1.5rem; }
  .page-header__actions { justify-self: stretch; margin-top: 0.75rem; }
  .page-header__actions > a, .page-header__actions > button { width: 100%; }
  .page-header__subtitle { font-size: 0.875rem; }
  .stats-grid { grid-template-columns: 1fr; gap: 1rem; }
  .stat-card--wide { grid-column: auto; }
  .stat-value, .stat-card--wide .stat-value { font-size: 1.75rem; }
  .stat-card:not(.stat-card--wide) .stat-value { font-size: 1.5rem; }
  .card { padding: 1rem; }
  .login-card { padding: 2rem 1.5rem; }
  .table-container { overflow: visible; background: transparent; border: none; box-shadow: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table tbody tr, .data-table tbody tr:nth-child(2n) { background: var(--bg-white); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); margin-bottom: 0.75rem; padding: 0.75rem 1rem; }
  .data-table tbody td { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; border: 0; padding: 0.35rem 0; text-align: right; }
  .data-table tbody td::before { content: attr(data-label); font-weight: 600; font-size: 0.75rem; color: var(--text-muted); text-align: left; flex: 0 0 auto; }
  .data-table tbody tr.sin-datos td::before { content: none; }
  .data-table tbody tr.sin-datos td { justify-content: center; }
  .table-footer { background: var(--bg-white); border: 1px solid var(--border); border-radius: 12px; justify-content: center; text-align: center; }
  .toast-container { left: 1rem; right: 1rem; bottom: 1rem; max-width: none; }
}
@media (width <= 480px) { h1 { font-size: 1.25rem; } .login-container { padding: 1rem; } .logo-icon { width: 72px; height: 72px; } .page { padding: 0.75rem; } }

/* Tres tarjetas secundarias (CNY, TRY, RUB) en una fila; una columna en móvil */
.stats-grid--3 { grid-template-columns: repeat(3, 1fr); }
@media (width <= 1024px) { .stats-grid--3 { grid-template-columns: repeat(3, 1fr); } }
@media (width <= 768px) { .stats-grid--3 { grid-template-columns: 1fr; } }
/* Tabla con muchas columnas (monedas elegidas): celdas más compactas para evitar scroll interno */
.data-table.densa thead th { padding: 1rem 0.75rem; }
.data-table.densa tbody td { padding: 1rem 0.75rem; }
@media (width <= 768px) { .data-table.densa tbody td { padding: 0.35rem 0; } }

/* Reporte de migración */
.veredicto { border-left: 4px solid var(--border); }
.veredicto--ok { border-left-color: #22c55e; } .veredicto--info { border-left-color: #3b82f6; }
.veredicto--error { border-left-color: #ef4444; } .veredicto--warn { border-left-color: #f59e0b; }
.veredicto__titulo { margin-bottom: 0.75rem; }
.veredicto__titulo .status-badge { font-size: 0.8125rem; padding: 0.45rem 0.9rem; }
.veredicto__texto { color: var(--text-secondary); font-size: 0.9375rem; }
.veredicto__motivos { margin: 0.75rem 0 0; padding-left: 1.2rem; color: var(--text-primary); font-size: 0.875rem; }
.veredicto__meta { margin-top: 0.75rem; font-size: 0.8125rem; color: var(--text-muted); }
.stats-grid + .section-header, .card + .stats-grid { margin-top: 1.5rem; }
.solo-movil { display: none; }
@media (width <= 768px) { .solo-movil { display: inline; } .data-table td[data-label="Análisis"] { text-align: right; } }
.status-pill.compacto { padding: 0.2rem 0.55rem; }
.data-table.densa thead th { white-space: normal; }
