 :root {
   --bg: #f4f8ff;
   --panel: #ffffff;
   --panel-soft: #f1f5ff;
   --muted: #5c6f90;
   --primary: #1f6bff;
   --primary-strong: #0f56ea;
   --accent: #9cc2ff;
   --font: "Space Grotesk", "Segoe UI Semibold", "Helvetica Neue", sans-serif;
 }

 * {
   box-sizing: border-box;
 }

 body {
   margin: 0;
   min-height: 100vh;
   background: radial-gradient(circle at 15% 10%, rgba(31, 107, 255, 0.08), transparent 35%),
     radial-gradient(circle at 85% 5%, rgba(31, 107, 255, 0.12), transparent 40%),
     var(--bg);
   color: #0f1b33;
   font-family: var(--font);
 }

 .muted {
   color: var(--muted);
 }

 .hidden {
   display: none !important;
 }

 .branch-topbar {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 18px 28px;
   background: rgba(255, 255, 255, 0.9);
   border-bottom: 1px solid rgba(15, 27, 51, 0.08);
   position: sticky;
   top: 0;
   z-index: 10;
   backdrop-filter: blur(10px);
 }

 .branch-topbar-title {
   font-weight: 800;
   font-size: 20px;
 }

 .branch-topbar-store {
   display: block;
   color: var(--primary);
   font-weight: 700;
   font-size: 14px;
   letter-spacing: 0.5px;
   margin-top: 4px;
 }

 .branch-shell {
   max-width: 1200px;
   margin: 0 auto;
   padding: 24px 28px 56px;
   display: flex;
   flex-direction: column;
   gap: 24px;
 }

 .branch-hero {
   display: flex;
   justify-content: space-between;
   align-items: center;
   gap: 16px;
 }

 .branch-hero h1 {
   margin: 8px 0 0;
   font-size: 32px;
 }

 .branch-hero-actions {
   display: flex;
   gap: 10px;
   flex-wrap: wrap;
   justify-content: flex-end;
   align-items: center;
 }

 .pill {
   border-radius: 999px;
   padding: 10px 18px;
   border: 1px solid rgba(15, 27, 51, 0.12);
   background: #ffffff;
   color: inherit;
   font-weight: 700;
   cursor: pointer;
 }

 .pill.solid {
   background: linear-gradient(135deg, var(--primary), var(--primary-strong));
   color: #ffffff;
   border: none;
 }

 .pill-blue {
   background: linear-gradient(135deg, #1f6bff, #0f56ea);
   border-color: #0f56ea;
   color: #ffffff;
   box-shadow: 0 10px 18px rgba(31, 107, 255, 0.25);
   transition: transform 0.15s ease, box-shadow 0.15s ease;
 }

 .pill-blue:hover {
   transform: translateY(-1px);
   box-shadow: 0 14px 22px rgba(31, 107, 255, 0.3);
 }

 .pill-blue:active {
   transform: translateY(0);
   box-shadow: 0 8px 16px rgba(31, 107, 255, 0.2);
 }

 .pill.ghost {
   background: rgba(31, 107, 255, 0.08);
 }

 .pill-green {
   background: linear-gradient(135deg, #22c55e, #16a34a);
   border-color: #14803d;
   color: #ffffff;
   box-shadow: 0 10px 18px rgba(34, 197, 94, 0.25);
   transition: transform 0.15s ease, box-shadow 0.15s ease;
 }

 .pill-green:hover {
   transform: translateY(-1px);
   box-shadow: 0 14px 22px rgba(34, 197, 94, 0.3);
 }

 .pill-green:active {
   transform: translateY(0);
   box-shadow: 0 8px 16px rgba(34, 197, 94, 0.2);
 }

 .branch-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
   gap: 16px;
 }

 .branch-card {
   background: var(--panel);
   padding: 18px;
   border-radius: 16px;
   display: flex;
   flex-direction: column;
   gap: 8px;
   box-shadow: 0 12px 24px rgba(15, 27, 51, 0.08);
 }

 .branch-card strong {
   font-size: 22px;
 }

 .branch-meta {
   font-size: 13px;
   color: var(--muted);
 }

 .branch-panels {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
   gap: 18px;
 }

 .branch-panel {
   background: var(--panel-soft);
   border-radius: 18px;
   padding: 18px;
   border: 1px solid rgba(15, 27, 51, 0.08);
 }

 .panel-head {
   display: flex;
   justify-content: space-between;
   align-items: center;
   gap: 10px;
   margin-bottom: 14px;
 }

 .ticket-list {
   list-style: none;
   margin: 0;
   padding: 0;
   display: flex;
   flex-direction: column;
   gap: 10px;
 }

 .ticket {
   padding: 12px 14px;
   border-radius: 12px;
   background: #ffffff;
   border: 1px solid rgba(15, 27, 51, 0.08);
   box-shadow: 0 10px 20px rgba(15, 27, 51, 0.08);
   font-weight: 700;
   color: #0f1b33;
 }

 .ticket-head {
   display: flex;
   justify-content: space-between;
   gap: 10px;
   margin-bottom: 6px;
   font-size: 13px;
 }

 .ticket-items {
   display: grid;
   gap: 2px;
   font-size: 13px;
   color: var(--muted);
 }

 .ticket-total {
   margin-top: 8px;
   display: flex;
   justify-content: flex-end;
   font-weight: 800;
   color: var(--primary);
 }

 .overlay {
   position: fixed;
   inset: 0;
   background: rgba(15, 27, 51, 0.35);
   display: flex;
   align-items: center;
   justify-content: center;
   padding: 24px;
   z-index: 30;
 }

 .overlay.hidden {
   display: none;
 }

 .overlay-card {
   background: #ffffff;
   border-radius: 18px;
   padding: 22px;
   width: min(420px, 100%);
   border: 1px solid rgba(15, 27, 51, 0.08);
   box-shadow: 0 24px 60px rgba(15, 27, 51, 0.22);
 }

 .overlay-card.wide {
   width: min(720px, 96vw);
 }

 .overlay-head {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 12px;
 }

 .overlay-time {
   font-size: 12px;
   text-transform: uppercase;
   letter-spacing: 0.6px;
   color: var(--muted);
   font-weight: 700;
 }

 .overlay-store {
   font-size: 18px;
   font-weight: 800;
   color: #0f1b33;
 }

 .overlay-ticket {
   font-size: 13px;
   font-weight: 700;
   color: var(--muted);
 }

 .close-btn {
   border: none;
   background: transparent;
   color: #0f1b33;
   font-size: 24px;
   float: right;
   cursor: pointer;
 }

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

 .form-field {
   display: grid;
   gap: 6px;
   font-size: 13px;
   font-weight: 700;
   color: var(--muted);
 }

 .form-field input {
   border-radius: 12px;
   border: 1px solid rgba(15, 27, 51, 0.12);
   padding: 10px 12px;
   font-size: 14px;
   font-family: var(--font);
   color: #0f1b33;
   background: #ffffff;
   box-shadow: 0 8px 18px rgba(15, 27, 51, 0.08);
 }

 .form-field input:focus {
   outline: none;
   border-color: rgba(31, 107, 255, 0.5);
   box-shadow: 0 10px 22px rgba(31, 107, 255, 0.18);
 }

 .form-field.checkbox-field {
   grid-column: 1 / -1;
   display: flex;
   align-items: center;
   gap: 10px;
   font-weight: 600;
 }

 .form-field.checkbox-field input[type="checkbox"] {
   margin: 0;
 }

 .form-actions {
   grid-column: 1 / -1;
   display: flex;
   flex-wrap: wrap;
   gap: 10px;
   justify-content: flex-end;
 }

 .alert {
   padding: 10px 12px;
   border-radius: 12px;
   font-weight: 700;
 }

 .alert.success {
   background: rgba(34, 197, 94, 0.12);
   border: 1px solid rgba(34, 197, 94, 0.25);
   color: #166534;
 }

 .branch-switch-list {
   display: flex;
   flex-direction: column;
   gap: 10px;
   margin-top: 16px;
 }

 .branch-switch-item {
   border-radius: 12px;
   padding: 12px;
   background: #ffffff;
   border: 1px solid rgba(15, 27, 51, 0.08);
   cursor: pointer;
 }

 .staff-list {
   display: flex;
   flex-direction: column;
   gap: 10px;
   margin-top: 16px;
 }

 .staff-item {
   padding: 12px;
   border-radius: 12px;
   background: #ffffff;
   border: 1px solid rgba(15, 27, 51, 0.08);
   display: flex;
   justify-content: space-between;
   align-items: center;
 }

 .staff-item strong {
   font-size: 15px;
 }

 .mini-login {
   display: grid;
   gap: 10px;
   margin-top: 12px;
 }

 .mini-login.hidden {
   display: none;
 }

 .mini-login label {
   display: grid;
   gap: 6px;
   font-size: 13px;
   color: var(--muted);
 }

 .mini-login input {
   border-radius: 10px;
   border: 1px solid rgba(15, 27, 51, 0.12);
   padding: 10px 12px;
   font-size: 14px;
 }

 .mini-login-msg {
   font-size: 12px;
   color: var(--muted);
 }

 @media (max-width: 720px) {
   .branch-hero {
     flex-direction: column;
     align-items: flex-start;
   }

   .branch-topbar {
     flex-direction: column;
     align-items: flex-start;
     gap: 8px;
   }
 }

 /* Reports Styles */
 .report-tabs {
   display: flex;
   gap: 8px;
   background: rgba(15, 27, 51, 0.05);
   padding: 4px;
   border-radius: 999px;
 }

 .tab-btn {
   border: none;
   background: transparent;
   padding: 6px 16px;
   border-radius: 999px;
   font-size: 13px;
   font-weight: 700;
   color: var(--muted);
   cursor: pointer;
   transition: all 0.2s ease;
 }

 .tab-btn.active {
   background: #ffffff;
   color: var(--primary);
   box-shadow: 0 4px 12px rgba(15, 27, 51, 0.08);
 }

 .report-body {
   margin-top: 20px;
 }

 .tab-content.hidden {
   display: none;
 }

 .report-summary-grid {
   display: grid;
   grid-template-columns: repeat(3, 1fr);
   gap: 12px;
   margin-bottom: 24px;
 }

 .summary-box {
   background: var(--panel-soft);
   padding: 16px;
   border-radius: 14px;
   display: flex;
   flex-direction: column;
   gap: 4px;
 }

 .summary-box strong {
   font-size: 18px;
   color: var(--primary);
 }

 .report-list {
   display: flex;
   flex-direction: column;
   gap: 10px;
   margin-top: 12px;
   max-height: 450px;
   overflow-y: auto;
   padding-right: 8px;
 }

 .report-list::-webkit-scrollbar {
   width: 6px;
 }

 .report-list::-webkit-scrollbar-track {
   background: transparent;
 }

 .report-list::-webkit-scrollbar-thumb {
   background: rgba(15, 27, 51, 0.1);
   border-radius: 10px;
 }

 .product-report-list .ticket-items {
   grid-template-columns: 1fr auto;
 }

 /* Ticket Printing Styles */
 #printArea {
   display: none;
 }

 @media print {
   @page {
     size: auto;
     margin: 0mm !important;
   }

   html,
   body {
     margin: 0 !important;
     padding: 0 !important;
     height: auto !important;
     min-height: 0 !important;
     background: #ffffff !important;
     color: #000000 !important;
     overflow: visible !important;
   }

   body>*:not(#printArea):not(iframe) {
     display: none !important;
     height: 0 !important;
     max-height: 0 !important;
     overflow: hidden !important;
     visibility: hidden !important;
   }

   #printArea {
     display: block !important;
     visibility: visible !important;
     position: static !important;
     width: 58mm !important;
     max-width: 58mm !important;
     margin: 0 auto !important;
     padding: 1.5mm 0 6mm 0 !important;
     background: #ffffff !important;
     color: #000000 !important;
     page-break-inside: avoid !important;
     break-inside: avoid !important;
     page-break-after: avoid !important;
     break-after: avoid !important;
   }

   #printArea * {
     visibility: visible !important;
   }
 }

 .ticket-print {
   font-family: 'Courier New', Courier, monospace;
   font-size: 12px;
   line-height: 1.25;
   width: 58mm;
   max-width: 58mm;
   padding: 3mm 2mm 5mm 2mm;
   margin: 0 auto;
   background: white;
   color: black;
   box-sizing: border-box;
   page-break-inside: avoid;
   break-inside: avoid;
   page-break-after: avoid;
   break-after: avoid;
 }

 .ticket-print h2 {
   font-size: 14px;
   text-align: center;
   margin: 0 0 5px;
   text-transform: uppercase;
 }

 .ticket-print .center {
   text-align: center;
 }

 .ticket-print .separator {
   border-top: 1px dashed #000;
   margin: 5px 0;
 }

 .ticket-print .line {
   display: flex;
   justify-content: space-between;
 }

 .ticket-print .items {
   margin: 5px 0;
 }

 /* --- Optimización Mobile Branch View --- */
 @media (max-width: 640px) {
   .branch-topbar {
     padding: 10px 15px !important;
     height: auto !important;
     flex-direction: column;
     align-items: flex-start !important;
     gap: 12px !important;
   }

   .branch-topbar-right {
     width: 100%;
     display: flex;
     justify-content: space-between;
     gap: 8px;
   }

   .branch-topbar-right .pill {
     flex: 1;
     font-size: 11px !important;
     padding: 6px 4px !important;
   }

   .branch-hero {
     padding: 25px 15px !important;
     text-align: center;
   }

   .branch-hero-actions {
     display: grid !important;
     grid-template-columns: 1fr 1fr;
     gap: 10px;
     margin-top: 20px;
   }

   .branch-hero-actions .pill {
     width: 100% !important;
     margin: 0 !important;
     font-size: 12px !important;
     padding: 12px 6px !important;
   }

   .branch-grid {
     grid-template-columns: 1fr !important;
     padding: 0 15px 20px !important;
   }

   .overlay-card {
     width: 95vw !important;
     margin: 10px auto !important;
     padding: 20px 15px !important;
     border-radius: 16px !important;
   }

   .form-grid {
     grid-template-columns: 1fr !important;
   }
 }

 .search-item {
   padding: 10px 14px;
   cursor: pointer;
   border-bottom: 1px solid #f3f4f6;
   transition: background 0.1s;
 }

 .search-item:hover {
   background-color: #f3f4f6;
 }

 /* ─── Movimientos de Fondo y Extra ─────────────────────────────────────── */
 .cash-flow-type-btn {
   transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
 }

 .cash-flow-type-btn:hover {
   transform: translateY(-1px);
   box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
 }

 .cash-flow-type-btn.active {
   border-color: #2563eb !important;
   background: #eff6ff !important;
   color: #1e40af !important;
   box-shadow: 0 4px 14px rgba(37, 99, 235, 0.15) !important;
 }

 .cash-quick-btn {
   transition: all 0.15s ease;
 }

 .cash-quick-btn:hover {
   background: #f1f5f9 !important;
   border-color: #94a3b8 !important;
   transform: translateY(-1px);
 }

 .cash-quick-btn:active {
   transform: translateY(0);
 }

 .cash-movement-item {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 8px 12px;
   background: white;
   border-radius: 8px;
   border: 1px solid #e2e8f0;
   transition: background 0.15s ease;
 }

 .cash-movement-item:hover {
   background: #f8fafc;
 }

 /* ─── Traspasos de Mercancía (Vista de sucursal) ───────────────────────── */
 .invoice-table-wrap {
   max-height: 60vh;
   width: 100%;
   overflow-x: auto;
   -webkit-overflow-scrolling: touch;
 }

 .invoice-table {
   width: 100%;
   border-collapse: collapse;
   font-size: 13px;
   background: #ffffff;
   border: 1px solid #e2e8f0;
   border-radius: 10px;
   overflow: hidden;
 }

 .invoice-table th,
 .invoice-table td {
   padding: 10px 12px;
   text-align: left;
   border: 1px solid #e2e8f0;
   color: #0f172a;
 }

 .invoice-table thead {
   background: #f1f5f9;
   font-weight: 800;
 }

 .invoice-table tbody tr:nth-child(odd) {
   background: #f8fafc;
 }

 .invoice-table tfoot td {
   font-weight: 800;
   background: #ecfdf5;
 }

 .stock-badge {
   display: inline-flex;
   align-items: center;
   justify-content: center;
   padding: 6px 12px;
   border-radius: 8px;
   background: #eff6ff;
   border: 1px solid #bfdbfe;
   color: #1e40af;
   font-weight: 700;
   white-space: nowrap;
 }

 .stock-search-results {
   position: absolute;
   top: 100%;
   left: 0;
   width: 100%;
   margin-top: 6px;
   background: #ffffff;
   color: #0f172a;
   border: 1px solid #cbd5e1;
   border-radius: 12px;
   box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
   max-height: 240px;
   overflow-y: auto;
   z-index: 250;
 }

 .stock-search-results.hidden {
   display: none;
 }

 .stock-search-results .stock-result-item {
   display: flex;
   justify-content: space-between;
   align-items: center;
   gap: 10px;
   padding: 10px 12px;
   cursor: pointer;
   border-bottom: 1px solid #f1f5f9;
   font-weight: 700;
   font-size: 13px;
 }

@media print {
  .ticket-wrapper {
    width: 100% !important;
    max-width: 54mm !important;
    margin: 0 auto !important;
    padding: 1mm 1mm 2mm 1mm !important;
    box-sizing: border-box !important;
  }
}

 .stock-search-results .stock-result-item:hover {
   background: #eff6ff;
 }

 .stock-search-results .stock-result-name {
   display: grid;
   gap: 2px;
   min-width: 0;
 }

 .stock-search-results .stock-result-name small {
   color: #64748b;
   font-weight: 600;
 }

 .stock-search-results .stock-result-meta {
   text-align: right;
   flex-shrink: 0;
   font-size: 12px;
   color: #475569;
 }

 .reinvest-list {
   list-style: none;
   margin: 0;
   padding: 0;
   display: flex;
   flex-direction: column;
 }

 .alert.error {
   background: rgba(220, 38, 38, 0.1);
   border: 1px solid rgba(220, 38, 38, 0.25);
   color: #991b1b;
 }

 .transfer-entry-grid {
   display: grid;
   grid-template-columns: 1fr auto 100px auto auto;
   gap: 12px;
   align-items: end;
 }

 .transfer-layout-row {
   display: flex;
   gap: 20px;
   align-items: flex-start;
   flex-wrap: wrap;
 }

 @media (max-width: 820px) {
   .transfer-entry-grid {
     grid-template-columns: 1fr 1fr;
   }

   .transfer-entry-search {
     grid-column: 1 / -1;
   }

   .transfer-entry-negative {
     grid-column: 1 / -1;
   }

   .transfer-draft-panel {
     width: 100% !important;
   }
 }

 @media print {
   .ticket-wrapper,
   .ticket-print {
     width: 100% !important;
     max-width: 46mm !important;
     margin: 0 auto !important;
     padding: 1mm 1.5mm 2mm 1.5mm !important;
     box-sizing: border-box !important;
     font-family: "Courier New", Courier, monospace !important;
     font-size: 8px !important;
     font-weight: 600 !important;
     line-height: 1.15 !important;
     text-align: center !important;
   }
 }


/* === LIA STYLE UPGRADES FOR SUCURSAL === */
body {
  font-family: "Plus Jakarta Sans", "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pill-amber {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border-color: #d97706;
}

.pill-purple {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #ffffff;
  border-color: #7c3aed;
}

.pill-rose {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #ffffff;
  border-color: #e11d48;
}

.pill-emerald {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.25);
}

.branch-switch-dropdown {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(31, 107, 255, 0.25);
  background: #ffffff;
  color: #0f172a;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
