* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f5f7fb;
    color: #182230;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: #155eef;
    text-decoration: none;
}

.topbar {
    align-items: center;
    background: #111827;
    color: #fff;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    padding: 14px 24px;
}

.sidebar-toggle {
    background: #155eef;
    display: none;
    padding: 8px 12px;
}

.brand {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.topbar nav a {
    color: #dbeafe;
    font-size: 14px;
}

.container {
    margin: 0 auto;
    max-width: 1180px;
    padding: 24px;
}

.app-shell {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    min-height: calc(100vh - 56px);
}

.app-content {
    max-width: none;
}

.practical-page .app-shell {
    grid-template-columns: 200px minmax(0, 1fr);
}

.practical-page .app-content {
    margin-left: 0;
    margin-right: 0;
    max-width: none;
    padding-left: 16px;
    padding-right: 16px;
    width: 100%;
}

.student-sidebar {
    background: #ffffff;
    border-right: 1px solid #d7deea;
    padding: 14px;
}

.sidebar-backdrop,
.sidebar-close {
    display: none;
}

.student-profile {
    border-bottom: 1px solid #d7deea;
    margin-bottom: 16px;
    padding-bottom: 16px;
    text-align: center;
}

.student-profile img,
.settings-photo img {
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
}

.student-profile img,
.avatar-placeholder {
    height: 64px;
    margin: 0 auto 10px;
    width: 64px;
}

.student-profile strong,
.student-profile span {
    display: block;
}

.student-profile span {
    color: #667085;
    font-size: 13px;
}

.avatar-placeholder {
    align-items: center;
    background: #eef4ff;
    border: 1px solid #b2ccff;
    border-radius: 50%;
    color: #1849a9;
    display: flex;
    font-size: 24px;
    font-weight: 700;
    justify-content: center;
}

.avatar-placeholder.large {
    height: 104px;
    width: 104px;
}

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

.sidebar-nav a {
    align-items: center;
    border-radius: 6px;
    color: #344054;
    display: flex;
    gap: 10px;
    font-weight: 700;
    padding: 10px 12px;
}

.menu-icon {
    align-items: center;
    background: #eef4ff;
    border: 1px solid #b2ccff;
    border-radius: 6px;
    color: #1849a9;
    display: inline-flex;
    flex: 0 0 26px;
    font-size: 12px;
    font-weight: 800;
    height: 26px;
    justify-content: center;
    width: 26px;
}

.menu-icon svg {
    fill: none;
    height: 16px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    width: 16px;
}

.sidebar-nav a:hover {
    background: #eef4ff;
    color: #1849a9;
}

.panel {
    background: #fff;
    border: 1px solid #d7deea;
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 20px;
}

.panel h1,
.panel h2,
.panel h3 {
    margin-top: 0;
}

.landing-login-page .container {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 68px);
    padding: 24px;
}

.landing-login-panel {
    margin: 0;
    max-width: 420px;
    padding: 24px;
    width: 100%;
}

.landing-login-title {
    border-bottom: 1px solid #d7deea;
    margin-bottom: 18px;
    padding-bottom: 14px;
    text-align: center;
}

.landing-login-title strong {
    color: #155eef;
    display: block;
    font-size: 30px;
    line-height: 1.1;
}

.landing-login-title span {
    color: #344054;
    display: block;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    margin-top: 6px;
}

.landing-login-panel h1 {
    font-size: 22px;
    text-align: center;
}

.landing-login-panel button {
    width: 100%;
}

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

.stat {
    background: #fff;
    border: 1px solid #d7deea;
    border-radius: 8px;
    padding: 16px;
}

.stat strong {
    display: block;
    font-size: 28px;
}

.dashboard-hero {
    align-items: center;
    background: #fff;
    border: 1px solid #d7deea;
    border-radius: 8px;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 20px;
}

.dashboard-hero h1 {
    margin: 0 0 6px;
}

.dashboard-stats {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-bottom: 20px;
}

.dashboard-stat {
    color: #182230;
    grid-column: span 2;
    min-height: 132px;
    position: relative;
}

.dashboard-stat-center {
    grid-column: 3 / span 2;
}

.dashboard-stat .menu-icon {
    margin-bottom: 12px;
}

.dashboard-stat span:not(.menu-icon) {
    color: #667085;
    display: block;
    font-weight: 700;
}

.dashboard-stat strong {
    color: #182230;
    margin-top: 6px;
}

.dashboard-stat:hover {
    border-color: #b2ccff;
    box-shadow: 0 8px 24px rgba(21, 94, 239, 0.08);
}

label {
    display: block;
    font-weight: 700;
    margin: 10px 0 6px;
}

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

input,
select,
textarea {
    border: 1px solid #b8c2d1;
    border-radius: 6px;
    padding: 10px;
    width: 100%;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
}

.check-all-label {
    align-items: center;
    display: inline-flex;
    gap: 6px;
    white-space: nowrap;
}

textarea.code {
    background: #0f172a;
    color: #e5e7eb;
    font-family: Consolas, Monaco, monospace;
    min-height: 260px;
}

.program-input {
    background: #ffffff;
    font-family: Consolas, Monaco, monospace;
    min-height: 90px;
    resize: vertical;
}

.program-input-panel {
    margin-top: 12px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.form-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.filter-row {
    align-items: end;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(220px, 1fr) 180px auto;
    margin-bottom: 14px;
}

.student-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.student-actions form {
    margin: 0;
}

.student-actions button,
.student-actions .button {
    padding: 7px 9px;
}

.student-actions input[type="number"] {
    max-width: 110px;
    padding: 7px 9px;
}

.level-buttons {
    margin-bottom: 16px;
}

.print-title {
    display: none;
}

.bulk-score {
    align-items: end;
    background: #f8fafc;
    border: 1px solid #d7deea;
    border-radius: 8px;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-bottom: 16px;
    padding: 12px;
}

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

.compact-actions {
    margin-top: 0;
}

.compact-actions .button {
    padding: 7px 9px;
}

.pagination-bar {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-top: 14px;
}

.table-search-row {
    margin-bottom: 12px;
}

.bulk-score label {
    margin-top: 0;
}

button,
.button {
    background: #155eef;
    border: 0;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: inline-block;
    padding: 10px 14px;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.button.secondary,
button.secondary {
    background: #475467;
}

.button.danger,
button.danger {
    background: #b42318;
}

.badge {
    background: #eef4ff;
    border: 1px solid #b2ccff;
    border-radius: 999px;
    color: #1849a9;
    display: inline-block;
    font-size: 12px;
    padding: 3px 9px;
}

.alert {
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.alert.success {
    background: #ecfdf3;
    border: 1px solid #abefc6;
    color: #067647;
}

.alert.error {
    background: #fef3f2;
    border: 1px solid #fecdca;
    color: #b42318;
}

table {
    background: #fff;
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid #d7deea;
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f1f5f9;
}

.code-cell {
    border: 1px solid #d7deea;
    border-radius: 8px;
    margin-bottom: 14px;
    overflow: hidden;
}

.code-cell textarea {
    border: 0;
    border-radius: 0;
    min-height: 150px;
}

.cell-toolbar {
    align-items: center;
    background: #f8fafc;
    border-bottom: 1px solid #d7deea;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    padding: 8px;
}

.cell-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cell-controls button {
    border-radius: 5px;
    font-size: 12px;
    line-height: 1.1;
    padding: 6px 8px;
}

.output {
    background: #101828;
    color: #ecfdf3;
    font-family: Consolas, Monaco, monospace;
    min-height: 52px;
    overflow-x: auto;
    padding: 12px;
    white-space: pre-wrap;
}

.detail-code {
    min-height: 180px;
}

.detail-output {
    max-height: 260px;
}

.detail-code-large {
    min-height: 420px;
}

.detail-output-large {
    max-height: 420px;
}

.practical-workspace {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr;
    justify-items: stretch;
    width: 100%;
}

.practical-info-panel {
    position: static;
}

.practical-page .practical-workspace > .panel,
.practical-page .code-cell,
.practical-page .output,
.practical-page textarea.code {
    max-width: none;
    width: 100%;
}

.practical-info-panel h1 {
    font-size: 24px;
    line-height: 1.25;
}

.countdown-box {
    background: #eef4ff;
    border: 1px solid #b2ccff;
    border-radius: 8px;
    color: #1849a9;
    display: grid;
    gap: 4px;
    margin: 14px 0;
    padding: 12px;
}

.countdown-box span,
.countdown-box small {
    font-size: 13px;
    font-weight: 700;
}

.countdown-box strong {
    color: #182230;
    font-size: 28px;
    line-height: 1.1;
}

.countdown-box.expired {
    background: #fef3f2;
    border-color: #fecdca;
    color: #b42318;
}

.practical-instructions {
    background: #f8fafc;
    border: 1px solid #d7deea;
    border-radius: 8px;
    color: #344054;
    max-height: 220px;
    overflow: auto;
    padding: 12px;
}

.practical-editor-panel {
    justify-self: stretch;
    min-width: 0;
    width: 100%;
}

.practical-page .practical-editor-panel textarea.code {
    min-height: 520px;
}

.practical-editor-panel textarea.code {
    min-height: 420px;
    resize: vertical;
}

.practical-editor-panel .output {
    max-height: 360px;
}

.details-header {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.history-list {
    display: grid;
    gap: 12px;
}

.history-card {
    align-items: center;
    border: 1px solid #d7deea;
    border-radius: 8px;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(220px, 2fr) 130px 100px minmax(140px, 1fr) auto;
    padding: 14px;
}

.history-actions {
    text-align: right;
}

.history-summary {
    background: #f8fafc;
    border: 1px solid #d7deea;
    border-radius: 8px;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-bottom: 18px;
    padding: 12px;
}

.settings-grid {
    align-items: start;
    display: grid;
    gap: 22px;
    grid-template-columns: 220px minmax(0, 1fr);
}

.settings-photo {
    text-align: center;
}

.settings-photo img {
    height: 104px;
    width: 104px;
}

.feedback-box {
    background: #f8fafc;
    border: 1px solid #d7deea;
    border-radius: 6px;
    margin-bottom: 10px;
    padding: 10px;
}

.modal-backdrop {
    align-items: flex-start;
    background: rgba(16, 24, 40, 0.55);
    display: flex;
    inset: 0;
    justify-content: center;
    overflow-y: auto;
    padding: 24px;
    position: fixed;
    z-index: 60;
}

.modal-panel {
    background: #fff;
    border-radius: 8px;
    max-width: 820px;
    padding: 20px;
    width: min(820px, 100%);
}

summary {
    color: #155eef;
    cursor: pointer;
    font-weight: 700;
}

.plot-output {
    background: #fff;
    border-radius: 6px;
    display: block;
    margin-top: 12px;
    max-width: 100%;
    padding: 8px;
}

.download-list {
    background: #fff;
    border-radius: 6px;
    color: #182230;
    margin-top: 12px;
    padding: 10px;
}

.download-link {
    display: block;
    font-family: Arial, Helvetica, sans-serif;
    margin-top: 6px;
}

.table-preview {
    border-top: 1px solid #d7deea;
    margin-top: 12px;
    padding-top: 10px;
}

.table-scroll {
    margin-top: 8px;
    max-height: 360px;
    overflow: auto;
}

.table-preview table {
    color: #182230;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    min-width: 520px;
}

.muted {
    color: #667085;
}

@media print {
    .topbar,
    .no-print,
    form button,
    .actions {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .container {
        max-width: none;
        padding: 0;
    }

    .panel {
        border: 0;
        padding: 0;
    }

    .print-title {
        display: block;
    }
}

@media (max-width: 980px) {
    .practical-workspace {
        grid-template-columns: 1fr;
    }

    .practical-info-panel {
        position: static;
    }

    .practical-instructions {
        max-height: none;
    }
}

@media (max-width: 640px) {
    .practical-page .app-shell {
        display: block;
    }

    .practical-page .app-content {
        padding: 14px;
    }

    .container {
        padding: 14px;
    }

    .topbar {
        align-items: center;
    }

    .app-shell {
        display: block;
    }

    .sidebar-toggle {
        display: inline-block;
    }

    .sidebar-backdrop {
        background: rgba(16, 24, 40, 0.45);
        display: none;
        inset: 0;
        position: fixed;
        z-index: 30;
    }

    .sidebar-open .sidebar-backdrop {
        display: block;
    }

    .student-sidebar {
        border-bottom: 0;
        border-right: 1px solid #d7deea;
        bottom: 0;
        left: 0;
        max-width: 82vw;
        overflow-y: auto;
        padding: 14px;
        position: fixed;
        top: 0;
        transform: translateX(-105%);
        transition: transform 160ms ease;
        width: 260px;
        z-index: 40;
    }

    .sidebar-open .student-sidebar {
        transform: translateX(0);
    }

    .sidebar-close {
        background: #475467;
        display: inline-block;
        margin-bottom: 12px;
        padding: 7px 10px;
    }

    .student-profile {
        display: block;
        margin-bottom: 10px;
        padding-bottom: 10px;
        text-align: center;
    }

    .student-profile img,
    .student-profile .avatar-placeholder {
        height: 58px;
        margin: 0 auto 8px;
        width: 58px;
    }

    .student-profile .avatar-placeholder {
        font-size: 22px;
    }

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

    .sidebar-nav a {
        background: #f8fafc;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        align-items: stretch;
        display: grid;
    }

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

    .dashboard-stat,
    .dashboard-stat-center {
        grid-column: auto;
    }

    .bulk-score {
        grid-template-columns: 1fr;
    }

    .details-header,
    .history-card {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .details-header {
        display: grid;
    }

    .history-actions {
        text-align: left;
    }

    .history-actions .button,
    .details-header .button {
        text-align: center;
        width: 100%;
    }

    .detail-code-large {
        min-height: 300px;
    }

    .modal-backdrop {
        padding: 12px;
    }
}
