:root {
    --uts-green: #0f947e;
    --uts-green-dark: #0a6d5d;
    --uts-green-soft: #eaf7f4;
    --bg: #eef2f4;
    --text: #22313f;
    --muted: #697586;
    --card: #ffffff;
    --border: #d9e2e7;
    --danger: #b42318;
    --success: #067647;
    --shadow: 0 18px 45px rgba(15, 35, 52, 0.08);
}

* { box-sizing: border-box; }

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

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; }

img { max-width: 100%; display: block; }

.page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.public-page {
    display: block;
}

.public-content {
    min-height: 100vh;
    padding: 0;
}

/* Sidebar / internal layout */
.sidebar {
    background: #f8fbfb;
    border-right: 1px solid var(--border);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-brand {
    padding: 8px 10px 16px;
    border-bottom: 1px solid #edf2f4;
}

.sidebar-logo {
    max-width: 150px;
    margin: 0 auto;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-nav a {
    text-decoration: none;
    padding: 14px 16px;
    border-radius: 14px;
    color: #314351;
    font-weight: 600;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.sidebar-nav a:hover {
    background: var(--uts-green-soft);
    color: var(--uts-green-dark);
    transform: translateX(2px);
}

.sidebar-nav .logout-link {
    margin-top: 10px;
    border: 1px solid #f3c7c3;
    color: #c74b43;
    background: #fff7f7;
}

.content {
    padding: 32px;
}

h1, h2, h3 {
    color: #233746;
}

h1 { margin: 0 0 12px; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.card,
.panel {
    background: var(--card);
    border: 1px solid rgba(15, 148, 126, 0.10);
    border-radius: 22px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.card {
    text-decoration: none;
    color: var(--text);
}

.card p,
.panel p,
.login-card p,
.kiosk-header p,
.auth-card p,
.home-header p,
.landing-hero p {
    color: var(--muted);
    line-height: 1.5;
}

.registro-layout {
    display: grid;
    grid-template-columns: minmax(320px, 520px) minmax(320px, 1fr);
    gap: 24px;
    align-items: start;
}

.registro-layout.single {
    grid-template-columns: minmax(320px, 760px);
    justify-content: center;
}

.panel-large {
    padding: 26px;
}

.camera {
    width: 100%;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: #111827;
    min-height: 280px;
    object-fit: cover;
}

.hidden { display: none; }

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #314351;
}

input,
textarea,
select {
    width: 100%;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 16px;
    background: #fff;
    color: var(--text);
    transition: border-color .18s ease, box-shadow .18s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--uts-green);
    box-shadow: 0 0 0 4px rgba(15, 148, 126, 0.12);
    outline: none;
}

.field-group {
    margin-bottom: 16px;
}

.actions,
.toolbar,
.topbar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.toolbar {
    flex-wrap: wrap;
    margin-top: 14px;
}

.toolbar input { max-width: 420px; margin-bottom: 0; }

.btn {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(0.98);
}

.btn.primary {
    background: var(--uts-green);
    color: #fff;
    width: 100%;
    box-shadow: 0 12px 24px rgba(15, 148, 126, 0.24);
}

.btn.primary:hover { background: var(--uts-green-dark); }

.btn.secondary {
    background: var(--uts-green-soft);
    color: var(--uts-green-dark);
}

.btn.compact {
    width: auto;
    padding: 10px 14px;
}

.btn.btn-lg {
    padding: 15px 18px;
    font-size: 1rem;
}

.btn:disabled {
    opacity: .65;
    cursor: not-allowed;
    transform: none;
}

.alert {
    padding: 18px 20px;
    border-radius: 18px;
    margin-top: 18px;
}

.alert.success {
    background: #ecfdf3;
    border: 1px solid #abefc6;
    color: var(--success);
}

.alert.error {
    background: #fef3f2;
    border: 1px solid #fecdca;
    color: var(--danger);
}

.result-card p {
    margin: 10px 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    margin-top: 18px;
    box-shadow: var(--shadow);
}

.table th,
.table td {
    padding: 14px 16px;
    border-bottom: 1px solid #edf2f4;
    text-align: left;
    vertical-align: top;
}

.table th {
    background: #f5fbfa;
    color: var(--uts-green-dark);
    font-size: .95rem;
}

.table tr:hover td {
    background: #fbfdfd;
}

code {
    background: #eef7f2;
    padding: 4px 8px;
    border-radius: 8px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

.foto-evidencia {
    width: 92px;
    height: 72px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #111827;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: .85rem;
}

.badge.entrada {
    background: #ecfdf3;
    color: #067647;
}

.badge.salida {
    background: #fef3f2;
    color: #b42318;
}

.muted {
    color: var(--muted);
}

.mt-20 { margin-top: 20px; }

.helper-message {
    padding: 10px 0 2px;
}

/* Landing */
.landing-page,
.auth-page {
    position: relative;
    min-height: 100vh;
    background: url('/images/uts-campus.jpg') center center / cover no-repeat;
    overflow: hidden;
}

.landing-overlay,
.auth-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(7, 21, 30, 0.72), rgba(15, 148, 126, 0.42));
    backdrop-filter: blur(2px);
}

.landing-shell,
.auth-shell {
    position: relative;
    z-index: 1;
}

.landing-shell {
    min-height: 100vh;
    max-width: 1180px;
    margin: 0 auto;
    padding: 48px 24px 64px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.landing-hero {
    max-width: 720px;
    color: #fff;
    margin-bottom: 32px;
}

.landing-badge {
    display: inline-block;
    background: rgba(255,255,255,0.14);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.18);
    backdrop-filter: blur(8px);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: 18px;
}

.landing-logo {
    width: 240px;
    background: rgba(255,255,255,0.92);
    border-radius: 22px;
    padding: 12px 18px;
    margin-bottom: 22px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.18);
}

.landing-hero h1 {
    font-size: clamp(2.4rem, 4vw, 4rem);
    color: #fff;
    margin-bottom: 14px;
    line-height: 1.08;
}

.landing-hero p {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.88);
    max-width: 640px;
}

.access-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.access-card {
    display: block;
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 24px;
    padding: 28px;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 22px 50px rgba(0,0,0,0.14);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.access-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 26px 56px rgba(0,0,0,0.18);
    border-color: rgba(15, 148, 126, 0.5);
}

.access-card.admin:hover { border-color: rgba(109, 65, 198, 0.36); }

.access-icon {
    width: 68px;
    height: 68px;
    border-radius: 20px;
    background: #e7f2ed;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 16px;
}

.access-tag {
    color: var(--uts-green-dark);
    font-size: .84rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 10px;
}

.access-card h2 {
    margin: 0 0 12px;
}

.access-card p {
    color: var(--muted);
    min-height: 96px;
}

.access-card span {
    display: inline-block;
    margin-top: 12px;
    font-weight: 800;
    color: var(--uts-green);
}

.access-card.admin span { color: #6941c6; }

/* Auth / login */
.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 32px 20px;
}

.auth-back {
    color: #fff;
    margin-bottom: 16px;
    align-self: center;
}

.auth-card,
.login-card {
    width: 100%;
    max-width: 460px;
    background: rgba(255,255,255,0.96);
    border: 1px solid rgba(255,255,255,0.54);
    border-radius: 26px;
    padding: 28px 28px 30px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.18);
    backdrop-filter: blur(8px);
}

.auth-logo {
    max-width: 170px;
    margin: 0 auto 14px;
}

.auth-kicker {
    text-align: center;
    color: var(--uts-green);
    text-transform: uppercase;
    font-size: .84rem;
    font-weight: 800;
    letter-spacing: .08em;
    margin-bottom: 10px;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 10px;
}

.auth-card p {
    text-align: center;
    margin: 0 0 20px;
}

.back-link {
    display: inline-block;
    color: var(--uts-green-dark);
    font-weight: 700;
    text-decoration: none;
}

/* Kiosk / remote */
.kiosk-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 24px 42px;
}

.topbar-card {
    background: rgba(255,255,255,0.94);
    border: 1px solid rgba(15, 148, 126, 0.14);
    border-radius: 20px;
    padding: 14px 18px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-logo {
    width: 118px;
}

.topbar-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #233746;
}

.topbar-subtitle {
    font-size: .94rem;
    color: var(--muted);
}

.session-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--uts-green-soft);
    color: var(--uts-green-dark);
    font-weight: 800;
}

.kiosk-header,
.kiosk-intro {
    margin-bottom: 18px;
}

.status-card {
    background: #f7fbfb;
    border: 1px solid #cae8e2;
    border-radius: 18px;
    padding: 18px 18px 14px;
    margin-bottom: 18px;
}

.status-card h1 {
    margin-bottom: 16px;
}

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

.status-grid span {
    display: block;
    color: var(--muted);
    font-size: .92rem;
    margin-bottom: 4px;
}

.status-grid strong {
    font-size: 1.05rem;
    color: var(--uts-green-dark);
}

/* Misc */
.input {
    width: 100%;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 16px;
    margin-bottom: 14px;
}

hr {
    border: 0;
    border-top: 1px solid #dfe7ea;
    margin: 14px 0;
}

@media (max-width: 1000px) {
    .page { grid-template-columns: 1fr; }

    .sidebar {
        position: static;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .content {
        padding: 22px;
    }

    .access-grid,
    .filter-grid,
    .status-grid,
    .registro-layout {
        grid-template-columns: 1fr;
    }

    .access-card p { min-height: auto; }
}

@media (max-width: 760px) {
    .landing-shell {
        padding: 30px 18px 40px;
    }

    .landing-logo { width: 200px; }

    .topbar-card,
    .topbar-brand,
    .topbar-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-actions {
        width: 100%;
    }

    .topbar-actions .btn,
    .actions-stack-mobile .btn {
        width: 100%;
    }

    .kiosk-shell {
        padding: 22px 16px 34px;
    }

    .auth-card {
        padding: 24px 20px 24px;
    }
}

/* Ajustes de logo y navegación global */
.logo-link {
    display: block;
    text-decoration: none;
}

.sidebar-logo,
.auth-logo,
.topbar-logo,
.landing-logo {
    object-fit: contain;
}

.sidebar-logo {
    width: 155px;
    height: auto;
}

.auth-logo {
    width: 185px;
    height: auto;
}

.topbar-logo {
    width: 128px;
    height: auto;
}

.landing-logo {
    width: 255px;
    height: auto;
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 22px;
    box-shadow: none;
}

.home-link {
    background: #eef8f6;
    color: var(--uts-green-dark) !important;
}

.home-button {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-back {
    text-shadow: 0 1px 2px rgba(0,0,0,.25);
}

/* Identificador de sesión y navegación de retorno */
.session-strip {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--uts-green-dark);
    font-weight: 800;
    font-size: .95rem;
}

.session-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--uts-green);
    box-shadow: 0 0 0 4px rgba(15, 148, 126, .12);
    display: inline-block;
}

.sidebar-session {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--uts-green-soft);
    color: var(--uts-green-dark);
    font-weight: 800;
    font-size: .86rem;
}

.auth-back {
    position: fixed;
    top: 22px;
    left: 22px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,.92);
    color: var(--uts-green-dark) !important;
    box-shadow: 0 12px 28px rgba(0,0,0,.16);
    text-decoration: none;
    text-shadow: none;
}

.auth-back:hover {
    background: #fff;
    transform: translateY(-1px);
}

@media (max-width: 760px) {
    .session-strip {
        justify-content: flex-start;
    }

    .auth-back {
        top: 12px;
        left: 12px;
        padding: 9px 12px;
        font-size: .9rem;
    }
}

/* Ajuste de navegación activa y exportación */
.sidebar-nav a.active {
    background: var(--uts-green-soft);
    color: var(--uts-green-dark) !important;
    font-weight: 800;
    box-shadow: inset 4px 0 0 var(--uts-green);
}

.sidebar-nav a.active:hover {
    transform: none;
}

.home-link {
    background: transparent;
    color: #314351 !important;
}

.button-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 10px;
}

.btn.fit {
    width: auto;
    min-width: 220px;
}

.export-note {
    margin: 10px 0 0;
    font-size: .92rem;
}

@media (max-width: 760px) {
    .btn.fit {
        width: 100%;
    }
}

/* Administración de alumnos */
.page-description {
    margin-top: -4px;
    margin-bottom: 22px;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(340px, 1.3fr) minmax(280px, .8fr);
    gap: 20px;
    align-items: start;
    margin-bottom: 22px;
}

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

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 16px;
    cursor: pointer;
    color: #314351;
}

.check-row input {
    width: auto;
    margin: 0;
    accent-color: var(--uts-green);
}

.summary-box {
    margin-top: 18px;
    background: #f6fbfa;
    border: 1px solid #d7eee9;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-box span {
    color: var(--muted);
    font-weight: 700;
}

.summary-box strong {
    color: var(--uts-green-dark);
    font-size: 1.6rem;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 18px;
}

.row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn.danger {
    background: #fff1f1;
    color: #b42318;
    border: 1px solid #fecdca;
}

@media (max-width: 1100px) {
    .admin-grid,
    .field-grid.two {
        grid-template-columns: 1fr;
    }
}

/* Administración integral */
.field-grid.three {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.admin-grid.wide-left {
    grid-template-columns: minmax(520px, 1.6fr) minmax(280px, .7fr);
}

.small-text {
    font-size: .9rem;
    margin-top: 4px;
}

.inside-field {
    margin: 8px 0 10px;
}

.admin-table th,
.admin-table td {
    vertical-align: top;
}

.sidebar-nav a {
    display: block;
}

@media (max-width: 1200px) {
    .admin-grid.wide-left,
    .field-grid.three {
        grid-template-columns: 1fr;
    }
}

/* Ajustes administración alumnos/periodos */
.field-grid.three {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.radio-row {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}
.radio-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid var(--border, #d9e2e7);
    border-radius: 999px;
    padding: .55rem .8rem;
    background: #fff;
    color: var(--text, #22313f);
    font-weight: 700;
    min-width: 44px;
    transition: all .18s ease;
}
.radio-pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.radio-pill.selected {
    background: var(--uts-green, #0f947e);
    color: #fff;
    border-color: var(--uts-green, #0f947e);
    box-shadow: 0 8px 18px rgba(15, 148, 126, .18);
}
.compact-summary {
    margin: .25rem 0 1rem;
}
.small-note {
    font-size: .92rem;
    margin-top: -.25rem;
}

@media (max-width: 1000px) {
    .field-grid.three {
        grid-template-columns: 1fr;
    }
}

.inline-field-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .6rem;
    align-items: center;
}

.inline-field-action input {
    margin-bottom: 0;
}

@media (max-width: 700px) {
    .inline-field-action {
        grid-template-columns: 1fr;
    }
}
