@import url(https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Outfit:wght@700;800;900&display=swap);

:root {
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --teal-light: #14b8a6;
  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --white: #f8fafc;
  --danger: #ef4444;
  --success: #22c55e;
  --touch: 44px;
  --radius: 14px;
  --shadow: 0 20px 50px rgba(0,0,0,.45);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.app-body {
  margin: 0;
  min-height: 100vh;
  font-family: Manrope, system-ui, sans-serif;
  background: var(--slate-900);
  color: var(--slate-200);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand-title {
  font-family: Outfit, Manrope, sans-serif;
  letter-spacing: .02em;
}

/* LOGIN */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(13,148,136,.25), transparent),
    var(--slate-900);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(30,41,59,.92);
  border: 1px solid var(--slate-700);
  border-radius: calc(var(--radius) + 4px);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 24px rgba(13,148,136,.35);
}

.login-title {
  text-align: center;
  color: var(--white);
  font-size: 1.65rem;
  font-weight: 800;
  margin: 0 0 .25rem;
}

.login-subtitle {
  text-align: center;
  color: var(--slate-400);
  font-size: .9rem;
  margin-bottom: .35rem;
}

.login-date {
  text-align: center;
  color: var(--teal-light);
  font-size: .8rem;
  font-weight: 600;
  margin-bottom: 1.75rem;
}

/* HEADER */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,23,42,.95);
  border-bottom: 2px solid var(--teal);
  backdrop-filter: blur(10px);
  padding: .65rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: var(--white);
}

.app-header .brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.app-header .brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--teal-light);
}

.app-header .brand-sub {
  font-size: .7rem;
  color: var(--slate-400);
  display: block;
  line-height: 1.2;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.user-chip {
  background: var(--slate-800);
  border: 1px solid var(--slate-700);
  border-radius: 999px;
  padding: .35rem .85rem;
  font-size: .8rem;
  color: var(--slate-400);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: var(--touch);
  padding: .55rem 1.1rem;
  border-radius: 10px;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform .15s, background .15s, box-shadow .15s;
}

.btn:active { transform: scale(.98); }

.btn-teal {
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(13,148,136,.35);
}

.btn-teal:hover { background: linear-gradient(135deg, var(--teal-light), var(--teal)); color: #fff; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--slate-700);
  color: var(--slate-400);
}

.btn-outline:hover { border-color: var(--teal); color: var(--teal-light); }

.btn-outline-teal {
  background: transparent;
  border: 1px solid var(--teal);
  color: var(--teal-light);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid #991b1b;
  color: #f87171;
  min-height: 36px;
  padding: .3rem .75rem;
  font-size: .8rem;
}

.btn-sm { min-height: 38px; padding: .35rem .85rem; font-size: .82rem; }

/* FORMS */
.form-label {
  display: block;
  color: var(--slate-400);
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: .35rem;
}

.form-control, .form-select {
  width: 100%;
  min-height: var(--touch);
  padding: .6rem .85rem;
  background: var(--slate-900);
  border: 1px solid var(--slate-700);
  border-radius: 10px;
  color: var(--slate-200);
  font-family: inherit;
  font-size: .95rem;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,148,136,.25);
}

textarea.form-control { min-height: 140px; resize: vertical; line-height: 1.5; }

.required-star { color: #f87171; }

/* CARDS */
.app-container { padding: 1rem; max-width: 1400px; margin: 0 auto; }

.card {
  background: var(--slate-800);
  border: 1px solid var(--slate-700);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  background: var(--slate-900);
  border-bottom: 1px solid var(--slate-700);
  padding: .85rem 1rem;
  color: var(--teal-light);
  font-weight: 700;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.card-body { padding: 1rem; }

/* STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: 1rem;
}

@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
}

.stat-card.purple { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.stat-card.blue { background: linear-gradient(135deg, #1d4ed8, #1e40af); }
.stat-card.cyan { background: linear-gradient(135deg, #0369a1, #0c4a6e); }

.stat-num { font-size: 1.85rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .78rem; opacity: .9; margin-top: .25rem; }

/* FILTERS */
.filters-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .65rem;
}

@media (min-width: 576px) { .filters-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px) { .filters-grid { grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto auto; align-items: end; } }

.filter-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* TABLE */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

.data-table thead th {
  background: var(--slate-950);
  color: var(--slate-400);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .75rem .65rem;
  text-align: left;
  border-bottom: 1px solid var(--slate-700);
  white-space: nowrap;
}

.data-table tbody tr:nth-child(even) { background: rgba(15,23,42,.55); }
.data-table tbody tr:nth-child(odd) { background: rgba(30,41,59,.35); }
.data-table tbody tr:hover { background: rgba(13,148,136,.1); }

.data-table td {
  padding: .7rem .65rem;
  border-bottom: 1px solid var(--slate-700);
  vertical-align: middle;
}

.novedades-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* BADGES */
.badge {
  display: inline-block;
  padding: .25rem .55rem;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.badge-emergencia { background: #991b1b; color: #fecaca; }
.badge-observacion { background: #1d4ed8; color: #bfdbfe; }
.badge-hospitalizacion { background: #166534; color: #bbf7d0; }
.badge-cirugia { background: #7c2d12; color: #fed7aa; }
.badge-ginecologia { background: #86198f; color: #f5d0fe; }
.badge-maternidad { background: #be185d; color: #fbcfe8; }
.badge-uci { background: #b45309; color: #fde68a; }
.badge-ucin { background: #92400e; color: #fde68a; }
.badge-neonatologia { background: #0891b2; color: #cffafe; }
.badge-consulta { background: #475569; color: #e2e8f0; }
.badge-default { background: #334155; color: #cbd5e1; }

.badge-tipo {
  background: rgba(124,58,237,.25);
  border: 1px solid rgba(124,58,237,.5);
  color: #ddd6fe;
  text-transform: none;
  font-weight: 600;
}

/* FORM LAYOUT */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) { .form-grid-2 { grid-template-columns: 1fr 1fr; } }

.form-section {
  margin-bottom: 1.5rem;
}

.section-title {
  color: var(--teal-light);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 800;
  border-bottom: 1px solid var(--slate-700);
  padding-bottom: .4rem;
  margin-bottom: 1rem;
}

.form-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  padding-top: .5rem;
}

.form-actions .btn-teal { flex: 1; min-width: 160px; }

.form-max { max-width: 900px; margin: 0 auto; }

/* ALERTS */
.alert {
  border-radius: 10px;
  padding: .75rem 1rem;
  font-size: .88rem;
  margin-bottom: 1rem;
}

.alert-danger { background: #450a0a; border: 1px solid #991b1b; color: #fca5a5; }
.alert-success { background: #052e16; border: 1px solid #166534; color: #86efac; }

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--slate-500);
}

.text-muted { color: var(--slate-500); }
.text-nowrap { white-space: nowrap; }

/* REPORT DATA CARD + EXPORT BAR */
.card-report-data {
  margin-bottom: 1rem;
  border: 2px solid var(--teal);
  box-shadow: 0 0 0 1px rgba(13,148,136,.15), 0 8px 24px rgba(13,148,136,.12);
}

.card-header-teal {
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: .02em;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.card-header-icon { font-size: 1.2rem; }

.report-help {
  color: var(--slate-300);
  font-size: .9rem;
  margin: 0 0 1rem;
}

.report-main-grid,
.resp-area-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .85rem;
}

@media (min-width: 768px) {
  .report-main-grid { grid-template-columns: 1fr 1fr; }
  .resp-area-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1100px) {
  .resp-area-grid { grid-template-columns: repeat(3, 1fr); }
}

.report-full { grid-column: 1 / -1; }

.form-control-highlight {
  border-color: rgba(13,148,136,.55);
  background: rgba(13,148,136,.06);
}

.filter-full { grid-column: 1 / -1; }

.export-bar {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--slate-700);
}

.export-bar-title {
  margin: 0 0 .85rem;
  font-weight: 700;
  color: var(--teal-light);
  font-size: .95rem;
}

.export-bar-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.btn-export-lg {
  min-height: 48px;
  padding: .75rem 1.35rem;
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: .02em;
  flex: 1 1 180px;
  justify-content: center;
  text-align: center;
}
