:root {
  --blue:   #1a3a6b;
  --blue2:  #2563eb;
  --green:  #16a34a;
  --yellow: #ca8a04;
  --orange: #ea580c;
  --red:    #dc2626;
  --gray:   #f3f4f6;
  --border: #e5e7eb;
  --text:   #111827;
  --muted:  #6b7280;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: #f9fafb; color: var(--text); font-size: 14px; }
a { color: var(--blue2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* NAV */
nav { background: var(--blue); color: #fff; padding: 0 1.5rem; display: flex; align-items: center; gap: 1.5rem; height: 52px; }
nav .brand { font-weight: 700; font-size: 1rem; letter-spacing: .5px; color: #fff; }
nav .spacer { flex: 1; }
nav a { color: rgba(255,255,255,.8); font-size: 13px; }
nav a:hover { color: #fff; text-decoration: none; }
nav .user-badge { background: rgba(255,255,255,.15); padding: 4px 10px; border-radius: 999px; font-size: 12px; }

/* MAIN LAYOUT */
main { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
h1 { font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; }
h2 { font-size: 1rem; font-weight: 600; margin-bottom: .75rem; }

/* CARDS */
.card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; }
.card + .card { margin-top: 1rem; }

/* SEMANAS GRID */
.semanas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.semana-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 1rem; position: relative; }
.semana-card:hover { border-color: var(--blue2); box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.semana-card .codigo { font-size: 1.5rem; font-weight: 800; color: var(--blue); }
.semana-card .fecha { color: var(--muted); font-size: 12px; margin-bottom: .5rem; }
.semana-card .badges { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .5rem; }
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; padding: 2px 7px; border-radius: 999px; font-weight: 500; }
.badge-ok     { background: #dcfce7; color: #15803d; }
.badge-warn   { background: #fef9c3; color: #854d0e; }
.badge-miss   { background: #fee2e2; color: #b91c1c; }
.badge-info   { background: #dbeafe; color: #1d4ed8; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; border: 1px solid transparent; cursor: pointer; transition: all .15s; }
.btn-primary   { background: var(--blue2); color: #fff; border-color: var(--blue2); }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--gray); }
.btn-danger    { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* TABLES */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--gray); text-align: left; padding: 8px 10px; font-weight: 600; border-bottom: 2px solid var(--border); position: sticky; top: 0; z-index: 1; }
td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafb; }

/* OCUPACIÓN COLORS */
.oc-rojo    { color: #b91c1c; font-weight: 600; }
.oc-amarillo{ color: #854d0e; font-weight: 600; }
.oc-naranja { color: #c2410c; font-weight: 600; }
.oc-verde   { color: #15803d; font-weight: 600; }
.oc-full    { color: #1d4ed8; font-weight: 600; }

/* TENDENCIA */
.tend-pos { color: var(--green); }
.tend-neg { color: var(--red); }

/* ALERTS */
.alert { padding: .75rem 1rem; border-radius: 6px; margin-bottom: .75rem; font-size: 13px; }
.alert-danger  { background: #fee2e2; border: 1px solid #fecaca; color: #7f1d1d; }
.alert-success { background: #dcfce7; border: 1px solid #bbf7d0; color: #14532d; }
.alert-info    { background: #dbeafe; border: 1px solid #bfdbfe; color: #1e3a8a; }
.alert-warn    { background: #fef9c3; border: 1px solid #fde047; color: #713f12; }

/* FORMS */
.form-group { margin-bottom: 1rem; }
label { display: block; font-weight: 500; margin-bottom: .35rem; font-size: 13px; }
input[type=text], input[type=password], input[type=email], select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
  outline: none; transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--blue2); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }

/* LOGIN */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box  { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 2rem; width: 360px; }
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo .logo-text { font-size: 1.5rem; font-weight: 800; color: var(--blue); }
.login-logo .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* LOG OUTPUT */
pre.log { background: #111; color: #e5e7eb; padding: 1rem; border-radius: 6px; font-size: 12px; max-height: 300px; overflow-y: auto; white-space: pre-wrap; }

/* RESUMEN HTML EMBED */
.semana-resumen iframe { width: 100%; border: 1px solid var(--border); border-radius: 6px; min-height: 600px; }

/* SPINNER */
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* FLEX UTILS */
.flex { display: flex; align-items: center; gap: .75rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
