/* ---------- Sistema de Registro de Atenciones de Enfermería ---------- */
:root {
  --c-bg: #f4f6fa;
  --c-card: #ffffff;
  --c-text: #1a2233;
  --c-muted: #6b7686;
  --c-border: #e3e7ee;
  --c-primary: #0c6cf2;
  --c-primary-dark: #084fb3;
  --c-accent: #00875a;
  --c-danger: #d23030;
  --c-warn: #c47b00;
  --c-ok-bg: #e8f5ee;
  --c-ok-text: #135736;
  --c-err-bg: #fdebea;
  --c-err-text: #8a1c1c;
  --c-warn-bg: #fff5e2;
  --c-warn-text: #7a4d00;
  --radius: 8px;
  --shadow: 0 2px 6px rgba(20,30,60,.06);
  --shadow-lg: 0 8px 24px rgba(20,30,60,.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef1f6; padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }
small { font-size: .85em; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  background: #fff;
  padding: .8rem 1.5rem;
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand strong { font-size: 1.05rem; }
.brand span { font-size: .8rem; color: var(--c-muted); }
.mainnav { display: flex; gap: .2rem; flex-wrap: wrap; flex: 1; }
.mainnav a {
  padding: .4rem .8rem; border-radius: var(--radius); color: var(--c-text);
}
.mainnav a:hover { background: #eef3fb; text-decoration: none; }
.useractions { display: flex; align-items: center; gap: .8rem; font-size: .9rem; color: var(--c-muted); }

/* Layout */
.container { max-width: 1200px; margin: 1.5rem auto; padding: 0 1.5rem; }
.footer { text-align: center; color: var(--c-muted); padding: 2rem 1rem; }

/* Cards */
.card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.card.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.card.narrow.login { margin-top: 4rem; }
.card h1, .card h2 { margin-top: 0; }

/* Headings */
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.2rem 0 .8rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.muted { color: var(--c-muted); }
.small { font-size: .85rem; }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* Forms */
label { display: block; margin: .6rem 0; font-weight: 500; font-size: .9rem; }
label.inline { display: inline-flex; align-items: center; gap: .35rem; font-weight: 400; margin-right: 1rem; }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=time],
input[type=number], input[type=file], input:not([type]), select, textarea {
  display: block; width: 100%;
  padding: .55rem .7rem;
  margin-top: .25rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: #fff;
  font: inherit; color: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(12,108,242,.15);
}
textarea { resize: vertical; min-height: 60px; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: .6rem; align-items: center; margin-top: 1rem; flex-wrap: wrap; }
.form-inline { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; }
.form-inline label { margin: 0; }
.form-inline input, .form-inline select { width: auto; min-width: 180px; }
.checks { padding: .5rem 0; }

button, .btn-primary, .btn-sm, .btn-danger {
  display: inline-block; cursor: pointer;
  padding: .55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  background: #fff; color: var(--c-text);
  font: inherit; font-weight: 500;
  text-decoration: none;
  transition: all .15s;
}
button:hover, .btn-sm:hover { background: #eef3fb; }
.btn-primary { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); color:#fff; text-decoration:none; }
.btn-sm { padding: .35rem .65rem; font-size: .85rem; }
.btn-danger { background: var(--c-danger); color: #fff; border-color: var(--c-danger); }
.btn-danger:hover { background: #a72525; border-color: #a72525; color: #fff; }

/* Search */
.search-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .5rem 0 1rem; }
.search-form input, .search-form select { width: auto; flex: 1; min-width: 220px; margin: 0; }

/* Tables */
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td {
  text-align: left;
  padding: .55rem .6rem;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}
table.data thead { background: #f7f9fc; }
table.data th { font-size: .82rem; text-transform: uppercase; color: var(--c-muted); letter-spacing: .03em; }
table.data tbody tr:hover { background: #f9fbff; }
table.data.small th, table.data.small td { font-size: .85rem; padding: .35rem .5rem; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat {
  background: #fff; border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.stat .num { font-size: 2rem; font-weight: 700; color: var(--c-text); line-height: 1.1; }
.stat .lbl { color: var(--c-muted); font-size: .85rem; margin-top: .25rem; }
.stat.stat-accent { background: linear-gradient(135deg, #0c6cf2 0%, #084fb3 100%); border-color: transparent; }
.stat.stat-accent .num, .stat.stat-accent .lbl { color: #fff; }
.stat.stat-muted { background: #f3f5f9; }

/* Atención (en ficha del alumno) */
.atencion {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: .9rem 1.1rem; margin: 1rem 0;
  background: #fbfcfe;
}
.atencion > header {
  display: flex; gap: .6rem; flex-wrap: wrap; align-items: center;
  border-bottom: 1px dashed var(--c-border); padding-bottom: .5rem; margin-bottom: .7rem;
}
.atencion .fecha { font-weight: 600; }
.atencion .tipo { background: #e8f0fe; color: #0050b4; padding: .15rem .55rem; border-radius: 4px; font-size: .85rem; }
.atencion .por { color: var(--c-muted); font-size: .85rem; margin-left: auto; }
.atencion .acciones { margin-left: .5rem; }
.atencion dl { display: grid; grid-template-columns: 200px 1fr; gap: .35rem .8rem; margin: 0; }
.atencion dt { font-weight: 600; color: var(--c-muted); font-size: .85rem; }
.atencion dd { margin: 0; }
@media (max-width: 700px) {
  .atencion dl { grid-template-columns: 1fr; }
  .atencion dt { margin-top: .4rem; }
}

.alumno-info { background: #eef3fb; padding: .6rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; }

/* Tags & badges */
.tag {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px;
  background: #e3e9f3; color: #2a3858; font-size: .78rem; font-weight: 500;
}
.tag-warn { background: #fff0d4; color: #7a4d00; }
.badge { display: inline-block; min-width: 24px; text-align: center; padding: .15rem .45rem;
        background: #e3e9f3; color: #2a3858; border-radius: 999px; font-size: .8rem; }
.badge-on { background: var(--c-primary); color: #fff; }

/* Flash messages */
.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.flash-ok { background: var(--c-ok-bg); color: var(--c-ok-text); border: 1px solid #b9e0c8; }
.flash-err { background: var(--c-err-bg); color: var(--c-err-text); border: 1px solid #f0b8b8; }
.flash-warn { background: var(--c-warn-bg); color: var(--c-warn-text); border: 1px solid #f3d599; }
.flash-info { background: #eaf2fd; color: #1c4a8a; border: 1px solid #c0d6f1; }

/* Detalles plegables */
details > summary { cursor: pointer; padding: .35rem .65rem; border-radius: var(--radius);
                    background: #f3f5f9; display: inline-block; }
details[open] > summary { background: #eaeef5; }

/* Login centrado */
.login h1 { text-align: center; }
.login .muted { text-align: center; margin-bottom: 1.2rem; }
.login button { width: 100%; padding: .7rem; margin-top: .5rem; }

/* Form atención */
.form-atencion .grid-2 { gap: 1rem; }
