*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
input, textarea { -webkit-user-select: text; user-select: text; }

:root {
  --bg: #F5F5F7;
  --card: #fff;
  --text: #1a1a1a;
  --text2: #666;
  --text3: #999;
  --blue: #2175f3;
  --blue-light: #E3F2FD;
  --green: #4CAF50;
  --red: #F44336;
  --amber: #FF9800;
  --border: #e0e0e0;
  --radius: 12px;
  --nav-height: 64px;
  --header-height: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #ffffff;
  color: var(--text);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.screen { display: none; height: 100%; }
.screen.active { display: flex; flex-direction: column; }

/* ─── Login ─── */
#login-screen {
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}
.login-container {
  background: var(--card);
  border-radius: 20px;
  padding: 40px 32px;
  width: min(360px, 90vw);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* Token verification screen */
#token-verify-screen {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
  gap: 20px;
}
.token-verify-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e0e0e0;
  border-top: 4px solid #2196F3;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.token-verify-text {
  font-size: 16px;
  color: #666;
  font-weight: 500;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 24px; font-weight: 800; margin-top: 8px; }
.login-logo p { color: var(--text2); font-size: 14px; margin-top: 4px; }
#login-form input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
#login-form input:focus { border-color: var(--blue); }
#login-form button {
  width: 100%;
  padding: 14px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: 12px;
  transition: opacity 0.2s;
}
#login-form button:active { opacity: 0.8; }
.error-text { color: var(--red); font-size: 13px; text-align: center; margin-top: 12px; min-height: 18px; }

/* ─── Header ─── */
#app-header {
  background: #ffffff;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: env(safe-area-inset-top, 0px);
  transition: border-color 0.2s;
}
#app-header.has-tabs {
  border-bottom-color: transparent;
}
.header-content {
  display: flex;
  align-items: center;
  height: var(--header-height);
  padding: 0 12px;
  gap: 8px;
}
.header-icon { font-size: 24px; color: var(--text); }
.header-title { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; flex: 1; }
.header-actions { display: flex; gap: 4px; }
.icon-btn {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.icon-btn:hover { background: rgba(0,0,0,0.05); }
.icon-btn:active { background: rgba(0,0,0,0.1); }
.icon-btn:focus { outline: none; }
.icon-btn.active-filter span { color: var(--blue); }
.search-bar {
  display: flex;
  align-items: center;
  height: var(--header-height);
  padding: 0 4px;
  gap: 4px;
}
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: inherit;
  background: transparent;
  color: var(--text);
}

/* ─── Content ─── */
#content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 10px 16px;
  padding-top: 0;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 36px);
  overscroll-behavior: none;
  background: var(--bg);
}
#content:has(.tabs:not(.tabs-hidden)) {
  padding-top: 40px;
}
#content > :first-child:not(.tabs) {
  margin-top: 12px;
}
#content > .tabs + * {
  margin-top: 10px;
}

/* ─── Bottom Nav (iOS 26 Liquid Glass) ─── */
#bottom-nav {
  display: flex;
  align-items: center;
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  z-index: 600;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(4px) saturate(150%);
  -webkit-backdrop-filter: blur(4px) saturate(150%);
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(0,0,0,0.06);
  padding-bottom: var(--safe-bottom);
  height: calc(var(--nav-height) + var(--safe-bottom));
  border-radius: 99px;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: #1c1c1e;
  padding: 6px 0;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  position: relative;
  border-radius: 99px;
  margin: 4px 3px;
  transition: color 0.2s ease, background 0.2s ease;
}
.nav-item:active { opacity: 0.6; }
.nav-item .material-icons-outlined {
  font-size: 26px;
}
.nav-label {
  font-size: 11px;
  font-weight: 600;
}

/* Active: Liquid Glass nav effect */
.nav-item.active {
  color: var(--blue);
}
.nav-item .material-icons-outlined {
  font-size: 26px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-item.nav-drop .material-icons-outlined {
  transform: scale(1.3);
}
#nav-bubble {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  border-radius: 99px;
  background: rgba(120,120,130,0.10);
  transition: transform 0.4s cubic-bezier(0.4, 0.0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0.0, 0.2, 1), border-radius 0.4s cubic-bezier(0.4, 0.0, 0.2, 1), top 0.4s cubic-bezier(0.4, 0.0, 0.2, 1), bottom 0.4s cubic-bezier(0.4, 0.0, 0.2, 1), background 0.4s ease, backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease, border 0.4s ease, box-shadow 0.4s ease;
  pointer-events: none;
  z-index: 0;
  border: 1px solid transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
#nav-bubble.glass {
  top: -4px;
  bottom: -4px;
  border-radius: 42% 58% 55% 45% / 52% 48% 52% 48%;
  background: 
    radial-gradient(circle at 50% 38%, rgba(100,180,255,0.6) 0%, rgba(33,117,243,0.2) 10%, transparent 35%),
    rgba(200,200,210,0.15);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08), inset 0 1px 2px rgba(255,255,255,0.9), inset 0 0 25px rgba(100,180,255,0.35), inset 0 -8px 15px rgba(33,117,243,0.2);
  animation: reflectFadeIn 0.4s ease-out forwards;
}
#nav-drop-ring { display: none; }
.nav-item { z-index: 1; }

/* ─── Cards ─── */
.card {
  background: var(--card);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.04);
  overflow: hidden;
}
.card-row { display: flex; align-items: center; gap: 10px; }
.card-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.card-body { flex: 1; min-width: 0; }
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  line-height: 1.3;
}
.card-subtitle {
  font-size: 11px;
  color: var(--text2);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 3px;
  font-size: 11px;
  color: var(--text3);
}
.card-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}
.badge-green { background: rgba(76,175,80,0.1); color: #2E7D32; }
.badge-red { background: rgba(244,67,54,0.1); color: #C62828; }
.badge-blue { background: rgba(33,150,243,0.1); color: #1565C0; }
.badge-amber { background: rgba(255,152,0,0.1); color: #eca008; }
.badge-grey { background: rgba(158,158,158,0.1); color: #616161; }
.badge-indigo { background: rgba(63,81,181,0.12); color: #283593; }
.badge-teal { background: rgba(0,150,136,0.1); color: #00695C; }

.tag {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  background: #f5f5f5;
  color: var(--text2);
}
.amount { font-size: 13px; font-weight: 700; color: var(--text); }
.amount-red { color: #C62828; }
.amount-green { color: #2E7D32; }

/* ─── KPI Cards ─── */
.kpi-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  text-align: center;
  overflow: hidden;
  min-width: 0;
}
.kpi-card .kpi-icon { font-size: 20px; margin-bottom: 6px; }
.kpi-card .kpi-value { font-size: 12px; font-weight: 800; letter-spacing: -0.3px; }
.kpi-card .kpi-label { font-size: 10px; color: var(--text2); font-weight: 500; margin-top: 2px; }

/* ─── Period Selector ─── */
.period-selector { display: flex; gap: 6px; margin-bottom: 12px; }
.period-btn {
  flex: 1;
  padding: 9px 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: all 0.15s;
}
.period-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ─── Range Card ─── */
.range-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.range-card .material-icons-outlined { font-size: 20px; color: #607D8B; }
.range-card .range-label { font-size: 13px; font-weight: 600; }
.range-card .range-text { flex: 1; font-size: 12px; color: var(--text2); }

/* ─── Dashboard ─── */
.dash-vendor-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
}
.dash-stats-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #43A047, #2E7D32);
  border-radius: var(--radius);
  color: #fff;
  margin-bottom: 12px;
  font-size: 14px;
}
.dash-stats-banner .material-icons-outlined { font-size: 28px; }

/* ─── Tabs ─── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin: 0 -10px;
  padding: 0 10px;
  background: #ffffff;
  position: fixed;
  top: var(--header-height);
  padding-top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  z-index: 99;
  transform-origin: top center;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  max-height: 40px;
  overflow: hidden;
}
.tabs.tabs-hidden {
  max-height: 0;
  opacity: 0;
  border-bottom: none;
}
.tab-btn {
  flex: 1;
  padding: 12px 8px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-btn .material-icons-outlined { font-size: 18px; }

/* ─── Overlay / Dialog ─── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.dialog {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  width: min(360px, 100%);
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(0,0,0,0.06);
}
.dialog h3 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.dialog-section { margin-bottom: 12px; }
.dialog-section label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.dialog-actions button {
  padding: 8px 16px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  font-family: inherit;
  color: var(--blue);
}
.dialog-actions button:hover { background: var(--blue-light); }

/* ─── Date Buttons (like orders filter) ─── */
.date-row { display: flex; gap: 8px; }
.date-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f5f5f5;
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  font-family: inherit;
  transition: all 0.15s;
}
.date-btn.has-value { background: var(--blue-light); border-color: #90CAF9; color: #0D47A1; font-weight: 600; }
.date-btn .material-icons-outlined { font-size: 14px; }
.date-btn .date-clear { margin-left: auto; cursor: pointer; font-size: 16px; color: var(--text3); }

/* ─── Status Chips ─── */
.chip-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f5f5f5;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chip.active { background: var(--blue-light); border-color: #90CAF9; color: #0D47A1; font-weight: 800; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; }

/* ─── Loading ─── */
.loading { text-align: center; padding: 40px; color: var(--text3); }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes reflectFadeIn {
  0% { 
    background: 
      radial-gradient(circle at 50% 38%, rgba(100,180,255,0) 0%, rgba(33,117,243,0) 10%, transparent 35%),
      rgba(200,200,210,0.15);
  }
  70% { 
    background: 
      radial-gradient(circle at 50% 38%, rgba(100,180,255,0) 0%, rgba(33,117,243,0) 10%, transparent 35%),
      rgba(200,200,210,0.15);
  }
  100% { 
    background: 
      radial-gradient(circle at 50% 38%, rgba(100,180,255,0.6) 0%, rgba(33,117,243,0.2) 10%, transparent 35%),
      rgba(200,200,210,0.15);
  }
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
}
.empty-state .material-icons-outlined { font-size: 64px; color: #ddd; }
.empty-state p { margin-top: 12px; font-size: 16px; font-weight: 500; }

/* ─── Responsive ─── */
@media (min-width: 768px) {
  #content { padding: 0 20px 20px; padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 40px); }
  .tabs { margin: 0 -20px; padding: 0 20px; }
  .card { padding: 12px; margin-bottom: 8px; border-radius: var(--radius); }
  .card-row { gap: 12px; }
  .card-avatar { width: 44px; height: 44px; font-size: 18px; }
  .card-title { font-size: 15px; }
  .stock-box { width: 56px; min-width: 56px; height: 56px; }
  .stock-value { font-size: 18px; }
  .price-box { font-size: 14px; padding: 4px 10px; }
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  #bottom-nav { max-width: 420px; left: 50%; right: auto; transform: translateX(-50%); width: calc(100% - 24px); }
}
@media (min-width: 1024px) {
  #app-screen { max-width: 800px; margin: 0 auto; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

/* ─── Product Card (Android-matching layout) ─── */
.stock-box {
  width: 48px;
  min-width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stock-value { font-size: 16px; font-weight: 800; line-height: 1.1; }
.stock-label { font-size: 7px; font-weight: 700; letter-spacing: 0.3px; }
.price-box {
  font-size: 12px;
  font-weight: 700;
  color: #1565C0;
  white-space: nowrap;
  padding: 3px 8px;
  background: #E3F2FD;
  border-radius: 6px;
  border: 1px solid #BBDEFB;
  flex-shrink: 0;
}
.product-card:active { background: #f0f0f0; }

/* ─── Client Detail (Android-matching) ─── */
.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}
.detail-section {
  background: var(--card);
  border-radius: var(--radius);
  margin-top: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.detail-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #607D8B;
  letter-spacing: 0.5px;
}
.detail-section-title .material-icons-outlined { font-size: 18px; }
.detail-section-subtitle {
  padding: 8px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.detail-section-body {
  padding: 4px 16px 16px;
}
.detail-field {
  margin-bottom: 12px;
}
.detail-field-label {
  font-size: 10px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}
.detail-field-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.phone-card {
  flex: 1;
  min-width: 140px;
  background: #F5F5F7;
  border-radius: 10px;
  padding: 10px 14px;
}

/* ─── Detail Header Bar (in-header, like Android app bar) ─── */
.detail-header-bar {
  display: flex;
  align-items: center;
  height: var(--header-height);
  padding: 0 4px;
  gap: 8px;
}



/* ─── Scroll-to-top FAB ─── */
.fab-scroll-top {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 32px);
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  cursor: pointer;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.2s;
}
.fab-scroll-top .material-icons-outlined {
  font-size: 24px;
  color: var(--text);
}
.fab-scroll-top:active {
  transform: scale(0.9);
}
@media (min-width: 1024px) {
  .fab-scroll-top {
    right: calc(50% - 400px + 16px);
  }
}

/* Single-line truncated title (clients) */
.card-title-single {
  display: block;
  white-space: nowrap;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
}

/* ─── Ver Movimientos Button (Android-matching) ─── */
.movements-btn-container {
  margin-top: 16px;
}
.movements-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #E3F2FD;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s;
}
.movements-btn:active { background: #BBDEFB; }
.movements-btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.movements-btn-icon .material-icons-outlined { font-size: 20px; color: #1976D2; }
.movements-btn-text { flex: 1; }
.movements-btn-title { font-size: 15px; font-weight: 700; color: #1976D2; }
.movements-btn-sub { font-size: 12px; color: #64B5F6; }

/* ─── Movement type box (client movements) ─── */
.mov-type-box {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mov-type-label {
  font-size: 7px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
}

/* ─── Grouped Transactions (invoice card with children inside) ─── */
.invoice-group-card {
  border: 1px solid rgba(0,0,0,0.06);
}
.invoice-group-card, .invoice-group-card:active { background: var(--card) !important; }
.invoice-header:active { background: #f0f0f0 !important; }
.invoice-child {
  border-top: 1px solid #E8EEF8;
}
.invoice-child:active { background: #D6E4F0 !important; }

/* ─── Tap/Press effect (mobile) ─── */
.tappable { transition: background 0.1s; }
.tappable:active { background: #f0f0f0 !important; }
.card { transition: background 0.1s; }
.card:active { background: #f5f5f5; }
.card.detail-card, .card.detail-card:active { background: #fff; cursor: default; }
.invoice-child:active { background: #D6E4F0 !important; }
.invoice-header:active { background: #f0f0f0 !important; }
.client-card:active { background: #f0f0f0 !important; }
.product-card:active { background: #f0f0f0 !important; }
.movements-btn:active { background: #BBDEFB !important; }

/* ─── Native date input styled as button (iOS fix) ─── */
.date-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f5f5f5;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
}
.date-input-wrap.has-value { background: var(--blue-light); border-color: #90CAF9; color: #0D47A1; font-weight: 600; }
.date-input-wrap input[type="date"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  font-size: 16px; /* prevents iOS zoom */
  -webkit-appearance: none;
}
.date-input-wrap .date-clear {
  margin-left: auto;
  cursor: pointer;
  font-size: 16px;
  color: var(--text3);
  z-index: 1;
}

/* ─── Swipe Gestures ─── */
.swipe-indicator {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-right: 16px;
  background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
  color: #1565C0;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
.swipe-indicator .material-icons-outlined {
  font-size: 20px;
}

/* ─── Collapsible Invoice Children ─── */
.invoice-children {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background: #F5F8FF;
  border-top: 1px solid #E8EEF8;
}
.invoice-children.expanded {
  max-height: 2000px;
  transition: max-height 0.4s ease-in;
}
.invoice-expand-icon {
  transition: transform 0.25s ease;
  font-size: 20px !important;
  color: #999;
}
.invoice-expand-icon.expanded {
  transform: rotate(180deg);
}
.invoice-detail-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #1976D2;
  cursor: pointer;
  border-top: 1px solid #E8EEF8;
}
.invoice-detail-link:active {
  background: #E3F2FD;
}

/* Connection banner */
#connection-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px 2px;
  padding-top: env(safe-area-inset-top, 0px);
  background: #D32F2F;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
#connection-banner.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#connection-banner .material-icons-outlined {
  font-size: 12px;
}

/* Modal status bar overlay */

/* ─── Bottom Sheet Adjustments ─── */
#bottom-sheet {
  bottom: -10px !important;
}
#bottom-sheet2 {
  bottom: -10px !important;
}
