
@font-face { font-family: "Geist"; src: url("/static/fonts/GeistVF.woff") format("woff"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/static/fonts/GeistMonoVF.woff") format("woff"); font-weight: 100 900; font-display: swap; }
:root { --font-geist-sans: "Geist"; --font-geist-mono: "Geist Mono"; }
/* ================================================
   HORIZON UI — Azul + Geist
   ================================================ */
:root {
  --bg: #F4F7FE;
  --bg-card: #ffffff;
  --bg-input: #F4F7FE;
  --bg-hover: #EBF2FF;

  --border: #E9EDF7;
  --border-dark: #C9D0E6;

  --text: #2B3674;
  --text-2: #A3AED0;
  --text-3: #707EAE;
  --text-4: #8F9BBA;

  --accent: #2563EB;
  --accent-dark: #1D4ED8;
  --accent-bg: #EBF2FF;
  --accent-b: rgba(37, 99, 235, 0.18);

  --green: #05CD99;
  --green-bg: #E6FAF5;
  --red: #EE5D50;
  --red-bg: #FEF0EE;
  --amber: #FFB547;
  --amber-bg: #FFF8EC;

  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;

  --shadow: 0px 18px 40px rgba(112, 144, 176, 0.12);
  --shadow-sm: 14px 17px 40px 4px rgba(112, 144, 176, 0.08);
  --shadow-xs: 0px 4px 16px rgba(112, 144, 176, 0.08);

  --t: 0.18s ease;
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0 }

html,body {
  height: 100%;
  background: var(--bg);
  color: #2B3674;
  font-family: var(--font-geist-sans), -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

::-webkit-scrollbar { width: 5px; height: 5px }
::-webkit-scrollbar-track { background: transparent }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 99px }

@keyframes spin { to { transform: rotate(360deg) } }
@keyframes noticeShrink {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}
.page-loader {
  width: 28px; height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ── App layout ── */
.app-layout { display: flex; min-height: 100vh; background: var(--bg) }

/* ── Sidebar ── */
.sidebar {
  width: 290px; min-height: 100vh;
  position: fixed; top: 0; left: 0;
  background: var(--bg-card);
  display: flex; flex-direction: column;
  z-index: 100; transition: width .22s ease; overflow: hidden;
}
.sidebar.collapsed { width: 72px; overflow: visible }
.sidebar.collapsed ~ .main-content { margin-left: 72px }
.sidebar.collapsed .sidebar-nav { overflow: visible }

.sidebar-brand-wrap {
  padding: 24px 24px 0;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.sidebar.collapsed .sidebar-brand-wrap {
  justify-content: center;
  padding: 24px 0 0;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; overflow: hidden; min-width: 0 }
.sidebar-brand-icon { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0 }
.sidebar-brand-title {
  color: #2B3674;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.15;
  white-space: nowrap;
}
.sidebar-toggle {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 8px;
  background: transparent; color: var(--text-2);
  cursor: pointer; flex-shrink: 0; transition: var(--t);
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text) }
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 0 }

.sidebar-nav {
  flex: 1; padding: 8px 16px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto; position: relative;
}
.sidebar-indicator {
  position: absolute; right: 0; width: 4px;
  background: var(--accent); border-radius: 25px 0 0 25px;
  transition: top .3s cubic-bezier(.4,0,.2,1), height .3s cubic-bezier(.4,0,.2,1), opacity .2s;
  pointer-events: none;
}
.sidebar-link {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; border-radius: var(--radius-xs);
  color: var(--text-2); text-decoration: none;
  font-size: 15px; font-weight: 500;
  transition: background var(--t), color var(--t);
  white-space: nowrap; overflow: hidden; position: relative;
}
.sidebar-link.has-tooltip { position: relative }
.sidebar.collapsed .sidebar-link.has-tooltip {
  overflow: visible;
  z-index: 120;
}
.sidebar.collapsed .sidebar-link.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t), transform var(--t);
  z-index: 140;
}
.sidebar.collapsed .sidebar-link.has-tooltip::before {
  content: "";
  position: absolute;
  left: calc(100% + 5px);
  top: 50%;
  width: 8px;
  height: 8px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: translateY(-50%) rotate(-45deg);
  opacity: 0;
  transition: opacity var(--t);
  z-index: 139;
}
.sidebar.collapsed .sidebar-link.has-tooltip:hover::after,
.sidebar.collapsed .sidebar-link.has-tooltip:focus-visible::after,
.sidebar.collapsed .sidebar-link.has-tooltip:hover::before,
.sidebar.collapsed .sidebar-link.has-tooltip:focus-visible::before {
  opacity: 1;
}
.sidebar.collapsed .sidebar-link.has-tooltip:hover::after,
.sidebar.collapsed .sidebar-link.has-tooltip:focus-visible::after {
  transform: translateY(-50%) translateX(0);
}
.sidebar-link:hover { background: var(--bg); color: var(--text); text-decoration: none }
.sidebar-link.active { color: var(--text); font-weight: 700 }
.sidebar-link-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0 }
.sidebar-link-label { overflow: hidden; text-overflow: ellipsis }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 11px; gap: 0 }
.sidebar.collapsed .sidebar-link-label { display: none }
.sidebar.collapsed .sidebar-link.active {
  background: var(--bg);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.14);
}

.sidebar-upgrade {
  margin: 16px; padding: 48px 20px 20px;
  background: linear-gradient(135deg, #4f8ef7 0%, var(--accent) 100%);
  border-radius: 24px; text-align: center;
  position: relative; overflow: visible;
}
.sidebar-upgrade-orb {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, #4f8ef7 0%, var(--accent) 100%);
  border: 4px solid white; border-radius: 50%;
  box-shadow: var(--shadow); position: absolute;
  top: -36px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; justify-content: center;
}
.sidebar-upgrade-orb-icon { color: #fff }
.sidebar-upgrade-title { font-size: 15px; font-weight: 700; color: white; margin-bottom: 6px }
.sidebar-upgrade-desc  { font-size: 12px; color: #E9EDF7; line-height: 1.5 }
.sidebar.collapsed .sidebar-upgrade { display: none }

/* ── Main content ── */
.main-content {
  flex: 1; margin-left: 290px; min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left .22s ease; min-width: 0;
}

/* ── TopNav ── */
.topnav {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 24px 30px 20px; background: transparent; flex-shrink: 0;
}
.topnav-breadcrumb { font-size: 14px; font-weight: 500; color: var(--text-3); margin-bottom: 2px }
.topnav-title { font-size: 34px; font-weight: 700; color: var(--text); letter-spacing: -.02em; line-height: 1.2 }
.topnav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0 }
.topnav-pill {
  display: flex; align-items: center; gap: 2px;
  background: var(--bg-card); border-radius: 30px;
  padding: 8px 10px; box-shadow: var(--shadow-sm);
}
.topnav-icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text-2);
  cursor: pointer; border-radius: 50%; transition: var(--t); text-decoration: none;
}
.topnav-icon-btn:hover { background: var(--bg); color: var(--text) }
.topnav-icon-btn.help-focus {
  color: var(--accent);
  background: var(--accent-bg);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  animation: topnav-help-pulse 1.4s ease-in-out infinite;
}

@keyframes topnav-help-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.1);
  }
}
.topnav-help-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topnav-help-wrap.has-coachmark {
  z-index: 1002;
}
.topnav-help-hint {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(-2px);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t), transform var(--t);
  z-index: 30;
}
.topnav-help-wrap:hover .topnav-help-hint,
.topnav-help-wrap:focus-within .topnav-help-hint {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.topnav-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 13px;
  cursor: pointer; flex-shrink: 0; transition: var(--t); position: relative;
}
.topnav-avatar:hover { opacity: .9 }
.topnav-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 6px; z-index: 200; min-width: 200px;
  animation: popUp .14s ease-out;
}
@keyframes popUp { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.topnav-dropdown-info { padding: 12px 14px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px }
.topnav-dropdown-name  { font-weight: 700; font-size: 14px; color: var(--text) }
.topnav-dropdown-email { font-size: 12px; color: var(--text-2); margin-top: 2px }
.topnav-logout-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--red);
  background: transparent; border: none; cursor: pointer;
  transition: background var(--t); font-family: var(--font-geist-sans), sans-serif;
}
.topnav-logout-btn:hover { background: var(--red-bg) }

.app-modal.onboarding-help-modal {
  width: min(82vw, 580px);
  max-width: 580px;
  height: auto;
  max-height: min(74vh, 520px);
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.onboarding-help-modal .app-modal-body {
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(56vh, 350px);
  overflow-y: auto;
  padding: 0 8px 2px 6px;
}

.onboarding-help-modal .app-modal-body > * {
  align-self: start;
}

.onboarding-device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.onboarding-device-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg);
  display: grid;
  gap: 9px;
}

.onboarding-device-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text);
}

.onboarding-device-card p {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 12px;
}

.onboarding-modal-step-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px;
  background: var(--bg);
  display: grid;
  gap: 5px;
  align-content: start;
}

.onboarding-modal-step-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent-bg);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.onboarding-modal-step-index {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.onboarding-modal-step-title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text);
}

.onboarding-modal-step-desc {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}

.onboarding-modal-step-actions {
  display: flex;
  gap: 7px;
  margin-top: 9px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.onboarding-modal-step-actions .btn {
  flex: 0 0 auto;
  min-width: 94px;
  justify-content: center;
}

.onboarding-help-graphic {
  border: 1px dashed var(--border-dark);
  border-radius: 10px;
  background: var(--bg-card);
  padding: 8px;
  display: grid;
  gap: 6px;
  min-height: 66px;
  width: min(100%, 290px);
  justify-self: start;
  align-content: center;
}

.onboarding-help-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  width: fit-content;
}

.onboarding-help-toggle span {
  padding: 4px 9px;
  font-size: 11px;
  color: var(--text-3);
  background: var(--bg);
}

.onboarding-help-toggle span.active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.onboarding-help-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px;
}

.onboarding-help-input,
.onboarding-help-btn,
.onboarding-help-dropzone {
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 10.5px;
}

.onboarding-help-input {
  padding: 5px 8px;
  color: var(--text-3);
  background: var(--bg);
}

.onboarding-help-btn {
  padding: 5px 8px;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
  text-align: center;
}

.onboarding-help-dropzone {
  padding: 7px;
  color: var(--text-3);
  text-align: center;
  border-style: dashed;
  background: var(--bg);
}

.onboarding-help-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.onboarding-help-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 600;
}

.onboarding-help-action.is-danger {
  border-color: rgba(238, 93, 80, 0.35);
  background: var(--red-bg);
  color: var(--red);
}

.topnav-help-coachmark {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  transform: none;
  width: min(300px, calc(100vw - 24px));
  border: 1px solid var(--accent-b);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "text close"
    "actions actions";
  align-items: start;
  gap: 8px 10px;
  padding: 10px 10px 9px;
  z-index: 1003;
}

.topnav-help-coachmark::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 16px;
  transform: rotate(45deg);
  width: 8px;
  height: 8px;
  background: var(--bg-card);
  border-left: 1px solid var(--accent-b);
  border-top: 1px solid var(--accent-b);
}

.topnav-help-coachmark-text {
  grid-area: text;
  margin: 0;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--text-3);
  font-weight: 600;
  padding-right: 2px;
}

.topnav-help-coachmark-text strong {
  color: var(--text-3);
}

.topnav-help-coachmark-actions {
  grid-area: actions;
  width: 100%;
  display: flex;
  gap: 6px;
  margin-top: 2px;
  justify-content: flex-end;
  flex-wrap: nowrap;
  align-items: center;
}

.topnav-help-coachmark-btn {
  flex: 0 0 auto;
  border: 1px solid var(--border-dark);
  background: var(--bg-card);
  color: var(--text-3);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 7px;
  min-height: 28px;
  cursor: pointer;
  line-height: 1.2;
}

.topnav-help-coachmark-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.topnav-help-coachmark-btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.topnav-help-coachmark-btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

.topnav-help-coachmark-close {
  grid-area: close;
  justify-self: end;
  align-self: start;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.topnav-help-coachmark-close:hover {
  background: var(--bg);
  color: var(--text);
}

.topnav-help-focus-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: none;
  z-index: 1000;
}

.topnav-help-focus-ring {
  position: fixed;
  border: 2px solid #60a5fa;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
  pointer-events: none;
  z-index: 1001;
  transition: top .15s ease, left .15s ease, width .15s ease, height .15s ease;
}

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: transparent;
  pointer-events: none;
}

.onboarding-mask-svg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.onboarding-highlight {
  position: fixed;
  border: 2px solid #60a5fa;
  border-radius: 12px;
  pointer-events: none;
  transition: top .2s ease, left .2s ease, width .2s ease, height .2s ease;
}

.onboarding-popover {
  position: fixed;
  width: min(92vw, 390px);
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 13px;
  z-index: 1201;
  display: grid;
  gap: 7px;
  pointer-events: auto;
}

.onboarding-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.onboarding-close:hover {
  background: var(--bg);
  color: var(--text);
}

.onboarding-step-index {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.onboarding-step-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  padding-right: 24px;
}

.onboarding-step-desc {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}

.onboarding-step-requirement {
  margin: 0;
  padding: 8px 9px;
  border-radius: 10px;
  border: 1px solid rgba(234, 179, 8, 0.35);
  background: rgba(254, 243, 199, 0.42);
  color: #92400e;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
}

.onboarding-step-requirement.done {
  border-color: rgba(5, 150, 105, 0.35);
  background: rgba(209, 250, 229, 0.5);
  color: #065f46;
}

.onboarding-step-note {
  margin: 0;
  padding: 8px;
  border-radius: 10px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-b);
  color: var(--accent);
  font-size: 11.5px;
}

.onboarding-fix-box {
  margin: 0;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(37, 99, 235, 0.25);
  background: rgba(239, 246, 255, 0.9);
  display: grid;
  gap: 6px;
}

.onboarding-fix-box.is-error {
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(254, 242, 242, 0.94);
}

.onboarding-fix-box.is-success {
  border-color: rgba(22, 163, 74, 0.28);
  background: rgba(240, 253, 244, 0.95);
}

.onboarding-fix-title {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-dark);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.onboarding-fix-box.is-error .onboarding-fix-title {
  color: #b91c1c;
}

.onboarding-fix-box.is-success .onboarding-fix-title {
  color: #166534;
}

.onboarding-fix-text {
  margin: 0;
  color: #1e3a8a;
  font-size: 11.5px;
  line-height: 1.35;
}

.onboarding-fix-box.is-error .onboarding-fix-text {
  color: #7f1d1d;
}

.onboarding-fix-box.is-success .onboarding-fix-text {
  color: #14532d;
}

.onboarding-fix-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.onboarding-fix-list li {
  color: #1e3a8a;
  font-size: 11.5px;
  line-height: 1.35;
}

.onboarding-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.onboarding-actions .btn {
  flex: 1;
  justify-content: center;
}

.onboarding-btn-prev {
  background: var(--bg-card);
  color: var(--text-3);
  border: 1px solid var(--border-dark);
  box-shadow: none;
}

.onboarding-btn-prev:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-dark);
  transform: translateY(0);
  box-shadow: none;
}

.onboarding-btn-prev:disabled {
  background: var(--bg);
  color: var(--text-2);
  border-color: var(--border);
}

/* ── Content wrapper ── */
.content-wrapper { flex: 1; padding: 0 30px 60px; min-width: 0 }

/* ── Premium card ── */
.premium-card {
  display: flex; gap: 18px;
  background: var(--bg-card); border-radius: var(--radius);
  padding: 24px 28px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.premium-card-icon {
  width: 44px; height: 44px; border-radius: var(--radius-xs);
  background: var(--accent-bg); color: var(--accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.premium-card-body { flex: 1; min-width: 0 }
.premium-card-title { font-size: 16px; font-weight: 700; color: var(--text); margin: 0 0 4px }
.premium-card-desc  { font-size: 13px; color: var(--text-2); margin: 0 0 16px; line-height: 1.5 }

/* ── Search box ── */
.search-box-container { display: flex; align-items: center; gap: 10px; max-width: 520px }
.search-input-text {
  flex: 1; padding: 11px 16px; font-size: 14px;
  font-family: var(--font-geist-sans), sans-serif;
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); outline: none; color: var(--text); transition: all var(--t);
}
.search-input-text::placeholder { color: var(--text-4) }
.search-input-text:focus { border-color: var(--accent); background: var(--bg-card); box-shadow: 0 0 0 3px rgba(37,99,235,.1) }
.verified-badge {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px; padding: 6px 14px;
  background: var(--green-bg); color: var(--green);
  border: 1px solid rgba(5,205,153,.25); border-radius: 99px;
  font-size: 13px; font-weight: 500;
}
.verified-badge-x { background: none; border: none; color: var(--green); cursor: pointer; padding: 0; margin-left: 4px; opacity: .5; transition: opacity var(--t); display: flex }
.verified-badge-x:hover { opacity: 1 }
.field-error { margin: 8px 0 0; font-size: 12.5px; color: var(--red) }

/* ── Dropzone ── */
.dropzone {
  border: 2px dashed var(--border-dark); border-radius: var(--radius);
  padding: 52px 24px; text-align: center; cursor: pointer;
  transition: all var(--t); background: var(--bg-card); box-shadow: var(--shadow-xs);
}
.dropzone:hover,.dropzone.active { border-color: var(--accent); background: var(--accent-bg); box-shadow: 0 0 0 4px rgba(37,99,235,.06) }
.dropzone-icon { color: var(--text-2); margin-bottom: 14px; transition: color var(--t) }
.dropzone:hover .dropzone-icon,.dropzone.active .dropzone-icon { color: var(--accent) }
.dropzone-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px }
.dropzone-subtitle { font-size: 13px; color: var(--text-2) }
.dropzone-count {
  margin-top: 18px; display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 18px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 99px; font-size: 13px; color: var(--text); font-weight: 500;
}
.dropzone input[type="file"] { display: none }

/* ── Action bar ── */
.action-bar {
  display: flex; align-items: center; gap: 12px;
  margin-top: 20px; flex-wrap: wrap;
  padding: 16px 22px; background: var(--bg-card);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; border: none; cursor: pointer;
  transition: all .16s ease; font-family: var(--font-geist-sans), sans-serif;
  white-space: nowrap; letter-spacing: -.01em;
}
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none!important; box-shadow: none!important }
.btn-primary, button.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; border: none; cursor: pointer;
  transition: all .16s ease; font-family: var(--font-geist-sans), sans-serif;
}
.btn-primary:hover:not(:disabled), button.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark); box-shadow: 0 6px 20px rgba(37,99,235,.4); transform: translateY(-1px);
}
.btn-primary:disabled, button.btn-primary:disabled { opacity: .45; cursor: not-allowed }
.btn-secondary { background: var(--green-bg); color: var(--green); border: 1px solid rgba(5,205,153,.3) }
.btn-secondary:hover:not(:disabled) { background: #d2f5ed; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(5,205,153,.2) }
.btn-secondary:disabled { background: var(--bg-card); border-color: var(--border); color: var(--text-2) }
.btn.btn-cancel {
  background: #ffffff;
  color: #64748b;
  border: 1px solid #d7dee9;
  box-shadow: none;
}
.btn.btn-cancel:hover:not(:disabled) {
  background: #f8fafc;
  color: #475569;
  border-color: #c5cedb;
  transform: none;
  box-shadow: 0 2px 7px rgba(100, 116, 139, 0.12);
}
.btn.btn-cancel:disabled {
  background: #ffffff;
  color: #a0adbf;
  border-color: #e2e8f0;
}
.btn-cloud { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.3) }
.btn-cloud:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,99,235,.38) }
.btn-cloud:disabled { opacity: .45; cursor: not-allowed }

/* Variante neutra (sin verde) para acciones secundarias en modales/forms */
.btn.btn-subtle-neutral {
  background: #fcfdff;
  color: #64748b;
  border: 1.5px solid #d7dfec;
  box-shadow: none;
}
.btn.btn-subtle-neutral:hover:not(:disabled) {
  background: #f9fbff;
  color: #55657f;
  border-color: #c3cfdf;
  transform: none;
  box-shadow: 0 1px 5px rgba(148,163,184,.1);
}
.btn.btn-subtle-neutral:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(148,163,184,.22);
}
.btn.btn-subtle-neutral:disabled {
  background: #fbfcff;
  color: #a0adbf;
  border-color: #e1e6f0;
  box-shadow: none;
}

/* ── Progress ── */
.progress-wrapper { flex: 1; min-width: 140px }
.progress-bar-outer { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden }
.progress-bar-inner { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease }
.progress-text { font-size: 12px; color: var(--text-2); margin-top: 5px }

/* ── Factura row ── */
.facturas-list { display: flex; flex-direction: column; gap: 10px; margin-top: 20px }
.factura-row { background: var(--bg-card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-xs); transition: box-shadow var(--t) }
.factura-row:hover { box-shadow: var(--shadow) }
.factura-row.status-processing { outline: 2px solid var(--accent-b) }
.factura-row.status-done       { outline: 2px solid rgba(5,205,153,.18) }
.factura-row.status-error      { outline: 2px solid rgba(238,93,80,.2) }
.factura-row-main { display: flex; align-items: center; gap: 14px; padding: 14px 14px }
.factura-row-thumb { flex-shrink: 0; display: flex; align-items: center; }
.factura-thumb-img { width: 48px; height: 48px; object-fit: cover; border-radius: var(--radius-xs); border: 1px solid var(--border) }
.factura-thumb-placeholder { width: 48px; height: 48px; border-radius: var(--radius-xs); background: var(--accent-bg); color: var(--accent); display: flex; align-items: center; justify-content: center; border: 1px solid var(--border) }
.factura-row-info { flex: 1; min-width: 0; align-items: center; display: flex;}
.factura-row-filename { font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;}
.factura-row-summary { display: flex; flex-wrap: wrap; gap: 6px }
.factura-row-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-size: 11.5px; color: var(--text) }
.factura-row-chip-label { color: var(--text-2); font-weight: 500 }
.factura-row-chip-value { font-weight: 700; font-family: var(--font-geist-mono), monospace }
.factura-row-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0 }
.factura-row-btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; background: var(--bg); border: 1px solid var(--border); color: var(--text); cursor: pointer; transition: var(--t); font-family: var(--font-geist-sans), sans-serif }
.factura-row-btn:hover { background: var(--bg-hover); border-color: var(--accent-b); color: var(--accent) }
.factura-row-btn-danger { color: var(--red); border-color: rgba(238,93,80,.25) }
.factura-row-btn-danger:hover { background: var(--red-bg); border-color: rgba(238,93,80,.4); color: var(--red) }
.factura-row-remove { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text-2); cursor: pointer; border-radius: 6px; transition: var(--t) }
.factura-row-remove:hover { background: var(--red-bg); color: var(--red) }
.factura-row-expanded { display: grid; grid-template-columns: 240px 1fr; gap: 0; border-top: 1px solid var(--border); background: var(--bg) }
@media(max-width:700px) { .factura-row-expanded { grid-template-columns: 1fr } }
.factura-preview-panel { border-right: 1px solid var(--border); padding: 16px; display: flex; align-items: flex-start; justify-content: center }
.factura-preview-img { width: 100%; max-width: 208px; border-radius: var(--radius-xs); border: 1px solid var(--border); object-fit: contain; background: white }
.factura-preview-pdf { width: 100%; height: 140px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-2); font-size: 12px; background: var(--bg-card); border-radius: var(--radius-xs); border: 1px solid var(--border) }
.factura-fields-panel { padding: 16px 20px }
.factura-fields-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px }
@media(max-width:900px) { .factura-fields-grid { grid-template-columns: 1fr } }
.card-field { display: flex; flex-direction: column; gap: 4px }
.card-field-wide { grid-column: 1 / -1 }
.card-field-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); font-weight: 700 }
.card-field-input { font-family: var(--font-geist-mono), monospace; font-size: 13px; color: var(--text); background: var(--bg-card); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; transition: all var(--t); width: 100% }
.card-field-input:focus { outline: none; border-color: var(--accent); background: var(--bg-card); box-shadow: 0 0 0 3px rgba(37,99,235,.1) }
.card-error-msg { font-size: 13px; color: var(--red); padding: 12px 18px; background: var(--red-bg); border-top: 1px solid rgba(238,93,80,.2) }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 99px; font-size: 11px; font-weight: 700; white-space: nowrap }
.badge-pending    { background: var(--bg); color: var(--text-2); border: 1px solid var(--border) }
.badge-done       { background: var(--green-bg); color: var(--green) }
.badge-error      { background: var(--red-bg); color: var(--red) }
.badge-processing { background: var(--accent-bg); color: var(--accent) }
.badge-spinner { display: inline-block; width: 11px; height: 11px; border: 2px solid rgba(37,99,235,.3); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0 }

/* ── Results table ── */
.results-section { margin-top: 32px }
.results-title { font-size: 22px; font-weight: 700; margin-bottom: 16px; color: var(--text); letter-spacing: -.02em }
.results-count { font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 10px }
.results-table-wrapper { overflow: visible; border-radius: var(--radius); background: var(--bg-card); box-shadow: var(--shadow); max-width: 100% }
.results-table-scroll { overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; max-width: 100%; border-radius: inherit; scrollbar-gutter: stable }
.results-table { width: 100%; min-width: 800px; border-collapse: collapse; font-size: 13px; white-space: nowrap }
.results-table th { padding: 14px 16px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text-2); background: var(--bg); border-bottom: 1px solid var(--border); letter-spacing: .06em; text-transform: uppercase; position: sticky; top: 0; z-index: 1 }
.results-table td { padding: 11px 16px; color: var(--text); border-bottom: 1px solid var(--border); font-family: var(--font-geist-mono), monospace; font-size: 12px }
.results-table td.td-text { font-family: var(--font-geist-sans), sans-serif; font-size: 13px }
.results-table tr:last-child td { border-bottom: none }
.results-table tr:hover td { background: var(--bg) }
.results-table td.td-amount { color: var(--accent); font-weight: 700 }

/* ── Empty state ── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 24px; color: var(--text-2); font-size: 14px; font-weight: 500 }
.empty-state svg { opacity: .3; margin-bottom: 16px }

/* ── Icon button ── */
.icon-btn { width: 32px; height: 32px; border-radius: var(--radius-xs); background: var(--bg); border: 1.5px solid var(--border); color: var(--accent); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all var(--t) }
.icon-btn:hover { background: var(--accent-bg); border-color: var(--accent-b) }

/* ════════════════════════════════════════
   LOGIN
   ════════════════════════════════════════ */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  background: var(--bg);
}

.login-brand-wrap {
  width: 820px;
  flex-shrink: 0;
  display: flex;
}

.login-brand {
  flex: 1;
  background: linear-gradient(155deg, #0f2460 0%, #1a3fa0 40%, #2563eb 80%, #3b82f6 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px 52px;
  color: white;
  text-align: center;
}

/* SVG decorativo de fondo — cubre todo */
.login-brand-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Orbs */
.login-brand-orb {
  position: absolute; border-radius: 50%;
  filter: blur(70px);
  animation: float 10s ease-in-out infinite;
  pointer-events: none;
}
.orb-1 { width: 400px; height: 400px; background: #3b82f6; opacity: .25; top: -140px; right: -100px }
.orb-2 { width: 300px; height: 300px; background: #93c5fd; opacity: .18; bottom: -80px; left: -80px; animation-delay: 4s }
.orb-3 { width: 180px; height: 180px; background: #60a5fa; opacity: .2; top: 40%; left: 60%; animation-delay: 7s }

@keyframes float {
  0%,100% { transform: translate(0,0) scale(1)          }
  50%     { transform: translate(14px,18px) scale(1.07) }
}

/* Contenido */
.login-brand-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 380px;
}

.login-brand-tag {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  padding: 5px 14px; border-radius: 99px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 24px;
}
.login-brand-tag-dot {
  width: 6px; height: 6px;
  background: #4ade80; border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1)    }
  50%     { opacity: .4; transform: scale(1.5) }
}

.login-brand-title {
  font-size: 40px; font-weight: 800;
  line-height: 1.1; letter-spacing: -.04em;
  margin-bottom: 16px; color: white;
}
.login-brand-title em {
  font-style: normal; opacity: .45; font-weight: 300;
}

.login-brand-line {
  width: 40px; height: 3px;
  background: rgba(255,255,255,.35);
  border-radius: 99px; margin-bottom: 16px;
}

.login-brand-sub {
  font-size: 14.5px; opacity: .72; line-height: 1.65;
  margin-bottom: 32px; max-width: 280px;
}

/* Tarjeta flotante */
.login-float-card {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.97);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28), 0 0 0 1px rgba(255,255,255,.1);
  animation: cardFloat 5s ease-in-out infinite;
  width: 100%;
}
@keyframes cardFloat {
  0%,100% { transform: translateY(0)    }
  50%     { transform: translateY(-7px) }
}
.login-float-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent-bg); color: var(--accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.login-float-texts { display: flex; flex-direction: column; gap: 3px; flex: 1; text-align: left }
.login-float-name  { font-size: 13px; font-weight: 700; color: var(--text) }
.login-float-sub   { font-size: 11px; color: var(--text-2) }
.login-float-check {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--green); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}

/* ── Panel derecho ── */
.login-panel {
  flex: 1;
  background: var(--bg);
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding: 48px 40px;
}
.login-panel-inner {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column;
}
.login-panel-logo { margin-bottom: 36px; display: flex; justify-content: center;}
.login-panel h3 {
  font-size: 28px; font-weight: 800;
  color: var(--text); margin-bottom: 8px; letter-spacing: -.03em;
  display: flex;
  justify-content: center;
}
.login-subtitle { color: var(--text-2); margin-bottom: 36px; font-size: 14px; line-height: 1.6; text-align: center }

.btn-microsoft {
  background: #1a1a1a; color: white; border: none;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 15px 24px;
  font-weight: 700; font-size: 15px;
  font-family: var(--font-geist-sans), sans-serif;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: all .22s ease; letter-spacing: -.01em;
}
.btn-microsoft:hover { background: #111; transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,.18) }
.btn-microsoft:active { transform: translateY(0) }

.login-credentials-input {
  border: 1px solid #e6edf8;
  background: transparent;
  border-radius: var(--radius-sm);
}
.login-credentials-input:focus {
  border-color: #cfdaf0;
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}

/* Evita doble icono de revelar contraseña (nativo + custom) */
.login-credentials-input[type="password"]::-ms-reveal,
.login-credentials-input[type="password"]::-ms-clear {
  display: none;
}

.login-credentials-input[type="password"]::-webkit-credentials-auto-fill-button {
  visibility: hidden;
  pointer-events: none;
}

.login-divider { display: flex; align-items: center; color: var(--text-2); font-size: 12px; margin: 28px 0 }
.login-divider::before,.login-divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border) }
.login-divider span { padding: 0 12px }
.login-divider-microsoft { margin: 16px 0 14px }
.login-divider-microsoft::before,
.login-divider-microsoft::after { border-bottom-color: #e3e8f3 }
.login-microsoft-note {
  margin: 10px 0px 20px 0px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}
.security-note { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; color: var(--text-2); font-size: 13px }
.security-note svg { color: var(--green) }

/* ── Responsive ── */
@media(max-width:1100px) { .login-brand-wrap { width: 520px } }
@media(max-width:900px) {
  .login-page       { flex-direction: column }
  .login-brand-wrap { display: none }
  .login-brand      { border-radius: 20px; padding: 40px 32px; min-height: 300px }
  .login-brand-title{ font-size: 30px }
  .login-panel      { padding: 40px 24px }
  .login-panel-inner{ max-width: 100% }
}
@media(max-width:768px) {
  /* Sidebar se oculta completamente en mobile */
  .sidebar             { display: none }
  .main-content        { margin-left: 0 !important }
  .sidebar ~ .main-content,
  .sidebar.collapsed ~ .main-content { margin-left: 0 !important }
  .content-wrapper     { padding: 0 14px 80px }   /* espacio abajo para bottom nav */
  .topnav              { padding: 14px 14px 12px }
  .topnav-title        { font-size: 22px }
  .topnav-breadcrumb   { font-size: 12px }
  .premium-card        { flex-direction: column; gap: 10px; padding: 16px 16px }
  .factura-row-summary { display: none }
  .action-bar          { gap: 8px; padding: 12px 14px }
  .btn                 { padding: 10px 16px; font-size: 13px }
  .btn-primary, button.btn-primary { padding: 10px 16px; font-size: 13px }
  .search-box-container {
    flex-direction: row;
    flex-wrap: nowrap;
    max-width: 100%;
    width: 100%;
    align-items: center;
  }
  .search-box-container .search-input-text {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
    height: 42px;
  }
  .search-box-container .btn,
  .search-box-container button {
    flex: 0 0 auto;
    white-space: nowrap;
    height: 42px;
    padding-top: 0;
    padding-bottom: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .tipo-toggle-btn     { padding: 7px 12px; min-width: 76px; font-size: 12px }

  .onboarding-help-modal {
    width: 92vw;
    max-width: 380px;
    height: auto;
    max-height: min(82dvh, 500px);
    min-height: 0;
    padding: 9px;
  }

  .onboarding-help-modal .app-modal-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 6px;
  }

  .onboarding-help-modal .app-modal-header > div:last-child {
    width: 100%;
    justify-content: space-between;
  }

  .onboarding-help-modal .app-modal-body {
    max-height: min(62dvh, 360px);
    padding-right: 1px;
  }

  .onboarding-popover {
    width: calc(100vw - 20px);
    max-width: none;
    border-radius: 16px;
    padding: 14px;
  }

  .onboarding-device-grid {
    grid-template-columns: 1fr;
  }

  .topnav-help-coachmark {
    right: 0;
    width: min(248px, calc(100vw - 18px));
    max-width: min(248px, calc(100vw - 18px));
    padding: 9px 9px 8px;
  }

  .topnav-help-coachmark::before {
    right: 20px;
    transform: rotate(45deg);
  }

  .topnav-help-coachmark-actions {
    gap: 5px;
    margin-top: 5px;
    justify-content: flex-end;
    padding-left: 6px;
    padding-right: 2px;
    box-sizing: border-box;
  }

  .topnav-help-coachmark-btn {
    flex: 0 0 auto;
    min-width: 0;
    text-align: center;
  }

  .topnav-help-coachmark-btn:first-child {
    margin-left: 4px;
  }
}

/* ─── Bottom Navigation Bar (solo mobile) ─── */
.mobile-bottom-nav {
  display: none;
}
@media(max-width:768px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 64px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 200;
    align-items: stretch;
    box-shadow: 0 -4px 20px rgba(112,144,176,.1);
    /* safe area para iPhones con notch */
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mobile-bottom-nav-item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-2);
    font-size: 10.5px; font-weight: 600;
    transition: color var(--t);
    background: none; border: none; cursor: pointer;
    font-family: var(--font-geist-sans), sans-serif;
    padding: 8px 4px;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-bottom-nav-item.active {
    color: var(--accent);
  }
  .mobile-bottom-nav-item svg {
    flex-shrink: 0;
  }
}

/* ─── DropZone mobile/desktop ─── */
.dropzone-desktop { display: block }
.dropzone-mobile  { display: none }

@media(max-width:768px) {
  .dropzone-desktop { display: none }
  .dropzone-mobile  {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 0;
  }
  .dropzone-mobile-count {
    grid-column: 1 / -1;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 18px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 99px; font-size: 13px; color: var(--text); font-weight: 500;
    justify-content: center;
  }
}

.dropzone-mobile-btn {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  padding: 28px 16px;
  border-radius: var(--radius);
  border: 2px dashed var(--border-dark);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--t);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.dropzone-mobile-btn:active {
  transform: scale(0.97);
}
.dropzone-mobile-camera {
  color: var(--accent);
  border-color: var(--accent-b);
  background: var(--accent-bg);
}
.dropzone-mobile-camera:hover, .dropzone-mobile-camera:active {
  background: #dae8ff; border-color: var(--accent);
}
.dropzone-mobile-gallery {
  color: var(--text-2);
}
.dropzone-mobile-gallery:hover, .dropzone-mobile-gallery:active {
  border-color: var(--accent); background: var(--accent-bg); color: var(--accent);
}
.dropzone-mobile-btn-label {
  font-size: 15px; font-weight: 700; color: inherit;
  font-family: var(--font-geist-sans), sans-serif;
}
.dropzone-mobile-btn-sub {
  font-size: 11.5px; color: var(--text-2);
  font-family: var(--font-geist-sans), sans-serif;
  margin-top: -4px;
}
.dropzone-mobile-camera .dropzone-mobile-btn-sub {
  color: var(--accent);
  opacity: .7;
}

/* ─── Ajustes generales para pantallas muy pequeñas ─── */
@media(max-width:480px) {
  .topnav-title    { font-size: 18px }
  .topnav          { padding: 12px 12px 10px }
  .content-wrapper { padding: 0 10px 80px }
  .premium-card    { padding: 14px 12px }
  .results-title   { font-size: 17px }
  .factura-row-main { padding: 12px 12px }
  .action-bar      { flex-direction: column; align-items: stretch }
  .action-bar .btn, .action-bar button.btn-primary {
    width: 100%; justify-content: center;
  }
  .progress-wrapper { min-width: unset; width: 100% }
}
/*FIN LOGIN*/

/* ── Toggle pill con slider ── */
.tipo-toggle {
  display: inline-flex; align-items: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 99px; padding: 3px;
  position: relative; flex-shrink: 0;
}
.tipo-slider {
  position: absolute; top: 3px; bottom: 3px; border-radius: 99px;
  transition: left .25s cubic-bezier(.4,0,.2,1), background-color .2s ease, width .25s cubic-bezier(.4,0,.2,1);
  pointer-events: none; z-index: 0;
}
.tipo-slider-compra,.tipo-slider-todos { background: var(--accent); box-shadow: 0 2px 8px rgba(37,99,235,.28) }
.tipo-slider-venta  { background: var(--green); box-shadow: 0 2px 8px rgba(5,205,153,.3) }
.tipo-slider-inconsistencias { background: var(--red); box-shadow: 0 2px 8px rgba(238,93,80,.3) }
.tipo-toggle-btn {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 18px; border: none; background: transparent;
  color: var(--text-2); font-size: 13px; font-weight: 600;
  cursor: pointer; border-radius: 99px; transition: color .18s ease;
  font-family: var(--font-geist-sans), sans-serif;
  white-space: nowrap; user-select: none; min-width: 96px;
}
.tipo-toggle-btn:hover:not(.active) { color: var(--text) }
.tipo-toggle-btn.active { color: #fff }
.tipo-toggle.disabled { opacity: .65 }
.tipo-toggle.disabled .tipo-toggle-btn { cursor: not-allowed }

/* ── Badges tipo ── */
.tipo-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700 }
.tipo-badge-compra { background: var(--accent-bg); color: var(--accent); border: 1px solid var(--accent-b) }
.tipo-badge-venta  { background: var(--green-bg); color: var(--green); border: 1px solid rgba(5,205,153,.2) }
.tipo-badge-todos  { background: var(--bg); color: var(--text-2); border: 1px solid var(--border) }

/* ── Empresa validada ── */
.empresa-validada { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 14px }
.empresa-validada-info { display: flex; align-items: center; gap: 12px; min-width: 0 }
.empresa-validada-icon { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; background: var(--bg-card); border: 1.5px solid var(--border-dark); display: flex; align-items: center; justify-content: center; color: var(--text-2) }
.empresa-validada-texts { min-width: 0 }
.empresa-validada-nombre { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.empresa-validada-ruc { font-size: 11.5px; color: var(--text-2); font-family: var(--font-geist-mono), monospace; margin-top: 1px }
.empresa-cambiar-btn { font-size: 12.5px; font-weight: 600; color: var(--text-2); background: none; border: none; cursor: pointer; padding: 4px 0; font-family: var(--font-geist-sans), sans-serif; white-space: nowrap; flex-shrink: 0; transition: color .15s ease; text-decoration: underline; text-underline-offset: 2px }
.empresa-cambiar-btn:hover { color: var(--text) }

/* ── Filtros card ── */
.filtros-card { background: var(--bg-card); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 20px; box-shadow: var(--shadow-xs); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 16px }
.filtros-card-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px }
.filtros-active-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0 }
.filtros-clear-btn { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; background: transparent; border: 1px solid var(--border); color: var(--text-2); cursor: pointer; transition: all .15s ease; font-family: var(--font-geist-sans), sans-serif }
.filtros-clear-btn:hover { border-color: var(--border-dark); color: var(--text); background: var(--bg) }
.filtros-grid { display: grid; grid-template-columns: minmax(145px,.85fr) minmax(135px,.75fr) minmax(280px,1.65fr) minmax(160px,.85fr) minmax(145px,.8fr); gap: 12px }
@media(max-width:1200px) { .filtros-grid { grid-template-columns: repeat(3,1fr) } }
@media(max-width:900px) { .filtros-grid { grid-template-columns: repeat(2,1fr) } }
@media(max-width:600px) { .filtros-grid { grid-template-columns: 1fr } }
.filtro-field { display: flex; flex-direction: column; gap: 5px }
.filtro-label { display: flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2) }
.filtro-input { padding: 9px 12px; font-size: 13.5px; font-family: var(--font-geist-sans), sans-serif; background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm); outline: none; color: var(--text); transition: all .18s ease; width: 100% }
.filtro-input::placeholder { color: var(--text-4) }
.filtro-input:focus { border-color: var(--accent); background: var(--bg-card); box-shadow: 0 0 0 3px rgba(37,99,235,.08) }
.filtro-custom-select { position: relative }
.filtro-custom-trigger {
  width: 100%;
  min-height: 40px;
  padding: 9px 38px 9px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  font-family: var(--font-geist-sans), sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  transition: all .18s ease;
}
.filtro-custom-trigger:hover {
  border-color: var(--border-dark);
  background: var(--bg-card);
}
.filtro-custom-select.is-open .filtro-custom-trigger {
  border-color: #d4dde8;
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(137,155,182,.12);
}
.filtro-custom-trigger-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filtro-custom-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.filtro-custom-select.is-open .filtro-custom-chevron {
  transform: translateY(-50%) rotate(180deg);
}
.filtro-custom-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 180;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15,23,42,.1);
  padding: 6px;
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}
.filtro-custom-option {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-geist-sans), sans-serif;
  padding: 8px 10px;
  cursor: pointer;
  transition: all .15s ease;
}
.filtro-custom-option:hover {
  border-color: var(--border);
  background: var(--bg);
  color: var(--text);
}
.filtro-custom-option.is-selected {
  border-color: #d8e1ec;
  background: #ecf2f9;
  color: #334155;
}

/* ── Results header ── */
.results-header-row { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px }
.results-export-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 0; margin-left: auto }
.results-actions-shell { display: flex; align-items: flex-start; justify-content: flex-end; gap: 8px; flex-wrap: wrap }
.results-export-row { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; flex: 1 }
.results-more-wrap { position: relative; flex: 0 0 auto }
.results-more-btn {
  width: 43px;
  height: 43px;
  border-color: var(--border-dark);
  box-shadow: inset 0 0 0 1px rgba(148,163,184,.16);
}
.results-more-btn:hover {
  border-color: rgba(37,99,235,.34);
}
.results-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  min-width: 236px;
  max-width: min(268px, calc(100vw - 24px));
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
  padding: 8px;
  z-index: 160;
  display: grid;
  gap: 6px;
  overflow-y: auto;
  --menu-offset-y: -4px;
  opacity: 0;
  transform: translateY(var(--menu-offset-y)) scale(.985);
  transition: opacity .14s ease, transform .14s ease;
}
.results-more-menu.is-measuring {
  visibility: hidden;
  pointer-events: none;
}
.results-more-menu.is-ready {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.results-more-menu.down-right { top: calc(100% + 8px); bottom: auto; right: 0; left: auto; transform-origin: top right; --menu-offset-y: -4px; }
.results-more-menu.up-right { top: auto; bottom: calc(100% + 8px); right: 0; left: auto; transform-origin: bottom right; --menu-offset-y: 4px; }
.results-more-menu.down-left { top: calc(100% + 8px); bottom: auto; left: 0; right: auto; transform-origin: top left; --menu-offset-y: -4px; }
.results-more-menu.up-left { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; transform-origin: bottom left; --menu-offset-y: 4px; }
.results-more-item {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-3);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 30px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-align: left;
  font-family: var(--font-geist-sans), sans-serif;
}
.results-more-item:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}
.results-more-item:disabled {
  opacity: .6;
  cursor: not-allowed;
}
.results-more-item-beta-pill {
  display: inline-flex;
  align-items: center;
  margin-left: -2px;
  transform: translateY(-5px);
  border-radius: 999px;
  border: 1px solid #d7e6fb;
  background: #eef5ff;
  color: #4f84c4;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  padding: 2px 5px;
  letter-spacing: .02em;
  pointer-events: none;
}
.results-more-item-danger {
  color: #9f3f3f;
  background: #fffafa;
  border-color: rgba(159, 63, 63, 0.16);
}
.results-more-item-danger:hover:not(:disabled) {
  background: #fff3f3;
  color: #8f3131;
  border-color: rgba(159, 63, 63, 0.24);
}
.results-audit-panel {
  margin: 8px 0 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  padding: 11px 12px;
  display: grid;
  gap: 9px;
  box-shadow: var(--shadow-xs);
}
.results-audit-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.results-audit-panel-kicker {
  margin: 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .05em;
  color: var(--text-2);
  text-transform: uppercase;
}
.results-audit-panel-title {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.results-audit-close-btn {
  border: 1px solid var(--border-dark);
  background: var(--bg-card);
  color: var(--text-3);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-geist-sans), sans-serif;
}
.results-audit-close-btn:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-dark);
}
.results-audit-loading {
  border: 1px dashed var(--border-dark);
  border-radius: 10px;
  background: var(--bg);
  padding: 8px 10px;
  color: var(--text-3);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.results-audit-empty {
  border: 1px dashed var(--border-dark);
  border-radius: 12px;
  background: var(--bg);
  padding: 10px;
  display: grid;
  gap: 8px;
}
.results-audit-empty p {
  margin: 0;
  color: var(--text-3);
  font-size: 12px;
}
.results-audit-empty-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.results-audit-empty-actions .btn {
  min-height: 34px;
}
.migration-preview-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f8fafc;
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
}
.migration-preview-tab {
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 34px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--font-geist-sans), sans-serif;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.migration-preview-tab:hover:not(:disabled) {
  color: #334155;
  background: #eef2f7;
}
.migration-preview-tab.is-active {
  background: #e5e7eb;
  color: #0f172a;
  border-color: #d1d5db;
}
.migration-preview-tab:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.results-empty-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.audit-provider-box {
  margin-top: 4px;
}
.audit-ruc-flow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.audit-ruc-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-geist-mono), monospace;
  border: 1px solid transparent;
}
.audit-ruc-chip.source {
  color: #9f3f3f;
  background: #fff6f6;
  border-color: rgba(159, 63, 63, 0.24);
}
.audit-ruc-chip.target {
  color: #166534;
  background: #effcf5;
  border-color: rgba(22, 163, 74, 0.28);
}
.audit-ruc-arrow {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 800;
}
.audit-ruc-target-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.audit-ruc-chip-btn {
  cursor: pointer;
}
.audit-ruc-chip-btn:focus-visible {
  outline: 2px solid rgba(22,163,74,.35);
  outline-offset: 2px;
}
.audit-floating-tooltip {
  position: fixed;
  width: min(280px, calc(100vw - 24px));
  max-width: calc(100vw - 20px);
  background: var(--bg-card);
  border: 1px solid rgba(22,163,74,.3);
  border-radius: 10px;
  box-shadow: var(--shadow-xs);
  padding: 8px;
  display: grid;
  gap: 6px;
  z-index: 320;
  white-space: normal;
  will-change: transform, opacity;
}
.audit-floating-tooltip.is-below {
  animation: audit-tooltip-slide-down .18s ease-out;
  transform-origin: top left;
}
.audit-floating-tooltip.is-above {
  animation: audit-tooltip-slide-up .18s ease-out;
  transform-origin: bottom left;
}
@keyframes audit-tooltip-slide-down {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes audit-tooltip-slide-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.audit-floating-tooltip strong {
  font-size: 11.5px;
  color: var(--text);
  line-height: 1.25;
}
.audit-floating-tooltip > span {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.25;
}
.audit-floating-tooltip-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.audit-floating-tooltip-copy,
.audit-floating-tooltip-cta {
  border: 1px solid rgba(22,163,74,.35);
  background: rgba(22,163,74,.08);
  color: #166534;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-geist-sans), sans-serif;
}
.audit-floating-tooltip-copy {
  border-color: var(--border-dark);
  background: var(--bg-card);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(148,163,184,.12);
}
.audit-floating-tooltip-copy:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
  border-color: rgba(37,99,235,.34);
}
.audit-floating-tooltip-cta:hover:not(:disabled) {
  background: rgba(22,163,74,.14);
}
.results-export-input {
  width: 162px;
  min-width: 162px;
  flex: 0 0 162px;
}
.results-btn-secondary {
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent-b);
}
.results-btn-secondary:hover:not(:disabled) {
  background: #dce8ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37,99,235,.18);
}
.results-btn-neutral {
  background: var(--bg-card);
  color: var(--text-3);
  border: 1px solid var(--border);
}
.results-btn-neutral:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--border-dark);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(148,163,184,.15);
}
.results-btn-muted {
  background: var(--bg);
  color: var(--text-3);
  border: 1px solid var(--border-dark);
}
.results-btn-muted:hover:not(:disabled) {
  background: #eaf0fb;
  border-color: #b9c5df;
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(148,163,184,.12);
}

.results-btn-outline-strong {
  background: #fcfdff;
  color: var(--text-3);
  border: 1px solid #b6c2da;
  box-shadow: none;
}

.results-btn-outline-strong:hover:not(:disabled) {
  background: #f6f9ff;
  color: var(--text);
  border-color: #94a5c7;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(112, 144, 176, 0.16);
}

@media(max-width:768px) {
  .results-export-controls { min-width: 100% }
  .results-actions-shell { width: 100% }
  .results-more-wrap { margin-left: auto }
  .results-more-menu {
    right: 0;
    left: auto;
    min-width: min(228px, calc(100vw - 24px));
    max-width: min(252px, calc(100vw - 24px));
  }
  .results-audit-panel-head { align-items: flex-start }
  .results-export-input {
    width: 142px;
    min-width: 142px;
    flex: 0 0 142px;
  }
}

@media(max-width:520px) {
  .results-export-row { width: 100% }
  .results-export-input {
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }
  .results-export-row .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* ── Paginación ── */
.pagination-row {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.pagination-summary {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
}
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap }
.pagination-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--bg-card); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s ease; font-family: var(--font-geist-sans), sans-serif }
.pagination-btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--accent-b); color: var(--accent) }
.pagination-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.25) }
.pagination-btn:disabled { opacity: .35; cursor: not-allowed }
.pagination-dots { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 14px }

/* ── Modal ── */
.app-modal-backdrop { position: fixed; inset: 0; background: rgba(43,54,116,.28); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 600; padding: 18px }
.app-modal { width: 100%; max-width: 460px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 18px 16px }
.app-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 10px }
.app-modal-title-wrap { display: flex; align-items: center; gap: 10px }
.app-modal-icon { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0 }
.app-modal-icon.success { background: var(--green-bg); color: var(--green) }
.app-modal-icon.error   { background: var(--red-bg); color: var(--red) }
.app-modal-title { margin: 0; font-size: 17px; font-weight: 700; color: var(--text) }
.app-modal-close { width: 30px; height: 30px; border: none; border-radius: 8px; background: transparent; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--t) }
.app-modal-close:hover { background: var(--bg); color: var(--text) }
.app-modal-body { margin: 12px 0 0; font-size: 13.5px; color: var(--text-3); line-height: 1.6 }
.app-modal-actions { margin-top: 16px; display: flex; justify-content: flex-end }

/* Flask conversion helpers */
.btn-sm { min-height: 30px; padding: 6px 10px; font-size: 12px; border-radius: 10px; }
.factura-card { display: grid; grid-template-columns: minmax(150px, 240px) 1fr; gap: 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); padding: 14px; margin-bottom: 14px; }
.factura-card-preview { min-height: 190px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg); overflow: hidden; display:flex; align-items:center; justify-content:center; cursor:pointer; }
.factura-preview-img, .factura-preview-pdf { width: 100%; height: 100%; min-height: 190px; object-fit: contain; border: 0; display:block; }
.factura-preview-placeholder { color: var(--text-2); display:grid; place-items:center; gap:8px; }
.factura-card-content { min-width: 0; display: grid; gap: 12px; }
.factura-card-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.factura-card-title { margin:0; color:var(--text); font-size:16px; font-weight:800; word-break:break-word; }
.factura-card-subtitle { margin:3px 0 0; color:var(--text-3); font-size:12px; font-weight:600; }
.factura-fields-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap:10px; }
.factura-field label { display:block; font-size:11.5px; font-weight:700; color:var(--text-2); margin-bottom:4px; }
.factura-input { width:100%; min-height:38px; border:1px solid var(--border); background:var(--bg-input); color:var(--text); border-radius:12px; padding:8px 10px; font:inherit; outline:none; }
.factura-input:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(37,99,235,.10); background:#fff; }
.detalles-editor { display:grid; gap:8px; }
.detalles-header { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.detalles-header h4 { margin:0; font-size:13px; color:var(--text); }
.detalle-row { display:grid; grid-template-columns: 1fr 80px 140px 36px; gap:8px; align-items:center; margin-bottom:8px; }
.factura-card-actions { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.manual-validation-card { background: var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:14px; margin-bottom:14px; box-shadow:var(--shadow-xs); display:grid; gap:12px; }
.manual-validation-header { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.manual-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 280px)); gap:10px; }
.manual-grid label { font-size:12px; color:var(--text-2); font-weight:700; display:block; margin-bottom:4px; }
.drop-zone.dragover { border-color: var(--accent); background: var(--accent-bg); }
.table-actions { display:flex; gap:6px; justify-content:flex-end; flex-wrap:wrap; }
.icon-btn { width:34px; height:34px; border:1px solid var(--border); background:var(--bg-card); color:var(--text-3); border-radius:10px; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; transition:var(--t); }
.icon-btn:hover { color:var(--text); background:var(--bg); }
.search-results-toolbar { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin: 14px 0; }
.filtros-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap:10px; margin-top:12px; }
.filtro-field label { font-size:11.5px; color:var(--text-2); font-weight:700; display:block; margin-bottom:4px; }
.modal-large { max-width: 980px !important; width:min(980px, calc(100vw - 28px)); }
.preview-modal-content { height:min(78vh, 820px); overflow:auto; display:flex; justify-content:center; align-items:flex-start; background:#0f172a; border-radius:0 0 var(--radius) var(--radius); padding:14px; }
.preview-modal-content img, .preview-modal-content embed { max-width:100%; width:100%; min-height:70vh; object-fit:contain; border:0; }
@media (max-width: 860px) { .factura-card { grid-template-columns: 1fr; } .detalle-row { grid-template-columns: 1fr; } }

/* ==================================================
   Adaptación visual TSX para la versión Flask
   ================================================== */
.sidebar.collapsed .sidebar-brand { display: none; }
.sidebar:not(.collapsed) .sidebar-brand { display: flex; }
.sidebar:not(.collapsed) .sidebar-link.has-tooltip::after,
.sidebar:not(.collapsed) .sidebar-link.has-tooltip::before { display: none; }

.topnav-left { min-width: 0; }
.topnav-profile-wrap { position: relative; }
.topnav-avatar { border: 0; font-family: var(--font-geist-sans), sans-serif; }
.topnav-dropdown[hidden] { display: none !important; }

.dropzone-wrapper { margin-top: 0; }
.dropzone svg { width: 38px; height: 38px; stroke-width: 1.5; }
.dropzone-title,
.dropzone-subtitle { margin-left: 0; margin-right: 0; }

.factura-validation-group {
  border: 1px solid rgba(148,163,184,.35);
  border-radius: 26px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(148,163,184,.08), rgba(148,163,184,.02));
  box-shadow: 0 10px 25px rgba(2,6,23,.08);
  backdrop-filter: blur(3px);
  display: grid;
  gap: 10px;
}
.factura-validation-group.is-done {
  border-color: rgba(22,163,74,.35);
  background: linear-gradient(180deg, rgba(22,163,74,.08), rgba(22,163,74,.02));
}
.factura-validation-group.is-error {
  border-color: rgba(220,38,38,.35);
  background: linear-gradient(180deg, rgba(220,38,38,.08), rgba(220,38,38,.02));
}
.factura-validation-group.is-processing {
  border-color: rgba(59,130,246,.35);
  background: linear-gradient(180deg, rgba(59,130,246,.08), rgba(59,130,246,.02));
}
.factura-validation-group.has-validation-error {
  border-color: rgba(220,38,38,.55);
  background: linear-gradient(180deg, rgba(220,38,38,.16), rgba(220,38,38,.05));
}
.factura-manual-section { display: grid; gap: 8px; }
.factura-manual-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.factura-manual-filename {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}
.factura-manual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 280px));
  justify-content: start;
  gap: 10px;
}
.factura-manual-field label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}
.factura-manual-field .search-input-text {
  width: 100%;
  min-width: 0;
  max-width: 280px;
}
.factura-match-status { display: grid; gap: 4px; }
.factura-match-status p { margin: 0; font-size: 12px; font-weight: 700; }

.factura-row-info { gap: 10px; }
.factura-row-summary { flex: 1; }
.factura-row-expanded[hidden] { display: none !important; }
.factura-row-btn svg,
.factura-row-remove svg,
.badge svg { flex-shrink: 0; }
.factura-preview-panel iframe { width: 100%; }
.factura-detalles-panel h4 { color: var(--text-3) !important; }
.detalle-edit-row {
  display: grid;
  grid-template-columns: 3fr 1fr 1.5fr auto;
  gap: 10px;
  margin-bottom: 8px;
  align-items: end;
}

.results-section .results-title { margin-bottom: 4px; }
.action-bar .action-bar-spacer { flex: 1; min-width: 10px; }
.action-bar .btn-subtle-neutral { margin-left: auto; }

@media(max-width:900px) {
  .factura-row-info { align-items: flex-start; flex-direction: column; }
}

@media(max-width:700px) {
  .factura-row-main { align-items: flex-start; flex-wrap: wrap; }
  .factura-row-info { width: calc(100% - 64px); }
  .factura-row-actions { width: 100%; justify-content: flex-end; }
  .detalle-edit-row { grid-template-columns: 1fr; }
  .detalle-edit-row .factura-row-remove { justify-self: end; }
}

/* ============================================================
   VISOR DE FACTURA A PANTALLA COMPLETA
   Solo afecta a la vista previa abierta desde Analizar.
   ============================================================ */

body.preview-open {
  overflow: hidden;
}

.preview-workspace {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  color: #f8fafc;
  background: rgba(11, 13, 18, .94);
  backdrop-filter: blur(2px);
}

.preview-workspace:fullscreen {
  width: 100vw;
  height: 100vh;
  background: #111318;
}

.preview-workspace-toolbar {
  position: relative;
  z-index: 12;
  flex: 0 0 auto;
  min-height: 88px;
  padding: 12px 18px 14px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  background: #242424;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .2);
}

.preview-workspace-fields {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.preview-manual-field {
  display: grid;
  gap: 6px;
}

.preview-manual-field label {
  padding-left: 2px;
  color: #b8c0d4;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
}

.preview-manual-field input {
  width: 170px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid #35415c;
  border-radius: 14px;
  outline: none;
  color: #f8fafc;
  background: #121827;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
  font-family: inherit;
  font-size: 13px;
  transition:
    border-color .15s ease,
    box-shadow .15s ease;
}

.preview-manual-field-monto input {
  width: 180px;
}

.preview-manual-field input:focus {
  border-color: #4d7df3;
  box-shadow:
    0 0 0 3px rgba(59, 130, 246, .16),
    inset 0 1px 0 rgba(255, 255, 255, .03);
}

.preview-manual-field input::placeholder {
  color: #78839d;
}

.preview-manual-field input::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: .8;
  cursor: pointer;
}

.preview-toolbar-spacer {
  flex: 1 1 12px;
  min-width: 8px;
}

.preview-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 3px;
  border: 1px solid #39445d;
  border-radius: 13px;
  background: #151b29;
}

.preview-tool-btn {
  min-height: 34px;
  padding: 7px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 10px;
  color: #d7dcea;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition:
    color .15s ease,
    background .15s ease,
    transform .15s ease;
}

.preview-tool-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

.preview-tool-btn:active {
  transform: translateY(1px);
}

.preview-tool-btn.active {
  color: #fff;
  background: #2563eb;
  box-shadow: 0 5px 14px rgba(37, 99, 235, .28);
}

.preview-tool-btn svg {
  width: 15px;
  height: 15px;
}

.preview-zoom-slider {
  height: 40px;
  min-width: 300px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #39445d;
  border-radius: 14px;
  background: #151b29;
}

.preview-zoom-slider button,
.preview-icon-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #e2e8f0;
  background: transparent;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition:
    color .15s ease,
    background .15s ease,
    transform .15s ease;
}

.preview-zoom-slider button,
.preview-icon-btn {
  transition:
    color .15s ease,
    background .15s ease,
    border-color .15s ease,
    transform .1s ease;
}

.preview-zoom-slider button:hover,
.preview-icon-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, .1);
  border-color: #4d5c82;
}

.preview-zoom-slider button:active,
.preview-icon-btn:active {
  transform: translateY(1px) scale(.96);
}

.preview-zoom-slider input[type="range"] {
  width: 135px;
  min-width: 90px;
  height: 4px;
  margin: 0;
  border: 0;
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  background: #3b4459;
  cursor: pointer;
}

.preview-zoom-slider input[type="range"]::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid #eaf0ff;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  background: #eaf0ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .22);
}

.preview-zoom-slider input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid #eaf0ff;
  border-radius: 50%;
  background: #eaf0ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .22);
}

.preview-zoom-slider span {
  min-width: 42px;
  color: #d8deeb;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.preview-icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid #39445d;
  border-radius: 13px;
  background: #151b29;
}

.preview-icon-btn svg {
  width: 18px;
  height: 18px;
}

.preview-close-btn {
  color: #aeb8cf;
}

.preview-close-btn:hover {
  color: #fff;
  background: rgba(239, 68, 68, .18);
}

.preview-workspace-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: 14px 24px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-workspace-body embed {
  width: min(1180px, 100%);
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 22px 55px rgba(0, 0, 0, .38);
}

.preview-image-stage {
  width: min(1180px, 100%);
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-image-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
}

.preview-image-wrap img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 22px 34px rgba(0, 0, 0, .38));
}

/* Librería ImageZoom */
.image-zoom-wrapper {
  touch-action: none;
}

.image-zoom-img {
  will-change: transform;
}

/* Librería ImageLupa */
.image-lupa-lens {
  position: absolute;
  z-index: 16;
  border: 3px solid #fff;
  border-radius: 50%;
  pointer-events: none;
  background-repeat: no-repeat;
  background-color: #0b0d12;
  box-shadow:
    0 5px 28px rgba(0, 0, 0, .52),
    0 0 0 1px rgba(0, 0, 0, .18),
    0 0 0 6px rgba(37, 99, 235, .18);
  opacity: 0;
  transition: opacity .12s ease-out;
}

.lupa-active {
  cursor: none;
}

.lupa-active .preview-image-wrap,
.lupa-active.preview-image-wrap {
  cursor: none;
}

@media (max-width: 980px) {
  .preview-workspace-toolbar {
    align-items: center;
  }

  .preview-toolbar-spacer {
    display: none;
  }

  .preview-zoom-slider {
    min-width: 260px;
  }
}

@media (max-width: 720px) {
  .preview-workspace-toolbar {
    min-height: auto;
    padding: 10px;
    gap: 8px;
  }

  .preview-workspace-fields {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .preview-manual-field input,
  .preview-manual-field-monto input {
    width: 100%;
  }

  .preview-tools {
    flex: 1 1 auto;
  }

  .preview-zoom-slider {
    order: 4;
    width: 100%;
    min-width: 0;
  }

  .preview-zoom-slider input[type="range"] {
    flex: 1 1 auto;
    width: auto;
  }

  .preview-workspace-body {
    padding: 10px;
  }
}

@media (max-width: 460px) {
  .preview-workspace-fields {
    grid-template-columns: 1fr;
  }

  .preview-tool-btn {
    flex: 1 1 0;
  }

  .preview-tools {
    width: calc(100% - 96px);
  }
}

.preview-pdf-loading {
  position: absolute;
  min-width: 220px;
  padding: 14px 18px;
  border: 1px solid #39445d;
  border-radius: 14px;
  color: #dbe5ff;
  background: #151b29;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
}

.preview-image-wrap img[hidden] {
  display: none;
}

/* ============================================================
   EDITAR FACTURA — AJUSTES VISUALES
   Solo afecta al modal de edición en Buscar.
   ============================================================ */

.edit-invoice-modal {
  max-width: 980px !important;
  width: min(980px, calc(100vw - 28px));
  padding: 18px 18px 0;
  overflow: hidden;
}

.edit-invoice-header {
  padding-bottom: 10px;
}

.edit-invoice-body {
  margin-top: 8px;
  max-height: calc(100vh - 190px);
  overflow: auto;
  padding: 0;
}

/* Saca aire superior y sube la vista previa */
.edit-invoice-modal .factura-row {
  box-shadow: none;
  border: 1px solid rgba(5, 205, 153, .28);
  border-radius: 18px;
  overflow: hidden;
}

.edit-invoice-modal .factura-row-main {
  padding: 10px 14px;
  align-items: center;
}

.edit-invoice-modal .factura-row-expanded {
  grid-template-columns: 240px 1fr;
  align-items: start;
  background: #f4f7fd;
}

.edit-invoice-modal .factura-preview-panel {
  padding: 10px 14px 14px;
  align-items: flex-start;
  justify-content: center;
  min-height: 420px;
}

.edit-invoice-modal .factura-preview-panel iframe {
  height: 410px !important;
}

.edit-invoice-modal .factura-preview-img {
  max-width: 210px;
  width: 100%;
  max-height: 390px;
  object-fit: contain;
  object-position: top center;
}

.edit-invoice-modal .factura-fields-panel {
  padding: 14px 18px 18px;
}

.edit-invoice-modal .factura-fields-grid {
  gap: 12px 12px;
}

.edit-invoice-modal .factura-detalles-panel {
  margin-top: 18px !important;
}

/* Botones inferiores más separados y prolijos */
.edit-invoice-actions {
  margin: 0 -18px;
  padding: 16px 18px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, .96);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
}

.edit-invoice-actions .btn {
  min-width: 132px;
  justify-content: center;
}

.edit-cancel-btn {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid rgba(5, 150, 105, .25);
}

.edit-save-btn {
  box-shadow: 0 10px 22px rgba(37, 99, 235, .28);
}

.buscar-tipo-toggle {
  margin: 12px 0 14px;
}

@media (max-width: 760px) {
  .edit-invoice-modal {
    width: calc(100vw - 18px);
  }

  .edit-invoice-modal .factura-row-expanded {
    grid-template-columns: 1fr;
  }

  .edit-invoice-modal .factura-preview-panel {
    min-height: auto;
  }

  .edit-invoice-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .edit-invoice-actions .btn {
    width: 100%;
  }
}

/* ============================================================
   BUSCAR — Toggle Compras / Ventas corregido
   Solo afecta al apartado Buscar.
   ============================================================ */

.buscar-tipo-toggle {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 230px;
  height: 42px;
  padding: 4px;
  margin: 12px 0 16px;
  border-radius: 999px;
  background: #f4f7fd;
  border: 1px solid rgba(148, 163, 184, .28);
  overflow: hidden;
}

.buscar-tipo-toggle .tipo-slider {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: auto;
  border-radius: 999px;
background: #2563eb;
box-shadow: 0 8px 18px rgba(37, 99, 235, .32);
  transition:
    left .22s ease,
    width .22s ease,
    transform .22s ease;
  z-index: 1;
}

.buscar-tipo-toggle .tipo-slider.tipo-slider-venta {
  background: #05c999;
  box-shadow: 0 8px 18px rgba(5, 201, 153, .28);
}

.buscar-tipo-toggle .tipo-slider.tipo-slider-compra {
  background: #2563eb;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .32);
}


.buscar-tipo-toggle .tipo-toggle-btn {
  position: relative;
  z-index: 2;
  height: 34px;
  min-width: 0;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent !important;
  box-shadow: none !important;
  color: #9aa8cc;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.buscar-tipo-toggle .tipo-toggle-btn svg,
.buscar-tipo-toggle .tipo-toggle-btn i {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.buscar-tipo-toggle .tipo-toggle-btn.active {
  color: #ffffff !important;
}

.buscar-tipo-toggle .tipo-toggle-btn:not(.active):hover {
  color: #25356f;
}
/* ============================================================
   VISOR — Zoom/Lupa precisos
   No se rota con CSS. La rotación se genera como imagen temporal.
   ============================================================ */

.preview-image-wrap {
  transform-origin: center center;
  transition: none !important;
  will-change: auto;
}

.preview-image-wrap img#previewImage {
  transform-origin: center center;
  transition: none !important;
  will-change: auto;
}

.preview-image-wrap-rotated {
  width: auto !important;
  height: auto !important;
}

.preview-image-wrap.is-lupa-active img#previewImage {
  cursor: none;
}
.cambio-calculado-box,
.cambio-calculado-inline {
  margin-top: 7px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, .15);
  background: #f8fbff;
  color: #25356f;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.45;
}

.cambio-calculado-inline {
  font-size: 11px;
}

.cambio-calculado-warning {
  color: #dc2626;
  font-weight: 800;
}

.cambio-calculado-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
}

.cambio-calculado-grid span:first-child {
  grid-column: 1 / -1;
  color: #1d4ed8;
}

@media (max-width: 700px) {
  .cambio-calculado-grid {
    grid-template-columns: 1fr;
  }
}
.btn-aplicar-cambio {
  margin-top: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid rgba(37, 99, 235, .22);
}

.btn-aplicar-cambio:hover {
  background: #dbeafe;
}

/* ============================================================
   MARCA PRODATO — logos del sistema
   Solo cambia la identidad visual en login y barra lateral.
   ============================================================ */

.sidebar-brand {
  gap: 9px;
}

.sidebar-brand-logo {
  width: 132px;
  height: auto;
  max-height: 36px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.sidebar-brand-icon-compact {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: contain;
  display: none;
}

.sidebar-brand-title {
  display: none !important;
}

.sidebar.collapsed .sidebar-brand-logo {
  display: none;
}

.sidebar.collapsed .sidebar-brand-icon-compact {
  display: block;
}

.sidebar:not(.collapsed) .sidebar-brand-icon-compact {
  display: none;
}

.login-panel-logo {
  margin-bottom: 34px;
}

.login-prodato-logo {
  width: 142px;
  height: auto;
  max-height: 48px;
  object-fit: contain;
  display: block;
}

@media (max-width: 900px) {
  .login-prodato-logo {
    width: 132px;
  }
}


/* ============================================================
   MARCA PRODATO — logos del sistema
   Solo cambia la identidad visual en login y barra lateral.
   ============================================================ */

.sidebar-brand {
  gap: 9px;
}

.sidebar-brand-logo {
  width: 132px;
  height: auto;
  max-height: 36px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.sidebar-brand-icon-compact {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: contain;
  display: none;
}

.sidebar-brand-title {
  display: none !important;
}

.sidebar.collapsed .sidebar-brand-logo {
  display: none;
}

.sidebar.collapsed .sidebar-brand-icon-compact {
  display: block;
}

.sidebar:not(.collapsed) .sidebar-brand-icon-compact {
  display: none;
}

.login-panel-logo {
  margin-bottom: 34px;
}

.login-prodato-logo {
  width: 142px;
  height: auto;
  max-height: 48px;
  object-fit: contain;
  display: block;
}

@media (max-width: 900px) {
  .login-prodato-logo {
    width: 132px;
  }
}

/* ============================================================
   AVISO INICIAL DEL TUTORIAL
   Aparece al iniciar sesión y guía al botón de ayuda.
   ============================================================ */

.tutorial-welcome-popover {
  position: fixed;
  top: 86px;
  right: 24px;
  width: min(330px, calc(100vw - 32px));
  z-index: 9999;
  padding: 18px 18px 16px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow:
    0 24px 60px rgba(15, 23, 42, .22),
    0 0 0 1px rgba(148, 163, 184, .16);
  animation: tutorialWelcomeIn .22s ease-out;
}

.tutorial-welcome-popover::before {
  content: "";
  position: absolute;
  top: -10px;
  right: 38px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  transform: rotate(45deg);
  border-left: 1px solid rgba(148, 163, 184, .16);
  border-top: 1px solid rgba(148, 163, 184, .16);
}

.tutorial-welcome-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #9aa8cc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tutorial-welcome-close:hover {
  background: #f1f5f9;
  color: #1e3a8a;
}

.tutorial-welcome-text {
  padding-right: 22px;
  color: #52658f;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.tutorial-welcome-text b {
  color: #1d4ed8;
  font-weight: 900;
}

.tutorial-welcome-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.tutorial-welcome-secondary,
.tutorial-welcome-primary {
  height: 38px;
  border-radius: 10px;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.tutorial-welcome-secondary {
  background: #f5f8ff;
  border: 1px solid #dbe4f0;
  color: #25356f;
}

.tutorial-welcome-primary {
  background: #2563eb;
  border: 1px solid #2563eb;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .25);
}

.tutorial-welcome-primary:hover {
  background: #1d4ed8;
}

@keyframes tutorialWelcomeIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 720px) {
  .tutorial-welcome-popover {
    top: 72px;
    right: 16px;
    left: 16px;
    width: auto;
  }

  .tutorial-welcome-popover::before {
    right: 28px;
  }

  .tutorial-welcome-actions {
    flex-direction: column;
  }

  .tutorial-welcome-secondary,
  .tutorial-welcome-primary {
    width: 100%;
  }
}

/* ============================================================
   TUTORIAL GUIADO — FORMATO RESTAURADO
   ============================================================ */

.tutorial-backdrop {
  background: rgba(15, 23, 42, .34) !important;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 9998;
}

.tutorial-modal-card {
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100vh - 42px);
  overflow: auto;
  padding: 20px 22px 18px;
  border-radius: 24px;
  background: #ffffff;
  box-shadow:
    0 24px 70px rgba(15, 23, 42, .22),
    0 0 0 1px rgba(148, 163, 184, .14);
}

.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 14px;
}

.tutorial-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.tutorial-icon,
.tutorial-step-icon {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: #eaf2ff;
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.tutorial-title {
  margin: 0;
  font-size: 19px;
  font-weight: 900;
  color: #172554;
}

.tutorial-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: #64748b;
  line-height: 1.35;
}

.tutorial-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f1f5f9;
  color: #1e3a8a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tutorial-close:hover {
  background: #e2e8f0;
}

.tutorial-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 10px;
}

.tutorial-progress div {
  height: 100%;
  border-radius: inherit;
  background: #1d4ed8;
  transition: width .22s ease;
}

.tutorial-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.tutorial-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #cbd5e1;
}

.tutorial-dots span.active {
  background: #1d4ed8;
  transform: scale(1.18);
}

.tutorial-step-card {
  border: 1px solid #dbe4f0;
  background: #f8fbff;
  border-radius: 18px;
  padding: 18px;
  min-height: 220px;
  display: grid;
  gap: 10px;
}

.tutorial-step-index {
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.tutorial-step-title {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  color: #1e2b64;
}

.tutorial-step-desc {
  margin: 0;
  color: #52658f;
  font-size: 14px;
  line-height: 1.45;
}

.tutorial-demo-box {
  margin-top: 4px;
  border: 1px dashed #b6c7ea;
  background: #ffffff;
  border-radius: 14px;
  padding: 12px;
  min-height: 58px;
  display: flex;
  align-items: center;
}

.tutorial-actions {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.tutorial-actions .btn {
  justify-content: center;
}

.tutorial-btn-prev {
  background: #f1f5f9;
  color: #64748b;
  box-shadow: none;
}

.tutorial-btn-prev:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.tutorial-btn-next {
  box-shadow: 0 10px 24px rgba(37, 99, 235, .28);
}

.tutorial-counter {
  color: #475569;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .tutorial-modal-card {
    padding: 18px 16px;
  }

  .tutorial-actions {
    grid-template-columns: 1fr;
  }

  .tutorial-counter {
    text-align: center;
  }
}

/* ============================================================
   TUTORIAL GUIADO — RESTAURACIÓN FINAL
   Solo afecta ayuda/tutorial y aviso inicial.
   ============================================================ */

.tutorial-backdrop {
  background: rgba(15, 23, 42, .34) !important;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 9998 !important;
}

.tutorial-modal-card {
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100vh - 42px);
  overflow: auto;
  padding: 20px 22px 18px;
  border-radius: 24px;
  background: #ffffff;
  color: #1e2b64;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .22), 0 0 0 1px rgba(148, 163, 184, .14);
}

.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 14px;
}

.tutorial-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.tutorial-icon,
.tutorial-step-icon {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: #eaf2ff;
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.tutorial-title {
  margin: 0;
  font-size: 19px;
  font-weight: 900;
  color: #172554;
}

.tutorial-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: #64748b;
  line-height: 1.35;
}

.tutorial-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f1f5f9;
  color: #1e3a8a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tutorial-close:hover {
  background: #e2e8f0;
}

.tutorial-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 10px;
}

.tutorial-progress div {
  height: 100%;
  border-radius: inherit;
  background: #1d4ed8;
  transition: width .22s ease;
}

.tutorial-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.tutorial-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #cbd5e1;
}

.tutorial-dots span.active {
  background: #1d4ed8;
  transform: scale(1.18);
}

.tutorial-step-card {
  border: 1px solid #dbe4f0;
  background: #f8fbff;
  border-radius: 18px;
  padding: 18px;
  min-height: 220px;
  display: grid;
  gap: 10px;
}

.tutorial-step-index {
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.tutorial-step-title {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  color: #1e2b64;
}

.tutorial-step-desc {
  margin: 0;
  color: #52658f;
  font-size: 14px;
  line-height: 1.45;
}

.tutorial-demo-box {
  margin-top: 4px;
  border: 1px dashed #b6c7ea;
  background: #ffffff;
  border-radius: 14px;
  padding: 12px;
  min-height: 58px;
  display: flex;
  align-items: center;
}

.tutorial-demo-toggle {
  display: inline-flex;
  border-radius: 999px;
  background: #eef3fb;
  border: 1px solid #dbe4f0;
  overflow: hidden;
}

.tutorial-demo-toggle span {
  padding: 8px 14px;
  font-size: 12px;
  color: #7c8bb4;
  font-weight: 800;
}

.tutorial-demo-toggle span.active {
  background: #2563eb;
  color: #ffffff;
}

.tutorial-demo-row,
.tutorial-demo-grid {
  width: 100%;
  display: grid;
  gap: 8px;
}

.tutorial-demo-row {
  grid-template-columns: 1fr auto;
}

.tutorial-demo-grid {
  grid-template-columns: 1fr 1fr;
}

.tutorial-demo-input,
.tutorial-demo-btn,
.tutorial-demo-drop,
.tutorial-demo-card,
.tutorial-demo-actions span {
  border-radius: 12px;
  border: 1px solid #dbe4f0;
  background: #f8fbff;
  color: #52658f;
  font-size: 12px;
  font-weight: 700;
  padding: 10px 12px;
}

.tutorial-demo-btn,
.tutorial-demo-primary {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}

.tutorial-demo-drop {
  width: 100%;
  border-style: dashed;
  text-align: center;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.tutorial-demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tutorial-demo-actions span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tutorial-demo-status {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 900;
}

.tutorial-demo-status .ok {
  color: #16a34a;
}

.tutorial-demo-card {
  display: grid;
  gap: 4px;
}

.tutorial-demo-card b {
  color: #1e2b64;
}

.tutorial-actions {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.tutorial-actions .btn {
  justify-content: center;
}

.tutorial-btn-prev {
  background: #f1f5f9 !important;
  color: #64748b !important;
  box-shadow: none !important;
}

.tutorial-btn-prev:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.tutorial-btn-next {
  box-shadow: 0 10px 24px rgba(37, 99, 235, .28);
}

.tutorial-counter {
  color: #475569;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.tutorial-welcome-popover {
  position: fixed;
  top: 86px;
  right: 24px;
  width: min(330px, calc(100vw - 32px));
  z-index: 9999;
  padding: 18px 18px 16px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22), 0 0 0 1px rgba(148, 163, 184, .16);
  animation: tutorialWelcomeIn .22s ease-out;
}

.tutorial-welcome-popover::before {
  content: "";
  position: absolute;
  top: -10px;
  right: 38px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  transform: rotate(45deg);
  border-left: 1px solid rgba(148, 163, 184, .16);
  border-top: 1px solid rgba(148, 163, 184, .16);
}

.tutorial-welcome-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #9aa8cc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tutorial-welcome-close:hover {
  background: #f1f5f9;
  color: #1e3a8a;
}

.tutorial-welcome-text {
  padding-right: 22px;
  color: #52658f;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.tutorial-welcome-text b {
  color: #1d4ed8;
  font-weight: 900;
}

.tutorial-welcome-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.tutorial-welcome-secondary,
.tutorial-welcome-primary {
  height: 38px;
  border-radius: 10px;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.tutorial-welcome-secondary {
  background: #f5f8ff;
  border: 1px solid #dbe4f0;
  color: #25356f;
}

.tutorial-welcome-primary {
  background: #2563eb;
  border: 1px solid #2563eb;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .25);
}

.tutorial-welcome-primary:hover {
  background: #1d4ed8;
}

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

@media (max-width: 620px) {
  .tutorial-modal-card {
    padding: 18px 16px;
  }

  .tutorial-demo-grid,
  .tutorial-demo-row,
  .tutorial-actions {
    grid-template-columns: 1fr;
  }

  .tutorial-counter {
    text-align: center;
  }
}

@media (max-width: 720px) {
  .tutorial-welcome-popover {
    top: 72px;
    right: 16px;
    left: 16px;
    width: auto;
  }

  .tutorial-welcome-popover::before {
    right: 28px;
  }

  .tutorial-welcome-actions {
    flex-direction: column;
  }

  .tutorial-welcome-secondary,
  .tutorial-welcome-primary {
    width: 100%;
  }
}


/* ============================================================
   BUSCAR — Toggle Compras / Ventas estable
   Evita movimientos al filtrar por número, proveedor o RUC.
   ============================================================ */

.buscar-tipo-toggle .tipo-slider {
  left: 4px !important;
  width: calc(50% - 4px) !important;
}

.buscar-tipo-toggle .tipo-slider.tipo-slider-compra {
  left: 4px !important;
  background: #2563eb;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .32);
}

.buscar-tipo-toggle .tipo-slider.tipo-slider-venta {
  left: calc(50% + 0px) !important;
  background: #05c999;
  box-shadow: 0 8px 18px rgba(5, 201, 153, .28);
}

/* ============================================================
   BUSCAR — Columna Tipo con colores iguales al toggle
   ============================================================ */

.results-table .tipo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: lowercase;
  border: 1px solid transparent;
}

.results-table .tipo-badge-compra {
  background: #2563eb;
  color: #ffffff;
  border-color: rgba(37, 99, 235, .25);
  box-shadow: 0 6px 14px rgba(37, 99, 235, .22);
}

.results-table .tipo-badge-venta {
  background: #05c999;
  color: #ffffff;
  border-color: rgba(5, 201, 153, .25);
  box-shadow: 0 6px 14px rgba(5, 201, 153, .22);
}