/* =============================================================
   Panel — Automecánica Sucre. Mismo ADN visual que la web
   pública (cálido, oscuro, acento naranja) pero pensado para
   uso funcional día a día, no para vender.
   ============================================================= */
:root {
  --bg: #12100e;
  --bg-2: #19160f;
  --bg-3: #221d16;
  --bg-4: #2c2519;
  --cream: #f3eee4;
  --cream-2: #cbc3b1;
  --cream-3: #8f8676;
  --accent: #e8871e;
  --accent-2: #c96a12;
  --blue: #3fb6ff;
  --red: #e2564f;
  --green: #58c27d;
  --line: rgba(243, 238, 228, 0.12);
  --line-strong: rgba(243, 238, 228, 0.22);
  --serif: "Space Grotesk", "Inter", sans-serif;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", monospace;
  --radius: 12px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-h: 64px;
  --container: 1180px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { tab-size: 2; }
body {
  font-family: var(--sans); font-size: 15px; line-height: 1.55;
  color: var(--cream); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
input, select, textarea {
  font: inherit; color: var(--cream); background: var(--bg-3);
  border: 1px solid var(--line-strong); border-radius: 9px; padding: 0.6rem 0.75rem;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.text-muted { color: var(--cream-3); }
.text-link { color: var(--accent); font-size: 0.9rem; font-weight: 600; }
.text-link:hover { text-decoration: underline; }

/* ---------- Nav ---------- */
.app-nav { position: sticky; top: 0; z-index: 100; background: rgba(18,16,14,0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); height: var(--nav-h); }
.app-nav-inner { max-width: var(--container); margin-inline: auto; padding-inline: 1.25rem; height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.app-brand { display: flex; align-items: center; gap: 0.6rem; font-family: var(--serif); font-weight: 700; }
.app-brand .mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #1a1206; font-family: var(--mono); font-size: 0.85rem; font-weight: 700; }
.app-menu { display: flex; align-items: center; gap: 1.4rem; font-size: 0.92rem; font-weight: 500; color: var(--cream-2); }
.app-menu a:hover { color: var(--cream); }
.app-menu a.is-active { color: var(--accent); }
.app-nav-actions { display: flex; align-items: center; gap: 0.8rem; }
.app-user { font-size: 0.85rem; color: var(--cream-3); font-family: var(--mono); }
.nav-toggle { display: none; width: 36px; height: 36px; place-items: center; }
.nav-toggle svg { width: 20px; height: 20px; }
@media (max-width: 780px) {
  .app-menu { position: fixed; inset: var(--nav-h) 0 0 0; background: var(--bg); flex-direction: column; align-items: stretch; padding: 1.5rem; font-size: 1.05rem; gap: 1.1rem; transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; }
  .app-menu.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .app-user { display: none; }
  .nav-toggle { display: grid; }
}

/* ---------- Layout ---------- */
.app-main { max-width: var(--container); margin-inline: auto; padding: 1.5rem 1.25rem 4rem; display: flex; flex-direction: column; gap: 1.4rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.page-head-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.crumb { margin-bottom: 0.3rem; }
.crumb a { color: var(--cream-3); font-size: 0.85rem; }
.crumb a:hover { color: var(--cream); }

.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; gap: 1rem; }
.two-col { display: grid; grid-template-columns: 1fr; gap: 1.4rem; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; align-items: start; } }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.65rem 1.15rem; border-radius: 999px; font-weight: 600; font-size: 0.9rem; transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #1a1206; }
.btn-outline { border: 1.5px solid var(--line-strong); color: var(--cream); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { color: var(--cream-2); }
.btn-ghost:hover { color: var(--cream); }
.btn-danger { color: var(--red); }
.btn-wa { background: #25d366; color: #06210f; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.inline-form { display: inline; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 1rem; }
.form-tight { gap: 0.7rem; margin-top: 0.9rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-size: 0.8rem; color: var(--cream-3); font-weight: 600; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 620px) {
  .field-row { grid-template-columns: 1fr 1fr; }
  .field-row-3 { grid-template-columns: repeat(3, 1fr); }
}
.form-actions { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; padding-top: 0.3rem; }
.form-error { color: var(--red); font-size: 0.9rem; }
.add-details { margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.add-details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 0.9rem; }

/* ---------- Search / filters ---------- */
.search-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.search-row input { max-width: 340px; }
.filter-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chip { font-family: var(--mono); font-size: 0.78rem; padding: 0.4rem 0.85rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--cream-2); }
.chip:hover { border-color: var(--accent); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #1a1206; }

/* ---------- Stats ---------- */
.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
@media (min-width: 720px) { .stat-row { grid-template-columns: repeat(5, 1fr); } }
.stat-chip { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: 0.2rem; transition: border-color 0.2s, transform 0.2s; }
.stat-chip:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.stat-chip strong { font-family: var(--serif); font-size: 1.6rem; }
.stat-chip span { font-size: 0.78rem; color: var(--cream-3); }
.stat-chip-ready strong { color: var(--green); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cream-3); padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: 0.7rem; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table td.td-desc { white-space: normal; min-width: 180px; }
.table tbody tr:hover { background: rgba(243,238,228,0.03); }
.table a:not(.btn) { color: var(--cream); font-weight: 600; }
.table a:not(.btn):hover { color: var(--accent); }
.td-actions { display: flex; gap: 0.4rem; }
.table-compact td, .table-compact th { padding: 0.5rem 0.6rem; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 0.28rem 0.65rem; border-radius: 999px; font-size: 0.74rem; font-weight: 700; font-family: var(--mono); white-space: nowrap; }
.badge-diagnostico { background: rgba(63,182,255,0.15); color: var(--blue); }
.badge-presupuestado { background: rgba(232,135,30,0.15); color: var(--accent); }
.badge-en_reparacion { background: rgba(232,135,30,0.28); color: var(--accent); }
.badge-listo { background: rgba(88,194,125,0.18); color: var(--green); }
.badge-entregado { background: rgba(243,238,228,0.1); color: var(--cream-3); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: calc(100svh - var(--nav-h) - 2rem); display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 380px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; display: flex; flex-direction: column; gap: 1rem; }
.auth-card h1 { font-size: 1.3rem; }

/* ---------- Flash ---------- */
.flash { padding: 0.85rem 1.1rem; border-radius: 10px; font-size: 0.9rem; font-weight: 600; }
.flash-ok { background: rgba(88,194,125,0.15); color: var(--green); border: 1px solid rgba(88,194,125,0.3); }
.flash-error { background: rgba(226,86,79,0.15); color: var(--red); border: 1px solid rgba(226,86,79,0.3); }
