@import url("./colors_and_type.css");

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body { background: var(--bg-app); color: var(--fg-1); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; box-shadow: 0 0 0 3px rgba(226,35,44,.25); border-color: var(--revin-red);
}
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-1); border-radius: 999px; border: 2px solid var(--bg-app); }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

/* =========================================================================
   View switcher (top-of-screen)
   ========================================================================= */
.view-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 36px; z-index: 100;
  background: var(--revin-black); color: #fff;
  display: flex; align-items: center; padding: 0 12px;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid var(--neutral-700);
}
.view-bar .vb-brand { display: flex; align-items: center; gap: 8px; padding-right: 16px; border-right: 1px solid var(--neutral-700); }
.view-bar .vb-brand img { height: 14px; }
.view-bar .vb-tag { font-size: 9px; color: var(--neutral-300); letter-spacing: .12em; }
.view-bar .vb-tabs { display: flex; align-items: center; gap: 0; height: 100%; margin-left: 16px; }
.view-bar .vb-tab { padding: 0 14px; height: 100%; display: inline-flex; align-items: center; gap: 8px; color: var(--neutral-300); cursor: pointer; border: none; background: transparent; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.view-bar .vb-tab:hover { color: #fff; background: var(--neutral-700); }
.view-bar .vb-tab.active { color: #fff; background: var(--neutral-700); box-shadow: inset 0 -2px 0 var(--revin-red); }
.view-bar .vb-spacer { flex: 1; }
.view-bar .vb-meta { color: var(--neutral-400); font-size: 10px; padding-right: 12px; }

/* Connection button (Supabase) */
.view-bar .vb-connection { display: flex; align-items: center; height: 100%; padding-right: 12px; border-left: 1px solid var(--neutral-700); }
.vb-conn-btn { background: transparent; border: none; color: var(--neutral-300); font: inherit; letter-spacing: inherit; text-transform: inherit; padding: 0 14px; height: 100%; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 10px; }
.vb-conn-btn:hover { color: #fff; background: var(--neutral-700); }
.vb-conn-btn b { font-weight: 700; color: #fff; margin-left: 2px; }
.vb-conn-btn.live { color: #fff; }
.vb-conn-btn.live b { color: #fff; }
.vb-conn-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--neutral-400); flex-shrink: 0; }
.vb-conn-dot.mock { background: var(--neutral-400); }
.vb-conn-dot.connecting { background: var(--warning); animation: pulse 1s ease-in-out infinite; }
.vb-conn-dot.live { background: var(--success); box-shadow: 0 0 0 2px rgba(31,157,85,.25); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.view-stage { position: fixed; inset: 36px 0 0 0; overflow: hidden; background: var(--bg-app); }

/* =========================================================================
   Desktop app shell (Comercial + Admin)
   ========================================================================= */
.app { display: grid; grid-template-columns: 240px 1fr; height: 100%; }
.main { display: grid; grid-template-rows: 56px minmax(0, 1fr); min-width: 0; min-height: 0; }
.content { padding: 24px 32px 40px; overflow: auto; min-height: 0; }

/* Sidebar */
.sb { background: var(--revin-black); color: #fff; display: flex; flex-direction: column; min-height: 0; }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid #252829; }
.sb-brand img { height: 18px; }
.sb-tag { font-size: 9px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--neutral-400); }
.sb-nav { display: flex; flex-direction: column; padding: 8px; gap: 1px; flex: 1; overflow: auto; min-height: 0; }
.sb-group { font-size: 9px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--neutral-400); padding: 14px 10px 6px; }
.sb-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 2px; color: var(--neutral-200); font-size: 13px; cursor: pointer; border-left: 2px solid transparent; user-select: none; position: relative; }
.sb-item:hover { background: #1F2326; color: #fff; }
.sb-item.active { background: #1F2326; color: #fff; border-left-color: var(--revin-red); padding-left: 8px; }
.sb-item .icon { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.75; fill: none; flex-shrink: 0; }
.sb-item .sb-badge { margin-left: auto; font-size: 10px; font-weight: 700; background: var(--revin-red); color: #fff; padding: 1px 6px; border-radius: 999px; letter-spacing: 0; }
.sb-foot { padding: 12px; border-top: 1px solid #252829; display: flex; align-items: center; gap: 10px; }
.sb-avatar { width: 28px; height: 28px; border-radius: 999px; background: var(--revin-red); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.sb-avatar.bw { background: var(--neutral-700); }
.sb-foot-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sb-foot-name { font-size: 12px; color: #fff; font-weight: 600; }
.sb-foot-role { font-size: 10px; color: var(--neutral-300); text-transform: uppercase; letter-spacing: .08em; }

/* Topbar */
.tb { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--border-1); background: var(--bg-surface); }
.tb-left { display: flex; align-items: center; gap: 16px; }
.tb-crumbs { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--fg-3); }
.tb-crumbs .sep { color: var(--border-2); }
.tb-crumbs .cur { color: var(--fg-1); font-weight: 600; }
.tb-right { display: flex; align-items: center; gap: 8px; }
.tb-search { display: flex; align-items: center; gap: 8px; background: var(--bg-inset); border: 1px solid var(--border-1); border-radius: 4px; padding: 6px 10px; width: 320px; cursor: pointer; }
.tb-search:hover { background: var(--bg-surface-2); }
.tb-search .ph { color: var(--fg-3); font-size: 13px; flex: 1; }
.tb-search .kbd { font-family: var(--font-mono); font-size: 10px; background: var(--bg-surface); border: 1px solid var(--border-1); padding: 1px 5px; border-radius: 2px; color: var(--fg-2); }
.tb-search .icon { width: 14px; height: 14px; stroke: var(--fg-3); stroke-width: 2; fill: none; }
.tb-icon-btn { background: transparent; border: 1px solid transparent; padding: 6px; border-radius: 4px; color: var(--fg-2); display: flex; align-items: center; position: relative; }
.tb-icon-btn:hover { background: var(--bg-inset); color: var(--fg-1); }
.tb-icon-btn .icon { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.75; fill: none; }
.tb-icon-btn .badge { position: absolute; top: 2px; right: 2px; min-width: 14px; height: 14px; padding: 0 4px; background: var(--revin-red); color: #fff; border-radius: 999px; font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center; line-height: 1; border: 1.5px solid var(--bg-surface); }
.tb-divider { width: 1px; height: 20px; background: var(--border-1); margin: 0 4px; }
.tb-user { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border: 1px solid var(--border-1); border-radius: 999px; cursor: pointer; }
.tb-user:hover { background: var(--bg-inset); }
.tb-user .ava { width: 24px; height: 24px; border-radius: 999px; background: var(--revin-black); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; }
.tb-user .name { font-size: 12px; font-weight: 600; color: var(--fg-1); }

/* Page header */
.page-h { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-h h1 { margin: 0; font-size: 28px; }
.page-h .sub { font-size: 13px; color: var(--fg-2); margin-top: 4px; }
.page-h .actions { display: flex; gap: 8px; }

/* Buttons */
.btn { font-family: var(--font-body); font-size: 13px; font-weight: 600; border: 1px solid transparent; border-radius: 4px; padding: 8px 14px; cursor: pointer; line-height: 1; letter-spacing: .01em; display: inline-flex; align-items: center; gap: 8px; transition: background 120ms, border-color 120ms; white-space: nowrap; }
.btn .icon { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; flex-shrink: 0; }
.btn.primary { background: var(--revin-red); color: #fff; border-color: var(--revin-red); }
.btn.primary:hover { background: var(--red-600); border-color: var(--red-600); }
.btn.primary:active { transform: translateY(0.5px); }
.btn.secondary { background: var(--bg-surface); color: var(--fg-1); border-color: var(--border-2); }
.btn.secondary:hover { background: var(--bg-inset); }
.btn.ghost { background: transparent; color: var(--fg-1); }
.btn.ghost:hover { background: var(--bg-inset); }
.btn.dark { background: var(--revin-black); color: #fff; border-color: var(--revin-black); }
.btn.dark:hover { background: var(--neutral-700); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.xs { padding: 4px 8px; font-size: 11px; }
.btn.icon-only { padding: 7px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Pills */
.pill { font-family: var(--font-body); font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; line-height: 1.2; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.pill.success { background: var(--success-bg); color: var(--success-fg); }
.pill.success .dot { background: var(--success); }
.pill.warning { background: var(--warning-bg); color: var(--warning-fg); }
.pill.warning .dot { background: var(--warning); }
.pill.info    { background: var(--info-bg);    color: var(--info-fg); }
.pill.info .dot { background: var(--info); }
.pill.danger  { background: var(--danger-bg);  color: var(--danger-fg); }
.pill.danger .dot { background: var(--danger); }
.pill.neutral { background: var(--bg-surface-2); color: var(--fg-2); }
.pill.neutral .dot { background: var(--fg-3); }
.pill.brand   { background: var(--revin-black); color: #fff; }
.pill.brand .dot { background: var(--revin-red); }
.pill.red     { background: var(--revin-red); color: #fff; }

/* Cards */
.card { background: var(--bg-surface); border: 1px solid var(--border-1); border-radius: 4px; }
.card.lg { border-radius: 8px; }
.card-h { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border-1); }
.card-h h3 { margin: 0; font-family: var(--font-body); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-2); }
.card-h .h-right { display: flex; align-items: center; gap: 6px; }
.card-b { padding: 16px; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--border-1); background: var(--bg-inset); border-radius: 0 0 4px 4px; }

/* Inputs */
.input, .select { font-family: var(--font-body); font-size: 13px; padding: 7px 10px; background: var(--bg-surface); border: 1px solid var(--border-2); border-radius: 4px; color: var(--fg-1); outline: none; width: 100%; }
.input:focus, .select:focus { border-color: var(--revin-red); box-shadow: 0 0 0 3px rgba(226,35,44,.25); }
.input::placeholder { color: var(--fg-3); }
textarea.input { resize: vertical; min-height: 64px; font-family: inherit; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-lbl { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-2); }
.field-hint { font-size: 11px; color: var(--fg-3); }

/* Filter chips bar */
.fbar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.fchip { font-family: var(--font-body); font-size: 12px; padding: 6px 11px; background: var(--bg-surface); border: 1px solid var(--border-1); border-radius: 4px; color: var(--fg-1); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; font-weight: 500; }
.fchip:hover { background: var(--bg-inset); }
.fchip.active { background: var(--revin-black); color: #fff; border-color: var(--revin-black); }
.fchip .icon { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; fill: none; }
.fbar-right { margin-left: auto; display: flex; gap: 8px; }

/* Tables */
.tbl-wrap { background: var(--bg-surface); border: 1px solid var(--border-1); border-radius: 4px; overflow: hidden; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-2); background: var(--bg-inset); padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-1); white-space: nowrap; }
.tbl tbody td { font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--border-3); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { cursor: pointer; transition: background 100ms; }
.tbl tbody tr:hover td { background: var(--bg-inset); }
.tbl tbody tr.selected td { background: var(--red-50); }
.tbl tbody tr.selected td:first-child { box-shadow: inset 2px 0 0 var(--revin-red); }
.tbl tbody tr.cooling td:first-child { box-shadow: inset 2px 0 0 var(--warning); }
.tbl tbody tr.cooling td { background: linear-gradient(to right, rgba(217,119,6,.04), transparent 40%); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .code { font-family: var(--font-mono); font-size: 11px; color: var(--fg-2); letter-spacing: .02em; text-transform: uppercase; }

/* View tabs (segmented) */
.view-tabs { display: inline-flex; background: var(--bg-inset); border: 1px solid var(--border-1); border-radius: 4px; padding: 2px; gap: 2px; }
.view-tabs button { font-family: var(--font-body); font-size: 11px; font-weight: 600; padding: 5px 10px; border: none; background: transparent; color: var(--fg-2); border-radius: 2px; cursor: pointer; text-transform: uppercase; letter-spacing: .04em; display: inline-flex; align-items: center; gap: 6px; }
.view-tabs button .icon { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; fill: none; }
.view-tabs button:hover { color: var(--fg-1); }
.view-tabs button.active { background: var(--revin-black); color: #fff; }

/* Eyebrow / overline */
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-2); }
.eyebrow.red { color: var(--revin-red); }

/* Mono doc code */
.doc-code { font-family: var(--font-mono); font-size: 11px; letter-spacing: .03em; text-transform: uppercase; color: var(--fg-1); background: var(--bg-inset); border: 1px solid var(--border-1); padding: 2px 6px; border-radius: 2px; display: inline-block; }

/* Empty state helper */
.empty { text-align: center; padding: 40px 20px; color: var(--fg-3); font-size: 13px; }
.empty .icon-wrap { width: 48px; height: 48px; border: 1px solid var(--border-1); border-radius: 4px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; color: var(--fg-3); }

/* ---------------------------------------------------------------------------
   MARCAS DE DATOS NO REALES (B0)
   Los componentes viven en UI.jsx; el criterio, en window.RevinMock (data.js).
   .demo-banner estaba inyectado en runtime desde Contabilidad.jsx: ahora que lo
   montan tres modulos y hay una segunda marca, su sitio es una hoja de estilos.
   Tonos AMBAR (--warning), no el rojo de marca: esto no es un fallo, es un aviso
   de que el dato no es real. El rojo vivo queda para lo que de verdad falla.
--------------------------------------------------------------------------- */
.demo-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 16px;
  background: var(--warning-bg); color: var(--warning-fg); border: 1px solid var(--warning);
  border-radius: 4px; font-size: 12.5px; font-weight: 500; }
.demo-banner .icon { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; flex-shrink: 0; }
.demo-banner b { font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }

/* Marca de BLOQUE: banda pegada al contenido que califica, nunca un badge suelto
   en una cabecera (ahi se lee como etiqueta de categoria). */
.demo-mark { display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  background: var(--warning-bg); color: var(--warning-fg);
  border-left: 3px solid var(--warning); font-size: 11.5px; line-height: 1.35; }
.demo-mark-tag { font-size: 9.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid currentColor; border-radius: 2px; padding: 1px 5px; flex-shrink: 0; }
