/* ============================================================
   FINTRACK - Estilos principales
   Design: Dark industrial / financial terminal aesthetic
   ============================================================ */

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

/* ---- Variables ---- */
:root {
  --bg-primary: #0d0f14;
  --bg-secondary: #13161e;
  --bg-card: #1a1d27;
  --bg-hover: #1f2334;
  --bg-input: #0f1118;

  --border: #252836;
  --border-light: #2e3347;

  --text-primary: #e8eaf0;
  --text-secondary: #8b8fa8;
  --text-muted: #565a72;

  --accent: #4ade80;
  --accent-dim: rgba(74, 222, 128, 0.12);
  --accent-glow: 0 0 20px rgba(74, 222, 128, 0.15);

  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.12);
  --blue: #60a5fa;
  --blue-dim: rgba(96, 165, 250, 0.12);
  --yellow: #fbbf24;
  --yellow-dim: rgba(251, 191, 36, 0.12);
  --purple: #a78bfa;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;

  --font-mono: 'Space Mono', monospace;
  --font-sans: 'DM Sans', sans-serif;

  --transition: 0.18s ease;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
}

[data-theme="light"] {
  --bg-primary: #f0f2f7;
  --bg-secondary: #e4e7ef;
  --bg-card: #ffffff;
  --bg-hover: #f5f7fc;
  --bg-input: #f0f2f7;

  --border: #d8dce8;
  --border-light: #e8ebf4;

  --text-primary: #1a1d2e;
  --text-secondary: #5a5f7d;
  --text-muted: #9ba0bc;

  --accent: #16a34a;
  --accent-dim: rgba(22, 163, 74, 0.1);
  --accent-glow: 0 0 20px rgba(22, 163, 74, 0.1);

  --red: #dc2626;
  --red-dim: rgba(220, 38, 38, 0.1);
  --blue: #2563eb;
  --blue-dim: rgba(37, 99, 235, 0.1);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Login Screen ---- */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

#login-screen::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(74,222,128,0.04) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.5s ease;
}

.login-logo {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.3rem;
  letter-spacing: -1px;
}

.login-tagline {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 2.5rem;
}

.login-features {
  list-style: none;
  text-align: left;
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.login-features li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.login-features li .icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-google:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  box-shadow: var(--accent-glow);
  transform: translateY(-1px);
}

.btn-google svg { flex-shrink: 0; }

/* ---- Sheet Selector ---- */
#sheet-selector {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 500px;
  width: 100%;
  animation: fadeInUp 0.4s ease;
}

#sheet-selector h2 {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

#sheet-selector p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

.sheet-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.sheet-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.88rem;
}

.sheet-item:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.sheet-item .sheet-icon { color: var(--accent); font-size: 1rem; }
.sheet-item .sheet-name { font-weight: 500; flex: 1; }
.sheet-item .sheet-date { color: var(--text-muted); font-size: 0.78rem; }

.divider { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; color: var(--text-muted); font-size: 0.8rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---- App Layout ---- */
#app { display: none; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 220px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo span {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.sidebar-logo small {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.5rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text-secondary);
  border: 1px solid transparent;
  margin-bottom: 2px;
}

.nav-item .nav-icon { width: 18px; text-align: center; font-size: 1rem; }

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(74, 222, 128, 0.2);
  font-weight: 500;
}

.sidebar-footer {
  padding: 1rem 0.5rem;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.5rem;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  object-fit: cover;
}

.user-avatar-placeholder {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.user-name { font-size: 0.82rem; font-weight: 500; }
.user-email { font-size: 0.72rem; color: var(--text-muted); }

/* ---- Main Content ---- */
.main-content {
  margin-left: 220px;
  min-height: 100vh;
  padding: 2rem;
}

/* ---- Top bar ---- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.page-title {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.top-actions { display: flex; align-items: center; gap: 0.75rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0d0f14;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: #22c55e;
  box-shadow: var(--accent-glow);
  transform: translateY(-1px);
}

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

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.25);
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.2); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-icon { padding: 0.5rem; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---- Stat Cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}

.stat-card:hover { border-color: var(--border-light); }
.stat-card:hover::after { opacity: 1; }

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.stat-currency-badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-value.negative { color: var(--red); }
.stat-value.positive { color: var(--accent); }

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.stat-total-card {
  background: linear-gradient(135deg, rgba(74,222,128,0.08) 0%, transparent 60%);
  border-color: rgba(74, 222, 128, 0.2);
}

/* ---- Tables ---- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  background: var(--bg-secondary);
  padding: 0.75rem 1rem;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--bg-hover); }

.td-amount {
  font-family: var(--font-mono);
  font-weight: 700;
  white-space: nowrap;
}

.td-amount.income { color: var(--accent); }
.td-amount.expense { color: var(--red); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-income { background: var(--accent-dim); color: var(--accent); }
.badge-expense { background: var(--red-dim); color: var(--red); }
.badge-empresa { background: var(--blue-dim); color: var(--blue); }
.badge-personal { background: var(--yellow-dim); color: var(--yellow); }
.badge-mixto { background: rgba(167, 139, 250, 0.15); color: var(--purple); }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.2rem; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.form-label .required { color: var(--red); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.1);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control option { background: var(--bg-card); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }

/* ---- Upload Zone ---- */
.upload-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-input);
  position: relative;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.upload-zone .upload-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: block;
}

.upload-zone .upload-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.upload-zone .upload-text strong {
  color: var(--accent);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-preview {
  margin-top: 1rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
}

.upload-preview img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
}

/* ---- Analysis Result ---- */
.analysis-card {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.analysis-card .analysis-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.confidence-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.confidence-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.uncertain-field {
  background: var(--yellow-dim);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-sm);
}

/* ---- Filters ---- */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.filter-select {
  padding: 0.4rem 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: var(--font-sans);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.filter-select:focus { border-color: var(--accent); }

/* ---- Currency Grid ---- */
.currency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.currency-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: var(--transition);
}

.currency-card:hover { border-color: var(--border-light); }

.currency-code {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.currency-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.currency-rate-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.currency-rate-input {
  flex: 1;
  padding: 0.45rem 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}

.currency-rate-input:focus { border-color: var(--accent); }

.currency-permanent-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ---- Charts ---- */
.chart-container {
  position: relative;
  height: 220px;
}

/* ---- Loading ---- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 15, 20, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ---- Toast notifications ---- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  max-width: 360px;
  animation: slideInRight 0.25s ease;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: var(--shadow);
}

.toast-success { background: var(--accent-dim); border: 1px solid rgba(74,222,128,0.3); color: var(--accent); }
.toast-error { background: var(--red-dim); border: 1px solid rgba(248,113,113,0.3); color: var(--red); }
.toast-info { background: var(--blue-dim); border: 1px solid rgba(96,165,250,0.3); color: var(--blue); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  backdrop-filter: blur(3px);
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeInUp 0.2s ease;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.25rem;
  line-height: 1;
  transition: var(--transition);
}

.modal-close:hover { color: var(--text-primary); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ---- Summary Tables ---- */
.summary-table td.positive { color: var(--accent); font-family: var(--font-mono); }
.summary-table td.negative { color: var(--red); font-family: var(--font-mono); }
.summary-table td.mono { font-family: var(--font-mono); }

/* ---- Misc ---- */
.divider-h { height: 1px; background: var(--border); margin: 1.5rem 0; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-red { color: var(--red); }
.text-mono { font-family: var(--font-mono); }

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.5; }
.empty-state p { font-size: 0.875rem; }

.section-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

/* ---- Mobile hamburger ---- */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1.25rem;
  padding: 0.25rem;
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ---- Animations ---- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.animate-pulse { animation: pulse 1.5s ease infinite; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .mobile-overlay.show { display: block; }
  .hamburger { display: block; }
  .main-content { margin-left: 0; padding: 1rem; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .currency-grid { grid-template-columns: 1fr 1fr; }
  .filters-bar { flex-direction: column; }
  .top-bar { flex-wrap: wrap; gap: 0.75rem; }

  /* Panel de registro: apilar verticalmente en móvil */
  #panel-photo {
    grid-template-columns: 1fr !important;
  }

  /* Tabs de registro más compactos */
  #tab-photo, #tab-manual, #tab-conversion {
    font-size: 0.78rem;
    padding: 0.5rem 0.7rem;
  }

  /* Tablas con scroll horizontal */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px;
  }

  /* Dashboard: resumen mensual apilado */
  .main-content > div[style*="grid-template-columns:1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
  }

  /* Cards más compactas */
  .card { padding: 1rem; }

  /* Stat cards en 2 columnas */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }

  /* Top bar compacta */
  .top-bar { gap: 0.5rem; }
  .page-title { font-size: 0.95rem; }

  /* Filtros en columna */
  .filters-bar { gap: 0.5rem; }
  .filter-group { width: 100%; }
  .filter-select { width: 100%; }

  /* Formulario de confirmación de foto full width */
  #photo-form-panel { max-height: none !important; }

  /* Botones de acciones en historial */
  .btn-icon { padding: 0.4rem; font-size: 0.8rem; }
   .panel-photo-grid { display: flex !important; flex-direction: column !important; }
  .dashboard-two-col { display: flex !important; flex-direction: column !important; }
  .reports-two-col { display: flex !important; flex-direction: column !important; }

}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .currency-grid { grid-template-columns: 1fr; }
  .modal { padding: 1.25rem; }
  .login-card { padding: 1.5rem 1.25rem; }

  /* Tabs de registro en una fila scrolleable */
  #tab-photo, #tab-manual, #tab-conversion {
    font-size: 0.72rem;
    padding: 0.45rem 0.6rem;
    white-space: nowrap;
  }

  /* Ocultar texto de tabs, dejar solo emoji en pantallas muy pequeñas */
  .main-content { padding: 0.75rem; }

  /* Análisis result más compacto */
  .analysis-card { padding: 0.75rem; }

  /* Upload zone más compacta */
  .upload-zone { padding: 1.5rem 1rem; }
  .upload-zone .upload-icon { font-size: 1.8rem; }

  /* Stat values más pequeños */
  .stat-value { font-size: 1.1rem; }

  /* Summary tables apiladas */
  .summary-table th, .summary-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.75rem;
  }
}
