:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --text: #e8eef7;
  --muted: #8b9cb3;
  --primary: #2dd4bf;
  --primary-d: #14b8a6;
  --danger: #f87171;
  --warn: #fbbf24;
  --success: #4ade80;
  --radius: 10px;
  --font: 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--surface); border-right: 1px solid #2a3548;
  display: flex; flex-direction: column; padding: 1rem;
}
.brand { display: flex; gap: .75rem; align-items: center; margin-bottom: 1.5rem; }
.brand small { display: block; color: var(--muted); font-size: .75rem; }
.brand-icon { font-size: 1.75rem; }
.sidebar nav { flex: 1; display: flex; flex-direction: column; gap: .25rem; }
.sidebar nav a {
  color: var(--muted); text-decoration: none; padding: .5rem .75rem; border-radius: 6px; font-size: .9rem;
}
.sidebar nav a:hover, .sidebar nav a.active { background: var(--surface2); color: var(--text); }
.nav-section { margin-top: 1rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .5rem .75rem 0; }
.sidebar-footer { border-top: 1px solid #2a3548; padding-top: 1rem; }
.user-chip strong { display: block; }
.user-chip span { font-size: .8rem; color: var(--muted); text-transform: capitalize; }

.main { flex: 1; padding: 1.5rem 2rem; overflow: auto; max-width: 1200px; }
.page-header { margin-bottom: 1.25rem; }
.page-header.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.page-header h1 { margin: 0 0 .25rem; font-size: 1.5rem; }
.meta, .subtitle, .hint { color: var(--muted); font-size: .9rem; }

.card { background: var(--surface); border-radius: var(--radius); padding: 1.25rem; border: 1px solid #2a3548; margin-bottom: 1rem; }
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .65rem 1rem; text-align: left; border-bottom: 1px solid #2a3548; }
th { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; }
.row-alert { background: rgba(248,113,113,.08); }
.actions { white-space: nowrap; }
.actions a, .link-btn { margin-right: .5rem; color: var(--primary); background: none; border: none; cursor: pointer; font: inherit; text-decoration: underline; }
.link-btn-danger { color: var(--danger); }
.actions form.inline { display: inline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .55rem 1rem; border-radius: 8px; border: none; cursor: pointer;
  font-weight: 600; text-decoration: none; font-size: .9rem;
}
.btn-primary { background: var(--primary); color: #042f2e; }
.btn-primary:hover { background: var(--primary-d); }
.btn-secondary { background: var(--surface2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid #2a3548; }
.btn-sm { padding: .35rem .65rem; font-size: .8rem; }
.btn-block { width: 100%; }

.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: .35rem; font-size: .85rem; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: .55rem .75rem; border-radius: 8px;
  border: 1px solid #3d4f66; background: var(--bg); color: var(--text);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.field-full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1rem; }
.form-card { max-width: 720px; }
.checks label, .checks-grid label { display: flex; align-items: center; gap: .5rem; margin: .35rem 0; }
.checks-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .5rem; }
.checkbox { display: flex; align-items: center; gap: .5rem; margin: .75rem 0; }

.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-success { background: rgba(74,222,128,.15); border: 1px solid var(--success); }
.alert-error { background: rgba(248,113,113,.15); border: 1px solid var(--danger); }
.alert-warn { background: rgba(251,191,36,.12); border: 1px solid var(--warn); }

.badge { display: inline-block; padding: .2rem .5rem; border-radius: 4px; font-size: .75rem; background: var(--surface2); }
.badge-warn, .badge-pendiente_revision { background: rgba(251,191,36,.2); color: var(--warn); }
.badge-aprobado { background: rgba(74,222,128,.2); color: var(--success); }
.badge-rechazado { background: rgba(248,113,113,.2); color: var(--danger); }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.stat-card { text-decoration: none; color: inherit; background: var(--surface); border: 1px solid #2a3548; border-radius: var(--radius); padding: 1rem; transition: border-color .2s; }
.stat-card:hover { border-color: var(--primary); }
.stat-numbers { display: flex; flex-direction: column; gap: .35rem; margin-top: .5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.list { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--muted); }
.mini-form { display: flex; flex-wrap: wrap; gap: .5rem; }
.mini-form input, .mini-form select { flex: 1; min-width: 100px; }
.filters { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; }
.inline-form { display: flex; align-items: center; gap: .75rem; }
.inline { display: inline; }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); padding: 2rem; border-radius: var(--radius); border: 1px solid #2a3548; }
.login-card h1 { margin: 0 0 .25rem; font-size: 1.35rem; }
.detail-grid { display: grid; grid-template-columns: 160px 1fr; gap: .5rem 1rem; }
.json-dump { background: var(--bg); padding: 1rem; border-radius: 8px; overflow: auto; font-size: .8rem; }
.text-center { text-align: center; }
.muted { color: var(--muted); }
.mb { margin-bottom: 1rem; }
.input-plain { background: transparent; border: none; color: var(--text); width: 100%; }
