/* =============================================================
   Historia Clinica Ginecologica - Sistema visual
   Paleta: rosa institucional / blanco / gris claro
   ============================================================= */

:root {
  --primary: #C2185B;
  --primary-dark: #9C1350;
  --primary-rgb: 194, 24, 91;
  --primary-soft: #FCE4EC;
  --primary-softer: #FDF1F5;
  --primary-contrast: #ffffff;

  --bg: #F5F6F8;
  --surface: #ffffff;
  --surface-2: #FAFAFB;
  --border: #E9EAEE;
  --border-strong: #DCDEE4;

  --text: #23262B;
  --text-2: #4B5058;
  --muted: #868C96;

  --success: #1E8E3E;
  --success-soft: #E6F4EA;
  --warning: #B26A00;
  --warning-soft: #FEF3E2;
  --danger: #C5221F;
  --danger-soft: #FCE8E6;
  --info: #1A73E8;
  --info-soft: #E8F0FE;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);

  --sidebar-w: 256px;
  --topbar-h: 66px;
  --font: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }

/* ============================ LAYOUT ============================ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .02em;
  overflow: hidden;
  flex: 0 0 auto;
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }

.brand-text { min-width: 0; }
.brand-text strong {
  display: block;
  font-size: 14.5px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-weight: 700;
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 3px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav-item.active {
  background: rgba(var(--primary-rgb), .10);
  color: var(--primary);
  font-weight: 600;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; }

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(var(--primary-rgb), .12);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex: 0 0 auto;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who strong {
  display: block; font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-foot .who span { font-size: 11.5px; color: var(--muted); }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar h2 { font-size: 17px; }
.topbar .sub { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.topbar-spacer { flex: 1; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 16px;
  width: 300px;
  transition: border-color .15s, background .15s;
}
.search-box:focus-within { background: #fff; border-color: rgba(var(--primary-rgb), .45); }
.search-box input {
  border: 0; background: transparent; outline: none;
  font-family: inherit; font-size: 13.5px; width: 100%; color: var(--text);
}
.search-box svg { width: 16px; height: 16px; color: var(--muted); flex: 0 0 auto; }

.content { padding: 26px; max-width: 1360px; width: 100%; margin: 0 auto; flex: 1; }

.menu-toggle {
  display: none;
  background: none; border: 1px solid var(--border);
  border-radius: 10px; width: 38px; height: 38px;
  cursor: pointer; color: var(--text); align-items: center; justify-content: center;
}

/* ============================ CABECERA DE PAGINA ============================ */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 23px; }
.page-head .desc { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================ TARJETAS ============================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-head h3 { font-size: 15px; }
.card-head .hint { font-size: 12.5px; color: var(--muted); }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Rejillas asimetricas que se apilan en pantallas pequenas */
.grid-split { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; }
.grid-calendario { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); align-items: start; }
.grid-perfil { grid-template-columns: 180px minmax(0, 1fr); align-items: start; }

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.kpi .ico {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; flex: 0 0 auto;
  background: rgba(var(--primary-rgb), .10); color: var(--primary);
}
.kpi .ico svg { width: 20px; height: 20px; }
.kpi .ico.green { background: var(--success-soft); color: var(--success); }
.kpi .ico.amber { background: var(--warning-soft); color: var(--warning); }
.kpi .ico.blue  { background: var(--info-soft); color: var(--info); }
.kpi .num { font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.kpi .lbl { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ============================ BOTONES ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(var(--primary-rgb), .35);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); color: #fff; }

.btn-ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-2);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

.btn-soft {
  background: rgba(var(--primary-rgb), .10);
  color: var(--primary);
}
.btn-soft:hover:not(:disabled) { background: rgba(var(--primary-rgb), .18); color: var(--primary); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.94); color: #fff; }

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 14.5px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 34px; height: 34px; }

/* ============================ FORMULARIOS ============================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 16px;
}
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field.span-3 { grid-column: span 3; }
.field.span-4 { grid-column: span 4; }

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.field label .req { color: var(--primary); }

.input, .select, .textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 9px 12px;
  outline: none;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(var(--primary-rgb), .65);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .13);
}
.input::placeholder, .textarea::placeholder { color: #A9AEB6; }
.textarea { min-height: 84px; resize: vertical; line-height: 1.55; }
.textarea.tall { min-height: 110px; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23868C96' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 15px; padding-right: 34px; }
.input[readonly] { background: var(--surface-2); color: var(--text-2); }

.field-hint { font-size: 11.5px; color: var(--muted); }

/* Casillas */
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 8px 13px;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
  transition: all .15s;
  color: var(--text-2);
}
.check:hover { border-color: rgba(var(--primary-rgb), .5); }
.check input { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; cursor: pointer; }
.check.on {
  background: rgba(var(--primary-rgb), .09);
  border-color: rgba(var(--primary-rgb), .55);
  color: var(--primary);
  font-weight: 600;
}

/* ============================ SECCIONES COLAPSABLES ============================ */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.section-head {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(var(--primary-rgb), .12), rgba(var(--primary-rgb), .05));
  border-bottom: 1px solid transparent;
  cursor: pointer;
  user-select: none;
}
.section.collapsed .section-head { border-bottom-color: transparent; }
.section:not(.collapsed) .section-head { border-bottom-color: var(--border); }
.section-head:hover { background: linear-gradient(135deg, rgba(var(--primary-rgb), .17), rgba(var(--primary-rgb), .08)); }

.section-num {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.section-head h3 { font-size: 15px; color: var(--primary-dark); flex: 1; }
.section-head .toggle {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  color: var(--primary);
  transition: transform .2s;
}
.section.collapsed .section-head .toggle { transform: rotate(-90deg); }
.section-body { padding: 20px 18px; }
.section.collapsed .section-body { display: none; }

/* ============================ TABLAS ============================ */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 700;
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--primary-softer); }
.table tbody tr.clickable { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-empty {
  text-align: center;
  padding: 42px 20px;
  color: var(--muted);
}
.table-empty strong { display: block; color: var(--text-2); margin-bottom: 4px; font-size: 15px; }

/* ============================ BADGES ============================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--bg);
  color: var(--text-2);
}
.badge::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  opacity: .85;
}
.badge.no-dot::before { display: none; }
.badge.rosa { background: var(--primary-soft); color: var(--primary); }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.amber { background: var(--warning-soft); color: var(--warning); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.blue { background: var(--info-soft); color: var(--info); }
.badge.gray { background: #EEF0F3; color: var(--text-2); }

/* ============================ LISTAS ============================ */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: var(--primary-softer); }
.list-item .when {
  font-size: 12px;
  color: var(--muted);
  min-width: 74px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow strong { display: block; font-size: 14px; font-weight: 600; }
.list-item .grow span { font-size: 12.5px; color: var(--muted); }

/* ============================ TIMELINE ============================ */
.timeline { position: relative; padding-left: 6px; }
.timeline-item {
  position: relative;
  padding: 0 0 22px 30px;
  border-left: 2px solid var(--border);
  margin-left: 8px;
}
.timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -8px; top: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--primary);
}
.timeline-item.actual::before { background: var(--primary); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .18); }
.timeline-item .t-date { font-size: 12px; color: var(--muted); font-weight: 600; }
.timeline-item .t-title { font-size: 14.5px; font-weight: 700; margin: 2px 0 4px; }
.timeline-item .t-body { font-size: 13px; color: var(--text-2); }
.timeline-item .t-actions { margin-top: 8px; display: flex; gap: 8px; }

/* ============================ IMAGENES ============================ */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 26px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), .05);
}
.dropzone strong { display: block; font-size: 14.5px; margin-bottom: 3px; }
.dropzone span { font-size: 12.5px; color: var(--muted); }
.dropzone svg { width: 30px; height: 30px; color: var(--primary); margin-bottom: 8px; }

.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.img-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.img-thumb {
  height: 148px;
  background: #F1F2F5;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.img-thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.img-thumb .pdf-tag {
  font-size: 12px; font-weight: 700; color: var(--danger);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.img-meta { padding: 11px 12px; display: flex; flex-direction: column; gap: 8px; }
.img-meta .input { padding: 6px 9px; font-size: 12.5px; }
.img-meta .row { display: flex; gap: 8px; }
.img-meta .row .input { min-width: 0; }

/* ============================ MODAL / TOAST ============================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 28, .55);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: modalIn .18s ease;
}
.modal.wide { max-width: 760px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 { font-size: 16.5px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  padding: 15px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-close {
  background: none; border: 0; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px;
  color: var(--muted); display: grid; place-items: center;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

#toasts {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 500;
}
.toast {
  background: #23262B;
  color: #fff;
  padding: 12px 16px;
  border-radius: 11px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 380px;
  animation: toastIn .2s ease;
}
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ============================ VACIO / CARGA ============================ */
.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--muted);
}
.empty .icon {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid; place-items: center;
}
.empty .icon svg { width: 26px; height: 26px; }
.empty strong { display: block; color: var(--text); font-size: 15.5px; margin-bottom: 4px; }

.loading {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 60px 0; color: var(--muted); font-size: 14px;
}
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(var(--primary-rgb), .25);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ CALENDARIO ============================ */
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.cal-title { font-size: 18px; font-weight: 700; text-transform: capitalize; }
.cal-nav { display: flex; gap: 6px; align-items: center; }

.cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-dow {
  background: var(--surface-2);
  padding: 9px 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.cal-day {
  background: #fff;
  min-height: 104px;
  padding: 7px;
  cursor: pointer;
  transition: background .12s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-day:hover { background: var(--primary-softer); }
.cal-day.out { background: #FBFBFC; color: #B9BDC4; }
.cal-day.sel { background: rgba(var(--primary-rgb), .10); box-shadow: inset 0 0 0 2px var(--primary); }
.cal-day.today .d-num { background: var(--primary); color: #fff; }
.d-num {
  width: 23px; height: 23px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  align-self: flex-start;
}
.cal-ev {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-ev.green { background: var(--success-soft); color: var(--success); }
.cal-ev.gray { background: #EEF0F3; color: var(--muted); text-decoration: line-through; }
.cal-more { font-size: 10.5px; color: var(--muted); font-weight: 600; padding-left: 4px; }

.cal.week .cal-day { min-height: 150px; }

/* ============================ LOGIN ============================ */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.login-hero {
  background:
    radial-gradient(1000px 500px at 10% 10%, rgba(255,255,255,.16), transparent 60%),
    linear-gradient(150deg, var(--primary) 0%, var(--primary-dark) 62%, #6D0E3A 100%);
  color: #fff;
  padding: 54px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-hero::after {
  content: '';
  position: absolute;
  right: -110px; bottom: -110px;
  width: 340px; height: 340px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .09);
}
.login-hero .brand { display: flex; align-items: center; gap: 13px; font-weight: 700; font-size: 17px; }
.login-hero .brand .brand-logo { background: rgba(255,255,255,.2); }
.login-hero h1 { font-size: 36px; line-height: 1.15; max-width: 460px; }
.login-hero p { font-size: 15px; opacity: .88; max-width: 440px; line-height: 1.65; }
.login-hero .feats { display: flex; flex-direction: column; gap: 11px; font-size: 14px; }
.login-hero .feats div { display: flex; gap: 10px; align-items: center; opacity: .93; }
.login-hero .feats svg { width: 17px; height: 17px; flex: 0 0 auto; }
.login-hero .foot { font-size: 12.5px; opacity: .7; }

.login-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg);
}
.login-card { width: 100%; max-width: 392px; }
.login-card h2 { font-size: 25px; margin-bottom: 5px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.login-card .field { margin-bottom: 15px; }
.login-card .input { padding: 12px 14px; font-size: 14.5px; }
.login-note {
  margin-top: 18px;
  background: var(--primary-softer);
  border: 1px solid rgba(var(--primary-rgb), .2);
  border-radius: 11px;
  padding: 13px 15px;
  font-size: 12.5px;
  color: var(--text-2);
}
.login-note strong { display: block; color: var(--primary-dark); margin-bottom: 5px; font-size: 12.5px; }
.login-note code {
  background: #fff; border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 5px; font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.login-note .row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }

/* ============================ UTILIDADES ============================ */
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.wrap { flex-wrap: wrap; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-14 { gap: 14px; }
.mt-8 { margin-top: 8px; } .mt-14 { margin-top: 14px; } .mt-20 { margin-top: 20px; }
.mb-0 { margin-bottom: 0 !important; } .mb-14 { margin-bottom: 14px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12.5px; }
.text-right { text-align: right; }
.bold { font-weight: 700; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.scroll-x { overflow-x: auto; }

.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 20px; }
.dl .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.dl .v { font-size: 14.5px; font-weight: 600; margin-top: 2px; }

.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 16px; }
.pagination button {
  min-width: 32px; height: 32px;
  border-radius: 8px; border: 1px solid var(--border-strong);
  background: #fff; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 600; color: var(--text-2);
}
.pagination button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination button:disabled { opacity: .45; cursor: default; }

.tip { position: relative; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 1180px) {
  .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .search-box { width: 190px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .grid-split, .grid-calendario, .grid-perfil { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .content { padding: 16px; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-2 { grid-template-columns: 1fr; }
  .field.span-2, .field.span-3, .field.span-4 { grid-column: span 1; }
  .grid-4 { grid-template-columns: 1fr; }
  .grid-split, .grid-calendario, .grid-perfil { grid-template-columns: minmax(0, 1fr); }
  .topbar { padding: 0 14px; gap: 10px; }
  .search-box { width: 140px; }
  .cal-day { min-height: 76px; }
}

.scrim {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 55; display: none;
}
.scrim.open { display: block; }

/* ============================ IMPRESION ============================ */
@media print {
  .sidebar, .topbar, .scrim, .page-actions, .pagination, #toasts,
  .cal-head, .menu-toggle, .no-print { display: none !important; }
  .main { margin-left: 0 !important; }
  body { background: #fff; }
  .content { padding: 0 !important; max-width: none; }
  .card, .section, .kpi {
    box-shadow: none !important;
    border-color: #DDDFE4 !important;
    break-inside: avoid;
  }
  .section.collapsed .section-body { display: block !important; }
  .section-head {
    background: #FBEFF3 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .badge, .cal-ev, .section-num {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  a[href]::after { content: ''; }
}
