:root {
  --bg-main: #0b0d13;
  --bg-sidebar: #0e111a;
  --bg-panel: #141722;
  --bg-card: #1a1e2d;
  --bg-card-hover: #22273a;
  --bg-input: #10131d;
  --border-subtle: #232738;
  --border-active: #3a415a;
  --text-primary: #f0f3f8;
  --text-secondary: #9aa2b4;
  --text-muted: #676e82;
  --accent-blurple: #5865f2;
  --accent-blurple-hover: #4752c4;
  --accent-green: #23a55a;
  --accent-green-bg: rgba(35, 165, 90, 0.15);
  --accent-yellow: #f0b232;
  --accent-red: #f23f43;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-stack);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Shell Layout */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
  font-size: 22px;
  background: linear-gradient(135deg, #5865f2, #99aab5);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #fff;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}

.nav-item:hover {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.nav-item.active {
  background-color: rgba(88, 101, 242, 0.15);
  color: #fff;
  font-weight: 600;
}

.nav-icon {
  font-size: 16px;
}

.nav-label {
  flex: 1;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  background-color: var(--border-subtle);
  color: var(--text-secondary);
}

.glow-badge {
  background: linear-gradient(135deg, #5865f2, #7388da);
  color: #fff;
  font-size: 10px;
  box-shadow: 0 0 8px rgba(88, 101, 242, 0.5);
}

.nav-svg {
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.nav-item:hover .nav-svg {
  color: var(--text-primary);
}

.nav-item.active .nav-svg {
  color: #fff;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.user-avatar-initial {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5865f2, #3b45a0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}

.user-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-tag {
  font-size: 9.5px;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: #5865f2;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-logout:hover {
  background-color: rgba(242, 63, 67, 0.15);
  color: var(--accent-red);
}

.bot-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: var(--bg-panel);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.pill-dot.online {
  background-color: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
}

.pill-dot.offline {
  background-color: var(--accent-red);
}

.backup-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.backup-btn:hover {
  background-color: var(--bg-card-hover);
  color: #fff;
  border-color: var(--border-active);
}

/* Main Area */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Topbar */
.topbar {
  height: 56px;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 7px 14px;
  width: 480px;
  transition: border-color 0.15s ease;
}

.search-box:focus-within {
  border-color: var(--accent-blurple);
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.2);
}

.search-icon {
  font-size: 14px;
  opacity: 0.6;
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13.5px;
  width: 100%;
  outline: none;
}

.kbd-hint {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-pill {
  font-size: 12.5px;
  color: var(--text-secondary);
  background-color: var(--bg-card);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

.stat-pill strong {
  color: var(--accent-yellow);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

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

.action-btn.primary:hover {
  background-color: var(--accent-blurple-hover);
}

.action-btn.large-btn {
  padding: 10px 20px;
  font-size: 14px;
}

/* Tab Panes */
.tab-pane {
  display: none;
  flex: 1;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.tab-pane.active {
  display: flex;
}

/* Scrollable tabs (Bot, Settings, Customers, Copilot) */
#tab-bot,
#tab-settings,
#tab-customers,
#tab-copilot {
  overflow-y: auto;
  overflow-x: hidden;
}

#tab-bot.active,
#tab-settings.active,
#tab-customers.active,
#tab-copilot.active {
  display: block;
}

.bot-control-dashboard,
.settings-container,
.copilot-tab-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 24px 80px;
  width: 100%;
}

/* Custom Discord-style Dark Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* 3-Pane Tickets Workspace */
.tickets-workspace {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Left Panel: Tickets List */
.ticket-list-panel {
  width: 330px;
  background-color: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.filter-bar {
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-chips {
  display: flex;
  gap: 6px;
}

.chip {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--border-active);
  color: #fff;
}

.chip.active {
  background-color: var(--accent-blurple);
  color: #fff;
  border-color: var(--accent-blurple);
}

.ticket-quick-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 5px 8px;
  margin: 2px 0 4px;
  transition: all 0.15s ease;
}

.ticket-quick-search-wrap:focus-within {
  border-color: #5865f2;
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.18);
  background-color: #18191c;
}

.quick-search-svg {
  color: #80848e;
  flex-shrink: 0;
}

#ticket-quick-filter {
  background: transparent;
  border: none;
  outline: none;
  font-size: 12px;
  color: #f2f3f5;
  width: 100%;
}

#ticket-quick-filter::placeholder {
  color: #80848e;
  font-size: 11.5px;
}

.btn-clear-quick-filter {
  background: transparent;
  border: none;
  color: #80848e;
  cursor: pointer;
  padding: 0 2px;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.btn-clear-quick-filter:hover {
  color: #dbdee1;
}

.ticket-count-summary {
  font-size: 11.5px;
  color: var(--text-muted);
}

.tickets-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ticket-card {
  padding: 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ticket-card:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-active);
}

.ticket-card.selected {
  border-color: var(--accent-blurple);
  background-color: rgba(88, 101, 242, 0.12);
}

.ticket-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ticket-card-title {
  font-weight: 600;
  font-size: 13.5px;
  color: #fff;
}

.type-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.type-pill.support {
  background-color: rgba(88, 101, 242, 0.2);
  color: #7983f5;
}

.type-pill.purchase {
  background-color: rgba(35, 165, 90, 0.2);
  color: #3ba55d;
}

.type-pill.media {
  background-color: rgba(240, 178, 50, 0.2);
  color: #faa61a;
}

.ticket-card-summary {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ticket-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Middle: Discord Transcript Viewer */
.ticket-transcript-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #313338; /* Genuine Discord dark theme */
  overflow: hidden;
  border-right: 1px solid var(--border-subtle);
}

.transcript-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.placeholder-icon {
  font-size: 48px;
  opacity: 0.5;
}

.transcript-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.transcript-header {
  padding: 14px 20px;
  background-color: #2b2d31;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ticket-header-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

.ticket-header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: #949ba4;
  margin-top: 2px;
}

.text-link-btn {
  color: #00a8fc;
  font-size: 12px;
  text-decoration: none;
}

.text-link-btn:hover {
  text-decoration: underline;
}

/* Discord Chat Log Styling */
.discord-chatlog {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.discord-msg {
  display: flex;
  gap: 16px;
  line-height: 1.375;
}

.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #5865f2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.msg-author {
  font-weight: 600;
  font-size: 14px;
  color: #fff;
}

.msg-author.homer {
  color: #faa61a;
}

.bot-tag {
  background-color: #5865f2;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  text-transform: uppercase;
}

.msg-time {
  font-size: 11px;
  color: #949ba4;
}

.msg-text {
  color: #dbdee1;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-embed {
  margin-top: 8px;
  padding: 10px 14px;
  background-color: #2b2d31;
  border-left: 4px solid #5865f2;
  border-radius: 4px;
  max-width: 520px;
}

.embed-title {
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  margin-bottom: 4px;
}

.embed-desc {
  font-size: 12.5px;
  color: #dbdee1;
}

.msg-attachment {
  margin-top: 8px;
  padding: 8px 12px;
  background-color: #2b2d31;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.msg-attachment a {
  color: #00a8fc;
  text-decoration: none;
}

.msg-attachment a:hover {
  text-decoration: underline;
}

/* Right Panel: Homer AI Copilot Dock */
.copilot-dock {
  width: 380px;
  background-color: var(--bg-panel);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.dock-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dock-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dock-title h3 {
  font-size: 14px;
  font-weight: 700;
}

.engine-tag {
  font-size: 11px;
  font-weight: 600;
  background-color: rgba(88, 101, 242, 0.15);
  color: var(--accent-blurple);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(88, 101, 242, 0.3);
}

.dock-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.copilot-controls label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}

.segmented-control {
  display: flex;
  background-color: var(--bg-card);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.segment {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.segment.active {
  background-color: var(--accent-blurple);
  color: #fff;
  font-weight: 600;
}

.copilot-output-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.output-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent-blurple);
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
}

.link-btn:hover {
  text-decoration: underline;
}

#dock-response-text {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  color: var(--text-primary);
  font-family: var(--font-stack);
  font-size: 13.5px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  min-height: 150px;
}

#dock-response-text:focus {
  border-color: var(--accent-blurple);
}

.btn-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #23a55a, #1f9450);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(35, 165, 90, 0.35);
  transition: all 0.15s ease;
}

.btn-copy:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.copilot-refine {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.copilot-refine label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.refine-input-row {
  display: flex;
  gap: 6px;
}

.refine-input-row input {
  flex: 1;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
}

.refine-input-row input:focus {
  border-color: var(--accent-blurple);
}

.btn-send-refine {
  background-color: var(--bg-card-hover);
  border: 1px solid var(--border-subtle);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 12px;
  cursor: pointer;
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-tag {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-tag:hover {
  background-color: var(--bg-card-hover);
  color: #fff;
  border-color: var(--border-active);
}

.dock-examples-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.examples-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-yellow);
  text-transform: uppercase;
}

.example-item {
  font-size: 12px;
  color: var(--text-secondary);
  background-color: var(--bg-panel);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.4;
}

.example-item:hover {
  color: #fff;
  background-color: rgba(240, 178, 50, 0.1);
}

/* Standalone Copilot Scratchpad Tab */
.standalone-copilot-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.panel-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.panel-header p {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-top: 4px;
}

.copilot-card {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-section label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

#standalone-input {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-primary);
  font-family: var(--font-stack);
  font-size: 14px;
  outline: none;
}

#standalone-input:focus {
  border-color: var(--accent-blurple);
}

.card-options-row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-group label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.option-group select,
.option-group input {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: #fff;
  font-size: 13px;
  outline: none;
}

.flex-1 {
  flex: 1;
}

.response-preview-box {
  border-top: 1px solid var(--border-subtle);
  padding-top: 18px;
}

#standalone-output {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  color: var(--text-primary);
  font-family: var(--font-stack);
  font-size: 14px;
  line-height: 1.6;
  outline: none;
}

.giant-copy {
  padding: 14px;
  font-size: 14px;
  margin-top: 10px;
}

/* Customers Tab */
.customers-layout {
  display: flex;
  width: 100%;
  height: 100%;
}

.customers-list-panel {
  width: 320px;
  background-color: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.panel-header-search {
  padding: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-header-search input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
  outline: none;
}

.customers-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.customer-card {
  padding: 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.customer-card:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-active);
}

.customer-card.selected {
  border-color: var(--accent-blurple);
  background-color: rgba(88, 101, 242, 0.15);
}

.customer-card-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--accent-blurple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.customer-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.customer-card-info {
  flex: 1;
  min-width: 0;
}

.customer-card-name {
  font-weight: 600;
  color: #fff;
  font-size: 13px;
}

.customer-card-id {
  font-size: 11px;
  color: var(--text-muted);
}

.customer-card-count {
  font-size: 11px;
  background-color: var(--border-subtle);
  padding: 2px 7px;
  border-radius: 12px;
  color: var(--text-secondary);
}

.customer-dossier-panel {
  flex: 1;
  overflow-y: auto;
  padding: 30px;
  background-color: var(--bg-main);
}

.dossier-card {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 800px;
}

.dossier-profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dossier-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--accent-blurple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
}

.dossier-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dossier-names h3 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.dossier-id {
  font-size: 12px;
  color: var(--text-muted);
}

.timeline-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.dossier-ticket-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dossier-ticket-item {
  padding: 12px 14px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.dossier-ticket-item:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-active);
}

/* Bot Center Tab */
.bot-control-dashboard {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}

.stat-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
}

.status-circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--accent-red);
}

.status-circle.online {
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.stat-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}

.invite-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background-color: var(--accent-blurple);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  margin-top: 4px;
  width: fit-content;
}

.invite-action-btn:hover {
  background-color: var(--accent-blurple-hover);
}

.sync-action-card {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sync-action-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.sync-action-card p {
  font-size: 13px;
  color: var(--text-secondary);
}

.sync-form-row {
  display: flex;
  gap: 10px;
}

.sync-form-row input,
.sync-form-row select {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-size: 13px;
  outline: none;
}

.sync-form-row input {
  flex: 1;
}

.sync-progress-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-card);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--accent-yellow);
}

/* Settings Tab */
.settings-container {
  max-width: 750px;
  margin: 0 auto;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.settings-form {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.help-text {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
}

.help-text a {
  color: var(--accent-blurple);
  text-decoration: none;
}

.form-group input,
.form-group select {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-size: 13.5px;
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-blurple);
}

.form-row {
  display: flex;
  gap: 14px;
}

.form-actions {
  margin-top: 10px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: linear-gradient(135deg, #23a55a, #1b8548);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  transition: all 0.2s ease;
}

.hidden {
  display: none !important;
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(240, 178, 50, 0.3);
  border-top-color: var(--accent-yellow);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Discord Markdown Enhancements */
.discord-code-block {
  background-color: #1e1f22;
  border: 1px solid #141517;
  border-radius: 6px;
  padding: 10px 14px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  color: #dbdee1;
  overflow-x: auto;
  margin: 6px 0;
  white-space: pre;
}

.discord-inline-code {
  background-color: #2b2d31;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12.5px;
  color: #dbdee1;
}

.discord-spoiler {
  background-color: #2b2d31;
  color: transparent;
  padding: 1px 6px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.discord-spoiler.revealed {
  background-color: rgba(255, 255, 255, 0.1);
  color: #dbdee1;
  user-select: text;
}

.discord-quote {
  border-left: 4px solid #4e5058;
  padding-left: 10px;
  margin: 4px 0;
  color: #949ba4;
}

.discord-mention {
  background-color: rgba(88, 101, 242, 0.3);
  color: #c9cdfb;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 500;
}

.discord-link {
  color: #00a8fc;
  text-decoration: none;
}

.discord-link:hover {
  text-decoration: underline;
}

/* Copy Button Success State Animation */
.copied-success {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.6) !important;
  transform: scale(1.02);
}

/* Custom Slim Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  background: #2b2d38;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3b4052;
}

/* --- LOGIN & AUTHENTICATION SCREEN --- */
.login-body {
  background: radial-gradient(circle at top, #161a29 0%, #090a0f 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100vw;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 440px;
}

.login-card {
  background-color: #111420;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.brand-mark-svg {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, #5865f2, #3b45a0);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(88, 101, 242, 0.4);
}

.login-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.login-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  background-color: #0b0d14;
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-tab.active {
  background-color: var(--bg-card);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.login-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-bottom: 18px;
  font-weight: 500;
}

.login-alert.error {
  background-color: rgba(242, 63, 67, 0.15);
  border: 1px solid rgba(242, 63, 67, 0.3);
  color: #ff7b7e;
}

.login-alert.success {
  background-color: rgba(35, 165, 90, 0.15);
  border: 1px solid rgba(35, 165, 90, 0.3);
  color: #3ba55d;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setup-notice {
  display: flex;
  gap: 12px;
  padding: 12px;
  background-color: rgba(88, 101, 242, 0.1);
  border: 1px solid rgba(88, 101, 242, 0.3);
  border-radius: var(--radius-sm);
  color: #c9cdfb;
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 6px;
}

.setup-notice svg {
  flex-shrink: 0;
  color: #5865f2;
}

.setup-notice strong {
  display: block;
  color: #fff;
  font-size: 12.5px;
  margin-bottom: 2px;
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-icon-wrap input {
  width: 100%;
  padding-left: 38px !important;
}

.btn-auth-primary {
  margin-top: 8px;
  padding: 11px 16px;
  background: linear-gradient(135deg, #5865f2, #4752c4);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  box-shadow: 0 4px 14px rgba(88, 101, 242, 0.35);
}

.btn-auth-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #4752c4, #3b45a0);
  transform: translateY(-1px);
}

.btn-auth-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

/* --- DISCORD SEARCH POPOVER (MATCHING SCREENSHOT 3) --- */
.search-box {
  position: relative;
}

.search-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 440px;
  max-width: 90vw;
  background-color: #11131a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  z-index: 1000;
  overflow: hidden;
  animation: popoverFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.popover-chip-homer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(88, 101, 242, 0.15);
  border: 1px solid rgba(88, 101, 242, 0.4);
  color: #a5b4fc;
  padding: 4px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.popover-chip-homer:hover {
  background: rgba(88, 101, 242, 0.3);
  border-color: #5865f2;
  color: #fff;
  transform: translateY(-1px);
}

.popover-filters-list {
  padding: 6px;
}

.popover-filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.popover-filter-row:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.filter-row-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  color: var(--text-secondary);
}

.popover-filter-row:hover .filter-row-icon {
  color: #fff;
  background: rgba(88, 101, 242, 0.2);
}

.filter-row-info {
  flex: 1;
}

.filter-row-title {
  font-size: 13px;
  font-weight: 500;
  color: #e5e7eb;
}

.filter-row-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: monospace;
}

/* Live Search Results inside Popover */
.search-live-results {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  max-height: 380px;
  display: flex;
  flex-direction: column;
}

.live-results-header {
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
}

.live-results-scroll {
  overflow-y: auto;
  max-height: 340px;
}

.live-result-item {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.live-result-item:hover {
  background-color: rgba(88, 101, 242, 0.1);
}

.live-result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.live-result-author {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
}

.badge-homer {
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #5865f2;
  color: #fff;
  font-weight: 700;
}

.live-result-channel {
  font-size: 11px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.live-result-snippet {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.live-result-snippet mark {
  background: rgba(234, 179, 8, 0.3);
  color: #fef08a;
  border-radius: 2px;
  padding: 0 2px;
}

/* --- MODALS (BOT SETUP & LIGHTBOX) --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-card {
  background: #12141c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  width: 540px;
  max-width: 94vw;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: modalScaleUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.modal-title-row h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.modal-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.modal-body {
  padding: 20px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.setup-steps-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.setup-step {
  display: flex;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #5865f2;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

.setup-step strong {
  display: block;
  color: #fff;
  margin-bottom: 2px;
}

.text-link {
  color: #5865f2;
  text-decoration: underline;
}

.modal-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0 14px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.modal-divider::before,
.modal-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-divider span {
  padding: 0 10px;
}

.client-id-row {
  display: flex;
  gap: 10px;
}

.client-id-row input {
  flex: 1;
  background: #090a0f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: #fff;
  font-size: 13px;
  outline: none;
}

.client-id-row input:focus {
  border-color: #5865f2;
}

/* Lightbox Modal */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

#lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
}

.lightbox-close {
  position: absolute;
  top: -36px;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* In-Chat Image Attachment Thumbnails (Discord-Style) */
.chatlog-attachment-preview {
  margin-top: 8px;
  display: inline-block;
  max-width: 380px;
}

.chatlog-attachment-img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: block;
}

.chatlog-attachment-img:hover {
  transform: scale(1.015);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.highlighted-pulse {
  animation: pulseHighlight 2s ease-out;
}

@keyframes pulseHighlight {
  0% { background-color: rgba(88, 101, 242, 0.4); }
  100% { background-color: transparent; }
}

/* --- DISCORD ROLES & COLORS (MATCHING REFERENCE UI) --- */
.owner-color, .owner-purple {
  color: #c084fc !important;
  font-weight: 700 !important;
}

.admin-color, .admin-gold {
  color: #facc15 !important;
  font-weight: 700 !important;
}

.bot-name {
  color: #ffffff !important;
  font-weight: 700 !important;
}

.app-color {
  color: #c084fc !important;
}

.discord-bot-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background-color: #5865f2;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1.5px 5px;
  border-radius: 4px;
  vertical-align: middle;
}

.discord-app-badge {
  display: inline-flex;
  align-items: center;
  background-color: rgba(88, 101, 242, 0.28);
  color: #c4b5fd;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1.5px 5px;
  border-radius: 4px;
  vertical-align: middle;
}

.discord-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 1.5px 6px;
  border-radius: 4px;
  vertical-align: middle;
}

.discord-role-badge.admin-badge {
  background-color: rgba(250, 204, 21, 0.15);
  color: #fde047;
  border: 1px solid rgba(250, 204, 21, 0.35);
}

.discord-role-badge.owner-badge {
  background-color: rgba(192, 132, 252, 0.15);
  color: #d8b4fe;
  border: 1px solid rgba(192, 132, 252, 0.35);
}

/* Status dots */
.status-indicator-dot, .status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2.5px solid #090a0f;
}

.status-indicator-dot.online, .status-dot.online {
  background-color: #22c55e;
}

.status-indicator-dot.dnd, .status-dot.dnd {
  background-color: #f43f5e;
}

/* Brand Avatar Halo */
.brand-avatar-halo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 35%, #8b5cf6 70%, #ec4899 100%);
  box-shadow: 0 0 14px rgba(79, 172, 254, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* User Profile Badge (Footer) */
.user-avatar-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-avatar-img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(250, 204, 21, 0.4);
}

.admin-tag {
  color: #facc15 !important;
  font-weight: 800 !important;
}

/* --- THE STRAFEOS ACTIVE CAPSULE STYLE (AS SEEN IN REFERENCE SCREENSHOT) --- */
.active-strafeos-capsule {
  position: relative;
  background: linear-gradient(90deg, rgba(88, 101, 242, 0.2) 0%, rgba(139, 92, 246, 0.08) 100%) !important;
  border: 1px solid rgba(129, 140, 248, 0.32) !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 18px rgba(88, 101, 242, 0.18) !important;
  overflow: hidden;
}

.active-strafeos-capsule::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.8);
}

/* Selected Ticket Card matching the StrafeOS Capsule */
.ticket-card.selected {
  position: relative;
  background: linear-gradient(90deg, rgba(88, 101, 242, 0.22) 0%, rgba(139, 92, 246, 0.08) 100%) !important;
  border: 1px solid rgba(129, 140, 248, 0.35) !important;
  border-radius: 8px !important;
  box-shadow: 0 6px 22px rgba(88, 101, 242, 0.2) !important;
  transform: translateX(3px);
}

.ticket-card.selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
  background: linear-gradient(180deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
}

/* Discord Server Roster Widget */
.discord-roster-card {
  margin-top: 24px;
  background: #0d0f17;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.roster-header-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 14px;
}

.roster-header-title h3 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.roster-server-tag {
  font-size: 11px;
  color: #a5b4fc;
  background: rgba(88, 101, 242, 0.15);
  border: 1px solid rgba(88, 101, 242, 0.3);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.roster-category {
  margin-bottom: 16px;
}

.roster-category-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 8px;
  padding-left: 6px;
}

.roster-member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}

.roster-member-row:hover:not(.active-strafeos-capsule) {
  background-color: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(3px);
}

.roster-member-row.active-strafeos-capsule:hover {
  background: linear-gradient(90deg, rgba(88, 101, 242, 0.28) 0%, rgba(139, 92, 246, 0.14) 100%) !important;
  border-color: rgba(129, 140, 248, 0.5) !important;
  transform: translateX(3px);
}

.roster-action-hint {
  font-size: 11px;
  color: #a5b4fc;
  background: rgba(88, 101, 242, 0.15);
  border: 1px solid rgba(88, 101, 242, 0.25);
  padding: 2px 7px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
  margin-left: auto;
  white-space: nowrap;
}

.roster-member-row:hover .roster-action-hint {
  opacity: 1;
}

.roster-avatar-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
}

.roster-avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.roster-avatar-wrap.cyber-halo {
  padding: 2px;
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 35%, #8b5cf6 70%, #ec4899 100%);
  box-shadow: 0 0 12px rgba(79, 172, 254, 0.5);
}

.roster-avatar-wrap.cyber-halo img {
  border-radius: 50%;
}

.roster-member-info {
  flex: 1;
  min-width: 0;
}

.roster-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.roster-member-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #f3f4f6;
}

.roster-member-status {
  font-size: 11.5px;
  color: #94a3b8;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Copilot Dock Header */
.dock-avatar-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dock-avatar-img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(250, 204, 21, 0.5);
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.25);
}

.dock-title-text {
  display: flex;
  flex-direction: column;
}

.dock-title-text h3 {
  font-size: 14px;
  margin: 0;
}

.dock-subtext {
  font-size: 10px;
  color: #a5b4fc;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* In-Chat Avatars */
.homer-avatar img {
  border: 1.5px solid rgba(250, 204, 21, 0.5);
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.2);
}

.strafe-avatar img {
  border: 1.5px solid rgba(192, 132, 252, 0.5);
  box-shadow: 0 0 8px rgba(192, 132, 252, 0.2);
}

/* Ticket Source Toggle (Archive vs Live) */
/* Native Discord Source Toggle */
.ticket-source-toggle {
  display: flex;
  background-color: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
  margin-bottom: 8px;
}

.source-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #949ba4;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.source-toggle-btn:hover {
  color: #dbdee1;
  background-color: rgba(255, 255, 255, 0.04);
}

.source-toggle-btn.active {
  background-color: #5865f2;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(88, 101, 242, 0.35);
}

.live-dot-green {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #23a55a;
  box-shadow: 0 0 6px rgba(35, 165, 90, 0.6);
  display: inline-block;
}

.live-count-badge {
  background-color: rgba(0, 0, 0, 0.3);
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
}

/* Open Ticket Cards - Discord Native */
.ticket-card.live-card {
  border-left: 3px solid #23a55a;
}

.ticket-card.live-card.selected {
  border-left: 3px solid #57f287;
  background: rgba(35, 165, 90, 0.07);
  box-shadow: 0 0 14px rgba(35, 165, 90, 0.15);
}

.live-channel-hash {
  color: #949ba4;
  font-weight: 700;
  margin-right: 2px;
}

.live-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(35, 165, 90, 0.12);
  color: #23a55a;
  border: 1px solid rgba(35, 165, 90, 0.3);
}

.live-status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #23a55a;
}

/* Backups Vault Card */
.backups-vault-card {
  margin-top: 24px;
  background-color: #0d0f17;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.vault-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.vault-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.vault-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(88, 101, 242, 0.15);
  border: 1px solid rgba(88, 101, 242, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blurple);
  flex-shrink: 0;
}

.vault-title-row h3 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.vault-title-row p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.vault-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vault-actions input,
.vault-header-right input,
#media-vault-search {
  background-color: #121520;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
  width: 260px;
  outline: none;
  box-sizing: border-box;
}

.vault-actions input:focus,
.vault-header-right input:focus,
#media-vault-search:focus {
  border-color: var(--accent-blurple);
}

.vault-table-container {
  overflow-x: auto;
}

.vault-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.vault-table th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.vault-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  vertical-align: middle;
}

.vault-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

.btn-vault-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-vault-action:hover {
  background: var(--accent-blurple);
  border-color: var(--accent-blurple);
}

/* --- COPILOT WORKFLOW ENHANCEMENTS (DISCORD DARK NATIVE) --- */

/* 1. Customer History Dossier */
.customer-dossier-card {
  background-color: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.15s ease;
}

.dossier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
}

.dossier-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.dossier-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #5865f2;
}

.dossier-title {
  font-size: 12px;
  font-weight: 700;
  color: #dbdee1;
}

.dossier-badge {
  font-size: 11px;
  background: rgba(88, 101, 242, 0.15);
  color: #7983f5;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  border: 1px solid rgba(88, 101, 242, 0.25);
}

.dossier-list {
  padding: 8px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  max-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dossier-item {
  font-size: 11.5px;
  color: #949ba4;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 8px;
  border-radius: 4px;
  border-left: 2px solid #5865f2;
}

.dossier-item strong {
  color: #f2f3f5;
}

/* 2. Ready State / Manual Trigger Card */
.copilot-ready-card {
  background: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}

.ready-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(88, 101, 242, 0.12);
  border: 1px solid rgba(88, 101, 242, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.ready-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #f2f3f5;
  margin: 0 0 6px;
}

.ready-card-desc {
  font-size: 12px;
  color: #949ba4;
  line-height: 1.45;
  margin: 0 0 16px;
  max-width: 260px;
}

.btn-generate-main {
  background: #5865f2;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(88, 101, 242, 0.25);
}

.btn-generate-main:hover {
  background: #4752c4;
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.4);
}

.ready-card-quota-note {
  font-size: 11px;
  color: #80848e;
  margin-top: 10px;
}

/* 3. Variant Selector Tabs */
.variant-tabs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.variant-tabs-header label {
  font-size: 11.5px;
  font-weight: 600;
  color: #dbdee1;
  margin: 0;
}

.variant-tabs {
  display: flex;
  background-color: #111214;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 2px;
  gap: 3px;
  margin-bottom: 10px;
}

.variant-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #949ba4;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.variant-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.variant-tab.active {
  background: #5865f2;
  color: #fff;
  box-shadow: 0 2px 6px rgba(88, 101, 242, 0.3);
}

/* 4. Action Buttons */
.btn-sent-memory {
  background: rgba(35, 165, 90, 0.12);
  border: 1px solid rgba(35, 165, 90, 0.25);
  color: #57f287;
  padding: 7px 12px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-sent-memory:hover {
  background: rgba(35, 165, 90, 0.25);
  border-color: #57f287;
}

/* 5. Closed-Loop Verified Outcome Banner */
.outcome-verified-banner {
  background: rgba(35, 165, 90, 0.1);
  border: 1px solid rgba(35, 165, 90, 0.25);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: #57f287;
}

/* 6. Customer Reaction Simulator Card (Discord Dark) */
.reaction-simulator-card {
  background: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.sim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sim-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #dbdee1;
}

.sim-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(35, 165, 90, 0.12);
  color: #57f287;
  border: 1px solid rgba(35, 165, 90, 0.25);
}

.sim-badge.warn {
  background: rgba(240, 178, 50, 0.12);
  color: #f0b232;
  border-color: rgba(240, 178, 50, 0.25);
}

.sim-metrics-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.sim-metric-box {
  background: #111214;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #80848e;
  font-weight: 700;
}

.metric-value {
  font-size: 11.5px;
  line-height: 1.4;
  color: #57f287;
  word-break: break-word;
}

.sim-section {
  margin-top: 6px;
}

.sim-sec-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #80848e;
  display: block;
  margin-bottom: 2px;
}

.sim-narrative, .sim-action {
  font-size: 11.5px;
  line-height: 1.4;
  color: #dbdee1;
  background: #111214;
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 6px 8px;
  border-radius: 4px;
  margin: 0;
}

/* 7. RLHF Feedback & Refinement Controls */
.refine-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.refine-header-row label {
  font-size: 11.5px;
  font-weight: 600;
  color: #dbdee1;
  margin: 0;
}

.rlhf-rating-btns {
  display: flex;
  gap: 5px;
}

.btn-rlhf {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #949ba4;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-rlhf:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.btn-rlhf.active-good {
  background: rgba(35, 165, 90, 0.15);
  border-color: #23a55a;
  color: #57f287;
}

.btn-rlhf.active-bad {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #f87171;
}

#dock-refine-input {
  width: 100%;
  background: #111214;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: #dbdee1;
  font-family: inherit;
  font-size: 12px;
  padding: 8px;
  resize: vertical;
  line-height: 1.4;
  margin-bottom: 8px;
}

#dock-refine-input:focus {
  outline: none;
  border-color: #5865f2;
}

.refine-actions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.btn-send-refine {
  flex: 1;
  background: #5865f2;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 7px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-send-refine:hover {
  background: #4752c4;
}

.btn-save-critique {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #dbdee1;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 7px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-save-critique:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.examples-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.memory-count-badge {
  font-size: 10px;
  background: rgba(35, 165, 90, 0.15);
  color: #57f287;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}

/* --- LOADERS & MEDIA VAULT STYLES --- */
.media-cat-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.media-cat-badge.loader {
  background: rgba(240, 178, 50, 0.15);
  color: #f0b232;
  border: 1px solid rgba(240, 178, 50, 0.3);
}

.media-cat-badge.archive {
  background: rgba(88, 101, 242, 0.15);
  color: #7983f5;
  border: 1px solid rgba(88, 101, 242, 0.3);
}

.media-cat-badge.image {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.media-cat-badge.document {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.media-cat-badge.media {
  background: rgba(255, 255, 255, 0.06);
  color: #949ba4;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.mirror-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mirror-badge.synced {
  background: rgba(35, 165, 90, 0.12);
  color: #57f287;
  border: 1px solid rgba(35, 165, 90, 0.25);
}

.mirror-badge.pending {
  background: rgba(240, 178, 50, 0.12);
  color: #f0b232;
  border: 1px solid rgba(240, 178, 50, 0.25);
}

.mirror-badge.local_only {
  background: rgba(255, 255, 255, 0.05);
  color: #949ba4;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.media-table-thumb {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  vertical-align: middle;
  transition: transform 0.15s ease;
}

.media-table-thumb:hover {
  transform: scale(1.1);
  border-color: #5865f2;
}

.media-file-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.media-file-icon {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #949ba4;
}

.media-file-name {
  font-weight: 600;
  color: #f2f3f5;
  font-size: 12.5px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-vault-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.15s ease;
}

.btn-vault-action.primary {
  background: #5865f2;
  color: #fff;
}

.btn-vault-action.primary:hover {
  background: #4752c4;
}

.btn-vault-action.secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #dbdee1;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-vault-action.secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* --- OPEN IN DISCORD APP BUTTON --- */
.btn-open-discord-app {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #5865f2;
  color: #ffffff !important;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(88, 101, 242, 0.35);
}

.btn-open-discord-app:hover {
  background: #4752c4;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.45);
}

/* --- INTERACTIVE DISCORD DRAFT COMPOSER (STAGING) --- */
.discord-draft-composer {
  background: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  margin: 12px 16px 16px;
  padding: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.draft-composer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.draft-lbl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #949ba4;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.draft-quick-actions {
  display: flex;
  gap: 6px;
}

.btn-draft-mini {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #b5bac1;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-draft-mini:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-draft-mini.active {
  background: rgba(88, 101, 242, 0.2);
  color: #5865f2;
  border-color: rgba(88, 101, 242, 0.4);
}

.draft-live-preview-wrap {
  background: #2b2d31;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.draft-msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.draft-msg .homer-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.draft-staging-tag {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 9px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.6px;
  margin-left: 6px;
}

.draft-input-bar {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.draft-input-bar textarea {
  flex: 1;
  background: #2b2d31;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #dbdee1;
  font-family: inherit;
  font-size: 13.5px;
  padding: 10px 12px;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.15s ease;
}

.draft-input-bar textarea:focus {
  border-color: #5865f2;
}

.btn-draft-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #5865f2;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  height: 44px;
  transition: all 0.15s ease;
}

.btn-draft-copy:hover {
  background: #4752c4;
  transform: translateY(-1px);
}

/* --- MODEL PICKER & COPILOT DOCK POLISH --- */
.dock-model-picker-wrap {
  display: flex;
  align-items: center;
}

.copilot-model-select {
  background: #1e1f22;
  color: #dbdee1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.copilot-model-select:focus,
.copilot-model-select:hover {
  border-color: #5865f2;
  color: #fff;
}

/* Real-time Learned Feedback Banner */
.outcome-learned-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(87, 242, 135, 0.1);
  border: 1px solid rgba(87, 242, 135, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  animation: bannerFadeIn 0.3s ease;
}

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

.learned-banner-title {
  font-size: 12px;
  font-weight: 700;
  color: #57f287;
}

.learned-banner-desc {
  font-size: 11.5px;
  color: #b5bac1;
  margin-top: 2px;
  line-height: 1.4;
}

/* --- CUSTOM SHARE LINKS MODAL STYLING --- */
.radio-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2b2d31;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: #dbdee1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.radio-pill:has(input:checked) {
  background: rgba(88, 101, 242, 0.2);
  border-color: #5865f2;
  color: #fff;
}

.slug-input-wrap {
  display: flex;
  align-items: center;
  background: #2b2d31;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 6px;
}

.slug-prefix {
  background: rgba(255, 255, 255, 0.04);
  color: #949ba4;
  font-size: 11.5px;
  padding: 9px 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.slug-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 13px;
  padding: 9px 12px;
}

.share-modal-filename {
  background: #2b2d31;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12.5px;
  color: #5865f2;
  word-break: break-all;
  border: 1px solid rgba(88, 101, 242, 0.25);
  margin-top: 4px;
}

.share-modal-result {
  background: rgba(88, 101, 242, 0.1);
  border: 1px solid rgba(88, 101, 242, 0.3);
  border-radius: 8px;
  padding: 12px;
  margin-top: 14px;
}

.share-url-copy-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.share-url-copy-row input {
  flex: 1;
  background: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #57f287;
  font-family: monospace;
  font-size: 12px;
  padding: 8px 10px;
}

.share-url-info {
  font-size: 11px;
  color: #949ba4;
  margin-top: 6px;
}

/* --- MODAL BASE STYLING --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.modal-backdrop.hidden {
  display: none !important;
}

.modal-card {
  background: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  width: 90%;
  max-width: 520px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: modalScaleIn 0.2s ease;
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title-row h3 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: #949ba4;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s ease;
}

.btn-modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #18191c;
}

.modal-desc {
  font-size: 12px;
  color: #949ba4;
  margin-bottom: 16px;
  line-height: 1.4;
}

/* ==========================================================================
   MOBILE RESPONSIVE SYSTEM & PROGRESSIVE WEB APP (PWA) STYLING
   Preserves 100% desktop fidelity while optimizing mobile viewports <= 900px
   ========================================================================== */

/* Hidden on desktop by default */
.mobile-bottom-nav,
.btn-mobile-back,
.btn-mobile-toggle-copilot,
.mobile-drawer-handle-bar,
.copilot-mobile-backdrop,
.customer-mobile-header {
  display: none !important;
}

/* PWA Settings Card (Desktop & Mobile) */
.pwa-settings-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.08), rgba(30, 31, 34, 0.95));
  border: 1px solid rgba(88, 101, 242, 0.3);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.pwa-card-icon-halo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(88, 101, 242, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(88, 101, 242, 0.4);
}

.pwa-card-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.pwa-card-info {
  flex: 1;
}

.pwa-card-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.pwa-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
}

.pwa-badge.available {
  background: rgba(87, 242, 135, 0.15);
  color: #57f287;
  border: 1px solid rgba(87, 242, 135, 0.3);
}

.pwa-badge.installed {
  background: rgba(88, 101, 242, 0.15);
  color: #5865f2;
  border: 1px solid rgba(88, 101, 242, 0.3);
}

.pwa-platform-tag {
  font-size: 11px;
  color: #949ba4;
}

.pwa-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px 0;
}

.pwa-card-desc {
  font-size: 13px;
  color: #949ba4;
  margin: 0;
  line-height: 1.4;
}

.btn-install-pwa-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #5865f2;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.btn-install-pwa-primary:hover {
  background: #4752c4;
  transform: translateY(-1px);
}

/* iOS Modal Styling */
.ios-modal-card {
  max-width: 440px;
}

.ios-guide-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0 8px 0;
}

.ios-step-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
}

.ios-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #5865f2;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ios-step-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: #dbdee1;
}

.ios-step-content strong {
  color: #fff;
  font-size: 13px;
}

.ios-step-content span {
  font-size: 12px;
  color: #949ba4;
  line-height: 1.4;
}

/* --- MOBILE BREAKPOINT <= 900px --- */
@media (max-width: 900px) {
  /* Layout transformation */
  .app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); /* Room for bottom nav + safe area */
  }

  /* Hide Desktop Sidebar */
  .sidebar {
    display: none !important;
  }

  /* Main container fills available height */
  .main-content {
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .tab-pane {
    flex: 1;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .tab-pane:not(.active) {
    display: none !important;
  }

  /* Topbar Mobile Ergonomics with Notch / Status Bar Protection */
  .topbar {
    height: calc(54px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-bottom: 4px;
    gap: 8px;
    flex-shrink: 0;
    box-sizing: border-box;
  }

  body.is-standalone-pwa .topbar {
    height: calc(54px + max(env(safe-area-inset-top, 0px), 44px));
    padding-top: max(env(safe-area-inset-top, 0px), 44px);
  }

  .global-search-container {
    max-width: none;
    flex: 1;
  }

  .global-search-container input {
    font-size: 13px;
    padding: 7px 12px 7px 32px;
  }

  .kbd-hint {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
  }

  .stat-pill {
    display: none;
  }

  .btn-sync-transcripts {
    padding: 6px 10px;
    font-size: 12px;
  }

  .btn-sync-transcripts span {
    display: none; /* Icon only on mobile */
  }

  /* Ticket Workspace Stack Navigation */
  .ticket-workspace,
  .tickets-workspace {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
  }

  /* Tickets list panel takes full width initially */
  .tickets-list-pane,
  .ticket-list-panel {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: 100%;
    border-right: none;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* When ticket detail is open, list slides left */
  .ticket-workspace.mobile-ticket-open .tickets-list-pane,
  .ticket-workspace.mobile-ticket-open .ticket-list-panel,
  .tickets-workspace.mobile-ticket-open .tickets-list-pane,
  .tickets-workspace.mobile-ticket-open .ticket-list-panel {
    display: none !important;
  }

  /* Transcript Panel takes full width */
  .ticket-transcript-panel {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    background: #18191c;
  }

  .ticket-workspace.mobile-ticket-open .ticket-transcript-panel,
  .tickets-workspace.mobile-ticket-open .ticket-transcript-panel {
    display: flex !important;
    animation: mobileSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes mobileSlideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
  }

  /* Customers Mobile Stack Navigation */
  .customers-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
  }

  .customers-list-panel {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 100%;
    border-right: none !important;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .customer-dossier-panel {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 100%;
    display: none;
    flex-direction: column;
    background: #18191c;
    overflow-y: auto;
    padding: 12px 10px !important;
    box-sizing: border-box !important;
  }

  .customer-dossier-panel .dossier-card {
    padding: 14px !important;
    gap: 14px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .customer-dossier-panel .dossier-header {
    gap: 12px !important;
  }

  .customer-dossier-panel .dossier-avatar {
    width: 48px !important;
    height: 48px !important;
    font-size: 20px !important;
    flex-shrink: 0 !important;
  }

  .customer-dossier-panel .dossier-stats {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px 12px !important;
    font-size: 11px !important;
  }

  .customer-dossier-panel .dossier-ticket-item {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 12px !important;
    box-sizing: border-box !important;
  }

  .customer-dossier-panel .dossier-ticket-top {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
  }

  .customer-dossier-panel .dossier-ticket-summary {
    font-size: 13px !important;
    line-height: 1.4 !important;
    color: var(--text-secondary) !important;
    word-break: break-word !important;
    width: 100% !important;
  }

  .customer-dossier-panel .dossier-ticket-footer {
    display: flex !important;
    justify-content: space-between !important;
    font-size: 11px !important;
    color: var(--text-muted) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding-top: 6px !important;
    width: 100% !important;
  }

  .customers-layout.mobile-customer-open .customers-list-panel {
    display: none !important;
  }

  .customers-layout.mobile-customer-open .customer-dossier-panel {
    display: flex !important;
    animation: mobileSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .customer-mobile-header {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #18191c;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
  }

  .customer-mobile-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Mobile Ticket Back Button & Actions Bar */
  .btn-mobile-back {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 6px 10px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
  }

  .btn-mobile-back:active {
    background: rgba(255, 255, 255, 0.14);
  }

  .btn-mobile-toggle-copilot {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #5865f2, #4752c4);
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(88, 101, 242, 0.4);
    flex-shrink: 0;
  }

  .transcript-header {
    padding: 8px 12px;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
  }

  .ticket-header-info {
    min-width: 0;
    flex: 1;
  }

  .ticket-header-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ticket-header-meta {
    font-size: 11px;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ticket-header-meta .meta-item:nth-child(n+3) {
    display: none; /* Hide date and msg count in header on narrow screens */
  }

  .ticket-header-actions {
    gap: 6px;
    flex-shrink: 0;
  }

  .btn-open-discord-app {
    padding: 6px 8px;
    font-size: 12px;
  }

  .btn-open-discord-app span {
    display: none; /* Discord icon only on mobile header */
  }

  .text-link-btn {
    display: none; /* Hide raw HTML on mobile header */
  }

  /* Discord Chatlog scroll on mobile */
  .discord-chatlog {
    padding: 12px 8px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Draft Composer Mobile Ergonomics */
  .discord-draft-composer {
    margin: 8px 10px 10px 10px;
    padding: 10px;
    border-radius: 10px;
  }

  .draft-composer-header {
    margin-bottom: 6px;
  }

  .draft-lbl {
    font-size: 11px;
  }

  .draft-staging-tag {
    font-size: 9px;
    padding: 1px 4px;
  }

  .draft-composer-footer {
    gap: 8px;
    align-items: stretch;
  }

  .draft-composer-footer textarea {
    font-size: 13px;
    padding: 8px 10px;
    min-height: 48px;
  }

  .btn-draft-copy {
    padding: 0 14px;
    font-size: 12px;
  }

  /* Homer AI Copilot Slide-Up Bottom Sheet Drawer */
  .copilot-dock {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 80vh !important;
    max-height: 85vh !important;
    background: #18191c !important;
    border-top: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-left: none !important;
    border-radius: 18px 18px 0 0 !important;
    z-index: 1050 !important;
    transform: translateY(105%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.7) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .copilot-dock.mobile-open {
    transform: translateY(0) !important;
  }

  .copilot-mobile-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 1040;
    transition: opacity 0.25s ease;
  }

  .mobile-drawer-handle-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 4px 16px;
    cursor: pointer;
  }

  .mobile-drawer-handle {
    width: 44px;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 auto;
  }

  .btn-mobile-close-drawer {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #949ba4;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
  }

  .dock-header {
    padding: 8px 16px 12px 16px;
  }

  .dock-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px 20px 16px;
  }

  /* Mobile Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    background: #111214;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    align-items: center;
    justify-content: space-around;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
  }

  .mobile-nav-item {
    background: transparent;
    border: none;
    color: #949ba4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    flex: 1;
    height: 100%;
    padding: 6px 0;
    transition: color 0.15s ease;
    touch-action: manipulation;
  }

  .mobile-nav-item.active {
    color: #5865f2;
    font-weight: 700;
  }

  .mobile-nav-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-nav-badge {
    position: absolute;
    top: -4px;
    right: -8px;
    background: #5865f2;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 8px;
    min-width: 14px;
    text-align: center;
  }

  /* PWA Settings Card on Mobile */
  .pwa-settings-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
  }

  .btn-install-pwa-primary {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }

  /* Media Vault Mobile Polish & Touch Cards */
  .vault-card-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .vault-header-right {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .vault-header-right input {
    width: 100% !important;
    min-width: 0 !important;
  }

  .vault-header-right button {
    width: 100% !important;
    justify-content: center !important;
  }

  .category-chips-row.media-category-chips {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px !important;
    gap: 6px !important;
  }

  .category-chips-row.media-category-chips .chip {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  /* Transform table into mobile touch cards */
  .vault-table thead {
    display: none !important;
  }

  .vault-table,
  .vault-table tbody,
  .vault-table tr,
  .vault-table td {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .vault-table tr {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 10px !important;
    padding: 12px !important;
    margin-bottom: 10px !important;
  }

  .vault-table td {
    padding: 2px 0 !important;
    border-bottom: none !important;
  }

  .vault-table td:nth-child(1) {
    margin-bottom: 6px;
  }

  .vault-table td:nth-child(2),
  .vault-table td:nth-child(3),
  .vault-table td:nth-child(4),
  .vault-table td:nth-child(5),
  .vault-table td:nth-child(6) {
    display: inline-block !important;
    width: auto !important;
    margin-right: 8px !important;
    font-size: 11px !important;
    vertical-align: middle !important;
  }

  .vault-table td:nth-child(7) {
    margin-top: 10px !important;
    padding-top: 8px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    display: flex !important;
  }

  .vault-table td:nth-child(7) div {
    display: flex !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .vault-table td:nth-child(7) .btn-vault-action {
    flex: 1 !important;
    justify-content: center !important;
    padding: 8px 12px !important;
    font-size: 12px !important;
  }
}

/* --- SMALL MOBILE BREAKPOINT <= 480px --- */
@media (max-width: 480px) {
  .filter-chips {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .ticket-source-pills {
    overflow-x: auto;
  }

  .ticket-card {
    padding: 10px;
  }

  .ticket-card-title {
    font-size: 13px;
  }

  .ticket-card-snippet {
    font-size: 12px;
    -webkit-line-clamp: 2;
  }
}




