@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Rajdhani:wght@600;700&display=swap');

:root {
  --ink: #f6f0ff;
  --muted: #a79bb5;
  --line: rgba(180, 137, 255, .14);
  --paper: #0b0710;
  --surface: #14101b;
  --surface-2: #1b1425;
  --accent: #9b5cff;
  --accent-strong: #7c3aed;
  --accent-soft: rgba(155, 92, 255, .14);
  --green: #43d69e;
  --blue: #8d7bff;
  --orange: #ff9d52;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(rgba(155,92,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(155,92,255,.025) 1px, transparent 1px),
    radial-gradient(circle at 78% -10%, rgba(124,58,237,.18), transparent 34%),
    var(--paper);
  background-size: 38px 38px, 38px 38px, auto, auto;
}
a { color: inherit; }
.shell { min-height: 100vh; display: flex; }

aside {
  position: fixed;
  inset: 0 auto 0 0;
  width: 265px;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  color: #fff;
  background: rgba(11, 7, 16, .94);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand > span, .mark {
  display: grid;
  place-items: center;
  color: #fff;
  font-family: Rajdhani, Inter, sans-serif;
  font-weight: 700;
  background: linear-gradient(135deg, #b375ff, #6d28d9);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 0 28px rgba(155,92,255,.3), inset 0 1px rgba(255,255,255,.18);
}
.brand > span { width: 42px; height: 42px; border-radius: 11px; font-size: 18px; }
.brand b { display: grid; font-family: Rajdhani, Inter, sans-serif; font-size: 20px; line-height: 1; letter-spacing: .02em; }
.brand b small { margin-top: 5px; color: #9d8eac; font: 700 9px/1 Inter, sans-serif; letter-spacing: .2em; }

nav { display: grid; gap: 5px; margin-top: 48px; }
nav a { position: relative; padding: 12px 14px; border-radius: 8px; color: #b9aec6; text-decoration: none; font-size: 14px; font-weight: 600; transition: .2s ease; }
nav a:hover { color: #fff; background: var(--accent-soft); transform: translateX(3px); }
nav a:hover::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.profile { margin-top: auto; display: grid; gap: 4px; padding: 21px 8px 0; border-top: 1px solid var(--line); }
.profile small { color: #887b97; }
.link { padding: 8px 0; border: 0; background: none; color: #b9aec6; cursor: pointer; text-align: left; }

main { margin-left: 265px; width: calc(100% - 265px); padding: 48px 5vw; }
.auth-main { position: relative; margin: 0; width: 100%; min-height: 100vh; display: grid; place-items: center; overflow: hidden; background: linear-gradient(110deg, rgba(7,4,11,.98) 10%, rgba(19,9,29,.88) 55%, rgba(72,25,126,.42)), repeating-linear-gradient(135deg, transparent 0 60px, rgba(166,96,255,.035) 61px 62px); }
.auth-main::before, .auth-main::after { content: ""; position: fixed; border-radius: 50%; pointer-events: none; }
.auth-main::before { width: 560px; height: 560px; right: -170px; top: -170px; border: 1px solid rgba(178,113,255,.2); box-shadow: 0 0 120px rgba(124,58,237,.18), inset 0 0 120px rgba(124,58,237,.1); }
.auth-main::after { width: 260px; height: 260px; left: 8%; bottom: -130px; background: rgba(112,40,180,.13); filter: blur(70px); }
.auth-card { position: relative; z-index: 1; width: min(450px, 92vw); padding: 42px; border: 1px solid rgba(190,143,255,.2); border-radius: 16px; background: rgba(20,14,28,.88); box-shadow: 0 30px 90px rgba(0,0,0,.45), 0 0 60px rgba(124,58,237,.09); backdrop-filter: blur(22px); }
.mark { width: 56px; height: 56px; margin-bottom: 28px; border-radius: 13px; font-size: 22px; }
.eyebrow { margin: 0 0 10px; color: #b987ff; font-size: 10px; font-weight: 800; letter-spacing: .2em; }
h1, h2 { font-family: Rajdhani, Inter, sans-serif; }
h1 { margin: 0 0 10px; font-size: clamp(31px, 3.6vw, 48px); line-height: 1; letter-spacing: -.025em; }
h2 { margin: 0; font-size: 21px; letter-spacing: .01em; }
.muted { margin: 0; color: var(--muted); line-height: 1.55; }

.stack { display: grid; gap: 18px; margin-top: 28px; }
label { display: grid; gap: 7px; color: #cfc5da; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; padding: 12px 13px; color: var(--ink); font: inherit; border: 1px solid rgba(185,139,245,.2); border-radius: 8px; background: rgba(7,5,10,.58); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(155,92,255,.25); border-color: var(--accent); }
textarea { resize: vertical; }
.primary, .secondary, .danger, .button, .discord-button { display: inline-flex; justify-content: center; align-items: center; border: 0; border-radius: 8px; padding: 12px 18px; font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.primary { color: #fff; background: linear-gradient(135deg, #a867ff, #7130d7); box-shadow: 0 8px 25px rgba(124,58,237,.25); }
.primary:hover, .discord-button:hover { transform: translateY(-1px); box-shadow: 0 11px 30px rgba(124,58,237,.38); }
.secondary { color: #e8def3; background: #2a2035; }
.danger { color: #ff9bb1; background: rgba(255,67,106,.1); }
.switch { margin: 22px 0 0; color: var(--muted); text-align: center; font-size: 13px; }
.switch a { color: #b77aff; font-weight: 800; }
.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: #7f728c; font-size: 11px; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.discord-button { gap: 9px; color: #fff; background: #5865f2; }
.discord-button.compact { padding: 10px 14px; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 22px; margin-bottom: 34px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 22px; }
.stats article, .panel { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(27,20,37,.94), rgba(17,13,23,.94)); box-shadow: inset 0 1px rgba(255,255,255,.018), 0 18px 45px rgba(0,0,0,.12); }
.stats article { position: relative; padding: 22px; border-radius: 11px; overflow: hidden; }
.stats article::after { content: ""; position: absolute; right: -30px; bottom: -45px; width: 110px; height: 110px; border: 1px solid rgba(155,92,255,.09); border-radius: 50%; }
.stats span { display: block; color: var(--muted); font-size: 12px; }
.stats strong { font: 700 38px/1 Rajdhani, Inter, sans-serif; }
.dot { position: absolute; right: 20px; top: 23px; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 12px currentColor; }
.orange { color: var(--orange); background: var(--orange); }
.blue { color: var(--blue); background: var(--blue); }
.green { color: var(--green); background: var(--green); }
.panel { border-radius: 11px; }
.panel-head { display: flex; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-head span { color: var(--muted); font-size: 12px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 13px 18px; color: #8d8099; border-bottom: 1px solid var(--line); text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
td { padding: 16px 18px; border-bottom: 1px solid rgba(180,137,255,.08); }
tbody tr { cursor: pointer; transition: background .15s ease; }
tbody tr:hover { background: rgba(155,92,255,.055); }
td small { display: block; margin-top: 4px; color: var(--muted); }
.badge { display: inline-block; padding: 6px 10px; border-radius: 20px; font-size: 11px; font-weight: 800; }
.badge.open { color: #e1bcff; background: rgba(155,92,255,.14); }
.badge.in_progress { color: #b7c2ff; background: rgba(116,117,255,.14); }
.badge.closed { color: #79e4ba; background: rgba(67,214,158,.12); }
.empty { padding: 45px; color: var(--muted); text-align: center; }

.form-panel { max-width: 760px; padding: 30px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; }
.ticket-grid { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 20px; }
.thread { padding: 8px 26px; }
.message { display: flex; gap: 14px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.message .avatar { flex: 0 0 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; color: #dcc5ff; background: var(--accent-soft); font-weight: 800; }
.message time { margin-left: 8px; color: var(--muted); font-size: 11px; }
.message p { line-height: 1.65; white-space: pre-wrap; }
.initial .avatar { color: #fff; background: linear-gradient(135deg, #9b5cff, #6324c3); }
.reply { display: grid; gap: 10px; padding: 22px 0; }
.reply button { justify-self: end; }
.details { height: max-content; padding: 22px; }
.details dl { display: grid; gap: 7px; margin: 24px 0; }
.details dt { color: #8d8099; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.details dd { margin: 0 0 10px; }
.mini { margin-top: 17px; padding-top: 17px; border-top: 1px solid var(--line); }
.role-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(290px,1fr)); gap: 18px; }
.role-card { padding: 24px; }
.permission { display: flex; align-items: center; gap: 10px; margin: 15px 0; }
.permission input, .check input { width: auto; accent-color: var(--accent); }
.permission span { display: grid; }
.permission small { color: var(--muted); font-weight: 400; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline select { width: auto; }
.check { display: flex; align-items: center; white-space: nowrap; }
.flash { margin-bottom: 18px; padding: 13px 16px; border: 1px solid rgba(67,214,158,.25); border-radius: 8px; color: #8aebc5; background: rgba(67,214,158,.09); }
.flash.error { color: #ff9bb1; border-color: rgba(255,102,135,.25); background: rgba(255,102,135,.08); }
.account-card { max-width: 720px; padding: 28px; display: grid; gap: 22px; }
.account-card > div { display: grid; gap: 5px; }
.account-card small { color: var(--muted); }
.discord-connect { display: flex!important; align-items: center; justify-content: space-between; gap: 18px; padding-top: 22px; border-top: 1px solid var(--line); }
.discord-connect > div { display: grid; gap: 5px; }
.settings-grid { display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 20px; }
.settings-status { height: max-content; padding: 28px; }
.settings-status p { position: relative; padding-left: 22px; }
.settings-status .dot { left: 0; right: auto; top: 6px; }
.settings-status small { display: block; margin-top: 24px; color: var(--muted); line-height: 1.55; }

@media (max-width: 820px) {
  .shell { display: block; }
  aside { position: static; width: 100%; height: auto; padding: 15px 18px; display: block; }
  .brand { display: inline-flex; }
  nav { display: flex; margin: 15px 0 0; overflow: auto; }
  .profile { display: none; }
  main { margin: 0; width: 100%; padding: 28px 18px; }
  .auth-main { min-height: 100vh; }
  .auth-card { padding: 34px 26px; }
  .stats, .ticket-grid, .settings-grid { grid-template-columns: 1fr; }
  .top { align-items: flex-start; flex-direction: column; }
  .discord-connect { align-items: flex-start; flex-direction: column; }
}
