/* ── Variables ───────────────────────────────────────────────────────────────── */
:root {
  --bg:           #f0f4f9;
  --card:         #ffffff;
  --text:         #14213d;
  --muted:        #64748b;
  --accent:       #2563eb;
  --accent-soft:  #dbeafe;
  --accent-dark:  #1d4ed8;
  --danger:       #dc2626;
  --success:      #16a34a;
  --warn:         #f97316;
  --border:       #e2e8f0;
  --nav-bg:       #0f172a;
  --radius-sm:    8px;
  --radius:       14px;
  --radius-lg:    20px;
  --shadow:       0 2px 12px rgba(15,23,42,0.08);
  --shadow-lg:    0 8px 32px rgba(15,23,42,0.14);
  --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --touch:        44px;
}

/* ── Reset ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

input, select, textarea, button { font: inherit; }

/* ── Utilidades ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.full-width { grid-column: 1 / -1; }

/* ── Login ───────────────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #0f172a 0%, #1e3a8a 60%, #2563eb 100%);
  padding: 24px 16px;
}

.login-box {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.4);
}

.login-logo {
  text-align: center;
}

.login-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent);
  color: white;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.login-box h2 {
  font-size: 1.25rem;
  text-align: center;
  color: var(--text);
}

.login-box form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-error {
  background: #fef2f2;
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  text-align: center;
  border: 1px solid #fecaca;
}

/* ── App shell ───────────────────────────────────────────────────────────────── */
#appContent {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #2563eb 100%);
  color: white;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-text { flex: 1; min-width: 0; }

.hero-text h1 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Nav principal ───────────────────────────────────────────────────────────── */
.main-nav {
  background: var(--nav-bg);
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.main-nav::-webkit-scrollbar { display: none; }

.nav-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.55);
  padding: 0 18px;
  height: var(--touch);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.nav-btn.active { color: white; border-bottom-color: var(--accent); }

/* ── Views ───────────────────────────────────────────────────────────────────── */
.view { flex: 1; }

/* ── App shell grid ──────────────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  gap: 14px;
  padding: 14px;
  grid-template-columns: 1fr;
}

/* ── Card ────────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

/* ── Stats ───────────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px;
}

.stat {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat h3 {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
}

.stat p {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

/* ── Section heading ─────────────────────────────────────────────────────────── */
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-heading h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 3px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
}

/* ── Table ───────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

th { color: var(--muted); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Badges ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.badge.low  { background: #fef2f2; color: var(--danger); }
.badge.ok   { background: #f0fdf4; color: var(--success); }
.badge.warn { background: #fff7ed; color: #c2410c; }
.badge.info { background: #eff6ff; color: var(--accent-dark); }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

input, select, textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  background: #f8fafc;
  color: var(--text);
  font-size: 0.92rem;
  min-height: var(--touch);
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
  background: white;
}

textarea { min-height: 80px; resize: vertical; }

.field-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.primary-btn, .ghost-btn {
  border: none;
  border-radius: 999px;
  padding: 0 20px;
  height: var(--touch);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.primary-btn:active, .ghost-btn:active { transform: scale(0.97); }

.primary-btn { background: var(--accent); color: white; }
.primary-btn:hover { opacity: 0.9; }

.ghost-btn { background: var(--accent-soft); color: var(--accent-dark); }
.ghost-btn:hover { background: #bfdbfe; }

.full-btn { width: 100%; border-radius: var(--radius-sm); }

button.small {
  height: 34px;
  padding: 0 12px;
  font-size: 0.8rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: #fef2f2; color: var(--danger); }

/* ── Wizard ──────────────────────────────────────────────────────────────────── */
.wizard-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.step {
  background: #f1f5f9;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  flex: 1;
  text-align: center;
  white-space: nowrap;
}
.step.active { background: var(--accent); color: white; }

.wizard-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ── Summary ─────────────────────────────────────────────────────────────────── */
.summary-box { background: #f8fafc; border-radius: var(--radius); border: 1px dashed var(--border); overflow: hidden; }

.summary-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

.summary-section { padding: 13px 16px; }

.summary-eyebrow {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 4px;
}

.summary-title { font-size: 1rem; font-weight: 700; }
.summary-sub { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.summary-divider { height: 1px; background: var(--border); }

.summary-amounts { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }

.summary-amount-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
}
.summary-amount-row span:first-child { color: var(--muted); }
.summary-debt strong { color: var(--danger); }

/* ── List / List-item ────────────────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: 10px; }

.list-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card);
}

/* ── Compras ─────────────────────────────────────────────────────────────────── */
.purchase-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.purchase-header > div { display: flex; flex-direction: column; gap: 2px; }
.purchase-header small { color: var(--muted); font-size: 0.8rem; }

.purchase-meta {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.meta-row { display: flex; justify-content: space-between; font-size: 0.86rem; }
.meta-row span:first-child { color: var(--muted); }
.meta-row.highlight span:last-child { font-weight: 700; color: var(--danger); }

.date-overdue { color: var(--danger); font-weight: 700; }
.date-urgent  { color: #c2410c; font-weight: 700; }

.purchase-notes { font-size: 0.82rem; color: var(--muted); font-style: italic; }

.purchase-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Fotos ───────────────────────────────────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.photo-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  background: #f8fafc;
  cursor: pointer;
}

.photo-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.photo-card img {
  width: 100%;
  max-height: 130px;
  object-fit: cover;
  border-radius: 5px;
}

/* ── Inputs de foto con cámara / galería ────────────────────────────────────── */
.photo-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.photo-input-label-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.photo-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.photo-btns { display: flex; gap: 8px; }

.photo-btn-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 0 14px;
  height: var(--touch);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.photo-btn-label:hover { background: #bfdbfe; }

.photo-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.photo-remove {
  position: absolute;
  top: 2px; right: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: white;
  border: none;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Buscador ────────────────────────────────────────────────────────────────── */
.search-box { margin-bottom: 12px; }

.search-box input {
  width: 100%;
  border-radius: 999px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-size: 0.9rem;
  min-height: var(--touch);
}
.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  background: white;
}

/* ── Nuevo proveedor inline ──────────────────────────────────────────────────── */
.new-supplier-box {
  background: #eff6ff;
  border: 1px dashed #93c5fd;
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Proveedores cards ───────────────────────────────────────────────────────── */
.supplier-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }

.supplier-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fafbff;
}

.supplier-card-header { display: flex; align-items: center; gap: 10px; }

.supplier-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  flex-shrink: 0;
}

.supplier-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.supplier-info strong { font-size: 0.92rem; }
.supplier-info small  { color: var(--muted); font-size: 0.78rem; }
.supplier-notes       { font-size: 0.8rem; color: var(--muted); font-style: italic; }

.supplier-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.sup-stat {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sup-stat-val   { font-size: 0.82rem; font-weight: 700; }
.sup-stat-label { font-size: 0.65rem; color: var(--muted); }
.sup-stat-debt .sup-stat-val { color: var(--danger); }

/* ── Expiry cards ────────────────────────────────────────────────────────────── */
.expiry-card {
  border-radius: var(--radius);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-left: 5px solid var(--border);
}
.expiry-card.expiry-ok       { border-left-color: #22c55e; background: #f0fdf4; }
.expiry-card.expiry-warn     { border-left-color: var(--warn); background: #fff7ed; }
.expiry-card.expiry-danger   { border-left-color: var(--danger); background: #fef2f2; }
.expiry-card.expiry-critical { border-left-color: #7f1d1d; background: #fef2f2; }

.expiry-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.expiry-title  { display: flex; flex-direction: column; gap: 2px; }
.expiry-title strong { font-size: 0.92rem; }
.expiry-title small  { color: var(--muted); font-size: 0.76rem; }

.expiry-days {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(0,0,0,0.07);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.expiry-card.expiry-danger .expiry-days,
.expiry-card.expiry-critical .expiry-days { background: #fecaca; color: #991b1b; }
.expiry-card.expiry-warn .expiry-days     { background: #fed7aa; color: #9a3412; }

.expiry-date { font-size: 0.8rem; color: var(--muted); }

.expiry-supplier {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
}
.expiry-sup-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.expiry-sup-name {
  font-weight: 700;
  color: var(--accent-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expiry-dates {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(255,255,255,0.6);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.expiry-date-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
}
.expiry-date-row span:first-child { color: var(--muted); }
.expiry-date-row span:last-child  { font-weight: 600; }
.expiry-shelf span:last-child     { color: var(--accent-dark); }

.expiry-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.expiry-stat {
  background: rgba(255,255,255,0.7);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.expiry-stat-val   { font-size: 0.82rem; font-weight: 700; }
.expiry-stat-label { font-size: 0.65rem; color: var(--muted); }
.expiry-stat-debt .expiry-stat-val { color: var(--danger); }

/* ── Mantenimiento ───────────────────────────────────────────────────────────── */
.maint-tabs {
  display: flex;
  background: white;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.maint-tabs::-webkit-scrollbar { display: none; }

.maint-tab {
  background: none;
  border: none;
  padding: 0 16px;
  height: var(--touch);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s;
}
.maint-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.maint-panel { padding: 14px; }

.maint-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.maint-form-actions { display: flex; gap: 8px; justify-content: flex-end; }

.maint-list { display: flex; flex-direction: column; gap: 8px; }

.maint-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fafbff;
}
.maint-item-info { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.maint-item-info strong { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.maint-item-info small  { color: var(--muted); font-size: 0.76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.maint-item-actions { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.maint-empty { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 24px 0; }

/* Producto card en mantenimiento */
.product-maint-card {
  display: flex;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fafbff;
}

.product-maint-photo {
  width: 80px;
  min-height: 80px;
  flex-shrink: 0;
  cursor: pointer;
  overflow: hidden;
}

.product-maint-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-maint-nophoto {
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.product-maint-nophoto span {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
}

.product-maint-body {
  flex: 1;
  padding: 10px 12px 10px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.product-maint-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.product-maint-header > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.product-maint-header strong {
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-maint-header small {
  color: var(--muted);
  font-size: 0.76rem;
}

.product-maint-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 0.78rem;
  color: var(--muted);
}

.product-maint-meta strong { color: var(--text); }
.text-danger { color: var(--danger); }

/* Preview foto en form producto */
.product-photo-preview {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.product-photo-preview img {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.product-photo-preview p {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 6px 10px;
  margin: 0;
  background: #f8fafc;
}

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 900;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-box {
  background: var(--card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px 32px;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-lg);
}

.modal-header { display: flex; align-items: center; gap: 10px; }
.modal-icon { font-size: 1.4rem; }
.modal-header h2 { font-size: 1.05rem; font-weight: 700; }

.modal-list { display: flex; flex-direction: column; gap: 8px; }

.alert-item {
  border-radius: var(--radius);
  padding: 11px 13px;
  border-left: 4px solid var(--border);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.alert-item.alert-overdue { border-left-color: var(--danger); background: #fef2f2; }
.alert-item.alert-urgent  { border-left-color: var(--warn); background: #fff7ed; }
.alert-item.alert-normal  { border-left-color: var(--accent); background: #eff6ff; }

.alert-item-header { display: flex; justify-content: space-between; align-items: center; }
.alert-saldo { font-weight: 700; font-size: 1rem; color: var(--danger); }
.alert-item-detail { font-size: 0.8rem; color: var(--muted); }
.alert-item-due { font-size: 0.83rem; font-weight: 600; }
.alert-item.alert-overdue .alert-item-due { color: var(--danger); }
.alert-item.alert-urgent .alert-item-due  { color: #c2410c; }

/* ── Lightbox ────────────────────────────────────────────────────────────────── */
.photo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.94);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
}
.photo-overlay img { max-width: 100%; max-height: 84vh; border-radius: var(--radius); object-fit: contain; }
.overlay-close {
  color: white;
  font-size: 0.88rem;
  cursor: pointer;
  align-self: flex-end;
  padding: 6px 14px;
  background: rgba(255,255,255,0.14);
  border-radius: 999px;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TABLET  ≥ 600px
═══════════════════════════════════════════════════════════════════════════════ */
@media (min-width: 600px) {
  .hero { padding: 18px 24px; }
  .hero-text h1 { font-size: 1.15rem; }

  .app-shell { padding: 18px; gap: 16px; }

  .stats-grid { grid-template-columns: repeat(4, 1fr); }

  .field-grid { grid-template-columns: repeat(2, 1fr); }

  .supplier-grid { grid-template-columns: repeat(2, 1fr); }

  .modal-overlay { align-items: center; padding: 16px; }
  .modal-box { border-radius: var(--radius-lg); max-width: 440px; }

  .maint-panel { padding: 18px; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   DESKTOP  ≥ 1024px
═══════════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  .hero { padding: 20px 32px; }
  .hero-text h1 { font-size: 1.25rem; white-space: normal; }

  /* Dashboard: 2 columnas */
  #view-dashboard .app-shell {
    grid-template-columns: 1.2fr 1fr;
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 32px;
  }

  #view-dashboard .stats-grid {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, 1fr);
  }

  /* Compras: 2 columnas */
  #view-purchases .app-shell {
    grid-template-columns: 1fr 1fr;
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 32px;
  }

  /* Mantenimiento: centrado con max-width */
  .maint-panel {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 32px;
  }

  .maint-tabs { padding: 0 32px; }

  .field-grid { grid-template-columns: repeat(4, 1fr); }

  .supplier-grid { grid-template-columns: repeat(3, 1fr); }

  .nav-btn { font-size: 0.9rem; padding: 0 24px; }
}
