/* ═══════════════════════════════════════════════════
   UPMYS · Sistema de Diseño Institucional
   Paleta oficial
   ═══════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Paleta oficial */
  --dark-blue:  #061856;
  --bold-blue:  #134074;
  --blue:       #0054A2;
  --light-blue: #5590FF;
  --light:      #F2F9FF;

  /* Derivados */
  --bg:         #F4F7FC;
  --surface:    #FFFFFF;
  --border:     #D3E2F4;
  --border-light: #E8F1FB;

  /* Texto */
  --text-primary:   #0D1B3E;
  --text-secondary: #4A5F80;
  --text-muted:     #8298B8;

  /* Estados */
  --success: #1A7F4B;
  --success-bg: #E8F5EE;
  --error:   #C0392B;
  --error-bg: #FAEAE8;
  --warning: #B7670A;
  --warning-bg: #FEF3E2;

  /* Layout */
  --header-h: 68px;
  --footer-h: 56px;
  --max-w: 1160px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;

  /* Sombras */
  --shadow-sm: 0 1px 4px rgba(6,24,86,.06), 0 1px 2px rgba(6,24,86,.04);
  --shadow:    0 2px 12px rgba(6,24,86,.08), 0 1px 4px rgba(6,24,86,.04);
  --shadow-lg: 0 8px 32px rgba(6,24,86,.12), 0 2px 8px rgba(6,24,86,.06);

  /* Transición */
  --ease: cubic-bezier(.4,0,.2,1);
  --t: 180ms;
}

/* ── Reset ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ══════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════ */
.site-header {
  height: var(--header-h);
  background: var(--dark-blue);
  border-bottom: 2px solid var(--bold-blue);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex: 1;
}

.header-logo {
  width: 40px;
  height: 40px;
  background: var(--blue);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}
.header-logo svg { width: 26px; height: 26px; }

.header-brand-text { display: flex; flex-direction: column; }
.header-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
  line-height: 1.1;
}
.header-brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,.5);
  letter-spacing: .02em;
  line-height: 1.3;
}

.header-divider {
  width: 1px; height: 28px;
  background: rgba(255,255,255,.15);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-link {
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--t) var(--ease);
}
.header-link:hover,
.header-link.active {
  color: #fff;
  background: rgba(255,255,255,.1);
}

.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--t) var(--ease);
  border: none;
}
.header-btn-primary {
  background: var(--blue);
  color: #fff;
}
.header-btn-primary:hover { background: var(--light-blue); }

.header-btn-ghost {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.8);
  border: 1px solid rgba(255,255,255,.15);
}
.header-btn-ghost:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* Breadcrumb inside header */
.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.header-breadcrumb a {
  color: rgba(255,255,255,.55);
  text-decoration: none;
  font-size: 13px;
  transition: color var(--t);
}
.header-breadcrumb a:hover { color: rgba(255,255,255,.9); }
.header-breadcrumb .sep { color: rgba(255,255,255,.25); font-size: 13px; }
.header-breadcrumb .current {
  color: rgba(255,255,255,.85);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

/* ══════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════ */
.site-footer {
  height: var(--footer-h);
  background: var(--dark-blue);
  border-top: 1px solid var(--bold-blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
  margin-top: auto;
}
.footer-left {
  font-size: 12px;
  color: rgba(255,255,255,.4);
}
.footer-left strong { color: rgba(255,255,255,.6); font-weight: 600; }
.footer-right {
  font-size: 12px;
  color: rgba(255,255,255,.3);
}

/* ══════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════ */
.page-main {
  flex: 1;
  padding: 40px 32px;
  max-width: calc(var(--max-w) + 64px);
  width: 100%;
  margin: 0 auto;
}

.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--dark-blue);
  line-height: 1.2;
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ══════════════════════════════════════════════════
   BADGES / CHIPS
   ══════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-blue   { background: var(--light); color: var(--blue); }
.badge-navy   { background: rgba(6,24,86,.08); color: var(--dark-blue); }
.badge-green  { background: var(--success-bg); color: var(--success); }
.badge-red    { background: var(--error-bg); color: var(--error); }
.badge-yellow { background: var(--warning-bg); color: var(--warning); }

/* ══════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--t) var(--ease);
  border: none;
  line-height: 1;
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.98); }

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,84,162,.25);
}
.btn-primary:hover:not(:disabled) {
  background: var(--bold-blue);
  box-shadow: 0 4px 16px rgba(0,84,162,.35);
}

.btn-secondary {
  background: var(--light);
  color: var(--blue);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border-light); }

.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(192,57,43,.15);
}
.btn-danger:hover:not(:disabled) { background: #F5C6C0; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--blue);
}

.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-full { width: 100%; }

/* ══════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ══════════════════════════════════════════════════
   FORM ELEMENTS
   ══════════════════════════════════════════════════ */
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 7px;
  line-height: 1.4;
}
.form-label .req { color: var(--error); margin-left: 3px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--error); margin-top: 5px; font-weight: 500; }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
  appearance: none;
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }
.form-input:hover,
.form-select:hover,
.form-textarea:hover { border-color: var(--light-blue); }
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,84,162,.12);
}
.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(192,57,43,.1);
}
.form-textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234A5F80' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Radio / Checkbox option rows */
.opt-list { display: flex; flex-direction: column; gap: 8px; }
.opt-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--t) var(--ease);
  background: #fff;
}
.opt-item:hover { border-color: var(--light-blue); background: var(--light); }
.opt-item.is-selected { border-color: var(--blue); background: var(--light); }
.opt-item input[type="radio"],
.opt-item input[type="checkbox"] {
  accent-color: var(--blue);
  width: 16px; height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}
.opt-item .opt-label { font-size: 14px; color: var(--text-primary); cursor: pointer; line-height: 1.3; }

/* ══════════════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
}
thead th {
  background: var(--dark-blue);
  color: rgba(255,255,255,.8);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--bold-blue);
}
thead th:first-child { border-radius: var(--radius-lg) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-lg) 0 0; }
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--t); }
tbody tr:hover td { background: var(--light); }
.td-muted { color: var(--text-muted); font-size: 12px; }

/* ══════════════════════════════════════════════════
   SPINNER / STATES
   ══════════════════════════════════════════════════ */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--text-muted);
  gap: 12px;
  text-align: center;
}
.empty-state-icon {
  width: 56px; height: 56px;
  background: var(--light);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
}
.empty-state p { font-size: 14px; max-width: 280px; }

/* ══════════════════════════════════════════════════
   ALERT
   ══════════════════════════════════════════════════ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}
.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(192,57,43,.2);
}
.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(26,127,75,.2);
}

/* ══════════════════════════════════════════════════
   MODAL / DRAWER
   ══════════════════════════════════════════════════ */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6,24,86,.45);
  z-index: 200;
  backdrop-filter: blur(2px);
}
.overlay.is-open { display: flex; }

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: 440px;
  max-width: 95vw;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  padding: 28px 28px 40px;
  animation: drawerIn .22s var(--ease);
  z-index: 201;
}
@keyframes drawerIn {
  from { transform: translateX(32px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%;
  max-width: 400px;
  margin: auto;
  animation: modalIn .2s var(--ease);
}
@keyframes modalIn {
  from { transform: scale(.96); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ══════════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════════ */
.flex   { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.mb-1   { margin-bottom: 4px; }
.mb-2   { margin-bottom: 8px; }
.mb-3   { margin-bottom: 12px; }
.mb-4   { margin-bottom: 16px; }
.mb-6   { margin-bottom: 24px; }
.mb-8   { margin-bottom: 32px; }
.mt-4   { margin-top: 16px; }
.mt-6   { margin-top: 24px; }
.text-sm   { font-size: 13px; }
.text-xs   { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }

/* ══════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .site-header { padding: 0 20px; }
  .page-main   { padding: 28px 20px; }
  .site-footer { padding: 0 20px; }
  .header-brand-sub { display: none; }
}
