/* ==========================================================================
   FlipsBS — Gestión de taller mecánico
   Design tokens tomados del handoff de diseño (hifi).
   ========================================================================== */

:root {
  /* Superficies */
  --bg-app: #0b0d10;
  --bg-shell: #14171c;
  --bg-card: #1c2028;
  --bg-input: #14171c;
  --bg-avatar: #242933;

  /* Bordes */
  --border-soft: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Texto */
  --text: #f4f5f7;
  --text-2: #d1d5db;
  --text-3: #9aa1ad;
  --text-4: #6b7280;
  --placeholder: #5b6270;

  /* Semánticos */
  --accent: #f5a524;
  --accent-hi: #ffb84d;
  --success: #4ade80;
  --danger: #ef4444;
  --danger-soft: #f87171;
  --info: #60a5fa;
  --teal: #2dd4bf;

  /* Forma */
  --r-card: 14px;
  --r-card-lg: 16px;
  --r-input: 9px;
  --r-pill: 20px;

  /* Tipografía */
  --font-body: 'Manrope', system-ui, -apple-system, sans-serif;
  --font-head: 'Barlow Condensed', 'Manrope', sans-serif;

  --nav-w: 230px;
  --content-max: 1100px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg-app);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

input::placeholder,
textarea::placeholder { color: var(--placeholder); }

button { font-family: inherit; }

a { color: var(--accent); }
a:hover { color: var(--accent-hi); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.16); background-clip: content-box; }

/* ==========================================================================
   Utilidades tipográficas
   ========================================================================== */

.h-num       { font: 800 24px/1.1 var(--font-head); letter-spacing: 0.2px; }
.h-num-lg    { font: 800 32px/1 var(--font-head); }
.h-num-sm    { font: 700 13px/1.1 var(--font-head); }
.section-title {
  font: 800 13px/1.2 var(--font-head);
  color: var(--text);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.label {
  font: 600 11px/1.2 var(--font-body);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.muted { color: var(--text-4); font: 500 12px/1.5 var(--font-body); }
.muted-italic { color: var(--text-4); font: 500 12px/1.5 var(--font-body); font-style: italic; }
.error-text { color: var(--danger-soft); font: 600 12px/1.4 var(--font-body); }
.pos { color: var(--success); }
.neg { color: var(--danger-soft); }

/* ==========================================================================
   Bloques base
   ========================================================================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-card);
  padding: 16px;
}

.stack { display: flex; flex-direction: column; }
.stack-6 { gap: 6px; }
.stack-8 { gap: 8px; }
.stack-10 { gap: 10px; }
.stack-12 { gap: 12px; }
.stack-14 { gap: 14px; }
.stack-16 { gap: 16px; }
.stack-18 { gap: 18px; }
.stack-20 { gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }

/* Botones ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  border-radius: 10px;
  border: none;
  font: 700 12.5px/1 var(--font-body);
  cursor: pointer;
  transition: filter 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: progress; }

.btn-accent { background: var(--accent); color: #14171c; font-weight: 800; }
.btn-ghost { background: transparent; color: var(--text-2); border: 1.5px solid var(--border-strong); }
.btn-outline-accent { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline-success { background: transparent; color: var(--success); border: 1.5px solid var(--success); }
.btn-success { background: var(--success); color: #0b0d10; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 10px 14px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font: 700 11.5px/1 var(--font-body);
  cursor: pointer;
  padding: 2px;
  align-self: flex-start;
}
.btn-link:hover { color: var(--accent-hi); }
.btn-square {
  width: 38px;
  flex-shrink: 0;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #14171c;
  font: 800 16px/1 var(--font-body);
  cursor: pointer;
}

/* Campos ----------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; }

.input,
.select,
.textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--r-input);
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--text);
  font: 500 14px/1.3 var(--font-body);
  outline: none;
  transition: border-color 0.15s ease;
}
.input:focus,
.select:focus,
.textarea:focus { border-color: var(--accent); }
.textarea { resize: vertical; min-height: 72px; }

/* Sobre fondo de panel (no de tarjeta) los inputs usan el tono de tarjeta */
.input-on-shell { background: var(--bg-card); border-color: rgba(255, 255, 255, 0.12); }

.select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa1ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
  font: 600 13px/1.3 var(--font-body);
  cursor: pointer;
}
.select option { background: var(--bg-card); color: var(--text); }

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.65);
  cursor: pointer;
}

/* Píldoras y badges ------------------------------------------------------ */

.chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-3);
  font: 700 11.5px/1 var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.chip:hover { border-color: rgba(255, 255, 255, 0.3); color: var(--text-2); }
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #14171c;
}

.badge {
  align-self: flex-start;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  font: 700 10px/1.2 var(--font-body);
  white-space: nowrap;
}
.badge-lg { padding: 5px 11px; font-size: 11px; }

.badge-compra     { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.badge-reparacion { background: rgba(245, 165, 36, 0.15); color: #f5a524; }
.badge-listo      { background: rgba(45, 212, 191, 0.15); color: #2dd4bf; }
.badge-venta      { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.badge-vendido    { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.badge-danger     { background: rgba(239, 68, 68, 0.15); color: var(--danger-soft); font-size: 11px; padding: 6px 11px; }

.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }

/* ==========================================================================
   Login / registro
   ========================================================================== */

.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 30px;
  gap: 28px;
  background: radial-gradient(circle at 50% 0%, rgba(245, 165, 36, 0.1), transparent 55%);
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}
.auth form { width: 100%; display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.auth .input { background: var(--bg-card); border-color: rgba(255, 255, 255, 0.12); border-radius: 10px; padding: 12px 14px; }
.auth-title { font: 800 32px/1 var(--font-head); color: var(--text); letter-spacing: 0.5px; }
.auth-sub {
  font: 600 11px/1.4 var(--font-body);
  color: var(--text-3);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 8px;
}
.auth-foot { font: 500 12px/1.6 var(--font-body); color: var(--text-4); text-align: center; }
.auth-foot strong { color: var(--text-3); font-weight: 700; }

.logo {
  border-radius: 16px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 800 22px/1 var(--font-head);
  color: #14171c;
  letter-spacing: 0.5px;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}
.logo-sm { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; }

/* ==========================================================================
   Shell de la aplicación
   ========================================================================== */

.shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-shell);
  position: relative;
  display: flex;
  /* Móvil: contenido arriba y navegación abajo. En escritorio pasa a fila
     (barra lateral + contenido), ver la consulta de medios de 880px. */
  flex-direction: column;
  margin: 0 auto;
}

.main { display: flex; flex-direction: column; flex: 1; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  background: var(--bg-shell);
  z-index: 5;
}
.topbar-title {
  font: 800 18px/1.1 var(--font-head);
  color: var(--text);
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-sub {
  font: 600 11px/1.3 var(--font-body);
  color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.icon-btn:hover { border-color: rgba(255, 255, 255, 0.24); }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-avatar);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 13px/1 var(--font-head);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.avatar:hover { border-color: var(--accent); }

.content {
  flex: 1;
  padding: 20px 20px 110px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  margin: 0 auto;
}

/* Navegación ------------------------------------------------------------- */

.nav {
  position: sticky;
  bottom: 0;
  display: flex;
  background: var(--bg-shell);
  z-index: 5;
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 8px 14px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  order: 2;
}
.nav-item {
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  border-radius: 8px;
  color: var(--text-4);
}
.nav-item span { font: 700 9.5px/1 var(--font-body); color: inherit; }
.nav-item svg { stroke: currentColor; }
.nav-item.is-active { color: var(--accent); }
.nav-item:hover { color: var(--text-3); }
.nav-item.is-active:hover { color: var(--accent); }

.fab {
  position: fixed;
  right: 20px;
  bottom: 92px;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  border: none;
  cursor: pointer;
  z-index: 6;
}

/* Móvil: sin nav en subpantallas, FAB solo en el listado de vehículos */
body[data-screen="vehicleDetail"] .nav,
body[data-screen="newVehicle"] .nav { display: none; }
body[data-screen="vehicles"] .fab { display: flex; }

.topbar-action { display: none; }

/* Escritorio ------------------------------------------------------------- */

@media (min-width: 880px) {
  .shell { max-width: none; box-shadow: none; flex-direction: row; }

  .nav {
    order: 0;
    position: sticky;
    top: 0;
    bottom: auto;
    flex-direction: column;
    width: var(--nav-w);
    height: 100vh;
    border-top: none;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 24px 16px;
    gap: 4px;
  }
  .nav-item {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 11px 14px;
  }
  .nav-item span { font-size: 13px; }
  .nav-item:hover { background: rgba(255, 255, 255, 0.04); }

  body[data-screen="vehicleDetail"] .nav,
  body[data-screen="newVehicle"] .nav { display: flex; }
  body[data-screen="vehicles"] .fab { display: none; }

  .main { order: 1; }
  .topbar { padding: 20px 32px; }
  .content { padding: 28px 36px 40px; max-width: var(--content-max); }

  body[data-screen="dashboard"] .topbar-action,
  body[data-screen="vehicles"] .topbar-action { display: inline-flex; }
}

@media (max-width: 879px) {
  .shell { max-width: 460px; box-shadow: 0 0 60px rgba(0, 0, 0, 0.5); }
}

/* ==========================================================================
   Dashboard
   ========================================================================== */

.capital-card {
  background: linear-gradient(135deg, rgba(245, 165, 36, 0.14), rgba(245, 165, 36, 0.02));
  border: 1px solid rgba(245, 165, 36, 0.28);
  border-radius: var(--r-card-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.capital-value { font: 800 32px/1 var(--font-head); color: var(--accent); }
.capital-value.neg { color: var(--danger-soft); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.kpi { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--r-card); padding: 16px; }
.kpi-label { font: 600 11px/1.2 var(--font-body); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px; }
.kpi-value { font: 800 24px/1.1 var(--font-head); color: var(--text); margin-top: 6px; }

.list-card { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--r-card); padding: 4px 16px; }
.list-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.list-row:last-child { border-bottom: none; }
.list-row-title { font: 600 13px/1.35 var(--font-body); color: #e5e7eb; }
.list-row-meta { font: 500 11px/1.3 var(--font-body); color: var(--text-4); margin-top: 2px; }
.list-row-amount { font: 700 13px/1.2 var(--font-head); color: var(--text-3); flex-shrink: 0; }

.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-card);
  padding: 14px 16px;
}
.notice p { margin: 0; font: 500 12.5px/1.45 var(--font-body); color: var(--text-3); }

.empty { text-align: center; padding: 30px 0; color: var(--text-4); font: 500 13px/1.5 var(--font-body); }

.team-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.team-row:last-child { border-bottom: none; }
.team-row .select { width: auto; min-width: 122px; padding: 7px 30px 7px 10px; font-size: 12px; }

/* ==========================================================================
   Vehículos
   ========================================================================== */

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-row-wrap { display: flex; flex-wrap: wrap; gap: 8px; }

.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }

.vehicle-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-card);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  padding: 0;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.vehicle-card:hover { border-color: rgba(255, 255, 255, 0.2); transform: translateY(-2px); }
.vehicle-card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; }
.vehicle-card-title { font: 700 15px/1.2 var(--font-body); color: var(--text); }
.vehicle-card-sub { font: 500 11px/1.3 var(--font-body); color: var(--text-3); }
.vehicle-card-line { display: flex; justify-content: space-between; align-items: baseline; }
.vehicle-card-line span:first-child {
  font: 600 10.5px/1.2 var(--font-body);
  color: var(--text-4);
  text-transform: uppercase;
}
.vehicle-card-line span:last-child { font: 700 13px/1.2 var(--font-head); color: var(--text); }

/* Ranura de imagen (sustituye al image-slot del prototipo) ---------------- */

.img-slot {
  position: relative;
  display: block;
  width: 100%;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: #101318;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  color: var(--text-4);
}
.img-slot.is-readonly { cursor: default; }
.img-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-slot-empty {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  text-align: center;
}
.img-slot-empty span {
  font: 600 9.5px/1.3 var(--font-body);
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.img-slot:hover:not(.is-readonly) { border-color: var(--accent); }
.img-slot.is-busy { opacity: 0.5; cursor: progress; }
.img-slot-rect { height: 110px; border-radius: 0; border-width: 0 0 1px 0; }
.img-slot-hero { height: 190px; border-radius: var(--r-card-lg); }
.img-slot-form { height: 150px; border-radius: var(--r-card); }
.img-slot-thumb { height: 88px; border-radius: 10px; }

.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.invoice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.invoice-label {
  font: 600 9.5px/1.3 var(--font-body);
  color: var(--text-3);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Detalle del vehículo
   ========================================================================== */

.detail-title { font: 800 22px/1.15 var(--font-head); color: var(--text); letter-spacing: 0.2px; }
.detail-sub { font: 500 12px/1.4 var(--font-body); color: var(--text-3); margin-top: 2px; }

.fin-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font: 600 13px/1.4 var(--font-body);
  color: var(--text-2);
}
.fin-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font: 700 14px/1.4 var(--font-body);
  color: var(--text);
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.fin-profit {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.fin-profit b { font: 700 14px/1.4 var(--font-body); color: var(--text); }
.fin-profit .amount { font: 800 20px/1.1 var(--font-head); }

.part-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.part-row-name { font: 600 13px/1.3 var(--font-body); color: #e5e7eb; }
.part-row-date { font: 500 11px/1.3 var(--font-body); color: var(--text-4); margin-top: 2px; }
.part-row-cost { font: 700 13px/1.2 var(--font-head); color: var(--text); }

.notes-body { margin-top: 9px; color: #b8bec9; font: 500 13px/1.6 var(--font-body); white-space: pre-wrap; }

/* ==========================================================================
   Materiales
   ========================================================================== */

.material-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px 14px;
}
.material-row.is-low { border-color: rgba(239, 68, 68, 0.4); }
.material-name { font: 700 13.5px/1.3 var(--font-body); color: var(--text); }
.material-meta { font: 500 11.5px/1.4 var(--font-body); color: var(--text-3); margin-top: 3px; }
.material-qty { font: 800 14px/1.2 var(--font-head); color: var(--text); }
.material-value { font: 500 11px/1.3 var(--font-body); color: var(--text-4); margin-top: 2px; }
.tag-low {
  font: 700 9.5px/1.2 var(--font-body);
  color: var(--danger-soft);
  background: rgba(239, 68, 68, 0.12);
  padding: 2px 7px;
  border-radius: 8px;
}

/* ==========================================================================
   Reportes
   ========================================================================== */

.segmented { display: flex; background: var(--bg-card); border-radius: 10px; padding: 4px; gap: 4px; }
.segmented button {
  flex: 1;
  padding: 9px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font: 700 12px/1 var(--font-body);
  background: transparent;
  color: var(--text-3);
}
.segmented button.is-active { background: var(--accent); color: #14171c; }

.report-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.report-kpi { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 12px; padding: 12px; }
.report-kpi-label { font: 600 9.5px/1.2 var(--font-body); color: var(--text-3); text-transform: uppercase; }
.report-kpi-value { font: 800 15px/1.2 var(--font-head); color: var(--text); margin-top: 4px; }

.locked {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 60px 20px;
}
.locked p { margin: 0; font: 600 13px/1.6 var(--font-body); color: var(--text-3); max-width: 320px; }

/* ==========================================================================
   Historial
   ========================================================================== */

.hist-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hist-title { font: 700 13.5px/1.35 var(--font-body); color: var(--text); }
.hist-title span { color: var(--text-3); font-weight: 600; }
.hist-meta { font: 500 11px/1.3 var(--font-body); color: var(--text-4); margin-top: 3px; }
.hist-diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.hist-diff-col { display: flex; flex-direction: column; gap: 8px; }
.hist-diff-head { font: 700 10px/1.2 var(--font-body); text-transform: uppercase; letter-spacing: 0.5px; }
.hist-diff-head.before { color: var(--danger-soft); }
.hist-diff-head.after { color: var(--success); }
.hist-diff-field { font: 600 10.5px/1.3 var(--font-body); color: var(--text-4); }
.hist-diff-value { font: 600 12.5px/1.35 var(--font-body); color: var(--text-2); margin-top: 1px; }

/* ==========================================================================
   Modales y avisos
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card-lg);
  padding: 24px;
  max-width: 340px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-title { font: 800 16px/1.2 var(--font-head); color: var(--text); }
.modal p { margin: 0; font: 500 13px/1.5 var(--font-body); color: var(--text-3); }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; padding: 11px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 80;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font: 600 12.5px/1.45 var(--font-body);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.18s ease;
}
.toast.is-error { border-color: rgba(239, 68, 68, 0.5); color: var(--danger-soft); }
.toast.is-ok { border-color: rgba(74, 222, 128, 0.4); }

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.boot {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-4);
  font: 600 12px/1 var(--font-body);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ==========================================================================
   Vista de impresión dedicada
   ========================================================================== */

.print-area { display: none; }

@media print {
  @page { margin: 16mm; }

  body { background: #fff; }
  .shell, .modal-backdrop, .toast, .fab { display: none !important; }

  .print-area {
    display: block;
    color: #111;
    font-family: var(--font-body);
    font-size: 12px;
  }
  .print-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 2px solid #111;
    padding-bottom: 10px;
    margin-bottom: 18px;
  }
  .print-brand { font: 800 26px/1 var(--font-head); letter-spacing: 0.5px; }
  .print-brand small { display: block; font: 600 10px/1.4 var(--font-body); letter-spacing: 2px; text-transform: uppercase; color: #555; }
  .print-meta { text-align: right; font-size: 11px; color: #555; }
  .print-title { font: 800 18px/1.2 var(--font-head); margin: 0 0 12px; text-transform: uppercase; }
  .print-section { margin-bottom: 22px; break-inside: avoid; }
  .print-table { width: 100%; border-collapse: collapse; }
  .print-table th,
  .print-table td { padding: 7px 8px; border-bottom: 1px solid #ddd; text-align: left; font-size: 11.5px; }
  .print-table th { text-transform: uppercase; font-size: 9.5px; letter-spacing: 0.6px; color: #555; }
  .print-table td.num,
  .print-table th.num { text-align: right; white-space: nowrap; }
  .print-table tr.total td { font-weight: 800; border-top: 2px solid #111; border-bottom: none; font-size: 13px; }
  .print-cards { display: flex; gap: 12px; margin-bottom: 16px; }
  .print-card { flex: 1; border: 1px solid #ccc; border-radius: 6px; padding: 10px 12px; }
  .print-card b { display: block; font: 800 17px/1.2 var(--font-head); margin-top: 3px; }
  .print-card span { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.5px; color: #555; }
  .print-foot { margin-top: 20px; border-top: 1px solid #ccc; padding-top: 8px; font-size: 10px; color: #777; }
}
