/* Vercel Design System CSS Tokens */
:root {
  /* Default Dark Mode (Premium Vercel Theme) */
  --bg: #000000;
  --fg: #ffffff;
  --accents-1: #111111;
  --accents-2: #222222;
  --accents-3: #333333;
  --accents-4: #888888;
  --accents-5: #a0a0a0;
  --border: #333333;
  --card-bg: #0a0a0a;
  --btn-primary-bg: #ffffff;
  --btn-primary-fg: #000000;
  --btn-primary-hover: #e0e0e0;
  --btn-secondary-bg: #111111;
  --btn-secondary-fg: #888888;
  --btn-secondary-hover: #222222;
  --badge-bg: #222222;
  --badge-fg: #ffffff;
  --success: #0070f3;
  --error: #ff0000;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  --shadow-modal: 0 30px 60px rgba(0, 0, 0, 0.8);
}

@media (prefers-color-scheme: light) {
  :root {
    /* Responsive Light Mode Override */
    --bg: #ffffff;
    --fg: #000000;
    --accents-1: #fafafa;
    --accents-2: #f0f0f0;
    --accents-3: #eaeaea;
    --accents-4: #666666;
    --accents-5: #444444;
    --border: #eaeaea;
    --card-bg: #ffffff;
    --btn-primary-bg: #000000;
    --btn-primary-fg: #ffffff;
    --btn-primary-hover: #333333;
    --btn-secondary-bg: #fafafa;
    --btn-secondary-fg: #666666;
    --btn-secondary-hover: #f0f0f0;
    --badge-bg: #f0f0f0;
    --badge-fg: #000000;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-modal: 0 30px 60px rgba(0, 0, 0, 0.12);
  }
}

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

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

.message-body a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--accents-4);
  font-weight: 500;
  transition: var(--transition);
  word-break: break-all;
}

.message-body a:hover {
  text-decoration-color: var(--fg);
  opacity: 0.8;
}


h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.02em;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 80px 16px;
}

/* Header & Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background-color: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 24px;
  height: 24px;
}

.brand-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.btn-primary {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--btn-primary-hover);
}

.btn-secondary {
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-fg);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  color: var(--fg);
  background-color: var(--btn-secondary-hover);
  border-color: var(--fg);
}

.btn-sm {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-icon {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
}

/* Form Inputs */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--accents-4);
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  background-color: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 6px;
  font-family: var(--font-family);
  font-size: 13px;
  transition: var(--transition);
  outline: none;
  width: 100%;
}

/* Custom Select Styling */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 32px !important;
  cursor: pointer;
}

@media (prefers-color-scheme: light) {
  select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  }
}

/* Custom Datepicker Styling */
input[type="date"] {
  position: relative;
  cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  background: transparent;
  color: transparent;
  cursor: pointer;
  opacity: 1;
  display: block;
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2' ry='2'></rect><line x1='16' y1='2' x2='16' y2='6'></line><line x1='8' y1='2' x2='8' y2='6'></line><line x1='3' y1='10' x2='21' y2='10'></line></svg>");
  background-repeat: no-repeat;
  background-size: contain;
  margin-left: 8px;
}

@media (prefers-color-scheme: light) {
  input[type="date"]::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2' ry='2'></rect><line x1='16' y1='2' x2='16' y2='6'></line><line x1='8' y1='2' x2='8' y2='6'></line><line x1='3' y1='10' x2='21' y2='10'></line></svg>");
  }
}



#sort-select {
  font-size: 11px;
  height: 28px;
  border-radius: 4px;
}

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

.help-text {
  font-size: 11px;
  color: var(--accents-4);
  margin-top: 2px;
}

/* Filter Card */
.filter-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .filter-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .filter-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

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

.input-with-icon input {
  padding-left: 36px;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--accents-4);
  display: block;
}

.filter-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.results-info {
  font-size: 13px;
  color: var(--accents-4);
}

.badge {
  background-color: var(--badge-bg);
  color: var(--badge-fg);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid var(--border);
}

/* Message Feed Card */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-card {
  background-color: transparent;
  border: none;
  border-bottom: 1px dashed var(--border);
  border-radius: 0;
  padding: 12px 8px;
  margin: 0 -8px;
  transition: var(--transition);
  display: flex;
  gap: 12px;
}

.message-card:hover {
  background-color: var(--accents-1);
  border-radius: 6px;
}

.messages-list .message-card:last-child {
  border-bottom: none;
}

.message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: #ffffff;
  flex-shrink: 0;
  letter-spacing: -0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  user-select: none;
  border: 1px solid var(--border);
}

.message-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* Prevents overflow inside flex container */
}

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

.message-user {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--fg);
}

.message-user .real-name {
  font-weight: 400;
  color: var(--accents-4);
  font-size: 11.5px;
  margin-left: 4px;
}

.message-time-id {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--accents-4);
}

.message-body {
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--fg);
  line-height: 1.5;
}

.message-body-wrapper {
  display: flex;
  flex-direction: column;
}

.btn-toggle-expand {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--accents-1);
  border: 1px solid var(--border);
  color: var(--accents-5);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  vertical-align: middle;
}

.btn-toggle-expand:hover {
  background-color: var(--accents-2);
  color: var(--fg);
  border-color: var(--accents-4);
}

.btn-toggle-expand .chevron-icon {
  width: 12px;
  height: 12px;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--accents-4);
}

.btn-toggle-expand:hover .chevron-icon {
  color: var(--fg);
}

/* Message Actions Bar (Copy & TTS) */
.message-actions-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.btn-action-icon {
  background: none;
  border: none;
  color: var(--accents-4);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  outline: none;
}

.btn-action-icon svg {
  width: 15px;
  height: 15px;
  display: block;
}

.btn-action-icon:hover {
  background-color: var(--accents-1);
  color: var(--fg);
}

.btn-play-tts.playing {
  color: var(--success);
}

/* Reply Block */
.reply-quote {
  background-color: var(--accents-1);
  border-left: 2px solid var(--accents-3);
  padding: 6px 10px;
  margin-bottom: 6px;
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--accents-5);
  transition: var(--transition);
}

.reply-quote:hover {
  border-left-color: var(--fg);
  background-color: var(--accents-2);
}

.reply-quote strong {
  color: var(--fg);
  font-weight: 500;
}

/* Attachments */
.attachments-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.images-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.files-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.image-attachment-wrapper {
  display: block;
  max-width: 260px;
  max-height: 180px;
  border-radius: 6px;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.image-attachment-wrapper:hover {
  border-color: var(--fg);
}

.chat-image {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  display: block;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  background-color: var(--accents-1);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 100px;
  text-decoration: none;
  color: var(--accents-4);
  transition: var(--transition);
}

.attachment-pill:hover {
  color: var(--fg);
  border-color: var(--fg);
  background-color: var(--accents-2);
}

/* Chat Message Links */
.chat-link {
  color: var(--success);
  text-decoration: underline;
  transition: var(--transition);
  word-break: break-all;
}

.chat-link:hover {
  opacity: 0.8;
}

/* Empty / Error States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--accents-4);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--fg);
}

/* Skeletons */
.skeleton-card {
  height: 90px;
  background: linear-gradient(90deg, var(--accents-1) 25%, var(--accents-2) 50%, var(--accents-1) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.pagination-info {
  font-size: 13px;
  color: var(--accents-4);
}

.pagination-buttons {
  display: flex;
  gap: 8px;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: color-mix(in srgb, var(--bg) 60%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 600px;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-lg {
  width: 760px;
}

.logs-console {
  background-color: #0c0c0c;
  color: #eaeaea;
  border: 1px solid #222;
  border-radius: 6px;
  padding: 16px;
  font-family: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11.5px;
  line-height: 1.6;
  height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: text;
  text-align: left;
}

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

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.btn-close {
  background: none;
  border: none;
  color: var(--accents-4);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: var(--transition);
}

.btn-close:hover {
  color: var(--fg);
  background-color: var(--accents-1);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Config Modal Tabs */
.config-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.config-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--accents-4);
  cursor: pointer;
  padding: 10px 16px;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: -1px;
}

.config-tab:hover {
  color: var(--fg);
}

.config-tab.active {
  color: var(--fg);
  border-bottom-color: var(--fg);
}

.config-tab-panel {
  display: none;
}

.config-tab-panel.active {
  display: block;
}

/* Toast System */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 13px;
  min-width: 250px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: toastIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-error {
  border-left: 3px solid var(--error);
}

/* Animations */
@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.spinner {
  animation: spin 1s linear infinite;
}

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

/* Custom Searchable Dropdown */
.custom-select-container {
  position: relative;
  width: 100%;
}

#user-select-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding-right: 36px;
  user-select: none;
}

.custom-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 4px;
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 250px;
  animation: slideUp 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

#user-select-search {
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  background-color: var(--bg);
  border: 1px solid var(--border);
}

.custom-select-options {
  overflow-y: auto;
  max-height: 180px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Custom Scrollbar for dropdown options */
.custom-select-options::-webkit-scrollbar {
  width: 4px;
}
.custom-select-options::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 4px;
}

.custom-option {
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  color: var(--accents-5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0; /* Prevents options from squishing and overlapping in flex container */
}

.custom-option:hover,
.custom-option.selected {
  background-color: var(--accents-1);
  color: var(--fg);
}

.custom-option.selected {
  font-weight: 600;
}

/* Lightbox zoom in animation */
@keyframes zoomIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.image-attachment-wrapper {
  cursor: zoom-in !important;
}

/* Filter Card Toggle Bar & Button (Desktop hidden by default) */
.filter-toggle-bar {
  display: none;
}

.mobile-pagination {
  display: none;
}

.filter-toggle-btn {
  width: 100%;
  background: none;
  border: none;
  color: var(--fg);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  outline: none;
}

.toggle-arrow {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
  color: var(--accents-4);
  display: block;
}

/* Mobile Web Responsiveness */
@media (max-width: 600px) {
  /* Container padding */
  .container {
    padding: 12px 12px 60px 12px;
  }

  /* Navbar Layout (Compact Single Row) */
  .navbar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background-color: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  
  .brand-title {
    display: none; /* Hide brand title text on mobile to save space */
  }
  
  .navbar-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    width: auto;
  }
  
  .navbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    width: auto;
  }

  .navbar-actions .btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--accents-5);
    transition: var(--transition);
  }

  .navbar-actions .btn:hover,
  .navbar-actions .btn:active {
    background-color: var(--accents-2);
    color: var(--fg);
  }

  .navbar-actions .btn .btn-text {
    display: none; /* Hide text inside buttons on mobile */
  }

  .navbar-actions .btn-icon {
    width: 18px;
    height: 18px;
    margin: 0;
  }

  #sync-btn .btn-text {
    display: none;
  }

  /* Filter footer stack */
  .filter-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .filter-footer-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  #sort-select,
  #reset-filters-btn {
    width: 100%;
    height: 36px;
    font-size: 13px;
    justify-content: center;
  }

  /* Message spacing and card density */
  .message-card {
    padding: 12px 6px;
    gap: 8px;
    margin: 0 -6px;
    background-color: transparent;
    border: none;
    border-bottom: 1px dashed var(--border);
    border-radius: 0;
  }

  .messages-list .message-card:last-child {
    border-bottom: none;
  }

  .message-avatar {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }

  .message-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .message-user {
    font-size: 14px;
  }

  .message-user .real-name {
    font-size: 12.5px;
  }

  .message-time-id {
    font-size: 10px;
  }

  .message-body {
    font-size: 14.5px;
    line-height: 1.55;
  }

  .reply-quote {
    font-size: 12.5px;
    padding: 8px 12px;
  }

  .image-attachment-wrapper {
    max-width: 100%;
    max-height: 150px;
  }

  .chat-image {
    max-height: 150px;
  }

  /* Hide Top Pagination, display only the embedded one */
  .pagination-top {
    display: none !important;
  }

  /* Bottom pagination stacks - Compact Horizontal Row */
  .pagination-container {
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px !important;
    background-color: var(--accents-1);
    border: 1px solid var(--border) !important;
    border-radius: 8px;
    margin: 8px 0 !important;
    gap: 12px;
    box-shadow: none;
    border-top: 1px solid var(--border) !important;
  }

  .pagination-info {
    font-size: 12px;
    color: var(--accents-5);
    text-align: left;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.4;
  }

  .last-sync-time-display {
    display: block !important;
    margin-left: 0 !important;
    font-size: 10px;
    color: var(--accents-4);
    white-space: nowrap;
  }

  .pagination-buttons {
    width: auto;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
  }

  .pagination-buttons .btn {
    flex: none;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    height: 28px;
    border-radius: 6px;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--fg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .pagination-buttons .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: transparent;
    border-color: var(--border);
    color: var(--accents-4);
  }

  /* Modal scaling */
  .modal {
    width: 95vw;
    max-height: 90vh;
  }

  /* Filter card mobile overrides - Compact Control Box with pagination merged */
  .filter-toggle-bar {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .filter-content {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .filter-card.expanded .filter-content {
    display: block;
  }

  .filter-card.expanded .toggle-arrow {
    transform: rotate(180deg);
  }

  .filter-card {
    background-color: var(--accents-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    box-shadow: none;
  }

  .filter-toggle-btn {
    font-size: 12.5px;
    color: var(--accents-5);
    display: inline-flex;
    align-items: center;
    width: auto;
    padding: 2px 4px;
  }

  /* Embedded Mobile Pagination */
  .mobile-pagination {
    display: flex !important;
    align-items: center;
    gap: 6px;
  }

  .mobile-pagination .btn-nav {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--fg);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    padding: 0;
  }

  .mobile-pagination .btn-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent;
  }

  .mobile-pagination .btn-nav:hover:not(:disabled),
  .mobile-pagination .btn-nav:active:not(:disabled) {
    background-color: var(--accents-2);
    border-color: var(--accents-5);
  }

  .mobile-page-info {
    font-size: 12px;
    font-weight: 500;
    color: var(--accents-5);
    min-width: 32px;
    text-align: center;
    white-space: nowrap;
  }
}

/* Desktop Side-by-Side Responsive Layout */
@media (min-width: 1024px) {
  .container {
    max-width: 1200px;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
    padding-top: 32px;
  }

  .filter-card {
    position: sticky;
    top: 96px; /* Sticks nicely below navbar */
    margin-bottom: 0;
  }

  .filter-grid {
    grid-template-columns: 1fr; /* Vertical column stacking inside the narrow left sidebar */
    gap: 12px;
  }

  .filter-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .filter-footer-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  #sort-select,
  #reset-filters-btn {
    width: 100%;
    height: 36px;
    font-size: 13px;
    justify-content: center;
  }
}
