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

:root {
  --bg:            #f0f2f8;
  --surface:       #ffffff;
  --surface2:      #f4f6fc;
  --border:        #e2e8f0;
  --text:          #1a202c;
  --text-muted:    #64748b;
  --accent:        #5b6af0;
  --accent-hover:  #4553d4;
  --accent-light:  #eef0fe;
  --danger:        #ef4444;
  --danger-light:  #fef2f2;
  --success:       #22c55e;
  --success-light: #f0fdf4;
  --warn:          #f59e0b;
  --warn-light:    #fffbeb;
  --sidebar-w:     240px;
  --topbar-h:      60px;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-md:     0 4px 24px rgba(0,0,0,.10);
  --transition:    .2s ease;
}

[data-theme="dark"] {
  --bg:            #0f1117;
  --surface:       #1a1d27;
  --surface2:      #222535;
  --border:        #2d3148;
  --text:          #e2e8f0;
  --text-muted:    #8892a4;
  --accent:        #6c7bf5;
  --accent-hover:  #8491f8;
  --accent-light:  #1e2245;
  --danger:        #f87171;
  --danger-light:  #2d1a1a;
  --success:       #4ade80;
  --success-light: #152e1e;
  --warn:          #fbbf24;
  --warn-light:    #2d2410;
  --shadow:        0 1px 3px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --shadow-md:     0 4px 24px rgba(0,0,0,.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: var(--topbar-h);
  transition: background var(--transition), color var(--transition);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warn { color: var(--warn); }
.fw-bold { font-weight: 600; }

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px 0 calc(var(--sidebar-w) + 24px);
  gap: 12px;
  transition: background var(--transition), border-color var(--transition);
  box-shadow: 0 1px 0 var(--border);
}

.topbar-links {
  display: flex;
  gap: 8px;
  margin-right: auto;
}

.topbar-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.topbar-link:hover {
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
}

#theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
#theme-toggle:hover { background: var(--surface2); color: var(--text); }
#theme-icon { font-size: 1rem; }

#steam-login button {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
}
#steam-login button:hover { background: var(--accent-hover); transform: translateY(-1px); }

#steam-profile {
  display: flex; align-items: center; gap: 10px;
}
#steam-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
}
#steam-info { display: flex; flex-direction: column; line-height: 1.3; }
#steam-name { font-size: .85rem; font-weight: 600; }
#steam-rank {
  font-size: .72rem;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 99px;
  width: fit-content;
}
#steam-rank.superadmin { background: #fee2e2; color: #dc2626; }
#steam-rank.admin       { background: #dbeafe; color: #2563eb; }
#steam-rank.moderateur  { background: #fef9c3; color: #a16207; }
#steam-rank.moderateur-test { background: #ede9fe; color: #7c3aed; }
#steam-rank.utilisateur { background: var(--surface2); color: var(--text-muted); }

[data-theme="dark"] #steam-rank.superadmin { background: #3b0e0e; color: #f87171; }
[data-theme="dark"] #steam-rank.admin       { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] #steam-rank.moderateur  { background: #3b2f00; color: #fbbf24; }
[data-theme="dark"] #steam-rank.moderateur-test { background: #2e1b5e; color: #a78bfa; }
[data-theme="dark"] #steam-rank.utilisateur { background: var(--surface2); color: var(--text-muted); }

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  z-index: 999;
  transition: background var(--transition), border-color var(--transition);
  overflow-y: auto;
}

.sidebar .logo {
  margin-bottom: 28px;
  width: 100%;
  display: flex;
  justify-content: center;
}
.sidebar .logo img {
  width: 80px;
  height: auto;
  filter: drop-shadow(0 0 12px rgba(108, 123, 245, .4));
}

.sidebar-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 0 12px;
  margin: 16px 0 6px;
  width: 100%;
}

.menu {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.menu a i { width: 18px; text-align: center; font-size: .9rem; flex-shrink: 0; }
.menu a:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.menu a.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}
[data-theme="dark"] .menu a.active { background: var(--accent-light); }

.sidebar-divider {
  width: calc(100% - 24px);
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px;
  min-height: calc(100vh - var(--topbar-h));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: background var(--transition), border-color var(--transition);
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2, .card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.card-body { padding: 24px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-card .stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.stat-card .stat-icon.red    { background: var(--danger-light); color: var(--danger); }
.stat-card .stat-icon.blue   { background: var(--accent-light); color: var(--accent); }
.stat-card .stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-card .stat-icon.yellow { background: var(--warn-light); color: var(--warn); }

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
thead tr {
  background: var(--surface2);
}
th {
  padding: 12px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

/* Player cell */
.player-cell { display: flex; align-items: center; gap: 10px; }
.player-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.player-id { font-family: monospace; font-size: .82rem; color: var(--text-muted); }

/* Ban badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-perm    { background: var(--danger-light);  color: var(--danger); }
.badge-active  { background: var(--warn-light);    color: var(--warn); }
.badge-expired { background: var(--success-light); color: var(--success); }
.badge-pending { background: var(--warn-light);    color: var(--warn); }
.badge-accept  { background: var(--success-light); color: var(--success); }
.badge-reject  { background: var(--danger-light);  color: var(--danger); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  font-family: inherit;
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--accent);  color: #fff; }
.btn-primary:hover   { background: var(--accent-hover); }

.btn-danger    { background: var(--danger-light); color: var(--danger); }
.btn-danger:hover    { background: var(--danger); color: #fff; }

.btn-success   { background: var(--success-light); color: var(--success); }
.btn-success:hover   { background: var(--success); color: #fff; }

.btn-ghost     { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover     { background: var(--border); }

.btn-sm { padding: 5px 10px; font-size: .78rem; }
.btn-xs { padding: 3px 8px;  font-size: .72rem; }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 123, 245, .15);
}
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238892a4' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea.form-control { resize: vertical; min-height: 100px; }

.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 4px;
  padding: 20px 0 4px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  text-decoration: none;
}
.pagination a:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.pagination .active, .pagination span.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination .prev-next { width: auto; padding: 0 12px; }

.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  min-width: 280px; max-width: 380px;
  padding: 14px 18px 14px 16px;
  border-radius: var(--radius);
  color: #fff;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  display: flex; align-items: flex-start; gap: 10px;
  animation: toast-in .35s cubic-bezier(.21,1.02,.73,1) forwards;
}
.toast.hide { animation: toast-out .3s ease forwards; }
.toast.successnotif { background: var(--success); }
.toast.errornotif   { background: var(--danger); }
.toast.info         { background: var(--accent); }
.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  background: rgba(255,255,255,.4);
  border-radius: 0 0 var(--radius) var(--radius);
  width: 100%;
  animation: toast-progress 5s linear forwards;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(60px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(60px); }
}
@keyframes toast-progress {
  from { width: 100%; }
  to   { width: 0; }
}

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  animation: fade-in .2s ease;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 32px;
  max-width: 480px; width: 90%;
  animation: scale-in .25s cubic-bezier(.34,1.56,.64,1) forwards;
}
.modal-box h2 { font-size: 1.25rem; margin-bottom: 10px; }
.modal-box p  { color: var(--text-muted); margin-bottom: 20px; }
@keyframes fade-in   { from { opacity: 0; } to { opacity: 1; } }
@keyframes scale-in  { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 300px;
}
.search-wrap i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .85rem;
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: .875rem;
  font-family: inherit;
  z-index: 999;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,123,245,.15);
}

.notif-bell {
  position: relative;
  display: flex;
  align-items: center;
}

.notif-bell-btn {
  background: var(--surface2, #1e1e2e);
  border: 1px solid var(--border, #2a2a3d);
  color: var(--text, #cdd6f4);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background .2s, border-color .2s, color .2s;
  font-size: .95rem;
}

.notif-bell-btn:hover {
  background: var(--accent, #89b4fa);
  color: #fff;
  border-color: var(--accent, #89b4fa);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger, #f38ba8);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--bg, #12121c);
  line-height: 1;
}

.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  background: var(--surface, #1a1a2e);
  border: 1px solid var(--border, #2a2a3d);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  z-index: 9999;
  overflow: hidden;
  animation: notifFadeIn .18s ease;
}

@keyframes notifFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.notif-dropdown.open {
  display: block;
}

.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #2a2a3d);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted, #888);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.notif-count {
  background: var(--surface2, #1e1e2e);
  border: 1px solid var(--border, #2a2a3d);
  border-radius: 99px;
  padding: 1px 8px;
  font-size: .75rem;
  color: var(--text-muted, #888);
}

.notif-list {
  max-height: 360px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #2a2a3d);
  position: relative;
  transition: background .15s;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: var(--surface2, #1e1e2e);
}

.notif-item.unread {
  background: color-mix(in srgb, var(--accent, #89b4fa) 6%, transparent);
}

.notif-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2, #1e1e2e);
  border: 1px solid var(--border, #2a2a3d);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent, #89b4fa);
  font-size: .8rem;
  margin-top: 2px;
}

.notif-item-body {
  flex: 1;
  min-width: 0;
}

.notif-item-msg {
  margin: 0 0 4px;
  font-size: .88rem;
  color: var(--text, #cdd6f4);
  line-height: 1.4;
  word-break: break-word;
}

.notif-item-meta {
  font-size: .75rem;
  color: var(--text-muted, #888);
}

.notif-unread-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, #89b4fa);
  margin-top: 6px;
}

.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-track { background: transparent; }
.notif-list::-webkit-scrollbar-thumb { background: var(--border, #2a2a3d); border-radius: 4px; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px;
  color: var(--text-muted);
  gap: 12px;
  text-align: center;
}
.empty-state i { font-size: 3rem; opacity: .3; }
.empty-state p { font-size: .9rem; }

.dm-bell { position: relative; }
 
.dm-bell-btn {
  width: 36px; height: 36px;
  background: none;
  border: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 1.05rem;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.dm-bell-btn:hover { background: var(--surface2); color: var(--accent); }
 
.dm-badge {
  position: absolute;
  top: -2px; right: -2px;
  min-width: 17px; height: 17px;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--surface);
  line-height: 1;
  pointer-events: none;
}
 
.dm-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
  z-index: 1100;
  animation: dm-fade-in .15s ease;
}
 
.dm-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(900px, 96vw);
  height: min(640px, 90vh);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
  display: flex;
  z-index: 1101;
  overflow: hidden;
  animation: dm-pop-in .2s cubic-bezier(.34,1.56,.64,1);
}
 
@keyframes dm-fade-in  { from { opacity: 0 } to { opacity: 1 } }
@keyframes dm-pop-in   { from { opacity: 0; transform: translate(-50%,-52%) scale(.96) } to { opacity: 1; transform: translate(-50%,-50%) scale(1) } }
 
.dm-sidebar {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--surface2);
}
 
.dm-sidebar-header {
  padding: 16px 16px 12px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.dm-sidebar-header h3 {
  font-size: .95rem; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
}
.dm-sidebar-header h3 i { color: var(--accent); }
 
.dm-new-btn {
  width: 30px; height: 30px;
  background: var(--accent-light);
  color: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  transition: background var(--transition);
}
.dm-new-btn:hover { background: var(--accent); color: #fff; }
 
.dm-search-wrap {
  margin: 10px 12px 0;
  position: relative;
  display: flex; align-items: center;
}
.dm-search-wrap i {
  position: absolute; left: 10px;
  color: var(--text-muted); font-size: .8rem;
  pointer-events: none;
}
#dm-search {
  width: 100%;
  padding: 7px 10px 7px 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .82rem;
  font-family: inherit;
  transition: border-color var(--transition);
}
#dm-search:focus { outline: none; border-color: var(--accent); }
 
.dm-filters {
  display: flex; gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.dm-filter-btn {
  flex: 1;
  padding: 4px 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--transition);
}
.dm-filter-btn.active,
.dm-filter-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
 
.dm-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
 
.dm-conv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background var(--transition), border-color var(--transition);
  position: relative;
}
.dm-conv-item:hover { background: var(--surface); }
.dm-conv-item.active {
  background: var(--accent-light);
  border-left-color: var(--accent);
}
.dm-conv-item.has-unread { background: var(--surface); }
 
.dm-conv-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}
.dm-conv-body { flex: 1; min-width: 0; }
.dm-conv-name {
  font-size: .83rem; font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm-conv-preview {
  font-size: .75rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
.dm-conv-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  flex-shrink: 0;
}
.dm-conv-time { font-size: .68rem; color: var(--text-muted); }
.dm-conv-unread-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
}
.dm-conv-status {
  font-size: .65rem; font-weight: 700;
  padding: 1px 5px;
  border-radius: 99px;
}
.dm-conv-status.open   { background: var(--success-light); color: var(--success); }
.dm-conv-status.closed { background: var(--surface2); color: var(--text-muted); }
 
.dm-loading {
  text-align: center; padding: 24px 0;
  color: var(--text-muted); font-size: .85rem;
}
 
.dm-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}
 
.dm-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; color: var(--text-muted);
  font-size: .9rem; text-align: center; padding: 32px;
}
.dm-empty i { font-size: 2.5rem; opacity: .3; }
 
.dm-chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  flex-shrink: 0;
}
.dm-chat-header-info { display: flex; align-items: center; gap: 10px; }
.dm-chat-avatar { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--border); }
.dm-chat-name   { display: block; font-size: .9rem; font-weight: 600; color: var(--text); }
.dm-chat-subject { display: block; font-size: .75rem; color: var(--text-muted); }
.dm-chat-actions { display: flex; gap: 6px; margin-right: 30px; }
 
.dm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dm-msg {
  display: flex;
  flex-direction: column;
  max-width: 72%;
  animation: dm-msg-in .15s ease;
}
@keyframes dm-msg-in { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: translateY(0) } }
 
.dm-msg.mine  { align-self: flex-end; align-items: flex-end; }
.dm-msg.other { align-self: flex-start; align-items: flex-start; }
 
.dm-msg-meta {
  font-size: .68rem;
  color: var(--text-muted);
  margin-bottom: 3px;
  display: flex; align-items: center; gap: 6px;
}
.dm-msg-meta .dm-msg-role {
  padding: 1px 5px;
  border-radius: 99px;
  font-weight: 700;
  font-size: .62rem;
}
.dm-msg-role.staff  { background: var(--accent-light); color: var(--accent); }
.dm-msg-role.player { background: var(--surface2); color: var(--text-muted); }
 
.dm-msg-bubble {
  padding: 9px 14px;
  border-radius: 16px;
  font-size: .855rem;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.dm-msg.mine  .dm-msg-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.dm-msg.other .dm-msg-bubble {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
 
.dm-msg-read {
  font-size: .65rem; color: var(--text-muted);
  margin-top: 2px; display: flex; align-items: center; gap: 3px;
}
 
.dm-date-separator {
  text-align: center;
  font-size: .7rem;
  color: var(--text-muted);
  padding: 4px 0;
  position: relative;
}
.dm-date-separator::before,
.dm-date-separator::after {
  content: '';
  position: absolute;
  top: 50%; width: 35%;
  height: 1px;
  background: var(--border);
}
.dm-date-separator::before { left: 0; }
.dm-date-separator::after  { right: 0; }

.dm-input-bar {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--surface);
  flex-shrink: 0;
}
.dm-textarea {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .875rem;
  padding: 9px 12px;
  resize: none;
  overflow-y: hidden;
  max-height: 150px;
  line-height: 1.5;
  transition: border-color var(--transition);
}
.dm-textarea:focus { outline: none; border-color: var(--accent); }
.dm-send-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
}
.dm-send-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.dm-send-btn:active { transform: translateY(0); }
 
.dm-new-form {
  position: absolute; inset: 0;
  background: var(--surface);
  z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.dm-new-form-inner {
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column; gap: 16px;
}
.dm-new-form-inner h4 {
  font-size: 1.05rem; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
}
.dm-new-form-inner h4 i { color: var(--accent); }
.dm-new-form-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 4px;
}
 
.dm-close-btn {
  position: absolute;
  top: 10px; right: 12px;
  width: 28px; height: 28px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: .9rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition);
  z-index: 20;
}
.dm-close-btn:hover { background: var(--surface2); color: var(--text); }
 
@media (max-width: 640px) {
  .dm-modal { flex-direction: column; height: 95vh; width: 98vw; }
  .dm-sidebar { width: 100%; height: 220px; border-right: none; border-bottom: 1px solid var(--border); }
  .dm-filters { display: none; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
