/* Tema de la app de operaciones. Para cambiar la marca, ajusta los tokens de :root. */
:root {
  --nav-from: #0d3a85;
  --nav-to: #0a2b63;
  --nav-text: #dbe6ff;
  --nav-active: #1e7bf2;
  --top: #1e7bf2;
  --primary: #1e7bf2;
  --primary-dark: #1663c9;
  --bg: #f2f6fc;
  --card: #ffffff;
  --border: #e3e9f3;
  --text: #0f1f3d;
  --muted: #5d6b85;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 31, 61, 0.06);

  --blue: #1e7bf2;   --blue-soft: #e8f1fe;
  --green: #22a45d;  --green-soft: #e6f7ee;
  --orange: #f59a23; --orange-soft: #fff4e5;
  --purple: #8b5cf6; --purple-soft: #f1ecfe;
  --red: #e5484d;    --red-soft: #fdecec;
  --gray: #7b879c;   --gray-soft: #eef1f6;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 28px; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 19px; margin: 0 0 14px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code, pre { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: 13px; }

/* ---------- Estructura ---------- */
.layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--nav-from), var(--nav-to)); color: var(--nav-text);
  padding: 22px 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 22px 26px; color: #fff; }
.brand svg { width: 38px; height: 38px; flex: none; }
.brand-name { font-size: 20px; font-weight: 700; line-height: 1.1; }
.brand-name span { color: #6fb0ff; }
.brand-tag { font-size: 12px; color: var(--nav-text); opacity: 0.85; }
.nav { display: flex; flex-direction: column; gap: 4px; padding-right: 0; }
.nav a {
  display: flex; align-items: center; gap: 14px; padding: 12px 22px; color: var(--nav-text);
  font-weight: 500; border-radius: 0 10px 10px 0; margin-right: 0;
}
.nav a:hover { background: rgba(255, 255, 255, 0.07); text-decoration: none; }
.nav a.active { background: var(--nav-active); color: #fff; }
.nav svg { width: 21px; height: 21px; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.6; padding: 18px 22px 6px; }
.sidebar-foot { margin-top: auto; }
.sidebar-foot form button {
  all: unset; display: flex; align-items: center; gap: 14px; padding: 12px 22px; cursor: pointer;
  color: var(--nav-text); width: 100%; box-sizing: border-box; font-weight: 500;
}
.sidebar-foot form button:hover { background: rgba(255, 255, 255, 0.07); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--top); color: #fff; height: 72px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 28px; gap: 16px;
}
.topbar .crumbs { font-weight: 500; opacity: 0.95; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); display: grid;
  place-items: center; font-weight: 700;
}
.user-chip .who { line-height: 1.15; }
.user-chip .who small { opacity: 0.85; display: block; }
.content { padding: 26px 28px 40px; max-width: 1400px; width: 100%; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }

/* ---------- Tarjetas ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 18px; }
.grid > .card { margin: 0; }
h1 svg, h2 svg, h3 svg { width: 20px; height: 20px; vertical-align: -3px; }
.muted svg, .meta svg { width: 15px; height: 15px; vertical-align: -2px; }
.linkbtn svg { width: 17px; height: 17px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.stat { display: flex; gap: 16px; align-items: center; padding: 20px; border-radius: var(--radius); border: 1px solid var(--border); }
.stat .icon { width: 58px; height: 58px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.stat .icon svg { width: 28px; height: 28px; }
.stat .label { font-weight: 600; font-size: 14px; }
.stat .value { font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat .hint { font-size: 12.5px; color: var(--muted); }
.stat.blue { background: var(--blue-soft); } .stat.blue .icon { background: var(--blue); } .stat.blue .label { color: #1452a8; }
.stat.green { background: var(--green-soft); } .stat.green .icon { background: var(--green); } .stat.green .label { color: #18733f; }
.stat.orange { background: var(--orange-soft); } .stat.orange .icon { background: var(--orange); } .stat.orange .label { color: #9a5a07; }
.stat.purple { background: var(--purple-soft); } .stat.purple .icon { background: var(--purple); } .stat.purple .label { color: #5b33c2; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; font-size: 13.5px; color: var(--muted); background: #f6f8fc; padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Etiquetas de estado ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--green-soft); color: #18733f; }
.badge.orange { background: var(--orange-soft); color: #a86207; }
.badge.blue { background: var(--blue-soft); color: #1452a8; }
.badge.red { background: var(--red-soft); color: #b42328; }
.badge.gray { background: var(--gray-soft); color: #4d5870; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.dot.ok { background: var(--green); } .dot.bad { background: var(--red); } .dot.off { background: #c3cad8; }

/* ---------- Botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; background: var(--primary); color: #fff; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn svg { width: 18px; height: 18px; }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: #f4f7fc; }
.btn.green { background: var(--green); } .btn.green:hover { background: #1b8a4e; }
.btn.orange { background: var(--orange); } .btn.orange:hover { background: #d9840f; }
.btn.danger { background: #fff; color: var(--red); border-color: #f3c2c4; }
.btn.danger:hover { background: var(--red-soft); }
.btn.small { padding: 6px 12px; font-size: 13.5px; border-radius: 8px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.linkbtn { all: unset; color: var(--primary); cursor: pointer; font-weight: 500; }
.linkbtn:hover { text-decoration: underline; }

form.stack { display: grid; gap: 14px; }
label { font-weight: 600; font-size: 14px; display: grid; gap: 6px; }
label .help { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
  font: inherit; padding: 10px 12px; border: 1px solid #cdd6e5; border-radius: 10px; background: #fff; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #b7d5fd; border-color: var(--primary); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 17px; height: 17px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
input.inline { padding: 6px 10px; border-radius: 8px; max-width: 220px; }

/* ---------- Avisos ---------- */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; }
.flash.ok { background: var(--green-soft); color: #18733f; }
.flash.error { background: var(--red-soft); color: #b42328; }
.notice { padding: 14px 16px; border-radius: 10px; background: var(--blue-soft); color: #173f7a; }
.notice.warn { background: var(--orange-soft); color: #7a4706; }
.notice.danger { background: var(--red-soft); color: #8f1d21; }

/* ---------- Varios ---------- */
.log { background: #0d1830; color: #d6e2ff; border-radius: 10px; padding: 14px; max-height: 520px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.empty { text-align: center; padding: 34px 10px; color: var(--muted); }
.module-card { display: flex; flex-direction: column; gap: 10px; }
.module-card .meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pill-list { display: flex; gap: 8px; flex-wrap: wrap; }
.saved { color: var(--green); font-size: 12.5px; }
.secret { font-family: "JetBrains Mono", ui-monospace, monospace; background: #f3f6fb; padding: 2px 8px; border-radius: 6px; }
details.danger-zone summary { cursor: pointer; color: var(--red); font-weight: 600; }
.doc { max-width: 920px; }
.doc table { margin: 12px 0; font-size: 14px; }
.doc td, .doc th { border: 1px solid var(--border); }
.doc pre { background: #0d1830; color: #e3ebff; padding: 14px; border-radius: 10px; overflow-x: auto; }
.doc code { background: #eef2f9; padding: 1px 5px; border-radius: 5px; }
.doc pre code { background: none; padding: 0; }
.doc blockquote { margin: 12px 0; padding: 10px 16px; border-left: 4px solid var(--primary); background: var(--blue-soft); border-radius: 0 8px 8px 0; }
.doc h1 { margin-top: 0; } .doc h2 { margin-top: 28px; } .doc h3 { margin-top: 20px; }

.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-side { background: linear-gradient(160deg, var(--nav-from), var(--nav-to)); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-side .brand { padding: 0; }
.login-side h1 { font-size: 34px; max-width: 420px; }
.login-form { display: grid; place-items: center; padding: 32px 16px; }
.login-form .card { width: 100%; max-width: 400px; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 14px 0; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav a { border-radius: 10px; padding: 10px 14px; white-space: nowrap; }
  .nav-section, .sidebar-foot { display: none; }
  .brand { padding-bottom: 12px; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 32px; }
  .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { padding: 28px 16px; }
}
.saved.bad { color: var(--red); }
.seat-student { display: flex; flex-direction: column; gap: 4px; min-width: 190px; }
