/* ============================================================
   Restpaq · Inventarios  —  styles.css
   Paleta heredada del portal de reportes
   ============================================================ */

:root {
  --bg:        #0d1117;
  --bg-2:      #1a1f2e;
  --card:      #1e2538;
  --card-2:    #232b40;
  --accent:    #f5a623;
  --accent-d:  #d98e10;
  --success:   #2dd4bf;
  --danger:    #ff6b6b;
  --text:      #e8ecf3;
  --text-dim:  #8a93a6;
  --text-mute: #5b647a;
  --line:      #2b3346;
  --radius:    14px;
  --radius-sm: 10px;
  --font-disp: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- atmósfera de fondo ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 600px at 85% -10%, rgba(245,166,35,0.08), transparent 60%),
    radial-gradient(700px 500px at 10% 110%, rgba(45,212,191,0.06), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   PANTALLAS DE AUTENTICACIÓN
   ============================================================ */
.screen { position: relative; z-index: 1; min-height: 100vh; }
.screen--center { display: flex; align-items: center; justify-content: center; padding: 24px; }

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}

.auth-logo {
  font-family: var(--font-disp);
  font-weight: 800;
  font-size: 34px;
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--text);
  display: flex;
  flex-direction: column;
}
.auth-logo--sm { font-size: 24px; display: block; }
.auth-logo__sub { color: var(--accent); }
.auth-tagline {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  margin-top: -14px;
}

.auth-fields { display: flex; flex-direction: column; gap: 12px; }

.field {
  width: 100%;
  padding: 13px 15px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
.field::placeholder { color: var(--text-mute); }
.field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245,166,35,0.15);
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  padding: 13px 18px;
  cursor: pointer;
  transition: transform .08s, background .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #1a1209; }
.btn--primary:hover { background: var(--accent-d); }
.btn--primary:disabled { opacity: .6; cursor: not-allowed; }
.btn--ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: 9px 16px;
  font-size: 14px;
}
.btn--ghost:hover { color: var(--text); border-color: var(--text-dim); }

.auth-error {
  text-align: center;
  color: var(--danger);
  font-size: 13.5px;
  min-height: 0;
}
.auth-error--fixed { min-height: 20px; }

.auth-foot { text-align: center; color: var(--text-dim); font-size: 13.5px; }
.auth-foot a { color: var(--accent); text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

.btn-link {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 13.5px;
  cursor: pointer;
  padding: 4px;
}
.btn-link:hover { color: var(--text); }

/* ---------- PIN ---------- */
.pin-card {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}
.pin-label { color: var(--text-dim); font-size: 15px; }
.pin-display {
  width: 100%;
  height: 58px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
#pin-dots { font-size: 30px; letter-spacing: .4em; color: var(--text); }

.pin-pad {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.pin-key {
  height: 64px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 500;
  cursor: pointer;
  transition: transform .06s, background .12s;
}
.pin-key:active { transform: translateY(1px); }
.pin-key:hover { background: #2a3350; }
.pin-key--alt { color: var(--text-dim); }
.pin-key--ok {
  background: var(--accent);
  color: #1a1209;
  font-weight: 700;
  font-size: 18px;
  border-color: var(--accent);
}
.pin-key--ok:hover { background: var(--accent-d); }
.pin-key:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   MÓDULO
   ============================================================ */
.app { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.topbar__brand {
  font-family: var(--font-disp);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.02em;
}
.topbar__brand-sub { color: var(--accent); margin-left: 8px; font-weight: 700; }
.topbar__right { display: flex; align-items: center; gap: 18px; }
.topbar__who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.topbar__negocio { font-size: 14px; font-weight: 600; color: var(--text); }
.topbar__usuario { font-size: 12.5px; color: var(--text-dim); }

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 22px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 500;
  padding: 14px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .12s, border-color .12s;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.content { flex: 1; padding: 28px; max-width: 1200px; width: 100%; margin: 0 auto; }
.panel { display: none; }
.panel.is-active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-placeholder {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 48px 36px;
}
.panel-placeholder h2 {
  font-family: var(--font-disp);
  font-weight: 700;
  font-size: 22px;
  margin-bottom: 8px;
}
.panel-placeholder p { color: var(--text-dim); font-size: 14.5px; }

/* ============================================================
   PANEL: encabezado + acciones
   ============================================================ */
.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.panel-title { font-family: var(--font-disp); font-weight: 700; font-size: 22px; }
.panel-sub { color: var(--text-dim); font-size: 14px; margin-top: 2px; }
.panel-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.field--inline { padding: 9px 12px; font-size: 14px; width: auto; }
.field--select { cursor: pointer; }
.btn--sm { padding: 9px 16px; font-size: 14px; }

/* ============================================================
   TABLA
   ============================================================ */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-mute);
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.data-table th.num, .data-table td.num { text-align: right; }
.data-table tbody td {
  padding: 13px 18px;
  font-size: 14.5px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.table-empty { text-align: center; color: var(--text-dim); padding: 32px !important; }

.acciones-col { width: 140px; text-align: right; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.icon-btn {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 13px;
  padding: 6px 11px;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.icon-btn:hover { color: var(--text); border-color: var(--text-dim); }
.icon-btn--danger:hover { color: var(--danger); border-color: var(--danger); }

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}
.badge--base { background: rgba(245,166,35,0.14); color: var(--accent); }
.badge--prep { background: rgba(45,212,191,0.14); color: var(--success); }
.muted { color: var(--text-mute); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
  animation: fade .15s ease;
}
.modal {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 30px 70px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-family: var(--font-disp); font-weight: 700; font-size: 18px; }
.modal-close {
  background: none; border: none; color: var(--text-dim);
  font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; display: flex; flex-direction: column; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px; border-top: 1px solid var(--line);
}

.form-label {
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  margin: 14px 0 6px;
}
.form-label:first-child { margin-top: 0; }
.form-hint { font-size: 12.5px; color: var(--text-mute); margin-top: 6px; }
.field--readonly {
  background: var(--bg);
  color: var(--text-dim);
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px;
}

/* ============================================================
   SUB-PESTAÑAS + EDITOR DE RECETAS
   ============================================================ */
.subtabs { display: flex; gap: 6px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.subtab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-dim); font-family: var(--font-body); font-size: 14px; font-weight: 600;
  padding: 10px 14px; cursor: pointer; transition: color .12s, border-color .12s;
}
.subtab:hover { color: var(--text); }
.subtab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.subpanel { display: none; }
.subpanel.is-active { display: block; animation: fade .2s ease; }

.editor-grid { display: grid; grid-template-columns: 280px 1fr; gap: 22px; align-items: start; }
.editor-grid--prod { grid-template-columns: 1fr 320px; }
@media (max-width: 760px) { .editor-grid, .editor-grid--prod { grid-template-columns: 1fr; } }

.editor-side {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px;
}
.editor-h { font-family: var(--font-disp); font-weight: 700; font-size: 15px; margin-bottom: 12px; color: var(--text); }
.side-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.side-item {
  padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  transition: background .12s; font-size: 14px;
}
.side-item:hover { background: var(--card-2); }
.side-item.is-sel { background: rgba(245,166,35,0.12); color: var(--accent); }
.side-item__count { font-size: 12px; color: var(--text-mute); }
.side-item.is-sel .side-item__count { color: var(--accent); }
.side-item--missing { color: var(--danger); }
.side-empty { padding: 10px 12px; color: var(--text-dim); font-size: 13.5px; }

.editor-main {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px;
}
.reng-head {
  display: grid; grid-template-columns: 1fr 140px 40px; gap: 10px;
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-mute); margin: 18px 0 8px;
}
.reng-cant-h { text-align: left; }
.reng {
  display: grid; grid-template-columns: 1fr 140px 40px; gap: 10px;
  margin-bottom: 8px; align-items: center;
}
.reng .field { margin: 0; }
.reng-unit { font-size: 12px; color: var(--text-mute); margin-top: 3px; display: block; }
.reng-del {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text-dim); font-size: 18px; line-height: 1; height: 42px; cursor: pointer;
}
.reng-del:hover { color: var(--danger); border-color: var(--danger); }

.btn-add {
  background: none; border: 1px dashed var(--line); border-radius: var(--radius-sm);
  color: var(--text-dim); font-family: var(--font-body); font-size: 14px; font-weight: 500;
  padding: 10px; width: 100%; cursor: pointer; margin-top: 6px; transition: color .12s, border-color .12s;
}
.btn-add:hover { color: var(--accent); border-color: var(--accent); }

.editor-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.editor-foot .btn { flex: 1 1 auto; min-width: 120px; }

/* ============================================================
   PRODUCCIÓN + MOVIMIENTOS
   ============================================================ */
.side-note { color: var(--text-dim); font-size: 13.5px; line-height: 1.55; }

.preview-box {
  margin-top: 18px; padding: 16px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.preview-h { font-family: var(--font-disp); font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.preview-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.preview-item:last-of-type { border-bottom: none; }
.preview-tag { font-size: 12px; font-weight: 600; }
.preview-ok { color: var(--success); }
.preview-warn { color: var(--accent); }

.badge--entrada { background: rgba(45,212,191,0.14); color: var(--success); }
.badge--salida  { background: rgba(255,107,107,0.14); color: var(--danger); }
.badge--ajuste  { background: rgba(122,162,247,0.16); color: #7aa2f7; }
.badge--prod    { background: rgba(245,166,35,0.14); color: var(--accent); }

/* ============================================================
   CHECKBOX INVENTARIO POR PIEZA
   ============================================================ */
.check-row {
  display: flex; align-items: center; gap: 9px;
  margin: 14px 0 4px; cursor: pointer;
  font-size: 14px; color: var(--text);
  user-select: none;
}
.check-row input[type="checkbox"] {
  width: 17px; height: 17px; cursor: pointer; accent-color: var(--accent);
}

/* ============================================================
   REPORTES
   ============================================================ */
.rep-sem-label { color: var(--text-dim); font-size: 14px; align-self: center; }
.rep-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin-bottom: 22px;
}
.rep-h { font-family: var(--font-disp); font-weight: 700; font-size: 17px; }
.rep-sub { color: var(--text-dim); font-size: 13.5px; margin: 2px 0 16px; }
.rep-chart-wrap { position: relative; height: 320px; }
.rep-empty { color: var(--text-dim); font-size: 14px; padding: 24px 0; text-align: center; }

.prog-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 12px;
}
.prog-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; flex-wrap: wrap; gap: 6px; }
.prog-title { font-family: var(--font-disp); font-weight: 700; font-size: 15px; }
.prog-fecha { color: var(--accent); font-size: 13.5px; font-weight: 600; }
.prog-cliente { color: var(--text-dim); font-size: 13px; }
.prog-ing { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.prog-ing:last-child { border-bottom: none; }
.prog-falta { color: var(--accent); }
.prog-ok { color: var(--text-dim); }
