/* ==========================================================================
   NovaBot Design System — 2026 Edition
   Strict Typography, Calibrated Color, Reduced Visual Noise & Fluid Motion
   Preserves 100% of all UI buttons, selectors, IDs and JavaScript bindings.
   ========================================================================== */

:root {
  /* NovaBot Pro Light Palette */
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  
  --header-bg: rgba(255, 255, 255, 0.92);
  --header-border: #e2e8f0;

  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --surface-hover: #e2e8f0;

  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --border-hover: #cbd5e1;
  --border-focus: #002D62;
  --border-accent: rgba(0, 45, 98, 0.25);

  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --subtle: #94a3b8;

  /* NovaBot Brand Deep Navy (#002D62) */
  --accent: #002D62;
  --accent-hover: #001e42;
  --accent-active: #00142e;
  --accent-bg: rgba(0, 45, 98, 0.06);
  --accent-bg-hover: rgba(0, 45, 98, 0.12);
  --accent-glow: rgba(0, 45, 98, 0.15);
  --accent-text: #ffffff;

  /* Status Colors */
  --ok: #059669;
  --ok-hover: #047857;
  --ok-bg: rgba(16, 185, 129, 0.1);
  --ok-border: rgba(16, 185, 129, 0.25);

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-bg: rgba(239, 68, 68, 0.08);
  --danger-border: rgba(239, 68, 68, 0.25);

  --info: #0284c7;
  --info-bg: rgba(2, 132, 199, 0.08);
  --info-border: rgba(2, 132, 199, 0.2);

  --warning: #d97706;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --warning-border: rgba(245, 158, 11, 0.25);

  /* Badges */
  --badge-bg: rgba(0, 45, 98, 0.05);
  --badge-border: rgba(0, 45, 98, 0.12);
  --badge-color: #002D62;

  /* Soft Ambient Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 4px -1px rgba(15, 23, 42, 0.02);
  --shadow-lg: 0 10px 28px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -2px rgba(15, 23, 42, 0.03);
  --shadow-glow: 0 0 18px rgba(0, 45, 98, 0.15);

  /* Typography Scale */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Strict Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Motion & Easings */
  --ease-smooth: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 220ms;
}

[data-theme="dark"] {
  /* NovaBot Pro Slate Dark Palette */
  --bg: #0b0f17;
  --bg-subtle: #101622;

  --header-bg: rgba(11, 15, 23, 0.92);
  --header-border: rgba(255, 255, 255, 0.08);

  --surface: #111827;
  --surface-elevated: #162032;
  --surface-2: #161f30;
  --surface-3: #1f293d;
  --surface-hover: #28354f;

  --border: rgba(255, 255, 255, 0.09);
  --border-light: rgba(255, 255, 255, 0.05);
  --border-hover: rgba(255, 255, 255, 0.2);
  --border-focus: #3b82f6;
  --border-accent: rgba(59, 130, 246, 0.4);

  --text: #f8fafc;
  --text-secondary: #cbd5e1;
  --muted: #94a3b8;
  --subtle: #64748b;

  /* Royal Electric Blue */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-active: #1e40af;
  --accent-bg: rgba(37, 99, 235, 0.16);
  --accent-bg-hover: rgba(37, 99, 235, 0.25);
  --accent-glow: rgba(37, 99, 235, 0.35);
  --accent-text: #ffffff;

  /* Status Colors */
  --ok: #10b981;
  --ok-hover: #34d399;
  --ok-bg: rgba(16, 185, 129, 0.16);
  --ok-border: rgba(16, 185, 129, 0.3);

  --danger: #ef4444;
  --danger-hover: #f87171;
  --danger-bg: rgba(239, 68, 68, 0.16);
  --danger-border: rgba(239, 68, 68, 0.3);

  --info: #38bdf8;
  --info-bg: rgba(56, 189, 248, 0.16);
  --info-border: rgba(56, 189, 248, 0.3);

  --warning: #fbbf24;
  --warning-bg: rgba(245, 158, 11, 0.18);
  --warning-border: rgba(245, 158, 11, 0.35);

  /* Badges */
  --badge-bg: rgba(255, 255, 255, 0.07);
  --badge-border: rgba(255, 255, 255, 0.12);
  --badge-color: #e2e8f0;

  /* Dark Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.35);
  --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.55), 0 2px 5px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.7), 0 4px 10px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.3);
}

/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--duration-normal) ease, color var(--duration-normal) ease;
}

::selection {
  background: var(--accent-bg-hover);
  color: var(--accent);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Custom Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: var(--radius-full);
  transition: background var(--duration-fast) ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

header {
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--header-border);
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background var(--duration-normal) ease, border-color var(--duration-normal) ease;
}

header .header-inner {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

header .brand-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

header .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: transform var(--duration-fast) var(--ease-spring);
}

header .brand-mark:hover {
  transform: scale(1.04);
}

[data-theme="dark"] header .brand-mark {
  background: #111827;
  border-color: var(--border-accent);
}

header .brand-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-md) - 1px);
}

header .brand-text-block {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

header h1 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.data-timestamp-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: var(--shadow-xs);
  cursor: default;
  user-select: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
  line-height: 1.2;
  transition: all var(--duration-fast) ease;
}

.data-timestamp-pill svg {
  width: 11px;
  height: 11px;
  color: var(--accent);
  flex-shrink: 0;
}

[data-theme="dark"] .data-timestamp-pill {
  background: var(--surface-3);
  border-color: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

[data-theme="dark"] .data-timestamp-pill svg {
  color: #60a5fa;
}

/* ==========================================================================
   Main Layout & Cards
   ========================================================================== */

main {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 14px 48px;
  padding-bottom: max(48px, calc(32px + env(safe-area-inset-bottom)));
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
  position: relative;
}

/* ==========================================================================
   1. Mass Import & Search (De-noised, Clean Structure)
   ========================================================================== */

.bento-filter-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

.main-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Primary Search Input */
.search-primary-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-lens-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
  z-index: 2;
  transition: color var(--duration-fast) ease;
}

.search-primary-wrapper:focus-within .search-lens-icon {
  color: var(--accent);
}

.search-primary-wrapper input {
  width: 100%;
  height: 44px;
  padding: 0 94px 0 42px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text);
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--duration-fast) ease, background-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.search-primary-wrapper input:focus {
  background: var(--surface);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-primary-wrapper input::placeholder {
  color: var(--subtle);
  font-weight: 400;
}

.search-actions-group {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 2;
}

.paste-search-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  box-shadow: var(--shadow-xs);
  transition: all var(--duration-fast) var(--ease-smooth);
}

.paste-search-btn:hover {
  background: var(--accent-bg);
  border-color: var(--border-accent);
  color: var(--accent);
}

.paste-search-btn:active {
  transform: scale(0.96);
}

.clear-search-btn {
  background: var(--surface-3);
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) ease;
  padding: 0;
}

.clear-search-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
  transform: scale(1.08);
}

/* Secondary Filters Details & Summary */
.secondary-filters-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  padding: 0;
  overflow: hidden;
  transition: border-color var(--duration-fast) ease;
}

.secondary-filters-details[open] {
  border-color: var(--border-hover);
}

.secondary-filters-summary {
  padding: 10px 14px;
  font-size: 0.8125rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  transition: background var(--duration-fast) ease;
}

.secondary-filters-summary::-webkit-details-marker {
  display: none !important;
}

.secondary-filters-summary::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  margin-left: auto;
  transition: transform var(--duration-fast) ease;
}

.secondary-filters-details[open] .secondary-filters-summary::after {
  transform: rotate(45deg);
}

.secondary-filters-summary:hover {
  background: var(--surface-3);
  color: var(--text);
}

.secondary-filters-details[open] .secondary-filters-summary {
  border-bottom: 1px solid var(--border);
  background: var(--surface-3);
}

.panel-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.compact-selects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 8px;
  padding: 10px;
  background: var(--surface);
}

.select-field-wrapper {
  position: relative;
}

.select-field-wrapper select {
  width: 100%;
  height: 36px;
  padding: 0 26px 0 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--text);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.select-field-wrapper select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.select-field-wrapper select.has-value {
  border-color: var(--accent);
  background-color: var(--accent-bg);
  color: var(--accent);
  font-weight: 700;
}

/* ==========================================================================
   Planificador Module (Días & Grupos) — Flattened & Tactile
   ========================================================================== */

.planificador-module-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.planificador-module-header {
  font-size: 0.8125rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.01em;
}

.plan-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.planificador-pills-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.day-pills-track {
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
  gap: 4px;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1px;
}

.day-pills-track .chip {
  flex: 1 1 0px;
  min-width: 34px;
  padding: 0 2px;
  height: 30px;
  font-size: 0.8125rem;
  text-align: center;
  white-space: nowrap;
}

.group-pills-track {
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
  gap: 6px;
  align-items: center;
}

.group-pills-track .chip.chip-num {
  flex: 1 1 0px;
  min-width: 32px;
  height: 30px;
  padding: 0 4px;
  font-size: 0.875rem;
  font-weight: 800;
  text-align: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow-xs);
  transition: all var(--duration-fast) var(--ease-smooth);
}

.chip:hover {
  border-color: var(--border-hover);
  color: var(--text);
  background: var(--surface-3);
}

.chip:active {
  transform: scale(0.97);
}

.chip.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  box-shadow: 0 2px 6px var(--accent-glow);
  font-weight: 800;
}

.chip input {
  display: none;
}

/* Filter Panel Footer */
.panel-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  gap: 8px;
  flex-wrap: wrap;
}

.reset-filters-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.reset-filters-btn:hover {
  color: var(--text);
  background: var(--surface-3);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.reset-filters-btn:active {
  transform: scale(0.97);
}

.reset-filters-btn.has-active-filters {
  background: rgba(239, 68, 68, 0.12) !important;
  color: var(--danger) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
  animation: filter-active-glow 2.2s infinite ease-in-out;
}

[data-theme="dark"] .reset-filters-btn.has-active-filters {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
}

.reset-filters-btn.has-active-filters:hover {
  background: rgba(239, 68, 68, 0.22) !important;
  border-color: var(--danger) !important;
  transform: scale(1.03);
}

@keyframes filter-active-glow {
  0%, 100% {
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.2);
  }
  50% {
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.45);
  }
}

.stat-line {
  font-size: 0.8125rem;
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

.stat-line b {
  color: var(--accent);
  font-weight: 800;
}

/* ==========================================================================
   Operation Segmented Controls (Above Results)
   ========================================================================== */

.op-segmented-bar {
  margin: 4px 0;
  width: 100%;
  display: flex;
}

.op-segmented-bar .segmented-control-track {
  width: 100%;
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-xs);
  scrollbar-width: none;
}

.op-segmented-bar .segmented-control-track::-webkit-scrollbar {
  display: none;
}

.segment-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all var(--duration-fast) var(--ease-smooth);
  flex-shrink: 0;
}

.segment-btn:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.segment-btn:active {
  transform: scale(0.97);
}

.segment-btn.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 800;
  box-shadow: 0 2px 6px var(--accent-glow);
}

/* ==========================================================================
   Toolbar & Photo Limiter
   ========================================================================== */

.toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-xs);
  flex-wrap: wrap;
}

.toolbar-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar h2 {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.photo-limit-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  height: 36px;
  flex-shrink: 0;
}

.photo-limit-picker label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  font-family: var(--font-display);
}

.photo-limit-picker select {
  font-size: 0.8125rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 800;
  cursor: pointer;
  outline: none;
  height: 26px;
}

.toolbar #downloadAllBtn {
  height: 36px;
  padding: 0 14px;
  font-size: 0.8125rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==========================================================================
   Buttons & Interactive Elements
   ========================================================================== */

.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  user-select: none;
  min-height: 38px;
  transition: all var(--duration-fast) var(--ease-smooth);
  line-height: 1.2;
}

.btn:active {
  transform: scale(0.98);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
  min-height: 34px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  min-height: 26px;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  box-shadow: 0 2px 6px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 3px 10px var(--accent-glow);
}

[data-theme="dark"] .btn-primary {
  background: #2563eb;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

[data-theme="dark"] .btn-primary:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.55);
}

.btn-primary:disabled {
  background: var(--surface-3);
  color: var(--subtle);
  border-color: var(--border);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-ghost {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--border-hover);
  color: var(--text);
}

[data-theme="dark"] .btn-ghost {
  background: var(--surface-2);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

[data-theme="dark"] .btn-ghost:hover {
  background: var(--surface-3);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: var(--danger);
}

/* Social Share Buttons — Calibrated for Harmony */
.btn-share-wa {
  background: #10b981;
  color: #ffffff;
  border: none;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.25);
}

.btn-share-wa:hover {
  background: #059669;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.btn-share-wa:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-share-fb {
  background: #2563eb;
  color: #ffffff;
  border: none;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.25);
}

.btn-share-fb:hover {
  background: #1d4ed8;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.btn-share-fb:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.theme-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  transition: all var(--duration-fast) ease;
}

.theme-btn:hover {
  border-color: var(--border-hover);
  background: var(--surface-3);
}

.icon-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--duration-fast) ease;
}

.icon-btn:hover {
  border-color: var(--border-hover);
  background: var(--surface-3);
  color: var(--accent);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn.has-update {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
  border-color: #34d399 !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
  animation: pulse-shake 1.4s infinite cubic-bezier(0.36, 0.07, 0.19, 0.97);
  position: relative;
}

.icon-btn.has-update::after {
  content: '';
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  background-color: #ef4444;
  border: 2px solid var(--surface);
  border-radius: 50%;
}

@keyframes pulse-shake {
  0%, 100% {
    transform: scale(1) rotate(0deg);
  }
  15% {
    transform: scale(1.08) rotate(-8deg);
  }
  30% {
    transform: scale(1.08) rotate(8deg);
  }
  45% {
    transform: scale(1.05) rotate(-4deg);
  }
  60% {
    transform: scale(1.05) rotate(4deg);
  }
  75% {
    transform: scale(1.02) rotate(0deg);
  }
}

/* ==========================================================================
   Property Listing Cards (.obj) — Maximum Scanability & Clean Ergonomics
   ========================================================================== */

.obj {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.obj:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.obj-head {
  display: flex;
  gap: 14px;
  padding: 14px;
  align-items: center;
}

.obj-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: transform var(--duration-normal) var(--ease-spring);
}

.obj:hover .obj-thumb {
  transform: scale(1.03);
}

.obj-info {
  flex: 1;
  min-width: 0;
}

.obj-code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 4px;
}

.obj-code::-webkit-scrollbar {
  display: none;
}

.code-badge {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: 0 1px 2px var(--accent-glow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}

[data-theme="dark"] .code-badge {
  background: rgba(37, 99, 235, 0.18);
  color: #60a5fa;
  border-color: #3b82f6;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.2);
}

.badge {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--badge-bg);
  color: var(--badge-color);
  border: 1px solid var(--badge-border);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
}

.badge-ofi {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info-border);
}

.badge-equipo {
  background: var(--surface-3);
  color: var(--text-secondary);
  border-color: var(--border);
}

.badge-planificador {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: var(--ok-border);
}

.badge-reserva {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
  font-weight: 800;
}

.badge-actualizacion {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--border-accent);
  font-weight: 700;
}

[data-theme="dark"] .badge-actualizacion {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.4);
}

.obj-title {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  margin: 3px 0 2px;
  line-height: 1.35;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: balance;
  letter-spacing: -0.01em;
}

.obj-meta {
  font-size: 0.8125rem;
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  line-height: 1.4;
  font-weight: 500;
}

.obj-actions {
  padding: 0 14px 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.obj-actions .btn {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.obj-actions .btn-primary {
  grid-column: 1 / -1;
  width: 100%;
}

.obj-actions .btn-share-wa {
  grid-column: 1;
}

.obj-actions .btn-share-fb {
  grid-column: 2;
}

.obj-actions .btn-copy-catalog {
  grid-column: 1;
}

.obj-actions .btn-copy-facebook {
  grid-column: 2;
}

.obj-actions .progress-pill {
  grid-column: 1 / -1;
}

.progress-pill {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ok);
  font-weight: 700;
  display: none;
  background: var(--ok-bg);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ok-border);
  width: 100%;
  margin-top: 2px;
  box-sizing: border-box;
}

.progress-pill.show {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: pulseGlow 1.8s infinite alternate ease-in-out;
}

@keyframes pulseGlow {
  from {
    opacity: 0.85;
    box-shadow: 0 0 2px var(--ok-bg);
  }
  to {
    opacity: 1;
    box-shadow: 0 0 10px var(--ok-bg);
  }
}

/* ==========================================================================
   Empty & Drop States
   ========================================================================== */

.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
  font-size: 0.9375rem;
  background: var(--surface);
  border: 1.5px dashed var(--border-hover);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.empty-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.empty-text {
  max-width: 340px;
  line-height: 1.45;
  color: var(--muted);
  font-size: 0.875rem;
}

.note {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
}

.drop {
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 18px 14px;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}

.drop:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.drop.dragover {
  border-color: var(--accent);
  background: var(--accent-bg-hover);
  box-shadow: var(--shadow-glow);
}

.drop-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  box-shadow: var(--shadow-xs);
}

.drop strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
}

.drop span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

input[type="file"] {
  display: none;
}

.links-list {
  padding: 6px 14px 12px;
}

.links-list a {
  display: inline-block;
  padding: 4px 8px;
  margin: 2px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 700;
  text-decoration: none;
  transition: all var(--duration-fast) ease;
}

.links-list a:hover {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.app-footer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 6px;
  box-shadow: var(--shadow-xs);
}

.app-footer p {
  margin: 0;
  line-height: 1.5;
}

.app-footer strong {
  color: var(--text);
  font-weight: 700;
}

.app-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-family: var(--font-mono);
  transition: color var(--duration-fast) ease;
}

.app-footer a:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

/* ==========================================================================
   Mobile Responsive Viewports
   ========================================================================== */

@media (max-width: 640px) {
  html {
    font-size: 14px;
  }

  /* Evita el zoom automático no deseado en iOS Safari al tocar inputs/selects */
  input[type="text"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }

  header {
    padding: 8px 10px;
  }

  header .header-inner {
    gap: 6px;
  }

  header .brand {
    gap: 6px;
  }

  header .brand-mark {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  header h1 {
    font-size: 1.05rem;
    white-space: nowrap;
  }

  .header-actions {
    gap: 5px;
    flex-shrink: 0;
    align-items: center;
  }

  .data-timestamp-pill {
    padding: 3px 6px;
    font-size: 0.65rem;
    gap: 3px;
  }

  .data-timestamp-pill svg {
    width: 10px;
    height: 10px;
  }

  #themeToggleBtn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0;
  }

  #themeToggleBtn #themeLabel {
    display: none !important;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  main {
    padding: 10px 8px 36px;
    gap: 10px;
  }

  .card {
    padding: 12px;
    border-radius: var(--radius-lg);
  }

  .compact-selects-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px;
  }

  .reset-filters-btn {
    font-size: 0.75rem;
    padding: 5px 9px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }

  .toolbar-header {
    justify-content: space-between;
    width: 100%;
  }

  .toolbar h2 {
    font-size: 0.9375rem;
  }

  .toolbar-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
  }

  .photo-limit-picker {
    flex: 1 1 40%;
    justify-content: center;
    min-width: 0;
    height: 38px;
  }

  .photo-limit-picker select {
    max-width: 80px;
  }

  .toolbar #downloadAllBtn {
    flex: 1 1 60%;
    height: 38px;
    justify-content: center;
    min-width: 0;
  }

  .obj-head {
    padding: 10px 12px;
    gap: 10px;
  }

  .obj-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
  }

  .obj-code {
    gap: 4px;
  }

  .code-badge {
    font-size: 0.75rem;
    padding: 2px 6px;
  }

  .badge {
    font-size: 0.65rem;
    padding: 2px 5px;
  }

  .obj-title {
    font-size: 0.875rem;
    line-height: 1.3;
  }

  .obj-actions {
    padding: 0 12px 12px;
    gap: 6px;
  }

  .obj-actions .btn {
    min-height: 38px;
    font-size: 0.75rem;
    padding: 4px 6px;
  }

  .obj-actions .btn-primary {
    min-height: 40px;
    font-size: 0.8125rem;
  }
}

@media (max-width: 400px) {
  header {
    padding: 6px 8px;
  }

  header .brand-mark {
    width: 28px;
    height: 28px;
  }

  header h1 {
    font-size: 0.95rem;
  }

  .data-timestamp-pill {
    font-size: 0.6rem;
    gap: 3px;
  }

  .icon-btn,
  #themeToggleBtn {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 360px) {
  .day-pills-track .chip {
    min-width: 28px;
    font-size: 0.6875rem;
    padding: 0 1px;
  }

  .group-pills-track .chip.chip-num {
    min-width: 26px;
    font-size: 0.75rem;
  }
}

/* ==========================================================================
   iOS Share Modal & Action Sheet
   ========================================================================== */

.ios-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: iosFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes iosFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ios-modal-sheet {
  background: var(--surface);
  border: 1px solid var(--border-highlight);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 20px 28px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
  animation: iosSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 640px) {
  .ios-modal-backdrop {
    align-items: center;
    padding: 20px;
  }
  .ios-modal-sheet {
    border-radius: 20px;
    border-bottom: 1px solid var(--border-highlight);
    max-height: 85vh;
  }
}

@keyframes iosSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.ios-modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border-highlight);
  border-radius: 999px;
  margin: 0 auto 12px;
}

.ios-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ios-modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}

.ios-modal-close {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) ease;
}

.ios-modal-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.ios-modal-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.ios-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.ios-btn-full {
  width: 100%;
  padding: 13px 18px;
  font-size: 0.9375rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(230, 81, 0, 0.35);
}

.ios-modal-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ios-btn-quick {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-md);
  min-height: 42px;
}

.ios-modal-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.ios-modal-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.ios-gallery-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
}

.ios-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ios-gallery-item .ios-photo-link {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 6px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 60%);
  color: #fff;
  text-decoration: none;
  font-size: 0.6875rem;
  font-weight: 600;
  text-align: center;
}

.ios-gallery-item .ios-photo-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}