/* ── Root ─────────────────────────────────────────────────── */
:root {
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 58px;
  --sidebar-bg: #1a3a28;
  --sidebar-dark: #0f2419;
  --sidebar-hover: #27ae60;
  --sidebar-text: #c8e6c9;
  --accent: #27ae60;
  --accent-dark: #1e8449;
  --top-h: 54px;
  --radius: 7px;
  --font-base: 0.8rem;
  --font-sm: 0.74rem;
  --font-xs: 0.69rem;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', sans-serif; background: #f0f2f5; font-size: var(--font-base); }

/* ── Login ────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f2419 0%, #27ae60 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: #fff; border-radius: 14px;
  padding: 2.2rem 1.8rem; width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-logo { font-size: 2.6rem; color: var(--accent); }
.login-box h5 { color: var(--sidebar-bg); font-weight: 700; font-size: .95rem; }
.btn-login {
  background: var(--accent); border: none; color: #fff;
  width: 100%; padding: .65rem; border-radius: var(--radius);
  font-weight: 600; font-size: .9rem; transition: background .2s;
}
.btn-login:hover { background: var(--accent-dark); }

/* ── Sidebar ──────────────────────────────────────────────── */
#sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  overflow: hidden; z-index: 200;
  transition: width .25s ease;
  white-space: nowrap;
}
body.sb-collapsed #sidebar { width: var(--sidebar-w-collapsed); overflow: hidden; }

#sidebar .sidebar-brand {
  background: var(--sidebar-dark);
  padding: .75rem .9rem; color: #fff;
  font-weight: 700; font-size: .78rem; line-height: 1.3;
  min-height: var(--top-h); display: flex; align-items: center; gap: .7rem;
  overflow: hidden;
}
#sidebar .sidebar-brand .brand-icon { font-size: 1.5rem; color: var(--accent); flex-shrink: 0; }
#sidebar .sidebar-brand .brand-text { overflow: hidden; white-space: nowrap; transition: opacity .2s, max-width .25s; max-width: 200px; }
body.sb-collapsed #sidebar .brand-text { opacity: 0; max-width: 0; }

#sidebar .sidebar-user {
  padding: .55rem .9rem; background: rgba(0,0,0,.2);
  color: var(--sidebar-text); font-size: var(--font-xs);
  overflow: hidden; transition: opacity .2s;
  display: flex; align-items: center; gap: .55rem;
}
body.sb-collapsed #sidebar .sidebar-user { opacity: 0; height: 0; padding: 0; }

/* ── User Avatar ──────────────────────────────────────────── */
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem; flex-shrink: 0;
  user-select: none;
}
.user-avatar-sm {
  width: 26px; height: 26px; font-size: .78rem;
}
.user-avatar-top {
  width: 28px; height: 28px; font-size: .8rem;
}

#sidebar .sidebar-section-label {
  padding: .5rem .9rem .2rem;
  font-size: .63rem; font-weight: 700; letter-spacing: 1px;
  color: rgba(255,255,255,.35); text-transform: uppercase;
  overflow: hidden; transition: opacity .2s;
}
body.sb-collapsed #sidebar .sidebar-section-label { opacity: 0; height: 0; padding: 0; }

#sidebar nav a {
  display: flex; align-items: center; gap: .6rem;
  padding: .52rem .9rem; color: var(--sidebar-text);
  text-decoration: none; font-size: var(--font-sm); font-weight: 500;
  border-left: 3px solid transparent; transition: all .15s;
  overflow: hidden;
}
#sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
#sidebar nav a.active {
  background: rgba(39,174,96,.2); color: #fff;
  border-left-color: var(--accent);
}
#sidebar nav a .menu-icon { width: 18px; text-align: center; font-size: .85rem; flex-shrink: 0; }
#sidebar a .menu-label { transition: opacity .2s, max-width .25s; display: inline-block; max-width: 160px; vertical-align: middle; overflow: hidden; white-space: nowrap; }
body.sb-collapsed #sidebar a .menu-label { opacity: 0; max-width: 0; }
#sidebar a .menu-badge {
  margin-left: auto; background: #e74c3c;
  color: #fff; font-size: .6rem; font-weight: 700;
  padding: 1px 6px; border-radius: 10px; line-height: 1.5;
  flex-shrink: 0;
}
/* When collapsed: pin badge to top-right of icon */
body.sb-collapsed #sidebar a .menu-badge {
  position: absolute;
  top: 4px; right: 4px;
  margin-left: 0;
  font-size: .52rem;
  padding: 1px 4px;
  min-width: 16px; text-align: center;
}

/* Center icon when collapsed */
body.sb-collapsed #sidebar nav a,
body.sb-collapsed #sidebar .mt-auto a {
  justify-content: center;
  padding-left: 0; padding-right: 0;
}

/* Tooltip on collapsed sidebar */
body.sb-collapsed #sidebar a { position: relative; }
body.sb-collapsed #sidebar a::after {
  content: attr(data-label);
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
  background: #333; color: #fff; padding: .3rem .6rem;
  border-radius: 4px; font-size: .72rem; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 999;
  margin-left: 8px;
}
body.sb-collapsed #sidebar a:hover::after { opacity: 1; }

/* ── Top Navbar ───────────────────────────────────────────── */
#topbar {
  position: fixed; top: 0;
  left: var(--sidebar-w); right: 0; height: var(--top-h);
  background: #fff; z-index: 100;
  display: flex; align-items: center;
  padding: 0 1.2rem; gap: .8rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transition: left .25s ease;
}
body.sb-collapsed #topbar { left: var(--sidebar-w-collapsed); }

#sidebarToggle {
  background: none; border: none;
  font-size: 1.15rem; color: #555; cursor: pointer; padding: .3rem .4rem;
  border-radius: 5px; flex-shrink: 0;
  transition: background .15s;
}
#sidebarToggle:hover { background: #f0f0f0; }

#topbar .page-title { font-weight: 700; font-size: .85rem; color: #333; flex: 1; }

#realtimeClock {
  font-size: .72rem; color: #555; white-space: nowrap;
  background: #f8f9fa; padding: .3rem .7rem; border-radius: 20px;
  border: 1px solid #e9ecef;
}

#topbar .top-user { font-size: .75rem; color: #555; display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }

/* Sync status — text hidden, spinner shown on avatar */
#syncStatus { display: none !important; }

/* Spinner ring around user avatar */
.avatar-sync-ring {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar-sync-ring::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  opacity: 0;
  transition: opacity .2s;
}
.avatar-sync-ring.syncing::after {
  opacity: 1;
  animation: spin .7s linear infinite;
}
.avatar-sync-ring.sync-error::after {
  border-top-color: #e74c3c;
  border-right-color: #e74c3c;
  opacity: 1;
  animation: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading overlay pulse animation */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .4; transform: scale(.9); }
}

/* ── Main Content ─────────────────────────────────────────── */
#mainContent {
  margin-left: var(--sidebar-w);
  padding-top: var(--top-h);
  min-height: 100vh;
  transition: margin-left .25s ease;
}
body.sb-collapsed #mainContent { margin-left: var(--sidebar-w-collapsed); }
#contentArea { padding: 1.2rem; }

/* ── Cards ────────────────────────────────────────────────── */
.card { border: none; border-radius: var(--radius); box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.card-header { border-radius: var(--radius) var(--radius) 0 0 !important; font-weight: 600; font-size: var(--font-sm); padding: .6rem 1rem; }
.card-body { font-size: var(--font-base); }

.stat-card { border-radius: var(--radius); padding: 1rem 1.2rem; color: #fff; }
.stat-card .stat-val { font-size: 1.7rem; font-weight: 800; }
.stat-card .stat-lbl { font-size: .72rem; opacity: .85; }
.stat-card .stat-icon { font-size: 2rem; opacity: .25; }

/* ── Tables ───────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.table { font-size: var(--font-sm); }
.table thead th {
  background: #1a3a28; color: #fff;
  font-size: .72rem; white-space: nowrap;
  vertical-align: middle; padding: .45rem .9rem;
}
.table tbody td { font-size: .73rem; vertical-align: middle; padding: .38rem .9rem; }
.table-hover tbody tr:hover { background: #f0faf5; }
.table-sm td, .table-sm th { padding: .3rem .65rem; font-size: .7rem; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn { font-size: var(--font-sm); }
.btn-sm, .btn-action { font-size: .7rem; padding: .22rem .5rem; }
.btn-action { border-radius: 4px; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }

/* ── Badges ───────────────────────────────────────────────── */
.bg-purple { background-color: #7b2d8b !important; }
.badge { font-size: .65rem; }

/* ── Follow-up columns ────────────────────────────────────── */
.fu-check { width: 1rem; height: 1rem; accent-color: var(--accent); cursor: pointer; }
.fu-check:disabled { cursor: not-allowed; opacity: .5; }
.fu-input { font-size: .7rem; padding: .18rem .35rem; border-radius: 4px; border: 1px solid #ccc; width: 100%; }

/* ── Forms ────────────────────────────────────────────────── */
.form-label { font-size: .78rem; font-weight: 600; color: #444; margin-bottom: .3rem; }
.form-control, .form-select {
  font-size: .82rem; border-radius: 5px;
  border: 1px solid #dde1e7; padding: .35rem .6rem;
}
.form-control-sm, .form-select-sm { font-size: .76rem; padding: .25rem .5rem; }
.form-control:focus, .form-select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 .18rem rgba(39,174,96,.15);
}
.input-group-text { background: #f0faf5; border-color: #dde1e7; color: var(--accent-dark); font-size: .82rem; }

/* ── Section heading ──────────────────────────────────────── */
.section-header { margin-bottom: 1rem; }
.section-header h5 { font-weight: 700; color: #1a3a28; margin: 0; font-size: .95rem; }
.section-header small { color: #888; font-size: .72rem; }

/* ── DB info bar ──────────────────────────────────────────── */
.db-info-bar {
  background: #e8f5e9; border: 1px solid #a5d6a7;
  border-radius: var(--radius); padding: .5rem .9rem;
  font-size: .76rem; color: #1b5e20;
}

/* ── Photo preview ────────────────────────────────────────── */
#photoPreview img { max-height: 160px; border-radius: var(--radius); border: 1px solid #ddd; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f0f0f0; }
::-webkit-scrollbar-thumb { background: #b0c4b1; border-radius: 3px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  #sidebar.open { transform: translateX(0); }
  #mainContent { margin-left: 0 !important; }
  #topbar { left: 0 !important; }

  /* Fix: 100vh tidak akurat di mobile (address bar browser makan ruang)
     100dvh = dynamic viewport height = tinggi layar yang benar-benar terlihat */
  #sidebar {
    height: 100dvh;
    height: -webkit-fill-available; /* fallback iOS Safari */
  }
  /* Nav bisa scroll jika menu terlalu banyak, tanpa merenggangkan jarak antar item */
  #sidebar nav { overflow-y: auto; flex-shrink: 1; min-height: 0; }
  .stat-card .stat-val { font-size: 1.3rem; }

  /* 1. Topbar: sembunyikan nama user, tampilkan avatar saja */
  #topUserName { display: none !important; }
  #topbar .top-user { position: relative; cursor: pointer; }
  #topbar .top-user .user-name-popup {
    display: none; position: absolute; top: calc(100% + 6px); right: 0;
    background: #fff; border: 1px solid #dee2e6; border-radius: 8px;
    padding: .3rem .7rem; white-space: nowrap; font-size: .75rem; color: #333;
    box-shadow: 0 4px 14px rgba(0,0,0,.12); z-index: 200;
  }
  #topbar .top-user.show-name .user-name-popup { display: block; }

  /* 2. Filter bar: kompak satu baris */
  .date-filter-bar { flex-wrap: nowrap; gap: 3px; }
  .date-filter-bar input[type="date"] {
    width: 100px !important; font-size: .68rem !important;
    padding: .18rem .25rem !important;
  }
  .date-filter-bar .text-muted { font-size: .7rem; white-space: nowrap; }
  .date-filter-bar i { display: none; } /* sembunyikan ikon kalender agar lebih ringkas */

  /* 3. Password table: sembunyikan kolom "Password Saat Ini" */
  #tblPwdAdmin th:nth-child(2),
  #tblPwdAdmin td:nth-child(2) { display: none; }
  #tblPwdAdmin th, #tblPwdAdmin td { font-size: .75rem; padding: .3rem .4rem; }

  /* 4. Database table: kolom Satuan dipersempit */
  #tblDB th:nth-child(1), #tblDB td:nth-child(1) { width: 32px; }
  #tblDB th:nth-child(3), #tblDB td:nth-child(3) {
    width: 68px !important; white-space: nowrap; font-size: .75rem;
  }
}

/* ── Toast container ──────────────────────────────────────── */
#toastContainer {
  position: fixed; bottom: 1.2rem; right: 1.2rem; z-index: 9999;
  display: flex; flex-direction: column; gap: .4rem;
}
.toast { font-size: .78rem; }

/* ── DataTables overrides ─────────────────────────────────── */
div.dataTables_wrapper { padding: .35rem .55rem; }
div.dataTables_wrapper div.dataTables_length label,
div.dataTables_wrapper div.dataTables_filter label { font-size: .76rem; }
div.dataTables_wrapper div.dataTables_length select,
div.dataTables_wrapper div.dataTables_filter input { font-size: .76rem; padding: .2rem .4rem; }
div.dataTables_wrapper div.dataTables_length select { min-width: 58px; padding-right: 1.5rem; }
div.dataTables_wrapper div.dataTables_info { font-size: .72rem; }
div.dataTables_wrapper div.dataTables_paginate .paginate_button {
  font-size: .68rem !important; padding: .15rem .42rem !important;
  min-width: 0 !important; line-height: 1.3 !important;
  border-radius: 4px !important;
}
div.dataTables_wrapper div.dataTables_paginate ul.pagination {
  margin: 0; gap: 2px;
}
div.dataTables_wrapper div.dataTables_paginate .page-link {
  font-size: .68rem !important;
  padding: .18rem .44rem !important;
  line-height: 1.3 !important;
  border-radius: 4px !important;
  min-width: 26px; text-align: center;
}
table.dataTable thead .sorting:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after { color: rgba(255,255,255,.65); }

/* ── ED table – smaller to accommodate inline TL column ──── */
#tblED_wrapper td { font-size: .66rem !important; padding-left: .6rem !important; padding-right: .6rem !important; }
#tblED_wrapper th { font-size: .65rem !important; padding-left: .6rem !important; padding-right: .6rem !important; }
#tblED_wrapper .btn-action { font-size: .59rem !important; padding: .13rem .32rem !important; }
#tblED_wrapper .badge { font-size: .58rem !important; }
#tblED_wrapper .fu-input { font-size: .65rem !important; }

/* ── BS table – compact 1-row display ────────────────────── */
#tblBS td { font-size: .64rem !important; padding: .26rem .55rem !important; white-space: nowrap; }
#tblBS th { font-size: .62rem !important; }
#tblBS .btn-action { font-size: .57rem !important; padding: .11rem .27rem !important; }
#tblBS .badge { font-size: .56rem !important; }
#tblBS .fu-check { width: .85rem; height: .85rem; }
#tblBS .fu-input { font-size: .63rem !important; padding: .14rem .3rem !important; max-width: 90px; }

/* ── Sticky columns (No. + Nama Barang) ──────────────────── */
/* BS table – scroll container is the parent div[overflow-x:auto] */
#tblBS thead tr:first-child th:nth-child(1),
#tblBS thead tr:first-child th:nth-child(2) {
    position: sticky; z-index: 3; background: #1a3a28;
}
#tblBS thead tr:first-child th:nth-child(1) { left: 0; }
#tblBS thead tr:first-child th:nth-child(2) { left: 36px; box-shadow: 2px 0 4px rgba(0,0,0,.18); }

#tblBS tbody td:nth-child(1),
#tblBS tbody td:nth-child(2) {
    position: sticky; z-index: 1; background-color: #fff !important;
}
#tblBS tbody tr:nth-of-type(odd) td:nth-child(1),
#tblBS tbody tr:nth-of-type(odd) td:nth-child(2) { background-color: #f2f2f2 !important; }
#tblBS tbody tr:hover td:nth-child(1),
#tblBS tbody tr:hover td:nth-child(2) { background-color: #e8f5e9 !important; }
#tblBS tbody td:nth-child(1) { left: 0; }
#tblBS tbody td:nth-child(2) { left: 36px; box-shadow: 2px 0 5px rgba(0,0,0,.15); }

/* ED table – DataTables scrollX, sticky inside dataTables_scrollBody */
#tblED_wrapper .dataTables_scrollHead th:nth-child(1),
#tblED_wrapper .dataTables_scrollHead th:nth-child(2) {
    position: sticky; z-index: 3; background: #1a3a28 !important;
}
#tblED_wrapper .dataTables_scrollHead th:nth-child(1) { left: 0; }
#tblED_wrapper .dataTables_scrollHead th:nth-child(2) { left: 36px; box-shadow: 2px 0 4px rgba(0,0,0,.18); }

#tblED_wrapper .dataTables_scrollBody td:nth-child(1),
#tblED_wrapper .dataTables_scrollBody td:nth-child(2) {
    position: sticky; z-index: 1; background-color: #fff !important;
}
#tblED_wrapper .dataTables_scrollBody tr:nth-of-type(odd) td:nth-child(1),
#tblED_wrapper .dataTables_scrollBody tr:nth-of-type(odd) td:nth-child(2) { background-color: #f2f2f2 !important; }
#tblED_wrapper .dataTables_scrollBody tr:hover td:nth-child(1),
#tblED_wrapper .dataTables_scrollBody tr:hover td:nth-child(2) { background-color: #e8f5e9 !important; }
#tblED_wrapper .dataTables_scrollBody td:nth-child(1) { left: 0; }
#tblED_wrapper .dataTables_scrollBody td:nth-child(2) { left: 36px; box-shadow: 2px 0 5px rgba(0,0,0,.15); }

/* ── Help page ────────────────────────────────────────────── */
.help-card { border-left: 4px solid var(--accent); }
.help-card .card-title { color: var(--sidebar-bg); font-size: .85rem; }
.help-card p, .help-card li { font-size: .78rem; }

/* ── Settings tabs ────────────────────────────────────────── */
.nav-tabs .nav-link { font-size: .8rem; padding: .45rem .9rem; }
.nav-tabs .nav-link.active { color: var(--accent-dark); font-weight: 600; border-bottom-color: #fff; }
.perm-table th { font-size: .68rem; text-align: center; padding: .3rem .25rem; }
.perm-table td { font-size: .72rem; padding: .28rem .3rem; text-align: center; vertical-align: middle; }
.perm-table td:first-child { text-align: left; font-weight: 600; }
.perm-check { width: .9rem; height: .9rem; accent-color: var(--accent); }

/* ── ED Follow-up cell ────────────────────────────────────── */
.ed-fu-cell { min-width: 170px; max-width: 230px; vertical-align: middle !important; }
.ed-fu-cell select.fu-input { width: 100%; }

/* ── Confirm modal ────────────────────────────────────────── */
#confirmModal .modal-header { background: var(--sidebar-bg); color: #fff; }
.modal-header { padding: .75rem 1rem; }
.modal-title { font-size: .9rem; }
.modal-body { font-size: .82rem; }

/* ── Chat ─────────────────────────────────────────────────── */
.chat-card {
  display: flex; flex-direction: column;
  height: calc(100vh - 210px); min-height: 420px;
  overflow: hidden; position: relative;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: .9rem 1rem;
  display: flex; flex-direction: column; gap: .1rem;
  background: #f8f9fa;
}
.chat-empty {
  text-align: center; color: #aaa; font-size: .78rem; margin: auto;
}
.chat-input-area {
  display: flex; align-items: center; gap: .4rem;
  padding: .55rem .75rem; border-top: 1px solid #dee2e6;
  background: #fff;
}
.chat-input-area .form-control { flex: 1; }

/* Date separator */
.chat-date-sep {
  text-align: center; margin: .7rem 0 .4rem;
}
.chat-date-sep span {
  background: #dee2e6; color: #666; font-size: .62rem;
  padding: 2px 12px; border-radius: 12px;
}

/* Message row */
.chat-msg {
  display: flex; align-items: flex-end; gap: .45rem;
  margin-bottom: .35rem; max-width: 100%;
}
.chat-msg.own { flex-direction: row-reverse; }

/* Avatar circle */
.chat-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; color: #fff;
  flex-shrink: 0; align-self: flex-end;
}

/* Bubble wrapper */
.chat-bubble { display: flex; flex-direction: column; max-width: 65%; }
.chat-msg.own .chat-bubble { align-items: flex-end; }

/* Name + time */
.chat-meta {
  font-size: .6rem; color: #888; margin-bottom: 3px; padding: 0 4px;
}
.chat-meta .chat-time { margin-left: 5px; opacity: .75; }

/* Text bubble */
.chat-text {
  background: #fff; border: 1px solid #e0e0e0;
  padding: .38rem .6rem; border-radius: 4px 14px 14px 14px;
  font-size: .78rem; word-break: break-word; line-height: 1.45;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.chat-msg.own .chat-text {
  background: #d4edda; border-color: #b7dfc1;
  border-radius: 14px 4px 14px 14px;
}
.chat-img-ph {
  color: #aaa; font-size: .72rem; font-style: italic;
  background: #f5f5f5; border-color: #ddd;
}

/* Image in chat */
.chat-img-wrap img {
  max-width: 220px; max-height: 220px;
  border-radius: 10px; cursor: zoom-in;
  display: block; border: 1px solid #ddd;
}

/* @ Mention autocomplete dropdown */
.mention-dropdown {
  position: absolute; bottom: 52px; left: 0; right: 0;
  background: #fff; border: 1px solid #d0d0d0;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -6px 20px rgba(0,0,0,.1);
  z-index: 50; max-height: 180px; overflow-y: auto;
}
.mention-dropdown ul { list-style: none; margin: 0; padding: .3rem 0; }
.mention-dropdown li {
  display: flex; align-items: center; gap: .5rem;
  padding: .32rem .8rem; font-size: .78rem; cursor: pointer;
}
.mention-dropdown li:hover { background: #f0f8f4; }
.mention-av {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .62rem; font-weight: 700; color: #fff; flex-shrink: 0;
}

/* Reply bar above input */
.chat-reply-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .4rem .8rem; background: #f0f8f4;
  border-top: 1px solid #d4edda; font-size: .75rem; gap: .5rem;
}
.chat-reply-preview { display: flex; align-items: center; gap: .25rem; flex: 1; min-width: 0; overflow: hidden; }
.chat-reply-sender { font-weight: 700; color: #1a6e3c; white-space: nowrap; }
.chat-reply-excerpt { color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-reply-cancel {
  background: none; border: none; padding: 0 .2rem;
  color: #aaa; font-size: .8rem; cursor: pointer; flex-shrink: 0;
}
.chat-reply-cancel:hover { color: #e74c3c; }

/* Quoted block inside bubble */
.chat-quoted {
  border-left: 3px solid #1a6e3c; background: rgba(26,110,60,.07);
  border-radius: 0 6px 6px 0; padding: .25rem .55rem;
  margin-bottom: .3rem; font-size: .72rem; display: flex; flex-direction: column; gap: 1px;
}
.chat-quoted-name { font-weight: 700; color: #1a6e3c; }
.chat-quoted-text { color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }

/* Reply button on messages from others */
.chat-reply-btn {
  background: none; border: none; padding: 0 .35rem;
  color: #aaa; font-size: .72rem; cursor: pointer;
  opacity: 0; transition: opacity .15s; align-self: center; flex-shrink: 0;
}
.chat-msg:hover .chat-reply-btn { opacity: 1; }
.chat-reply-btn:hover { color: #1a6e3c; }

/* Mention highlight in message text */
.chat-mention {
  background: #d4edda; color: #155724;
  border-radius: 3px; padding: 0 4px; font-weight: 600;
}
.chat-mention-self {
  background: #fff3cd; color: #856404;
}

/* Badge: dot only (no number) for general unread */
#sidebar a .menu-badge.badge-dot {
  width: 10px; height: 10px;
  padding: 0; border-radius: 50%;
  min-width: 0; font-size: 0;
}
body.sb-collapsed #sidebar a .menu-badge.badge-dot {
  width: 8px; height: 8px;
  top: 6px; right: 6px;
}

/* Download button */
.chat-dl-btn {
  font-size: .62rem; color: #555; background: #f0f0f0;
  border: 1px solid #ccc; border-radius: 4px;
  padding: 1px 8px; cursor: pointer;
}
.chat-dl-btn:hover { background: #e2e2e2; }

/* Section-level date filter bar ───────────────────────── */
.date-filter-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  font-size: .78rem;
}

