/* ============================================================
   LA HOJA VERDE POS · Sistema de Diseño v1.2
   UX mejorada: táctil, móvil, rápido
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --hv-verde-800: #1B5E20;
  --hv-verde-700: #2E7D32;
  --hv-verde-600: #388E3C;
  --hv-verde-400: #4CAF50;
  --hv-verde-300: #81C784;
  --hv-verde-200: #A5D6A7;
  --hv-verde-100: #C8E6C9;
  --hv-verde-50:  #E8F5E9;
  --hv-amarillo:  #FFC107;
  --hv-warning:   #F57C00;
  --hv-amarillo-bg: #FFF8E1;
  --hv-gris-900:  #1A1A1A;
  --hv-gris-700:  #424242;
  --hv-gris-500:  #9E9E9E;
  --hv-gris-400:  #BDBDBD;
  --hv-gris-200:  #EEEEEE;
  --hv-gris-100:  #F5F5F5;
  --hv-gris-50:   #FAFAFA;
  --hv-danger:    #C62828;
  --hv-danger-bg: #FFEBEE;
  --font-titulo:  'Sora', sans-serif;
  --font-cuerpo:  'DM Sans', sans-serif;
  /* Táctil */
  --touch-min: 44px;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; }
body {
  margin: 0; padding: 0;
  font-family: var(--font-cuerpo);
  font-size: 14px;
  color: var(--hv-gris-900);
  background: var(--hv-verde-50);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; /* quita flash azul en Android */
}

/* ── Layout ─────────────────────────────────────────────────── */
.pos-wrapper { display: flex; min-height: 100vh; }

.pos-sidebar {
  width: 220px; height: 100vh;
  background: var(--hv-verde-800);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0;
  z-index: 1000; transition: transform .25s;
  overflow: hidden;
}
.pos-main {
  flex: 1; margin-left: 220px;
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.brand-name {
  font-family: var(--font-titulo);
  font-size: 13px; font-weight: 700; color: #fff; line-height: 1.2;
}
.brand-sub {
  font-size: 10px; color: rgba(255,255,255,0.5);
  text-transform: uppercase; letter-spacing: .5px;
}
.sidebar-nav {
  flex: 1; padding: 8px;
  overflow-y: auto; scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
.nav-section-label {
  font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase; letter-spacing: .8px;
  padding: 12px 8px 4px;
}
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;       /* +1px más alto que antes */
  min-height: var(--touch-min);
  border-radius: 8px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s;
  position: relative; cursor: pointer;
  border: none; width: 100%; background: none; text-align: left;
}
.nav-link:hover  { background: rgba(255,255,255,0.1); color: #fff; }
.nav-link.active { background: var(--hv-verde-600); color: #fff; }
.nav-link i { font-size: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--hv-amarillo); color: var(--hv-verde-800);
  font-size: 10px; font-weight: 700;
  border-radius: 10px; padding: 1px 6px;
}
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.1); padding: 4px 0; flex-shrink: 0; }

/* ── Topbar ──────────────────────────────────────────────────── */
.pos-topbar {
  height: 58px; background: #fff;
  border-bottom: 1px solid var(--hv-gris-200);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.topbar-page-title {
  font-family: var(--font-titulo);
  font-size: 16px; font-weight: 700;
  color: var(--hv-verde-800); margin: 0; white-space: nowrap;
}

/* ── Content ─────────────────────────────────────────────────── */
.pos-content { flex: 1; padding: 24px; }

/* ── Cards ───────────────────────────────────────────────────── */
.card-tq {
  background: #fff; border-radius: 14px; padding: 20px;
  border: 1px solid var(--hv-gris-200);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.card-title {
  font-family: var(--font-titulo); font-size: 15px; font-weight: 700;
  color: var(--hv-verde-800); margin-bottom: 14px;
}

/* ── Stat cards ──────────────────────────────────────────────── */
.stat-card {
  background: #fff; border-radius: 12px; padding: 16px;
  border: 1px solid var(--hv-gris-200);
}
.stat-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.stat-label  { font-size: 12px; color: var(--hv-gris-500); margin-bottom: 4px; }
.stat-value  { font-family: var(--font-titulo); font-size: 22px; font-weight: 700; line-height: 1; }
.stat-sub    { font-size: 11px; color: var(--hv-gris-400); margin-top: 4px; }

/* ── Botones — área táctil mínima 44px ───────────────────────── */
.btn-tq {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 18px;
  height: var(--touch-min);       /* siempre 44px de alto */
  border-radius: 10px;
  font-family: var(--font-titulo);
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .12s, transform .08s;
  border: none; text-decoration: none; white-space: nowrap;
  -webkit-user-select: none; user-select: none;
}
.btn-tq:active { transform: scale(0.97); }
.btn-tq:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-tq-primary   { background: var(--hv-verde-600); color: #fff; }
.btn-tq-primary:hover   { background: var(--hv-verde-800); color: #fff; }
.btn-tq-secondary { background: var(--hv-gris-100); color: var(--hv-gris-700); border: 1px solid var(--hv-gris-200); }
.btn-tq-secondary:hover { background: var(--hv-gris-200); }
.btn-tq-danger    { background: var(--hv-danger-bg); color: var(--hv-danger); border: 1px solid #FFCDD2; }
.btn-tq-danger:hover    { background: var(--hv-danger); color: #fff; }
/* Tamaños alternativos */
.btn-tq-sm { height: 34px; padding: 0 12px; font-size: 12px; border-radius: 7px; }
.btn-tq-lg { height: 52px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.w-100 { width: 100%; }

/* ── Tablas ──────────────────────────────────────────────────── */
.tabla-tq { width: 100%; border-collapse: collapse; }
.tabla-tq thead th {
  font-family: var(--font-titulo); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; color: var(--hv-gris-500);
  padding: 8px 12px; border-bottom: 2px solid var(--hv-gris-200);
  background: var(--hv-gris-50); white-space: nowrap;
}
.tabla-tq tbody tr { border-bottom: 1px solid var(--hv-gris-100); }
.tabla-tq tbody tr:hover { background: var(--hv-verde-50); }
.tabla-tq tbody td { padding: 10px 12px; font-size: 13px; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge-tq {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700; font-family: var(--font-titulo);
}
.badge-success { background: var(--hv-verde-50);   color: var(--hv-verde-700); }
.badge-warning { background: var(--hv-amarillo-bg); color: var(--hv-warning); }
.badge-danger  { background: var(--hv-danger-bg);   color: var(--hv-danger); }
.badge-info    { background: #E3F2FD; color: #1565C0; }
.badge-muted   { background: var(--hv-gris-100); color: var(--hv-gris-500); }

/* ── Formularios — inputs grandes y cómodos ─────────────────── */
.form-group  { margin-bottom: 14px; }
.form-label  { display: block; font-size: 12px; font-weight: 600; color: var(--hv-gris-700); margin-bottom: 5px; }
.form-control {
  width: 100%;
  padding: 0 12px;
  height: var(--touch-min);   /* 44px — cómodo en celular */
  border: 1.5px solid var(--hv-gris-200);
  border-radius: 10px;
  font-family: var(--font-cuerpo);
  font-size: 14px;            /* más legible */
  background: #fff;
  transition: border-color .15s;
  color: var(--hv-gris-900);
}
.form-control:focus { outline: none; border-color: var(--hv-verde-400); box-shadow: 0 0 0 3px rgba(76,175,80,0.15); }
.form-control::placeholder { color: var(--hv-gris-400); }
select.form-control  { cursor: pointer; appearance: auto; -webkit-appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; height: auto; padding-top: 10px; }

/* ── Alertas flash ───────────────────────────────────────────── */
.alert-tq {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
}
.alert-success { background: var(--hv-verde-50);   color: var(--hv-verde-700); border: 1px solid var(--hv-verde-200); }
.alert-danger  { background: var(--hv-danger-bg);   color: var(--hv-danger);   border: 1px solid #FFCDD2; }
.alert-warning { background: var(--hv-amarillo-bg); color: var(--hv-warning);  border: 1px solid #FFE082; }
.alert-info    { background: #E3F2FD; color: #1565C0; border: 1px solid #BBDEFB; }

/* ── Montos ──────────────────────────────────────────────────── */
.monto-positivo { color: var(--hv-verde-600); }
.monto-negativo { color: var(--hv-danger); }

/* ── Utilidades Bootstrap-compat ────────────────────────────── */
.text-end { text-align: right; }
.fw-bold  { font-weight: 700; }
.mt-2 { margin-top: 8px; }  .mt-3 { margin-top: 14px; } .mt-4 { margin-top: 20px; }
.mb-2 { margin-bottom: 8px; }.mb-3 { margin-bottom: 14px; }.mb-4 { margin-bottom: 20px; }
.ms-2 { margin-left: 8px; }
.gap-2 { gap: 8px; } .gap-3 { gap: 14px; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.d-none { display: none !important; }

/* ── Responsive móvil ────────────────────────────────────────── */
@media (max-width: 768px) {
  .pos-sidebar { transform: translateX(-100%); }
  .pos-sidebar.open { transform: translateX(0); }
  .pos-main { margin-left: 0; }
  .pos-content { padding: 12px; }
  .pos-topbar { padding: 0 12px; gap: 10px; }
  .stat-value { font-size: 18px; }
  /* Cards más compactas en móvil */
  .card-tq { padding: 14px; border-radius: 12px; }
  /* Botones full-width más naturales en móvil */
  .btn-tq-lg { height: 54px; font-size: 16px; }
  /* Tabla con scroll horizontal */
  .tabla-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (min-width: 769px) {
  .d-md-none { display: none !important; }
  .d-md-block { display: block !important; }
}

/* ── Input group ─────────────────────────────────────────────── */
.input-group { display: flex; }
.input-group .form-control { flex: 1; border-radius: 0 10px 10px 0; }
.input-group-text {
  padding: 0 12px; height: var(--touch-min);
  background: var(--hv-gris-50);
  border: 1.5px solid var(--hv-gris-200);
  border-right: none; border-radius: 10px 0 0 10px;
  color: var(--hv-gris-500); font-size: 14px;
  display: flex; align-items: center;
}

/* ── Nav pills ───────────────────────────────────────────────── */
.nav-pills { display: flex; gap: 6px; padding: 0; margin: 0; list-style: none; }
.nav-pills .nav-link {
  color: var(--hv-gris-700) !important;
  background: var(--hv-gris-100) !important;
  border: 1px solid var(--hv-gris-200) !important;
  padding: 0 16px !important; height: 38px !important;
  border-radius: 8px !important; width: auto !important; min-height: unset;
}
.nav-pills .nav-link.active {
  background: var(--hv-verde-600) !important;
  color: #fff !important; border-color: var(--hv-verde-600) !important;
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--hv-gris-100); }
::-webkit-scrollbar-thumb { background: var(--hv-verde-300); border-radius: 3px; }

/* Fix select global */
select { appearance: auto !important; -webkit-appearance: auto !important; color: var(--hv-gris-900) !important; }
select option { color: var(--hv-gris-900) !important; background: #fff !important; }
