/* Bravo Kids yönetim paneli — sade, kurumsal arayüz. Açık (gündüz) ve koyu (gece) tema.
   Renkler değişkenlerde durur; tema, <html data-theme="light|dark"> ile seçilir (js/theme.js). */
:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f2f4f7;
  --line: #e4e7ec;
  --text: #101828;
  --muted: #475467;
  --faint: #98a2b3;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --accent-text: #1d4ed8;
  --on-accent: #ffffff;
  --ok: #16a34a;
  --ok-bg: #dcfce7;
  --ok-text: #166534;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --info-bg: #e0f2fe;
  --info-text: #075985;
  --hover: rgba(16, 24, 40, 0.04);
  --overlay: rgba(16, 24, 40, 0.5);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 12px 32px rgba(16, 24, 40, 0.12);
  --radius: 12px;
  --sidebar: 248px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d12;
  --bg-2: #0f1218;
  --panel: #12151c;
  --panel-2: #1a1e28;
  --line: #232834;
  --text: #e6e8ee;
  --muted: #9aa3b5;
  --faint: #6b7488;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --accent-text: #93c5fd;
  --on-accent: #ffffff;
  --ok: #22c55e;
  --ok-bg: rgba(34, 197, 94, 0.16);
  --ok-text: #86efac;
  --warn-bg: rgba(245, 158, 11, 0.16);
  --warn-text: #fcd34d;
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.16);
  --danger-text: #fca5a5;
  --info-bg: rgba(56, 189, 248, 0.14);
  --info-text: #7dd3fc;
  --hover: rgba(255, 255, 255, 0.04);
  --overlay: rgba(0, 0, 0, 0.65);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
svg.icon { width: 18px; height: 18px; flex: none; }

/* ---------- Giriş / tam ekran kartlar ---------- */
.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 34px 30px; box-shadow: var(--shadow); text-align: center; }
.auth-card .logo { width: 44px; height: 44px; margin: 0 auto 18px; border-radius: 12px; background: var(--text); color: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.auth-card h1 { font-size: 20px; font-weight: 700; }
.auth-card p.lead { color: var(--muted); margin: 6px 0 24px; }
.auth-card form { text-align: left; }
.auth-card .btn { width: 100%; margin-top: 6px; padding: 11px 16px; }
.auth-card .linklike { display: block; margin: 18px auto 0; background: none; border: 0; color: var(--muted); font-size: 13px; text-decoration: underline; }
.auth-card .theme-corner { position: fixed; top: 16px; right: 16px; }
.msg { margin-top: 10px; font-size: 13px; min-height: 18px; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }

/* ---------- Kabuk ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; overflow-y: auto; z-index: 40; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 16px; }
.brand .mark { width: 32px; height: 32px; border-radius: 9px; background: var(--text); color: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: none; }
.brand b { display: block; font-size: 14px; line-height: 1.2; }
.brand span { color: var(--faint); font-size: 12px; }
.nav-group { margin-top: 18px; }
.nav-title { padding: 0 10px 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--muted); text-align: left; text-decoration: none; font-weight: 500; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-item.soon { opacity: .55; cursor: default; }
.nav-item.soon:hover { background: none; color: var(--muted); }
.nav-item .tag { margin-left: auto; font-size: 10px; padding: 1px 7px; border-radius: 999px; background: var(--panel-2); color: var(--faint); font-weight: 600; }
.sidebar .grow { flex: 1; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 16px; border-radius: 10px; border: 1px solid var(--line); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--muted); flex: none; text-transform: uppercase; }
.user-card .who { min-width: 0; flex: 1; }
.user-card .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card .who span { color: var(--faint); font-size: 12px; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; }
.icon-btn:hover { background: var(--hover); color: var(--text); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 28px; background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 16px; font-weight: 700; }
.topbar .crumb { color: var(--faint); font-size: 12px; display: block; line-height: 1.1; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.page { padding: 28px; width: 100%; max-width: 1320px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.page-head p { color: var(--muted); margin-top: 2px; }
.scrim { display: none; }

/* ---------- Bileşenler ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 14px; font-weight: 600; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); margin-bottom: 22px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stat-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.stat-card .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); flex: none; }
.stat-card .ico.ok { background: var(--ok-bg); color: var(--ok-text); }
.stat-card .ico.warn { background: var(--warn-bg); color: var(--warn-text); }
.stat-card .ico.info { background: var(--info-bg); color: var(--info-text); }
.stat-card b { display: block; font-size: 22px; font-weight: 700; line-height: 1.15; }
.stat-card span { color: var(--muted); font-size: 12.5px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 600; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--accent-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 7px; }

.input, .select, textarea.input { width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.input:focus, .select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.input::placeholder { color: var(--faint); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--faint); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.toolbar .search { position: relative; flex: 1 1 240px; max-width: 360px; }
.toolbar .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.toolbar .search .input { padding-left: 36px; }
.toolbar .select { width: auto; min-width: 130px; }
.toolbar .count { margin-left: auto; color: var(--muted); font-size: 13px; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { position: sticky; top: 0; text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--hover); }
.table .nowrap { white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table .strong { font-weight: 600; }
.table .sub { color: var(--faint); font-size: 12px; }
.table code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); background: var(--panel-2); padding: 1px 6px; border-radius: 5px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok-text); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.badge.danger { background: var(--danger-bg); color: var(--danger-text); }
.badge.info { background: var(--info-bg); color: var(--info-text); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; vertical-align: middle; margin-right: 8px; }

.switch { position: relative; width: 38px; height: 22px; display: inline-block; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: .15s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:disabled + i { opacity: .5; }

.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty .ico { width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 12px; background: var(--panel-2); display: grid; place-items: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--panel-2), var(--line), var(--panel-2)); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.loading { padding: 28px 20px; display: grid; gap: 14px; }
.notice { display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--info-bg); color: var(--info-text); }
.notice.warn { background: var(--warn-bg); color: var(--warn-text); }
.notice.err { background: var(--danger-bg); color: var(--danger-text); }
.list { display: grid; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .sub { color: var(--faint); font-size: 12px; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.tick { color: var(--ok); font-weight: 800; }
.dash { color: var(--faint); }

/* ---------- Pencere (modal) ve bildirim ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: var(--overlay); display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
pre.json { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow: auto; max-height: 360px; font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-word; }
.radio-card { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--panel); }
.radio-card + .radio-card { margin-top: 10px; }
.radio-card input { accent-color: var(--accent); margin-top: 4px; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card b { display: block; }
.radio-card span { color: var(--muted); font-size: 12.5px; }
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 10px; }
.toast { min-width: 240px; max-width: 380px; padding: 11px 14px; border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; animation: toast-in .18s ease-out; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 35; }
  .menu-btn { display: grid; }
  .topbar { padding: 0 14px; }
  .page { padding: 18px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .toolbar .count { margin-left: 0; width: 100%; }
}

/* ---------- Bölüm içi gezinme: sekmeler ve kategori listesi ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; }
.tabs .tab { background: none; border: 0; padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs .tab:hover { color: var(--text); }
.tabs .tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tabs .tab .n { margin-left: 8px; font-size: 12px; color: var(--faint); font-weight: 600; }
.split { display: grid; grid-template-columns: 240px 1fr; }
.split-main { min-width: 0; }
.rail { border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; align-self: stretch; }
.rail-title { padding: 2px 10px 8px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.rail-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--muted); text-align: left; }
.rail-item:hover { background: var(--hover); color: var(--text); }
.rail-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.rail-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item .n { font-size: 12px; color: var(--faint); font-weight: 600; }
.rail-item.dim { opacity: .55; }
.rail-item.warn .label { color: var(--warn-text); }
.rail-sep { height: 1px; background: var(--line); margin: 8px 10px; }
.card-note { padding: 12px 20px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; gap: 6px; padding: 12px; }
  .rail-title, .rail-sep { display: none; }
  .rail-item { width: auto; border: 1px solid var(--line); }
}

.rail-host { display: contents; }
