:root {
  --azul: #1e5f8c;
  --azul-osc: #14405f;
  --azul-claro: #eaf2f8;
  --verde: #2e9e5b;
  --verde-bg: #e7f6ec;
  --amarillo: #d9a72c;
  --amarillo-bg: #fdf1e3;
  --rojo: #cc4b4b;
  --rojo-bg: #fbebeb;
  --gris: #6b7280;
  --bg: #f4f6f8;
  --card: #ffffff;
  --borde: #e2e6ea;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: #1f2937; }
a { color: inherit; }
button { font-family: inherit; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: var(--azul-osc);
  color: white;
  padding: 20px 14px;
  flex-shrink: 0;
}
.sidebar .brand { font-weight: 800; font-size: 20px; margin-bottom: 24px; letter-spacing: .5px; }
.sidebar .brand img { height: 34px; display: block; filter: brightness(0) invert(1); }
.login-card .brand img { height: 44px; display: block; margin: 0 auto; }
.sidebar nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 4px;
  color: #cfe0ec;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
}
.sidebar nav a.active, .sidebar nav a:hover { background: rgba(255,255,255,.12); color: white; }
.sidebar .user-box { margin-top: 24px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.15); font-size: 13px; color: #cfe0ec; }
.sidebar .user-box button { margin-top: 8px; width: 100%; }

.main { flex: 1; padding: 24px 32px; max-width: 1100px; }
.page-title { font-size: 22px; font-weight: 700; margin: 0 0 18px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } .layout { flex-direction: column; } .sidebar { width: 100%; } .main { padding: 16px; } }

.card { background: var(--card); border: 1px solid var(--borde); border-radius: 12px; padding: 18px; transition: box-shadow .15s ease, transform .15s ease; }
.card:hover { box-shadow: 0 4px 16px rgba(20,64,95,.08); }
.stat-card { border-left: 4px solid var(--azul); }
.stat-card.accent-azul { border-left-color: var(--azul); }
.stat-card.accent-verde { border-left-color: var(--verde); }
.stat-card.accent-rojo { border-left-color: var(--rojo); }
.stat-card.accent-amarillo { border-left-color: var(--amarillo); }
.stat-card .stat-num { font-size: 28px; font-weight: 800; color: var(--azul-osc); }
.stat-card .stat-label { color: var(--gris); font-size: 13px; margin-top: 4px; }

.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.qa-btn {
  border: none; border-radius: 10px; padding: 12px 18px; font-size: 14px; font-weight: 700;
  cursor: pointer; background: linear-gradient(135deg, var(--azul), var(--azul-osc)); color: white;
  box-shadow: 0 3px 10px rgba(30,95,140,.25); transition: transform .12s ease, box-shadow .12s ease;
}
.qa-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(30,95,140,.32); }

.avisos-privados { background: #fbf7ec; border: 1px dashed var(--amarillo); }

.main { animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

tr.clickable { transition: background-color .1s ease; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--borde); }
th { color: var(--gris); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
tr:hover td { background: #fafbfc; }
tr.clickable { cursor: pointer; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #eef2f6; color: var(--azul-osc); }
.badge-pendiente, .badge-nuevo { background: var(--amarillo-bg); color: var(--amarillo); }
.badge-en_proceso, .badge-esperando_documentos, .badge-en_revision { background: var(--azul-claro); color: var(--azul); }
.badge-entregado, .badge-aprobado, .badge-subido { background: var(--verde-bg); color: var(--verde); }
.badge-rechazado, .badge-vencido { background: var(--rojo-bg); color: var(--rojo); }

.btn { border: none; border-radius: 8px; padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer; background: var(--azul); color: white; transition: background-color .12s ease, transform .08s ease; }
.btn:active { transform: scale(0.97); }
.btn:hover { background: var(--azul-osc); }
.btn-secondary { background: #eef2f6; color: var(--azul-osc); }
.btn-secondary:hover { background: #dfe7ee; }
.btn-danger { background: var(--rojo-bg); color: var(--rojo); }
.btn-danger:hover { background: #f6d5d5; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.search-input, input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  width: 100%;
  background: white;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 70px; }
label { font-size: 13px; font-weight: 600; color: #374151; display: block; margin-bottom: 5px; }
.field { margin-bottom: 14px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(20,30,40,.5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal { background: white; border-radius: 14px; padding: 24px; width: 100%; max-width: 560px; }
.modal h2 { margin-top: 0; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--azul-osc); }
.login-card { background: white; border-radius: 16px; padding: 36px; width: 100%; max-width: 380px; }
.login-card .brand { font-weight: 800; font-size: 26px; color: var(--azul-osc); text-align: center; margin-bottom: 4px; }
.login-card .tagline { text-align: center; color: var(--gris); font-size: 13px; margin-bottom: 24px; }

.alert { border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px; }
.alert-error { background: var(--rojo-bg); color: #8a2c2c; }
.alert-warn { background: var(--amarillo-bg); color: #8a5a10; }
.alert-success { background: var(--verde-bg); color: #1f6b3c; }

.section-title { font-size: 15px; font-weight: 700; margin: 20px 0 10px; }
.muted { color: var(--gris); font-size: 13px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tag-filter { padding: 6px 14px; border-radius: 20px; border: 1px solid var(--borde); background: white; cursor: pointer; font-size: 13px; }
.tag-filter.active { background: var(--azul); color: white; border-color: var(--azul); }

.checklist-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--borde); }
.checklist-row:last-child { border-bottom: none; }
.checklist-row .name { flex: 1; font-size: 14px; }
.link-box { display: flex; gap: 8px; align-items: center; background: #f7f9fb; border: 1px solid var(--borde); border-radius: 8px; padding: 10px 12px; font-size: 13px; word-break: break-all; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--gris); }
