/* ============================================================
   ROAN AUTOMOTORES — Estilos principales
   Paleta: Rojo #ee2930 | Negro #1A1A1A | Blanco #FFFFFF
============================================================ */

/* ─── Variables ─────────────────────────────────────────── */
:root {
  --red:        #ee2930;
  --red-dark:   #c41e24;
  --red-light:  #FDEAEA;
  --black:      #1A1A1A;
  --gray-900:   #111827;
  --gray-800:   #1F2937;
  --gray-700:   #374151;
  --gray-600:   #4B5563;
  --gray-400:   #9CA3AF;
  --gray-200:   #E5E7EB;
  --gray-100:   #F3F4F6;
  --gray-50:    #F9FAFB;
  --white:      #FFFFFF;
  --green:      #16A34A;
  --green-bg:   #DCFCE7;
  --yellow:     #D97706;
  --yellow-bg:  #FEF3C7;
  --blue:       #2563EB;
  --blue-bg:    #DBEAFE;

  --sidebar-w:  240px;
  --header-h:   60px;
  --radius:     8px;
  --radius-lg:  12px;
  --shadow:     0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.10), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.10), 0 4px 6px -2px rgba(0,0,0,.05);

  --font:       'Inter', system-ui, -apple-system, sans-serif;
  --transition: 150ms ease;
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--gray-50); color: var(--gray-800); line-height: 1.5; }
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }

/* ─── Screens ────────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ─── Login ──────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--black) 0%, #2d0a0a 50%, var(--red-dark) 100%);
  padding: 1rem;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  justify-content: center;
}
.logo-icon { width: 52px; height: 52px; }
.logo-icon svg { width: 100%; height: 100%; }
.logo-text { display: flex; flex-direction: column; }
.logo-roan { font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; color: var(--black); line-height: 1; }
.logo-auto { font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; color: var(--gray-400); }
.login-logo-img { width: 100%; max-width: 280px; display: block; margin: 0 auto; border-radius: 8px; }
.header-logo-img { height: 36px; width: auto; object-fit: contain; border-radius: 4px; }
@media (max-width: 768px) {
  .header-logo { display: flex; align-items: center; justify-content: center; }
  .header-logo-img { height: 30px; }
}
.login-title { text-align: center; font-size: 1rem; font-weight: 500; color: var(--gray-600); margin-bottom: 1.5rem; }
.form-login { display: flex; flex-direction: column; gap: 1rem; }

/* ─── Header ─────────────────────────────────────────────── */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--header-h);
  background: var(--red);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem;
  box-shadow: 0 2px 8px rgba(229,34,34,.4);
}
.header-left, .header-right { display: flex; align-items: center; gap: .75rem; }
.btn-sidebar-toggle {
  background: transparent; border: none; color: var(--white);
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); transition: background var(--transition);
}
.btn-sidebar-toggle:hover { background: rgba(255,255,255,.15); }
.btn-sidebar-toggle svg { width: 20px; height: 20px; }
.logo-icon-sm { width: 28px; height: 28px; }
.logo-icon-sm svg { width: 100%; height: 100%; }
.header-brand {
  font-size: 1.1rem; font-weight: 800; color: var(--white); letter-spacing: -.01em;
  display: flex; align-items: baseline; gap: .4rem;
}
.header-brand em { font-style: normal; font-weight: 400; font-size: .75rem; letter-spacing: .08em; opacity: .85; }
.user-badge { display: flex; align-items: center; gap: .5rem; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.2); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
}
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: .85rem; font-weight: 600; color: var(--white); line-height: 1.2; }
.user-role { font-size: .7rem; color: rgba(255,255,255,.7); text-transform: capitalize; }
.btn-icon {
  background: transparent; border: none; color: rgba(255,255,255,.85);
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); transition: all var(--transition);
}
.btn-icon:hover { background: rgba(255,255,255,.15); color: var(--white); }
.btn-icon svg { width: 18px; height: 18px; }

/* ─── App Body / Sidebar ─────────────────────────────────── */
.app-body {
  display: flex;
  padding-top: var(--header-h);
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  top: var(--header-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  overflow-y: auto;
  transition: transform var(--transition);
  z-index: 40;
}
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-w))); }
.sidebar-nav { padding: .75rem .5rem; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .85rem; border-radius: var(--radius);
  color: var(--gray-600); font-weight: 500; font-size: .9rem;
  transition: all var(--transition);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--gray-100); color: var(--gray-900); }
.nav-item.active { background: var(--red-light); color: var(--red); font-weight: 600; }
.nav-item.active svg { stroke: var(--red); }

/* ─── Main Content ───────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  transition: margin var(--transition);
}
.main-content.full { margin-left: 0; }

/* ─── Pages ──────────────────────────────────────────────── */
.page { display: none; padding: 1.5rem; }
.page.active { display: block; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap;
}
.page-header-left { display: flex; align-items: center; gap: .75rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; color: var(--gray-900); }
.btn-back {
  width: 34px; height: 34px; border-radius: var(--radius);
  background: var(--gray-100); border: none; color: var(--gray-600);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.btn-back:hover { background: var(--gray-200); }
.btn-back svg { width: 18px; height: 18px; }

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
}
.card-header h3 { font-size: 1rem; font-weight: 600; color: var(--gray-900); }
.card-header h4 { font-size: .9rem; font-weight: 600; color: var(--gray-700); }
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }

/* ─── Stats ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon-blue   { background: var(--blue-bg);   color: var(--blue);   }
.stat-icon-yellow { background: var(--yellow-bg);  color: var(--yellow); }
.stat-icon-green  { background: var(--green-bg);   color: var(--green);  }
.stat-icon-red    { background: var(--red-light);  color: var(--red);    }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: .78rem; color: var(--gray-400); margin-top: 2px; }

/* ─── Forms ──────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .85rem 1rem;
  padding: 1.1rem 1.25rem;
}
.field { display: flex; flex-direction: column; gap: .35rem; }
.field.field-wide { grid-column: 1 / -1; }
.field.field-check { justify-content: center; }
.field label { font-size: .82rem; font-weight: 500; color: var(--gray-600); }
.req { color: var(--red); }
.check-label {
  display: flex; align-items: center; gap: .5rem;
  cursor: pointer; font-size: .88rem; color: var(--gray-700);
  padding: .6rem .75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  transition: all var(--transition);
  background: var(--gray-50);
}
.check-label:hover { border-color: var(--red); background: var(--red-light); }
.check-label input[type="checkbox"] { accent-color: var(--red); width: 16px; height: 16px; }
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-800);
  font-size: .9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(229,34,34,.12);
}
select { cursor: pointer; }
textarea { resize: vertical; min-height: 80px; }
.section-subtitle { font-size: .9rem; font-weight: 600; color: var(--gray-600); padding: .5rem 1.25rem 0; }
.divider { height: 1px; background: var(--gray-200); margin: .5rem 0; }

/* ─── Tabs ───────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 2px solid var(--gray-200);
  padding: 0 .5rem;
  margin-bottom: 1rem;
}
.tab {
  padding: .65rem 1rem;
  border: none; background: transparent;
  color: var(--gray-500); font-weight: 500; font-size: .88rem;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: all var(--transition);
  cursor: pointer;
}
.tab:hover { color: var(--gray-900); background: var(--gray-100); }
.tab.active { color: var(--red); border-bottom-color: var(--red); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Peritaje ───────────────────────────────────────────── */
.peritaje-intro {
  background: var(--blue-bg); border: 1px solid #BFDBFE;
  border-radius: var(--radius); padding: .75rem 1rem;
  font-size: .85rem; color: var(--blue); margin-bottom: 1rem;
}
.peritaje-category {
  margin-bottom: 1rem;
}
.peritaje-category-title {
  font-size: .8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--gray-400);
  padding: .5rem 0; border-bottom: 1px solid var(--gray-200);
  margin-bottom: .5rem;
}
.category-icons {
  carroceria:    '🚗';
  vidrios:       '🪟';
  neumaticos:    '⚙️';
  mecanica:      '🔧';
  electricidad:  '⚡';
  interior:      '🪑';
  documentacion: '📄';
}
.peritaje-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin-bottom: .5rem;
  transition: border-color var(--transition);
}
.peritaje-item:has(.condition-select:not([value=""])):not(:has(.condition-select[value=""])) {
  border-color: var(--gray-300);
}
.peritaje-item-header {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.peritaje-item-label {
  font-size: .88rem; font-weight: 500; color: var(--gray-700); flex: 1; min-width: 140px;
}
.condition-select {
  min-width: 150px; max-width: 180px; width: auto;
  padding: .4rem .65rem; font-size: .83rem;
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  background: var(--gray-50); cursor: pointer;
}
.condition-ok      { border-color: var(--green)!important;  background: var(--green-bg)!important;  }
.condition-leve    { border-color: var(--yellow)!important; background: var(--yellow-bg)!important; }
.condition-moderado{ border-color: orange!important;        background: #FFF7ED!important;          }
.condition-grave   { border-color: var(--red)!important;    background: var(--red-light)!important; }
.condition-faltante{ border-color: var(--black)!important;  background: var(--gray-100)!important;  }
.peritaje-item-detail {
  margin-top: .75rem;
  display: grid; grid-template-columns: 1fr auto; gap: .5rem;
  animation: fadeIn .15s ease;
}
.peritaje-item-detail.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.repair-cost-input { max-width: 160px; }

/* ─── Fotos ──────────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  margin: 1rem 1.25rem;
  background: var(--gray-50);
  position: relative;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--red);
  background: var(--red-light);
}
.file-input-hidden {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-icon { width: 36px; height: 36px; color: var(--gray-400); margin: 0 auto .75rem; display: block; }
.upload-text { font-size: .9rem; color: var(--gray-600); }
.upload-text strong { color: var(--red); }
.upload-hint { font-size: .78rem; color: var(--gray-400); margin-top: .25rem; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
  padding: 0 1.25rem 1.25rem;
}
.photo-item {
  position: relative; border-radius: var(--radius);
  overflow: hidden; aspect-ratio: 4/3;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  group: true;
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-item-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  opacity: 0; transition: opacity var(--transition);
}
.photo-item:hover .photo-item-overlay { opacity: 1; }
.photo-delete-btn {
  background: var(--red); color: var(--white); border: none;
  width: 32px; height: 32px; border-radius: 50%;
  font-size: .8rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.photo-pending {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; gap: .25rem;
}
.photo-pending span { font-size: .7rem; color: var(--gray-400); }
.photos-notice {
  display: flex; align-items: center; gap: .5rem;
  font-size: .8rem; color: var(--gray-400);
  padding: 0 1.25rem 1rem;
}
.notice-icon { width: 14px; height: 14px; flex-shrink: 0; }

/* ─── Valuación / Reparaciones ───────────────────────────── */
.repair-summary {
  margin: 1rem 1.25rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.repair-summary-title {
  display: flex; align-items: center; gap: .5rem;
  padding: .65rem 1rem;
  background: var(--gray-50);
  font-size: .85rem; font-weight: 600; color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
}
.repair-summary-title svg { width: 16px; height: 16px; }
.repair-items { padding: .5rem; }
.repair-item-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .35rem .5rem; font-size: .83rem; color: var(--gray-600);
  border-radius: 4px;
}
.repair-item-row:hover { background: var(--gray-50); }
.repair-item-name { flex: 1; }
.repair-item-cost { font-weight: 600; color: var(--red); }
.repair-total {
  display: flex; justify-content: space-between; align-items: center;
  padding: .65rem 1rem;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  font-size: .88rem; color: var(--gray-700);
}
.repair-total strong { font-size: 1.05rem; color: var(--gray-900); }

/* ─── Form Footer ────────────────────────────────────────── */
.form-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 0; margin-top: 1rem; gap: .75rem; flex-wrap: wrap;
}
.form-footer-right { display: flex; gap: .75rem; }

/* ─── Table ──────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead tr { border-bottom: 2px solid var(--gray-200); }
thead th {
  padding: .65rem 1rem; text-align: left;
  font-size: .78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--gray-400); background: var(--gray-50);
}
tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--transition);
  cursor: pointer;
}
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: .75rem 1rem; color: var(--gray-700); vertical-align: middle; }
.td-main { font-weight: 600; color: var(--gray-900); }
.td-sub { font-size: .78rem; color: var(--gray-400); }

/* ─── Badges / Status ────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .6rem; border-radius: 100px;
  font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }
.badge-yellow  { background: var(--yellow-bg); color: var(--yellow); }
.badge-green   { background: var(--green-bg);  color: var(--green);  }
.badge-red     { background: var(--red-light); color: var(--red);    }
.badge-blue    { background: var(--blue-bg);   color: var(--blue);   }
.badge-black   { background: var(--gray-800);  color: var(--white);  }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.1rem; border-radius: var(--radius);
  font-size: .88rem; font-weight: 600; border: none;
  transition: all var(--transition); cursor: pointer; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--red);      color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-200); }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover:not(:disabled) { background: var(--red-dark); }
.btn-full { width: 100%; }
.btn-text { display: inline; }
.btn-spinner { display: none; }

/* ─── Filters ────────────────────────────────────────────── */
.filters-bar {
  display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.input-search { min-width: 260px; flex: 1; }
.select-sm { max-width: 220px; }

/* ─── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  padding: 1rem;
}
.page-btn {
  min-width: 36px; height: 36px; border-radius: var(--radius);
  border: 1px solid var(--gray-200); background: var(--white);
  color: var(--gray-600); font-size: .85rem; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition);
}
.page-btn:hover { border-color: var(--red); color: var(--red); }
.page-btn.active { background: var(--red); color: var(--white); border-color: var(--red); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Alerts ─────────────────────────────────────────────── */
.alert {
  padding: .65rem .85rem; border-radius: var(--radius);
  font-size: .85rem; font-weight: 500;
}
.alert-error { background: var(--red-light); color: var(--red); border: 1px solid #FCA5A5; }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid #86EFAC; }

/* ─── Detail view ────────────────────────────────────────── */
.detail-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem; margin-bottom: 1rem;
}
.detail-section {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); overflow: hidden;
}
.detail-section-title {
  padding: .75rem 1rem; background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  font-size: .85rem; font-weight: 700; color: var(--gray-600);
  text-transform: uppercase; letter-spacing: .04em;
}
.detail-field-list { padding: .75rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.detail-field { display: flex; flex-direction: column; gap: 1px; }
.detail-field-label { font-size: .75rem; color: var(--gray-400); }
.detail-field-value { font-size: .9rem; color: var(--gray-800); font-weight: 500; }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-header .btn-icon { color: var(--gray-400); }
.modal-header .btn-icon:hover { color: var(--gray-800); background: var(--gray-100); }
.modal-body { padding: 1.25rem; }
.modal-footer {
  padding: 1rem 1.25rem; border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: .5rem;
}

/* ─── Toast ──────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 200; display: flex; flex-direction: column; gap: .5rem;
}
.toast {
  background: var(--gray-900); color: var(--white);
  padding: .65rem 1rem; border-radius: var(--radius);
  font-size: .85rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: .5rem;
  animation: slideIn .2s ease;
  max-width: 320px;
}
.toast-success { background: var(--green); }
.toast-error   { background: var(--red); }
@keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* ─── Loading / Empty ────────────────────────────────────── */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem 1rem; color: var(--gray-400); font-size: .9rem;
}
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3rem 1rem; gap: .75rem; text-align: center;
}
.empty-state svg { width: 48px; height: 48px; color: var(--gray-300); }
.empty-state p { color: var(--gray-400); font-size: .9rem; }
.link { font-size: .85rem; color: var(--red); font-weight: 500; }
.link:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .user-info { display: none; }
  .page { padding: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; }
  .input-search { min-width: 0; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .tabs { gap: 2px; }
  .tab { padding: .5rem .7rem; font-size: .8rem; }
}

/* ─── Branch tabs ────────────────────────────────────────── */
.branch-tabs {
  display: flex; gap: .4rem; flex-wrap: wrap;
  margin-bottom: 1rem; padding: .5rem;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
}
.branch-tab {
  padding: .45rem .9rem; border-radius: var(--radius);
  border: 1px solid transparent; background: transparent;
  color: var(--gray-600); font-size: .83rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.branch-tab:hover { background: var(--gray-100); }
.branch-tab.active { background: var(--red); color: var(--white); border-color: var(--red); font-weight: 600; }

/* ─── Dashboard search ────────────────────────────────────── */
.dashboard-search-bar {
  display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.search-input-wrap {
  flex: 1; min-width: 240px; position: relative;
}
.search-icon-inline {
  position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--gray-400); pointer-events: none;
}
.dash-search-input {
  width: 100%; padding: .55rem .75rem .55rem 2.25rem;
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  background: var(--white); font-size: .9rem; outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.dash-search-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(229,34,34,.12); }

/* ─── Alert bell ─────────────────────────────────────────── */
.btn-alert {
  position: relative; background: rgba(255,255,255,.15); border: none;
  color: var(--white); width: 36px; height: 36px;
  border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background var(--transition);
}
.btn-alert:hover { background: rgba(255,255,255,.25); }
.btn-alert svg { width: 18px; height: 18px; }
.alert-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--yellow); color: var(--white);
  font-size: .65rem; font-weight: 700; border-radius: 100px;
  min-width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* ─── Alerts panel ───────────────────────────────────────── */
.alerts-panel {
  position: fixed; top: var(--header-h); right: 0;
  width: 340px; max-height: calc(100vh - var(--header-h));
  background: var(--white); border-left: 1px solid var(--gray-200);
  box-shadow: var(--shadow-lg); z-index: 60;
  display: flex; flex-direction: column;
}
.alerts-panel.hidden { display: none; }
.alerts-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-200);
}
.alerts-panel-header h3 { font-size: .95rem; font-weight: 600; }
.alerts-list { flex: 1; overflow-y: auto; }
.alert-item {
  padding: .85rem 1.25rem; border-bottom: 1px solid var(--gray-100);
  cursor: pointer; transition: background var(--transition);
}
.alert-item:hover { background: var(--gray-50); }
.alert-item-title { font-size: .88rem; font-weight: 600; color: var(--gray-900); }
.alert-item-sub { font-size: .78rem; color: var(--gray-500); margin-top: .15rem; }
.alert-item-badge { font-size: .7rem; color: var(--red); font-weight: 600; }
.alerts-backdrop {
  position: fixed; inset: 0; z-index: 55; background: transparent;
}
.alerts-backdrop.hidden { display: none; }

/* ─── Stock days badge ───────────────────────────────────── */
.days-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .72rem; padding: .15rem .45rem; border-radius: 100px; font-weight: 600;
}
.days-ok    { background: var(--green-bg);  color: var(--green);  }
.days-warn  { background: var(--yellow-bg); color: var(--yellow); }
.days-alert { background: var(--red-light); color: var(--red);    }

/* ─── Costos tab ─────────────────────────────────────────── */
.cost-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem .75rem; border-radius: var(--radius);
  background: var(--gray-50); margin-bottom: .35rem;
  font-size: .85rem;
}
.cost-item-info { flex: 1; }
.cost-item-cat { font-size: .7rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: .04em; }
.cost-item-desc { font-weight: 500; color: var(--gray-800); }
.cost-item-amount { font-weight: 700; color: var(--gray-900); }
.cost-total-row {
  display: flex; justify-content: space-between;
  padding: .65rem .75rem; border-top: 2px solid var(--gray-200);
  font-size: .9rem; font-weight: 700; color: var(--gray-900);
  margin-top: .25rem;
}

/* ─── Clientes ───────────────────────────────────────────── */
.client-interest-card {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: .65rem .85rem;
  margin-bottom: .4rem; font-size: .85rem;
}
.client-interest-title { font-weight: 600; color: var(--gray-800); }
.client-interest-sub { font-size: .78rem; color: var(--gray-500); margin-top: .15rem; }
.interaction-item {
  padding: .5rem 0; border-bottom: 1px solid var(--gray-100);
  font-size: .83rem;
}
.interaction-type { font-size: .7rem; font-weight: 600; text-transform: uppercase; color: var(--gray-400); }

/* ─── Peritaje repair type ───────────────────────────────── */
.repair-type-group {
  display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem;
}
.repair-type-btn {
  padding: .25rem .6rem; border-radius: 100px; font-size: .75rem; font-weight: 500;
  border: 1px solid var(--gray-200); background: var(--gray-50);
  color: var(--gray-600); cursor: pointer; transition: all var(--transition);
}
.repair-type-btn:hover { border-color: var(--red); color: var(--red); }
.repair-type-btn.active { background: var(--red); color: var(--white); border-color: var(--red); }

/* ─── Print ──────────────────────────────────────────────── */
@media print {
  .app-header, .sidebar, .form-footer, .tabs, .btn, .filters-bar { display: none !important; }
  .main-content { margin-left: 0; }
  .page { display: block !important; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
