:root {
  --bg: #fbf5f0; --bg-2: #f3ebe3; --panel: #ffffff; --raised: #fef1e6; --hover: #ffe9d8;
  --line: #f0ddc9; --ink: #241a2e; --ink-2: #4a3a55; --muted: #7c6a86; --faint: #a695ac;
  --accent: #ff5d73; --accent-strong: #ff3d5c; --accent-soft: #ffe3e8;
  --violet: #7c4dff; --violet-soft: #ece2ff; --green: #0f9d74; --green-soft: #dcf7ec;
  --amber: #b86e00; --amber-soft: #fff1d6; --red: #d6243f; --red-soft: #ffe3e8;
  --grad-brand: linear-gradient(135deg, #ff5d73 0%, #ff5d9e 55%, #7c4dff 100%);
  --radius: 18px; --radius-sm: 12px;
  --shadow: 0 2px 10px -4px rgba(65, 30, 60, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 10px; }
code { background: var(--bg-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; justify-content: center; }
.hidden { display: none !important; }
.pre { white-space: pre-wrap; }

.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); padding: 0 8px 16px; }
.brand:hover { text-decoration: none; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.logo { width: 38px; height: 38px; border-radius: 12px; background: var(--grad-brand); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 20px; }
.sidebar nav { flex: 1; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 16px 10px 6px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--ink-2); font-weight: 500; }
.sidebar nav a:hover { background: var(--hover); text-decoration: none; }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent-strong); }
.ico { width: 20px; text-align: center; }
.badge { margin-left: auto; background: var(--accent-strong); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 99px; }
.logout { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
.main { padding: 28px 32px 60px; min-width: 0; max-width: 1400px; }
.menu-toggle { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline { display: inline-flex; gap: 8px; margin: 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card.empty { text-align: center; padding: 40px; }
.link-card { display: block; color: var(--ink); }
.link-card:hover { text-decoration: none; border-color: var(--accent); }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.two.wide-left { grid-template-columns: 1.6fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid > .card { margin-bottom: 0; }
.grid + .card, .card + .grid { margin-top: 18px; }

.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi a { color: inherit; display: block; } .kpi a:hover { text-decoration: none; }
.kpi span { color: var(--muted); font-size: 13px; display: block; }
.kpi strong { font-size: 28px; letter-spacing: -.02em; }
.stat-row { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 14px; }
.stat-row strong { display: block; font-size: 20px; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-wrap { width: 100%; overflow: hidden; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--faint); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .hit { fill: transparent; }
.chart .bar:hover .hit { fill: var(--raised); }
.funnel { margin-top: 18px; display: grid; gap: 6px; }
.funnel-row { display: grid; grid-template-columns: 140px 1fr 60px; gap: 12px; align-items: center; font-size: 13px; }
.funnel-row strong { text-align: right; }
.funnel .bar { background: var(--bg-2); border-radius: 99px; height: 10px; overflow: hidden; }
.funnel .bar b { display: block; height: 100%; background: var(--violet); border-radius: 99px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.faded { opacity: .5; }
.card > .table { display: block; overflow-x: auto; }
.card > .table > * { display: table; width: 100%; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--bg-2); color: var(--ink-2); text-transform: capitalize; }
.tag.big { font-size: 14px; padding: 5px 14px; }
.tag.verified, .tag.open, .tag.unban, .tag.untimeout { background: var(--green-soft); color: var(--green); }
.tag.review, .tag.warn, .tag.automod, .tag.timeout, .tag.locked, .tag.captcha { background: var(--amber-soft); color: var(--amber); }
.tag.denied, .tag.underage, .tag.ban, .tag.kick { background: var(--red-soft); color: var(--red); }
.tag.closed, .tag.pending, .tag.purge { background: var(--violet-soft); color: var(--violet); }
.pill { padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; }
.pill.good { background: var(--green-soft); color: var(--green); } .pill.bad { background: var(--red-soft); color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--raised); border-radius: 99px; padding: 3px 10px; font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 9px 16px; border-radius: 12px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; box-shadow: 0 10px 22px -10px rgba(255, 61, 92, .6); }
.btn.primary:hover { background: #f02c4c; }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { background: var(--panel); border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }

.form .fields, .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.fields.three { grid-template-columns: repeat(3, 1fr); }
.fields.one { grid-template-columns: 1fr; }
.fields .span2 { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
label small { font-weight: 400; color: var(--muted); font-size: 12px; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; min-width: 0; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
select[multiple] { background-image: none; padding-right: 12px; }
textarea { resize: vertical; }
input[type="color"] { padding: 4px; height: 42px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.switch { flex-direction: row; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 40px; height: 22px; background: var(--line); border-radius: 99px; position: relative; flex: none; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); transition: transform .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); }
.form-foot { display: flex; gap: 12px; align-items: center; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px; }
.filters input { flex: 1; min-width: 180px; } .filters select { width: auto; min-width: 160px; }

.rows { display: grid; gap: 8px; margin-bottom: 10px; }
.row { display: grid; grid-template-columns: 80px 1fr 1.5fr auto; gap: 8px; align-items: center; }
.row.four { grid-template-columns: 1.2fr 80px 1fr 1.3fr auto; }
.row.head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 500; }
.flash.success { background: var(--green-soft); color: #08694d; }
.flash.error { background: var(--red-soft); color: #a3142c; }
.flash.warning { background: var(--amber-soft); color: #7a4a00; }

.review-user { display: flex; gap: 14px; align-items: center; flex: 1; }
.review-user img { border-radius: 50%; background: var(--bg-2); }
.card.review .review-user { margin-bottom: 12px; }
.risk { margin-left: auto; font-weight: 700; padding: 6px 12px; border-radius: 99px; font-size: 13px; }
.risk.high { background: var(--red-soft); color: var(--red); } .risk.mid { background: var(--amber-soft); color: var(--amber); } .risk.low { background: var(--green-soft); color: var(--green); }
.reasons { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.reasons li { display: flex; justify-content: space-between; gap: 12px; background: var(--raised); padding: 8px 12px; border-radius: 10px; font-size: 14px; }
.review-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.review-actions input { flex: 1; min-width: 200px; }
.meta { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 14px; margin: 14px 0; }
.meta dt { color: var(--muted); } .meta dd { margin: 0; }
.transcript { background: var(--bg-2); padding: 14px; border-radius: 12px; font-size: 12px; max-height: 600px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow: auto; background: var(--bg-2); padding: 12px; border-radius: var(--radius-sm); }
.chat-msg { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 14px; word-break: break-word; }
.chat-msg.bot { background: var(--raised); }
.chat-meta { margin-bottom: 2px; }
.chat-embed { border-left: 3px solid var(--accent); padding: 4px 10px; margin-top: 6px; }
.chat-reply { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.discord-embed { background: #2b2d31; color: #dbdee1; border-left: 4px solid var(--accent); border-radius: 6px; padding: 12px 16px; }
.discord-embed strong { color: #fff; }
.embed-img { max-width: 100%; border-radius: 6px; margin-top: 8px; }
.danger-zone { margin-top: 8px; }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: radial-gradient(circle at 20% 10%, #ffe3e8, transparent 50%), radial-gradient(circle at 80% 90%, #ece2ff, transparent 50%), var(--bg); }
.login-card { background: var(--panel); padding: 32px; border-radius: 22px; width: 100%; max-width: 380px; box-shadow: 0 24px 60px -20px rgba(65, 20, 60, .28); display: grid; gap: 14px; }

@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(3, 1fr); } .grid.three { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 10; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .menu-toggle { display: inline-flex; margin-bottom: 14px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 12px; font: inherit; cursor: pointer; }
  .main { padding: 16px; }
  .grid.two, .grid.two.wide-left, .grid.three, .fields, .fields.three { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .row, .row.four { grid-template-columns: 1fr; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
  .row.head { display: none; }
  .funnel-row { grid-template-columns: 100px 1fr 40px; }
}

/* Roles & permissions */
.role-badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; text-transform: capitalize; background: var(--bg-2); color: var(--ink-2); }
.role-badge.owner { background: var(--grad-brand); color: #fff; }
.role-badge.admin { background: var(--violet-soft); color: var(--violet); }
.role-badge.moderator { background: var(--amber-soft); color: var(--amber); }
.role-badge.support { background: var(--green-soft); color: var(--green); }
.role-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.role-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.role-card p { margin: 8px 0 0; }
.perm-table-wrap { overflow-x: auto; }
.perm-table th.c, .perm-table td.c { text-align: center; width: 110px; }
.perm-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent-strong); cursor: pointer; }
.perm-table .group-row td { background: var(--raised); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 6px 10px; }
.perm-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.perm-list li { background: var(--raised); padding: 8px 12px; border-radius: 10px; font-size: 14px; }
.check { color: var(--green); font-weight: 800; margin-right: 8px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.row-actions form { margin: 0; }
.pw-reset summary { list-style: none; }
.pw-reset summary::-webkit-details-marker { display: none; }
.pw-reset[open] form { margin-top: 6px; }
.pw-reset input { width: 160px; padding: 5px 8px; font-size: 13px; }
@media (max-width: 900px) { .role-cards { grid-template-columns: 1fr 1fr; } }
.table td select { min-width: 140px; width: auto; }
.last-msg { max-width: 320px; } .last-msg .muted.small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
