:root {
  --sidebar-bg: #1a1f2e;
  --sidebar-width: 240px;
}

body { background: #f0f2f5; font-size: 14px; }

.login-bg { background: linear-gradient(135deg, #1a1f2e 0%, #2d3561 100%); }
.login-card { border: none; border-radius: 12px; }

.wrapper { min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar .nav-link {
  border-radius: 8px;
  font-size: 13px;
  padding: 8px 12px;
  transition: background .15s;
}

.sidebar .nav-link:hover { background: rgba(255,255,255,.08); }
.sidebar .nav-link.active { background: #198754; color: #fff !important; }

.main-content { min-height: 100vh; overflow-y: auto; }

.card { border-radius: 10px; }
.card-header { border-radius: 10px 10px 0 0 !important; border-bottom: 1px solid #f0f0f0; padding: .75rem 1rem; }

.stat-icon { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; }

.btn-xs { padding: 2px 6px; font-size: 12px; }
.btn-xs.btn { line-height: 1.5; }

.table th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; }
.table td { font-size: 13px; vertical-align: middle; }

code { background: #f0f0f0; padding: 1px 5px; border-radius: 4px; color: #d63384; font-size: 12px; }

.font-monospace { font-family: 'Courier New', monospace; }

.badge { font-weight: 500; }

/* scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }

/* ── Mobile top navbar ─────────────────────────────── */
.mobile-nav {
  background: var(--sidebar-bg);
  position: sticky;
  top: 0;
  z-index: 1050;
  height: 52px;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

/* ── Sidebar overlay backdrop ──────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1030;
}
.sidebar-overlay.show { display: block; }

/* ── Responsive sidebar ────────────────────────────── */
@media (max-width: 767.98px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform .28s ease;
  }
  .sidebar.show { transform: translateX(0); }
  .main-content { width: 100%; min-width: 0; }
  .wrapper { display: block !important; }

  /* Tighten overall padding */
  .main-content { padding: .75rem !important; }

  /* Hide non-essential columns on mobile */
  .col-mob-hide { display: none !important; }

  /* Content column — fill remaining space */
  .col-content  { max-width: none !important; min-width: 160px; }

  /* Time column — single line, wide enough for YYYY-MM-DD HH:MM:SS */
  .col-time     { font-size: 11px !important; white-space: nowrap !important; min-width: 148px !important; }

  /* From→To column — wide enough for number + push_name */
  .col-from     { min-width: 200px !important; max-width: 240px !important; }

  .table-responsive { font-size: 12px; }
  .btn-group-sm .btn { padding: .2rem .35rem; }
}

@media (min-width: 768px) {
  .mobile-nav { display: none !important; }

  /* Message log — fixed column widths so Content gets the most space */
  #msgTable .col-time    { width: 158px; white-space: nowrap; }
  #msgTable .col-from    { width: 260px; max-width: 260px; }
  #msgTable th:nth-child(2) { width: 130px; }   /* Bot */
  #msgTable th:nth-child(3) { width: 62px;  }   /* Dir */
  #msgTable th:nth-child(5) { width: 68px;  }   /* Type */
  #msgTable .col-content { min-width: 220px; max-width: none; }
}

/* From→To layout */
.jid-from { font-weight: 600; }
.jid-to   { color: #6c757d; font-size: .75rem; }