:root {
    color-scheme: light;
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #101828;
    --text: #344054;
    --muted: #667085;
    --line: #e4e7ec;
    --line-strong: #cbd5e1;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --brand-soft: #ccfbf1;
    --accent: #2563eb;
    --ok: #047857;
    --danger: #b42318;
    --danger-soft: #fef3f2;
    --shadow: 0 14px 34px rgba(16, 24, 40, 0.08);
    --radius: 8px;
}

/* ── Toast Bildirimi ────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 480px;
    padding: 13px 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(16, 24, 40, 0.14);
    font-size: 14px;
    font-weight: 700;
    pointer-events: auto;
    animation: toast-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.toast.toast-success {
    color: #14532d;
    background: #f0fdf4;
    border-color: #86efac;
}

.toast.toast-error {
    color: #7f1d1d;
    background: #fef2f2;
    border-color: #fca5a5;
}

.toast.toast-out {
    animation: toast-out 0.22s ease forwards;
}

.toast-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.toast-success .toast-icon {
    background: #16a34a;
    color: #fff;
}

.toast-error .toast-icon {
    background: #dc2626;
    color: #fff;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.96);
    }
}
/* ── /Toast ─────────────────────────────────────────────────── */

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(180deg, #eef6f5 0, rgba(238, 246, 245, 0) 260px),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    color: var(--brand-dark);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 68px;
    padding: 12px max(22px, calc((100vw - 1180px) / 2));
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(228, 231, 236, 0.9);
    backdrop-filter: blur(14px);
}

.topbar strong {
    display: block;
    color: var(--ink);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0;
}

.topbar span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 13px;
}

.topbar nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.topbar nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 11px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
}

.topbar nav a:hover {
    color: var(--brand-dark);
    border-color: #99f6e4;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 26px auto;
}

.shell.narrow {
    width: min(720px, calc(100% - 32px));
}

.two-col {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.panel {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

.panel h1,
.panel h2 {
    margin: 0 0 18px;
    color: var(--ink);
    font-weight: 800;
    line-height: 1.2;
}

.panel h1 {
    font-size: 24px;
}

.panel h2 {
    font-size: 19px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

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

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

.grid-2,
.grid-3,
.reader-grid {
    display: grid;
    gap: 12px;
}

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

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

.reader-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 16px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--text);
    font-size: 13px;
    font-weight: 750;
}

input,
select {
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 8px 11px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    outline: none;
    font: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    min-width: 0;
    padding: 8px 14px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.button:hover {
    color: var(--ink);
    background: var(--surface-soft);
    transform: translateY(-1px);
}

.button.primary {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
}

.button.primary:hover {
    color: #fff;
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.button.danger {
    color: var(--danger);
    background: #fff;
    border-color: #fecdca;
}

.button.danger:hover {
    color: #fff;
    background: var(--danger);
    border-color: var(--danger);
}

.button.small {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 13px;
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.notice {
    margin: 14px 0;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-weight: 750;
}

.notice.success {
    color: var(--ok);
    background: #ecfdf3;
    border-color: #abefc6;
}

.notice.danger {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #fecdca;
}

.config-list {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 8px 12px;
    margin: 18px 0;
    padding: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.config-list dt {
    color: var(--muted);
}

.config-list dd {
    margin: 0;
    color: var(--ink);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.exam-list {
    display: grid;
    gap: 10px;
}

.exam-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.exam-card h3 {
    margin: 0 0 4px;
    color: var(--ink);
    font-size: 16px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.exam-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.exam-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.scan-canvas {
    display: block;
    width: 100%;
    max-height: 460px;
    object-fit: contain;
    background:
        linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
        linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
        linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
    background-color: #fff;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
}

.answer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
}

.answer-key-shell {
    width: min(1320px, calc(100% - 32px));
}

.answer-key-panel {
    display: grid;
    gap: 16px;
}

.answer-key-panel .panel-head {
    margin-bottom: 0;
}

.answer-key-panel .panel-head p {
    margin: 5px 0 0;
}

.key-tabs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.key-tabs button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
}

.key-tabs button.active {
    color: #fff;
    background: #16a34a;
    border-color: #15803d;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.16);
}

.key-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.key-summary strong {
    color: var(--ink);
    font-size: 15px;
}

.key-summary span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.key-form-grid {
    overflow-x: auto;
    padding: 14px;
    background: #eef2f6;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.key-column-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
    align-items: start;
}

.key-section-column {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
}

.key-section-column .key-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    padding: 10px 12px;
    color: var(--ink);
    background: #f8fafc;
    border: 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    text-align: left;
}

.key-section-column .key-section-title strong {
    font-size: 13px;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.key-section-column .key-section-title span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.key-section-questions {
    display: grid;
    gap: 1px;
    padding: 8px;
    background: #e5eaf0;
}

.key-omr-stage {
    display: flex;
    justify-content: center;
    min-width: max-content;
}

.key-paper {
    position: relative;
    width: 210mm;
    min-height: 297mm;
    padding: 10mm;
    background: #fff;
    box-shadow: 0 12px 30px rgba(16, 24, 40, 0.2);
    box-sizing: border-box;
    font-family: Inter, Arial, sans-serif;
}

.key-paper.a5 {
    width: 148mm;
    min-height: 210mm;
}

.key-paper.a6 {
    width: 105mm;
    min-height: 148mm;
    padding: 6mm;
}

.key-form-content {
    display: flex;
    flex-direction: column;
    min-height: calc(297mm - 20mm);
    height: 100%;
    padding: 5mm;
    border: 2px solid #000;
}

.key-paper.a5 .key-form-content {
    min-height: calc(210mm - 20mm);
}

.key-paper.a6 .key-form-content {
    min-height: calc(148mm - 12mm);
}

.key-omr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1mm;
    padding-bottom: 1mm;
    border-bottom: 1px solid #000;
}

.key-header-left,
.key-header-right {
    flex: 1;
    font-size: 10px;
    font-weight: 800;
}

.key-header-right {
    text-align: right;
}

.key-header-center {
    flex: 2;
    text-align: center;
    font-size: 13px;
    font-weight: 900;
}

.key-student-info-section {
    display: flex;
    gap: 3mm;
    margin-bottom: 2mm;
}

.key-info-box {
    flex: 1.2;
    padding: 3mm;
    border: 1px solid #000;
}

.key-info-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 2mm;
    font-size: 9px;
}

.key-info-row span {
    margin-bottom: 1mm;
}

.key-write-line {
    width: 100%;
    height: 3mm;
    border-bottom: 1px dotted #666;
}

.key-coding-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5mm;
    border: 1px solid #000;
}

.key-group-area {
    align-self: flex-start;
}

.key-coding-title {
    margin-bottom: 1.5mm;
    font-size: 9px;
    font-weight: 900;
}

.key-coding-grid {
    display: flex;
    gap: 0.8mm;
}

.key-coding-col {
    display: flex;
    flex-direction: column;
    gap: 0.8mm;
}

.key-write-box {
    width: 3.5mm;
    height: 3.8mm;
    margin-bottom: 0.8mm;
    border: 1px solid #000;
}

.key-student-number-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #000;
    border-radius: 999px;
    background: #fff;
    color: #111;
}

.key-student-number-bubble {
    width: 3.2mm;
    height: 3.2mm;
    font-size: 6px;
}

.key-group-bubbles {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5mm;
}

.key-questions-area {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2mm;
}

.key-paper.a5 .key-questions-area {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.key-paper.a6 .key-questions-area {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.key-question-col {
    display: flex;
    flex-direction: column;
}

.key-section-title {
    margin-bottom: 1.5mm;
    padding: 1mm 0;
    background: #eee;
    border: 1px solid #000;
    font-size: 10px;
    font-weight: 900;
    text-align: center;
}

.key-q-row {
    display: flex;
    align-items: center;
    min-height: 36px;
    margin-bottom: 0;
    padding: 5px 8px;
    background: #fff;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.12s ease;
}

.key-q-row.has-selection {
    background: #f0fdf4;
    border-left: 3px solid #16a34a;
    padding-left: 5px;
}

.key-q-row.has-selection .key-q-num {
    color: #15803d;
    font-weight: 900;
}

.key-q-num {
    width: 32px;
    margin-right: 8px;
    text-align: right;
    font-weight: 900;
}

.key-answer-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-right: 4px;
    padding: 0;
    color: #374151;
    background: #fff;
    border: 1.5px solid #9ca3af;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.key-answer-bubble:hover {
    background: #f0fdf4;
    border-color: #16a34a;
    color: #15803d;
}

.key-answer-bubble.active,
.key-answer-bubble.is-selected,
.key-answer-bubble[data-selected="true"] {
    color: #fff !important;
    background: #16a34a !important;
    border-color: #15803d !important;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.28) !important;
    transform: scale(1.1);
    font-weight: 900;
}

.key-answer-bubble.selected-group {
    color: #fff;
    background: var(--brand);
    border-color: #000;
}

.key-section {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.key-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 11px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--line);
}

.key-section-head strong {
    color: var(--ink);
    font-size: 13px;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.key-section-head span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.key-question-list {
    display: grid;
    gap: 1px;
    padding: 8px;
    background: #eef2f6;
}

.key-question {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 5px 7px;
    background: #fff;
}

.key-question > strong {
    color: var(--text);
    font-size: 13px;
    text-align: right;
}

.key-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.key-options button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    color: var(--text);
    background: #fff;
    border: 1px solid #aebccc;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
}

.key-options button.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.answer-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
}

.answer-item strong {
    color: var(--text);
    font-size: 13px;
}

.answer-options {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.answer-options button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 29px;
    height: 29px;
    color: var(--text);
    background: #fff;
    border: 1px solid #bdc7d4;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.answer-options button.active {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
}

.print-body {
    background: #d9e0e8;
}

.print-actions {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px;
    background: rgba(246, 248, 251, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.omr-page {
    position: relative;
    width: 794px;
    height: 1123px;
    margin: 24px auto 28px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(20, 31, 43, 0.18);
    overflow: hidden;
}

.marker {
    position: absolute;
    display: block;
    background: #111;
}

.compact-omr {
    font-family: Arial, Helvetica, sans-serif;
}

.form-info-box {
    position: absolute;
    left: 112px;
    top: 36px;
    width: 570px;
    height: 108px;
    border: 1.5px solid #222;
    font-size: 18px;
}

.form-info-box div {
    height: 36px;
    padding: 6px 12px;
    border-bottom: 1.5px solid #222;
}

.form-info-box div:last-child {
    border-bottom: 0;
}

.identity-code-box {
    position: absolute;
    left: 104px;
    top: 178px;
    width: 132px;
    min-height: 236px;
    padding: 10px 8px;
    display: grid;
    align-content: start;
    gap: 12px;
    border: 1.5px solid #222;
    font-size: 13px;
    text-align: center;
}

.identity-code-box .group-code,
.identity-code-box .student-no-code {
    display: grid;
    gap: 8px;
    justify-items: center;
}

.identity-code-box .code-row {
    justify-content: center;
}

.identity-code-box .digit-grid {
    width: 100%;
    gap: 4px;
}

.identity-code-box .digit-grid span,
.identity-code-box .code-row span {
    width: 15px;
    height: 15px;
    font-size: 9px;
}

.identity-code-box.no-group {
    align-content: center;
}

.section-header {
    position: absolute;
    display: grid;
    justify-items: center;
    gap: 1px;
    min-height: 34px;
    font-size: 12px;
    line-height: 1.15;
    text-align: center;
}

.section-header strong {
    font-size: 13px;
}

.section-header span {
    font-size: 9px;
}

.section-header em {
    margin-top: 2px;
    font-style: normal;
    font-size: 11px;
    word-spacing: 9px;
}

.form-title {
    position: absolute;
    left: 90px;
    top: 34px;
    width: 610px;
    text-align: center;
}

.form-title h1 {
    margin: 0 0 7px;
    font-size: 26px;
}

.form-title p {
    margin: 0 0 7px;
    font-size: 15px;
}

.student-box {
    position: absolute;
    left: 70px;
    top: 96px;
    display: grid;
    grid-template-columns: 160px 280px 120px;
    gap: 14px;
    font-size: 14px;
}

.student-box div {
    border-bottom: 1px solid #111;
    padding-bottom: 10px;
}

.question-row {
    position: absolute;
    height: 18px;
    font-size: 11px;
}

.qno {
    position: absolute;
    left: 0;
    top: -6px;
    width: 26px;
    text-align: right;
    font-weight: 700;
}

.bubble,
.bubble-label {
    position: absolute;
}

.bubble {
    border: 1.5px solid #111;
    border-radius: 999px;
}

.bubble-label {
    display: none;
    top: 8px;
    width: 14px;
    text-align: center;
    font-size: 8px;
}

.designer-layout {
    grid-template-columns: minmax(360px, 620px) minmax(320px, 1fr);
}

.designer-panel {
    display: grid;
    gap: 22px;
}

.panel-head.compact {
    margin-bottom: 10px;
}

.panel-head.compact h2 {
    font-size: 16px;
}

.section-builder,
.section-list {
    display: grid;
    gap: 10px;
}

.section-card {
    display: grid;
    gap: 12px;
    padding: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.section-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.preview-wrap {
    display: grid;
    gap: 10px;
}

.preview-paper {
    position: relative;
    width: 100%;
    max-width: 430px;
    aspect-ratio: 794 / 1123;
    margin: 0 auto;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(16, 24, 40, 0.12);
    font-size: 10px;
}

.preview-svg {
    display: block;
    width: 100%;
    height: 100%;
}

.preview-actions {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.mini-head {
    position: absolute;
    left: 12%;
    top: 4%;
    width: 76%;
    text-align: center;
}

.mini-head h3 {
    margin: 8px 0 2px;
    font-size: 16px;
    line-height: 1.15;
}

.mini-head p {
    margin: 0;
    color: var(--muted);
}

.mini-line {
    padding-bottom: 7px;
    border-bottom: 1px solid #111;
    text-align: left;
}

.mini-meta {
    position: absolute;
    left: 8%;
    top: 16%;
    right: 8%;
    display: grid;
    grid-template-columns: 95px 1fr;
    gap: 14px;
}

.mini-meta strong,
.mini-sections strong {
    display: block;
    margin-bottom: 4px;
    font-size: 9px;
}

.mini-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    margin: 0 3px 3px 0;
    border: 1px solid #111;
    border-radius: 999px;
    vertical-align: middle;
}

.mini-bubble span {
    transform: translateY(10px);
    font-size: 6px;
}

.mini-digits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18px, 1fr));
    gap: 4px;
}

.mini-digit {
    display: grid;
    justify-items: center;
}

.mini-digit strong {
    margin-bottom: 2px;
}

.mini-sections {
    position: absolute;
    left: 8%;
    top: 32%;
    right: 8%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 12px;
    padding: 8px;
    border: 1px solid #111;
}

.mini-sections span {
    display: block;
    color: var(--muted);
    font-size: 8px;
}

.mini-questions {
    position: absolute;
    left: 7%;
    right: 7%;
    top: 45%;
    bottom: 6%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 8px;
}

.mini-question-col {
    display: grid;
    align-content: start;
    gap: 5px;
}

.mini-question {
    display: grid;
    grid-template-columns: 18px 1fr;
    align-items: center;
    gap: 4px;
}

.mini-question strong {
    text-align: right;
    font-size: 8px;
}

.student-name-line {
    margin: 0 auto 12px;
    padding-bottom: 10px;
    width: 440px;
    border-bottom: 1px solid #111;
    text-align: left;
    font-size: 14px;
}

.coding-strip {
    position: absolute;
    left: 70px;
    top: 122px;
    right: 70px;
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 22px;
    font-size: 14px;
}

.group-code,
.student-no-code {
    display: grid;
    gap: 8px;
}

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

.code-row span,
.digit-grid span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 1.5px solid #111;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
}

.digit-grid {
    display: grid;
    gap: 8px;
}

.digit-grid div {
    display: grid;
    justify-items: center;
    gap: 4px;
}

.digit-grid em {
    font-style: normal;
    font-size: 10px;
    font-weight: 700;
}

.form-sections {
    position: absolute;
    left: 70px;
    top: 236px;
    right: 70px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 18px;
    padding: 10px;
    border: 1px solid #111;
    font-size: 11px;
}

.form-sections div {
    display: grid;
    gap: 2px;
}

.form-sections span {
    color: #333;
}

@media (max-width: 900px) {
    .topbar {
        position: static;
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 18px;
    }

    .shell {
        width: min(100% - 24px, 720px);
        margin: 18px auto;
    }

    .two-col,
    .designer-layout,
    .grid-2,
    .grid-3,
    .reader-grid {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 18px;
    }

    .panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel-head .button {
        width: 100%;
    }

    .exam-card {
        grid-template-columns: 1fr;
    }

    .exam-actions {
        justify-content: stretch;
    }

    .exam-actions .button {
        flex: 1 1 92px;
    }

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

    .section-card-head {
        grid-template-columns: 1fr;
    }

    .preview-paper {
        max-width: 100%;
    }

    .mini-meta,
    .mini-sections {
        grid-template-columns: 1fr;
    }

    .mini-sections {
        top: 36%;
    }

    .mini-questions {
        top: 52%;
    }
}

@media (max-width: 520px) {
    body {
        font-size: 14px;
    }

    .topbar nav {
        width: 100%;
    }

    .topbar nav a {
        flex: 1 1 auto;
    }

    .panel h1 {
        font-size: 21px;
    }

    .config-list {
        grid-template-columns: 1fr;
    }

    .button {
        width: 100%;
    }

    .print-actions .button {
        width: auto;
    }
}

@media print {
    .print-actions {
        display: none;
    }

    body,
    .print-body {
        background: #fff;
    }

    .omr-page {
        margin: 0;
        box-shadow: none;
    }
}

/* ── Öğrenci Yönetimi ───────────────────────────────────────── */
.students-shell {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    width: min(1280px, calc(100% - 32px));
}

.students-sidebar {
    display: grid;
    gap: 16px;
}

.students-list-panel {
    display: grid;
    gap: 14px;
}

.form-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.search-input {
    height: 36px;
    min-width: 200px;
    padding: 6px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    font: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    width: auto;
}

.search-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.class-filter {
    height: 36px;
    width: auto;
    min-width: 130px;
    padding: 6px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    color: #fff;
    background: var(--brand);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    vertical-align: middle;
    margin-left: 6px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.students-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.students-table thead tr {
    background: var(--surface-soft);
    border-bottom: 2px solid var(--line);
}

.students-table th {
    padding: 10px 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: left;
    white-space: nowrap;
}

.students-table tbody tr {
    border-bottom: 1px solid var(--line);
    transition: background 0.1s;
}

.students-table tbody tr:last-child {
    border-bottom: none;
}

.students-table tbody tr:hover {
    background: #f8fafc;
}

.students-table td {
    padding: 9px 12px;
    color: var(--ink);
    vertical-align: middle;
}

.students-table .col-check {
    width: 36px;
    text-align: center;
}

.students-table .col-actions {
    width: 140px;
    white-space: nowrap;
}

.students-table .col-actions {
    display: flex;
    gap: 6px;
    padding: 7px 10px;
}

.students-table .cell-no {
    font-weight: 800;
    color: var(--brand);
}

.students-table .cell-notes {
    color: var(--muted);
    font-size: 12px;
}

.table-empty {
    padding: 32px !important;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

.csv-textarea {
    display: block;
    width: 100%;
    min-height: 110px;
    padding: 9px 11px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    font: inherit;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}

.csv-textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

@media (max-width: 860px) {
    .students-shell {
        grid-template-columns: 1fr;
    }
}
/* ── /Öğrenci Yönetimi ──────────────────────────────────────── */

/* ── OMR Okuyucu ────────────────────────────────────────────── */
.omr-shell {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    width: min(1300px, calc(100% - 32px));
}

.omr-sidebar {
    display: grid;
    gap: 16px;
}

.omr-camera-panel {
    display: grid;
    gap: 12px;
}

.camera-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #111;
    border-radius: 8px;
    overflow: hidden;
}

.camera-viewport video {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-viewport canvas {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.camera-hint {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #94a3b8;
}

.camera-hint span { font-size: 48px; }

.camera-hint p {
    margin: 0;
    font-size: 13px;
    text-align: center;
    padding: 0 16px;
}

.camera-status {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    transition: background 0.2s;
}

.camera-status--scanning { background: rgba(245,158,11,0.88); color: #fff; }
.camera-status--ok       { background: rgba(22,163,74,0.88);  color: #fff; }
.camera-status--error    { background: rgba(220,38,38,0.88);  color: #fff; }

.omr-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.omr-divider::before,
.omr-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
}

.photo-upload-label {
    display: block;
    text-align: center;
    cursor: pointer;
}

.photo-upload-label .button {
    width: 100%;
}

/* Cevap paneli */
.omr-answers-panel {
    display: grid;
    gap: 12px;
}

.omr-stats {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.omr-answer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.omr-section-block {
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    overflow: hidden;
}

.omr-section-label {
    padding: 7px 10px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
    font-weight: 900;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.omr-row {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    gap: 6px;
    border-bottom: 1px solid #f1f5f9;
}

.omr-row:last-child { border-bottom: none; }

.omr-qnum {
    width: 26px;
    text-align: right;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    flex-shrink: 0;
}

.omr-opts {
    display: flex;
    gap: 4px;
}

.omr-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1.5px solid #9ca3af;
    border-radius: 50%;
    background: #fff;
    color: #374151;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.12s;
}

.omr-bubble:hover {
    border-color: var(--brand);
    background: #f0fdf4;
    color: var(--brand);
}

.omr-bubble.omr-sel {
    background: #16a34a;
    border-color: #15803d;
    color: #fff;
    transform: scale(1.08);
}

.omr-bubble.omr-double {
    background: #fef2f2;
    border-color: #dc2626;
    color: #dc2626;
}

.student-lookup-result {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
}

.student-lookup-result.found {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #86efac;
}

.student-lookup-result.not-found {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

@media (max-width: 900px) {
    .omr-shell {
        grid-template-columns: 1fr;
    }
}
/* ── /OMR Okuyucu ───────────────────────────────────────────── */

/* ── Sonuç Sayfası ──────────────────────────────────────────── */
.results-shell {
    display: grid;
    gap: 16px;
    width: min(1400px, calc(100% - 32px));
}

.results-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    gap: 4px;
}

.stat-val { font-size: 28px; font-weight: 900; color: var(--ink); line-height: 1; }
.stat-lbl { font-size: 12px; color: var(--muted); font-weight: 700; text-align: center; }
.stat-card--ok .stat-val     { color: #16a34a; }
.stat-card--danger .stat-val { color: #dc2626; }

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

.results-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    align-items: start;
}

.results-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.results-table thead tr { background: var(--surface-soft); border-bottom: 2px solid var(--line); }
.results-table th { padding: 9px 10px; color: var(--muted); font-size: 11px; font-weight: 800; text-align: left; white-space: nowrap; }
.results-table tbody tr { border-bottom: 1px solid var(--line); transition: background 0.1s; }
.results-table tbody tr:last-child { border-bottom: none; }
.results-table tbody tr:hover { background: #f8fafc; }
.results-table td { padding: 8px 10px; vertical-align: middle; }
.results-table .col-check { width: 32px; text-align: center; }
.results-table .col-num   { text-align: center; font-weight: 800; }

.cell-no     { font-weight: 800; color: var(--brand); }
.score-ok    { color: #16a34a; }
.score-wrong { color: #dc2626; }
.score-blank { color: var(--muted); }
.score-total { color: var(--ink); font-size: 14px !important; }

.group-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; background: var(--brand-soft);
    color: var(--brand-dark); border-radius: 6px; font-size: 11px; font-weight: 900;
}

.analysis-grid { display: grid; gap: 5px; max-height: 520px; overflow-y: auto; }
.analysis-row {
    display: grid;
    grid-template-columns: 28px 1fr 36px 70px;
    align-items: center; gap: 6px; font-size: 12px;
}
.analysis-qno { text-align: right; font-weight: 800; color: var(--muted); }
.analysis-bar-wrap { background: #e5e7eb; border-radius: 4px; height: 10px; overflow: hidden; }
.analysis-bar { height: 100%; border-radius: 4px; }
.bar-ok  { background: #16a34a; }
.bar-mid { background: #f59e0b; }
.bar-low { background: #dc2626; }
.analysis-pct    { font-weight: 800; color: var(--ink); }
.analysis-detail { font-size: 11px; white-space: nowrap; }

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    z-index: 1000; display: flex; align-items: center;
    justify-content: center; padding: 16px;
}
.modal-box {
    background: #fff; border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    max-width: 560px; width: 100%; max-height: 80vh;
    display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { overflow-y: auto; padding: 14px 18px; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
.detail-row {
    display: flex; flex-direction: column; align-items: center;
    padding: 8px 6px; border-radius: 7px; font-size: 12px; font-weight: 700; gap: 2px;
}
.detail-qno  { color: var(--muted); font-size: 11px; }
.detail-ans  { font-size: 16px; font-weight: 900; }
.detail-icon { font-size: 14px; }
.detail-key  { font-size: 11px; color: var(--muted); }
.detail-ok    { background: #f0fdf4; }
.detail-ok .detail-ans  { color: #16a34a; }
.detail-ok .detail-icon { color: #16a34a; }
.detail-wrong { background: #fef2f2; }
.detail-wrong .detail-ans  { color: #dc2626; }
.detail-wrong .detail-icon { color: #dc2626; }
.detail-blank { background: #f8fafc; }
.detail-blank .detail-ans { color: var(--muted); }

@media (max-width: 960px) {
    .results-main-grid { grid-template-columns: 1fr; }
}
/* ── /Sonuç Sayfası ─────────────────────────────────────────── */

/* ── OMR Onay Modalı ────────────────────────────────────────── */
.omr-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 12px;
}

.omr-modal-box {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.4);
    width: min(960px, 100%);
    max-height: calc(100vh - 24px);
    overflow: hidden;
}

.omr-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.omr-modal-head h3 { margin: 0; font-size: 17px; }

.omr-modal-canvas-wrap {
    flex: 1;
    overflow: auto;
    background: #e5e7eb;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12px;
}

.omr-modal-canvas-wrap canvas {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
/* ── /OMR Onay Modalı ───────────────────────────────────────── */

/* ── Tespit Edilen Meta ─────────────────────────────────────── */
.detected-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 10px;
}

.detected-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.detected-meta-lbl {
    color: var(--muted);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
}

.omr-hint-txt {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.5;
    margin: 0 0 10px;
}

.omr-hint-txt a { color: var(--brand-dark); font-weight: 700; }

.prefill-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 18px;
    align-items: start;
}

.prefill-controls {
    grid-column: 1 / -1;
}

.prefill-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.7fr 1fr;
    gap: 12px;
}

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

.prefill-preview-panel {
    position: sticky;
    top: 82px;
}

.prefill-preview-wrap {
    max-height: calc(100vh - 190px);
    overflow: auto;
    display: flex;
    justify-content: center;
    padding: 18px;
    background: #94a3b8;
    border-radius: 8px;
}

.prefill-preview-wrap .paper {
    transform: scale(0.45);
    transform-origin: top center;
    margin-bottom: -610px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
}

.prefill-text {
    font-weight: 800;
    font-size: 11px;
    line-height: 1;
    padding-left: 2mm;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prefill-digit-box {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 8px;
}

.student-number-bubble.prefill-marked {
    background: #111;
    color: #111;
    box-shadow: inset 0 0 0 0.55mm #111;
}

.prefill-print-stage {
    position: fixed;
    left: -10000px;
    top: 0;
    width: 230mm;
    min-height: 320mm;
    background: #fff;
    pointer-events: none;
}

.prefill-print-stage .paper {
    box-shadow: none;
    transform: none;
}

@media (max-width: 1100px) {
    .prefill-shell {
        grid-template-columns: 1fr;
    }

    .prefill-preview-panel {
        position: static;
    }

    .prefill-grid {
        grid-template-columns: 1fr;
    }
}
/* ── /Tespit Edilen Meta ────────────────────────────────────── */
