* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.login-box h1 {
    font-size: 28px;
    margin-bottom: 30px;
    color: #333;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.flash-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.flash {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.flash-error {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.flash-success {
    background-color: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

/* Dashboard Styles */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

body:has(.dashboard-container) {
    background: #f5f7fa;
    display: block;
    padding: 0;
    margin: 0;
}

.sidebar {
    width: 210px;
    background: #2c3e50;
    color: white;
    padding: 16px 0;
    position: fixed;
    height: 100vh;
}

.sidebar .logo {
    padding: 0 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar .logo h2 {
    font-size: 20px;
    font-weight: 600;
}

.logo-image {
    display: block;
    width: 100%;
    max-width: 160px;
    height: auto;
}

.nav-menu {
    list-style: none;
    padding: 20px 0;
}

.nav-menu li {
    margin: 0;
}

.nav-menu a {
    display: block;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.main-content {
    margin-left: 210px;
    flex: 1;
    padding: 30px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dashboard-header h1 {
    font-size: 28px;
    color: #2c3e50;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

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

.card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.card p {
    color: #7f8c8d;
    line-height: 1.6;
}

.stat {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #ecf0f1;
}

.stat:last-child {
    border-bottom: none;
}

.stat-label {
    color: #7f8c8d;
    font-size: 14px;
}

.stat-value {
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
}

/* User Management Styles */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn {
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

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

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

.users-table th,
.users-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.users-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.users-table tbody tr:hover {
    background: #f8f9fa;
}

.selection-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.selection-summary {
    display: flex;
    gap: 12px;
    align-items: center;
    font-weight: 600;
}

.selection-actions,
.bulk-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.select-col {
    width: 44px;
    text-align: center;
}

.question-select {
    width: 16px;
    height: 16px;
}

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

.pagination-info {
    display: flex;
    gap: 16px;
    align-items: center;
}

.pagination-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.per-page-form,
.page-jump-form,
.page-nav {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.page-jump-form input[type="number"] {
    width: 80px;
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.role-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-inactive {
    background: #ffebee;
    color: #c62828;
}

.status-answered {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-unanswered {
    background: #fff3e0;
    color: #ef6c00;
}

.status-flagged {
    background: #fff8e1;
    color: #ff8f00;
}

.status-in-progress {
    background: #e3f2fd;
    color: #1565c0;
}

.status-submitted {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-ended {
    background: #fff3e0;
    color: #ef6c00;
}

.status-returned {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-pending {
    background: #fff8e1;
    color: #ff8f00;
}

.actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-edit {
    background: #2196f3;
    color: white;
}

.btn-edit:hover {
    background: #1976d2;
}

.btn-toggle {
    background: #ff9800;
    color: white;
}

.btn-toggle:hover {
    background: #f57c00;
}

.btn-delete {
    background: #f44336;
    color: white;
}

.btn-delete:hover {
    background: #d32f2f;
}

/* User Form Styles */
.user-form {
    padding: 20px 0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.user-form .form-group {
    margin-bottom: 20px;
}

.user-form select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
    background: white;
}

.user-form select:focus {
    outline: none;
    border-color: #667eea;
}

.user-form small {
    display: block;
    margin-top: 5px;
    color: #7f8c8d;
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

/* Search and Filter Styles */
.search-filter-container {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-bar {
    display: flex;
    gap: 12px;
}

.search-bar input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.search-bar input:focus {
    outline: none;
    border-color: #667eea;
}

.search-bar .btn-primary {
    width: auto;
    padding: 10px 24px;
}

.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    min-width: 150px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-secondary {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Tag Badge Styles */
.tag-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
    margin-bottom: 4px;
}

.review-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #2c3e50;
}

.review-details summary:hover {
    color: #1d3557;
}

.review-meta-grid {
    margin-top: 8px;
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #4a5568;
}

.text-muted {
    color: #999;
    font-style: italic;
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 10px;
}

/* Bulk Upload Styles */
.bulk-upload-container {
    padding: 30px;
}

.instructions {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.instructions h4 {
    margin-bottom: 15px;
    color: #333;
}

.instructions ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.instructions li {
    margin-bottom: 8px;
    color: #555;
}

.csv-format-info {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.csv-format-info h5 {
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
}

.csv-format-info pre {
    background: #282c34;
    color: #abb2bf;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
}

.csv-format-info code {
    background: #e3f2fd;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    color: #1976d2;
}

.upload-form {
    background: white;
    padding: 25px;
    border-radius: 8px;
    border: 2px dashed #e0e0e0;
}

.upload-form input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
}

.upload-form input[type="file"]:hover {
    border-color: #667eea;
}

.results-container {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.results-container h4 {
    margin-bottom: 15px;
    color: #333;
}

.result-summary {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: 600;
}

.result-summary.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.result-summary.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.error-details {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
}

.error-details h5 {
    margin-bottom: 10px;
    color: #721c24;
    font-size: 14px;
}

.error-details ul {
    list-style: none;
    padding: 0;
}

.error-details li {
    padding: 8px;
    margin-bottom: 5px;
    background: #fff5f5;
    border-left: 3px solid #dc3545;
    color: #721c24;
    font-size: 13px;
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card-content {
    padding: 20px;
}

.card-content p {
    color: #555;
    line-height: 1.6;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    color: #777;
    text-transform: uppercase;
    font-weight: 600;
}

/* Links Management Styles */
.links-form {
    padding: 20px;
}

.link-type-row {
    margin: 20px 0;
}

.link-type-row .form-group {
    margin-bottom: 0;
}

.select-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.links-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.link-type-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e8f0fe;
    color: #1a73e8;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.link-direction-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.link-direction-badge.incoming {
    background: #fff3e0;
    color: #ef6c00;
}

.mutual-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e0f2f1;
    color: #00695c;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.inline-form {
    display: inline;
}

.link-user {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.link-name {
    font-weight: 600;
    color: #2c3e50;
}

.links-section {
    margin-bottom: 20px;
}

.links-section h4 {
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.links-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.links-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.link-user-name {
    font-weight: 600;
    color: #2c3e50;
}

/* Question Management Styles */
.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.section-card {
    margin-top: 20px;
    border: 1px solid #eef1f4;
    box-shadow: none;
}

.question-form .form-row {
    align-items: flex-start;
}

.question-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
}

.question-form textarea:focus {
    outline: none;
    border-color: #667eea;
}

.question-form input[type="text"],
.question-form input[type="number"],
.question-form select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.question-form input[type="text"]:focus,
.question-form input[type="number"]:focus,
.question-form select:focus {
    outline: none;
    border-color: #667eea;
}

.question-form input[type="file"] {
    width: 100%;
    padding: 6px 0;
}

.inline-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.radio-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid #dfe6e9;
    background: #f8f9fa;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
}

.question-text-block,
.question-image-block,
.answer-text-block,
.answer-image-block {
    margin-top: 15px;
}

.option-card {
    border: 1px solid #e6eaef;
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
    background: #fdfdfd;
}

.option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.option-header h5 {
    margin: 0;
    font-size: 14px;
    color: #2c3e50;
}

.option-correct {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.option-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.paste-target {
    margin-top: 10px;
    padding: 12px;
    border: 2px dashed #d0d7de;
    border-radius: 8px;
    color: #6c757d;
    font-size: 13px;
    background: #f8f9fa;
    cursor: text;
}

.paste-target:empty::before {
    content: attr(data-placeholder);
    color: #9aa5b1;
}

.image-preview {
    margin-top: 10px;
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.question-table .question-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 120px;
    justify-content: center;
}

.question-viewer-trigger {
    border: none;
    background: none;
    padding: 0;
    text-align: left;
    width: 100%;
    cursor: pointer;
}

.question-viewer-trigger:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.question-table .question-text {
    font-weight: 600;
    color: #2c3e50;
}

.question-thumb {
    width: auto;
    max-width: 100%;
    max-height: 120px;
    height: auto;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    object-fit: contain;
}

.question-type-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #ede7f6;
    color: #5e35b1;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(28, 35, 45, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 30px;
    z-index: 2000;
}

.modal.open {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 14px;
    width: min(900px, 100%);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header,
.modal-footer {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eef1f4;
}

.modal-footer {
    border-top: 1px solid #eef1f4;
    border-bottom: none;
    gap: 10px;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-close {
    border: none;
    background: #f5f7fa;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: #5f6b7a;
}

.viewer-question {
    font-size: 16px;
    color: #2c3e50;
}

.viewer-image {
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

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

.viewer-option {
    border: 1px solid #e6eaef;
    border-radius: 10px;
    padding: 12px;
    background: #fafbfc;
}

.viewer-option-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #6c757d;
    margin-bottom: 8px;
    font-weight: 600;
}

.correct-answer-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 10px;
    border-radius: 12px;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 12px;
    font-weight: 600;
}

.viewer-answer {
    border-top: 1px solid #eef1f4;
    padding-top: 16px;
}

.viewer-answer-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #6c757d;
    margin-bottom: 10px;
}

.intro-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.intro-warning {
    margin-top: 16px;
}

.test-taking-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.test-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
}

.question-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.question-nav-item {
    border: 1px solid #d7dce3;
    background: #fff;
    border-radius: 6px;
    padding: 6px 10px;
    min-width: 36px;
    cursor: pointer;
    font-weight: 600;
}

.question-nav-item.active {
    background: #e3f2fd;
    border-color: #64b5f6;
}

.question-nav-item.flagged {
    border-color: #ff9800;
    box-shadow: 0 0 0 1px rgba(255, 152, 0, 0.3);
}

.question-nav-ellipsis {
    padding: 6px 10px;
    color: #6c757d;
}

.question-jump {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.timer-label {
    font-size: 12px;
    color: #6c757d;
}

.timer-value {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
}

.question-area {
    border: 1px solid #eef1f4;
    border-radius: 12px;
    padding: 20px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.review-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.attempt-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.attempt-selector select {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #fff;
}

.score-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.attempt-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.feedback-area {
    border-top: 1px solid #eef1f4;
    padding-top: 16px;
}

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feedback-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.feedback-form textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-size: 14px;
    resize: vertical;
}

.annotation-wrapper,
.file-preview-frame {
    position: relative;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafbfc;
    overflow: hidden;
    max-width: 100%;
}

.annotation-base {
    display: block;
    max-width: 100%;
    height: auto;
}

.annotation-canvas {
    position: absolute;
    top: 0;
    left: 0;
}

.annotation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    pointer-events: none;
}

.annotation-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.file-review-block {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-preview-frame img,
.file-preview-frame iframe {
    display: block;
    width: 100%;
    height: auto;
    border: none;
}

.file-preview-frame-embed {
    width: 100%;
    height: 400px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.flag-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #ef6c00;
}

.answer-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.open-answer-text {
    width: 100%;
    min-height: 120px;
    border: 1px solid #d7dce3;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
}

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

.option-item {
    display: flex;
    gap: 12px;
    align-items: center;
    border: 1px solid #e6eaef;
    border-radius: 10px;
    padding: 12px;
    background: #fafbfc;
}

.option-item input {
    margin-top: 4px;
}

.option-item.selected {
    border-color: #64b5f6;
    background: #e3f2fd;
}

.canvas-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.canvas-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.canvas-wrap {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px;
    background: #fdfdfd;
}

.file-upload {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.uploaded-files {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.uploaded-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.attempt-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attempt-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.attempt-select {
    width: 100%;
    max-width: 260px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #fff;
    font-size: 14px;
}

.attempt-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.attempt-select-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.feedback-link[hidden] {
    display: none;
}

.question-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.practice-answer {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.practice-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.practice-timer-display {
    font-weight: 600;
    font-size: 16px;
    color: #2c3e50;
    min-width: 64px;
    text-align: center;
}

.practice-nav {
    display: flex;
    gap: 8px;
    margin-right: auto;
}

.official-answer-panel {
    margin-top: 16px;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #d7dce3;
    background: #f6f8fb;
}

.official-answer-list {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.official-answer-item {
    border: 1px solid #e1e6ee;
    border-radius: 10px;
    padding: 12px;
    background: #ffffff;
}

.official-answer-label {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.option-item.correct-option {
    border-color: #8bc34a;
    background: #f0f8e8;
}

.learning-notes {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.question-review-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.question-review-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border: 1px solid #eef1f4;
    border-radius: 10px;
    padding: 12px 16px;
    background: #fafbfc;
}

.question-review-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.question-review-block {
    padding: 16px 0;
    border-bottom: 1px solid #eef1f4;
}

.question-review-header {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: baseline;
}

.open-answer-review {
    margin-top: 12px;
}

/* AI Budget */
.usage-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.usage-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.usage-label {
    width: 80px;
    font-weight: 600;
    color: #2c3e50;
}

.usage-bar {
    flex: 1;
    height: 10px;
    background: #eef1f4;
    border-radius: 999px;
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #5a67d8);
}

.usage-meta {
    width: 160px;
    text-align: right;
    font-size: 12px;
    color: #777;
}

.usage-chart {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 12px;
    align-items: end;
}

.usage-bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.usage-bar-graph {
    width: 100%;
    height: 120px;
    background: #f0f3f8;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.usage-bar-fill-graph {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #667eea, #4c51bf);
}

.usage-bar-label {
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
}

.usage-bar-value {
    font-size: 11px;
    color: #777;
}

[data-no-copy]:not(input):not(textarea) {
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}

[data-allow-select] {
    user-select: text;
    -webkit-user-select: text;
    -ms-user-select: text;
}

[data-no-copy][data-allow-select] {
    user-select: text;
    -webkit-user-select: text;
    -ms-user-select: text;
}

[data-no-context] {
    -webkit-user-drag: none;
}

.statement-card {
    margin-bottom: 20px;
}

.statement-summary {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.statement-total {
    font-size: 16px;
    font-weight: 600;
    color: #1f2a44;
}

.statement-section {
    margin-bottom: 24px;
}

.statement-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}

.statement-input {
    width: 100%;
    min-height: 160px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #d6dbe3;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
    background: #fff;
}

.statement-input.is-readonly {
    background: #f5f6f8;
}

.warning-text {
    font-size: 12px;
    color: #b00020;
}

.statement-warning {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff5f5;
    color: #9b2c2c;
    font-size: 12px;
}

.change-preview {
    padding: 12px;
    background: #f7f8fb;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid #e4e7ef;
}

.change-preview h5 {
    margin-bottom: 8px;
}

.change-preview ins {
    background: #dcfce7;
    text-decoration: none;
}

.change-preview del {
    background: #fee2e2;
    text-decoration: line-through;
}

.comment-input {
    min-height: 100px;
}

.comment-helper {
    font-size: 13px;
    color: #555;
    margin-bottom: 12px;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.toggle input {
    accent-color: #2c3e50;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.page-actions {
    margin-bottom: 16px;
}

.assignment-edit-form {
    margin-top: 10px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
