:root {
    --bg: #0f172a;
    --bg-alt: #1e293b;
    --card: rgba(15, 23, 42, 0.7);
    --accent: #38bdf8;
    --accent-strong: #22d3ee;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --danger: #f87171;
    --success: #4ade80;
    --border: rgba(56, 189, 248, 0.25);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at 20% -10%, #1d4ed8 0%, #0f172a 45%);
    color: var(--text);
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

.bg-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 80% 20%, rgba(56, 189, 248, 0.35), transparent 55%);
    filter: blur(40px);
    opacity: 0.6;
}

.page-shell {
    position: relative;
    z-index: 1;
    padding: clamp(1.5rem, 4vw, 3rem);
    display: grid;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .page-shell {
        padding-top: 4.5rem;
    }
}



.auth-card,
.dashboard {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    padding: clamp(1.8rem, 4vw, 2.8rem);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.45);
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-mark {
    width: 96px;
    height: 96px;
    border-radius: 24px;
    background: rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: auto;
    display: block;
}

.brand-mark--sm {
    width: 88px;
    height: 88px;
    padding: 0.35rem;
}

.hero-brand {
    align-items: flex-start;
    flex-wrap: wrap;
}

.hero-brand--stacked {
    align-items: center;
}

.hero-brand-copy {
    flex: 1 1 240px;
    min-width: 220px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--muted);
    font-size: 0.75rem;
    margin-bottom: 0.35rem;
}

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

.auth-card h1 {
    font-size: clamp(2rem, 5vw, 2.8rem);
    margin-bottom: 0.6rem;
}

#googleButton {
    margin-top: 1.25rem;
}

.alert {
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.4);
    border-radius: 1rem;
    padding: 0.85rem 1.1rem;
    color: #fecdd3;
    margin-top: 1rem;
    font-size: 0.95rem;
}

.alert.success {
    background: rgba(74, 222, 128, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
    color: #bbf7d0;
}

.alert.info {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.4);
    color: #bae6fd;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 2.5rem);
    align-items: stretch;
}

.login-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
}



.login-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.login-logo {
    width: 128px;
    height: 128px;
    border-radius: 32px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.3);
    display: grid;
    place-items: center;
    padding: 0.75rem;
}

.login-logo img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.login-lede {
    font-size: 1.05rem;
    color: var(--muted);
}

.login-highlight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.login-highlight-grid div {
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 1rem;
    padding: 0.85rem 1rem;
}

.login-highlight-grid span {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.login-highlight-grid strong {
    display: block;
    margin-top: 0.25rem;
    font-size: 1.1rem;
}

.login-hero-copy {
    margin-top: 1.75rem;
    padding-top: 1.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
}

.login-hero-copy h2 {
    margin: 0.4rem 0 0.35rem;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.login-actions {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.google-slot {
    display: inline-flex;
}

.login-help {
    font-size: 0.85rem;
}

.login-aside {
    display: flex;
    align-items: stretch;
}

.login-aside-card {
    border-radius: 1.25rem;
    padding: 1.5rem;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.7), rgba(30, 41, 59, 0.95));
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.aside-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.9);
    margin: 0;
}

.login-aside-card h3 {
    margin: 0;
    font-size: 1.4rem;
}

.login-aside-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.35rem;
    color: var(--muted);
}

.login-aside-card ul li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1.3;
}

.login-aside-card ul li::before {
    content: '•';
    margin-right: 0.5rem;
    color: var(--accent);
}

.login-aside-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.8rem;
}

.login-aside-meta span {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.login-aside-meta strong {
    display: block;
    margin-top: 0.2rem;
}

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

.hero h1 {
    font-size: clamp(2rem, 4vw, 2.6rem);
    margin: 0.35rem 0;
}

.hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
}

.user-pill img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid rgba(56, 189, 248, 0.4);
}

.user-pill-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.user-pill-actions .btn {
    white-space: nowrap;
}

.role-badge {
    background: rgba(56, 189, 248, 0.2);
    padding: 0.1rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--accent);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2rem;
}

.stat-card {
    background: rgba(30, 41, 59, 0.75);
    border-radius: 1.1rem;
    padding: 1.2rem 1.4rem;
    border: 1px solid rgba(226, 232, 240, 0.08);
}

.stat-card small {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.stat-card h2 {
    margin: 0.5rem 0 0;
    font-size: 2rem;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.search {
    flex: 1;
    min-width: 260px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 999px;
    padding: 0.45rem 1rem;
}

.search svg {
    width: 18px;
    height: 18px;
    fill: var(--muted);
}

.search input {
    background: transparent;
    border: none;
    color: var(--text);
    width: 100%;
    font-size: 0.95rem;
    outline: none;
}

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

.btn {
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.4rem;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn.primary {
    background: linear-gradient(120deg, #38bdf8, #22d3ee);
    color: #0f172a;
    box-shadow: 0 15px 30px rgba(8, 47, 73, 0.45);
}

.btn.primary:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn.outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid rgba(56, 189, 248, 0.5);
}

.btn.ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
}
.btn.outline {
    color: var(--accent);
    border: 1px solid rgba(90, 173, 255, 0.6);
}

.btn.ghost {
    color: rgba(226, 240, 255, 0.8);
    border-color: transparent;
}

.table-card {
    border-radius: 1.2rem;
    border: 1px solid rgba(56, 189, 248, 0.2);
    background: rgba(15, 23, 42, 0.55);
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th,
td {
    padding: 1rem 1.2rem;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

th {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    color: var(--muted);
}

.center {
    text-align: center;
}

.tag {
    background: rgba(56, 189, 248, 0.15);
    padding: 0.15rem 0.7rem;
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--accent);
}

.table-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.action-btn {
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0.65rem;
    padding: 0.35rem 0.75rem;
    background: transparent;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.action-btn.danger {
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.4);
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 20;
}

.modal-content {
    background: #0b1220;
    border-radius: 1.5rem;
    border: 1px solid rgba(56, 189, 248, 0.25);
    padding: 1.5rem;
    width: auto !important;
    max-width: none !important;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 90vh;
    overflow-y: auto;
}

#userModal .modal-content {
    width: 90vw !important;
    max-width: 1120px !important;
    max-height: calc(100vh - 0.5rem);
    overflow-x: hidden !important;
}

@media (max-width: 640px) {
    #userModal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
    }
}

#userModal .user-table {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

#userModal .user-table table {
    width: 100% !important;
    table-layout: fixed !important;
}

#userModal .user-table table th,
#userModal .user-table table td {
    white-space: normal !important;
    word-break: break-word !important;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    padding-bottom: 0.8rem;
}

.modal-header h3 {
    margin: 0;
}

form label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-weight: 600;
}

form input,
form select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.8rem;
    padding: 0.7rem 0.9rem;
    color: var(--text);
    font: inherit;
}

form input[type="file"] {
    padding: 0.4rem;
}

form textarea {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.8rem;
    padding: 0.7rem 0.9rem;
    color: var(--text);
    font: inherit;
    resize: vertical;
    min-height: 120px;
}

.email-input-group .email-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.email-input-group input[type="text"] {
    flex: 1;
}

.email-domain {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.combo {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.combo input[type="text"] {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.8rem;
    padding: 0.7rem 0.9rem;
    color: var(--text);
    font: inherit;
}

.combo-list {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: #0b1220;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 0.9rem;
    box-shadow: 0 20px 40px rgba(2, 6, 23, 0.6);
    z-index: 25;
}

.combo-list.hidden {
    display: none;
}

.combo-item {
    padding: 0.65rem 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.combo-item:last-child {
    border-bottom: none;
}

.combo-item:hover {
    background: rgba(56, 189, 248, 0.15);
}

.combo-item.muted {
    cursor: default;
    color: var(--muted);
}

.combo-item.manual {
    font-weight: 600;
    color: var(--accent);
}

.combo-item-label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.combo-item-label strong {
    font-weight: 600;
    font-size: 0.9rem;
}

.combo.open input[type="text"] {
    border-color: rgba(56, 189, 248, 0.6);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.user-form {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.user-table table th:last-child,
.user-table table td:last-child {
    text-align: right;
}

.badge-role {
    padding: 0.15rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    text-transform: capitalize;
}

.badge-role.superadmin {
    background: rgba(248, 250, 252, 0.2);
    color: #fde68a;
}

.badge-role.docente {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent);
}

.badge-role.tecnico {
    background: rgba(74, 222, 128, 0.15);
    color: var(--success);
}

.welcome-status {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.85rem;
}

.welcome-status small {
    color: var(--muted);
    font-size: 0.75rem;
}

.badge-status {
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-status.pending {
    background: rgba(248, 113, 113, 0.15);
    color: #fecdd3;
}

.badge-status.sent {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent);
}

.badge-status.read {
    background: rgba(74, 222, 128, 0.15);
    color: var(--success);
}

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: rgba(15, 23, 42, 0.9);
    padding: 0.85rem 1.2rem;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--text);
    z-index: 50;
    min-width: 220px;
}

.toast.error {
    border-color: rgba(248, 113, 113, 0.6);
    color: #fecdd3;
}

.subject {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.subject strong {
    font-weight: 600;
}

@media (max-width: 720px) {
    .hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-pill {
        width: 100%;
        justify-content: space-between;
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-aside-card {
        order: -1;
    }
}
