:root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1f232c;
    --border: #2a2f3a;
    --text: #e6e8ec;
    --muted: #9aa3b2;
    --accent: #8b5cf6;
    --accent-2: #a78bfa;
    --ok: #22c55e;
    --err: #ef4444;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
    line-height: 1.5;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.adm-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 20px;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.adm-brand { font-weight: 700; color: var(--accent-2); }
.adm-nav { display: flex; gap: 4px; flex: 1; }
.adm-nav a {
    padding: 8px 14px;
    border-radius: var(--radius);
    color: var(--muted);
}
.adm-nav a:hover { background: var(--surface-2); text-decoration: none; }
.adm-nav a.active { background: var(--accent); color: #fff; }
.adm-user { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--muted); }
.adm-logout { color: var(--err); }

.adm-main { max-width: 1000px; margin: 0 auto; padding: 28px 20px 60px; }

h1 { font-size: 24px; margin: 0 0 20px; }
h2 { font-size: 18px; margin: 28px 0 12px; }

.adm-flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 14px; }
.adm-flash-ok { background: rgba(34,197,94,.12); border: 1px solid var(--ok); color: #86efac; }
.adm-flash-err { background: rgba(239,68,68,.12); border: 1px solid var(--err); color: #fca5a5; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
.card .num { font-size: 30px; font-weight: 700; }
.card .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; }
.badge-pub { background: rgba(34,197,94,.15); color: #86efac; }
.badge-draft { background: rgba(154,163,178,.15); color: var(--muted); }

input, textarea, select {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
}
textarea { min-height: 360px; resize: vertical; font-family: ui-monospace, monospace; line-height: 1.6; }
label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 13px; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--accent); color: #fff; border: none;
    padding: 9px 16px; border-radius: var(--radius); cursor: pointer; font: inherit; font-weight: 600;
}
.btn:hover { background: var(--accent-2); text-decoration: none; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--err); }
.btn-sm { padding: 5px 10px; font-size: 13px; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-form { display: inline; }

/* Etiket içinde checkbox + açıklayıcı satır (chapter-edit, library quick-add). */
.checkline { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; margin: 14px 0 0; color: var(--text); font-size: 14px; }
.checkline input[type=checkbox] { width: auto; margin-top: 3px; flex: 0 0 auto; cursor: pointer; }
.checkline code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 12px; color: var(--accent-2); }
.checkline .muted { font-size: 13px; }

/* library.php — her kitabın altındaki "Bölüm ekle" açılır satırı. */
.quick-add-row > td { padding: 0; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.quick-add-row details { padding: 0; }
.quick-add-row summary { padding: 8px 14px; cursor: pointer; color: var(--accent-2); font-size: 13px; user-select: none; list-style: none; }
.quick-add-row summary::-webkit-details-marker { display: none; }
.quick-add-row summary::before { content: "▸ "; display: inline-block; transition: transform .15s; }
.quick-add-row details[open] summary::before { content: "▾ "; }
.quick-add-row summary:hover { background: rgba(167,139,250,.08); }
.quick-add-body { padding: 6px 16px 18px; }
.quick-add-body label { margin: 10px 0 4px; }
.quick-add-body textarea { min-height: 180px; }
.quick-add-bottom { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 14px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.field { max-width: 520px; }
form.stack { max-width: 760px; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; }
.login-box h1 { text-align: center; font-size: 20px; }
