/* ============================================================
   Proyectos Ligiere Interactivos — identidad visual unificada
   con Ligiere Core (tokens, tipografía y componentes tomados
   de ligiere-core-master para que ambos sistemas se vean como
   una sola familia).
   ============================================================ */

:root {
  --ink: #18201d;
  --muted: #68716d;
  --line: #e5e8e5;
  --paper: #f7f8f6;
  --green: #254f43;
  --green-dark: #1a3a31;
  --green2: #dce9e3;
  --cream: #f2eee3;
  --danger: #a3403c;
  --danger-bg: #fbeaec;
  --ok: #17643a;
  --ok-bg: #e3f4ea;
  --warn: #8a5b00;
  --warn-bg: #fff1cf;
  --radius: 10px;

  /* alias de compatibilidad con nombres usados antes */
  --bg: var(--paper);
  --panel: #ffffff;
  --border: var(--line);
  --text: var(--ink);
  --text-muted: var(--muted);
  --brand: var(--green);
  --brand-dark: var(--green-dark);
  --accent: #b6ed22;
  --ok-old: var(--ok);
  --warn-old: var(--warn);
}

* { box-sizing: border-box; }

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

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; color: var(--ink); }

.app-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: #ffffff;
  color: var(--ink);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: Georgia, serif;
  font-size: 1.15rem;
  color: var(--ink);
  margin-bottom: 22px;
  line-height: 1.25;
}
.sidebar .brand .brand-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 9px;
  overflow: hidden;
  background: var(--green);
  display: grid;
  place-items: center;
}
.sidebar .brand .brand-mark img { width: 100%; height: 100%; display: block; }
.sidebar .brand b { color: var(--green); display: block; }
.sidebar .brand small { display: block; font-weight: 400; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.02em; margin-top: 2px; }

.sidebar a {
  color: #65706b;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
}
.sidebar a:hover { background: #f1f3f0; text-decoration: none; }
.sidebar a.active { background: var(--green2); color: var(--green); font-weight: 800; }

.sidebar .spacer { flex: 1; }
.sidebar .user-box { font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.sidebar .user-box b, .sidebar .user-box > * { color: var(--ink); }
.sidebar form { margin-top: 6px; }
.sidebar button.link-btn {
  background: none; border: none; color: var(--green); cursor: pointer; padding: 0; font-size: 0.82rem;
  font-weight: 700; text-decoration: none;
}
.sidebar button.link-btn:hover { text-decoration: underline; }

.main { flex: 1; padding: 32px 40px; max-width: 1180px; }

h1 { font-size: 1.9rem; margin: 0 0 4px; line-height: 1.15; }
h2 { font-size: 1.2rem; margin: 30px 0 12px; font-family: Georgia, serif; color: var(--green); }
.subtitle { color: var(--muted); margin: 0 0 24px; }

.panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(29, 43, 37, 0.06);
}

.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.stat-tile {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px 19px;
  min-width: 150px;
  box-shadow: 0 2px 8px rgba(29, 43, 37, 0.05);
}
.stat-tile .num { font-family: Georgia, serif; font-size: 1.7rem; font-weight: 500; color: var(--green); }
.stat-tile .label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 9px; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
th { color: var(--muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; background: #f9faf9; }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 800;
  background: #eef1f0; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em;
}
.badge.descubrimiento { background: var(--warn-bg); color: var(--warn); }
.badge.cotizado { background: var(--green2); color: var(--green); }
.badge.aprobado, .badge.enviado { background: var(--ok-bg); color: var(--ok); }
.badge.en_progreso { background: var(--green2); color: var(--green); }
.badge.cerrado { background: #eef1f0; color: var(--muted); }
.badge.rechazado, .badge.borrador { background: var(--danger-bg); color: var(--danger); }

.btn {
  display: inline-block; background: var(--green); color: #fff; border: none; padding: 10px 17px;
  border-radius: 9px; cursor: pointer; font-size: 0.9rem; font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 79, 67, 0.18);
  font-family: inherit;
}
.btn:hover { background: var(--green-dark); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--green); border: 1px solid #b9cbc2; box-shadow: none; }
.btn.secondary:hover { background: #f3f9f5; }
.btn.danger { background: var(--danger); box-shadow: none; }

.form-row { margin-bottom: 15px; }
.form-row label { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 6px; color: #505955; }
.form-row input[type=text], .form-row input[type=email], .form-row input[type=number],
.form-row input[type=password], .form-row select, .form-row textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #dbe0dc; border-radius: 8px; font-size: 0.92rem;
  font-family: inherit; background: #fff; color: var(--ink); outline: none;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: #9db9aa; box-shadow: 0 0 0 3px var(--green2); }
.form-row textarea { min-height: 80px; resize: vertical; }
.hint { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }

.error-box { background: var(--danger-bg); color: var(--danger); border: 1px solid #f0c9c6; padding: 11px 15px; border-radius: 8px; margin-bottom: 18px; font-size: 0.9rem; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--paper); padding: 20px; }
.login-box { background: #fff; padding: 38px 34px; border-radius: 16px; width: 360px; border: 1px solid var(--line); box-shadow: 0 20px 55px rgba(24, 51, 40, 0.1); text-align: center; }
.login-box .login-logo { width: 190px; margin: 0 auto 18px; display: block; }
.login-box h1 { text-align: center; margin-bottom: 4px; font-size: 1.5rem; }
.login-box .subtitle { text-align: center; margin-bottom: 24px; }
.login-box .form-row { text-align: left; }

.category-block { margin-bottom: 24px; }
.category-block h3 { font-size: 0.95rem; color: var(--green); margin: 0 0 10px; font-family: Georgia, serif; }
.question-row { margin-bottom: 12px; }
.question-row label { display: block; font-size: 0.88rem; margin-bottom: 4px; color: #505955; }

.total-line { font-size: 1.2rem; font-weight: 700; text-align: right; padding: 12px 0; font-family: Georgia, serif; color: var(--green); }

.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .form-row { margin-bottom: 0; flex: 1; min-width: 120px; }

.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 12px; }
.breadcrumb a { color: var(--muted); text-decoration: underline; }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { margin-bottom: 0; margin-right: auto; }
  .sidebar .spacer { display: none; }
  .sidebar .user-box { display: none; }
  .main { padding: 22px 18px; }
}

@media print {
  .sidebar, .no-print { display: none !important; }
  .main { max-width: 100%; padding: 0; }
}
