:root {
  --bg: #f4f4f8; --panel: #fff; --side: #1e1b3a; --side-2: #2b2752; --side-text: #cfcbe8;
  --text: #1d1c24; --muted: #6b6a78; --line: #e6e5ec; --accent: #4f46e5; --accent-soft: #eef0ff;
  --green: #16a34a; --red: #dc2626; --amber: #d97706;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn { border: 1px solid var(--line); background: #fff; padding: 7px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: #c9c7d6; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn.ghost { background: transparent; }
.btn.light { color: var(--side-text); border-color: var(--side-2); justify-content: center; }
.btn.light:hover { color: #fff; background: var(--side-2); }
.input { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); height: 100vh; }
.side { background: var(--side); color: var(--side-text); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.brand { color: #fff; font-weight: 700; font-size: 18px; padding: 0 8px; display: flex; gap: 8px; align-items: center; }
.logo { color: #8b83ff; }
.side-sub { font-size: 12px; color: #8f8ab5; padding: 0 8px 14px; text-transform: uppercase; letter-spacing: .08em; }
#nav a { display: block; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
#nav a:hover { background: var(--side-2); color: #fff; }
#nav a.on { background: var(--accent); color: #fff; }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; gap: 10px; align-items: center; padding: 8px; background: var(--side-2); border-radius: 8px; font-size: 13px; }
.me b { color: #fff; display: block; }

.content { overflow-y: auto; padding: 24px 32px 48px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.box.flush { padding: 0; overflow-x: auto; }
.box h3 { margin: 0 0 14px; font-size: 15px; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat .s { color: var(--muted); font-size: 12px; margin-top: 2px; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 18px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar .fill { width: 100%; max-width: 34px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar .n { font-size: 11px; color: var(--muted); }
.bar .d { font-size: 10px; color: var(--muted); white-space: nowrap; }
.hbar { display: grid; grid-template-columns: 120px 1fr 40px; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.hbar .track { background: #f1f0f5; border-radius: 4px; height: 10px; }
.hbar .track div { background: var(--accent); height: 100%; border-radius: 4px; }
.hbar span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafafc; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.off td { opacity: .55; }
.table .actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.person { display: flex; align-items: center; gap: 10px; }
.person small { display: block; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 8px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; position: relative; }
.avatar .on { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; background: #22c55e; border: 2px solid #fff; border-radius: 50%; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: #f1f0f5; color: var(--muted); }
.tag.admin { background: #fef3c7; color: #92400e; }
.tag.ok { background: #dcfce7; color: #166534; }
.tag.off { background: #fee2e2; color: #991b1b; }
.tag.warn { background: #ffedd5; color: #9a3412; }
.tag.info { background: var(--accent-soft); color: var(--accent); }

.msg-row { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.msg-row:last-child { border-bottom: 0; }
.msg-row .body { flex: 1; min-width: 0; }
.msg-row .meta { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.msg-row .meta b { color: var(--text); }
.msg-row .txt { white-space: pre-wrap; word-wrap: break-word; }
.msg-row .att { font-size: 12px; color: var(--accent); margin-top: 4px; }
.msg-row .att a { color: var(--accent); margin-right: 10px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

.form { display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
.form label, .card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.form label.check, .card label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }

.overlay { position: fixed; inset: 0; background: rgba(20,18,40,.55); display: flex; align-items: center; justify-content: center; z-index: 50; }
.card { background: #fff; border-radius: 14px; padding: 24px; width: min(480px, 94vw); max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 12px; }
.card h3 { margin: 0; }
.card .input { width: 100%; }
.card .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.error { color: var(--red); font-size: 13px; min-height: 1em; }
.member-picker { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.member-picker label { padding: 7px 10px; border-bottom: 1px solid var(--line); }
.member-picker label:last-child { border-bottom: 0; }
.cred { background: #f8f8fb; border: 1px dashed #c9c7d6; border-radius: 10px; padding: 14px; font-family: Consolas, monospace; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.note { font-size: 12px; color: var(--muted); }

.denied { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1d1c24; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 70; }

[data-theme="dark"] {
  --bg: #121220; --panel: #1a1a2b; --side: #0f0f1b; --side-2: #1b1a30; --text: #ebeaf5; --muted: #8e8da6; --line: #2a2a40; --accent-soft: #2a2950;
  color-scheme: dark;
}
[data-theme="dark"] .btn { background: var(--panel); border-color: var(--line); }
[data-theme="dark"] .table th, [data-theme="dark"] .cred { background: #1f1f32; }
[data-theme="dark"] .input { background: #1f1f32; border-color: var(--line); }
[data-theme="dark"] .hbar .track, [data-theme="dark"] .tag { background: #26263c; }
[data-theme="dark"] .card { background: var(--panel); }
.btn.primary { background: linear-gradient(135deg, #5b5bf7, #7c6cf9); border-color: transparent; }
.stat { transition: transform .15s, box-shadow .15s; }
.stat:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(20,18,50,.08); }
.form label .note { font-weight: 400; }

/* Özel mesaj denetimi */
.card.wide { width: min(1000px, 96vw); }
.dm-inspect { display: grid; grid-template-columns: 260px 1fr; border: 1px solid var(--line); border-radius: 12px; height: min(60vh, 560px); overflow: hidden; }
.dm-convs { border-right: 1px solid var(--line); overflow-y: auto; }
.dm-convs .conv { display: flex; gap: 10px; align-items: center; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.dm-convs .conv:hover { background: var(--accent-soft); }
.dm-convs .conv.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.dm-convs .conv b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-convs .conv small { color: var(--muted); }
.dm-view { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.dm-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.dm-head .avatar { width: 26px; height: 26px; font-size: 11px; }
.dm-msgs { overflow-y: auto; flex: 1; }
.dm-msgs .msg-row.reply { padding-left: 46px; background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }

td.clickable { cursor: pointer; }
td.clickable:hover b { color: var(--accent); text-decoration: underline; }

.ban-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--panel-2); }
.ban-box .check { margin: 4px 0; }
