:root {
  --bg: #f4efe9;
  --card: #ffffff;
  --ink: #2c2a3a;
  --muted: #8a8496;
  --verde: #7bc9a1;
  --verde-bg: #e6f6ee;
  --rojo: #e88b8b;
  --rojo-bg: #fbe9e9;
  --gris: #b7b2c4;
  --gris-bg: #ece9f2;
  --vacio-bg: #f7f5f2;
  --accent: #c9a6e0;
  --accent2: #a6c9e0;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 30px 70px -30px rgba(60, 40, 90, 0.18), 0 6px 16px -6px rgba(60, 40, 90, 0.12);
  font-family: "Manrope", sans-serif;
}

* { box-sizing: border-box; }
html, body, #root { min-height: 100%; }
body {
  margin: 0;
  background: linear-gradient(180deg, #f7f2ec, #efe7f4);
  color: var(--ink);
  overflow-x: hidden;
}

h1, h2, h3 { font-family: "Anton", sans-serif; letter-spacing: 0.3px; margin: 0; }

.app { min-height: 100vh; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login__card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 30px;
}
.login__title { font-size: clamp(1.6rem, 6vw, 2.2rem); margin-bottom: 6px; }
.login__sub { color: var(--muted); margin-bottom: 22px; font-size: 0.95rem; }
.login__field { margin-bottom: 14px; }
.login__field label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.login__field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #e4dfe9;
  background: #faf8fb;
  font-size: 1rem;
  font-family: inherit;
}
.login__field input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.login__btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  color: #2c2a3a;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 14px 30px -12px rgba(180, 140, 220, 0.6);
  transition: transform 0.15s ease;
  margin-top: 6px;
}
.login__btn:hover { transform: translateY(-2px); }
.login__switch { margin-top: 16px; text-align: center; font-size: 0.9rem; color: var(--muted); }
.login__switch button { background: none; border: none; color: var(--ink); font-weight: 700; cursor: pointer; text-decoration: underline; padding: 0; }
.login__error { color: #b0453f; font-size: 0.85rem; margin-top: 10px; }

/* ---------- Layout ---------- */
.panel { max-width: 1100px; margin: 0 auto; padding: 28px 20px 80px; }
.panel__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.panel__title { font-size: clamp(1.6rem, 6vw, 2.4rem); }
.panel__user { color: var(--muted); font-size: 0.9rem; }
.panel__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn--ghost { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.btn--danger { background: linear-gradient(120deg, #eb9a9a, #e4736e); color: #fff; box-shadow: 0 14px 30px -12px rgba(220, 100, 100, 0.5); }
.btn--primary { background: linear-gradient(120deg, var(--accent2), var(--accent)); color: #2c2a3a; box-shadow: 0 14px 30px -12px rgba(160, 140, 220, 0.55); }

/* ---------- Resumen ---------- */
.resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 16px; margin-bottom: 26px; }
.resumen__card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.resumen__card::before {
  content: "";
  position: absolute;
  top: -30px; right: -30px;
  width: 90px; height: 90px;
  border-radius: 50%;
  opacity: 0.25;
}
.resumen__card--verde::before { background: var(--verde); }
.resumen__card--rojo::before { background: var(--rojo); }
.resumen__card--gris::before { background: var(--gris); }
.resumen__card--total::before { background: var(--accent); }
.resumen__num { font-family: "Anton", sans-serif; font-size: 2.4rem; line-height: 1; }
.resumen__label { color: var(--muted); font-size: 0.85rem; margin-top: 4px; font-weight: 600; }

/* ---------- Formulario ---------- */
.form-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 28px;
}
.form-card h3 { font-size: 1.2rem; margin-bottom: 16px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.form-grid label { display: block; font-size: 0.8rem; color: var(--muted); font-weight: 700; margin-bottom: 6px; min-width: 0; }
.form-grid select, .form-grid input, .form-grid textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #e4dfe9;
  background: #faf8fb;
  font-family: inherit;
  font-size: 0.95rem;
}
.form-card textarea { min-height: 60px; resize: vertical; }
.form-card .msg { margin-top: 10px; font-size: 0.85rem; }
.form-card .msg--ok { color: #4a8c6b; }
.form-card .msg--err { color: #b0453f; }

/* ---------- Tabla ---------- */
.tabla-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
table.tabla { width: 100%; border-collapse: collapse; min-width: 640px; }
.tabla th, .tabla td { padding: 14px 16px; text-align: left; font-size: 0.9rem; }
.tabla th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid #eee5f2; }
.tabla tr:not(:last-child) td { border-bottom: 1px solid #f1ecf6; }
.tabla__permiso { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.tabla__icono { width: 22px; height: 22px; flex: none; color: var(--ink); opacity: 0.75; }

.semaforo { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 0.8rem; }
.semaforo__dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.semaforo--verde { background: var(--verde-bg); color: #327b56; }
.semaforo--verde .semaforo__dot { background: var(--verde); box-shadow: 0 0 0 4px rgba(123,201,161,0.25); }
.semaforo--rojo { background: var(--rojo-bg); color: #a8433d; }
.semaforo--rojo .semaforo__dot { background: var(--rojo); box-shadow: 0 0 0 4px rgba(232,139,139,0.25); }
.semaforo--gris { background: var(--gris-bg); color: #605a72; }
.semaforo--gris .semaforo__dot { background: var(--gris); box-shadow: 0 0 0 4px rgba(183,178,196,0.25); }
.semaforo--vacio { background: var(--vacio-bg); color: #b0aab8; }
.semaforo--vacio .semaforo__dot { background: #ddd8e2; }

.tabla__meta { color: var(--muted); font-size: 0.82rem; }
.tabla__error { color: #a8433d; font-size: 0.8rem; max-width: 220px; overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .panel__top { flex-direction: column; align-items: flex-start; }
}

.login__demo {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--vacio-bg);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.login__demo-title { color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.login__demo p { margin: 3px 0; }

.roles__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.roles__msg { color: var(--muted); }
