﻿:root {
  --bg: #050507;
  --panel: rgba(11, 11, 13, 0.72);
  --panel-solid: #0b0b0d;
  --raised: #181818;
  --modal: #101012;
  --border: #27272a;
  --border-2: #3f3f46;
  --text: #f4f4f5;
  --muted: #8b8b94;
  --soft: #c4c4cc;
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.2);
  --accent-line: rgba(99, 102, 241, 0.3);
  --accent-text: #c7c9ff;
  --accent-2: #a5b4fc;
  --danger: #dc2626;
  --danger-text: #f87171;
  --green: #22c55e;
  --bg-image: none;
  --blur: 14px;
}

:root[data-theme="light"] {
  --bg: #f5f6fa;
  --panel: rgba(255,255,255,.9);
  --panel-solid: #ffffff;
  --raised: #eeeef3;
  --modal: #ffffff;
  --border: #dfe1e8;
  --border-2: #c4c4ce;
  --text: #20222b;
  --muted: #717582;
  --soft: #3f3f46;
  --accent: #5865f2;
  --accent-soft: rgba(88, 101, 242, .14);
  --accent-line: rgba(88, 101, 242, .3);
  --accent-text: #4338ca;
  --accent-2: #4f46e5;
  --danger-text: #dc2626;
  --bg-image: none;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image: var(--bg-image);
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; line-height: 1.25; }
a { color: #818cf8; }
a:hover { color: #a5b4fc; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #3f3f46; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }

/* ---------- Login ---------- */

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 32px 28px;
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-logo img { width: 100%; height: 100%; object-fit: contain; }

.login-brand { display: flex; flex-direction: column; gap: 6px; }
.login-title { font-size: 22px; font-weight: 700; }
.login-sub { font-size: 13px; color: #818cf8; }

.login-copy { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.login-hello { font-size: 16px; font-weight: 600; }
.login-note { font-size: 13px; color: var(--muted); line-height: 1.5; }

.login-btn {
  width: 100%;
  padding: 14px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}
.login-btn:hover { background: #7477f3; color: #fff; }

.login-terms { font-size: 11px; color: var(--muted); }

/* ---------- App shell ---------- */

.app {
  height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 56px;
  flex-shrink: 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: relative;
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar-left, .topbar-right { display: flex; align-items: center; min-width: 0; }
.topbar-left { gap: 16px; }
.topbar-right { gap: 8px; }

.top-nav { display: flex; align-items: center; gap: 8px; }
.top-tab {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.top-tab:hover, .top-tab.active { background: var(--raised); color: var(--text); }
.top-tab svg { width: 14px; height: 14px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand img { width: 28px; height: 28px; border-radius: 8px; object-fit: contain; }

.online { color: var(--muted); }

.me { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.me img { width: 28px; height: 28px; border-radius: 50%; background: var(--border); object-fit: cover; }

.account { position: relative; z-index: 20; }
.account-trigger {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
}
.account-trigger:hover, .account-trigger[aria-expanded="true"] { background: var(--raised); border-color: var(--border); }
.account-trigger img { width: 28px; height: 28px; border-radius: 50%; background: var(--border); object-fit: cover; }
.account-chevron { width: 14px; height: 14px; color: var(--muted); transition: transform .15s ease; }
.account-trigger[aria-expanded="true"] .account-chevron { transform: rotate(180deg); }
.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--modal);
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
  backdrop-filter: blur(16px);
}
.account-summary { display: flex; align-items: center; gap: 10px; padding: 14px; border-bottom: 1px solid var(--border); }
.account-summary img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--border); }
.account-summary div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.account-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-summary span { color: var(--muted); font-size: 12px; }
.account-item { width: 100%; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 0; background: transparent; color: var(--text); text-align: left; font-size: 13px; }
.account-item:hover { background: var(--raised); }
.account-item > span { width: 16px; color: var(--muted); text-align: center; }
.account-logout { border-top: 1px solid var(--border); color: #f87171; }
.account-logout > span { color: #f87171; }

.ghost-btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.ghost-btn:hover { color: var(--text); border-color: #3f3f46; }

.layout {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 8px;
  padding: 8px;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 16px;
}

/* ---------- Sidebar ---------- */

.sidebar {
  width: clamp(300px, 26vw, 384px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

.sidebar-head { display: flex; align-items: center; justify-content: space-between; }
.panel-title { font-size: 15px; font-weight: 700; }

.conn {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}
.conn.off { background: rgba(220, 38, 38, 0.15); color: #f87171; }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.sidebar > .input { height: 40px; border-radius: 999px; padding: 0 20px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.input::placeholder, .textarea::placeholder { color: #5b5b63; }

.select { padding: 8px 10px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, #8b8b94 50%), linear-gradient(135deg, #8b8b94 50%, transparent 50%); background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 26px; }

.filters { display: flex; gap: 8px; }
.filters .select { flex: 1; min-width: 0; }
.filter-dropdown { position: relative; flex: 1; min-width: 0; }
.filter-trigger {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  text-align: left;
}
.filter-trigger:hover, .filter-trigger[aria-expanded="true"] { border-color: var(--accent); }
.filter-trigger svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--muted); }
.filter-label { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; }
.filter-label > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-label .avatar { width: 24px; height: 24px; flex: 0 0 24px; }
.filter-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  padding: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--modal);
  box-shadow: 0 16px 36px rgba(0,0,0,.5);
}
.filter-menu button {
  width: 100%;
  min-height: 36px;
  padding: 8px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  text-align: left;
}
.filter-menu button { display: flex; align-items: center; gap: 9px; min-height: 38px; }
.filter-menu button > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-option-icon { display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; border: 1px solid var(--border); border-radius: 50%; color: var(--muted); font-size: 12px; }
.filter-option-all { color: var(--accent); border-color: var(--accent-line); }
.filter-menu button:hover, .filter-menu button:focus-visible { background: var(--raised); outline: none; }
#status-dropdown .filter-menu button { min-height: 30px; padding: 6px 10px; }
#staff-dropdown .filter-menu button { min-height: 34px; padding: 5px 10px; }
#source-dropdown .filter-menu button { min-height: 30px; padding: 6px 10px; }

.ticket-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 -4px;
  padding: 0 4px;
}

.ticket-item {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: 0 5px 18px rgba(0, 0, 0, .2);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.ticket-item:hover { background: #181818; border-color: #3f3f46; transform: translateY(-1px); }
.ticket-item.active { background: #181818; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft), 0 8px 24px rgba(0, 0, 0, .32); }
.ticket-item.overdue { border-color: rgba(239, 68, 68, .72); background: rgba(127, 29, 29, .16); box-shadow: none; }
.ticket-item.overdue:hover, .ticket-item.overdue.active { border-color: #ef4444; background: rgba(127, 29, 29, .24); }

.ticket-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; min-width: 0; }
.ticket-top .avatar { flex: 0 0 28px; }
.ticket-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ticket-time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.ticket-preview { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 100%; }
.ticket-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap; }
.ticket-id { color: var(--muted); font-size: 10px; letter-spacing: 0.03em; }

.sidebar-foot { color: var(--muted); font-size: 11px; }

/* ---------- Chat ---------- */

.chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-head {
  height: 60px;
  flex-shrink: 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.chat-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-status { color: var(--muted); white-space: nowrap; }
.assignment-control { position: relative; margin-left: auto; }
.assignment-trigger { display: inline-flex; align-items: center; gap: 8px; min-width: 150px; max-width: 230px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--raised); color: var(--text); font-size: 12px; text-align: left; }
.assignment-trigger:hover, .assignment-trigger[aria-expanded="true"] { border-color: var(--accent); }
.assignment-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assignment-trigger svg { width: 14px; height: 14px; margin-left: auto; flex-shrink: 0; color: var(--muted); }
.assignment-menu { position: absolute; z-index: 45; top: calc(100% + 7px); right: 0; width: 260px; max-height: 280px; overflow-y: auto; padding: 5px; border: 1px solid var(--border); border-radius: 12px; background: #101012; box-shadow: 0 18px 45px rgba(0,0,0,.55); }
.assignment-option { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; }
.assignment-option:hover, .assignment-option.selected { background: var(--raised); }
.assignment-option > span:not(.avatar):not(.assignment-free) { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.assignment-option b, .assignment-option small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assignment-option small { color: var(--muted); font-size: 11px; }
.assignment-free { width: 28px; height: 28px; flex: 0 0 28px; border: 1px dashed #71717a; border-radius: 50%; }
.chat-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.public-id { color: var(--muted); font-size: 11px; letter-spacing: 0.04em; }

.chat-search {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 5, 7, 0.45);
}
.chat-search input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
}
.chat-search input:focus { border-color: var(--accent); }
.chat-search-count { color: var(--muted); font-size: 11px; white-space: nowrap; }

.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 0;
  background: var(--raised);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--raised); }
.icon-btn svg { width: 15px; height: 15px; display: block; }
.back-btn { display: none; background: transparent; }

.danger-btn {
  padding: 8px 16px;
  border-radius: 10px;
  border: 0;
  background: var(--danger);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}
.danger-btn:hover { background: #ef4444; }

.primary-btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}
.primary-btn:hover { background: #7477f3; }

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg-day {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--raised);
  text-align: center;
}
.history-event {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(90%, 520px);
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--raised) 82%, transparent);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
.history-event span { white-space: nowrap; opacity: .75; }
.history-truncated { align-self: center; color: var(--muted); font-size: 11px; text-align: center; }

.msg { display: flex; flex-direction: column; gap: 4px; max-width: 620px; position: relative; }
.msg.user { align-self: flex-start; align-items: flex-start; max-width: 520px; }
.msg.user > .avatar { margin-bottom: -2px; }
.msg.staff { align-self: flex-end; align-items: flex-end; }
.msg.system { align-self: center; align-items: center; max-width: 100%; }

.msg-author { color: var(--muted); font-size: 11px; }
.msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user .msg-bubble { background: var(--panel-solid); border: 1px solid var(--border); border-radius: 14px 14px 14px 4px; box-shadow: 0 4px 14px rgba(0, 0, 0, .14); }
.msg.staff .msg-bubble { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 14px 14px 4px 14px; }
.msg.system .msg-bubble {
  background: rgba(99, 102, 241, 0.08);
  border: 1px dashed var(--accent-line);
  color: #a5b4fc;
  border-radius: 10px;
  font-size: 12px;
  text-align: center;
}
.msg-time { color: var(--muted); font-size: 11px; }
.msg.deleted .msg-bubble { opacity: 0.6; font-style: italic; }
.msg.deleted .msg-author { text-decoration: line-through; }
.edited { font-size: 11px; color: var(--muted); margin-left: 6px; }

.msg-actions {
  position: absolute;
  top: -10px;
  right: 0;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.12s ease;
  background: #0b0b0d;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  z-index: 2;
}
.msg.staff:hover .msg-actions, .msg-actions:focus-within { opacity: 1; }
.msg-action {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 6px;
}
.msg-action:hover { background: var(--raised); color: var(--text); }
.msg-action.delete:hover { color: #f87171; }

.attachments { display: flex; flex-wrap: wrap; gap: 6px; }
.attachments a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--raised);
  border: 1px solid var(--border);
  color: #c7c7cd;
  text-decoration: none;
  font-size: 12px;
}
.attachments a:hover { border-color: var(--accent); }
.attachment-media { flex-direction: column !important; align-items: flex-start !important; padding: 5px !important; max-width: 260px; }
.attachment-media img { display: block; width: min(250px, 60vw); max-height: 220px; object-fit: contain; border-radius: 6px; background: #050507; }
.attachment-media span { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-previews { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 8px; }
.pending-attachment { position: relative; flex: 0 0 58px; width: 58px; height: 58px; overflow: hidden; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--raised); }
.pending-attachment img { width: 100%; height: 100%; object-fit: cover; }
.pending-attachment button { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: rgba(0,0,0,.75); color: #fff; line-height: 18px; }

.delivery { font-size: 11px; color: #f87171; }
.delivery.sent, .delivery.received { color: #4ade80; }

.composer { padding: 12px 16px; border-top: 1px solid var(--border); }
.composer-box {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 6px 6px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.composer-tools { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.composer-tools .icon-btn { background: transparent; color: var(--muted); }
.composer-tools .icon-btn:hover { background: var(--raised); color: var(--text); }
.emoji-toggle { font-size: 19px; line-height: 1; color: var(--muted); }
.emoji-toggle:hover { color: var(--text); }
.composer-box:focus-within { border-color: #3f3f46; }
.composer-box.drag-over { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer-box.drag-over::after { content: '╨Ю╤В╨┐╤Г╤Б╤В╨╕╤В╨╡ ╨╕╨╖╨╛╨▒╤А╨░╨╢╨╡╨╜╨╕╨╡'; position: absolute; inset: 4px; display: grid; place-items: center; border: 1px dashed var(--accent); border-radius: 999px; background: rgba(5, 5, 7, .88); color: var(--text); font-size: 12px; font-weight: 600; pointer-events: none; }
.composer-box input, .composer-box textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 0;
  outline: none;
  font-size: 13px;
}
.composer-box textarea { min-height: 34px; max-height: 140px; resize: none; line-height: 1.45; overflow-y: auto; }
.composer-box input::placeholder, .composer-box textarea::placeholder { color: #5b5b63; }
.composer.closed { display: none; }

.empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  padding: 20px;
}
.empty svg { width: 40px; height: 40px; margin: 0 auto; opacity: 0.5; }

/* ---------- Info panel ---------- */

.info {
  width: 320px;
  flex-shrink: 0;
  padding: 20px;
  overflow-y: auto;
}

.info-body { display: flex; flex-direction: column; gap: 16px; min-height: 100%; }

.info-profile { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.info-name { font-weight: 700; font-size: 16px; }
.info-username { color: var(--muted); }
.info-id { color: var(--muted); font-size: 11px; }

.avatar {
  border-radius: 50%;
  background: #27272a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #a1a1aa;
  font-weight: 600;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-72 { width: 72px; height: 72px; font-size: 26px; }
.avatar-32 { width: 32px; height: 32px; font-size: 13px; }
.avatar-28 { width: 28px; height: 28px; font-size: 11px; }
.avatar-24 { width: 24px; height: 24px; font-size: 10px; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}
.badge.open { background: rgba(22, 163, 74, 0.2); color: #4ade80; }
.badge.pending { background: rgba(234, 179, 8, 0.18); color: #facc15; }
.badge.escalation { background: rgba(249, 115, 22, 0.18); color: #fb923c; }
.badge.closed { background: rgba(113, 113, 122, 0.2); color: #a1a1aa; }
.badge.overdue { background: rgba(239, 68, 68, .18); color: #f87171; }

.info-section { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.info-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.info-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.info-row > span:first-child { color: var(--muted); }
.info-row > span:last-child { text-align: right; }
.info-actions { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Quick replies ---------- */

.quick-panel {
  position: fixed;
  width: 420px !important;
  min-width: 420px !important;
  max-width: 420px !important;
  flex: 0 0 420px;
  box-sizing: border-box;
  height: 258px;
  max-height: 258px;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-radius: 14px;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  z-index: 60;
}
.emoji-panel { position: fixed; z-index: 62; padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--modal); box-shadow: 0 18px 40px rgba(0,0,0,.55); }
.emoji-panel-title { padding: 2px 4px 8px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.emoji-grid button { min-width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; font-size: 20px; cursor: pointer; }
.emoji-grid button:hover { background: var(--raised); transform: scale(1.08); }
.quick-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 4px 8px;
}
.quick-tabs { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); }
.quick-tabs button { flex: 1; padding: 7px 5px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; }
.quick-tabs button.active { background: var(--raised); color: var(--text); }
.quick-empty { padding: 18px 8px; color: var(--muted); font-size: 12px; line-height: 1.4; text-align: center; }
.quick-item {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
}
.quick-item:hover { background: var(--raised); }
.quick-item b { font-size: 12px; font-weight: 600; }
.quick-item span { font-size: 11px; color: var(--muted); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: normal; }

/* ---------- Modals ---------- */

.modal {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  width: min(560px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.76); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }

.modal-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-radius: 16px;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.modal[open] .modal-card { animation: modal-in .18s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
.role-dialog-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.role-dialog-choices { display: flex; flex-direction: column; gap: 8px; }
.role-dialog-choices button { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); text-align: left; font-weight: 600; }
.role-dialog-choices button:hover { border-color: var(--accent); }
.role-dialog-choices button.selected { border-color: var(--accent); background: var(--accent-soft); color: #c7c9ff; }
.textarea { resize: vertical; min-height: 90px; }

.close-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: 12px;
  background: var(--raised);
  font-size: 12px;
  color: #c7c7cd;
}
.close-info b { color: var(--text); }

.section-card { width: 100%; }
#section-dialog { width: min(700px, calc(100vw - 32px)); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head .icon-btn { background: transparent; color: var(--muted); font-size: 20px; }
.section-empty { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); text-align: center; }
.section-empty strong { color: var(--text); font-size: 15px; }
.section-empty-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--raised); color: var(--accent-2); font-size: 22px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-card { display: flex; flex-direction: column; gap: 5px; padding: 14px; border-radius: 12px; background: var(--raised); border: 1px solid var(--border); }
.stat-card b { font-size: 24px; color: #a5b4fc; }
.stat-card span, .section-note { color: var(--muted); font-size: 12px; }
.section-block { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.section-label { color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.staff-list { display: flex; flex-direction: column; gap: 4px; }
.staff-row { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 9px; background: var(--raised); }
.staff-row > span:last-child { color: var(--muted); font-size: 11px; }
.staff-presence { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.account-settings { display: flex; flex-direction: column; gap: 14px; }
.account-settings > img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--border); }
.account-settings > div { display: flex; flex-direction: column; gap: 4px; }
.account-settings > div span { color: var(--muted); }
.account-settings dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; }
.account-settings dt { color: var(--muted); }
.account-settings dd { margin: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Admin workspace ---------- */

.admin-view {
  position: absolute;
  z-index: 20;
  inset: 64px 0 0;
  display: flex;
  min-height: 0;
  overflow: hidden;
  background-color: var(--bg);
  background-image: var(--bg-image);
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}
.workspace-mode .topbar { display: none; }
.workspace-mode .admin-view { inset: 0; }
.workspace-mode .settings-view { inset: 0; }
.workspace-head { height: 56px; flex: 0 0 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--border); background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.workspace-brand, .workspace-user { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.workspace-brand img { width: 28px; height: 28px; border-radius: 8px; object-fit: contain; }
.workspace-user { gap: 8px; }
.workspace-user img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: #27272a; }
.admin-sidebar {
  width: 240px;
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 20px 16px;
  border-right: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.admin-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.admin-brand img { width: 32px; height: 32px; border-radius: 10px; object-fit: contain; }
.admin-brand div { display: flex; flex-direction: column; gap: 2px; }
.admin-brand strong { font-weight: 700; }
.admin-brand span { color: var(--muted); font-size: 11px; }
.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-nav button { padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 500; text-align: left; }
.admin-nav button:hover { background: var(--raised); color: var(--text); }
.admin-nav button.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.admin-note { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); }
.admin-note strong { color: #a5b4fc; font-size: 12px; }
.admin-note span { color: var(--muted); line-height: 1.5; font-size: 12px; }
.admin-main { flex: 1; min-width: 0; overflow-y: auto; padding: 20px 32px 40px; }
.admin-main-head { display: flex; align-items: center; justify-content: space-between; max-width: 1120px; margin: 0 auto 18px; }
.admin-live { color: var(--muted); font-size: 11px; }
.admin-live i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: var(--green); }
.admin-content { width: min(1120px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.admin-page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; }
.admin-page-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.admin-page-head p { margin: 6px 0 0; color: var(--muted); }
.admin-page-actions { display: flex; align-items: center; gap: 8px; }
.stats-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.segmented, .month-switch { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.segmented button, .month-switch button { min-height: 34px; padding: 8px 16px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; }
.segmented button.active { background: var(--accent); color: #fff; }
.month-switch button { width: 34px; padding: 0; font-size: 18px; }
.month-switch b { min-width: 130px; text-align: center; text-transform: capitalize; }
.stats-toolbar select { min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--text); font-weight: 600; }
.admin-search { width: 240px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--text); outline: none; }
.admin-search:focus { border-color: var(--accent); }
.admin-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.admin-stat, .admin-card { border: 1px solid var(--border); border-radius: 16px; background: var(--panel); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); }
.admin-stat { display: flex; flex-direction: column; gap: 8px; padding: 18px; }
.admin-stat span, .admin-stat small, .admin-muted { color: var(--muted); }
.admin-stat b { font-size: 32px; line-height: 1; letter-spacing: -.02em; }
.admin-stat small { font-size: 12px; }
.admin-card { padding: 20px 22px; }
.admin-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.admin-chart { height: 230px; display: flex; align-items: stretch; gap: 4px; padding: 0 4px; border-bottom: 1px dashed var(--border); }
.chart-column { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; }
.chart-column b { color: var(--muted); font-size: 10px; font-weight: 500; }
.chart-bar { width: min(24px, 100%); min-height: 3px; height: var(--bar-height); border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #818cf8, #4f46e5); opacity: .9; }
.chart-bar.zero { opacity: .12; }
.chart-column:hover .chart-bar { background: #a5b4fc; }
.stats-chart-card { gap: 16px; }
.chart-legend { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 3px; background: var(--accent); }
.admin-chart-grid { position: relative; height: 220px; margin-left: 30px; }
.admin-chart-grid .admin-chart { position: absolute; inset: 0 0 20px; height: 220px; align-items: stretch; border-bottom: 0; z-index: 1; }
.chart-lines { position: absolute; inset: 0 0 30px; display: flex; flex-direction: column; justify-content: space-between; border-bottom: 1px dashed var(--border); }
.chart-lines i { display: block; border-top: 1px dashed var(--border); }
.stats-table { overflow-x: auto; border: 1px solid var(--border); border-radius: 18px; background: var(--panel); }
.stats-table-head, .stats-staff-row { display: grid; grid-template-columns: 44px minmax(180px,1.5fr) minmax(120px,2fr) 84px 76px 120px; gap: 12px; align-items: center; padding: 12px 20px; }
.stats-table-head, .stats-staff-row { min-width: 760px; }
.stats-table-head { padding-top: 14px; padding-bottom: 14px; background: #050507; color: var(--muted); font-size: 12px; }
.stats-staff-row { border-top: 1px solid var(--border); }
.stats-staff-row > small { color: var(--muted); font-size: 11px; }
.stats-staff-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stats-staff-user > span { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.stats-staff-user small { color: var(--muted); font-size: 11px; }
.rank { color: var(--muted); font-weight: 800; text-align: center; }
.rank-1, .rank-2, .rank-3 { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.rank-1 { background: #eab308; color: #050507; }
.rank-2 { background: #a1a1aa; color: #050507; }
.rank-3 { background: #c2410c; color: #fff; }
.stats-progress { height: 8px; overflow: hidden; border-radius: 4px; background: #18181b; }
.stats-progress span { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.stat-positive { color: #4ade80 !important; font-weight: 600; }
.staff-stats-select { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); }
.staff-stats-select > strong { font-size: 12px; color: var(--muted); }
.staff-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.staff-picker-option { min-width: 0; display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 11px; background: var(--bg); color: var(--text); text-align: left; }
.staff-picker-option:hover, .staff-picker-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.staff-picker-option > span { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.staff-picker-option b, .staff-picker-option small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-picker-option small { color: var(--muted); font-size: 11px; }
.staff-picker-option i { margin-left: auto; color: var(--accent-2); font-style: normal; opacity: 0; }
.staff-picker-option.selected i { opacity: 1; }
.staff-ticket-list { display: flex; flex-direction: column; gap: 6px; }
.staff-ticket-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text); text-align: left; }
.staff-ticket-row:hover { background: #18181b; }
.staff-ticket-row > span:not(.avatar) { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.staff-ticket-row > .avatar { width: 28px; height: 28px; flex: 0 0 28px; display: inline-flex; }
.staff-ticket-row small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.staff-ticket-row em { color: var(--muted); font-size: 11px; font-style: normal; white-space: nowrap; }
.chart-empty { width: 100%; align-self: center; text-align: center; color: var(--muted); }
.admin-ranking { display: flex; flex-direction: column; }
.admin-ranking-row { display: grid; grid-template-columns: 28px 32px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--border); }
.admin-ranking-row:first-child { border-top: 0; }
.admin-ranking-row .rank { color: var(--muted); font-weight: 700; text-align: center; }
.admin-ranking-row > div { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.admin-ranking-row small, .admin-list-main small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-two-col { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); gap: 20px; align-items: start; }
.admin-form { display: flex; flex-direction: column; gap: 14px; }
.admin-form > strong { font-size: 15px; }
.admin-form label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.admin-form input, .admin-form select, .admin-form textarea { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); outline: none; }
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus { border-color: var(--accent); }
.admin-form textarea { resize: vertical; }
.admin-form-note { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.role-label { color: var(--muted); font-size: 12px; }
.role-choices { display: flex; flex-direction: column; gap: 8px; }
.role-choice { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); text-align: left; }
.role-choice:hover { border-color: #3f3f46; }
.role-choice.selected { border-color: var(--accent); background: rgba(99,102,241,.08); }
.role-choice i { width: 18px; height: 18px; flex: 0 0 18px; border: 2px solid #3f3f46; border-radius: 50%; }
.role-choice.selected i { border: 5px solid var(--accent); }
.role-choice b { flex: 1; }
.role-choice small { color: var(--muted); font-size: 11px; }
.role-choice.disabled { opacity: .55; cursor: not-allowed; }
.admin-list { display: flex; flex-direction: column; gap: 8px; max-width: 900px; }
.admin-list.compact { max-width: none; }
.admin-list-row { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); }
.admin-list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.admin-role { padding: 5px 10px; border-radius: 999px; background: rgba(99,102,241,.14); color: #a5b4fc; font-size: 11px; font-weight: 700; white-space: nowrap; }
.admin-role.owner { background: rgba(234,179,8,.14); color: #fde047; }
.admin-remove { border: 1px solid rgba(220,38,38,.4); color: #f87171; }
.admin-empty, .admin-loading, .admin-error { padding: 28px; color: var(--muted); text-align: center; }
.admin-error { color: #fca5a5; }
.admin-error small { color: var(--muted); }
.reply-row .admin-list-main small { white-space: normal; line-height: 1.4; }

/* ---------- Ban list ---------- */

.ban-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.ban-head > div { display: flex; flex-direction: column; gap: 5px; }
.ban-head strong { font-size: 17px; }
.ban-head span { color: var(--muted); }
.ban-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px 0; }
.ban-form input { min-width: 0; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); outline: none; }
.ban-date { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 11px; }
.ban-date input { width: 100%; }
.ban-form > .primary-btn { align-self: end; min-height: 40px; }
.ban-form input:focus { border-color: var(--accent); }
.ban-list { display: flex; flex-direction: column; gap: 10px; max-height: min(55vh, 520px); overflow-y: auto; padding-top: 14px; }
.ban-row { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); }
.avatar-40 { width: 40px; height: 40px; }
.ban-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ban-main strong { display: flex; gap: 8px; }
.ban-main span { color: #c4c4cc; font-size: 12px; }
.ban-main small { color: var(--muted); font-size: 11px; }
.ban-expiry { padding: 5px 10px; border-radius: 999px; background: rgba(234,179,8,.14); color: #fde047; font-size: 11px; white-space: nowrap; }
.ban-expiry.forever { background: rgba(220,38,38,.14); color: #fca5a5; }
.danger-outline { padding: 8px 12px; border: 1px solid rgba(220,38,38,.4); border-radius: 10px; background: transparent; color: #f87171; font-weight: 600; font-size: 12px; white-space: nowrap; }
.danger-outline:hover { background: rgba(220,38,38,.12); }

/* ---------- Account settings ---------- */

.settings-view { position: absolute; z-index: 20; inset: 0; overflow: hidden; display: flex; flex-direction: column; background-color: var(--bg); background-image: var(--bg-image); background-position: center; background-size: cover; background-attachment: fixed; }
.settings-panel { flex: 1; min-height: 0; margin: 16px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 20px; background: var(--panel); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); }
.settings-head { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); font-size: 15px; }
.settings-head .icon-btn { font-size: 17px; }
.settings-body { flex: 1; min-height: 0; display: flex; }
.settings-nav { width: 240px; flex: 0 0 240px; display: flex; flex-direction: column; gap: 4px; padding: 16px; border-right: 1px solid var(--border); }
.settings-nav button { padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 500; text-align: left; }
.settings-nav button:hover { background: var(--raised); color: var(--text); }
.settings-nav button.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.settings-content { flex: 1; min-width: 0; overflow-y: auto; padding: 36px 24px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.settings-page-head, .settings-narrow, .customization-grid { width: min(760px, 100%); }
.settings-page-head { display: flex; flex-direction: column; gap: 6px; }
.settings-page-head h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.settings-page-head p { margin: 0; color: var(--muted); }
.settings-narrow { max-width: 560px; display: flex; flex-direction: column; gap: 20px; }
.settings-stack { gap: 22px; }
.settings-stack > section { display: flex; flex-direction: column; gap: 10px; }
.settings-card, .settings-profile-card, .token-note, .bind-row { border: 1px solid var(--border); border-radius: 16px; background: var(--bg); }
.settings-profile-card { display: flex; align-items: center; gap: 16px; padding: 18px; }
.settings-profile-card > div { display: flex; flex-direction: column; gap: 5px; }
.settings-profile-card span, .settings-form small, .settings-profile-card b { color: var(--muted); font-size: 12px; }
.settings-profile-card b { align-self: flex-start; padding: 3px 9px; border-radius: 999px; background: rgba(88,101,242,.2); color: #a5b4fc; font-size: 11px; }
.avatar-64 { width: 64px; height: 64px; }
.settings-form { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.settings-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.settings-form input, .settings-form textarea, .settings-input { padding: 11px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--text); outline: none; }
.settings-form input:focus, .settings-form textarea:focus, .settings-input:focus { border-color: var(--accent); }
.settings-form-row { display: flex; gap: 10px; }
.settings-form-row > * { flex: 1; min-width: 0; }
.choice-list, .toggle-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--bg); }
.choice { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; }
.choice:last-child, .toggle-row:last-child { border-bottom: 0; }
.choice.selected { background: rgba(99,102,241,.08); box-shadow: inset 0 0 0 1px rgba(99,102,241,.7); }
.choice span, .toggle-row span { display: flex; flex-direction: column; gap: 3px; }
.choice small, .toggle-row small { color: var(--muted); font-size: 12px; }
.choice i { width: 18px; height: 18px; border: 2px solid #3f3f46; border-radius: 50%; }
.choice.selected i { border: 5px solid var(--accent); }
.bind-row { display: flex; align-items: center; gap: 10px; padding: 14px; }
.bind-row kbd { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); font-weight: 600; }
.bind-capture { flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); text-align: left; font-weight: 600; }
.bind-capture:hover, .bind-capture.capturing { border-color: var(--accent); background: var(--accent-soft); }
.muted-bind { color: var(--muted); border-style: dashed; }
.customization-grid { display: grid; grid-template-columns: minmax(0,1fr) 260px; gap: 20px; align-items: start; }
.choice-grid { display: grid; gap: 10px; }
.choice-grid.two { grid-template-columns: 1fr 1fr; }
.choice-grid.three { grid-template-columns: repeat(3, 1fr); }
.theme-choice { padding: 13px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); color: var(--text); font-weight: 600; text-align: left; }
.theme-choice.selected { border-color: var(--accent); background: rgba(99,102,241,.08); }
.theme-choice small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 400; }
.settings-preview { position: sticky; top: 0; display: flex; flex-direction: column; gap: 8px; }
.settings-preview > div { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg); }
.settings-preview em { width: 70px; height: 6px; border-radius: 3px; background: var(--border); }
.settings-preview p { width: fit-content; max-width: 100%; margin: 0; padding: 6px 10px; border-radius: 10px; background: var(--raised); font-size: 11px; }
.settings-preview p:nth-of-type(2) { align-self: flex-end; background: rgba(99,102,241,.2); border: 1px solid rgba(99,102,241,.3); }
.settings-preview button { align-self: flex-start; padding: 6px 12px; border: 0; border-radius: 8px; background: var(--accent); color: white; font-size: 11px; font-weight: 600; }
.preview-dot { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); }
.toggle-row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; }
.toggle-row > span { flex: 1; }
.switch { width: 44px; height: 26px; position: relative; flex-shrink: 0; border-radius: 13px; background: #27272a; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #f4f4f5; transition: transform .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); background: white; }
.sound-options { display: flex; gap: 8px; }
.sound-options > * { flex: 1; }
.token-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px 14px; color: var(--muted); font-size: 12px; }
.token-note code { padding: 3px 8px; border-radius: 7px; background: rgba(99,102,241,.12); color: #a5b4fc; font-size: 11px; }
.form-bottom, .settings-session-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.form-bottom small { color: var(--muted); }
.personal-list, .session-list { display: flex; flex-direction: column; gap: 8px; }
.personal-row, .session-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); }
.personal-row > div, .session-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.personal-row span, .session-row span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.personal-row kbd { padding: 3px 8px; border-radius: 7px; background: var(--raised); color: var(--muted); font-size: 11px; }
.session-row > b { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(99,102,241,.15); color: #a5b4fc; font-size: 20px; line-height: 1; }
.session-row em { color: var(--muted); font-size: 12px; font-style: normal; font-weight: 500; white-space: nowrap; }
.session-row em.current { color: var(--text, inherit); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 8px);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 100;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.site-notifications { position: fixed; left: 20px; bottom: 20px; z-index: 160; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none; }
.site-notification { position: relative; width: min(340px, calc(100vw - 40px)); padding: 13px 38px 13px 14px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 12px; background: var(--modal); box-shadow: 0 18px 45px rgba(0,0,0,.42); opacity: 0; transform: translateY(12px); transition: opacity .2s ease, transform .2s ease; pointer-events: auto; }
.site-notification.show { opacity: 1; transform: none; }
.site-notification strong, .site-notification span { display: block; }
.site-notification strong { color: var(--text); font-size: 13px; }
.site-notification span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.site-notification.success { border-left-color: var(--green); }
.site-notification.closed { border-left-color: var(--danger); }
.site-notification button { position: absolute; top: 8px; right: 9px; border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.toggle-row.locked { cursor: default; opacity: .85; }
.toggle-row.locked:hover { border-color: var(--border); transform: none; }

.status-view { min-height: 100vh; background: var(--bg); color: var(--text); }
.status-head { height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 18px; border-bottom: 1px solid var(--border); background: var(--panel); }
.status-head strong { flex: 1; font-size: 16px; }
.status-content { width: min(760px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 48px; }
.status-loading { padding: 60px 0; color: var(--muted); text-align: center; }
.status-issue { display: flex; flex-direction: column; gap: 5px; margin-bottom: 18px; padding: 18px; border: 1px solid rgba(234,179,8,.45); border-radius: 18px; background: rgba(234,179,8,.09); }
.status-issue strong { color: #facc15; }
.status-issue span { color: var(--muted); font-size: 12px; }
.status-issue.ok { border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.08); }
.status-issue.ok strong { color: var(--green); }
.status-list { display: flex; flex-direction: column; gap: 12px; }
.status-card, .status-uptime { display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--panel); }
.status-card-icon { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 12px; background: var(--raised); color: var(--muted); font-size: 20px; }
.status-card-copy { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.status-card-copy strong { font-size: 13px; }
.status-card-copy span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-card > b { color: var(--danger-text); font-size: 12px; white-space: nowrap; }
.status-card.is-up > b { color: var(--green); }
.status-uptime { align-items: flex-start; margin-top: 12px; }
.status-uptime-copy { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.status-uptime-copy > span, .status-uptime-copy small { color: var(--muted); font-size: 11px; }
.status-uptime-copy > div { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 12px; }
.status-uptime-copy > div strong { color: var(--green); font-size: 20px; }
.uptime-bar { height: 6px; margin-top: 0 !important; border-radius: 999px; background: var(--raised); overflow: hidden; }
.uptime-bar i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
@media (max-width: 600px) { .site-notifications { left: 12px; bottom: 12px; } .status-content { padding-top: 18px; } }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .info { display: none; }
  .admin-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 430px) {
  #me-name { display: none; }
  .topbar-right { gap: 10px; }
  .top-nav { display: none; }
}

/* Customization overrides */
.primary-btn, .login-btn { background: var(--button-bg, var(--accent)); color: var(--button-text, #fff); }
.primary-btn:hover, .login-btn:hover { background: var(--button-bg, var(--accent)); filter: brightness(1.08); }
.panel, .admin-stat, .admin-card, .staff-stats-select, .stats-table, .admin-list-row, .ban-row, .settings-card, .settings-profile-card, .token-note, .bind-row, .personal-row, .session-row, .admin-sidebar, .settings-nav { background: var(--panel) !important; }
.modal-card, .filter-menu, .assignment-menu, .quick-panel, .media-dialog { background-color: var(--modal) !important; }
.ticket-item.active, .ticket-item:hover, .filter-trigger, .assignment-trigger { background: var(--raised); }
.msg.user .msg-bubble { background: var(--message-incoming-bg, var(--panel-solid)); color: var(--message-incoming-text, var(--text)); }
.msg.staff .msg-bubble { background: var(--message-outgoing-bg, var(--accent-soft)); border-color: var(--message-outgoing-border, var(--accent-line)); color: var(--message-outgoing-text, var(--text)); }
.msg.user .msg-author, .msg.staff .msg-author, .msg-time { color: var(--muted); }
.icon-btn, .composer-tools .icon-btn, .emoji-toggle { color: var(--icon, var(--muted)); }
.settings-preview > div { background: var(--secondary, var(--bg)); }

@media (max-width: 760px) {
  .topbar { padding: 0 12px; }
  .online { display: none; }
  .layout { padding: 0; gap: 0; }
  .panel { border-radius: 0; border-left: 0; border-right: 0; }
  .sidebar { width: 100%; border: 0; }
  .chat { display: none; }
  body.chat-open .sidebar { display: none; }
  body.chat-open .chat { display: flex; }
  .back-btn { display: flex; }
  .chat-head { padding: 0 12px; gap: 8px; }
  .chat-status, .public-id { display: none; }
  .messages { padding: 14px; }
  .msg { max-width: 86%; }
  .msg.user { max-width: 86%; }
  .danger-btn { padding: 8px 10px; font-size: 12px; }
  .quick-panel { width: calc(100vw - 24px) !important; min-width: 0 !important; max-width: calc(100vw - 24px) !important; flex-basis: auto; }
  .staff-picker { grid-template-columns: 1fr; }
  .admin-view { inset: 64px 0 0; overflow-y: auto; display: block; }
  .admin-sidebar { width: 100%; min-height: auto; padding: 12px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .admin-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-note { display: none; }
  .admin-main { overflow: visible; padding: 14px 12px 28px; }
  .admin-main-head { margin-bottom: 14px; }
  .admin-page-head h1 { font-size: 22px; }
  .admin-page-actions, .admin-search { width: 100%; }
  .admin-two-col { grid-template-columns: 1fr; }
  .admin-list-row { flex-wrap: wrap; }
  .admin-role { margin-left: 44px; }
  .ban-form { grid-template-columns: 1fr; }
  .ban-row { align-items: flex-start; flex-wrap: wrap; }
  .ban-expiry { margin-left: 54px; }
  .danger-outline { margin-left: auto; }
  .settings-view { inset: 64px 0 0; padding: 0; overflow-y: auto; }
  .settings-panel { height: auto; min-height: 100%; border-radius: 0; border-left: 0; border-right: 0; }
  .settings-body { display: block; }
  .settings-nav { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-right: 0; border-bottom: 1px solid var(--border); }
  .settings-content { padding: 24px 14px 32px; }
  .customization-grid { grid-template-columns: 1fr; }
  .settings-preview { display: none; }
  .choice-grid.three { grid-template-columns: 1fr; }
  .settings-form-row, .sound-options { flex-direction: column; display: flex; }
  .form-bottom { align-items: stretch; flex-direction: column; }
}

/* ---------- FearSupport design system ---------- */
body {
  background-color: #050507;
  background-image: radial-gradient(ellipse at 0 0, rgba(77,46,101,.18), transparent 42%), radial-gradient(ellipse at 100% 100%, rgba(45,57,130,.12), transparent 45%);
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}
.app { background: transparent; }
.topbar { height: 56px; padding: 0 20px; background: rgba(11,11,13,.72); border-color: #27272a; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.brand { gap: 10px; font-size: 13px; }
.brand img { width: 32px; height: 32px; border-radius: 9px; padding: 3px; background: var(--accent); }
.online { font-size: 12px; }
.online i { width: 8px; height: 8px; }
.layout { height: calc(100vh - 56px); gap: 12px; padding: 12px; }
.panel { background: rgba(11,11,13,.72); border: 1px solid #27272a; border-radius: 16px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.sidebar { width: 320px; padding: 16px; gap: 12px; }
.sidebar > .input { height: 40px; border-radius: 12px; padding: 0 12px; background: #181818; }
.filter-trigger { min-height: 40px; height: 40px; padding: 7px 10px; border-radius: 10px; background: #181818; }
.ticket-item { padding: 12px; border-radius: 12px; }
.ticket-top { grid-template-columns: 40px minmax(0,1fr) auto; gap: 10px; }
.ticket-top .avatar { width: 40px; height: 40px; }
.ticket-name { font-size: 14px; font-weight: 700; }
.ticket-preview { font-size: 12px; }
.chat-head { height: 56px; padding: 0 16px; }
.messages { padding: 20px; gap: 16px; }
.info { width: 300px; padding: 18px; }
.info-back { display: none; }
.info-toggle { display: none; }
.admin-view { inset: 56px 0 0; background-color: transparent; background-image: none; }
.workspace-head { height: 56px; flex-basis: 56px; background: rgba(11,11,13,.72); }
.settings-view { background-color: #050507; background-image: none; }
.admin-stat, .admin-card, .staff-stats-select, .stats-table, .admin-list-row, .ban-row, .settings-card, .settings-profile-card, .token-note, .bind-row, .personal-row, .session-row { background: rgba(11,11,13,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.admin-page-head h1, .settings-page-head h1 { font-weight: 800; letter-spacing: -.02em; }
.admin-sidebar, .settings-nav { background: rgba(11,11,13,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 16px; height: 16px; }
.account-item > span { display: inline-flex; align-items: center; justify-content: center; }
.account-item > span svg { width: 16px; height: 16px; }

@media (max-width: 760px) {
  .topbar { height: 56px; padding: 0 12px; }
  .layout { height: calc(100vh - 56px); padding: 0; gap: 0; }
  .panel { border-radius: 0; border-left: 0; border-right: 0; }
  .sidebar { width: 100%; padding: 12px; }
  .chat-head { height: 56px; padding: 0 12px; }
  .info-toggle { display: inline-flex; }
  .info { display: none; width: 100%; padding: 16px; overflow-y: auto; }
  body.info-open .sidebar, body.info-open .chat { display: none; }
  body.info-open .info { display: flex; }
  body.info-open .info-back { display: inline-flex; margin-bottom: 12px; }
  .admin-view { inset: 56px 0 0; }
  .admin-nav { display: flex; flex-direction: row; overflow-x: auto; padding-bottom: 2px; }
  .admin-nav button { flex: 0 0 auto; white-space: nowrap; }
  .settings-view { inset: 56px 0 0; }
}

/* Final compact workspace adjustments. */
body { background-image: radial-gradient(ellipse at 0 0, rgba(77,46,101,.18), transparent 42%), radial-gradient(ellipse at 100% 100%, rgba(45,57,130,.12), transparent 45%); }
.layout { grid-template-columns: minmax(320px, 360px) minmax(0,1fr) minmax(280px, 330px); }
.ticket-item { padding: 10px 11px; }
.ticket-top { grid-template-columns: 32px minmax(0,1fr) auto; gap: 8px; }.ticket-top .avatar { width: 32px; height: 32px; }
.filter-dropdown { min-width: 0; }.filter-trigger { width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.filter-trigger > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#source-dropdown .filter-menu button { min-height: 30px; padding: 6px 10px; }
.filter-menu:not(.hidden), .account-menu:not(.hidden), .assignment-menu:not(.hidden), .quick-panel:not(.hidden), .emoji-panel:not(.hidden) { animation: support-pop .14s ease-out both; transform-origin: top left; }
@keyframes support-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
#reply-form textarea, .admin-form textarea, .settings-form textarea { min-height: 86px; max-height: 140px; resize: none; overflow-y: auto; }
.site-notifications { left: 20px; right: auto; align-items: flex-start; }.site-notification { max-width: 340px; }
@media (max-width: 1100px) { .layout { grid-template-columns: minmax(300px, 340px) minmax(0,1fr); } }
@media (max-width: 760px) { .layout { grid-template-columns: 1fr; }.site-notifications { left: 12px; right: auto; } }

/* Final customization values override legacy fixed colors. */
.primary-btn, .login-btn { background: var(--button-bg, var(--accent)); color: var(--button-text, #fff); }
.primary-btn:hover, .login-btn:hover { background: var(--button-bg, var(--accent)); filter: brightness(1.08); }
.panel, .admin-stat, .admin-card, .staff-stats-select, .stats-table, .admin-list-row, .ban-row, .settings-card, .settings-profile-card, .token-note, .bind-row, .personal-row, .session-row, .admin-sidebar, .settings-nav { background: var(--panel) !important; }
.modal-card, .filter-menu, .assignment-menu, .quick-panel, .media-dialog { background-color: var(--modal) !important; }
.ticket-item.active, .ticket-item:hover, .filter-trigger, .assignment-trigger { background: var(--raised); }
.msg.user .msg-bubble { background: var(--message-incoming-bg, var(--panel-solid)); color: var(--message-incoming-text, var(--text)); }
.msg.staff .msg-bubble { background: var(--message-outgoing-bg, var(--accent-soft)); border-color: var(--message-outgoing-border, var(--accent-line)); color: var(--message-outgoing-text, var(--text)); }
.msg.user .msg-author, .msg.staff .msg-author, .msg-time { color: var(--muted); }
.icon-btn, .composer-tools .icon-btn, .emoji-toggle { color: var(--icon, var(--muted)); }
.settings-preview > div { background: var(--secondary, var(--bg)); }

/* ---------- Reference workspace ---------- */
.app { background: transparent; }
.topbar { height: 64px; padding: 0 24px; background: #0b0b0d; border-color: #27272a; backdrop-filter: none; -webkit-backdrop-filter: none; }
.topbar-left, .topbar-right { gap: 20px; }
.brand { gap: 12px; font-size: 15px; }
.brand img { width: 40px; height: 40px; border-radius: 11px; background: var(--accent); padding: 4px; }
.online { display: inline-flex; align-items: center; gap: 8px; color: #8b8b94; font-size: 14px; }
.online i { display: block; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 10px rgba(34,197,94,.35); }
.top-nav { gap: 20px; }
.top-tab { padding: 0; border-radius: 0; background: transparent; color: #8b8b94; font-size: 12px; letter-spacing: .04em; }
.top-tab:hover, .top-tab.active { background: transparent; color: var(--text); }
.account-trigger { min-height: 32px; padding: 2px 4px; border-radius: 8px; }
.account-trigger:hover, .account-trigger[aria-expanded="true"] { background: var(--raised); border-color: transparent; }
.layout { gap: 14px; padding: 14px; height: calc(100vh - 64px); }
.panel { border-radius: 16px; background: #0b0b0d; border-color: #27272a; backdrop-filter: none; -webkit-backdrop-filter: none; }
.sidebar { width: 340px; padding: 18px; gap: 14px; }
.sidebar-head { padding: 0; }
.panel-title { font-size: 15px; }
.sidebar > .input { height: auto; padding: 10px 12px; border-radius: 11px; background: #181818; }
.filters { gap: 8px; }
.filter-trigger { height: 40px; min-height: 40px; padding: 7px 10px; border-radius: 11px; background: #181818; font-size: 12px; }
.ticket-list { gap: 0; margin: 4px 0 0; padding: 0; }
.ticket-item { gap: 6px; padding: 14px; border: 1px solid transparent; border-radius: 13px; background: transparent; box-shadow: none; }
.ticket-item:hover { background: #111113; border-color: transparent; transform: none; }
.ticket-item.active { background: #181818; border-color: var(--accent); box-shadow: none; }
.ticket-top { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.ticket-top .avatar { width: 34px; height: 34px; }
.ticket-name { font-size: 14px; }
.ticket-preview { color: #8b8b94; }
.ticket-meta { display: none; }
.sidebar-foot { display: none; }
.chat-head { height: 60px; padding: 0 20px; border-color: #27272a; }
.messages { padding: 24px; gap: 18px; }
.msg { max-width: min(760px, 82%); gap: 6px; }
.msg.user { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 4px; row-gap: 3px; align-items: start; max-width: min(760px, 82%); }
.msg.user > .avatar { grid-column: 1; grid-row: 1 / span 5; width: 28px; height: 28px; margin: 0; }
.msg.user .msg-author, .msg.user .msg-bubble, .msg.user .attachments, .msg.user .delivery, .msg.user .msg-time { grid-column: 2; }
.msg-author { font-size: 12px; }
.msg-bubble { padding: 13px 16px; font-size: 14px; border-radius: 16px; }
.msg.user .msg-bubble { background: #19191c; border: 0; border-radius: 5px 16px 16px 16px; box-shadow: none; padding: 10px 13px; }
.msg.staff .msg-bubble { border-radius: 16px 16px 5px 16px; }
.composer { padding: 12px 16px; border-color: #27272a; }
.composer-box { border-radius: 999px; padding-left: 14px; background: #050507; }
.info { width: 340px; padding: 22px; }
.info .avatar-72 { width: 88px; height: 88px; }
.info-body { gap: 8px; }
.info-ban, .profile-site-btn { width: 100%; padding: 10px; border-radius: 10px; font-weight: 600; }
.info-ban { margin-top: 6px; }
.profile-site-btn { border: 1px solid var(--border); background: var(--raised); color: var(--text); }
.info-section { width: 100%; gap: 12px; padding-top: 12px; margin-top: 4px; }
.info-row { font-size: 12px; }
.info-row > span:last-child { font-weight: 500; }
.chat-search { background: #050507; }

@media (max-width: 760px) {
  .topbar { height: 56px; padding: 0 12px; }
  .brand { font-size: 13px; }
  .brand img { width: 34px; height: 34px; }
  .online-count { display: none; }
  .top-nav { display: none; }
  .layout { height: calc(100vh - 56px); padding: 0; gap: 0; }
  .panel { border-radius: 0; border-left: 0; border-right: 0; }
  .sidebar { width: 100%; padding: 12px; }
  .ticket-item { padding: 12px; }
  .messages { padding: 14px; gap: 14px; }
  .msg, .msg.user { max-width: 94%; }
}

/* Final brief alignment: keep the design grid authoritative. */
.topbar { height: 56px; padding: 0 20px; background: rgba(11,11,13,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.brand { gap: 10px; font-size: 13px; }
.brand img { width: 32px; height: 32px; border-radius: 9px; padding: 3px; }
.online { gap: 7px; font-size: 12px; }
.online i { width: 8px; height: 8px; }
.layout { height: calc(100vh - 56px); gap: 12px; padding: 12px; }
.panel { background: rgba(11,11,13,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.sidebar { width: 320px; padding: 16px; gap: 12px; }
.sidebar > .input { height: 40px; padding: 0 12px; border-radius: 12px; }
.filter-trigger { height: 40px; min-height: 40px; border-radius: 10px; }
.ticket-top { grid-template-columns: 40px minmax(0,1fr) auto; }
.ticket-top .avatar { width: 40px; height: 40px; }
.ticket-name { font-size: 14px; font-weight: 700; }
.chat-head { height: 56px; padding: 0 16px; }
.info { width: 300px; padding: 18px; }
.admin-view { inset: 56px 0 0; background-color: transparent; background-image: none; }
.workspace-head { height: 56px; flex-basis: 56px; }
.admin-sidebar, .settings-nav { background: rgba(11,11,13,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.icon-btn { width: 34px; height: 34px; align-items: center; justify-content: center; }
.icon-btn svg { width: 16px; height: 16px; }
.info-back, .info-toggle { display: none; }
.brand img, .workspace-brand img, .admin-brand img { background: transparent; padding: 0; }
.attachment-media { display: inline-flex; border: 0; cursor: zoom-in; }
.attachment-media { align-items: flex-start; padding: 5px; border: 1px solid var(--border); border-radius: 8px; background: var(--raised); color: #c7c7cd; font: inherit; text-align: left; }
.attachment-media:hover { border-color: var(--accent); }
.media-dialog { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--text); overflow: hidden; }
.media-dialog::backdrop { background: rgba(5,5,7,.78); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.media-stage { width: 100%; height: 100%; display: grid; place-items: center; overflow: hidden; touch-action: none; user-select: none; }
.media-dialog img { display: block; width: auto; height: auto; max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: 10px; box-shadow: 0 24px 80px rgba(0,0,0,.6); transform-origin: center center; transition: transform .08s ease-out; user-select: none; }
.media-close { position: absolute; top: 18px; right: 18px; z-index: 2; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 50%; background: rgba(24,24,24,.9); color: var(--text); font-size: 22px; line-height: 1; }
.media-close:hover { background: var(--raised); }
.media-scale, .media-help { position: absolute; z-index: 2; border: 1px solid var(--border); border-radius: 999px; background: rgba(24,24,27,.82); color: var(--muted); font-size: 11px; backdrop-filter: blur(8px); }
.media-scale { top: 18px; left: 18px; padding: 6px 10px; }
.media-help { bottom: 18px; left: 50%; padding: 7px 12px; transform: translateX(-50%); white-space: nowrap; }
@media (max-width: 680px) { .media-help { max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; } }
.msg-bubble { padding: 8px 12px; line-height: 1.4; }
.messages { gap: 12px; }
.ticket-item { padding: 10px; }
.ticket-top { grid-template-columns: 34px minmax(0,1fr) auto; gap: 8px; }
.ticket-top .avatar { width: 34px; height: 34px; }
.quick-panel { height: 360px; max-height: min(420px, calc(100vh - 24px)); }
.admin-main { background: transparent; }
.workspace-mode .topbar { display: flex; }
.workspace-mode .admin-view, .workspace-mode .settings-view { inset: 56px 0 0; }
.workspace-mode .workspace-head, .workspace-mode .admin-brand { display: none; }
.workspace-mode .admin-sidebar { padding-top: 16px; }
.admin-view, .settings-view { background-image: var(--bg-image); }
.admin-main { background-image: none; }
.settings-form input[readonly] { color: var(--muted); background: #181818; border-color: #27272a; cursor: not-allowed; user-select: text; }
#personal-form textarea { min-height: 108px; max-height: none; resize: none; overflow-y: hidden; line-height: 1.5; }
.custom-color-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.color-control { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.color-control span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.color-control b { font-size: 12px; }
.color-control small { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.color-control input { width: 32px; height: 28px; padding: 0; border: 0; border-radius: 7px; background: transparent; cursor: pointer; }
.admin-chart-grid .admin-chart { align-items: flex-end; }
.chart-column { position: relative; justify-content: flex-end; }
.chart-column .chart-bar { flex: 0 0 auto; }
.admin-chart-grid .admin-chart { bottom: 24px; height: auto; }
.admin-chart-grid .chart-column { display: block; height: 100%; }
.admin-chart-grid .chart-bar { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); }
.admin-chart-grid .chart-column b { position: absolute; left: 0; right: 0; bottom: -24px; height: 16px; overflow: hidden; text-align: center; }
.panel, .admin-stat, .admin-card, .staff-stats-select, .stats-table, .admin-list-row, .ban-row, .settings-card, .settings-profile-card, .token-note, .bind-row, .personal-row, .session-row, .admin-sidebar, .settings-nav { background-color: rgba(11,11,13,var(--panel-opacity,.72)); }
.range-value { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
@media (max-width: 760px) { .custom-color-grid { grid-template-columns: 1fr; } }

@media (max-width: 760px) {
  .topbar { height: 56px; padding: 0 12px; }
  .layout { height: calc(100vh - 56px); padding: 0; gap: 0; }
  .sidebar { width: 100%; padding: 12px; }
  .chat-head { height: 56px; padding: 0 12px; }
  .info-toggle { display: inline-flex; }
  .info { display: none; width: 100%; padding: 16px; }
  body.info-open .sidebar, body.info-open .chat { display: none; }
  body.info-open .info { display: flex; border-radius: 0; }
  body.info-open .info-back { display: inline-flex; margin-bottom: 12px; }
  .admin-view { inset: 56px 0 0; }
  .admin-nav { display: flex; flex-direction: row; overflow-x: auto; }
  .admin-nav button { flex: 0 0 auto; white-space: nowrap; }
  .settings-view { inset: 56px 0 0; }
}
video { max-width: 100%; max-height: 420px; }
