/* ==========================================================
   HERENCIA GAUCHA - DESIGN SYSTEM (APPLE & AIRBNB STYLE)
   Tipografía: Space Grotesk
   Temas: Modo Claro y Modo Oscuro
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Inter:wght@400;500;600&display=swap');

/* Default (Dark Theme) */
:root, [data-theme="dark"] {
  --bg-main: #0B0C0E;
  --bg-card: #14151B;
  --bg-card-hover: #1A1C24;
  --bg-elevated: #1E212B;
  --bg-input: #101116;

  --border-color: #242733;
  --border-focus: #F59E0B;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;

  --primary: #F59E0B;
  --primary-hover: #D97706;
  --primary-text: #000000;
  --primary-soft: rgba(245, 158, 11, 0.12);

  --btn-main-bg: #FFFFFF;
  --btn-main-text: #000000;
  --btn-main-hover: #E2E8F0;

  --green-success: #10B981;
  --green-soft: rgba(16, 185, 129, 0.12);
  --red-danger: #EF4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --blue-fba: #3B82F6;
  --blue-soft: rgba(59, 130, 246, 0.12);
  --purple-accent: #8B5CF6;
  --purple-soft: rgba(139, 92, 246, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);

  --header-bg: rgba(11, 12, 14, 0.85);
  --bottom-nav-bg: rgba(11, 12, 14, 0.92);

  /* Bottom nav icon shadows: verde agua in dark mode */
  --nav-floor-shadow: #2DD4BF;
  --nav-floor-shadow-soft: rgba(45, 212, 191, 0.45);
}

/* Light Theme (Airbnb / Apple Clean & Crisp) */
[data-theme="light"] {
  --bg-main: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --bg-elevated: #F8FAFC;
  --bg-input: #F1F5F9;

  --border-color: #E2E8F0;
  --border-focus: #0F172A;

  --text-main: #0F172A;
  --text-muted: #475569;
  --text-dim: #94A3B8;

  --primary: #0F172A;
  --primary-hover: #1E293B;
  --primary-text: #FFFFFF;
  --primary-soft: rgba(15, 23, 42, 0.08);

  --btn-main-bg: #0F172A;
  --btn-main-text: #FFFFFF;
  --btn-main-hover: #273549;

  --green-success: #059669;
  --green-soft: rgba(5, 150, 105, 0.1);
  --red-danger: #DC2626;
  --red-soft: rgba(220, 38, 38, 0.1);
  --blue-fba: #2563EB;
  --blue-soft: rgba(37, 99, 235, 0.1);
  --purple-accent: #7C3AED;
  --purple-soft: rgba(124, 58, 237, 0.1);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);

  --header-bg: rgba(255, 255, 255, 0.88);
  --bottom-nav-bg: rgba(255, 255, 255, 0.94);

  /* Bottom nav icon shadows: dark gray in light mode */
  --nav-floor-shadow: rgba(0, 0, 0, 0.65);
  --nav-floor-shadow-soft: rgba(0, 0, 0, 0.35);
}

:root {
  --font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;

  /* Apple-style "ease out expo" — snappy start, silky settle */
  --ease-fly: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

*:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-bottom: 74px;
  transition: background-color 0.25s var(--ease-standard), color 0.25s var(--ease-standard);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Slim, unobtrusive scrollbar for a "designed" feel */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 20px;
  border: 2px solid var(--bg-main);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

::selection {
  background: var(--primary);
  color: var(--primary-text);
}

@media (min-width: 992px) {
  body {
    padding-bottom: 100px;
  }
}

/* ==========================================================
   APP HEADER & NAVBAR
   ========================================================== */
.app-header {
  background-color: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 24px;
  box-shadow: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.25s var(--ease-standard);
}

.app-header.is-scrolled {
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo-img {
  height: 28px;
  width: auto;
  object-fit: contain;
  transition: opacity 0.2s;
}

/* Switch logo based on theme */
[data-theme="dark"] .brand-logo-img.light-logo { display: none; }
[data-theme="dark"] .brand-logo-img.dark-logo { display: block; }
[data-theme="light"] .brand-logo-img.light-logo { display: block; }
[data-theme="light"] .brand-logo-img.dark-logo { display: none; }

.brand-badge {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

/* Navigation Tabs (Apple / Airbnb Segmented Pill Style) */
.nav-tabs {
  display: none;
  position: relative;
  gap: 4px;
  background-color: var(--bg-input);
  padding: 4px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

@media (min-width: 992px) {
  .nav-tabs {
    display: flex;
  }
}

.tab-btn {
  position: relative;
  z-index: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.25s var(--ease-standard);
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn:active {
  transform: scale(0.96);
}

.tab-btn.active {
  color: var(--text-main);
}

/* Sliding pill indicator — positioned via JS (left/width) for a fluid "gliding" tab switch */
.nav-tabs-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
  transition: left 0.4s var(--ease-fly), width 0.4s var(--ease-fly);
  z-index: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-success);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.theme-toggle-btn:hover {
  background: var(--bg-card-hover);
  transform: scale(1.05);
}

[data-theme="dark"] .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: inline-block; }
[data-theme="light"] .theme-icon-dark { display: inline-block; }
[data-theme="light"] .theme-icon-light { display: none; }

/* ==========================================================
   BRAND LOGO DROPDOWN MENU
   ========================================================== */
.brand-container {
  position: relative;
}

.brand-dropdown-trigger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background-color 0.18s ease;
  color: var(--text-main);
  font-family: inherit;
}

.brand-dropdown-trigger:hover {
  background-color: var(--primary-soft);
}

.brand-chevron {
  color: var(--text-muted);
  transition: transform 0.3s var(--ease-fly);
  flex-shrink: 0;
}

#brand-dropdown-btn[aria-expanded="true"] .brand-chevron {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.brand-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  min-width: 200px;
  padding: 8px;
  z-index: 500;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s var(--ease-fly), transform 0.22s var(--ease-fly);
  transform-origin: top left;
}

.brand-dropdown-menu.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
  letter-spacing: -0.01em;
}

.dropdown-item:hover {
  background-color: var(--primary-soft);
  color: var(--primary);
}

.dropdown-item-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 6px 8px;
}

/* ==========================================================
   BOTTOM NAVIGATION BAR — ONE CONTINUOUS UNDULATING LINE
   ========================================================== */

/* Wrapper: transparent, taller to allow center button to float up */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 104px;
  z-index: 1000;
  background: transparent;
  padding-bottom: env(safe-area-inset-bottom);
  filter: drop-shadow(0 -4px 20px rgba(0, 0, 0, 0.2));
}

/* The single wavy line, drawn as a stretched SVG path (not a circle notch) */
.bottom-nav-shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 86px;
  bottom: 0;
  top: auto;
}

.bottom-nav-shape path {
  fill: var(--bottom-nav-bg);
  stroke: var(--border-color);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

/* Backdrop blur layer, clipped to the same wave via mask so it reads as glass */
.bottom-nav::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 86px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 76' preserveAspectRatio='none'%3E%3Cpath d='M0,22 L156,22 C166,22 170,4 200,4 C230,4 234,22 244,22 L400,22 L400,76 L0,76 Z'/%3E%3C/svg%3E") center/100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 76' preserveAspectRatio='none'%3E%3Cpath d='M0,22 L156,22 C166,22 170,4 200,4 C230,4 234,22 244,22 L400,22 L400,76 L0,76 Z'/%3E%3C/svg%3E") center/100% 100% no-repeat;
  pointer-events: none;
}

/* Row that holds the actual buttons, sits above the shape */
.bottom-nav-row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 100%;
  padding-bottom: 10px;
}

/* Sliding glow indicator that tracks the active side tab */
.bottom-nav-indicator {
  position: absolute;
  bottom: 12px;
  left: 0;
  width: 34px;
  height: 3px;
  border-radius: 3px;
  background: #2dd4bf;
  box-shadow: 0 0 10px 1px rgba(45, 212, 191, 0.7);
  transform: translateX(-50%);
  opacity: 0;
  transition: left 0.45s var(--ease-spring), opacity 0.25s ease;
  z-index: 1;
  pointer-events: none;
}

.bottom-nav-indicator.is-visible {
  opacity: 0.4;
}

/* ── SIDE BUTTONS (Inventario & Productos) ── */
.bottom-nav-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0 14px 6px;
  cursor: pointer;
  flex: 1;
  transition: color 0.2s var(--ease-standard);
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

/* ── ICON WRAP & FLOOR SHADOW (strictly underneath the icon) ── */
.bottom-nav-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Floor shadow placed strictly under the image */
.bottom-nav-icon-wrap::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 6px;
  border-radius: 50%;
  background: var(--nav-floor-shadow);
  filter: blur(4px);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.3s ease, transform 0.3s var(--ease-spring), width 0.3s ease, background 0.3s ease;
  opacity: 0.35;
}

.bottom-nav-btn.active .bottom-nav-icon-wrap::after {
  opacity: 0.85;
  width: 50px;
  height: 7px;
  filter: blur(4.5px);
}

.bottom-nav-btn:hover .bottom-nav-icon-wrap::after {
  opacity: 0.65;
  transform: translateX(-50%) translateY(2px) scale(0.92);
}

/* Nav button icon wrap size */
.bottom-nav-btn .bottom-nav-icon-wrap {
  width: 92px;
  height: 92px;
  background: transparent;
  transition: transform 0.3s var(--ease-spring);
}

/* Nav button icon */
.bottom-nav-btn .bottom-nav-icon {
  position: relative;
  z-index: 1;
  width: 82%;
  height: 82%;
  object-fit: cover;
  object-position: 54% 46%;
  filter: grayscale(60%) opacity(0.82) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
  transition: filter 0.3s ease, transform 0.3s var(--ease-spring);
}

.bottom-nav-btn:hover .bottom-nav-icon-wrap {
  transform: translateY(-2px);
}

.bottom-nav-btn:hover .bottom-nav-icon {
  filter: grayscale(20%) opacity(0.95) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.bottom-nav-btn:hover {
  color: var(--text-muted);
}

.bottom-nav-btn.active {
  color: #2dd4bf;
}

.bottom-nav-btn.active .bottom-nav-icon-wrap {
  transform: translateY(-2px);
}

.bottom-nav-btn.active .bottom-nav-icon {
  filter: grayscale(0%) opacity(1) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.bottom-nav-btn:active .bottom-nav-icon-wrap {
  transform: scale(0.92);
}

.bottom-nav-label {
  transition: color 0.2s ease;
}

/* ── DESKTOP ── */
@media (min-width: 992px) {
  .bottom-nav-row {
    max-width: 460px;
    margin: 0 auto;
    justify-content: center;
    gap: 0;
  }
  .bottom-nav-btn {
    flex: 0 0 auto;
    padding: 0 44px 6px;
    font-size: 0.74rem;
  }
  .bottom-nav-btn .bottom-nav-icon-wrap {
    width: 82px;
    height: 82px;
  }
}

/* ==========================================================
   MAIN CONTENT & LAYOUT
   ========================================================== */
.main-content {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px calc(104px + env(safe-area-inset-bottom)) 20px;
  flex: 1;
}

@media (min-width: 992px) {
  .main-content {
    padding-bottom: 36px;
  }
}

@media (min-width: 1400px) {
  .main-content {
    max-width: 1560px;
  }
}

.view-panel {
  display: none;
  animation: fadeIn 0.35s var(--ease-fly) forwards;
}

.view-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .view-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.view-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.view-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ==========================================================
   CARDS & CONTAINERS (APPLE / AIRBNB MINIMALISM)
   ========================================================== */
.scanner-card, .scanned-result-card, .audit-form-card,
.audit-history-card, .table-card, .calendar-card, .day-details-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.2s ease, border-color 0.25s var(--ease-standard), box-shadow 0.25s var(--ease-standard);
}

.scanner-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 992px) {
  .scanner-grid {
    grid-template-columns: 420px 1fr;
    align-items: start;
  }
}

/* Visor Cámara */
.scanner-box {
  position: relative;
  background-color: var(--bg-input);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 250px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border-color);
}

/* Light mode: make the camera resting box clearly light */
[data-theme="light"] .scanner-box {
  background-color: #F1F5F9;
  border-color: #CBD5E1;
}

#reader {
  width: 100% !important;
  border: none !important;
}

#reader:empty {
  display: none !important;
}

#reader video {
  width: 100% !important;
  border-radius: var(--radius-md);
  object-fit: cover;
  display: block;
}

.scanner-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--text-dim);
  pointer-events: none;
  z-index: 2;
}

.scanner-placeholder .icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.7;
  line-height: 1;
}

.scanner-placeholder p {
  margin: 0;
  line-height: 1.4;
  text-align: center;
}

.scanner-laser {
  position: absolute;
  top: 0;
  left: 8%;
  width: 84%;
  height: 2px;
  background: #EF4444;
  box-shadow: 0 0 8px #EF4444;
  animation: scanLaser 2s infinite ease-in-out;
  display: none;
  z-index: 10;
}

@keyframes scanLaser {
  0% { top: 15%; opacity: 0.3; }
  50% { top: 85%; opacity: 1; }
  100% { top: 15%; opacity: 0.3; }
}

/* Inputs & Form Controls */
.barcode-input-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.input-with-action {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-action input, .form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  padding: 12px 14px;
  transition: border-color 0.18s var(--ease-standard), background-color 0.18s var(--ease-standard), box-shadow 0.18s var(--ease-standard);
}

.input-with-action input:focus, .form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  background: var(--bg-card);
  outline: none;
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.input-with-action input:hover, .form-input:hover, .form-select:hover, .form-textarea:hover {
  border-color: var(--text-dim);
}

.clear-input-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.1rem;
  display: none;
}

/* Buttons (Apple Pill Style) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 30px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.18s var(--ease-standard), border-color 0.18s var(--ease-standard),
              color 0.18s var(--ease-standard), transform 0.15s var(--ease-spring), box-shadow 0.18s var(--ease-standard);
  border: 1px solid transparent;
  letter-spacing: -0.01em;
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--btn-main-bg);
  color: var(--btn-main-text);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--btn-main-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0) scale(0.96);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-dim);
}

.btn-full {
  width: 100%;
}

.btn-lg {
  padding: 14px 22px;
  font-size: 1rem;
}

/* ==========================================================
   SCANNED PRODUCT CARD
   ========================================================== */
.scanned-result-card.active-match {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

.scanned-result-card.pulse-in {
  animation: matchPulse 0.5s var(--ease-fly);
}

@keyframes matchPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.35); }
  60% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: var(--shadow-md); }
}

.result-empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-dim);
}

.result-empty .icon {
  font-size: 3.5rem;
  margin-bottom: 14px;
  opacity: 0.4;
  animation: floatIcon 3.5s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.product-hero {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.product-avatar {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
  animation: avatarPop 0.4s var(--ease-spring);
}

@keyframes avatarPop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.product-meta {
  flex: 1;
}

.product-meta h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 6px;
}

.code-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.code-badge {
  font-size: 0.72rem;
  font-weight: 600;
  font-family: monospace;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.code-badge.fnsku {
  color: var(--primary);
  border-color: var(--border-color);
}

.code-badge.asin {
  color: var(--blue-fba);
}

/* 3-Way Location Stock Overview (Airbnb Minimalist Cards) */
.stock-locations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.loc-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease-standard), border-color 0.2s var(--ease-standard);
}

.loc-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.loc-card.loc-casa { border-top-color: var(--purple-accent); }
.loc-card.loc-trastero { border-top-color: var(--primary); }
.loc-card.loc-amazon { border-top-color: var(--blue-fba); }
.loc-card.loc-total { border-top-color: var(--green-success); background: var(--bg-elevated); }

.loc-name {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.loc-qty {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
  margin-bottom: 4px;
}

.loc-detail {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* ==========================================================
   ENHANCED SCANNED PRODUCT HERO (THUMBNAIL & DESCRIPTION)
   ========================================================== */
.product-thumb-container {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.prod-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.25s ease;
}

.prod-hero-img:hover {
  transform: scale(1.06);
}

.prod-hero-title {
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 4px 0 2px 0;
  line-height: 1.25;
}

.prod-hero-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 6px 0 10px 0;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}

/* ==========================================================
   UNIFIED STOCK ADJUSTMENT PANEL (RESTAR / SUMAR)
   ========================================================== */
.stock-action-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.action-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.action-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-panel-icon {
  font-size: 1.3rem;
}

.action-panel-title h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.action-panel-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 2px 0 0 0;
}

.stock-ctrl-group {
  margin-bottom: 16px;
}

.stock-ctrl-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Location Segmented Control */
.location-segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.loc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.loc-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.loc-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  border-color: rgba(245, 158, 11, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  font-weight: 700;
}

.loc-btn-icon {
  font-size: 0.95rem;
}

/* Inputs Row: Quantity & Reason */
.stock-inputs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.stock-qty-wrapper {
  display: flex;
  flex-direction: column;
}

/* Stepper Control */
.qty-stepper {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  height: 44px;
}

.stepper-btn {
  width: 44px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.stepper-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.stepper-btn:active {
  background: rgba(255, 255, 255, 0.15);
}

.stepper-input {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  font-family: inherit;
  outline: none;
  -moz-appearance: textfield;
}

.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.quick-qty-pills {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.quick-qty-pill {
  flex: 1;
  padding: 4px 0;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-qty-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.quick-qty-pill.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

/* Reason & Notes */
.stock-reason-wrapper {
  display: flex;
  flex-direction: column;
}

.stock-reason-select {
  height: 44px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 0.88rem;
  font-family: inherit;
}

.stock-notes-input {
  height: 34px;
  font-size: 0.8rem;
}

/* Two Big Clear Action Buttons */
.stock-action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-stock-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.btn-action-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.btn-action-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.btn-action-text strong {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.btn-action-sub {
  font-size: 0.72rem;
  opacity: 0.85;
  font-weight: 500;
}

/* Restar Button (Red) */
.btn-stock-decrement {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn-stock-decrement:hover {
  background: linear-gradient(135deg, #DC2626, #B91C1C);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-stock-decrement:active {
  transform: translateY(0);
}

/* Sumar Button (Green) */
.btn-stock-increment {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-stock-increment:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-stock-increment:active {
  transform: translateY(0);
}

/* ==========================================================
   MOBILE CAMERA OPTIMIZATIONS
   ========================================================== */
@media (max-width: 768px) {
  .scanner-box {
    min-height: 110px !important;
    height: 120px !important;
    border-radius: 14px !important;
  }

  .scanner-placeholder {
    padding: 12px !important;
  }

  .scanner-placeholder .icon {
    font-size: 1.6rem !important;
    margin-bottom: 4px !important;
  }

  .scanner-placeholder p {
    font-size: 0.76rem !important;
    line-height: 1.2 !important;
  }

  #reader video {
    max-height: 175px !important;
  }

  .product-hero {
    gap: 12px !important;
  }

  .product-thumb-container {
    width: 68px !important;
    height: 68px !important;
  }

  .stock-inputs-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .stock-action-buttons {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
}

.secondary-actions {
  display: flex;
  gap: 10px;
}

/* ==========================================================
   TAB 2: CONTEO DE INVENTARIO (VARIANCE WIDGET)
   ========================================================= */
.audit-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 992px) {
  .audit-container {
    grid-template-columns: 460px 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.variance-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.variance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  text-align: center;
}

.v-item {
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.v-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 4px;
}

.v-val {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-main);
}

.variance-badge-container {
  display: flex;
  justify-content: center;
}

.variance-badge {
  padding: 10px 16px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
  transition: all 0.2s;
}

.variance-badge.balanced {
  background: var(--green-soft);
  color: var(--green-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.variance-badge.deficit {
  background: var(--red-soft);
  color: var(--red-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.variance-badge.surplus {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ==========================================================
   TAB 3: CATÁLOGO & TABLAS
   ========================================================== */
.table-toolbar {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 768px) {
  .table-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-chip {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.18s var(--ease-standard), border-color 0.18s var(--ease-standard),
              color 0.18s var(--ease-standard), transform 0.15s var(--ease-spring);
}

.filter-chip:hover {
  color: var(--text-main);
  border-color: var(--text-dim);
}

.filter-chip:active {
  transform: scale(0.94);
}

.filter-chip.active {
  background: var(--btn-main-bg);
  border-color: var(--btn-main-bg);
  color: var(--btn-main-text);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.product-name-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  max-width: 320px;
}

@media (min-width: 1280px) {
  .product-name-clamp {
    max-width: 420px;
  }
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
  transition: background-color 0.15s var(--ease-standard);
}

.data-table tbody tr {
  animation: rowIn 0.3s var(--ease-fly) backwards;
}

@keyframes rowIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.data-table tr:hover td {
  background-color: var(--bg-card-hover);
}

.table-responsive {
  max-height: 65vh;
  overflow-y: auto;
}

.stock-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.8rem;
}

.stock-tag.in-stock {
  background: var(--green-soft);
  color: var(--green-success);
}

.stock-tag.low-stock {
  background: var(--red-soft);
  color: var(--red-danger);
}

.stock-tag.zero-stock {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-dim);
}

/* Movements Badges */
.movement-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}

.movement-badge.venta_fbm {
  background: var(--red-soft);
  color: var(--red-danger);
}

.movement-badge.entrada {
  background: var(--green-soft);
  color: var(--green-success);
}

.movement-badge.ajuste_inventario {
  background: var(--primary-soft);
  color: var(--primary);
}

.movement-badge.transferencia_salida, .movement-badge.transferencia_entrada {
  background: var(--blue-soft);
  color: var(--blue-fba);
}

/* ==========================================================
   TAB 5: CALENDARIO & FESTIVOS (APPLE / AIRBNB STYLE)
   ========================================================== */
.calendar-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 992px) {
  .calendar-layout {
    grid-template-columns: 1fr 360px;
  }
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.month-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: capitalize;
}

.cal-nav-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  min-height: 74px;
  padding: 6px;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-standard), border-color 0.15s var(--ease-standard), transform 0.15s var(--ease-spring);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cal-day:active {
  transform: scale(0.96);
}

@media (min-width: 768px) {
  .cal-day {
    min-height: 90px;
    padding: 8px;
  }
}

.cal-day:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.cal-day.other-month {
  opacity: 0.25;
}

.cal-day.today {
  border: 2px solid var(--border-focus);
}

.cal-day.selected {
  outline: 2px solid var(--text-main);
  background: var(--bg-card);
}

.day-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.day-number {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.day-holiday-badge {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.badge-nacional {
  background: #DC2626;
  color: #FFF;
}

.badge-cataluna {
  background: #D97706;
  color: #FFF;
}

.badge-barcelona {
  background: #2563EB;
  color: #FFF;
}

.day-dots {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

.event-dot.dot-fba { background: var(--blue-fba); }
.event-dot.dot-proveedor { background: var(--purple-accent); }
.event-dot.dot-inventario { background: var(--green-success); }
.event-dot.dot-urgente { background: var(--red-danger); }

/* Day Details Sidebar */
.day-details-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.holiday-detail-item {
  background: var(--bg-input);
  border-left: 4px solid var(--primary);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 8px;
}

.holiday-detail-item.nacional { border-color: #DC2626; }
.holiday-detail-item.cataluna { border-color: #D97706; }
.holiday-detail-item.barcelona { border-color: #2563EB; }

.event-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.event-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.event-category-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* ==========================================================
   MODALS
   ========================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
  animation: overlayIn 0.25s var(--ease-standard) forwards;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  max-width: 500px;
  width: 100%;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalPop 0.35s var(--ease-fly) forwards;
}

.modal-body {
  overflow-y: auto;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-elevated);
}

/* ==========================================================
   TOAST NOTIFICATIONS
   ========================================================== */
.toast-container {
  position: fixed;
  top: 82px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 12px 20px;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.35s var(--ease-fly) forwards;
  pointer-events: auto;
  max-width: 400px;
  overflow: hidden;
}

.toast.toast-success { border-left: 4px solid var(--green-success); }
.toast.toast-danger { border-left: 4px solid var(--red-danger); }
.toast.toast-warning { border-left: 4px solid var(--primary); }

.toast::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: currentColor;
  opacity: 0.25;
  transform-origin: left;
  animation: toastProgress linear forwards;
  animation-duration: var(--toast-duration, 3s);
}

.toast.toast-success::after { color: var(--green-success); }
.toast.toast-danger::after { color: var(--red-danger); }
.toast.toast-warning::after { color: var(--primary); }

@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-14px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ====================================================
   INVENTARIO VALORIZADO, THUMBNAILS Y LIGHTBOX
   ==================================================== */

/* Valued Inventory Table Header & Sum Sub-Badge */
.th-total-value {
  min-width: 140px;
  background: rgba(16, 185, 129, 0.05);
}

.th-val-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.th-val-sum-pill {
  display: inline-block;
  margin-top: 5px;
  padding: 3px 8px;
  font-size: 0.8rem;
  font-weight: 800;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  color: #059669;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

[data-theme="dark"] .th-val-sum-pill {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.28);
}

/* Inventory KPI Bar */
.inventory-kpi-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.inv-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.inv-kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

.inv-kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.inv-kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  color: var(--text-main);
}

.inv-kpi-card.highlight-kpi {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-card) 100%);
}

.inv-kpi-card.highlight-kpi .inv-kpi-value {
  color: #10b981;
}

[data-theme="dark"] .inv-kpi-card.highlight-kpi .inv-kpi-value {
  color: #34d399;
}

/* Thumbnails */
.table-thumbnail-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-thumbnail {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.table-thumbnail:hover {
  transform: scale(1.18);
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}

.table-thumbnail-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--text-dim);
  cursor: pointer;
}

/* ==========================================
   INLINE EDITING (Inventario & Catálogo)
   ========================================== */
.editable-value {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  border-radius: 4px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.editable-value:hover {
  border-bottom-color: var(--primary);
  background-color: rgba(245, 158, 11, 0.08);
}

.inline-edit-input {
  width: 100%;
  min-width: 64px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--primary);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
}

.inline-edit-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
}

.inline-edit-select {
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.8rem;
  cursor: pointer;
}

.status-toggle-badge {
  cursor: pointer;
  user-select: none;
  border: none;
}

.status-toggle-badge:hover {
  filter: brightness(1.12);
  transform: scale(1.03);
}

/* Editable thumbnail (click / drag & drop / take photo) */
.table-thumbnail-wrap {
  position: relative;
}

.thumb-edit-btn {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
  padding: 0;
}

.table-thumbnail-wrap:hover .thumb-edit-btn {
  opacity: 1;
}

.thumb-edit-btn:hover {
  transform: scale(1.15);
  border-color: var(--primary);
}

.editable-thumb.drag-over {
  outline: 2px dashed var(--primary);
  outline-offset: 3px;
  border-radius: 10px;
}

.image-upload-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  color: var(--text-dim);
  transition: border-color 0.15s ease, background-color 0.15s ease;
  padding: 12px;
}

.image-upload-dropzone.drag-over {
  border-color: var(--primary);
  background-color: rgba(245, 158, 11, 0.06);
}

.image-upload-dropzone p {
  margin: 0;
  font-size: 0.82rem;
}

/* Lightbox Modal */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lightbox-overlay.active {
  display: flex;
  opacity: 1;
}

.lightbox-container {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: zoomLightbox 0.3s var(--ease-spring) forwards;
}

@keyframes zoomLightbox {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox-close-btn {
  position: absolute;
  top: -46px;
  right: 0;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-close-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.1);
}

.lightbox-image-wrap {
  max-width: 85vw;
  max-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  background: #000;
}

.lightbox-img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.lightbox-caption {
  text-align: center;
  color: #f3f4f6;
}

.lightbox-caption h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: #fff;
}

.lightbox-subtitle {
  font-size: 0.82rem;
  color: #9ca3af;
  font-family: monospace;
}

/* Real-Time Auto Sync Badge */
.auto-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #10b981;
  user-select: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

[data-theme="light"] .auto-sync-badge {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.35);
  color: #047857;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 2s infinite;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes pulseGreen {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* ==========================================================
   HERENCIA GAUCHA - LOGIN SCREEN (DARK LUXURY THEME)
   ========================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #040405;
  background-image: 
    radial-gradient(circle at 50% 20%, rgba(245, 158, 11, 0.10) 0%, transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(20, 22, 30, 0.8) 0%, #040405 100%);
  padding: 20px;
  overflow-y: auto;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
}

.login-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(245, 158, 11, 0.06) 0%, rgba(4, 4, 6, 0.95) 70%, #000000 100%);
  pointer-events: none;
}

.login-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  margin: auto;
}

.login-card {
  background: rgba(14, 15, 20, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow: 
    0 25px 60px -15px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(245, 158, 11, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  text-align: center;
  transition: transform 0.25s ease;
}

.login-card.shake {
  animation: loginShake 0.45s ease-in-out;
}

@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.login-header {
  margin-bottom: 26px;
}

.login-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
}

.login-logo-img {
  max-width: 190px;
  height: auto;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.8));
}

.login-badge {
  display: inline-block;
  padding: 4px 12px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #F59E0B;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 100px;
  margin-bottom: 10px;
}

.login-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: #FFFFFF;
  margin: 0 0 6px 0;
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 0.85rem;
  color: #94A3B8;
  margin: 0;
  font-weight: 400;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94A3B8;
  text-transform: uppercase;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-icon {
  position: absolute;
  left: 14px;
  font-size: 0.95rem;
  opacity: 0.6;
  pointer-events: none;
  z-index: 2;
}

.login-input {
  width: 100%;
  height: 48px;
  padding: 0 44px 0 42px;
  background: #090A0D;
  border: 1px solid #232634;
  border-radius: 12px;
  color: #F8FAFC;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.login-input:focus {
  outline: none;
  border-color: #F59E0B;
  background: #0C0E13;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}

.login-input::placeholder {
  color: #475569;
}

.login-pwd-toggle {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: #94A3B8;
  cursor: pointer;
  padding: 6px;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.login-pwd-toggle:hover {
  opacity: 1;
}

.login-error-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 10px;
  color: #FCA5A5;
  font-size: 0.82rem;
  font-weight: 500;
  animation: fadeIn 0.2s ease;
}

.btn-login-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  margin-top: 8px;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #000000;
  border: none;
  border-radius: 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.32);
  transition: all 0.2s ease;
}

.btn-login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 26px rgba(245, 158, 11, 0.45);
  filter: brightness(1.05);
}

.btn-login-submit:active {
  transform: translateY(0);
}

.btn-login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-login-arrow {
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}

.btn-login-submit:hover .btn-login-arrow {
  transform: translateX(3px);
}

.login-footer {
  margin-top: 24px;
  font-size: 0.72rem;
  color: #475569;
  letter-spacing: 0.04em;
}

.dropdown-item.text-danger {
  color: #EF4444;
}

.dropdown-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.12);
}
