:root {
    --bg: #0f172a;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --line: #dbe4f0;
    --text: #122033;
    --text-soft: #526277;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --muted: #64748b;
    --shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
    --radius: 18px;
    --radius-sm: 12px;
    --sidebar-width: 280px;
    --transition: 180ms ease;
    --font: "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: #eef4fb;
    color: var(--text);
    font-family: var(--font);
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

img,
iframe {
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

.login-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 40%),
        radial-gradient(circle at bottom right, rgba(22, 163, 74, 0.18), transparent 35%),
        #eff5fb;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 420px);
    min-height: 100vh;
    gap: 32px;
    align-items: center;
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.login-hero h1 {
    margin: 0 0 16px;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    line-height: 1.05;
}

.login-hero p {
    max-width: 640px;
    color: var(--text-soft);
    font-size: 1.05rem;
}

.feature-list {
    padding: 0;
    margin: 24px 0 0;
    list-style: none;
}

.feature-list li {
    position: relative;
    padding: 10px 0 10px 28px;
}

.feature-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--success));
}

.login-card,
.card {
    background: var(--panel);
    border: 1px solid rgba(219, 228, 240, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.login-card {
    padding: 30px;
}

.login-card h2 {
    margin-top: 0;
    font-size: 2rem;
}

.login-card form {
    display: grid;
    gap: 14px;
}

.auth-switch {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--text-soft);
}

.auth-switch p {
    margin: 0 0 12px;
}

.forgot-link {
    margin: 14px 0 0;
    text-align: right;
    font-size: 0.92rem;
}

.forgot-link a {
    color: var(--text-soft);
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
}

.forgot-link a:hover {
    color: var(--brand, #2563eb);
}

.login-card .muted {
    margin: -8px 0 16px;
    color: var(--text-soft);
    font-size: 0.95rem;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    padding: 24px 18px;
    background: linear-gradient(180deg, #0f172a, #111f38);
    color: #e5efff;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px;
    margin-bottom: 26px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff;
    font-weight: 800;
}

.brand span {
    display: block;
    color: rgba(229, 239, 255, 0.72);
    font-size: 0.9rem;
}

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

.sidebar-nav a {
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(229, 239, 255, 0.84);
    transition: background var(--transition), color var(--transition), transform var(--transition);
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateX(4px);
}

.app-main {
    flex: 1;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar h1 {
    margin: 0;
    font-size: 1.7rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-user span {
    display: block;
    color: var(--text-soft);
    font-size: 0.88rem;
}

.content {
    padding: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.stats-grid,
.grid-two,
.dashboard-grid,
.reports-grid,
.detail-grid,
.evaluation-layout {
    display: grid;
    gap: 20px;
}

.stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 24px;
}

.dashboard-grid,
.grid-two,
.detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.evaluation-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
}

.reports-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.stat-card {
    padding: 22px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #fff, #f8fbff);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.stat-card span {
    display: block;
    color: var(--text-soft);
    margin-bottom: 12px;
}

.stat-card strong {
    font-size: 2rem;
    line-height: 1;
}

.card {
    padding: 24px;
}

.card-inner {
    padding: 20px;
    background: var(--panel-soft);
    border-radius: var(--radius-sm);
    box-shadow: none;
}

.stack {
    display: grid;
    gap: 20px;
}

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

.section-head h2,
.card h2,
.card h3 {
    margin: 0;
}

.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

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

.table th {
    color: var(--text-soft);
    font-size: 0.88rem;
    font-weight: 700;
}

.table-note {
    margin: 6px 0 0;
    color: var(--text-soft);
    font-size: 0.9rem;
}

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

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

label {
    display: grid;
    gap: 8px;
    color: var(--text-soft);
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    padding: 12px 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.form-actions,
.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.inline-form {
    display: inline-flex;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 11px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    transition: transform var(--transition), background var(--transition), border-color var(--transition), color var(--transition);
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.btn-outline {
    background: #fff;
    border-color: var(--line);
    color: var(--text);
}

.btn-danger {
    background: rgba(220, 38, 38, 0.12);
    color: var(--danger);
}

.btn-sm {
    min-height: 34px;
    padding: 8px 12px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
}

.badge-success {
    background: rgba(22, 163, 74, 0.12);
    color: var(--success);
}

.badge-warning {
    background: rgba(217, 119, 6, 0.14);
    color: var(--warning);
}

.badge-danger {
    background: rgba(220, 38, 38, 0.14);
    color: var(--danger);
}

.badge-info {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary);
}

.badge-muted {
    background: rgba(100, 116, 139, 0.12);
    color: var(--muted);
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.badge-card {
    display: flex;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #fff, #f8fbff);
}

.badge-card--upload {
    align-items: flex-start;
}

.badge-card__body {
    display: grid;
    gap: 4px;
}

.badge-card__body span,
.badge-card__body small {
    color: var(--text-soft);
}

.badge-medal {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), #6d28d9);
    color: #fff;
    font-weight: 800;
    box-shadow: inset 0 -6px 12px rgba(255, 255, 255, 0.16);
}

.badge-medal--image {
    overflow: hidden;
    padding: 0;
}

.badge-medal--image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.student-badge-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 22px;
}

.student-badge-card {
    position: relative;
    display: grid;
    grid-template-columns: 148px minmax(0, 1fr);
    align-items: center;
    gap: 22px;
    min-height: 220px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.14), transparent 30%),
        radial-gradient(circle at bottom right, rgba(37, 99, 235, 0.1), transparent 28%),
        linear-gradient(180deg, #ffffff, #f7fbff);
    transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.student-badge-card::after {
    content: "";
    position: absolute;
    inset: auto -20% 0 auto;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.12), transparent 68%);
    pointer-events: none;
}

.student-badge-card:hover {
    transform: translateY(-8px);
    border-color: rgba(37, 99, 235, 0.28);
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.16);
}

.student-badge-card .badge-card__body {
    position: relative;
    z-index: 1;
    gap: 8px;
}

.student-badge-card .badge-card__body strong {
    font-size: 1.38rem;
    line-height: 1.08;
    letter-spacing: -0.02em;
}

.student-badge-kicker {
    margin: 0;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.student-badge-card .badge-card__body span {
    font-size: 1rem;
}

.student-badge-card .badge-card__body p {
    margin: 4px 0 0;
    color: var(--text);
    font-size: 1rem;
}

.student-badge-card .badge-card__body small {
    margin-top: 6px;
}

.student-badge-visual {
    width: 148px;
    height: 148px;
    flex: 0 0 148px;
    display: grid;
    place-items: center;
    background: transparent;
    perspective: 1000px;
    position: relative;
    z-index: 1;
}

.student-badge-trigger {
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    position: relative;
    display: grid;
    place-items: center;
    transition: transform 220ms ease, filter 220ms ease;
}

.student-badge-trigger:hover {
    transform: rotateX(9deg) rotateY(-12deg) translateY(-8px) scale(1.08);
}

.student-badge-glow {
    position: absolute;
    inset: 14px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.4), rgba(14, 165, 233, 0.14) 48%, transparent 72%);
    filter: blur(14px);
    opacity: 0.9;
    transition: transform 220ms ease, opacity 220ms ease;
    pointer-events: none;
}

.student-badge-trigger:hover .student-badge-glow {
    transform: scale(1.12);
    opacity: 1;
}

.student-badge-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 18px 30px rgba(15, 23, 42, 0.24));
    transition: transform 220ms ease, filter 220ms ease;
}

.student-badge-trigger:hover .student-badge-image {
    transform: scale(1.12) rotate(-5deg);
    filter: drop-shadow(0 26px 40px rgba(37, 99, 235, 0.3));
}

.student-badge-fallback {
    width: 92px;
    height: 92px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), #6d28d9);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 800;
    box-shadow: inset 0 -6px 12px rgba(255, 255, 255, 0.16);
}

.badge-lightbox-open {
    overflow: hidden;
}

.badge-lightbox[hidden] {
    display: none !important;
}

.badge-lightbox {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
}

.badge-lightbox__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
}

.badge-lightbox__dialog {
    position: relative;
    z-index: 1;
    width: min(620px, calc(100vw - 32px));
    padding: 24px 24px 32px;
    border-radius: 32px;
    background:
        radial-gradient(circle at top, rgba(59, 130, 246, 0.16), transparent 34%),
        linear-gradient(180deg, #ffffff, #f7fbff);
    box-shadow: 0 34px 100px rgba(15, 23, 42, 0.34);
    text-align: center;
    animation: badge-pop 220ms cubic-bezier(.2,.9,.2,1);
}

.badge-lightbox__media {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 380px;
}

.badge-lightbox__glow {
    position: absolute;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.24), rgba(14, 165, 233, 0.14) 42%, transparent 72%);
    filter: blur(22px);
}

.badge-lightbox__dialog img {
    position: relative;
    z-index: 1;
    width: min(380px, 100%);
    max-height: 380px;
    object-fit: contain;
    filter: drop-shadow(0 28px 44px rgba(15, 23, 42, 0.3));
    animation: badge-float 2.6s ease-in-out infinite;
}

.badge-lightbox__dialog strong {
    display: block;
    margin-top: 8px;
    font-size: 1.55rem;
    line-height: 1.08;
}

.badge-lightbox__meta {
    margin: 10px 0 0;
    color: var(--text-soft);
}

.badge-lightbox__close {
    margin-left: auto;
    margin-bottom: 16px;
    display: inline-flex;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
}

@keyframes badge-pop {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes badge-float {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.badge-upload-preview {
    width: 96px;
    height: 96px;
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    background: var(--panel-soft);
}

.badge-upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.badge-remove-option {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.badge-remove-option input {
    width: 18px;
    height: 18px;
}

.badge-options {
    display: grid;
    gap: 12px;
    margin: 14px 0;
}

.badge-option {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.badge-option input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.progress-list,
.metric-list,
.file-list,
.explorer-list,
.timeline {
    display: grid;
    gap: 14px;
}

.progress-item__header,
.metric-list li,
.file-list li,
.explorer-list li,
.timeline-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.metric-list,
.file-list,
.explorer-list {
    padding: 0;
    margin: 0;
    list-style: none;
}

.metric-list li,
.file-list li,
.explorer-list li,
.timeline-item {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-soft);
}

.progress-bar {
    margin-top: 8px;
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: #dfe8f4;
    overflow: hidden;
}

.progress-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--success));
}

.preview-frame {
    width: 100%;
    min-height: 520px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

.preview-frame--tall {
    min-height: 720px;
}

.code-viewer {
    margin-top: 18px;
}

.code-viewer pre {
    overflow: auto;
    padding: 18px;
    border-radius: 14px;
    background: #0f172a;
    color: #dbeafe;
    font-size: 0.9rem;
}

.alert {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    font-weight: 600;
}

.alert-success {
    background: rgba(22, 163, 74, 0.12);
    color: var(--success);
}

.alert-error {
    background: rgba(220, 38, 38, 0.12);
    color: var(--danger);
}

.alert-warning {
    background: rgba(217, 119, 6, 0.14);
    color: var(--warning);
}

.empty-state {
    padding: 26px;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: 14px;
    color: var(--text-soft);
    background: var(--panel-soft);
}

.agrinho-summary,
.agrinho-result {
    margin-top: 20px;
}

.agrinho-result pre {
    margin: 12px 0 0;
    overflow: auto;
    padding: 16px;
    border-radius: 14px;
    background: #0f172a;
    color: #dbeafe;
    font-size: 0.9rem;
}

.hint {
    color: var(--text-soft);
}

.sidebar-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: #e8eef8;
    cursor: pointer;
}

.sidebar-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    margin: 4px auto;
}

@media (max-width: 1180px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-grid,
    .grid-two,
    .detail-grid,
    .reports-grid,
    .evaluation-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    .login-shell {
        grid-template-columns: 1fr;
        padding: 32px 0;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 40;
        transition: left var(--transition);
    }

    .sidebar.is-open {
        left: 0;
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .topbar {
        padding: 18px 20px;
    }

    .content {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .content,
    .topbar {
        padding: 16px;
    }

    .form-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .section-head,
    .topbar,
    .progress-item__header,
    .metric-list li,
    .file-list li,
    .explorer-list li,
    .timeline-item {
        flex-direction: column;
        align-items: stretch;
    }

    .preview-frame,
    .preview-frame--tall {
        min-height: 420px;
    }
}
