:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --text: #1f2933;
    --muted: #616e7c;
    --border: #dde2e8;
    --primary: #1d5c63;
    --primary-hover: #164a50;
    --primary-soft: #e3f0f1;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --success: #1e7b45;
    --success-soft: #e6f4ec;
    --warning: #9a6700;
    --warning-soft: #fff4d6;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--primary); }

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }

/* Üst menü */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: .75rem 16px;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; margin-right: auto; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; align-items: center; }
.nav a {
    padding: .4rem .75rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--muted);
}
.nav a:hover, .nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav form { margin: 0; }
.user-name { color: var(--muted); font-size: .9rem; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px 3rem; }

/* Kart */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.card + .card { margin-top: 1rem; }

/* Giriş/kayıt sayfaları */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 16px; }
.auth-box { width: 100%; max-width: 420px; }
.auth-title { text-align: center; margin-bottom: 1.25rem; }
.auth-title .brand { display: block; font-size: 1.25rem; margin-bottom: .25rem; }
.auth-title p { margin: 0; color: var(--muted); }
.auth-links { text-align: center; margin-top: 1rem; font-size: .95rem; color: var(--muted); }

/* Form */
.field { margin-bottom: 1rem; }
label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], select, textarea {
    width: 100%;
    padding: .6rem .75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    background: #fff;
}
input:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.error { color: var(--danger); font-size: .875rem; margin-top: .25rem; }

.btn {
    display: inline-block;
    padding: .55rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.btn:hover { background: var(--primary-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: .3rem .7rem; font-size: .875rem; }
.btn-light { background: #fff; color: var(--text); border-color: var(--border); }
.btn-light:hover { background: var(--bg); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8f1c13; }
.btn-link { background: none; border: 0; color: var(--muted); padding: .4rem .75rem; cursor: pointer; font: inherit; }
.btn-link:hover { color: var(--primary); }

textarea { resize: vertical; min-height: 4.5rem; line-height: 1.5; }
.hint { color: var(--muted); font-size: .875rem; margin: -.5rem 0 1rem; }
.field .hint { margin: .3rem 0 0; }
.grid-2, .grid-3 { display: grid; gap: 0 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.narrow { max-width: 640px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.row-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.row-actions form { margin: 0; }
.inline-form { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.inline-form input { flex: 1 1 260px; }
.breadcrumb { color: var(--muted); font-size: .9rem; margin: 0 0 .5rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem 1.5rem; margin: 1rem 0 0; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; font-weight: 500; }
.danger-zone { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px dashed var(--border); }
.danger-text { color: var(--danger); }
tr.inactive td { opacity: .55; }
.nowrap { white-space: nowrap; }
.question .question-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .5rem; }
.points { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; margin: 0; }
.points input { width: 5.5rem; }
.question-tools { margin-top: .5rem; }

.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.info-box p { margin-top: 0; }
.info-box ul { margin: .5rem 0 0; padding-left: 1.2rem; }

/* Bölüm seçimi */
.choices { display: grid; gap: .5rem; }
.choice {
    display: flex; gap: .75rem; align-items: flex-start;
    padding: .75rem; border: 1px solid var(--border); border-radius: 8px;
    font-weight: 400; margin: 0; cursor: pointer;
}
.choice:hover { border-color: var(--primary); }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice input { margin-top: .25rem; width: 1.1rem; height: 1.1rem; flex: none; }
.choice.disabled, .choice.full { opacity: .55; cursor: not-allowed; }
.choice.disabled:hover, .choice.full:hover { border-color: var(--border); }
.choice-body { display: flex; flex-direction: column; gap: .15rem; }
.choice-meta { font-size: .9rem; color: var(--primary); font-weight: 600; }
.choice-range { font-size: .875rem; color: var(--muted); }
.choice-body .badge { align-self: flex-start; margin-top: .25rem; }

.sticky-bar {
    position: sticky; bottom: 0; z-index: 5;
    display: flex; gap: .75rem; align-items: center; justify-content: flex-end; flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: .75rem 1rem; margin-top: 1rem; box-shadow: 0 -4px 16px rgba(0,0,0,.05);
}
.sticky-bar > :first-child { margin-right: auto; }

/* Sınav ekranı */
.exam-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.exam-status { text-align: right; }
.timer { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary); }
.timer.warn { color: var(--danger); }
.question-body { white-space: normal; margin: 0 0 .75rem; font-size: 1.05rem; }

/* Puanlama */
.progress { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; margin: .5rem 0; }
.progress-bar { height: 100%; background: var(--success); }
.answer-box {
    background: var(--bg); border-left: 3px solid var(--primary);
    border-radius: 6px; padding: .75rem 1rem; margin-bottom: .75rem; white-space: normal;
}
.note-input { font-size: .9rem; }
.note { margin: .25rem 0 0; font-size: .95rem; color: var(--warning); }
.ok-text { color: var(--success); font-weight: 700; }
.danger-text { font-weight: 700; }

/* Analiz */
.rank {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2rem; height: 2rem; border-radius: 999px;
    background: var(--primary-soft); color: var(--primary); font-weight: 700;
}
.meter { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; min-width: 80px; margin-bottom: .2rem; }
.meter-bar { height: 100%; background: var(--primary); }
.meter-bar.low { background: var(--danger); }
details.card summary { cursor: pointer; }
details.card[open] summary { margin-bottom: .75rem; }
.question-stats td { vertical-align: top; }
.question-stats .q-no { width: 2rem; color: var(--muted); }
.question-stats .q-meter { width: 220px; }
.cell-label { display: none; color: var(--muted); }
@media (max-width: 700px) {
    .cell-label { display: inline; }
    .question-stats .q-meter { width: auto; }
}

/* Uyarılar */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--primary-soft); color: var(--primary); }

/* Tablo */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline; }

/* Sekmeler */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a {
    padding: .5rem .9rem;
    text-decoration: none;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.badge {
    display: inline-block;
    min-width: 1.4rem;
    padding: .05rem .45rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    text-align: center;
    background: var(--border);
    color: var(--text);
}
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stats > .card { margin-top: 0; }
.stat .label { color: var(--muted); font-size: .9rem; }
.stat .value { font-size: 1.75rem; font-weight: 700; }

.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 2rem 0; }
.pagination { margin-top: 1rem; }

@media (max-width: 700px) {
    .card { padding: 1rem; }
    table.responsive thead { display: none; }
    table.responsive tr { display: block; padding: .75rem 0; border-bottom: 1px solid var(--border); }
    table.responsive td { display: block; border: 0; padding: .1rem 0; }
    table.responsive td.actions { text-align: left; white-space: normal; padding-top: .5rem; }
}
