@charset "UTF-8";

/* ═══════════════════════════════════════════════════════════════════
   ImperBur CRM — PWA Stylesheet v3.0
   Premium Design System · Glassmorphism · Dual Theme · Micro-anim
   Tipografía: Poppins · Colores: ImperBur Identity v1.2 (2026)
   "Más que impermeable. Imparable."
═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap');

/* ── TOKENS DE LAYOUT (siempre activos, sin color) ────────────── */
:root {
  /* Layout */
  --nav-h:      64px;
  --header-h:   60px;
  --radius:     16px;
  --radius-sm:  10px;
  --radius-lg:  24px;
  --radius-xl:  32px;
  /* Blur */
  --blur:    blur(20px);
  --blur-sm: blur(10px);
  /* Transitions */
  --tr:        0.18s ease;
  --tr-slow:   0.35s cubic-bezier(0.4,0,0.2,1);
  --tr-spring: 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

/* ── TEMA OSCURO ────────────────────────────────────────────────── */
[data-theme="dark"] {
  /* Corporativos ImperBur */
  --brand:        #0069b3;
  --brand-dark:   #004f89;
  --brand-light:  #1a82cc;
  --brand-xlight: #3399db;
  --isotipo:      #3399db;
  --brand-glow:   rgba(0,105,179,0.45);

  /* Gradientes de marca */
  --grad-brand:   linear-gradient(135deg, #0069b3 0%, #3399db 100%);
  --grad-surface: linear-gradient(180deg, rgba(10,22,44,0.95) 0%, rgba(5,12,26,0.98) 100%);

  /* Backgrounds */
  --bg:           #04090f;
  --surface:      rgba(8,16,32,0.85);
  --surface-2:    rgba(13,26,52,0.9);
  --surface-3:    rgba(20,38,70,0.85);
  --surface-card: rgba(10,20,42,0.92);
  --glass:        rgba(10,24,50,0.7);
  --glass-border: rgba(51,153,219,0.14);

  /* Borders */
  --border:       rgba(51,153,219,0.10);
  --border-2:     rgba(51,153,219,0.20);
  --border-3:     rgba(51,153,219,0.35);

  /* Text */
  --text:         #EFF6FF;
  --text-2:       #85b4d8;
  --text-3:       #3d6e96;

  /* Navbar overlay */
  --nav-bg: rgba(5,12,26,0.88);
  --nav-border: rgba(51,153,219,0.12);

  /* Legacy aliases */
  --gold:       #0069b3;
  --gold-light: #3399db;
  --gold-dark:  #004f89;
  --navy:       #001c35;
  --navy-dark:  #000e1f;
  --navy-light: var(--brand);
  --carbon:     #000000;
  --chalk:      #ffffff;

  /* Semantic */
  --success:    #10b981;
  --success-bg: rgba(16,185,129,0.12);
  --warning:    #f59e0b;
  --warning-bg: rgba(245,158,11,0.12);
  --danger:     #ef4444;
  --danger-bg:  rgba(239,68,68,0.12);
  --info:       #3399db;
  --info-bg:    rgba(51,153,219,0.12);

}

/* ── TEMA CLARO ─────────────────────────────────────────────────── */
[data-theme="light"] {
  --brand:        #0058a0;
  --brand-dark:   #004080;
  --brand-light:  #0072cc;
  --brand-xlight: #2a8dc9;
  --isotipo:      #2a8dc9;
  --brand-glow:   rgba(0,88,160,0.25);
  --grad-brand:   linear-gradient(135deg, #0058a0 0%, #2a8dc9 100%);
  --grad-surface: linear-gradient(180deg, #ffffff 0%, #f6f9fd 100%);

  --bg:           #edf2f8;
  --surface:      rgba(255,255,255,0.95);
  --surface-2:    rgba(240,246,252,0.95);
  --surface-3:    rgba(224,236,248,0.90);
  --surface-card: rgba(255,255,255,0.98);
  --glass:        rgba(255,255,255,0.80);
  --glass-border: rgba(0,88,160,0.12);

  --border:       rgba(0,88,160,0.10);
  --border-2:     rgba(0,88,160,0.18);
  --border-3:     rgba(0,88,160,0.30);

  --text:         #0a1929;
  --text-2:       #3a6a9a;
  --text-3:       #6a96bc;

  --nav-bg: rgba(248,251,255,0.92);
  --nav-border: rgba(0,88,160,0.10);

  --gold:       #0058a0;
  --gold-light: #2a8dc9;
  --gold-dark:  #004080;
  --navy:       #d6e8f7;
  --navy-dark:  #0a1929;
  --navy-light: var(--brand);

  --success:    #059669;
  --success-bg: rgba(5,150,105,0.10);
  --warning:    #d97706;
  --warning-bg: rgba(217,119,6,0.10);
  --danger:     #dc2626;
  --danger-bg:  rgba(220,38,38,0.10);
  --info:       #2a8dc9;
  --info-bg:    rgba(42,141,201,0.10);
}

/* ── RESET ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 16px; }
body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.4s ease, color 0.4s ease;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* Transición suave SOLO en body/html al cambiar tema */
html, body { transition: background-color 0.35s ease; }

/* ── APP SHELL ──────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

/* Fondo con patrón sutil en dark */
[data-theme="dark"] #app::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 10% 0%,   rgba(51,153,219,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 100%, rgba(0,105,179,0.08)  0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}
[data-theme="light"] #app::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 10% 0%,   rgba(42,141,201,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 100%, rgba(0,88,160,0.04)   0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ── HEADER ─────────────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.header-back {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text-2);
  font-size: 20px;
  transition: background var(--tr), transform var(--tr);
  margin-right: 4px;
}
.header-back:active { background: var(--surface-3); transform: scale(0.9); }

.header-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.header-action {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--brand);
  font-size: 20px;
  transition: background var(--tr), transform var(--tr);
}
.header-action:active { background: var(--surface-3); transform: scale(0.9); }
.header-badge {
  position: absolute;
  top: 8px; right: 8px;
  width: 10px; height: 10px;
  background: var(--brand);
  border-radius: 50%;
  border: 2px solid var(--bg);
}

/* ── SCREEN SYSTEM ──────────────────────────────────────────────── */
.screens { flex: 1; overflow: hidden; position: relative; z-index: 1; }
.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  transition: transform var(--tr-slow);
  will-change: transform;
}
.screen.active { transform: translateX(0); }
.screen.slide-out { transform: translateX(-25%); }

/* ── BOTTOM NAV ─────────────────────────────────────────────────── */
.bottom-nav {
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-top: 1px solid var(--nav-border);
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 10;
  position: relative;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  color: var(--text-3);
  transition: color var(--tr-slow), transform var(--tr);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.nav-item.active { color: var(--brand); }
.nav-item:active { transform: scale(0.88); }

/* Pill indicator activo */
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px;
  background: var(--grad-brand);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 0 8px var(--brand-glow);
}

.nav-icon { font-size: 22px; line-height: 1; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.2px; }
.nav-badge {
  position: absolute;
  top: 6px; right: 18%;
  min-width: 16px; height: 16px;
  background: var(--danger);
  border-radius: 99px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.15); }
}

/* ── CONTENT HELPERS ────────────────────────────────────────────── */
.scroll-content { padding: 16px 16px 0; }
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-3);
  margin-bottom: 10px;
  margin-top: 22px;
}
.section-title:first-child { margin-top: 0; }

/* ── CARDS ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
}
.card-pressable {
  transition: background var(--tr), transform var(--tr), box-shadow var(--tr);
  -webkit-tap-highlight-color: transparent;
}
.card-pressable:active {
  background: var(--surface-2);
  transform: scale(0.985);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ── SEARCH BAR ─────────────────────────────────────────────────── */
.search-wrap {
  padding: 12px 16px;
  background: var(--glass);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
}
.search-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 10px 14px 10px 38px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  position: relative;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--info-bg);
}
.search-box { position: relative; flex: 1; }
.search-box::before {
  content: '🔍';
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
}
.btn-filter {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap;
  transition: border-color var(--tr), background var(--tr);
}
.btn-filter:active { background: var(--surface-3); }

/* ── FILTER CHIPS ───────────────────────────────────────────────── */
.chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.chips-scroll::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 6px 16px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text-2);
  transition: all var(--tr);
  white-space: nowrap;
  cursor: pointer;
}
.chip:active { transform: scale(0.94); }
.chip.active {
  background: var(--grad-brand);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px var(--brand-glow);
}

/* ── SUB-TABS (Clientes / Potenciales) ──────────────────────────── */
.sub-tab {
  flex: 1;
  padding: 13px 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  color: var(--text-3);
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  transition: color var(--tr), border-color var(--tr), background var(--tr);
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -0.1px;
}
.sub-tab:active { background: var(--surface-2); }
.sub-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 700;
  background: var(--info-bg);
}

/* ── STATUS PILLS ───────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.pill-pending   { background: rgba(245,158,11,0.15); color: #FBBF24; }
.pill-review    { background: rgba(249,115,22,0.15); color: #f97316; }  /* En Revisión */
.pill-info      { background: rgba(42,141,201,0.15); color: #60A5FA; }
.pill-responded { background: rgba(42,141,201,0.15); color: #60A5FA; }
.pill-done      { background: rgba(16,185,129,0.15); color: #34D399; }
.pill-rejected  { background: var(--danger-bg);      color: #F87171; }
.pill-archived  { background: rgba(156,163,175,0.15);color: #9CA3AF; }
.pill-converted { background: rgba(139,92,246,0.15); color: #A78BFA; }

/* ── LIST ITEMS ─────────────────────────────────────────────────── */
.list-item {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--tr), transform var(--tr);
}
.list-item:first-child { border-top: 1px solid var(--border); }
.list-item:active { background: var(--surface-2); transform: scale(0.99); }

.list-avatar {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--grad-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: 0 3px 12px var(--brand-glow);
}
.list-body { flex: 1; min-width: 0; }
.list-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.list-sub {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.list-chevron { color: var(--text-3); font-size: 14px; }

/* ── STAT CARDS ─────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  transition: transform var(--tr), box-shadow var(--tr);
}
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--grad-brand);
  border-radius: 3px 0 0 3px;
}
.stat-card:active { transform: scale(0.97); }

.stat-icon { font-size: 24px; }
.stat-val {
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -1px;
}
.stat-val.gold    { color: var(--brand); }
.stat-val.success { color: var(--success); }
.stat-val.info    { color: var(--info); }
.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.stat-trend { font-size: 11px; font-weight: 600; color: var(--success); }

/* ── BUTTONS ────────────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  transition: all var(--tr);
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -0.1px;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 4px 16px var(--brand-glow);
}
.btn-primary:active {
  box-shadow: 0 2px 8px var(--brand-glow);
}

.btn-secondary {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
}
.btn-secondary:active { background: var(--surface-3); }

.btn-danger {
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,0.25);
  color: var(--danger);
}
.btn-success {
  background: var(--success-bg);
  border: 1px solid rgba(16,185,129,0.25);
  color: var(--success);
}
.btn-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
}

/* FAB premium */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  right: 16px;
  width: 56px; height: 56px;
  border-radius: 18px;
  background: var(--grad-brand);
  color: #fff;
  font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  box-shadow:
    0 6px 24px var(--brand-glow),
    0 2px 8px rgba(0,0,0,0.20);
  z-index: 50;
  transition: transform var(--tr-spring), box-shadow var(--tr);
}
.fab:active {
  transform: scale(0.88);
  box-shadow: 0 3px 12px var(--brand-glow);
}

/* ── FORMS ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.form-input {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
  -webkit-appearance: none;
}
.form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--info-bg);
}
.form-select {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  -webkit-appearance: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--info-bg);
}
.form-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 5px;
  line-height: 1.4;
}

/* ── STOCK WAREHOUSE CARDS ──────────────────────────────────────── */
.warehouse-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wh-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform var(--tr);
}
.wh-card:active { transform: scale(0.98); }
.wh-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wh-dot.green { background: var(--success); box-shadow: 0 0 8px rgba(16,185,129,0.5); }
.wh-dot.amber { background: var(--warning); box-shadow: 0 0 8px rgba(245,158,11,0.5); }
.wh-dot.red   { background: var(--danger);  box-shadow: 0 0 8px rgba(239,68,68,0.5); }
.wh-info { flex: 1; }
.wh-name { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.wh-sub  { font-size: 11px; color: var(--text-3); }
.wh-qty  { font-size: 22px; font-weight: 800; color: var(--text); text-align: right; }
.wh-unit { font-size: 10px; color: var(--text-3); text-align: right; }

/* ── TARIFF TREE ────────────────────────────────────────────────── */
.tariff-family {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
  transition: box-shadow var(--tr);
}
.tariff-family:has(.family-header:active) {
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
.family-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--tr);
}
.family-header:active { background: var(--surface-2); }
.family-icon { font-size: 16px; }
.family-name { flex: 1; font-size: 14px; font-weight: 700; color: var(--text); }
.family-chevron {
  font-size: 12px;
  color: var(--text-3);
  transition: transform var(--tr-slow);
}
.tariff-family.open .family-chevron { transform: rotate(90deg); }
.family-discount-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.discount-badge {
  background: var(--info-bg);
  border: 1px solid var(--border-3);
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  min-width: 52px;
  text-align: center;
}
.discount-input {
  width: 64px;
  background: var(--surface-2);
  border: 1.5px solid var(--border-2);
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.discount-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--info-bg);
}
.discount-input::placeholder { color: var(--text-3); font-weight: 400; }
.subfamily-list {
  display: none;
  border-top: 1px solid var(--border);
}
.tariff-family.open .subfamily-list { display: block; }
.subfamily-row {
  display: flex;
  align-items: center;
  padding: 11px 16px 11px 36px;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.subfamily-row:last-child { border-bottom: none; }
.subfamily-name { flex: 1; font-size: 13px; color: var(--text-2); }
.subfamily-disc-input {
  width: 64px;
  background: var(--bg);
  border: 1.5px solid var(--border-2);
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color var(--tr), color var(--tr);
}
.subfamily-disc-input:focus { border-color: var(--brand); }
.subfamily-disc-input.custom {
  color: var(--brand);
  border-color: rgba(0,105,179,0.4);
}

/* ── CHART ──────────────────────────────────────────────────────── */
.chart-wrap {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 10px;
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.chart-title { font-size: 13px; font-weight: 700; color: var(--text); }
.chart-total {
  font-size: 24px;
  font-weight: 800;
  color: var(--brand);
  margin-bottom: 16px;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 80px;
}
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar {
  width: 100%;
  border-radius: 6px 6px 0 0;
  min-height: 2px;
  transition: height 0.7s cubic-bezier(0.34,1.56,0.64,1);
  cursor: pointer;
  position: relative;
}
.bar.current {
  background: var(--grad-brand);
  box-shadow: 0 0 10px var(--brand-glow);
}
.bar.previous { background: var(--surface-3); }
.bar-label { font-size: 9px; color: var(--text-3); font-weight: 500; text-align: center; }
.bar:hover::after {
  content: attr(data-val);
  position: absolute;
  bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3);
  color: var(--text);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  border: 1px solid var(--border-2);
  z-index: 5;
}
.chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 10px;
}
.legend-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-3);
}
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }

/* ── BOTTOM SHEET ───────────────────────────────────────────────── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tr-slow);
}
.sheet-overlay.open { opacity: 1; pointer-events: all; }
.bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border-top: 1px solid var(--glass-border);
  padding: 0 16px 32px;
  z-index: 101;
  transform: translateY(100%);
  transition: transform var(--tr-slow);
  max-height: 85dvh;
  overflow-y: auto;
}
.bottom-sheet.open { transform: translateY(0); }
.sheet-handle {
  width: 36px; height: 4px;
  background: var(--border-3);
  border-radius: 99px;
  margin: 14px auto 22px;
}
.sheet-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
  letter-spacing: -0.3px;
}

/* ── ACTION LIST ────────────────────────────────────────────────── */
.action-list { display: flex; flex-direction: column; gap: 8px; }
.action-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--tr), transform var(--tr), border-color var(--tr);
  -webkit-tap-highlight-color: transparent;
}
.action-item:active {
  background: var(--surface-3);
  transform: scale(0.98);
  border-color: var(--border-2);
}
.action-item-icon {
  font-size: 22px;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--info-bg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.action-item-body { flex: 1; }
.action-item-name { font-size: 14px; font-weight: 600; color: var(--text); }
.action-item-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.action-item.danger .action-item-icon { background: var(--danger-bg); }
.action-item.danger .action-item-name { color: var(--danger); }
.action-item > .action-item-icon + .action-item-body .action-item-name::after {
  content: ' →';
  color: var(--text-3);
  font-weight: 400;
}

/* ── LOGIN ──────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 15%, rgba(51,153,219,0.20) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 85%, rgba(0,105,179,0.16) 0%, transparent 50%),
    radial-gradient(ellipse at 10% 90%, rgba(0,79,137,0.10) 0%, transparent 40%);
  pointer-events: none;
}
.login-bg::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 200px;
  background: linear-gradient(to top right, rgba(0,105,179,0.08) 0%, transparent 100%);
  pointer-events: none;
}
.login-logo {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: env(safe-area-inset-top, 40px);
  padding-bottom: 24px;
  animation: loginLogoIn 0.8s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes loginLogoIn {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Logo SVG colocado directamente sobre el fondo oscuro */
.login-logo-img {
  display: block;
  margin: 0 auto 24px;
  user-select: none; -webkit-user-drag: none;
}
.login-subtitle {
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.55);
  margin-bottom: 4px; letter-spacing: 0.3px;
}
.login-grupo {
  font-size: 11px; font-weight: 400;
  color: rgba(255,255,255,0.3); letter-spacing: 0.5px;
}
.login-grupo span { font-weight: 700; color: rgba(51,153,219,0.6); }
.login-form {
  width: 100%; max-width: 380px;
  animation: loginFormIn 0.7s 0.15s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes loginFormIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-form .form-group:last-of-type { margin-bottom: 24px; }

/* ── ORDER STATUS ───────────────────────────────────────────────── */
.order-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
}
.order-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.order-ref    { font-size: 13px; font-weight: 700; color: var(--brand); font-family: monospace; }
.order-client { font-size: 13px; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.order-date   { font-size: 11px; color: var(--text-3); }
.order-amount { font-size: 18px; font-weight: 800; color: var(--text); text-align: right; }
.order-stages { display: flex; align-items: center; gap: 0; margin-top: 10px; }
.stage {
  flex: 1; height: 3px;
  background: var(--surface-3);
  border-radius: 99px;
  position: relative;
  transition: background 0.4s;
}
.stage.done   { background: var(--grad-brand); }
.stage.active { background: var(--success); }
.stage + .stage { margin-left: 2px; }

/* ── EMPTY STATE ────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 32px;
  animation: fadeInUp 0.4s ease both;
}
.empty-icon  { font-size: 52px; margin-bottom: 16px; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-desc  { font-size: 13px; color: var(--text-3); line-height: 1.5; }

/* ── DIVIDER ────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── TOAST ──────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  left: 16px; right: 16px;
  max-width: 448px;
  margin: 0 auto;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  z-index: 200;
  transform: translateY(-24px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success {
  border-color: rgba(16,185,129,0.4);
  color: var(--success);
}
.toast.error {
  border-color: rgba(239,68,68,0.4);
  color: var(--danger);
}

/* ── PROFILE CHIP (header home) ────────────────────────────────── */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--grad-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff;
  box-shadow: 0 2px 8px var(--brand-glow);
}
.user-info { display: flex; flex-direction: column; gap: 0; }
.user-name  { font-size: 12px; font-weight: 700; color: var(--text); line-height: 1.2; }
.user-role  { font-size: 10px; color: var(--brand); font-weight: 600; }

/* ── THEME TOGGLE BUTTON ────────────────────────────────────────── */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  font-size: 18px;
  color: var(--text-2);
  transition: all var(--tr-spring);
  cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle:active { transform: scale(0.88) rotate(20deg); }

/* ── INFO ROWS ──────────────────────────────────────────────────── */
.info-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.info-row:last-child { border-bottom: none; }
.info-key  { font-size: 12px; color: var(--text-3); font-weight: 500; flex-shrink: 0; }
.info-val  { font-size: 13px; color: var(--text);   font-weight: 600; text-align: right; }

/* ── HEADER BRAND (home) ────────────────────────────────────────── */
.app-header--home {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-border);
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
}
.header-brand-text {
  font-family: 'Poppins', sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: -0.2px;
}
.header-brand-text b {
  font-weight: 800;
  color: var(--isotipo);
}

/* Isotipo del header: blanco en tema oscuro, color corporativo en tema claro
   Esto implementa correctamente las versiones del Manual de Identidad:
   - Dark  → versión Tiza (blanca) para fondos oscuros
   - Light → versión Color (azul+negro) para fondos claros            */
[data-theme="dark"]  .header-brand img { filter: brightness(0) invert(1); }
[data-theme="light"] .header-brand img { filter: none; }

/* ── SLOGAN ─────────────────────────────────────────────────────── */
.brand-slogan {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  text-align: center;
  padding: 6px 0 2px;
}

/* ── QUICK ACCESS CARDS (home) ──────────────────────────────────── */
.quick-access-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  cursor: pointer;
  transition: transform var(--tr-spring), box-shadow var(--tr), border-color var(--tr);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.quick-access-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-brand);
  opacity: 0;
  transition: opacity var(--tr);
}
.quick-access-card:active {
  transform: scale(0.94);
  box-shadow: 0 4px 16px var(--brand-glow);
  border-color: var(--brand-light);
}
.quick-access-card:active::after { opacity: 0.06; }

/* ── ANIMATIONS ─────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes pulseBlue {
  0%,100% { box-shadow: 0 0 0 0 var(--brand-glow); }
  50%     { box-shadow: 0 0 0 8px transparent; }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.anim-in      { animation: fadeInUp 0.35s ease both; }
.anim-scale   { animation: scaleIn  0.3s cubic-bezier(0.34,1.56,0.64,1) both; }
.pulse-blue   { animation: pulseBlue 2.5s infinite; }

/* Skeleton loading shimmer */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface-2) 25%,
    var(--surface-3) 50%,
    var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

/* ── SCROLLBAR ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 0; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN SYSTEM v2.0
   Breakpoints: xs(≤360) · sm(361-390) · md(391-430) · lg(431-520) · xl(>520)
   Incluye: Landscape · Safe Areas · Touch targets · Visual Enhancements
   ═══════════════════════════════════════════════════════════════════ */

/* ── FLUID SPACING TOKENS ────────────────────────────────────────── */
:root {
  --gutter:     16px;
  --tap-target: 44px;
}

/* ── XS: iPhone SE, Galaxy A pequeño (≤360px) ───────────────────── */
@media screen and (max-width: 360px) {
  :root {
    --nav-h:    58px;
    --header-h: 54px;
    --gutter:   12px;
  }

  /* Typography */
  .stat-val       { font-size: 22px; letter-spacing: -0.5px; }
  .stat-icon      { font-size: 20px; }
  .stat-label     { font-size: 9px; }
  .stat-card      { padding: 14px 12px; gap: 4px; }
  .stats-grid     { padding: 12px; gap: 8px; }

  /* Lists */
  .list-name      { font-size: 13px; }
  .list-sub       { font-size: 11px; }
  .list-item      { padding: 12px; gap: 10px; }
  .list-avatar    { width: 40px; height: 40px; font-size: 14px; border-radius: 12px; }

  /* Nav */
  .nav-icon       { font-size: 20px; }
  .nav-label      { font-size: 9px; letter-spacing: 0; }
  .nav-badge      { right: 14%; }

  /* Layout */
  .scroll-content { padding: 12px 12px 0; }
  .search-wrap    { padding: 10px 12px; }
  .section-title  { margin-top: 16px; }
  .chips-scroll   { padding: 8px 12px; }
  .chip           { padding: 5px 12px; font-size: 11px; }

  /* Header */
  .header-title   { font-size: 15px; }

  /* Buttons & Forms */
  .btn            { padding: 12px 14px; font-size: 13px; min-height: 44px; }
  .form-input,
  .form-select    { padding: 11px 12px; font-size: 13px; min-height: 44px; }
  .form-label     { font-size: 10px; }

  /* Sheets */
  .bottom-sheet   { padding: 0 12px 28px; }
  .sheet-title    { font-size: 16px; margin-bottom: 16px; }
  .action-item    { padding: 12px; gap: 10px; }
  .action-item-icon { width: 40px; height: 40px; font-size: 20px; }

  /* Chart */
  .chart-bars     { height: 60px; }
  .bar-label      { font-size: 8px; }
  .chart-title    { font-size: 12px; }
  .chart-total    { font-size: 20px; margin-bottom: 12px; }
  .chart-wrap     { padding: 14px 12px; }

  /* Stock */
  .wh-qty         { font-size: 18px; }
  .wh-card        { padding: 12px; gap: 10px; }

  /* Quick access */
  .quick-access-card { padding: 12px 6px; }

  /* Empty */
  .empty-state    { padding: 40px 20px; }
  .empty-icon     { font-size: 44px; }

  /* Login */
  .login-wordmark { font-size: 28px; }
  .login-form     { padding: 0 4px; }
}

/* ── SM: iPhone 13 mini, Pixel 6a (361-390px) ───────────────────── */
@media screen and (min-width: 361px) and (max-width: 390px) {
  .stat-val   { font-size: 26px; }
  .stats-grid { padding: 14px; gap: 10px; }
  .stat-card  { padding: 16px 14px; }
}

/* ── MD: iPhone 14/15, Pixel 7 (391-430px) ──────────────────────── */
@media screen and (min-width: 391px) and (max-width: 430px) {
  .stat-val   { font-size: 28px; }
  .stats-grid { padding: 16px; gap: 12px; }
}

/* ── LG: iPhone Pro Max, Samsung Ultra (431-520px) ───────────────── */
@media screen and (min-width: 431px) {
  #app        { max-width: 520px; }

  .stat-val   { font-size: 32px; }
  .stat-icon  { font-size: 26px; }
  .stats-grid { gap: 14px; padding: 20px; }
  .stat-card  { padding: 20px 18px; }

  .list-item      { padding: 16px 20px; gap: 14px; }
  .list-avatar    { width: 48px; height: 48px; font-size: 18px; }
  .list-name      { font-size: 15px; }

  .nav-icon   { font-size: 24px; }
  .nav-label  { font-size: 11px; }

  .scroll-content { padding: 20px 20px 0; }
  .search-wrap    { padding: 14px 20px; }
  .chips-scroll   { padding: 10px 20px; }

  .chart-wrap     { padding: 20px; }
  .chart-bars     { height: 96px; }
  .chart-total    { font-size: 28px; }

  .action-item    { padding: 16px 20px; }
  .bottom-sheet   { padding: 0 20px 36px; }
  .sheet-title    { font-size: 20px; }

  .btn            { font-size: 15px; padding: 15px 22px; }
  .form-input,
  .form-select    { padding: 14px 16px; font-size: 15px; }
}

/* ── XL: Tablet / Pantalla grande (>520px) ──────────────────────── */
@media screen and (min-width: 521px) {
  #app {
    max-width: 560px;
    box-shadow: 0 0 80px rgba(0,0,0,0.35);
  }
  .stats-grid     { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .stat-val       { font-size: 26px; }
  .stat-label     { font-size: 9px; }
  .bottom-sheet   { max-width: 560px; }
  .scroll-content { padding: 24px 24px 0; }
}

/* ── LANDSCAPE: modo horizontal compacto ────────────────────────── */
@media screen and (orientation: landscape) and (max-height: 480px) {
  :root {
    --header-h: 48px;
    --nav-h:    50px;
  }

  .bottom-nav       { height: var(--nav-h); }
  .nav-icon         { font-size: 18px; }
  .nav-label        { display: none; }
  .nav-item         { gap: 0; padding: 6px 4px; }
  .nav-item.active::before { top: 4px; }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    padding: 10px 14px;
    gap: 8px;
  }
  .stat-card    { padding: 10px 12px; gap: 3px; }
  .stat-val     { font-size: 20px; }
  .stat-icon    { font-size: 16px; }
  .stat-label   { font-size: 8px; }

  .list-item        { padding: 10px 14px; }
  .chart-bars       { height: 56px; }
  .scroll-content   { padding: 10px 14px 0; }
  .section-title    { margin-top: 12px; margin-bottom: 8px; }

  .login-logo       { flex: 0.5; padding-top: 8px; padding-bottom: 8px; }
  .login-wordmark   { font-size: 24px; }
  .login-form       { padding-bottom: 8px; }
}

/* ═══════════════════════════════════════════════════════════════════
   SAFE AREA — Notch · Dynamic Island · Home Indicator (iOS/Android)
   ═══════════════════════════════════════════════════════════════════ */
@supports (padding: max(0px, env(safe-area-inset-bottom))) {
  .bottom-nav {
    height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .fab {
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
  }
  .screen {
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .bottom-sheet {
    padding-bottom: max(32px, calc(28px + env(safe-area-inset-bottom, 0px)));
  }
  .toast {
    top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 8px);
  }
  .login-screen {
    padding-top: max(24px, env(safe-area-inset-top, 24px));
    padding-bottom: max(40px, calc(32px + env(safe-area-inset-bottom, 0px)));
  }
  .app-header {
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
    align-items: flex-end;
    padding-bottom: 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   TOUCH OPTIMIZATIONS — Dispositivos con puntero grueso (táctil)
   ═══════════════════════════════════════════════════════════════════ */
@media (pointer: coarse) {
  .btn         { min-height: 48px; }
  .form-input,
  .form-select { min-height: 48px; }
  .nav-item    { min-width: 44px; }
  .bar:hover::after { display: none; } /* tooltips solo en desktop */

  /* Agrandar zonas de tap en items pequeños */
  .header-back,
  .header-action,
  .btn-icon { width: 44px; height: 44px; }
}

/* ═══════════════════════════════════════════════════════════════════
   MEJORAS VISUALES PREMIUM — Profundidad · Glassmorphism · Micro-UI
   ═══════════════════════════════════════════════════════════════════ */

/* ── STAT CARDS mejoradas ────────────────────────────────────────── */
.stat-card {
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
[data-theme="dark"] .stat-card {
  box-shadow:
    0 2px 16px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.04);
}
.stat-card--highlight {
  border-color: rgba(0,105,179,0.35);
  background: linear-gradient(135deg, rgba(0,105,179,0.08) 0%, var(--surface-card) 70%);
}
[data-theme="light"] .stat-card--highlight {
  border-color: rgba(0,88,160,0.25);
  background: linear-gradient(135deg, rgba(0,88,160,0.06) 0%, var(--surface-card) 70%);
}

/* ── LIST ITEMS: borde izquierdo al presionar ────────────────────── */
.list-item {
  border-left: 3px solid transparent;
  transition: background var(--tr), transform var(--tr), border-left-color var(--tr);
}
.list-item:active { border-left-color: var(--brand); }

/* ── NAV ICON glow en activo ─────────────────────────────────────── */
.nav-item.active .nav-icon {
  filter: drop-shadow(0 0 6px var(--brand-glow));
}

/* ── FAB: halo pulsante ──────────────────────────────────────────── */
.fab { overflow: visible; }
.fab::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 24px;
  background: var(--brand);
  opacity: 0;
  animation: fabHalo 3s ease-in-out infinite;
  z-index: -1;
}
@keyframes fabHalo {
  0%, 100% { transform: scale(1);    opacity: 0; }
  40%       { transform: scale(1.25); opacity: 0.22; }
  70%       { transform: scale(1.4);  opacity: 0; }
}

/* ── PILLS: brillo en dark mode ──────────────────────────────────── */
[data-theme="dark"] .pill-done    { box-shadow: 0 0 8px rgba(16,185,129,0.2); }
[data-theme="dark"] .pill-review  { box-shadow: 0 0 8px rgba(249,115,22,0.2); }
[data-theme="dark"] .pill-pending { box-shadow: 0 0 8px rgba(245,158,11,0.15); }
.pill { white-space: nowrap; flex-shrink: 0; }

/* ── BOTTOM SHEET: sombra realzada ───────────────────────────────── */
.bottom-sheet {
  box-shadow: 0 -4px 32px rgba(0,0,0,0.12), 0 -1px 0 var(--glass-border);
}
[data-theme="dark"] .bottom-sheet {
  box-shadow: 0 -8px 48px rgba(0,0,0,0.5), 0 -1px 0 rgba(51,153,219,0.15);
}
.sheet-handle {
  width: 40px;
  background: linear-gradient(90deg, transparent, var(--border-3), transparent);
}

/* ── CARD: profundidad ───────────────────────────────────────────── */
.card { box-shadow: 0 2px 12px rgba(0,0,0,0.05); }
[data-theme="dark"] .card {
  box-shadow: 0 2px 16px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.03);
}

/* ── INPUTS: highlight al enfocar ────────────────────────────────── */
.form-input:focus, .form-select:focus { background: var(--surface-card); }
.search-input:focus { background: var(--surface-card); }

/* ── INFO ROWS: mejor wrapping en móvil ─────────────────────────── */
.info-key { max-width: 45%; line-height: 1.4; }
.info-val { max-width: 55%; word-break: break-word; text-align: right; line-height: 1.4; }

/* ── CHART: profundidad ──────────────────────────────────────────── */
.chart-wrap { box-shadow: 0 2px 14px rgba(0,0,0,0.05); }
[data-theme="dark"] .chart-wrap {
  box-shadow: 0 2px 20px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.03);
}
.bar { will-change: height; }

/* ── ERROR STATE ─────────────────────────────────────────────────── */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
  animation: fadeInUp 0.4s ease both;
}
.error-icon  { font-size: 40px; }
.error-title { font-size: 16px; font-weight: 700; color: var(--danger); }
.error-desc  {
  font-size: 13px; color: var(--text-3);
  line-height: 1.6; max-width: 280px;
}

/* ── SKELETON mejorado ───────────────────────────────────────────── */
.skeleton-text   { height: 14px; border-radius: 6px; margin-bottom: 8px; }
.skeleton-text.sm  { height: 10px; width: 60%; }
.skeleton-text.lg  { height: 20px; width: 80%; }
.skeleton-circle   { border-radius: 50%; }
.skeleton-card     { height: 80px; border-radius: var(--radius); margin-bottom: 10px; }
.skeleton-stat     { height: 100px; border-radius: var(--radius); }

/* ── LOADING SPINNER ─────────────────────────────────────────────── */
.loading-spinner {
  width: 24px; height: 24px;
  border: 2.5px solid var(--border-2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
.loading-container {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 48px 24px;
}
.loading-text { font-size: 13px; color: var(--text-3); font-weight: 500; }

/* ── UTILIDADES DE TEXTO ─────────────────────────────────────────── */
.text-ellipsis {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.text-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════
   ACCESIBILIDAD
   ═══════════════════════════════════════════════════════════════════ */
/* Respeto por la preferencia de movimiento reducido */
@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;
  }
}

/* Alto contraste */
@media (prefers-contrast: high) {
  .card, .stat-card, .wh-card { border-width: 2px; }
  .pill { font-weight: 800; }
  .nav-item.active { text-decoration: underline; }
  .form-input, .form-select { border-width: 2.5px; }
}

/* ── PRINT ───────────────────────────────────────────────────────── */
@media print {
  .bottom-nav, .fab, .search-wrap, .chips-scroll { display: none; }
  #app         { max-width: 100%; height: auto; overflow: visible; }
  .screen      { position: static; transform: none; overflow: visible; }
  .screens     { overflow: visible; height: auto; }
  .app-header  { position: static; }
}
