/* ─── DESIGN TOKENS ──────────────────────────────────────────────────── */
:root {
  /* Brand - Premium Look */
  --blue:    #005eb8;
  --blue-2:  #004285;
  --yellow:  #ffc800;
  --black:   #0f172a; /* Slate 900 */
  --ink:     #334155; /* Slate 700 */
  --muted:   #64748b; /* Slate 500 */
  --line:    #e2e8f0; /* Slate 200 */
  --bg:      #f8fafc; /* Slate 50 */
  --white:   #ffffff;
  --surface: #f1f5f9; /* Slate 100 */

  /* Semantic */
  --danger:     #dc2626;
  --danger-bg:  #fef2f2;
  --success:    #16a34a;
  --success-bg: #f0fdf4;
  --warning:    #d97706;
  --warning-bg: #fffbeb;

  /* Spacing scale */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;
  --sp-4: 16px;  --sp-6: 24px;  --sp-8: 32px;

  /* Radius */
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-full: 9999px;

  /* Elevation (Soft Coloured Shadows) */
  --shadow-sm: 0 2px 8px -2px rgba(15,23,42,0.06);
  --shadow-md: 0 8px 24px -4px rgba(15,23,42,0.08);
  --shadow-lg: 0 24px 48px -12px rgba(15,23,42,0.12);
  --shadow-blue: 0 8px 20px -4px rgba(0,94,184,0.3);

  /* Typography */
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system,
               BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Mobile nav height (for bottom padding offset) */
  --nav-h: 74px;
}

/* ─── RESET ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; max-width: 100%; }
html, body { width: 100%; min-width: 0; margin: 0; overflow-x: hidden; }
body { background: var(--bg); color: var(--ink); }
img, canvas, svg, video { display: block; max-width: 100%; }

/* ─── ACCESSIBILITY ──────────────────────────────────────────────────── */
/* Screen-reader only */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Skip link — visible only on keyboard focus */
.skip-link {
  position: absolute;
  top: -100%; left: 16px;
  background: var(--blue); color: var(--white);
  padding: 12px 24px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-weight: 700; font-size: 14px;
  z-index: 9999; text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 0; }

/* Focus visible — keyboard navigation ring */
:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0,94,184,0.12);
}

/* ─── TYPOGRAPHY ─────────────────────────────────────────────────────── */
.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px; font-weight: 800;
  letter-spacing: 0.5px; text-transform: uppercase;
}
h1, h2, h3 { margin: 0; color: var(--black); line-height: 1.15; }
h1 { font-size: 30px; font-weight: 900; letter-spacing: -0.5px; }
h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
h3 { font-size: 16px; font-weight: 700; }

/* ─── BUTTONS ────────────────────────────────────────────────────────── */
button, .button-link, input, select, textarea {
  width: 100%; max-width: 100%; min-width: 0; font: inherit;
}

button, .button-link {
  align-items: center;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--blue);
  color: var(--white);
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  gap: 6px;
  box-shadow: var(--shadow-sm);
}
button:hover, .button-link:hover { 
  background: var(--blue-2); 
  box-shadow: var(--shadow-blue);
  transform: translateY(-1px);
}
button:active, .button-link:active { 
  transform: scale(0.96) translateY(0); 
  opacity: 0.88; 
}

button.secondary,
#manual-button,
#logout-button,
#clear-filters,
#clear-dashboard-filters {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
button.secondary:hover,
#manual-button:hover,
#logout-button:hover,
#clear-filters:hover,
#clear-dashboard-filters:hover { 
  background: var(--surface); 
  color: var(--black);
  border-color: var(--muted);
  box-shadow: var(--shadow-md);
}

button.compact { min-height: 40px; }
.hidden { display: none !important; }

/* ─── INPUTS ─────────────────────────────────────────────────────────── */
label {
  display: grid; gap: 6px;
  color: var(--black); font-size: 14px; font-weight: 700;
}
input, select, textarea {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink);
  padding: 12px 14px; font-size: 16px;
  transition: all 0.2s ease;
}
input:focus, select:focus, textarea:focus {
  background: var(--white);
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0,94,184,0.12);
  outline: none;
}
input::placeholder { color: var(--muted); opacity: 1; }
textarea { resize: vertical; }
.hidden-field { display: none; }
.invalid-field {
  border-color: var(--danger) !important;
  background: var(--danger-bg);
  box-shadow: 0 0 0 4px rgba(220,38,38,0.12) !important;
}
.form-message {
  color: var(--danger); font-size: 14px;
  font-weight: 700; line-height: 1.35;
  margin: 0; width: 100%;
}
.field-hint {
  font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px;
}

/* ─── LOGIN ──────────────────────────────────────────────────────────── */
.login-shell {
  width: 100%; min-height: 100vh;
  display: grid; place-items: center; padding: 16px;
  background:
    linear-gradient(135deg, rgba(0,94,184,0.95), rgba(15,23,42,0.85)),
    var(--blue);
}
.login-panel {
  width: 100%; background: var(--white);
  border-radius: var(--radius-lg); padding: 32px 24px;
  box-shadow: var(--shadow-lg); display: grid; gap: 24px;
  animation: slideUpFade 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.login-logo { width: 220px; }
.login-form, .management-form, .filters { display: grid; gap: 18px; }
.login-note { color: var(--muted); font-size: 14px; line-height: 1.4; margin: 0; }
.login-vendor-name {
  min-height: 48px; border: 1px solid var(--line);
  border-radius: var(--radius-md); background: var(--surface);
  color: var(--blue); display: grid; align-items: center;
  padding: 12px 14px; font-size: 14px; font-weight: 800; line-height: 1.3;
}
.login-vendor-name.error { background: var(--danger-bg); color: var(--danger); }

/* ─── APP SHELL ──────────────────────────────────────────────────────── */
.app-shell { width: 100%; min-height: 100vh; display: grid; grid-template-columns: minmax(0,1fr); }

/* ─── SIDEBAR (Desktop default) ──────────────────────────────────────── */
.sidebar {
  width: 100%; background: var(--black); color: var(--white);
  padding: 12px 16px; display: grid; gap: 12px;
}
.brand { display: grid; gap: 10px; font-weight: 800; }
.brand img { width: 170px; background: var(--white); border-radius: var(--radius-md); padding: 8px; }
.nav-tabs { display: grid; gap: 6px; }
.nav-tab {
  text-align: left; background: transparent; color: var(--white);
  border: 1px solid rgba(255,255,255,0.16);
  transition: all 0.2s ease;
  gap: 8px;
}
.nav-tab:hover { background: rgba(255,255,255,0.1); }
.nav-tab:active { transform: scale(0.98); }
.nav-tab.active,
.nav-tab[aria-selected="true"] {
  background: var(--yellow); color: var(--black); border-color: transparent;
  box-shadow: 0 4px 12px rgba(255, 200, 0, 0.2);
}
.user-card { display: grid; gap: 6px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.16); }
.user-card small { color: #cbd5e1; font-size: 12px; }

/* ─── WORKSPACE ──────────────────────────────────────────────────────── */
.workspace { width: 100%; min-width: 0; padding: 16px; }
.topbar { display: grid; gap: 12px; margin-bottom: 24px; }
.topbar-actions, .form-actions { display: grid; gap: 10px; }

/* Mobile user info strip */
.mobile-user-info {
  display: none;
  align-items: center; gap: 12px;
  background: transparent; border: none;
  padding: 0; margin-bottom: 8px;
  font-size: 13px; font-weight: 700; color: var(--ink);
}
.mobile-user-avatar {
  width: 40px; height: 40px;
  background: var(--blue); color: var(--white);
  border-radius: 50%; display: flex;
  align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; flex-shrink: 0;
  box-shadow: var(--shadow-blue);
}
.mobile-user-info button {
  background: var(--white); border: 1px solid var(--line);
  color: var(--ink); box-shadow: var(--shadow-sm);
}

/* ─── VIEWS & ANIMATIONS ─────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Staggered grid animations */
.form-grid > * { animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
.form-grid > *:nth-child(1) { animation-delay: 0.02s; }
.form-grid > *:nth-child(2) { animation-delay: 0.04s; }
.form-grid > *:nth-child(3) { animation-delay: 0.06s; }
.form-grid > *:nth-child(4) { animation-delay: 0.08s; }
.form-grid > *:nth-child(5) { animation-delay: 0.10s; }
.form-grid > *:nth-child(6) { animation-delay: 0.12s; }
.form-grid > *:nth-child(7) { animation-delay: 0.14s; }
.form-grid > *:nth-child(n+8) { animation-delay: 0.16s; }

.kpi { animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
.kpi:nth-child(1) { animation-delay: 0.05s; }
.kpi:nth-child(2) { animation-delay: 0.10s; }
.kpi:nth-child(3) { animation-delay: 0.15s; }
.kpi:nth-child(4) { animation-delay: 0.20s; }
.kpi:nth-child(n+5) { animation-delay: 0.25s; }

/* ─── CARDS / PANELS ─────────────────────────────────────────────────── */
.management-form, .filters, .admin-toolbar, .chart-panel, .table-wrap {
  width: 100%; min-width: 0; background: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-sm);
}
.form-grid, .filters, .admin-toolbar, .kpi-grid, .dashboard-grid, .heatmap {
  display: grid; grid-template-columns: minmax(0,1fr); gap: 20px;
}

/* ─── MODAL ──────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 16px;
  background: rgba(15,23,42,0.6); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-panel {
  width: min(440px, 100%); background: var(--white);
  border-radius: var(--radius-lg); padding: 24px;
  display: grid; gap: 16px; box-shadow: var(--shadow-lg);
  animation: slideUpFade 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ─── ADMIN ──────────────────────────────────────────────────────────── */
.admin-toolbar { margin-bottom: 20px; }
.user-form, #user-kpi-grid { margin-bottom: 20px; }
.admin-table select { min-width: 150px; }

/* ─── FILTERS ────────────────────────────────────────────────────────── */
.file-field { align-content: start; }
.filters { align-items: end; margin-bottom: 20px; }

/* ─── TABLE ──────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto; overflow-y: hidden; padding: 0;
  -webkit-overflow-scrolling: touch;
}
table { width: 100%; min-width: 1340px; border-collapse: collapse; }
th, td {
  border-bottom: 1px solid var(--line);
  padding: 16px; text-align: left;
  font-size: 14px; white-space: nowrap;
}
th {
  background: var(--surface); color: var(--ink);
  font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.5px;
  position: sticky; top: 0; z-index: 1;
}
td[contenteditable="true"] {
  background: #fffdf0; outline-color: var(--yellow); cursor: text;
  border-radius: var(--radius-sm); margin: 2px 0;
}
td[contenteditable="true"]:hover { background: #fffbe6; }
td[contenteditable="true"]:focus { box-shadow: inset 0 0 0 2px var(--yellow); outline: none; }

.row-actions { display: flex; gap: 8px; }
.row-actions button {
  width: auto; min-height: 44px; min-width: 44px;
  padding: 0 14px; font-size: 13px;
}
.delete-button { background: var(--danger); color: var(--white); }
.delete-button:hover { background: #b91c1c; }
.edit-button { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.edit-button:hover { background: var(--white); border-color: var(--muted); }

/* ─── STATUS BADGES ──────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.status-badge-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}

/* ─── KPI CARDS ──────────────────────────────────────────────────────── */
.kpi-grid { margin-bottom: 20px; }
.kpi {
  background: var(--white); border: 1px solid var(--line);
  border-left: 6px solid var(--yellow);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}
.kpi:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.kpi strong { display: block; color: var(--black); font-size: 28px; font-weight: 800; line-height: 1.2; margin-bottom: 4px; overflow-wrap: anywhere; }
.kpi span { color: var(--muted); font-size: 13px; font-weight: 700; }

/* ─── QUOTE TOTAL ────────────────────────────────────────────────────── */
.quote-total {
  background: var(--blue); border: none; color: var(--white);
  border-radius: var(--radius-lg); display: grid; gap: 6px; padding: 20px;
  box-shadow: var(--shadow-blue);
}
.quote-total span { color: rgba(255,255,255,0.8); font-size: 14px; font-weight: 700; }
.quote-total strong { color: var(--white); font-size: 32px; font-weight: 800; }

/* ─── CHARTS ─────────────────────────────────────────────────────────── */
.chart-panel { min-height: 320px; display: grid; grid-template-rows: auto 1fr; gap: 16px; }
.chart-panel canvas { width: 100%; height: 260px; }

/* ─── HEATMAP ────────────────────────────────────────────────────────── */
.heat-cell {
  border-radius: var(--radius-md); color: var(--black);
  min-height: 84px; padding: 16px; display: grid;
  align-content: space-between; border: 1px solid rgba(0,0,0,0.04);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}
.heat-cell:hover { transform: scale(1.03); box-shadow: var(--shadow-md); z-index: 2; position: relative; }
.heat-cell strong { font-size: 16px; font-weight: 800; }

/* ─── EMPTY STATE ────────────────────────────────────────────────────── */
.empty-state { padding: 48px; text-align: center; color: var(--muted); font-size: 15px; font-weight: 600; }

/* ─── GLOBAL LOADER ──────────────────────────────────────────────────── */
#global-loader {
  position: fixed; top: 16px; right: 20px; z-index: 1000;
  background: var(--blue); color: var(--white);
  padding: 10px 20px 10px 16px;
  border-radius: var(--radius-full);
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-blue);
  opacity: 0; transform: translateY(-12px);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
#global-loader.visible { opacity: 1; transform: translateY(0); }
.loader-spinner {
  width: 18px; height: 18px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── TOAST NOTIFICATIONS ────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 24px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--black); color: var(--white);
  padding: 14px 28px; border-radius: var(--radius-full);
  font-weight: 700; font-size: 15px;
  opacity: 0; z-index: 600; pointer-events: none;
  box-shadow: var(--shadow-lg); white-space: nowrap;
  max-width: calc(100vw - 32px);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-success { background: var(--success); }
.toast.toast-error   { background: var(--danger);  }
.toast.toast-info    { background: var(--blue);    }
.toast.toast-warning { background: var(--warning); }

/* ─── OFFLINE BANNER ─────────────────────────────────────────────────── */
#offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 800;
  background: var(--danger); color: var(--white);
  text-align: center; padding: 12px 16px;
  font-weight: 700; font-size: 14px;
  transform: translateY(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-md);
}
#offline-banner.visible { transform: translateY(0); }

/* ─── RESPONSIVE: 480px ──────────────────────────────────────────────── */
@media (min-width: 480px) {
  .login-panel { width: min(440px, 100%); padding: 40px; }
}

/* ─── RESPONSIVE: 768px ──────────────────────────────────────────────── */
@media (min-width: 768px) {
  button { width: auto; min-height: 48px; }
  label { font-size: 14px; }
  input, select, textarea { min-height: 48px; font-size: 15px; padding: 12px 14px; }
  .login-vendor-name { min-height: 48px; }
  .sidebar { position: sticky; top: 0; z-index: 3; }
  .nav-tabs { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .workspace { padding: 32px; }
  .topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px; }
  .topbar-actions, .form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; }
  .form-grid, .filters, .admin-toolbar, .kpi-grid, .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
  .span-2, .wide { grid-column: span 2; }
  .heatmap { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

/* ─── RESPONSIVE: 1080px (desktop) ──────────────────────────────────── */
@media (min-width: 1080px) {
  :root { --nav-h: 0px; }

  .app-shell { grid-template-columns: 280px minmax(0,1fr); }
  .sidebar { min-height: 100vh; align-content: space-between; padding: 24px; }
  .brand img { width: 190px; }
  .nav-tabs { grid-template-columns: minmax(0,1fr); }

  .form-grid { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
  .filters { grid-template-columns: repeat(6, minmax(140px,1fr)) auto; gap: 16px; }
  .admin-toolbar { grid-template-columns: minmax(0,1fr) auto; gap: 16px; align-items: end; }
  .kpi-grid { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }

  .mobile-user-info { display: none !important; }
  .fab-add { display: none !important; }
  .toast { bottom: 32px; }
}

/* ─── MOBILE: Bottom Navigation Bar (<1080px) ────────────────────────── */
@media (max-width: 1079px) {
  :root { --nav-h: 80px; }

  .app-shell { display: flex; flex-direction: column; min-height: 100vh; }

  /* Floating Pill Nav (Glassmorphism) */
  .sidebar {
    order: 2;
    position: fixed; bottom: 16px; left: 16px; right: 16px;
    z-index: 100; gap: 0; padding: 8px;
    background: rgba(15, 23, 42, 0.85); /* Slate 900 translucent */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-full);
    box-shadow: 0 12px 32px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255,255,255,0.15);
    margin-bottom: env(safe-area-inset-bottom, 0px);
  }
  .brand, .user-card { display: none; }

  .nav-tabs {
    display: flex; justify-content: space-around; width: 100%;
  }
  .nav-tab {
    flex-direction: column; gap: 4px;
    font-size: 10px; font-weight: 700;
    min-height: 52px; padding: 6px 12px;
    border: none; border-radius: var(--radius-full);
    text-align: center; line-height: 1.2;
    background: transparent; color: rgba(255,255,255,0.6);
    flex: 1;
    position: relative;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .nav-tab-icon { 
    font-size: 22px; line-height: 1; 
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .nav-tab.active {
    color: var(--white);
    background: transparent;
  }
  .nav-tab.active .nav-tab-icon {
    transform: scale(1.15) translateY(-2px);
    color: var(--yellow);
  }
  .nav-tab.active::after {
    content: ''; position: absolute;
    bottom: 2px; left: 50%; transform: translateX(-50%);
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--yellow);
    box-shadow: 0 0 8px var(--yellow);
  }

  /* Hide normal 'Ingreso' tab on mobile */
  #tab-form { display: none !important; }

  /* Floating Action Button (FAB) */
  .fab-add {
    display: flex;
    position: fixed;
    bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom, 0px));
    right: 20px;
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--blue);
    color: var(--white);
    font-size: 32px; font-weight: 300; line-height: 1;
    box-shadow: var(--shadow-blue), inset 0 1px 1px rgba(255,255,255,0.2);
    z-index: 90;
    align-items: center;
    justify-content: center;
    padding: 0; border: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  }
  .fab-add:hover { transform: scale(1.05); box-shadow: 0 12px 24px rgba(0,94,184,0.4); }
  .fab-add:active { transform: scale(0.95); }
  .fab-add.hidden { display: none; }

  .workspace {
    order: 1; flex: 1;
    padding-bottom: calc(var(--nav-h) + 110px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-user-info { display: flex; }

  /* Responsive Cards — Native Notification Style */
  .table-wrap {
    background: transparent; border: none; box-shadow: none;
    padding: 0; overflow-x: visible;
  }

  table.responsive-cards,
  table.responsive-cards thead,
  table.responsive-cards tbody,
  table.responsive-cards th,
  table.responsive-cards td,
  table.responsive-cards tr { display: block; }

  table.responsive-cards { min-width: 0; width: 100%; }
  table.responsive-cards thead { display: none; }

  table.responsive-cards tr {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius-lg); margin-bottom: 16px;
    padding: 0; box-shadow: var(--shadow-sm);
    overflow: hidden;
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  
  /* Stagger cards up to 10 */
  table.responsive-cards tr:nth-child(1) { animation-delay: 0.05s; }
  table.responsive-cards tr:nth-child(2) { animation-delay: 0.10s; }
  table.responsive-cards tr:nth-child(3) { animation-delay: 0.15s; }
  table.responsive-cards tr:nth-child(4) { animation-delay: 0.20s; }
  table.responsive-cards tr:nth-child(5) { animation-delay: 0.25s; }
  table.responsive-cards tr:nth-child(n+6) { animation-delay: 0.30s; }
  
  table.responsive-cards td {
    display: flex; justify-content: space-between;
    align-items: flex-start; gap: 12px;
    padding: 12px 16px; border: none;
    border-bottom: 1px solid var(--surface);
    white-space: normal; font-size: 14px;
  }
  /* Highlight the "Cliente" row to look like a card title */
  table.responsive-cards td[data-label="Cliente"] {
    font-size: 16px; font-weight: 800; color: var(--black);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }
  table.responsive-cards td:last-child { 
    border-bottom: none; 
    background: var(--bg);
  }
  table.responsive-cards td::before {
    content: attr(data-label);
    font-weight: 700; color: var(--muted);
    font-size: 12px; text-transform: uppercase;
    letter-spacing: 0.2px; flex-shrink: 0;
    min-width: 100px; padding-top: 1px;
  }
  table.responsive-cards .row-actions { justify-content: flex-end; width: 100%; gap: 12px; }
  table.responsive-cards .row-actions button {
    flex: 1; padding: 10px; font-size: 14px; min-height: 44px;
  }
}

/* 4-column nav on tablet */
@media (min-width: 768px) and (max-width: 1079px) {
  .nav-tabs { max-width: 500px; margin: 0 auto; }
}
