/* Panel administrativo */
:root { --blue: #0b63b6; --blue-deep: #083f78; --ink: #12263d; --text: #2a3a4c; --muted: #66768a; --line: #dde5ee; --bg: #f3f6fa; --sun: #f6c51b; --green: #2c6612; --red: #b3261e; }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--blue); }
h1, h2 { color: var(--ink); line-height: 1.2; margin: 0 0 .8rem; }
h2 { font-size: 1.1rem; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .6rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 14px; line-height: 1.2; font-weight: 600; font-family: inherit; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-deep); color: #fff; }
.btn-wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn-wa:hover { background: #1eb457; color: #fff; }
.btn-block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; text-decoration: underline; }
.danger { color: var(--red) !important; }

/* Login / instalación */
.auth { min-height: 100vh; display: grid; place-items: center; background: var(--blue); padding: 1rem; }
.auth-card { background: #fff; width: min(420px, 100%); padding: 2.2rem; border-radius: 18px; box-shadow: 0 30px 60px rgba(0,0,0,.25); }
.auth-card img { margin-bottom: 1rem; }
.auth-card h1 { font-size: 1.5rem; }

/* Estructura */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #c8d6e6; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side-brand { display: flex; align-items: center; gap: .7rem; padding: 1.2rem 1.2rem 1.4rem; color: #fff; text-decoration: none; font-weight: 700; line-height: 1.15; }
.side-brand small { display: block; font-weight: 400; color: #8fa6bf; font-size: .78rem; }
.side nav { display: flex; flex-direction: column; padding: 0 .6rem; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: .6rem; padding: .62rem .8rem; border-radius: 8px; color: #c8d6e6; text-decoration: none; }
.side nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side nav a[aria-current="page"] { background: var(--blue); color: #fff; }
.ico { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .5; }
.badge { margin-left: auto; background: var(--sun); color: var(--ink); font-size: .75rem; font-weight: 700; padding: 0 .45rem; border-radius: 999px; }
.side-foot { margin-top: auto; padding: 1rem 1.4rem 1.4rem; display: flex; flex-direction: column; gap: .4rem; font-size: .9rem; border-top: 1px solid rgba(255,255,255,.08); }
.side-foot a { color: #9fb4cb; text-decoration: none; }
.side-foot a:hover { color: #fff; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 2rem; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 1.3rem; margin: 0; }
.who { margin-left: auto; color: var(--muted); font-size: .9rem; }
.side-toggle { display: none; }
.content { padding: 1.8rem 2rem 3rem; max-width: 1200px; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .side-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .side-toggle { display: inline-flex; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .45rem .8rem; font: inherit; font-weight: 600; cursor: pointer; }
  .topbar { padding: .8rem 1rem; } .content { padding: 1.2rem 1rem 3rem; } .who { display: none; }
}

/* Componentes */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.4rem 1.5rem; margin-bottom: 1.5rem; }
.narrow { max-width: 760px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; text-decoration: none; color: var(--muted); }
.stat strong { display: block; font-size: 2rem; color: var(--ink); line-height: 1.1; }
.stat:hover { border-color: var(--blue); }
@media (max-width: 800px) { .stats { grid-template-columns: 1fr 1fr; } }
.quick { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.5rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.search { display: flex; gap: .4rem; }
.search input { padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; min-width: 220px; }
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; }
.tabs a { padding: .5rem .85rem; border-radius: 8px; text-decoration: none; color: var(--text); background: #fff; border: 1px solid var(--line); font-weight: 500; }
.tabs a[aria-current="page"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.table td { padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table a { text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table .thumb { width: 64px; } .thumb img { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; }
.table tr.past td { color: var(--muted); }
.panel:has(> .table) { overflow-x: auto; }
.actions { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; }
.actions form { display: inline; margin: 0; }
td.actions { white-space: nowrap; }

.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px; background: #eef1f5; color: var(--muted); }
.pill-nueva { background: #fff3c4; color: #7a5b00; }
.pill-contactada { background: #e1efff; color: #0b4f99; }
.pill-inscrita { background: #ece4ff; color: #4b2aa3; }
.pill-matriculada { background: #e0f4d6; color: var(--green); }
.pill-descartada { background: #f6e3e3; color: #8a2a2a; }
.pill-star { background: var(--sun); color: var(--ink); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border: 0; }
.list a { text-decoration: none; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li.unread a strong::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--blue); border-radius: 50%; margin-right: .45rem; vertical-align: middle; }
.details { display: grid; grid-template-columns: 170px 1fr; gap: .55rem 1rem; margin: 0 0 1rem; }
.details dt { color: var(--muted); font-weight: 600; font-size: .9rem; }
.details dd { margin: 0; }
@media (max-width: 600px) { .details { grid-template-columns: 1fr; } .details dd { margin-bottom: .6rem; } }
.message { background: var(--bg); border-radius: 10px; padding: 1.2rem; white-space: normal; }

/* Formularios */
.form { display: grid; gap: 1rem; }
.form label, .form .label { display: grid; gap: .35rem; font-weight: 600; color: var(--ink); font-size: .92rem; }
.form .label { display: block; }
.form input:not([type=checkbox]):not([type=file]), .form select, .form textarea { width: 100%; padding: .65rem .8rem; border: 1px solid #c9d5e2; border-radius: 8px; font-size: 15px; line-height: 1.45; font-weight: 400; font-family: inherit; color: var(--ink); background: #fff; }
.form textarea { resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(11,99,182,.15); }
.form label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.form label.check input { width: 18px; height: 18px; }
.input-lg { font-size: 1.2rem !important; font-weight: 600 !important; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .row { grid-template-columns: 1fr; } }
.hint { margin: -.6rem 0 0; font-size: .82rem; color: var(--muted); }
.money { display: flex; align-items: center; border: 1px solid #c9d5e2; border-radius: 8px; overflow: hidden; background: #fff; }
.money span { padding: 0 .7rem; color: var(--muted); font-weight: 600; }
.money input { border: 0 !important; box-shadow: none !important; padding-left: 0 !important; }
.editor-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.5rem; align-items: start; }
.side-panel { position: sticky; top: 90px; }
@media (max-width: 1000px) { .editor-layout { grid-template-columns: 1fr; } .side-panel { position: static; } }
#editor { min-height: 360px; font-size: 16px; background: #fff; }
.ql-toolbar.ql-snow, .ql-container.ql-snow { border-color: #c9d5e2 !important; }
.ql-toolbar.ql-snow { border-radius: 8px 8px 0 0; }
.ql-container.ql-snow { border-radius: 0 0 8px 8px; }
.preview img { border-radius: 8px; max-height: 180px; object-fit: cover; width: 100%; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; margin-top: .6rem; }
.preview-grid img { height: 80px; }
.dropzone { border: 2px dashed #c9d5e2; border-radius: 10px; padding: 1rem; background: var(--bg); }
.photo-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; }
.photo-admin figure { margin: 0; }
.photo-admin img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; }
.photo-admin figcaption { display: flex; justify-content: space-between; gap: .5rem; font-size: .85rem; margin-top: .4rem; }
.album-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.2rem; }
.album-admin .panel { padding: .9rem; margin: 0; }
.album-cover { display: block; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; background: var(--bg); margin-bottom: .8rem; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-admin h2 { font-size: 1rem; margin-bottom: .2rem; }
.album-admin h2 a { text-decoration: none; color: var(--ink); }

.alert { padding: .85rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-ok { background: #e3f5d6; color: #22520e; }
.alert-error { background: #fde4e1; color: #8a1f12; }

.plain-editor { border: 1px solid #c9d5e2; border-radius: 8px; padding: 1rem; }
