/* Custom topbar styles for SaaS feel */
.topbar { height: 42px; padding: 0; }
.topbar .navbar-nav .nav-link {
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
}
.topbar .navbar-nav .nav-link.active,
.topbar .navbar-nav .nav-link:hover {
  background: rgba(255,255,255,0.14);
}
.topbar-actions .btn { border-radius: 10px; }
.topbar-actions .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.topbar .badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 50%;
}
.topbar-nav-scroller {
  scrollbar-width: thin;
}
@media (max-width: 991px) {
  .topbar .navbar-nav { flex-wrap: nowrap; }
  .topbar .navbar-nav .nav-link { white-space: nowrap; }
}

.topbar-compact { height: 50px; }
.avatar-outline { width: 34px; height: 34px; border:1px solid #d1d5db; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; font-weight:700; color:#6b7280; background:#f9fafb; }
.mobile-sidebar-toggle {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
}

/* Project collaboration */
.project-tabs { overflow-x: auto; white-space: nowrap; }
.project-tabs .nav-link { white-space: nowrap; }
.message-list .message-item { border-bottom: 1px solid #f1f5f9; padding: 16px; }
.message-body { margin-top: 8px; }
.message-editor { min-height: 140px; }
.mention { background: #e0f2fe; color: #0369a1; padding: 2px 4px; border-radius: 4px; }
.mention-dropdown { border:1px solid #e5e7eb; border-radius:8px; background:#fff; max-height:200px; overflow:auto; margin-top:8px; }
.mention-item { padding:6px 10px; cursor:pointer; }
.mention-item:hover { background:#f1f5f9; }

.message-list.card { border: 1px solid #e5e7eb; border-radius: 14px; overflow: visible; }
.message-list-header { padding: 14px 16px; background: #f8fafc; border-bottom: 1px solid #e5e7eb; }
.message-compose { position: static; background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 12px; z-index: 2; }

/* Attendance reminders must stay interactive above page-specific modal backdrops. */
.attendance-reminder-modal.modal { z-index: 2147483647 !important; }
.reply-composer { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 12px; margin-top: 12px; }
.chat-upload-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.chat-upload-preview-item { position: relative; width: 92px; border: 1px solid #e5e7eb; border-radius: 12px; background: #f8fafc; padding: 8px; }
.chat-upload-preview-thumb { width: 100%; height: 60px; border-radius: 8px; background: #e2e8f0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.chat-upload-preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-upload-preview-ext { font-size: 11px; font-weight: 700; color: #0f172a; letter-spacing: 0.04em; }
.chat-upload-preview-name { margin-top: 8px; font-size: 11px; font-weight: 600; color: #334155; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.chat-upload-preview-meta { margin-top: 4px; font-size: 10px; color: #64748b; line-height: 1.2; min-height: 12px; }
.chat-upload-preview-progress { margin-top: 8px; height: 4px; border-radius: 999px; background: #dbe4ef; overflow: hidden; opacity: 0; transition: opacity 0.15s ease; }
.chat-upload-preview-progress-bar { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2563eb 0%, #38bdf8 100%); transition: width 0.15s linear; }
.chat-upload-preview-item.is-uploading .chat-upload-preview-progress { opacity: 1; }
.chat-upload-preview-remove { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border: 0; border-radius: 999px; background: #ef4444; color: #fff; font-size: 14px; font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(239,68,68,0.28); cursor: pointer; }
.chat-upload-preview-remove:hover { background: #dc2626; }
.chat-upload-preview-remove:disabled { opacity: 0.65; cursor: not-allowed; }
.message-item { padding: 16px; border-bottom: 1px solid #f1f5f9; position: relative; background: #fff; }
.message-item:last-child { border-bottom: 0; }
.message-item:hover { background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%); box-shadow: inset 0 0 0 1px rgba(226,232,240,0.8); }
.message-row { display: flex; gap: 12px; align-items: flex-start; }
.message-avatar { width: 36px; height: 36px; border-radius: 999px; background: #0f172a; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.message-card { background: #ffffff; border: 1px solid #e5e7eb; border-radius: 16px; padding: 12px 14px; width: 100%; position: relative; }
.message-item:hover .message-actions { opacity: 1; pointer-events: auto; }
.message-item:hover .message-card { box-shadow: 0 10px 24px rgba(15,23,42,0.08); }
.message-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.message-author { font-weight: 600; color: #111827; }
.message-time { color: #6b7280; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.message-status { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; margin-left: 4px; color: inherit; }
.message-status-icon { font-size: 14px; }
.message-status-sent .message-status-icon { color: #94a3b8; }
.message-status-read .message-status-icon { color: #2563eb; }
.message-body { margin-top: 8px; color: #111827; font-size: 14px; line-height: 1.55; }
.message-body p { margin: 0 0 8px; }
.message-body a { color: #1d4ed8; text-decoration: underline; }
.message-attachments { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 12px; }
.attachment-card { border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; background: #f8fafc; display: flex; flex-direction: column; width: 150px; min-height: 170px; }
.attachment-thumb { display: block; background: #e2e8f0; width: 100%; height: 140px; }
.attachment-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attachment-meta { padding: 10px 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 60px; max-width: 100%; }
.attachment-name { font-weight: 600; font-size: 13px; color: #1f2937; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: normal; word-break: normal; hyphens: auto; }
.attachment-actions { position: absolute; top: 8px; right: 8px; display: inline-flex; gap: 6px; opacity: 0; transition: opacity 0.15s ease; }
.attachment-card { position: relative; }
.attachment-card:hover .attachment-actions { opacity: 1; }
.attachment-file { display: flex; align-items: center; gap: 12px; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px; background: #fff; min-width: 0; }
.attachment-deleted { background: #f8fafc; border-color: #f1f5f9; }
.file-icon { min-width: 48px; height: 48px; border-radius: 10px; background: #0f172a; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.file-meta { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.attachment-file { position: relative; }
.attachment-file .attachment-actions { position: absolute; top: 8px; right: 8px; }
.attachment-file:hover .attachment-actions { opacity: 1; }
.attachment-file .attachment-name { max-width: calc(100% - 60px); white-space: normal; word-break: break-word; }
.attachment-card .approval-status {
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}
.attachment-card .approval-status .badge {
  font-size: 11px;
  padding: 2px 6px;
  white-space: normal;
  text-align: center;
  max-width: 100%;
}
.icon-btn { width: 28px; height: 28px; border-radius: 999px; border: 1px solid #e2e8f0; background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.icon-btn:hover { background: #f1f5f9; }
.deleted-pill { font-size: 11px; font-weight: 700; color: #991b1b; background: #fee2e2; padding: 2px 8px; border-radius: 999px; }
.message-deleted { background: #f8fafc; color: #94a3b8; }
.message-deleted .message-body { color: #94a3b8; }
.message-body-deleted { color: #94a3b8; }
.message-deleted-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: #991b1b; background: #fee2e2; padding: 3px 8px; border-radius: 999px; margin-top: 8px; }
.message-edited-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: #1f2937; background: #e2e8f0; padding: 3px 8px; border-radius: 999px; margin-top: 8px; }
.message-body-original { color: #6b7280; background: #f8fafc; border: 1px dashed #e5e7eb; border-radius: 10px; padding: 8px 10px; }
.message-actions { position: absolute; top: 10px; right: 12px; display: inline-flex; gap: 6px; opacity: 0; pointer-events: none; transition: opacity 0.15s ease; }
.message-reply, .message-menu-btn { border: 1px solid #d1d5db; background: #fff; color: #374151; border-radius: 999px; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; }
.message-menu-btn { font-size: 18px; line-height: 1; }
.message-menu { position: absolute; top: 36px; right: 0; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; box-shadow: 0 10px 24px rgba(15,23,42,0.12); min-width: 220px; padding: 6px 0; display: none; z-index: 2200; flex-direction: column; gap: 0; }
.message-menu.open { display: flex; }
.message-menu-item { width: 100%; text-align: left; padding: 10px 16px; border: 0; background: transparent; border-radius: 4px; font-size: 13px; color: #111827; }
.message-menu-item:hover { background: #f1f5f9; }
.message-menu-divider { height: 1px; margin: 6px 0; background: #e5e7eb; border-radius: 999px; }
.message-menu-section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; padding: 4px 10px 2px; }
@media (max-width: 767px) {
  .message-actions { opacity: 1; pointer-events: auto; position: static; margin-top: 10px; }
}

/* Global responsive helpers */
@media (max-width: 991px) {
  main.container-fluid { padding-left: 14px; padding-right: 14px; }
  .filter-bar .col-md-1, .filter-bar .col-md-2, .filter-bar .col-md-3, .filter-bar .col-md-4 { width: 100%; }
  .filter-bar .btn { width: 100%; }
}
@media (max-width: 767px) {
  .table { display: block; width: 100%; overflow-x: auto; }
  .table thead, .table tbody, .table tr, .table th, .table td { white-space: nowrap; }
  .table td .btn, .table td .btn-group { white-space: nowrap; }
  .nav-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
  .nav-tabs .nav-link { white-space: nowrap; }
  .card-body { padding: 12px; }
  .modal-dialog { margin: .5rem; }
  .topbar-actions { flex-wrap: wrap; gap: 6px; }
  .topbar-actions .btn { width: 100%; }
.topbar-actions .avatar { width: 30px; height: 30px; }
}

/* Action column polish */
.action-stack {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
  min-width: 150px;
}
.action-stack .action-row { margin: 0; }
.action-stack .form-select { border-radius: 10px; }
.action-stack .btn { border-radius: 10px; }

.bulk-actions-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.bulk-actions-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.bulk-actions-group .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.bulk-actions-select {
  flex: 1 1 220px;
  min-width: 220px;
}
.bulk-actions-count {
  margin-left: auto;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .bulk-actions-toolbar {
    align-items: stretch;
  }
  .bulk-actions-group {
    max-width: 100%;
  }
  .bulk-actions-count {
    width: 100%;
    margin-left: 0;
  }
}

.reply-preview { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 6px 18px rgba(15,23,42,0.06); }
.reply-preview .reply-preview-content { display: grid; gap: 4px; }
.reply-preview-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; margin-left: auto; margin-right: 8px; }
.reply-preview-close { border: 0; background: #fff; width: 28px; height: 28px; border-radius: 999px; font-size: 18px; color: #64748b; box-shadow: 0 2px 8px rgba(15,23,42,0.1); }
.reply-inline { border-left: 3px solid #94a3b8; background: #f8fafc; padding: 10px 12px; border-radius: 12px; margin: 8px 0 12px; position: relative; }
.reply-inline::before { content: ""; position: absolute; left: -6px; top: 18px; width: 12px; height: 12px; border-radius: 999px; background: #cbd5f5; }
.reply-ref { font-size: 12px; font-weight: 700; color: #1d4ed8; text-decoration: none; }
.reply-ref:hover { text-decoration: underline; }
.reply-snippet { font-size: 12px; color: #475569; margin-top: 6px; line-height: 1.4; }
.reply-thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; margin-top: 8px; }
.reply-file-preview { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; }
.reply-file-preview .file-icon { width: 36px; height: 36px; border-radius: 8px; font-size: 11px; }
.reply-file-link { color: #1d4ed8; text-decoration: none; font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-file-link:hover { text-decoration: underline; }
.reply-meta { display: flex; align-items: center; gap: 8px; }
.reply-meta-text { display: flex; align-items: baseline; gap: 8px; }
.reply-meta-text .reply-time { font-size: 11px; color: #94a3b8; }
.message-card { position: relative; }
.message-card.replying { margin-left: 18px; }
.message-card.replying::before { content: ""; position: absolute; left: -18px; top: 16px; width: 12px; height: 2px; background: #cbd5f5; }
.reply-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.reply-avatar { width: 24px; height: 24px; border-radius: 999px; background: #1e3a8a; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.reply-author { font-weight: 700; font-size: 12px; color: #0f172a; }
.reply-time { font-size: 11px; color: #64748b; }
.message-highlight { outline: 2px solid #60a5fa; box-shadow: 0 0 0 4px rgba(96,165,250,0.15); }

.chat-layout { display: block; }
.chat-content { display: flex; flex-direction: column; gap: 16px; }
.chat-header { display: flex; justify-content: space-between; align-items: center; }
.chat-title { font-weight: 700; font-size: 18px; color: #111827; }
.chat-subtitle { font-size: 13px; color: #6b7280; }
.chat-date { text-align: center; padding: 10px 0; font-size: 12px; color: #6b7280; }
.chat-date span { background: #f1f5f9; padding: 4px 10px; border-radius: 999px; }
.reply-thread { margin-left: 48px; border-left: 2px solid #e5e7eb; padding-left: 16px; }
.reply-item .message-avatar { width: 28px; height: 28px; font-size: 10px; }
.mention-dropdown { position: absolute; z-index: 1000; }

@media (max-width: 991px) {
  .chat-layout { display: block; }
}

.password-field-wrapper {
  position: relative;
  width: 100%;
}
.password-field-wrapper .form-control {
  padding-right: 48px;
  width: 100%;
  box-sizing: border-box;
}
.password-toggle-btn {
  border: 0;
  background: #eef2ff;
  color: #1d4ed8;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 0;
}
.password-toggle-btn:hover,
.password-toggle-btn:focus-visible {
  background: #dbeafe;
  outline: 0;
}
.password-toggle-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
}

.lightbox { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 2000; }
.lightbox.open { display: flex; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.75); }
.lightbox-content { position: relative; z-index: 1; max-width: 90vw; max-height: 90vh; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lightbox-content img { max-width: 90vw; max-height: 80vh; border-radius: 12px; box-shadow: 0 24px 60px rgba(0,0,0,0.4); }
.lightbox-actions { display: flex; gap: 10px; }

/* Notifications tray */
.notifications-tray { max-height: 360px; overflow-y: auto; }
.notifications-tray .tray-item { padding: 10px 8px; border-bottom: 1px solid #f3f4f6; }
.notifications-tray .tray-item:last-child { border-bottom: 0; }
.notifications-tray .tray-link { color: inherit; text-decoration: none; display: block; border-radius: 8px; }
.notifications-tray .tray-link:hover { background: #f8fafc; }
.topbar-compact .badge { position: absolute; top: -6px; right: -10px; font-size: 10px; padding: 4px 6px; border-radius: 999px; }







.message-cards-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.dashboard-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.dashboard-hero .hero-actions {
  display: flex;
  gap: 12px;
}
.hero-title {
  max-width: 60%;
}

@media (max-width: 900px) {
  .hero-title {
    max-width: 100%;
  }
  .dashboard-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .message-cards-wrapper {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

@media (max-width: 600px) {
  .message-actions {
    position: static;
  }
  .message-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .message-time {
    font-size: 11px;
  }
  .attachment-thumb {
    height: 100px;
  }
}
