*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

:root {
  --bg:        #0d0d14;
  --bg2:       #111118;
  --card:      #18181f;
  --border:    #2a2a3a;
  --border2:   #3a3a4a;
  --text:      #e2e2f0;
  --muted:     #9ca3af;
  --faint:     #4b5563;
  --purple:    #7c3aed;
  --purple-h:  #6d28d9;
  --purple-l:  #a78bfa;
  --green:     #10b981;
  --yellow:    #f59e0b;
  --cyan:      #06b6d4;
  --red:       #ef4444;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* ── Layout ─────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: 240px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  margin-bottom: 20px;
}
.logo-icon {
  width: 34px; height: 34px;
  background: var(--purple);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 13px; color: #fff; flex-shrink: 0;
}
.logo-text { font-weight: 800; font-size: 17px; color: #fff; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--muted); font-size: 14px;
  transition: all 0.15s; margin-bottom: 2px;
}
.nav-link:hover, .nav-link.active {
  background: rgba(124,58,237,.15);
  color: var(--purple-l);
}
.nav-link i { width: 16px; text-align: center; }
.sidebar-bottom {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.user-box {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; margin-bottom: 4px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(124,58,237,.2);
  border: 1px solid rgba(124,58,237,.4);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: var(--purple-l);
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Main Content ─────────────────────────────────── */
.main { flex: 1; overflow-y: auto; padding: 32px; }
.page-title { font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 28px; }

/* ── Cards ────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.card-title { font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 6px; }
.stat-val { font-size: 30px; font-weight: 900; color: #fff; }

/* ── Badges ───────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 10px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase;
}
.badge-admin   { background:rgba(124,58,237,.15); color:#a78bfa; border:1px solid rgba(124,58,237,.3); }
.badge-unlimited{background:rgba(6,182,212,.15);  color:#67e8f9; border:1px solid rgba(6,182,212,.3); }
.badge-premium { background:rgba(245,158,11,.15); color:#fbbf24; border:1px solid rgba(245,158,11,.3); }
.badge-supporter{background:rgba(6,182,212,.15);  color:#67e8f9; border:1px solid rgba(6,182,212,.3); }
.badge-user    { background:rgba(16,185,129,.15); color:#34d399; border:1px solid rgba(16,185,129,.3); }
.badge-open    { background:rgba(16,185,129,.15); color:#34d399; border:1px solid rgba(16,185,129,.3); }
.badge-in_progress{background:rgba(245,158,11,.15);color:#fbbf24;border:1px solid rgba(245,158,11,.3);}
.badge-closed  { background:rgba(107,114,128,.15);color:#9ca3af; border:1px solid rgba(107,114,128,.3);}

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 8px; font-size: 14px;
  font-weight: 600; cursor: pointer; border: none; transition: all 0.15s;
  text-decoration: none;
}
.btn-primary  { background: var(--purple);  color: #fff; }
.btn-primary:hover  { background: var(--purple-h); }
.btn-ghost    { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover    { border-color: var(--purple); color: var(--purple-l); }
.btn-danger   { background: transparent; color: var(--red); border: 1px solid transparent; }
.btn-danger:hover   { background: rgba(239,68,68,.1); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; margin-top: 6px; }

/* ── Forms ────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
.form-label i { margin-right: 5px; }
.form-input, .form-textarea, .form-select {
  width: 100%; background: var(--bg2);
  border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 10px 14px;
  font-size: 14px; outline: none; transition: border 0.15s;
  font-family: inherit;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--purple); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--faint); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: 12px; color: var(--faint); margin-top: 4px; }

/* ── Alerts ───────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-error   { background:rgba(239,68,68,.1);  color:#fca5a5; border:1px solid rgba(239,68,68,.2); }
.alert-success { background:rgba(16,185,129,.1); color:#6ee7b7; border:1px solid rgba(16,185,129,.2); }
.alert-info    { background:rgba(124,58,237,.1); color:#c4b5fd; border:1px solid rgba(124,58,237,.2); }

/* ── Progress bar ─────────────────────────────────── */
.progress { height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress-bar { height: 100%; border-radius: 4px; transition: width .3s; }

/* ── Table ────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing:.5px; color: var(--faint); padding: 8px 14px; border-bottom: 1px solid var(--border); }
td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid rgba(42,42,58,.5); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ── Auth pages ───────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 28px; gap: 10px; }
.auth-logo .logo-icon { width: 48px; height: 48px; font-size: 17px; border-radius: 12px; }
.auth-logo h1 { font-size: 22px; font-weight: 800; color: #fff; }
.auth-logo p  { font-size: 13px; color: var(--muted); }
.auth-footer  { text-align: center; font-size: 13px; color: var(--muted); margin-top: 16px; }
.auth-footer a { color: var(--purple-l); font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ── Chat ─────────────────────────────────────────── */
.chat-sidebar {
  width: 220px; background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 12px 10px; flex-shrink: 0;
}
.chat-item {
  padding: 8px 10px; border-radius: 8px;
  color: var(--muted); font-size: 13px;
  cursor: pointer; transition: all 0.15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block;
}
.chat-item:hover, .chat-item.active { background: rgba(255,255,255,.05); color: var(--text); }
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chat-header { padding: 12px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 12px; max-width: 85%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(124,58,237,.15); border: 1px solid rgba(124,58,237,.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900; color: var(--purple-l);
  flex-shrink: 0; margin-top: 2px;
}
.msg-bubble {
  padding: 10px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.65;
}
.msg.ai .msg-bubble  { background: var(--card); border: 1px solid var(--border); border-top-left-radius: 4px; }
.msg.user .msg-bubble{ background: var(--purple); color: #fff; border-top-right-radius: 4px; }
.chat-input-area { padding: 16px 20px; border-top: 1px solid var(--border); }
.chat-input-row { display: flex; gap: 10px; align-items: flex-end; }
.chat-textarea {
  flex: 1; background: var(--card); border: 1px solid var(--border);
  color: var(--text); border-radius: 12px; padding: 11px 16px;
  font-size: 14px; outline: none; resize: none;
  font-family: inherit; transition: border .15s; max-height: 140px;
}
.chat-textarea:focus { border-color: var(--purple); }
.chat-textarea::placeholder { color: var(--faint); }
.send-btn {
  width: 42px; height: 42px; background: var(--purple);
  border: none; border-radius: 10px; color: #fff;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; transition: background .15s;
}
.send-btn:hover:not(:disabled) { background: var(--purple-h); }
.send-btn:disabled { opacity: .4; cursor: not-allowed; }
.typing-dots { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing-dots span {
  width: 7px; height: 7px; background: var(--purple-l);
  border-radius: 50%; animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

/* ── Landing ──────────────────────────────────────── */
.hero { text-align: center; padding: 80px 24px 60px; }
.hero h1 { font-size: clamp(36px, 6vw, 64px); font-weight: 900; color: #fff; line-height: 1.1; margin-bottom: 18px; }
.hero h1 span { background: linear-gradient(135deg,#a78bfa,#7c3aed); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p { font-size: 17px; color: var(--muted); max-width: 520px; margin: 0 auto 32px; }
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.features { max-width: 1100px; margin: 0 auto; padding: 40px 24px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap: 16px; }
.feature-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 24px; transition: border .2s; }
.feature-card:hover { border-color: rgba(124,58,237,.4); }
.feature-icon { font-size: 28px; margin-bottom: 14px; }
.feature-card h3 { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.feature-card p { font-size: 13px; color: var(--muted); line-height: 1.6; }
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px; border-bottom: 1px solid var(--border);
  background: rgba(13,13,20,.8); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 50;
}
.navbar-logo { display: flex; align-items: center; gap: 10px; }
.navbar-links { display: flex; align-items: center; gap: 8px; }
.section-title { text-align: center; font-size: 28px; font-weight: 900; color: #fff; margin-bottom: 8px; }
.section-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 32px; }
.roles-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 12px; max-width: 900px; margin: 0 auto 60px; padding: 0 24px; }
.role-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.role-card-name { font-weight: 800; font-size: 15px; color: #fff; margin-bottom: 6px; }
.role-card-desc { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
footer { text-align: center; padding: 28px; border-top: 1px solid var(--border); color: var(--faint); font-size: 13px; }
