:root {
    --primary: #123c69;
    --primary-dark: #0a2949;
    --accent: #d9a441;
    --bg: #eef3f8;
    --text: #1e293b;
    --muted: #64748b;
    --border: #d8e0ea;
    --success-bg: #e8f7ef;
    --success-text: #12613a;
    --error-bg: #fff1f1;
    --error-text: #a11f1f;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top left, #ffffff 0, var(--bg) 45%, #dfe9f4 100%);
}

.page {
    width: min(980px, calc(100% - 28px));
    margin: 38px auto 24px;
}

.card {
    background: rgba(255,255,255,.96);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 22px 55px rgba(15, 43, 71, .16);
    overflow: hidden;
}

.header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 30px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-bottom: 5px solid var(--accent);
}

.logo {
    width: 94px;
    height: 94px;
    object-fit: contain;
    background: #fff;
    padding: 8px;
    border-radius: 18px;
    box-shadow: 0 10px 28px rgba(0,0,0,.22);
}

.eyebrow {
    margin: 0 0 6px;
    color: #f4d188;
    text-transform: uppercase;
    font-size: .82rem;
    letter-spacing: .12em;
    font-weight: 700;
}

h1 {
    margin: 0;
    font-size: clamp(1.65rem, 3vw, 2.45rem);
    line-height: 1.15;
}

.subtitle {
    margin: 10px 0 0;
    color: #dbe8f6;
}

form { padding: 30px; }

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

label {
    display: grid;
    gap: 8px;
    font-weight: 700;
    color: #24364a;
}

.full { grid-column: 1 / -1; }

input, select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 13px 14px;
    font: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color .2s, box-shadow .2s, transform .2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(18, 60, 105, .13);
}

.notice {
    margin: 24px 30px 0;
    padding: 16px 18px;
    border-radius: 14px;
    line-height: 1.45;
}

.notice ul { margin: 8px 0 0; }
.notice.success { background: var(--success-bg); color: var(--success-text); border: 1px solid #b7e7cb; }
.notice.error { background: var(--error-bg); color: var(--error-text); border: 1px solid #ffc9c9; }
.client-error { margin-top: 16px; color: var(--error-text); font-weight: 700; }

.actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 26px;
}

button {
    border: 0;
    border-radius: 999px;
    padding: 13px 24px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 12px 26px rgba(18, 60, 105, .22);
}

button:hover { transform: translateY(-1px); }
button.secondary { background: #e7edf4; color: var(--primary-dark); box-shadow: none; }

footer {
    text-align: center;
    color: var(--muted);
    font-weight: 700;
    padding: 18px 0 32px;
}

@media (max-width: 720px) {
    .header { align-items: flex-start; flex-direction: column; }
    .grid { grid-template-columns: 1fr; }
    .actions { flex-direction: column; }
    button { width: 100%; }
}

.header-content { flex: 1; min-width: 0; }

.admin-button {
    align-self: flex-start;
    white-space: nowrap;
    text-decoration: none;
    color: var(--primary-dark);
    background: #fff;
    border: 1px solid rgba(255,255,255,.65);
    border-radius: 999px;
    padding: 11px 18px;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(0,0,0,.18);
    transition: transform .2s, box-shadow .2s;
}

.admin-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(0,0,0,.22);
}

.wide-page { width: min(1280px, calc(100% - 28px)); }

.admin-login,
.admin-panel { padding: 30px; }

.admin-login h2,
.admin-panel h2 {
    margin: 0 0 8px;
    color: var(--primary-dark);
}

.form-help {
    margin: 0 0 20px;
    color: var(--muted);
    font-weight: 600;
}

.login-notice { margin: 18px 0; }
.notice.info { background: #eef6ff; color: #17436b; border: 1px solid #c7def5; }

.admin-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.logout-link,
.secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 800;
}

.logout-link { background: #fff1f1; color: var(--error-text); border: 1px solid #ffc9c9; }
.secondary-link { background: #e7edf4; color: var(--primary-dark); }

.filter-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
    padding: 18px;
    margin-bottom: 22px;
    background: #f7fafc;
    border: 1px solid var(--border);
    border-radius: 18px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-actions button { width: auto; padding-inline: 20px; }

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1080px;
    font-size: .94rem;
}

.log-table th,
.log-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.log-table th {
    color: #fff;
    background: var(--primary);
    position: sticky;
    top: 0;
}

.log-table tbody tr:nth-child(even) { background: #f8fbff; }
.log-table tbody tr:hover { background: #fff8e8; }
.log-table a { color: var(--primary); font-weight: 700; }

@media (max-width: 900px) {
    .filter-form { grid-template-columns: 1fr; }
    .filter-actions { flex-direction: column; align-items: stretch; }
    .filter-actions button, .secondary-link { width: 100%; }
}

@media (max-width: 720px) {
    .admin-button { align-self: stretch; text-align: center; }
    .admin-toolbar { flex-direction: column; }
    .logout-link { width: 100%; }
}


.admin-notice { margin: 0 0 18px; }
.status-filter-form { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.status-table { min-width: 1480px; }
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-weight: 900;
    font-size: .82rem;
    border: 1px solid var(--border);
    white-space: nowrap;
}
.status-pendiente { background: #fff8e8; color: #8a5a00; border-color: #f2d69a; }
.status-cursada { background: #eef6ff; color: #17436b; border-color: #c7def5; }
.status-finalizada { background: var(--success-bg); color: var(--success-text); border-color: #b7e7cb; }
.status-actions { display: flex; flex-direction: column; gap: 8px; min-width: 150px; }
.inline-form { padding: 0; margin: 0; }
.small-button {
    width: 100%;
    border-radius: 10px;
    padding: 9px 11px;
    font-size: .84rem;
    box-shadow: none;
}
.final-button { background: linear-gradient(135deg, #12613a, #0d4a2c); }

@media (max-width: 1100px) {
    .status-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .status-filter-form { grid-template-columns: 1fr; }
}

.admin-toolbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.download-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, #12613a, #0d4a2c);
    border: 1px solid #0d4a2c;
    box-shadow: 0 8px 18px rgba(13, 74, 44, .18);
}

.export-help {
    margin: -8px 0 18px;
    color: var(--muted);
    font-size: .94rem;
}

@media (max-width: 720px) {
    .admin-toolbar-actions { width: 100%; flex-direction: column; align-items: stretch; }
    .download-link { width: 100%; }
}
