/* erp/assets/style.css - estilos compartidos del sitio web, mismos
   colores de marca que la app Flutter (ver lib/System/variables.dart) */
:root {
  --brand-primary: #163059;
  --brand-accent: #18b1a1;
  --navy: #0b1c33;
  --grey-text: #6b7280;
  --page-bg: #f4f7fa;
  --card-border: #e4eaf2;
  --white: #ffffff;
  --danger: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, -apple-system, sans-serif;
  background: var(--page-bg);
  color: var(--navy);
}

.erp-topbar {
  background: var(--brand-primary);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.erp-topbar img { height: 32px; border-radius: 8px; background: #fff; padding: 4px; }
.erp-topbar span { font-weight: 700; font-size: 17px; }
.erp-topbar .erp-user { margin-left: auto; font-size: 13px; opacity: .9; display: flex; align-items: center; gap: 12px; }
.erp-topbar a { color: #fff; text-decoration: none; opacity: .85; }
.erp-topbar a:hover { opacity: 1; text-decoration: underline; }

.erp-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.erp-login-card {
  background: var(--white);
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(11, 28, 51, 0.12);
  padding: 40px;
  width: 100%;
  max-width: 380px;
}

.erp-login-card img.logo {
  display: block;
  margin: 0 auto 18px;
  height: 56px;
}

.erp-login-card h1 {
  font-size: 20px;
  text-align: center;
  margin: 0 0 6px;
  color: var(--navy);
}

.erp-login-card p.subtitle {
  text-align: center;
  color: var(--grey-text);
  font-size: 13px;
  margin: 0 0 24px;
}

.erp-field { margin-bottom: 16px; }
.erp-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--navy); }

/* Tooltip explicativo junto a una etiqueta de campo/indicador - nativo
   (atributo title del navegador), sin JS. Ver erp_label() en
   ui_helpers.php y la regla permanente "Tooltips explicativos" en
   CLAUDE.md: todo campo/indicador del ERP debe traer uno. */
.erp-tip {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--grey-text);
  cursor: help;
  border: 1px solid var(--card-border);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  line-height: 13px;
  text-align: center;
  vertical-align: middle;
}
.erp-kpi-card .erp-tip { margin-left: 3px; }
.erp-field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  font-size: 14px;
  background: var(--page-bg);
}
.erp-field input:focus { outline: none; border-color: var(--brand-primary); background: #fff; }

.erp-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--brand-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
}
.erp-btn:hover { background: #1c3a6d; }

.erp-error {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 18px;
}

.erp-content { max-width: 960px; margin: 32px auto; padding: 0 24px; }
.erp-card {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
}

/* ===== Layout con sidebar (dashboard y modulos) ===== */
.erp-shell { display: flex; min-height: 100vh; }

.erp-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--navy);
  color: #fff;
  padding: 18px 0;
  overflow-y: auto;
}
.erp-sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 12px;
}
.erp-sidebar-brand img { height: 30px; border-radius: 8px; background: #fff; padding: 3px; }
.erp-sidebar-brand span { font-weight: 700; font-size: 15px; }

.erp-nav { display: flex; flex-direction: column; }
.erp-nav-group {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: rgba(255,255,255,.45); font-weight: 700;
  padding: 16px 18px 6px;
}
.erp-nav-link {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: 14px;
  padding: 9px 18px;
  border-left: 3px solid transparent;
}
.erp-nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.erp-nav-link.active {
  background: rgba(24,177,161,.14);
  border-left-color: var(--brand-accent);
  color: #fff;
  font-weight: 600;
}

.erp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.erp-main .erp-topbar { position: sticky; top: 0; z-index: 5; }
.erp-page-title { font-weight: 700; font-size: 16px; }
.erp-menu-toggle {
  display: none;
  background: rgba(255,255,255,.12);
  border: none; color: #fff; border-radius: 8px;
  width: 34px; height: 34px; font-size: 16px; cursor: pointer;
}
.erp-content { flex: 1; padding: 24px; max-width: 100%; margin: 0; }

@media (max-width: 860px) {
  .erp-sidebar { position: fixed; left: -280px; top: 0; bottom: 0; z-index: 20; transition: left .2s; }
  .erp-shell.erp-sidebar-open .erp-sidebar { left: 0; }
  .erp-menu-toggle { display: inline-block; }
}

/* ===== KPI cards del dashboard (mismo estilo que _KpiCard en Menunew.dart) ===== */
.erp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.erp-kpi-card {
  display: flex; align-items: center; gap: 10px;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 12px 14px;
}
.erp-kpi-card .bar { width: 3px; height: 30px; border-radius: 2px; }
.erp-kpi-card .value { font-weight: 800; font-size: 17px; color: var(--navy); }
.erp-kpi-card .label { font-size: 12px; color: var(--grey-text); }

.erp-hero {
  background: linear-gradient(135deg, var(--brand-primary), var(--navy));
  color: #fff;
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
}
.erp-hero .eyebrow { font-size: 12px; letter-spacing: .08em; opacity: .75; font-weight: 700; }
.erp-hero .amount { font-size: 32px; font-weight: 800; margin: 8px 0 12px; }
.erp-hero .chip {
  display: inline-block;
  background: rgba(255,255,255,.14);
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
}

.erp-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--grey-text);
}
.erp-empty .icon { font-size: 40px; margin-bottom: 12px; }

/* ===== select + datalist inputs (mismo look que .erp-field input) ===== */
.erp-field select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  font-size: 14px;
  background: var(--page-bg);
  color: var(--navy);
  box-sizing: border-box;
}
.erp-field select:focus,
.erp-field input[list]:focus {
  outline: none;
  border-color: var(--brand-primary);
  background: #fff;
}
.erp-field input[list] { width: 100%; box-sizing: border-box; }

/* ===== Grids de formulario responsivos: nunca se cortan, se acomodan
   solos segun el ancho disponible en vez de columnas fijas. ===== */
.erp-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.erp-form-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.erp-form-section { margin-bottom: 4px; }
.erp-form-section h3 {
  color: var(--navy);
  font-size: 15px;
  margin: 28px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--card-border);
}
.erp-form-section:first-of-type h3 { margin-top: 0; }

.erp-checkbox-field { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.erp-checkbox-field input[type="checkbox"] { width: auto; margin: 0; }
.erp-checkbox-field label { margin: 0; font-weight: 500; }

.erp-form-actions {
  display: flex; gap: 12px; align-items: center;
  margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--card-border);
}
.erp-btn-secondary {
  background: #fff; color: var(--navy); border: 1px solid var(--card-border);
  padding: 12px 24px; border-radius: 10px; font-weight: 700; text-decoration: none;
  font-size: 14px; display: inline-block;
}

@media (max-width: 600px) {
  .erp-content { padding: 16px; }
  .erp-login-card { padding: 28px 22px; }
}

/* ===== Sidebar: acceso a Inicio destacado + grupos colapsables ===== */
.erp-nav-home {
  margin: 0 8px 14px;
  padding: 10px 10px !important;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  font-weight: 700;
}
.erp-nav-home .erp-nav-icon { margin-right: 6px; }
.erp-nav-home.active {
  background: rgba(24,177,161,.16);
  border-color: rgba(24,177,161,.35);
}

.erp-nav-group { border: none; margin: 0 8px 4px; }
.erp-nav-group-title {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(255,255,255,.55);
  font-weight: 700;
  padding: 10px 10px;
  border-radius: 10px;
  user-select: none;
}
.erp-nav-group-title::-webkit-details-marker { display: none; }
.erp-nav-group-title::marker { content: ''; }
.erp-nav-group-title:hover { background: rgba(255,255,255,.05); color: rgba(255,255,255,.8); }
.erp-nav-chevron {
  transition: transform .15s;
  font-size: 13px;
}
.erp-nav-group[open] .erp-nav-chevron { transform: rotate(90deg); }

.erp-nav-group-items {
  display: flex;
  flex-direction: column;
  padding: 2px 0 6px 4px;
  border-left: 1px solid rgba(255,255,255,.08);
  margin-left: 14px;
}
.erp-nav-group-items .erp-nav-link { padding: 8px 12px; font-size: 13px; }

/* ===== Maestro-detalle de clientes (clientes.php) — mismo patron que
   el panel lateral de Home_clientes.dart en Flutter: lista a la
   izquierda, ficha del cliente seleccionado a la derecha. Navegacion
   por URL (?selected_id=N), sin JS. ===== */
.erp-master-detail {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.erp-master-detail .erp-list-col { flex: 1; min-width: 0; }
.erp-master-detail .erp-detail-col { width: 380px; flex-shrink: 0; }
@media (max-width: 1180px) {
  .erp-master-detail { flex-direction: column; }
  .erp-master-detail .erp-detail-col { width: 100%; }
}

.erp-row-selected { background: rgba(24,177,161,.06); }
.erp-row-selected td:first-child { box-shadow: inset 3px 0 0 var(--brand-accent); }

.erp-detail-empty {
  text-align: center;
  color: var(--grey-text);
  font-size: 13px;
  padding: 40px 20px;
}
.erp-detail-empty .icon { font-size: 32px; margin-bottom: 10px; }

/* Tarjetas de "caja" de detalle (Contacto, Domicilio, SAT, Credito) -
   ver erp_info_box() en ui_helpers.php. */
.erp-info-box {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 13px;
  margin-bottom: 12px;
}
.erp-info-box-title {
  font-weight: 900;
  font-size: 12.6px;
  color: var(--navy);
  margin-bottom: 10px;
}
.erp-info-row { display: flex; gap: 8px; margin-bottom: 6px; }
.erp-info-label {
  width: 80px;
  flex-shrink: 0;
  color: var(--grey-text);
  font-size: 11.3px;
  font-weight: 600;
}
.erp-info-value {
  color: var(--navy);
  font-size: 11.8px;
  font-weight: 700;
  word-break: break-word;
}

.erp-tag {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--page-bg);
  border: 1px solid var(--card-border);
  color: var(--navy);
  font-size: 11px;
  font-weight: 600;
}
