/* ==========================================================================
   FikaOne · tema "C" (modo oscuro de trabajo)
   Se carga DESPUÉS de core-dark.css y theme-default-dark.css.
   ========================================================================== */
:root {
  --fx-bg: #0E1116;
  --fx-rail: #0A0C10;
  --fx-surface: #161A21;
  --fx-surface-2: #12151B;
  --fx-raise: #1E232C;
  --fx-border: #262B35;
  --fx-border-soft: #1E232C;
  --fx-text: #E8EAEE;
  --fx-muted: #9AA1AE;
  --fx-faint: #5E6573;
  --fx-accent: #FF6B6B;
  --fx-accent-hover: #FF8A8A;
  --fx-accent-ink: #0E1116;
  --fx-green: #4ADE80;
  --fx-green-bg: #13301F;
  --fx-red-bg: #3A1A1D;
  --fx-blue: #9DB7F5;
  --fx-blue-bg: #1D2A44;
  --fx-sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --fx-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --fx-radius: 10px;
  --fx-border-strong: #343A46;
  --fx-raise-2: #2C323D;
  --fx-text-2: #C4C9D2;
  --fx-danger-border: #5A2A2E;
  --fx-chart-prev: #4A5160;
  --fx-chart-bar: #3A4150;
  --fx-row-hover: #191E26;
  --fx-row-stripe: #151920;
  --fx-cell-focus: #1A1F28;
  --fx-sheet-hover: #171B22;
  --fx-bar-muted: #7C8594;
  --fx-backdrop: rgba(5, 7, 10, .6);
  --fx-accent-ring: rgba(255, 107, 107, .18);
  --fx-shadow-color: rgba(0, 0, 0, .45);
  --fx-c1: #FF6B6B; --fx-c2: #9DB7F5; --fx-c3: #4ADE80; --fx-c4: #F5C26B; --fx-c5: #C49DF5; --fx-c6: #7C8594;
  color-scheme: dark;
}

/* ---------- Tema claro (mismo diseño, mismos componentes) ---------------- */
html[data-fx-theme="light"] {
  --fx-bg: #F5F6F8;
  --fx-rail: #FFFFFF;
  --fx-surface: #FFFFFF;
  --fx-surface-2: #F8F9FB;
  --fx-raise: #F1F3F6;
  --fx-raise-2: #E7EAEF;
  --fx-border: #E2E5EA;
  --fx-border-soft: #EDEFF2;
  --fx-border-strong: #D3D8DF;
  --fx-text: #16181D;
  --fx-text-2: #3C414B;
  --fx-muted: #5B6270;
  --fx-faint: #8A919E;
  --fx-accent: #D93F42;
  --fx-accent-hover: #BE3236;
  --fx-accent-ink: #FFFFFF;
  --fx-accent-ring: rgba(217, 63, 66, .18);
  --fx-green: #1E7B3E;
  --fx-green-bg: #E3F4E8;
  --fx-red-bg: #FDECEC;
  --fx-danger-border: #F3C4C6;
  --fx-blue: #2A4A9A;
  --fx-blue-bg: #E8EEFB;
  --fx-chart-prev: #B9BFC8;
  --fx-chart-bar: #C9CED6;
  --fx-row-hover: #F5F7FA;
  --fx-row-stripe: #FAFBFC;
  --fx-cell-focus: #FFFFFF;
  --fx-sheet-hover: #FAFBFC;
  --fx-bar-muted: #9AA1AE;
  --fx-backdrop: rgba(16, 24, 40, .35);
  --fx-shadow-color: rgba(16, 24, 40, .14);
  --fx-c1: #D93F42; --fx-c2: #3E63C8; --fx-c3: #2E9455; --fx-c4: #C98A1A; --fx-c5: #8152C9; --fx-c6: #6B7280;
  color-scheme: light;
}


html, body { background: var(--fx-bg) !important; }
body { color: var(--fx-text); font-family: var(--fx-sans); font-size: 14px; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--fx-text); font-family: var(--fx-sans); }
a { color: var(--fx-text); }
a:hover { color: var(--fx-accent-hover); }
.text-muted, small, .small { color: var(--fx-muted) !important; }
hr { border-color: var(--fx-border); opacity: 1; }
.fx-mono, .fx-num { font-family: var(--fx-mono); font-variant-numeric: tabular-nums; }
kbd, .fx-kbd {
  font-family: var(--fx-mono); font-size: 11px; line-height: 1; color: var(--fx-muted);
  background: transparent; border: 1px solid var(--fx-border-strong); border-radius: 4px; padding: 2px 5px; box-shadow: none;
}

/* ---------- Layout --------------------------------------------------------- */
.fx-app { display: flex; min-height: 100vh; }
.fx-rail {
  position: sticky; top: 0; height: 100vh; flex: 0 0 72px; z-index: 1030;
  background: var(--fx-rail); border-right: 1px solid var(--fx-border);
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 0; box-sizing: border-box;
}
.fx-logo {
  width: 40px; height: 40px; border-radius: 10px; background: var(--fx-accent); color: var(--fx-accent-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; margin-bottom: 14px; text-decoration: none;
}
.fx-logo:hover { color: var(--fx-accent-ink); }
.fx-rail-link {
  position: relative; width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: var(--fx-muted);
}
.fx-rail-link i { font-size: 21px; }
.fx-rail-link:hover { background: var(--fx-raise); color: var(--fx-text); }
.fx-rail-link.is-active { background: var(--fx-raise); color: var(--fx-accent); }
.fx-rail-link .fx-tip {
  position: absolute; left: 54px; top: 50%; transform: translateY(-50%); white-space: nowrap; pointer-events: none;
  background: var(--fx-raise); color: var(--fx-text); border: 1px solid var(--fx-border); border-radius: 6px;
  padding: 4px 8px; font-size: 12px; opacity: 0; transition: opacity .12s;
}
.fx-rail-link:hover .fx-tip, .fx-rail-link:focus-visible .fx-tip { opacity: 1; }
.fx-rail-bottom { margin-top: auto; }
.fx-avatar {
  width: 36px; height: 36px; border-radius: 18px; background: var(--fx-border); color: var(--fx-text); border: 0;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; text-transform: uppercase;
}
.fx-shell { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.fx-topbar {
  position: sticky; top: 0; z-index: 1020; background: var(--fx-bg);
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--fx-border);
}
.fx-topbar-title { margin: 0 auto 0 0; font-size: 16px; font-weight: 600; }
.fx-search {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; width: 420px; max-width: 100%; box-sizing: border-box;
  border: 1px solid var(--fx-border); border-radius: 8px; background: var(--fx-surface); color: var(--fx-muted); cursor: text;
}
.fx-search span { flex: 1; text-align: left; }
.fx-content { padding: 24px 28px 40px; flex: 1; }
.fx-footer { padding: 14px 28px; border-top: 1px solid var(--fx-border); color: var(--fx-faint); font-size: 12px; }

@media (max-width: 767.98px) {
  .fx-app { flex-direction: column; }
  .fx-rail { position: sticky; height: auto; flex: none; flex-direction: row; padding: 8px 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--fx-border); }
  .fx-logo { margin: 0 8px 0 0; }
  .fx-rail-bottom { margin: 0 0 0 auto; }
  .fx-rail-link .fx-tip { display: none; }
  .fx-topbar { position: static; padding: 12px 16px; }
  .fx-search { width: 100%; }
  .fx-content { padding: 16px; }
}

/* ---------- Componentes propios ------------------------------------------ */
.fx-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--fx-border); background: transparent; color: var(--fx-text); font: inherit; font-size: 13px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.fx-btn:hover { background: var(--fx-raise); color: var(--fx-text); }
.fx-btn i { font-size: 16px; }
.fx-btn-primary { background: var(--fx-accent); border-color: var(--fx-accent); color: var(--fx-accent-ink); font-weight: 600; }
.fx-btn-primary:hover { background: var(--fx-accent-hover); border-color: var(--fx-accent-hover); color: var(--fx-accent-ink); }
.fx-btn-ghost-accent { border-color: var(--fx-accent); color: var(--fx-accent-hover); }
.fx-btn-icon { width: 32px; padding: 0; justify-content: center; }
.fx-btn-danger:hover { background: var(--fx-red-bg); border-color: var(--fx-danger-border); color: var(--fx-accent-hover); }

.fx-panel { background: var(--fx-surface); border: 1px solid var(--fx-border); border-radius: var(--fx-radius); }
.fx-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--fx-border); }
.fx-panel-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.fx-panel-sub { font-size: 12px; color: var(--fx-muted); }
.fx-panel-body { padding: 14px 18px; }

.fx-pill { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.fx-pill-ok { background: var(--fx-green-bg); color: var(--fx-green); }
.fx-pill-ko { background: var(--fx-red-bg); color: var(--fx-accent-hover); }
.fx-pill-info { background: var(--fx-blue-bg); color: var(--fx-blue); }

.fx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 1px solid var(--fx-border); border-radius: var(--fx-radius); background: var(--fx-surface); overflow: hidden; }
.fx-kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--fx-border); margin-right: -1px; }
.fx-kpi-label { font-size: 12px; color: var(--fx-muted); }
.fx-kpi-value { font-family: var(--fx-mono); font-size: 22px; font-weight: 500; color: var(--fx-text); }
.fx-kpi-note { font-size: 12px; color: var(--fx-muted); }
.fx-up { color: var(--fx-green) !important; }
.fx-down { color: var(--fx-accent-hover) !important; }

.fx-grid-2 { display: flex; flex-wrap: wrap; gap: 20px; }
.fx-grid-2 > .fx-col-wide { flex: 3 1 520px; min-width: 0; }
.fx-grid-2 > .fx-col-narrow { flex: 2 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

.fx-table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--fx-text); }
.fx-table th { padding: 8px 12px; font-size: 12px; font-weight: 500; color: var(--fx-muted); text-align: left; background: var(--fx-surface-2); border-bottom: 1px solid var(--fx-border); white-space: nowrap; }
.fx-table td { padding: 10px 12px; border-bottom: 1px solid var(--fx-border-soft); vertical-align: middle; }
.fx-table tr:hover td { background: var(--fx-row-hover); }
.fx-table .r { text-align: right; }
.fx-table tfoot td { background: var(--fx-surface-2); font-family: var(--fx-mono); font-weight: 500; border-bottom: 0; }
.fx-table th:first-child, .fx-table td:first-child { padding-left: 18px; }
.fx-table th:last-child, .fx-table td:last-child { padding-right: 18px; }
.fx-scroll { overflow-x: auto; }

.fx-bar-track { height: 6px; border-radius: 3px; background: var(--fx-border); }
.fx-bar { height: 6px; border-radius: 3px; background: var(--fx-bar-muted); }
.fx-bar.is-hot { background: var(--fx-accent); }

.fx-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--fx-border); }
.fx-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--fx-muted); min-width: 120px; }
.fx-field .form-control, .fx-field .form-select { height: 36px; font-size: 13px; }

/* ---------- Editor de líneas (tipo hoja de cálculo) ---------------------- */
.fx-docbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: -24px -28px 0; padding: 12px 28px; border-bottom: 1px solid var(--fx-border); background: var(--fx-bg); }
.fx-docbar h1 { margin: 0; font-family: var(--fx-mono); font-size: 16px; font-weight: 500; }
.fx-crumb { color: var(--fx-muted); }
.fx-crumb-sep { color: var(--fx-chart-prev); }
.fx-docbar-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fx-client { display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 12px 0 0; font-size: 13px; color: var(--fx-muted); }
.fx-client strong { color: var(--fx-text); font-weight: 500; }
.fx-meta { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 16px 0; }
.fx-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--fx-border); background: var(--fx-surface-2); }
.fx-toolbar .fx-count { margin-right: auto; font-size: 13px; color: var(--fx-muted); }

.fx-sheet { width: 100%; min-width: 820px; border-collapse: collapse; font-size: 13px; }
.fx-sheet thead th { position: sticky; top: 0; padding: 8px 10px; font-size: 12px; font-weight: 500; color: var(--fx-muted); background: var(--fx-surface-2); border: 1px solid var(--fx-border); border-top: 0; text-align: left; white-space: nowrap; }
.fx-sheet thead th.r { text-align: right; }
.fx-sheet tbody td { padding: 0; border: 1px solid var(--fx-border-soft); vertical-align: top; }
.fx-sheet tbody tr:hover td { background: var(--fx-sheet-hover); }
.fx-sheet th:first-child, .fx-sheet td:first-child { border-left: 0; }
.fx-sheet th:last-child, .fx-sheet td:last-child { border-right: 0; }
.fx-sheet .fx-rownum { width: 44px; text-align: center; color: var(--fx-faint); font-family: var(--fx-mono); padding: 9px 0; cursor: grab; user-select: none; }
.fx-sheet .fx-rownum .fa-arrows { display: none; }
.fx-sheet tr:hover .fx-rownum .fx-n { display: none; }
.fx-sheet tr:hover .fx-rownum .fa-arrows { display: inline-block; color: var(--fx-muted); }
.fx-sheet .fx-cell {
  width: 100%; height: 36px; box-sizing: border-box; border: 0; border-radius: 0; background: transparent; color: var(--fx-text);
  padding: 0 10px; font: inherit; font-family: var(--fx-mono); font-size: 13px; outline: none; box-shadow: none;
}
.fx-sheet .fx-cell.is-text { font-family: var(--fx-sans); }
.fx-sheet .fx-cell.r { text-align: right; }
.fx-sheet .fx-cell[readonly] { color: var(--fx-muted); }
.fx-sheet .fx-cell.is-total { color: var(--fx-text); }
.fx-sheet .fx-cell:focus { background: var(--fx-cell-focus); box-shadow: inset 0 0 0 2px var(--fx-accent); }
.fx-sheet .fx-del { width: 40px; text-align: center; }
.fx-sheet .fx-del button { width: 28px; height: 28px; margin-top: 4px; border: 0; border-radius: 6px; background: transparent; color: var(--fx-faint); cursor: pointer; }
.fx-sheet .fx-del button:hover { background: var(--fx-red-bg); color: var(--fx-accent-hover); }
.fx-sheet .ui-sortable-helper td { background: var(--fx-raise); }
.fx-empty { padding: 28px; text-align: center; color: var(--fx-muted); }

.fx-totals { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--fx-border); background: var(--fx-surface-2); border-radius: 0 0 var(--fx-radius) var(--fx-radius); }
.fx-totals .fx-hint { margin-right: auto; font-size: 12px; color: var(--fx-muted); }
.fx-totals span.lbl { color: var(--fx-muted); }
.fx-totals span.val { font-family: var(--fx-mono); color: var(--fx-text); margin-left: 6px; }
.fx-totals span.val.big { color: var(--fx-accent); font-size: 20px; font-weight: 500; }

/* ---------- Paleta de comandos (⌘K) -------------------------------------- */
.fx-palette-backdrop { position: fixed; inset: 0; background: var(--fx-backdrop); z-index: 2000; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.fx-palette-backdrop.is-open { display: flex; }
.fx-palette { width: 560px; max-width: calc(100vw - 32px); background: var(--fx-raise); border: 1px solid var(--fx-border-strong); border-radius: 12px; box-shadow: 0 24px 48px var(--fx-shadow-color); overflow: hidden; }
.fx-palette input { width: 100%; height: 52px; box-sizing: border-box; border: 0; border-bottom: 1px solid var(--fx-raise-2); background: transparent; color: var(--fx-text); font: inherit; font-size: 15px; padding: 0 18px; outline: none; }
.fx-palette ul { list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow-y: auto; }
.fx-palette li a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: var(--fx-text); text-decoration: none; }
.fx-palette li a i { font-size: 18px; color: var(--fx-muted); }
.fx-palette li a .fx-group { margin-left: auto; font-size: 12px; color: var(--fx-muted); }
.fx-palette li.is-active a { background: var(--fx-raise-2); }
.fx-palette-foot { padding: 8px 14px; font-size: 11px; color: var(--fx-muted); border-top: 1px solid var(--fx-raise-2); }

/* ---------- Bootstrap / Sneat (afecta a todas las pantallas) ------------- */
.card { background: var(--fx-surface) !important; border: 1px solid var(--fx-border) !important; border-radius: var(--fx-radius) !important; box-shadow: none !important; color: var(--fx-text); }
.card-header, .card-footer { background: transparent !important; border-color: var(--fx-border) !important; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--fx-text); --bs-table-hover-bg: var(--fx-row-hover); --bs-table-striped-bg: var(--fx-row-stripe); color: var(--fx-text); border-color: var(--fx-border-soft) !important; }
.table > :not(caption) > * > * { border-bottom-color: var(--fx-border-soft) !important; background-color: transparent; color: var(--fx-text); }
.table thead th, .table th { color: var(--fx-muted) !important; font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; background: var(--fx-surface-2) !important; }
.table.border-top { border-top-color: var(--fx-border) !important; }
.form-control, .form-select, .input-group-text, textarea {
  background-color: var(--fx-surface) !important; border-color: var(--fx-border) !important; color: var(--fx-text) !important; border-radius: 8px;
}
.form-control::placeholder { color: var(--fx-faint) !important; }
.form-control:focus, .form-select:focus { border-color: var(--fx-accent) !important; box-shadow: 0 0 0 3px var(--fx-accent-ring) !important; }
.form-control[readonly] { color: var(--fx-muted) !important; }
.form-label, label { color: var(--fx-muted); }
.btn-primary { background: var(--fx-accent) !important; border-color: var(--fx-accent) !important; color: var(--fx-accent-ink) !important; box-shadow: none !important; font-weight: 600; }
.btn-primary:hover { background: var(--fx-accent-hover) !important; border-color: var(--fx-accent-hover) !important; }
.btn-dark, .btn-secondary, .btn-light, .btn-light-secondary { background: var(--fx-raise) !important; border: 1px solid var(--fx-border) !important; color: var(--fx-text) !important; box-shadow: none !important; }
.btn-dark:hover, .btn-secondary:hover, .btn-light:hover { background: var(--fx-border) !important; }
.btn-outline-secondary { border-color: var(--fx-border) !important; color: var(--fx-text) !important; }
.btn-outline-secondary:hover { background: var(--fx-raise) !important; }
.btn-danger { background: var(--fx-red-bg) !important; border-color: var(--fx-danger-border) !important; color: var(--fx-accent-hover) !important; box-shadow: none !important; }
.dropdown-menu { background: var(--fx-raise) !important; border: 1px solid var(--fx-border-strong) !important; box-shadow: 0 12px 24px var(--fx-shadow-color) !important; }
.dropdown-item { color: var(--fx-text) !important; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--fx-raise-2) !important; }
.dropdown-divider { border-color: var(--fx-raise-2) !important; }
.modal-content { background: var(--fx-surface) !important; border: 1px solid var(--fx-border) !important; color: var(--fx-text); }
.modal-header, .modal-footer { border-color: var(--fx-border) !important; }
.modal-backdrop.show { opacity: .6; }
html:not([data-fx-theme="light"]) .btn-close { filter: invert(1) grayscale(1); }
.nav-tabs .nav-link { color: var(--fx-muted) !important; }
.nav-tabs .nav-link.active { background: var(--fx-surface) !important; color: var(--fx-text) !important; border-color: var(--fx-border) !important; }
.badge.bg-label-danger { background: var(--fx-red-bg) !important; color: var(--fx-accent-hover) !important; }
.badge.bg-label-success { background: var(--fx-green-bg) !important; color: var(--fx-green) !important; }
.swal2-popup { background: var(--fx-raise) !important; color: var(--fx-text) !important; border: 1px solid var(--fx-border-strong); }
.swal2-title, .swal2-html-container { color: var(--fx-text) !important; }
.swal2-footer { border-color: var(--fx-raise-2) !important; }
.swal2-footer a { color: var(--fx-accent-hover); font-family: var(--fx-mono); }
.swal2-styled.swal2-confirm { background: var(--fx-accent) !important; color: var(--fx-accent-ink) !important; }
.swal2-styled.swal2-cancel { background: var(--fx-raise-2) !important; color: var(--fx-text) !important; }
.container-p-y > .row, .fx-content > .row { --bs-gutter-x: 20px; }

/* ---------- Gráfico apilado por empresa + tooltip ------------------------- */
.fx-stack-chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; }
.fx-stack-col { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; outline: none; cursor: default; }
.fx-stack-top { font-size: 11px; color: var(--fx-muted); }
.fx-stack-year { font-size: 11px; color: var(--fx-muted); }
.fx-stack-bar { width: 100%; max-width: 36px; display: flex; flex-direction: column-reverse; gap: 2px; border-radius: 3px; overflow: hidden; transition: filter .12s; }
.fx-stack-seg { min-height: 2px; }
.fx-stack-col:hover .fx-stack-bar, .fx-stack-col:focus-visible .fx-stack-bar { filter: brightness(1.15); box-shadow: 0 0 0 2px var(--fx-surface), 0 0 0 3px var(--fx-muted); }
.fx-stack-chart:hover .fx-stack-col:not(:hover) .fx-stack-bar { opacity: .55; }
.fx-tooltip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translate(-50%, 4px); z-index: 20;
  min-width: 220px; padding: 10px 12px; border-radius: 8px; pointer-events: none;
  background: var(--fx-raise); border: 1px solid var(--fx-border-strong); box-shadow: 0 12px 24px var(--fx-shadow-color);
  font-size: 12px; opacity: 0; visibility: hidden; transition: opacity .12s, transform .12s;
}
.fx-stack-col:nth-last-child(-n+2) .fx-tooltip { left: auto; right: 0; transform: translate(0, 4px); }
.fx-stack-col:nth-child(-n+2) .fx-tooltip { left: 0; transform: translate(0, 4px); }
.fx-stack-col:hover .fx-tooltip, .fx-stack-col:focus-visible .fx-tooltip { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.fx-stack-col:nth-last-child(-n+2):hover .fx-tooltip, .fx-stack-col:nth-last-child(-n+2):focus-visible .fx-tooltip,
.fx-stack-col:nth-child(-n+2):hover .fx-tooltip, .fx-stack-col:nth-child(-n+2):focus-visible .fx-tooltip { transform: translate(0, 0); }
.fx-tooltip-title { font-weight: 600; margin-bottom: 6px; color: var(--fx-text); }
.fx-tooltip-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; color: var(--fx-text); white-space: nowrap; }
.fx-tooltip-name { flex: 1; color: var(--fx-text-2); }
.fx-tooltip-total { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--fx-border-strong); font-weight: 600; }
.fx-tooltip-total .fx-tooltip-name { color: var(--fx-text); }
.fx-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; flex: none; }
.fx-tooltip-row .fx-dot { margin-right: 0; }
.fx-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: 12px; color: var(--fx-muted); }

/* ---------- Gráfico mensual (año actual vs anterior) ---------------------- */
.fx-month-chart { gap: 4px; height: 150px; }
.fx-pair { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 100%; transition: filter .12s, opacity .12s; }
.fx-pair-bar { flex: 1; max-width: 12px; border-radius: 2px 2px 0 0; }
.fx-pair-bar.is-prev { background: var(--fx-chart-prev); }
.fx-pair-bar.is-cur { background: var(--fx-accent); }
.fx-pair-bar.is-future { background: var(--fx-border); }
.fx-month-chart .is-current .fx-stack-year { color: var(--fx-text); font-weight: 600; }
.fx-month-chart:hover .fx-stack-col:not(:hover) .fx-pair { opacity: .5; }
.fx-month-chart .fx-stack-col:hover .fx-pair, .fx-month-chart .fx-stack-col:focus-visible .fx-pair { filter: brightness(1.2); }
.fx-month-chart .fx-stack-col:nth-last-child(-n+3) .fx-tooltip { left: auto; right: 0; transform: translate(0, 4px); }
.fx-month-chart .fx-stack-col:nth-child(-n+3) .fx-tooltip { left: 0; transform: translate(0, 4px); }
.fx-month-chart .fx-stack-col:nth-last-child(-n+3):hover .fx-tooltip, .fx-month-chart .fx-stack-col:nth-last-child(-n+3):focus-visible .fx-tooltip,
.fx-month-chart .fx-stack-col:nth-child(-n+3):hover .fx-tooltip, .fx-month-chart .fx-stack-col:nth-child(-n+3):focus-visible .fx-tooltip { transform: translate(0, 0); }

.dropdown-item.fx-danger-item { color: var(--fx-accent-hover) !important; }
.dropdown-item.fx-danger-item:hover { background: var(--fx-red-bg) !important; }

/* ---------- Login (propuesta 3: foto actual + tarjeta oscura) ------------- */
.fx-login { position: relative; min-height: 100vh; background-color: var(--fx-bg); background-size: cover; background-position: center; color: var(--fx-text); font-family: var(--fx-sans); font-size: 14px; }
.fx-login-shade { position: absolute; inset: 0; background: rgba(10, 12, 16, .72); }
.fx-login-inner { position: relative; min-height: 100vh; max-width: 1280px; margin: 0 auto; padding: 48px 56px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.fx-login-brand { display: flex; align-items: center; gap: 12px; color: var(--fx-text); text-decoration: none; }
.fx-login-brand:hover { color: var(--fx-text); }
.fx-login-brand .fx-logo { margin: 0; }
.fx-login-brand-name { font-size: 16px; font-weight: 600; }
.fx-login-brand-org { color: var(--fx-text-2); font-size: 13px; }
.fx-login-main { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 40px; }
.fx-login-card {
  width: 400px; max-width: 100%; box-sizing: border-box; padding: 32px; border-radius: 14px;
  background: rgba(22, 26, 33, .92); border: 1px solid var(--fx-border-strong); box-shadow: 0 24px 48px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column; gap: 18px;
}
.fx-login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 600; color: var(--fx-text); }
.fx-login-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--fx-muted); margin: 0; }
.fx-login-field input {
  height: 44px; box-sizing: border-box; border: 1px solid var(--fx-border-strong); border-radius: 8px; background: var(--fx-bg);
  color: var(--fx-text); font: inherit; font-size: 14px; padding: 0 12px; outline: none;
}
.fx-login-field input:focus { border-color: var(--fx-accent); box-shadow: 0 0 0 3px var(--fx-accent-ring); }
.fx-login-check { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--fx-text-2); margin: 0; cursor: pointer; }
.fx-login-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--fx-accent); }
.fx-login-submit {
  height: 46px; border: 0; border-radius: 8px; background: var(--fx-accent); color: var(--fx-accent-ink);
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.fx-login-submit:hover { background: var(--fx-accent-hover); }
.fx-login-submit:focus-visible { outline: 2px solid var(--fx-text); outline-offset: 2px; }
.fx-login-error { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--fx-red-bg); color: var(--fx-accent-hover); font-size: 13px; }
.fx-login-error-icon { flex: none; width: 18px; height: 18px; border-radius: 9px; border: 1.5px solid currentColor; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: 11px; font-weight: 600; }
.fx-login-info { padding: 10px 12px; border-radius: 8px; background: var(--fx-raise); font-size: 13px; color: var(--fx-text-2); }
.fx-login-info a { color: var(--fx-accent-hover); }
.fx-login-claim { max-width: 420px; margin-left: auto; display: flex; flex-direction: column; gap: 14px; text-align: right; }
.fx-login-keys { font-family: var(--fx-mono); font-size: 13px; color: var(--fx-accent-hover); }
.fx-login-headline { font-size: 34px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; }
.fx-login-foot { color: var(--fx-text-2); font-size: 12px; }

@media (max-width: 767.98px) {
  .fx-login-inner { padding: 24px 20px; }
  .fx-login-brand-org { display: none; }
  .fx-login-claim { display: none; }
  .fx-login-main { justify-content: center; }
}

/* ---------- Selector de tema --------------------------------------------- */
.fx-theme-switch { display: flex; gap: 4px; padding: 3px; border-radius: 8px; background: var(--fx-bg); border: 1px solid var(--fx-border); }
.fx-theme-switch button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 10px;
  border: 0; border-radius: 6px; background: transparent; color: var(--fx-muted); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.fx-theme-switch button[aria-checked="true"] { background: var(--fx-surface); color: var(--fx-text); box-shadow: 0 1px 2px var(--fx-shadow-color); }
.fx-theme-switch button:focus-visible { outline: 2px solid var(--fx-accent); outline-offset: 1px; }
html.fx-theme-switching, html.fx-theme-switching * { transition: none !important; }

/* ---------- Spinner "Destello" (logo FIKA) ------------------------------- */
.fx-spinner { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--fx-accent); }
.fx-spinner-svg { display: block; overflow: visible; width: 48px; height: 48px; }
.fx-spinner-sm .fx-spinner-svg { width: 24px; height: 24px; }
.fx-spinner-lg .fx-spinner-svg { width: 96px; height: 96px; }
.fx-spinner-svg line, .fx-spinner-svg .r circle { stroke-width: 3; }
.fx-spinner-sm .fx-spinner-svg line, .fx-spinner-sm .fx-spinner-svg .r circle { stroke-width: 5; }
.fx-spinner-lg .fx-spinner-svg line, .fx-spinner-lg .fx-spinner-svg .r circle { stroke-width: 1.8; }
.fx-spinner-label { font-size: 13px; color: var(--fx-muted); }
.fx-spinner-svg .r line { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: fxDraw 1.8s cubic-bezier(.6, 0, .3, 1) infinite; animation-delay: calc(var(--i) * 60ms); }
.fx-spinner-svg .r circle { transform-box: fill-box; transform-origin: center; opacity: 0; animation: fxNode 1.8s ease-out infinite; animation-delay: calc(var(--i) * 60ms); }
.fx-spinner-svg .core { animation: fxCore 1.8s ease-in-out infinite; }
@keyframes fxDraw { 0% { stroke-dashoffset: 1; } 38%, 62% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -1; } }
@keyframes fxNode { 0%, 22% { opacity: 0; transform: scale(.2); } 38%, 62% { opacity: 1; transform: scale(1); } 86%, 100% { opacity: 0; transform: scale(.2); } }
@keyframes fxCore { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .fx-spinner-svg .r line, .fx-spinner-svg .r circle, .fx-spinner-svg .core { animation-duration: 4s; }
}
/* Bloque de carga que ocupa el hueco del contenido mientras llega */
.fx-loading { display: flex; align-items: center; justify-content: center; min-height: 220px; padding: 24px; }
/* Capa sobre contenido ya visible (al recargar líneas o resultados) */
.fx-loading-host { position: relative; }
.fx-loading-host > .fx-loading-veil {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: flex-start; justify-content: center; padding-top: 56px;
  background: color-mix(in srgb, var(--fx-surface) 72%, transparent); border-radius: inherit;
  opacity: 0; animation: fxVeilIn .15s ease-out .15s forwards;
}
@keyframes fxVeilIn { to { opacity: 1; } }
.fx-loading-veil > .fx-spinner { position: sticky; top: 140px; }
/* Destello a pantalla completa para acciones largas (PDF, clonar, convertir) */
.fx-overlay {
  position: fixed; inset: 0; z-index: 2100; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--fx-bg) 78%, transparent); backdrop-filter: blur(2px);
  opacity: 0; animation: fxVeilIn .15s ease-out .1s forwards;
}
.fx-overlay .fx-spinner-label { font-size: 15px; color: var(--fx-text); }

/* ---------- Modo soporte (fabricante dentro de otra cuenta) -------------- */
.fx-soporte {
  position: sticky; top: 0; z-index: 1025; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 28px; background: var(--fx-accent); color: var(--fx-accent-ink); font-size: 13px;
}
.fx-soporte i { font-size: 18px; }
.fx-soporte strong { font-weight: 600; }
.fx-soporte-salir {
  margin-left: auto; padding: 6px 12px; border-radius: 6px; background: var(--fx-accent-ink); color: var(--fx-accent) !important;
  font-weight: 600; text-decoration: none; white-space: nowrap;
}
.fx-soporte-salir:hover { opacity: .9; }
.fx-soporte ~ .fx-topbar { top: 40px; }
@media (max-width: 767.98px) { .fx-soporte { padding: 10px 16px; } .fx-soporte ~ .fx-topbar { top: 0; } }

/* Login: logo de FIKA Capital Investments (versión para fondo oscuro) + nombre del producto */
.fx-login-logo { display: block; height: 72px; width: auto; }
.fx-login-brand-sep { width: 1px; height: 36px; background: rgba(255, 255, 255, .28); }
.fx-login-brand .fx-login-brand-name { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
@media (max-width: 767.98px) {
  .fx-login-logo { height: 52px; }
  .fx-login-brand .fx-login-brand-name { font-size: 18px; }
}

/* Logo de empresa en su formulario */
.fx-logo-field { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--fx-border); }
.fx-logo-preview {
  width: 220px; height: 110px; flex: none; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--fx-border-strong); border-radius: 10px; background: #FFFFFF; color: #8A919E; font-size: 13px; overflow: hidden;
}
.fx-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 10px; box-sizing: border-box; }
.fx-logo-mini { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 32px; border-radius: 6px; background: #FFFFFF; overflow: hidden; }
.fx-logo-mini img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 3px; box-sizing: border-box; }

/* Zona de peligro (eliminar cuenta) */
.fx-peligro { border-color: var(--fx-danger-border) !important; }
.fx-peligro .fx-panel-head h2 { color: var(--fx-accent-hover); }
.fx-peligro-lista { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; font-size: 13px; }
.fx-peligro-lista li { display: flex; justify-content: space-between; color: var(--fx-muted); padding: 3px 0; border-bottom: 1px solid var(--fx-border-soft); }
.fx-peligro-lista strong { color: var(--fx-text); font-weight: 500; }
