/* ── Dashboard Site Styles ───────────────────────────────────────────────── */

/* ── Design Tokens ─────────────────────────────────────────────────────── */
:root {
  --sidebar-bg: #f1f5f9;
  --sidebar-border: #e2e8f0;
  --sidebar-text: #475569;
  --sidebar-text-hover: #1e293b;
  --sidebar-hover-bg: #f1f5f9;
  --sidebar-muted: #94a3b8;
  --sidebar-active-bg: #f5f3ff;
  --sidebar-active-text: #6d28d9;

  --surface-primary: var(--bs-body-bg, #ffffff);
  --surface-secondary: #f8f9fa;
  --surface-tertiary: #f1f5f9;
  --border-default: #e2e8f0;
  --border-subtle: #f0f0f0;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-table-header: #6c757d;

  --kanban-card-bg: #ffffff;
  --kanban-story-bg: #ffffff;
  --kanban-story-header-bg: #f8f9fa;
  --kanban-story-header-hover: #e9ecef;
  --kanban-col-border: #f0f0f0;
  --kanban-empty-border: #dee2e6;
  --kanban-empty-text: #adb5bd;
  --kanban-drag-bg: #e8f4fd;
  --kanban-drag-forbidden-bg: #fde8e8;
  --kanban-toolbar-gap: 0.5rem;
  --kanban-action-size: 32px;
  --kanban-control-h: 32px;
  --kanban-action-muted: #64748b;
  --kanban-chrome-bg: #f8fafc;
  --kanban-suggested-bg: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  --kanban-suggested-border: #c4b5fd;
  --kanban-suggested-border-hover: #a78bfa;
  --kanban-radius: 8px;
  --kanban-radius-lg: 10px;
  --kanban-pad-x: 12px;
  --kanban-pad-y: 10px;

  --chat-bg: #f8f9fa;
  --chat-msg-bg: #f1f3f5;
  --chat-msg-border: transparent;
  --chat-msg-own-bg: #dbeafe;
  --chat-msg-own-border: color-mix(in srgb, var(--bs-primary, #0d6efd) 22%, transparent);
  --chat-msg-own-fg: #0b2e59;
  --chat-input-bg: #ffffff;
  --chat-author: #1e293b;
  --chat-time: #94a3b8;

  --attachment-bg: #f8f9fa;
  --attachment-border: #e9ecef;
  --attachment-preview-bg: #eeeeee;

  --spinner-overlay-bg: rgba(255, 255, 255, 0.6);
  --progress-bg: #e9ecef;
  --overdue-bg: #fff5f5;

  --login-gradient: linear-gradient(
    135deg,
    #1a1a2e 0%,
    #16213e 50%,
    #0f3460 100%
  );
}

[data-bs-theme="dark"] {
  --sidebar-bg: #1e293b;
  --sidebar-border: #334155;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #e2e8f0;
  --sidebar-hover-bg: #334155;
  --sidebar-muted: #64748b;
  --sidebar-active-bg: #312e81;
  --sidebar-active-text: #a78bfa;

  --surface-primary: var(--bs-body-bg, #212529);
  --surface-secondary: #1e293b;
  --surface-tertiary: #1e293b;
  --border-default: #334155;
  --border-subtle: #2d3748;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-table-header: #94a3b8;

  --kanban-card-bg: #1e293b;
  --kanban-story-bg: #1e293b;
  --kanban-story-header-bg: #0f172a;
  --kanban-story-header-hover: #334155;
  --kanban-col-border: #334155;
  --kanban-empty-border: #334155;
  --kanban-empty-text: #64748b;
  --kanban-drag-bg: #1e3a5f;
  --kanban-drag-forbidden-bg: #3b1f1f;
  --kanban-toolbar-gap: 0.5rem;
  --kanban-action-size: 32px;
  --kanban-control-h: 32px;
  --kanban-action-muted: #94a3b8;
  --kanban-chrome-bg: #0f172a;
  --kanban-suggested-bg: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  --kanban-suggested-border: #6366f1;
  --kanban-suggested-border-hover: #818cf8;
  --kanban-radius: 8px;
  --kanban-radius-lg: 10px;
  --kanban-pad-x: 12px;
  --kanban-pad-y: 10px;

  --chat-bg: #0f172a;
  --chat-msg-bg: #1e293b;
  --chat-msg-border: transparent;
  --chat-msg-own-bg: #1e3a5f;
  --chat-msg-own-border: color-mix(in srgb, var(--bs-primary, #6ea8fe) 35%, transparent);
  --chat-msg-own-fg: #dbeafe;
  --chat-input-bg: #1e293b;
  --chat-author: #e2e8f0;
  --chat-time: #64748b;

  --attachment-bg: #1e293b;
  --attachment-border: #334155;
  --attachment-preview-bg: #0f172a;

  --spinner-overlay-bg: rgba(15, 23, 42, 0.6);
  --progress-bg: #334155;
  --overdue-bg: #3b1f1f;

  --login-gradient: linear-gradient(
    135deg,
    #0f172a 0%,
    #1e293b 50%,
    #1e3a5f 100%
  );
}

/* ── Base ──────────────────────────────────────────────────────────────── */
html,
body {
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  height: 100%;
  margin: 0;
}

/* ── Typography Utilities ──────────────────────────────────────────────── */
.text-xs {
  font-size: 0.75rem !important;
}

.text-2xs {
  font-size: 0.65rem !important;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.dashboard-layout {
  height: 100vh;
  overflow: hidden;
}

.dashboard-sidebar {
  width: 220px;
  min-width: 0;
  min-height: 100vh;
  position: sticky;
  top: 0;
  /* position: sticky creates a stacking context; raise it above the main
     content (Kanban columns/cards are position: relative) so the fixed
     global-search dropdown paints above the board. Kept below modals (1040+). */
  z-index: 1030;
  flex-shrink: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  transition: width 0.2s ease;
}

main {
  overflow-y: auto;
  height: 100vh;
}

/* Chat page: lock viewport height; only the message list scrolls */
main:has(.chat-page) {
  overflow: hidden;
}

main:has(.chat-page) > .p-4 {
  overflow: hidden;
  min-height: 0;
  padding-bottom: 1rem;
}

/* ── Sidebar Collapse ──────────────────────────────────────────────────── */
.sidebar-collapse-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--sidebar-muted);
  transition:
    background-color 0.15s,
    color 0.15s;
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  background-color: var(--sidebar-hover-bg);
  color: var(--sidebar-text-hover);
}

.sidebar-brand-link {
  min-width: 0;
  overflow: hidden;
}

.dashboard-sidebar.sidebar-collapsed {
  width: 60px;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-brand-link {
  display: none;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-collapse-btn {
  margin: 0 auto;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-user-info {
  display: none;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-user-notifications {
  position: relative;
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
  text-align: center;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-user-notifications .nav-link {
  justify-content: center;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-user-notifications .nav-link i {
  margin-right: 0 !important;
  font-size: 1.1rem;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-user-notifications .nav-link .badge {
  position: absolute;
  top: 2px;
  right: 8px;
  font-size: 0.6rem;
  padding: 0.15em 0.4em;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-label {
  display: none;
}

.dashboard-sidebar.sidebar-collapsed .nav-section-header {
  font-size: 0;
  padding: 6px 0;
  text-align: center;
}

.dashboard-sidebar.sidebar-collapsed .nav-section-header::after {
  content: "";
  display: block;
  width: 20px;
  height: 1px;
  background: var(--sidebar-muted);
  margin: 0 auto;
}

.dashboard-sidebar.sidebar-collapsed .dashboard-nav .nav-link {
  text-align: center;
  padding-left: 0 !important;
  padding-right: 0 !important;
  justify-content: center;
}

.dashboard-sidebar.sidebar-collapsed .dashboard-nav .nav-link i {
  margin-right: 0 !important;
  font-size: 1.1rem;
}

.dashboard-sidebar.sidebar-collapsed .dashboard-nav .nav-link span:not(.badge) {
  display: none;
}

.dashboard-sidebar.sidebar-collapsed .dashboard-nav .nav-link .badge {
  position: absolute;
  top: 2px;
  right: 8px;
  font-size: 0.6rem;
  padding: 0.15em 0.4em;
}

.dashboard-sidebar.sidebar-collapsed .dashboard-nav .nav-item {
  position: relative;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-collapse-icon {
  margin: 0;
}

.dashboard-sidebar.sidebar-collapsed .p-3.border-top {
  padding: 0.5rem !important;
}

.dashboard-sidebar.sidebar-collapsed .p-3.border-top .btn {
  padding: 0.4rem;
}

/* ── Page Header ───────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.page-header h4 {
  margin-bottom: 0;
  font-weight: 600;
}

.page-header .page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

/* ── Sidebar Logo ───────────────────────────────────────────────────────── */
.sidebar-logo {
  max-width: 100%;
  height: auto;
  max-height: 60px;
  object-fit: contain;
  transition: opacity 0.15s ease;
}

.sidebar-logo:hover {
  opacity: 0.85;
}

/* ── Sidebar Nav Links ───────────────────────────────────────────────────── */
.dashboard-nav .nav-link,
.sidebar-user-notifications .nav-link {
  color: var(--sidebar-text);
  border-radius: 0;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.dashboard-nav .nav-link:hover,
.sidebar-user-notifications .nav-link:hover {
  background-color: var(--sidebar-hover-bg);
  color: var(--sidebar-text-hover);
}

.dashboard-nav .nav-link.active,
.sidebar-user-notifications .nav-link.active {
  background-color: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

/* ── Sidebar Section Headers ─────────────────────────────────────────────── */
.nav-section-header {
  color: var(--sidebar-muted);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 12px 16px 4px;
  list-style: none;
}

/* ── Sidebar Nav Icon Colours ────────────────────────────────────────────── */
.nav-icon-monitoring {
  color: #f97316;
}
.nav-icon-work {
  color: #7c3aed;
}
.nav-icon-admin {
  color: #3b82f6;
}
.nav-icon-account {
  color: #0d9488;
}

.dashboard-nav .nav-link.active .nav-icon-monitoring,
.dashboard-nav .nav-link.active .nav-icon-work,
.dashboard-nav .nav-link.active .nav-icon-admin,
.dashboard-nav .nav-link.active .nav-icon-account,
.sidebar-user-notifications .nav-link.active .nav-icon-account {
  color: var(--sidebar-active-text);
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  border-radius: 8px;
}

.dashboard-card {
  border: 0;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  transition: box-shadow 0.15s ease;
}

.overview-card {
  cursor: pointer;
  transition:
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.overview-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-table-header);
}

/* ── Blazor Error UI ─────────────────────────────────────────────────────── */
#blazor-error-ui {
  background: #fef2f2;
  border: 1px solid #f87171;
  border-radius: 4px;
  padding: 12px 16px;
  font-size: 14px;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  float: right;
}

/* ── Progress bars ────────────────────────────────────────────────────── */
.progress {
  border-radius: 4px;
  background-color: var(--progress-bg);
}

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-wrapper {
  background: var(--login-gradient);
}

/* ── Spinner overlay ─────────────────────────────────────────────────────── */
.dashboard-spinner-overlay {
  position: absolute;
  inset: 0;
  background: var(--spinner-overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}

/* ── Severity badge sizes ────────────────────────────────────────────────── */
.badge {
  font-size: 0.72rem;
  padding: 0.3em 0.55em;
}

/* ── Kanban Board ───────────────────────────────────────────────────────── */

/* Page chrome */
.kanban-page-chrome {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.kanban-context-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: var(--kanban-chrome-bg);
  border: 1px solid var(--border-default);
  border-radius: 10px;
}

/* Each context cluster is a full-width row (board row, sprint row) */
.kanban-context-bar > .kanban-context-cluster {
  width: 100%;
}

/* Board + sprint selects share one width so they line up when stacked */
.kanban-context-select {
  width: 260px;
  max-width: 100%;
}

.min-width-0 {
  min-width: 0 !important;
}

/* One consistent control height across the whole chrome */
.kanban-context-bar .btn,
.kanban-view-bar .btn {
  display: inline-flex;
  align-items: center;
  height: var(--kanban-control-h);
}

.kanban-context-bar .form-select,
.kanban-view-bar .form-select,
.kanban-context-bar .form-control,
.kanban-view-bar .form-control,
.kanban-context-bar .input-group-text,
.kanban-view-bar .input-group-text {
  height: var(--kanban-control-h);
}

.kanban-toolbar-primary {
  margin-left: auto;
}

.kanban-context-cluster {
  display: flex;
  align-items: center;
  gap: var(--kanban-toolbar-gap);
  flex-wrap: wrap;
  min-width: 0;
}

.kanban-context-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-right: 0.15rem;
}

.kanban-sprint-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 0.15rem;
}

.kanban-view-bar {
  display: flex;
  align-items: center;
  gap: var(--kanban-toolbar-gap);
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-default);
}

.kanban-view-bar .nav-tabs {
  border-bottom: none;
  flex-wrap: wrap;
}

.kanban-view-controls {
  display: flex;
  align-items: center;
  gap: var(--kanban-toolbar-gap);
  flex-wrap: wrap;
  margin-left: auto;
}

.kanban-filter-switches {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.kanban-layout-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.kanban-search {
  width: auto;
  min-width: 160px;
  max-width: 240px;
}

.kanban-toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--kanban-toolbar-gap);
}

.kanban-capacity-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: var(--kanban-control-h);
  padding: 0 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: var(--surface-primary);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.kanban-capacity-pill .bi {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.kanban-capacity-pill.is-over {
  border-color: rgba(220, 53, 69, 0.5);
  color: #dc3545;
}

.kanban-capacity-pill.is-over .bi {
  color: #dc3545;
}

/* Transparent full-screen catcher that closes open toolbar menus */
.kanban-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1040;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: default;
}

.kanban-menu-anchor {
  position: relative;
}

.kanban-menu-anchor .dropdown-menu.show {
  z-index: 1050;
}

/* View options popover */
.kanban-view-menu {
  min-width: 260px;
  max-width: min(92vw, 320px);
  padding: 0.5rem 0.75rem 0.75rem;
  /* Manual toggle has no data-bs-popper, so right-align it ourselves */
  right: 0;
  left: auto;
}

.kanban-view-menu .form-select {
  max-width: 100%;
}

.kanban-view-menu-section + .kanban-view-menu-section {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-default);
}

.kanban-view-menu-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.kanban-sprint-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: var(--surface-primary);
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.2;
  cursor: pointer;
}

.kanban-sprint-chip:hover {
  background: var(--kanban-story-header-hover);
  color: var(--text-primary);
}

.kanban-sprint-chip strong {
  color: var(--text-primary);
  font-weight: 600;
}

.kanban-icon-btn {
  width: var(--kanban-action-size);
  height: var(--kanban-action-size);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--kanban-action-muted);
  line-height: 1;
  text-decoration: none;
}

.kanban-icon-btn:hover {
  background: var(--kanban-story-header-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.kanban-icon-btn.is-active {
  background: var(--bs-secondary-bg, #e9ecef);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.kanban-story-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  margin-left: auto;
}

.kanban-story-actions .btn-sm {
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.2;
}

.kanban-story-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  min-width: 0;
}

.kanban-story-assignees {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  max-width: 9rem;
  overflow: hidden;
}

.kanban-board-table {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kanban-story-card {
  border: 1px solid var(--border-default);
  border-radius: var(--kanban-radius-lg);
  background: var(--kanban-story-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.kanban-story-card.kanban-story-drop-hint {
  border-color: #0dcaf0;
  box-shadow: 0 0 0 2px rgba(13, 202, 240, 0.3);
}

.kanban-story-card-muted {
  border-style: dashed;
}

.kanban-story-drag-handle {
  cursor: grab;
  color: var(--bs-secondary-color);
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
  user-select: none;
}

.kanban-story-drag-handle:active {
  cursor: grabbing;
}

.kanban-story-reorder-zone {
  min-height: 6px;
  margin: 0 0 2px;
}

.kanban-story-reorder-zone.kanban-drop-zone-active {
  min-height: 28px;
  margin-bottom: 6px;
}

.kanban-story-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: var(--kanban-story-header-bg);
  border-bottom: 1px solid var(--border-default);
  border-radius: var(--kanban-radius-lg) var(--kanban-radius-lg) 0 0;
  cursor: pointer;
  user-select: none;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.kanban-story-header .kanban-story-actions {
  flex-shrink: 0;
}

.kanban-story-header:hover {
  background: var(--kanban-story-header-hover);
}

.kanban-story-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-story-tasks-scroll {
  max-height: min(65vh, 560px);
  overflow: auto;
  scrollbar-gutter: stable;
}

.kanban-story-tasks-scroll-expanded {
  max-height: none;
  overflow-y: visible;
}

.kanban-story-columns-outer {
  width: 100%;
}

.kanban-story-columns {
  display: flex;
  gap: 0;
  width: 100%;
}

.kanban-story-column {
  flex: 1 1 0;
  min-width: 0;
  border-right: 1px solid var(--kanban-col-border);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* When JS sets an explicit width, suppress flex growth */
.kanban-story-column[style*="width"] {
  flex: 0 0 auto !important;
  min-width: 160px;
}

.kanban-col-resize-handle {
  position: absolute;
  top: 0;
  left: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
  background: transparent;
  transition: background-color 0.15s;
}

.kanban-col-resize-handle:hover,
.kanban-col-resize-handle.resizing {
  background-color: rgba(var(--bs-primary-rgb), 0.25);
}

.kanban-story-column:last-child {
  border-right: none;
}

.kanban-story-col-header {
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 0;
  position: sticky;
  top: 0;
  z-index: 3;
  flex-shrink: 0;
  background: var(--kanban-story-header-bg);
  border-bottom: 1px solid var(--border-default);
}

.kanban-col-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.kanban-col-label {
  color: var(--text-primary);
}

.kanban-count {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
  padding: 0.15em 0.45em;
  border-radius: 6px;
  background: rgba(var(--bs-body-color-rgb, 0, 0, 0), 0.06);
}

.bg-purple {
  background-color: #6f42c1 !important;
}

.bg-orange {
  background-color: #fd7e14 !important;
  color: #fff;
}

.kanban-story-col-body {
  padding: 8px;
  min-height: 60px;
  flex: 1;
  transition: background-color 0.15s ease;
}

.kanban-story-column.drag-over > .kanban-story-col-body {
  background-color: var(--kanban-drag-bg);
  outline: 2px dashed #0d6efd;
  outline-offset: -4px;
  border-radius: 0 0 4px 4px;
}

.kanban-story-column.drag-over-forbidden > .kanban-story-col-body {
  background-color: var(--kanban-drag-forbidden-bg);
  outline: 2px dashed #dc3545;
  outline-offset: -4px;
  border-radius: 0 0 4px 4px;
  cursor: not-allowed;
}

.kanban-card-drop-top,
.kanban-card-drop-bottom {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  z-index: 2;
}

.kanban-card-drop-top {
  top: 0;
}

.kanban-card-drop-bottom {
  bottom: 0;
}

.kanban-card-drop-before {
  margin-top: 10px;
  box-shadow: 0 -5px 0 0 var(--bs-primary);
  transition: margin 0.15s ease;
}

.kanban-card-drop-after {
  margin-bottom: 10px;
  box-shadow: 0 5px 0 0 var(--bs-primary);
  transition: margin 0.15s ease;
}

.kanban-drop-zone {
  height: 4px;
  transition:
    height 0.2s ease,
    margin 0.2s ease,
    background-color 0.15s ease;
  border-radius: 3px;
  margin: 0 2px;
}

.kanban-drop-zone-end {
  min-height: 20px;
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    min-height 0.2s ease,
    background-color 0.15s ease;
}

.kanban-drop-zone-active {
  height: 40px;
  margin: 4px 2px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(var(--bs-primary-rgb), 0.15) 35%,
    var(--bs-primary) 48%,
    var(--bs-primary) 52%,
    rgba(var(--bs-primary-rgb), 0.15) 65%,
    transparent 100%
  );
  border-radius: 4px;
}

.kanban-drop-zone-end.kanban-drop-zone-active {
  min-height: 40px;
  background-color: rgba(var(--bs-primary-rgb), 0.08);
  border: 2px dashed var(--bs-primary);
  border-radius: 6px;
}

.kanban-col-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px dashed var(--kanban-empty-border);
  border-radius: 6px;
  color: var(--kanban-empty-text);
  font-size: 0.72rem;
  user-select: none;
}

.kanban-story-progress {
  width: 60px;
  height: 5px;
  background: var(--progress-bg);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}

.kanban-story-progress-fill {
  height: 100%;
  background: #198754;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.kanban-add-btn {
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.7;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--kanban-action-muted);
}

.kanban-add-btn:hover {
  opacity: 1;
  color: var(--kanban-action-muted);
  background-color: rgba(var(--bs-body-color-rgb, 0, 0, 0), 0.08);
}

/* Task cards */
.kanban-card {
  cursor: grab;
  transition:
    box-shadow 0.15s ease,
    transform 0.1s ease,
    border-color 0.15s ease;
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--border-default);
  border-radius: var(--kanban-radius);
  background: var(--kanban-card-bg);
}

.kanban-card.kanban-card-todo {
  border-left-color: #0d6efd;
}
.kanban-card.kanban-card-inprogress {
  border-left-color: #0dcaf0;
}
.kanban-card.kanban-card-review {
  border-left-color: #ffc107;
}
.kanban-card.kanban-card-instaging {
  border-left-color: #6f42c1;
}
.kanban-card.kanban-card-inproduction {
  border-left-color: #198754;
}
.kanban-card.kanban-card-backlog {
  border-left-color: #6c757d;
}

.kanban-card:active {
  cursor: grabbing;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transform: rotate(0.5deg);
}

.kanban-card:hover {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.kanban-card .card-body {
  padding: var(--kanban-pad-y) var(--kanban-pad-x);
}

/* Shared single-line truncation for normal and compact task card titles */
.kanban-card-title-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}

.kanban-card-compact-row1 .kanban-card-title-text {
  font-weight: 500;
  line-height: 1.2;
}

.kanban-card-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bs-secondary-bg);
  color: var(--bs-body-color);
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid var(--border-default);
}

.kanban-card-avatar-primary {
  background: #ffc107;
  color: #000;
  border-color: #e6ac00;
}

.kanban-card.kanban-card-overdue {
  border-color: rgba(220, 53, 69, 0.4);
  border-left-color: #dc3545;
  background: var(--overdue-bg);
}

.kanban-card.kanban-card-suggested {
  border-color: var(--kanban-suggested-border);
  border-style: dashed;
  background: var(--kanban-suggested-bg);
  opacity: 0.85;
  cursor: default;
}

.kanban-card.kanban-card-suggested:hover {
  border-color: var(--kanban-suggested-border-hover);
  opacity: 0.95;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.12);
}

/* ── Compact Card Mode ──────────────────────────────────────────────────── */
.kanban-card.kanban-card-compact {
  border-width: 0 0 0 3px;
  border-radius: var(--kanban-radius);
  margin-bottom: 4px !important;
}

.kanban-card-compact-body {
  padding: 5px 8px !important;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.kanban-card-compact-row1 {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.kanban-card-compact-type-icon {
  flex-shrink: 0;
  font-size: 0.68rem;
  color: var(--bs-secondary-color);
}

.kanban-card-compact-row2 {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.kanban-card-compact-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
  font-size: 0.6rem;
  font-weight: 600;
  flex-shrink: 0;
  border: 1px solid var(--bs-border-color);
}

.kanban-card-compact-due {
  font-size: 0.68rem;
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
}

.kanban-card.kanban-card-compact.kanban-card-suggested {
  border-style: dashed;
}

.kanban-card.kanban-card-compact.kanban-card-overdue {
  border-color: #dc3545;
}

/* Backlog */
.backlog-card-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 900px;
}

.backlog-story-card {
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--bs-body-bg);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.backlog-story-card:hover {
  border-color: var(--bs-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.backlog-row:hover {
  background-color: var(--surface-secondary);
}

/* ── Code Review Cards ──────────────────────────────────────────────────── */
.review-card {
  transition: box-shadow 0.15s ease;
}

.review-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.review-code-block {
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}

.kanban-card-recently-viewed {
  border-left: 3px solid var(--bs-success) !important;
}

.work-item-description {
  min-height: 120px;
  max-height: 420px;
  field-sizing: content;
  resize: vertical;
}

.work-item-nav-panel {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1055;
  background: var(--bs-modal-bg, #fff);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.work-item-nav-panel-left {
  border-radius: 0.5rem 0 0 0.5rem;
  right: min(calc(50% + var(--wi-dialog-width) / 2 + 8px), calc(100% - 56px));
}

.work-item-nav-panel-right {
  border-radius: 0 0.5rem 0.5rem 0;
  left: min(calc(50% + var(--wi-dialog-width) / 2 + 8px), calc(100% - 56px));
}

.work-item-nav-btn-side {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.work-item-nav-btn-side:hover:not(:disabled) {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  color: #fff;
}

.work-item-nav-btn-side:disabled {
  opacity: 0.25;
  cursor: default;
}

@media (max-width: 768px) {
  .work-item-nav-panel {
    display: none;
  }
}

.responsible-toggle {
  background: none;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s;
}

.responsible-toggle:hover {
  color: #ffc107 !important;
}

/* ── Dependency Status Dots ───────────────────────────────────────────── */
.dependency-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-backlog {
  background-color: #6c757d;
}
.status-todo {
  background-color: #0d6efd;
}
.status-inprogress {
  background-color: #0dcaf0;
}
.status-review {
  background-color: #ffc107;
}
.status-instaging {
  background-color: #6f42c1;
}
.status-inproduction {
  background-color: #198754;
}

/* ── Work Item Modal Shell ────────────────────────────────────────────── */
.work-item-modal-shell {
  --wi-dialog-width: min(96vw, var(--wi-modal-width, 1020px));
  height: 100vh;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.work-item-modal-dialog {
  width: var(--wi-dialog-width);
  max-width: none;
  height: 100%;
  display: flex;
  align-items: center;
  transition: width 0.18s ease;
}

.work-item-modal-content {
  width: 100%;
  height: min(90vh, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border-default);
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.25);
}

.work-item-modal-content > .modal-header,
.work-item-modal-content > .modal-footer,
.work-item-modal-content > .work-item-modal-error,
.work-item-modal-content > .scrum-modal-banner {
  flex: 0 0 auto;
}

.work-item-modal-content > .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.work-item-modal-header {
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-default);
}

.work-item-modal-footer {
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-default);
}

.work-item-modal-error {
  margin: 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

.work-item-type-chip,
.work-item-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border-default);
  background: var(--bs-tertiary-bg, var(--bs-secondary-bg));
  color: var(--text-secondary);
  white-space: nowrap;
}

.work-item-dirty-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Work Item Modal Body Columns ─────────────────────────────────────── */
.work-item-modal-split {
  height: 100%;
  min-height: 0;
  align-items: stretch;
}

.work-item-main-col {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.work-item-props-col {
  flex: 0 0 268px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 16px 22px;
  border-left: 1px solid var(--border-default);
  background: var(--bs-tertiary-bg, var(--bs-secondary-bg));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Keep sections at their natural height so a long description scrolls the column
   instead of squashing its siblings. */
.work-item-main-col > *,
.work-item-props-col > * {
  flex: 0 0 auto;
}

.work-item-title-input {
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 8px;
  background: transparent;
  box-shadow: none !important;
}

.work-item-title-input:hover {
  border-color: var(--border-default);
}

.work-item-title-input:focus {
  border-color: var(--bs-primary);
  background: var(--bs-body-bg);
}

.work-item-title-input::placeholder {
  color: var(--text-muted);
  font-weight: 500;
}

.work-item-prop-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.work-item-prop-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

.work-item-field-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* ── Work Item Collapsible Sections ───────────────────────────────────── */
.work-item-section {
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--bs-body-bg);
  overflow: hidden;
}

.work-item-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: none;
  border: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
}

.work-item-section-header:hover {
  background: var(--bs-tertiary-bg, var(--bs-secondary-bg));
}

.work-item-section-chevron {
  font-size: 0.72rem;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.work-item-section.is-open .work-item-section-chevron {
  transform: rotate(90deg);
}

.work-item-section-body {
  padding: 0 12px 12px;
}

.work-item-chat-col {
  flex: 0 0 336px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-default);
  padding: 14px 14px 16px;
  min-width: 0;
  min-height: 0;
}

.work-item-time-col {
  flex: 0 0 292px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-default);
  padding: 14px 14px 16px;
  min-width: 0;
  min-height: 0;
}

.work-item-time-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.work-item-time-timer {
  font-size: 0.95rem;
  padding: 0.35rem 0.55rem;
  border-radius: 0.375rem;
  background: var(--bs-tertiary-bg, var(--bs-secondary-bg));
}

.work-item-time-timer.is-running {
  color: var(--bs-success);
}

.work-item-time-timer.is-paused {
  color: var(--bs-warning-text-emphasis, var(--bs-warning));
}

.work-item-time-form {
  border: 1px solid var(--border-default);
  border-radius: 0.5rem;
  padding: 0.65rem;
  background: var(--bs-tertiary-bg, var(--bs-secondary-bg));
}

.work-item-time-empty {
  padding: 1.25rem 0.5rem;
  text-align: center;
}

.work-item-time-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 2px;
}

.work-item-time-entry {
  border: 1px solid var(--border-default);
  border-radius: 0.5rem;
  padding: 0.5rem 0.55rem;
  background: var(--bs-body-bg);
}

@media (max-width: 1400px) {
  .work-item-props-col {
    flex-basis: 240px;
  }

  .work-item-time-col {
    flex-basis: 262px;
  }

  .work-item-chat-col {
    flex-basis: 300px;
  }
}

@media (max-width: 1100px) {
  .work-item-modal-split {
    flex-direction: column;
    overflow-y: auto;
  }

  .work-item-main-col,
  .work-item-props-col,
  .work-item-time-col,
  .work-item-chat-col {
    flex: 0 0 auto;
    width: 100%;
    overflow: visible;
    border-left: 0;
    border-right: 0;
  }

  .work-item-main-col {
    order: 1;
  }

  .work-item-props-col {
    order: 2;
    border-top: 1px solid var(--border-default);
  }

  .work-item-time-col {
    order: 3;
    border-top: 1px solid var(--border-default);
  }

  .work-item-chat-col {
    order: 4;
    border-top: 1px solid var(--border-default);
    min-height: 360px;
  }

  .work-item-time-list {
    max-height: 260px;
    overflow-y: auto;
  }
}

/* ── Work Item Chat / Comments ────────────────────────────────────────── */
.work-item-chat {
  border: 1px solid var(--chat-msg-border);
  border-radius: 8px;
  background: var(--chat-bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.work-item-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-message {
  background: var(--chat-msg-bg);
  border: 1px solid var(--chat-msg-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.84rem;
}

.chat-room-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.chat-room-layout > .chat-room-panel {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}

.chat-message-search-sidepanel {
  display: flex;
  flex-direction: column;
  flex: 0 0 20rem;
  width: 20rem;
  max-width: 40%;
  min-width: 16rem;
  min-height: 0;
  align-self: stretch;
  border-left: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
}

.chat-message-search-sidepanel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--bs-border-color);
  flex-shrink: 0;
}

.chat-message-search-close {
  line-height: 1;
  font-size: 1rem;
}

.chat-message-search-sidepanel-input {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--bs-border-color);
  flex-shrink: 0;
}

.chat-message-search-sidepanel-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.chat-message-search-empty {
  padding: 1rem 0.25rem;
  text-align: center;
}

.chat-message-search-cards {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.chat-message-search-card {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  background: var(--bs-tertiary-bg);
  padding: 0.7rem 0.8rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.chat-message-search-card:hover,
.chat-message-search-card:focus-visible {
  border-color: var(--bs-primary);
  background: var(--bs-body-bg);
  outline: none;
}

.chat-message-search-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.chat-message-search-card-author {
  font-weight: 600;
  font-size: 0.82rem;
}

.chat-message-search-card-time {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--bs-secondary-color);
}

.chat-message-search-card-snippet {
  font-size: 0.84rem;
  color: var(--bs-body-color);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-message-search-sidepanel-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.35rem;
  margin-top: auto;
}

@media (max-width: 991.98px) {
  .chat-message-search-sidepanel {
    position: absolute;
    inset: 0;
    z-index: 20;
    width: 100%;
    max-width: none;
    min-width: 0;
    flex-basis: auto;
    border-left: 0;
  }

  .chat-room-layout {
    position: relative;
  }
}

.chat-message.chat-message-own {
  background: var(--chat-msg-own-bg);
  border-color: var(--chat-msg-own-border);
}

.chat-author {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--chat-author);
}

.chat-time {
  font-size: 0.7rem;
  color: var(--chat-time);
  margin-left: 6px;
}

.chat-content {
  margin-top: 2px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

.chat-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.chat-message:hover .chat-actions {
  opacity: 1;
}

.activity-entry {
  padding: 8px 10px;
  border-bottom: 1px solid var(--chat-msg-border, #e9ecef);
  font-size: 0.84rem;
}

.activity-entry:last-child {
  border-bottom: none;
}

.chat-input-row {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--chat-msg-border);
  background: var(--chat-input-bg);
}

/* ── Work Item Attachments ─────────────────────────────────────────────── */
.attachment-drop-zone {
  position: relative;
  border: 2px dashed var(--border-default);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  transition:
    border-color 0.2s,
    background 0.2s;
  cursor: pointer;
}

.attachment-drop-zone:hover,
.attachment-drop-zone.drag-over {
  border-color: #0d6efd;
  background: var(--kanban-drag-bg);
}

.attachment-drop-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.attachment-drop-text i {
  font-size: 1.5rem;
}

.attachment-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.attachment-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.attachment-item {
  position: relative;
  border: 1px solid var(--attachment-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--attachment-bg);
  display: flex;
  flex-direction: column;
  width: 140px;
  flex-shrink: 0;
}

.attachment-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 90px;
  overflow: hidden;
  background: var(--attachment-preview-bg);
  text-decoration: none;
  color: var(--text-muted);
}

.attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-preview.attachment-video {
  background: #1a1a2e;
  color: #fff;
}

.attachment-preview.attachment-video i {
  font-size: 2rem;
  opacity: 0.8;
}

.attachment-preview.attachment-file i {
  font-size: 2rem;
}

.attachment-info {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.attachment-name {
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-size {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.attachment-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.attachment-actions a,
.attachment-actions button {
  background: var(--surface-primary);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.attachment-item:hover .attachment-actions {
  opacity: 1;
}

/* ── Attachment Lightbox ──────────────────────────────────────────────── */
.attachment-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.attachment-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.attachment-lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
}

.attachment-lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  z-index: 2001;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attachment-lightbox-filename {
  margin-top: 10px;
  color: #fff;
  font-size: 0.85rem;
  text-align: center;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Global Search ────────────────────────────────────────────────────── */
.search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1055;
  background: transparent;
}

.search-results {
  z-index: 1060;
  max-height: 400px;
  overflow-y: auto;
  background: var(--surface-primary);
  border: 1px solid var(--border-default);
  border-radius: 0.375rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  isolation: isolate;
}

.search-results .search-results-section {
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  pointer-events: none;
  background: var(--surface-secondary);
  border-bottom: none;
  padding-top: 0.5rem;
  padding-bottom: 0.25rem;
}

.global-search .form-control:focus,
.global-search .input-group-text {
  box-shadow: none;
  border-color: var(--border-default);
}

/* ── Utilities ────────────────────────────────────────────────────────── */
.cursor-pointer {
  cursor: pointer;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
.global-search {
  width: 100%;
}

@media (max-width: 767.98px) {
  .dashboard-sidebar.sidebar-mobile-open {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    width: 220px !important;
  }

  .dashboard-sidebar.sidebar-collapsed {
    width: 220px;
  }

  .sidebar-collapse-btn {
    display: none;
  }
}

@media (max-width: 768px) {
  .global-search {
    width: 200px !important;
  }

  .kanban-story-tasks-scroll {
    overflow-x: auto;
  }
}

@media (max-width: 576px) {
  .global-search {
    width: 160px !important;
  }
}

/* Chat message hover actions — floating toolbar on the bubble */
.chat-message-bubble-wrap {
  position: relative;
  display: block;
  width: max-content;
  max-width: 100%;
}

.chat-msg-actions {
  position: absolute;
  top: -0.55rem;
  /* Outer/center-facing edge of the bubble */
  inset-inline-end: 0.35rem;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 0.05rem;
  padding: 0.1rem 0.2rem;
  border-radius: 0.5rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color-translucent, var(--bs-border-color));
  box-shadow: var(--bs-box-shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.chat-msg-action-btn {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.35rem;
  text-decoration: none !important;
}

.chat-msg-action-btn:hover,
.chat-msg-action-btn:focus-visible {
  background: var(--bs-secondary-bg);
}

@media (hover: hover) and (pointer: fine) {
  .chat-message-row:hover .chat-msg-actions,
  .chat-message-row:focus-within .chat-msg-actions,
  .chat-message-row-actions-open .chat-msg-actions {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Touch / coarse pointers: keep actions reachable without hover */
@media (hover: none), (pointer: coarse) {
  .chat-msg-actions {
    opacity: 1;
    pointer-events: auto;
  }
}

.chat-emoji-picker {
  position: absolute;
  bottom: calc(100% + 0.3rem);
  inset-inline-end: 0;
  z-index: 1080;
  max-width: 220px;
  background: var(--bs-body-bg);
}

.chat-reaction-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
  max-width: min(85vw, 36rem);
}

.chat-reaction-row-own {
  justify-content: flex-end;
  margin-inline-start: auto;
}

.chat-reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-size: 0.78rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.chat-reaction-pill:hover,
.chat-reaction-pill:focus-visible {
  background: var(--bs-secondary-bg);
  border-color: var(--bs-primary);
}

.chat-reaction-pill.is-active {
  border-color: var(--bs-primary);
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary-text-emphasis, var(--bs-body-color));
}

.chat-reaction-emoji {
  font-size: 0.95rem;
  line-height: 1;
}

.chat-reaction-count {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--bs-secondary-color);
}

.chat-reaction-pill.is-active .chat-reaction-count {
  color: inherit;
}

.chat-presentation-mode .chat-msg-actions,
.chat-presentation-mode .chat-emoji-picker {
  display: none !important;
}

/* Author glanceability — avatar + grouped runs */
.chat-message-row {
  margin-bottom: 0.7rem;
}

.chat-message-row-continuation {
  margin-bottom: 0.22rem;
}

.chat-message-cluster {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  /* Hug bubble width so absolute actions aren't relative to the full pane */
  width: max-content;
  max-width: min(88%, 42rem);
}

.chat-message-row-own .chat-message-cluster {
  flex-direction: row-reverse;
  margin-inline-start: auto;
  margin-inline-end: 0.15rem;
}

.chat-message-row:not(.chat-message-row-own) .chat-message-cluster {
  margin-inline-end: auto;
  margin-inline-start: 0.15rem;
}

.chat-author-avatar-col {
  flex: 0 0 2rem;
  width: 2rem;
  min-height: 2rem;
}

.chat-author-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
  background: hsl(var(--chat-author-hue, 210) 52% 42%);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.chat-author-avatar-spacer {
  display: block;
  width: 2rem;
  height: 0.25rem;
}

.chat-message-main {
  flex: 0 1 auto;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.chat-message-row-own .chat-message-main {
  align-items: flex-end;
}

.chat-message-meta {
  width: max-content;
  max-width: 100%;
  margin-bottom: 0.15rem;
  padding-inline: 0.15rem;
}

.chat-message-row-own .chat-message-meta {
  justify-content: flex-end;
}

/* Keep receipt next to the name on own messages (ms-auto would shove the name left). */
.chat-message-row-own .chat-message-meta .chat-receipt-indicator {
  margin-inline-start: 0.35rem !important;
}

.chat-author-name {
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.2;
  color: hsl(var(--chat-author-hue, 210) 55% 34%);
}

[data-bs-theme="dark"] .chat-author-name {
  color: hsl(var(--chat-author-hue, 210) 62% 72%);
}

.chat-message-bubble {
  max-width: min(78vw, 34rem);
  width: fit-content;
  padding: 0.45rem 0.75rem;
  border: 1px solid transparent;
  box-shadow: none;
  line-height: 1.4;
}

.chat-message-bubble-other {
  background: var(--chat-msg-bg);
  border-color: var(--chat-msg-border);
  color: var(--bs-body-color);
  border-radius: 1rem 1rem 1rem 0.35rem;
}

.chat-message-bubble-own {
  background: var(--chat-msg-own-bg);
  border-color: var(--chat-msg-own-border);
  color: var(--chat-msg-own-fg, var(--bs-body-color));
  border-radius: 1rem 1rem 0.35rem 1rem;
}

.chat-message-row-own .chat-message-bubble {
  margin-inline-start: 0;
}

.chat-message-meta-continuation .chat-message-time-hover {
  opacity: 0;
  transition: opacity 0.15s;
  font-variant-numeric: tabular-nums;
}

.chat-message-row-continuation:hover .chat-message-time-hover,
.chat-message-row-continuation:focus-within .chat-message-time-hover {
  opacity: 1;
}

.activity-log-entry a {
  color: var(--bs-link-color);
  text-decoration: underline;
}

.activity-log-entry a:hover {
  color: var(--bs-link-hover-color);
}

/* ── Time Tracker Widget ─────────────────────────────────────────────────── */

.time-tracker-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1050;
}

.ttw-fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--bs-primary, #0d6efd);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  position: relative;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}

.ttw-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.time-tracker-widget.has-active .ttw-fab {
  background: var(--bs-success, #198754);
  animation: ttw-glow 2s ease-in-out infinite;
}

.time-tracker-widget.is-paused .ttw-fab {
  background: var(--bs-warning, #ffc107);
  color: #212529;
  animation: none;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.45);
}

.ttw-fab-time {
  font-size: 0.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.ttw-fab-pulse {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dc3545;
  animation: ttw-pulse 1.2s ease-in-out infinite;
}

.ttw-fab-paused-mark {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  line-height: 1;
}

@keyframes ttw-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.3);
  }
}

@keyframes ttw-glow {
  0%,
  100% {
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.3);
  }
  50% {
    box-shadow: 0 4px 20px rgba(25, 135, 84, 0.6);
  }
}

.ttw-panel {
  width: 320px;
  max-height: 530px;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: ttw-slide-up 0.2s ease-out;
}

@keyframes ttw-slide-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ttw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

.ttw-active {
  padding: 10px 14px;
  background: var(--bs-success-bg-subtle, #d1e7dd);
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

.time-tracker-widget.is-paused .ttw-active {
  background: var(--bs-warning-bg-subtle, #fff3cd);
}

.ttw-active-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: inherit;
}

a.ttw-active-title:hover {
  text-decoration: underline !important;
}

.ttw-active-time {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--bs-success, #198754);
}

.ttw-tasks {
  overflow-y: auto;
  max-height: 380px;
  padding: 6px 0;
}

.ttw-task-item {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  gap: 8px;
  transition: background 0.1s;
}

.ttw-task-item:hover {
  background: var(--bs-tertiary-bg, #f8f9fa);
}

.ttw-task-item.active {
  background: var(--bs-success-bg-subtle, #d1e7dd);
}

.ttw-task-title {
  flex: 1;
  font-size: 0.8rem;
  min-width: 0;
}

.ttw-task-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.ttw-divider {
  padding: 4px 14px 2px;
  border-top: 1px solid var(--border-default, #dee2e6);
  margin-top: 4px;
}

/* ── Scrum Mode ──────────────────────────────────────────────────────────── */

.scrum-end-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.scrum-end-time {
  font-size: 3.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  margin-bottom: 8px;
}

.scrum-end-time.fast {
  color: var(--bs-success, #198754);
}

.scrum-end-time.slow {
  color: var(--bs-warning, #ffc107);
}

.scrum-end-screen.animating .scrum-end-time.fast {
  color: #4ade80;
  text-shadow: 0 2px 8px rgba(74, 222, 128, 0.4);
}

.scrum-end-screen.animating .scrum-end-time.slow {
  color: #fbbf24;
  text-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
}

.scrum-end-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 16px;
  margin-bottom: 32px;
}

.scrum-end-stat {
  text-align: center;
  min-width: 70px;
}

.scrum-end-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.scrum-end-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.scrum-end-screen.animating .scrum-end-stat-value {
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.scrum-end-screen.animating .scrum-end-stat-label {
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.scrum-animation-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.scrum-end-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.scrum-end-message {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.scrum-end-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.scrum-end-screen.animating .scrum-end-message {
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.scrum-end-screen.animating .scrum-end-subtitle {
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.scrum-modal-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 600;
  border-radius: 6px 6px 0 0;
}

.scrum-modal-banner-title {
  font-size: 1rem;
}

.scrum-modal-banner-timer {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

[data-bs-theme="dark"] .scrum-modal-banner {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
}

/* ── To Do Page ─────────────────────────────────────────────────────────── */

.todo-page {
  height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
}

.todo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0 0.75rem;
}

.todo-header-icon {
  font-size: 1.5rem;
  color: var(--sidebar-active-text, #6d28d9);
}

.todo-layout {
  flex: 1;
  display: flex;
  gap: 0;
  min-height: 0;
  border: 1px solid var(--border-default);
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--surface-primary);
}

.todo-sidebar {
  width: 240px;
  min-width: 240px;
  padding: 0.75rem 0.5rem;
  border-right: 1px solid var(--border-default);
  background: var(--surface-secondary);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.todo-list-btn {
  display: flex;
  align-items: center;
  width: 100%;
  border: none;
  background: none;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}

.todo-list-btn:hover {
  background: var(--sidebar-hover-bg);
}

.todo-list-btn.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.todo-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0;
}

.todo-add-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
}

.todo-add-icon {
  border: none;
  background: none;
  color: var(--sidebar-active-text);
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
}

.todo-add-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.9rem;
  color: var(--text-primary);
  padding: 0.25rem 0;
}

.todo-add-input::placeholder {
  color: var(--text-muted);
}

.todo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 3rem;
  color: var(--text-secondary);
}

.todo-empty-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  opacity: 0.5;
}

.todo-list {
  display: flex;
  flex-direction: column;
}

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  cursor: default;
  transition: background 0.1s;
}

.todo-item:hover {
  background: var(--surface-secondary);
}

.todo-item.selected {
  background: var(--sidebar-active-bg);
}

.todo-item.completed .todo-item-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-check {
  border: none;
  background: none;
  padding: 0.125rem;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.05rem;
  transition: color 0.15s;
}

.todo-check:hover {
  color: var(--sidebar-active-text);
}

.todo-check.done {
  color: var(--sidebar-active-text);
}

.todo-item-content {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.todo-item-title {
  display: block;
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.todo-item-meta {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.125rem;
  font-size: 0.75rem;
}

.todo-star {
  border: none;
  background: none;
  padding: 0.125rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
  margin-top: 0.05rem;
}

.todo-star:hover,
.todo-star.active {
  color: #eab308;
}

.todo-completed-section {
  border-top: 1px solid var(--border-default);
}

.todo-completed-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  border: none;
  background: none;
  padding: 0.625rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.todo-completed-toggle:hover {
  background: var(--surface-secondary);
}

/* Detail panel */
.todo-detail {
  width: 320px;
  min-width: 320px;
  border-left: 1px solid var(--border-default);
  background: var(--surface-secondary);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.todo-detail-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.todo-detail-title {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  padding: 0.25rem 0;
}

.todo-detail-body {
  flex: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.todo-detail-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.todo-detail-field i {
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.todo-detail-field .form-control,
.todo-detail-field .form-select {
  background: var(--surface-primary);
}

.todo-detail-note textarea {
  resize: none;
  font-size: 0.85rem;
}

.todo-detail-footer {
  display: flex;
  align-items: center;
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--border-subtle);
}

@media (max-width: 992px) {
  .todo-sidebar {
    width: 200px;
    min-width: 200px;
  }

  .todo-detail {
    width: 280px;
    min-width: 280px;
  }
}

@media (max-width: 768px) {
  .todo-layout {
    flex-direction: column;
  }

  .todo-sidebar {
    width: 100%;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--border-default);
    flex-direction: row;
    overflow-x: auto;
    gap: 0.25rem;
    padding: 0.5rem;
  }

  .todo-detail {
    width: 100%;
    min-width: 0;
    border-left: none;
    border-top: 1px solid var(--border-default);
  }
}

/* ── Chat work item reference badges ────────────────────────────────────── */

.chat-work-item-ref {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1.4;
  text-decoration: none;
  background: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
}

.chat-work-item-ref:hover {
  filter: brightness(0.92);
}

.chat-work-item-ref.status-backlog {
  background: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
  border-color: var(--bs-border-color);
}

.chat-work-item-ref.status-todo {
  background: #e2e3e5;
  color: #41464b;
}

.chat-work-item-ref.status-inprogress {
  background: #fff3cd;
  color: #664d03;
}

.chat-work-item-ref.status-review {
  background: #cff4fc;
  color: #055160;
}

.chat-work-item-ref.status-done {
  background: #d1e7dd;
  color: #0a3622;
}

.chat-board-ref {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: 500;
  border: 1px solid var(--bs-border-color);
  cursor: pointer;
  vertical-align: middle;
  line-height: 1.4;
  background: #e7f1ff;
  color: #084298;
}

.chat-board-ref:hover {
  filter: brightness(0.92);
}

.chat-ref-unresolved {
  font-style: italic;
  opacity: 0.85;
}

.chat-typing-indicator {
  min-height: 1.75rem;
  background: var(--bs-body-bg);
}

.chat-typing-dots {
  display: inline-block;
  width: 1.1rem;
  height: 0.45rem;
  margin-right: 0.35rem;
  vertical-align: middle;
  background:
    radial-gradient(circle, currentColor 38%, transparent 42%) 0 50% / 0.35rem 0.35rem no-repeat,
    radial-gradient(circle, currentColor 38%, transparent 42%) 50% 50% / 0.35rem 0.35rem no-repeat,
    radial-gradient(circle, currentColor 38%, transparent 42%) 100% 50% / 0.35rem 0.35rem no-repeat;
  animation: chat-typing-dots 1.2s infinite ease-in-out;
}

@keyframes chat-typing-dots {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

.chat-receipt-indicator {
  font-size: 0.75rem;
  line-height: 1;
  opacity: 0.85;
}

.chat-receipt-indicator .bi-check-all.text-info {
  color: var(--bs-info) !important;
}

.chat-message-highlight {
  animation: chat-message-flash 2s ease-out;
}

@keyframes chat-message-flash {
  0%, 15% { background-color: rgba(var(--bs-warning-rgb), 0.35); border-radius: 0.5rem; }
  100% { background-color: transparent; }
}

.chat-quote-block {
  display: block;
  width: 100%;
  text-align: start;
  border: none;
  border-left: 3px solid var(--bs-primary);
  background: rgba(var(--bs-secondary-rgb), 0.12);
  border-radius: 0.375rem;
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.chat-quote-block:hover {
  background: rgba(var(--bs-secondary-rgb), 0.2);
}

.chat-quote-block-own {
  border-left-color: var(--bs-primary);
  background: color-mix(in srgb, var(--bs-body-bg) 55%, transparent);
}

.chat-quote-block-own:hover {
  background: color-mix(in srgb, var(--bs-body-bg) 75%, transparent);
}

.chat-quote-sender {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.9;
}

.chat-quote-preview {
  display: block;
  font-size: 0.8rem;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-composer-quote {
  border-left: 3px solid var(--bs-primary);
  background: var(--bs-secondary-bg);
  border-radius: 0.375rem;
  padding: 0.35rem 0.5rem;
}

/* Team chat page — messages scroll; composer stays pinned at bottom */
.chat-page {
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.chat-page-workspace {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.chat-page-row {
  flex: 1 1 0;
  min-height: 0;
  /* Avoid Bootstrap .row default min-height:auto blowing past the viewport */
  align-items: stretch;
}

.chat-page-row > [class*="col-"] {
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
}

.chat-page-sidebar-col,
.chat-page-main-col {
  min-height: 0;
  overflow: hidden;
}

/* Room list: allow the flush list to shrink and scroll inside the card */
.chat-page-sidebar-col .dashboard-card {
  min-height: 0;
  max-height: 100%;
}

.chat-page-sidebar-col .list-group.overflow-auto {
  min-height: 0;
  flex: 1 1 0;
  overscroll-behavior: contain;
}

/* Sidebar: channels vs Conversations (iconography + spacing) */
.chat-sidebar-list .chat-sidebar-group-header {
  letter-spacing: 0.045em;
  text-transform: uppercase;
  font-size: 0.68rem !important;
  padding: 0.55rem 0.85rem !important;
  border-bottom-color: transparent;
}

.chat-sidebar-group-toggle {
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  font-weight: inherit;
}

.chat-sidebar-group-glyph {
  font-size: 0.8rem;
  opacity: 0.7;
  text-transform: none;
  letter-spacing: 0;
}

.chat-sidebar-group-people,
.chat-sidebar-group-dms,
.chat-sidebar-group-activity {
  margin-top: 0.55rem;
  border-top: 1px solid var(--bs-border-color-translucent, var(--bs-border-color)) !important;
  padding-top: 0.7rem !important;
  background: color-mix(in srgb, var(--bs-body-bg) 88%, var(--bs-secondary-bg)) !important;
}

.chat-sidebar-group-dms {
  margin-top: 0.75rem;
  padding-top: 0.8rem !important;
}

.chat-sidebar-group-dms .chat-sidebar-group-glyph {
  color: var(--bs-primary);
  opacity: 0.9;
}

.chat-sidebar-row-btn {
  padding: 0.4rem 0.85rem !important;
  min-width: 0;
}

.chat-sidebar-channel-row .chat-sidebar-row-btn {
  padding-left: 1.35rem !important;
}

.chat-sidebar-channel-icon {
  flex: 0 0 1.05rem;
  width: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  opacity: 0.55;
  color: inherit;
}

.chat-sidebar-row.active .chat-sidebar-channel-icon {
  opacity: 0.9;
}

.chat-sidebar-row-sub {
  padding-left: calc(1.05rem + 0.5rem);
  line-height: 1.25;
}

.chat-sidebar-dm-row .chat-sidebar-row-btn {
  padding-top: 0.45rem !important;
  padding-bottom: 0.45rem !important;
}

.chat-sidebar-dm-avatar {
  flex: 0 0 1.55rem;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
  background: hsl(var(--chat-author-hue, 210) 52% 42%);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.chat-sidebar-dm-avatar-group {
  background: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
  font-size: 0.72rem;
  box-shadow: none;
  border: 1px solid var(--bs-border-color-translucent, var(--bs-border-color));
}

.chat-sidebar-row.active .chat-sidebar-dm-avatar-group {
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
  border-color: rgba(255, 255, 255, 0.28);
}

.chat-sidebar-dm-lock {
  font-size: 0.65rem;
  opacity: 0.45;
  flex-shrink: 0;
}

.chat-sidebar-row.active .chat-sidebar-dm-lock {
  opacity: 0.7;
}

.chat-sidebar-dm-row .chat-sidebar-row-sub {
  padding-left: calc(1.55rem + 0.5rem);
}

.chat-sidebar-people-row {
  padding-left: 1.1rem !important;
}

.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.35rem;
  padding: 2.75rem 1.25rem;
  color: var(--bs-secondary-color);
}

.chat-empty-state-icon {
  font-size: 1.75rem;
  opacity: 0.45;
  margin-bottom: 0.25rem;
  color: var(--bs-primary);
}

.chat-empty-state-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--bs-body-color);
}

.chat-empty-state-text {
  font-size: 0.82rem;
  max-width: 16rem;
  line-height: 1.35;
  margin: 0;
  opacity: 0.9;
}

.chat-empty-state-sidebar {
  padding: 1.25rem 1rem 1.5rem;
  gap: 0.4rem;
}

.chat-empty-state-sidebar .chat-empty-state-icon {
  font-size: 1.35rem;
}

.chat-empty-state-sidebar .chat-empty-state-title {
  font-size: 0.82rem;
}

.chat-empty-state-sidebar .chat-empty-state-text {
  font-size: 0.75rem;
  margin-bottom: 0.35rem;
}

.chat-room-panel {
  flex: 1 1 0;
  min-height: 0;
}

.chat-messages-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-messages-scroll-inner {
  min-height: min-content;
}

/* Client-only link preview cards */
.chat-link-previews {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.4rem;
  width: 100%;
  min-width: min(16rem, 100%);
  max-width: min(85vw, 36rem);
}

.chat-link-previews-own {
  margin-inline-start: auto;
}

.chat-link-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 0.5rem;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  text-decoration: none !important;
  box-shadow: var(--bs-box-shadow-sm);
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.chat-link-preview:hover,
.chat-link-preview:focus-visible {
  background: var(--bs-secondary-bg);
  border-color: var(--bs-primary);
  color: var(--bs-body-color);
}

.chat-link-preview-favicon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.chat-link-preview-text {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.chat-link-preview-host {
  font-size: 0.8rem;
  font-weight: 650;
}

.chat-link-preview-path {
  font-size: 0.72rem;
  color: var(--bs-secondary-color);
}

.chat-link-preview-ext {
  flex: 0 0 auto;
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
  opacity: 0.85;
}

/* Chat image attachment + sticky caption */
.chat-attachment-figure {
  position: relative;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  border-radius: 0.375rem;
}

.chat-attachment-thumb {
  display: block;
  max-width: 100%;
  background: transparent;
  line-height: 0;
}

.chat-attachment-img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  vertical-align: middle;
}

.chat-attachment-caption {
  position: sticky;
  bottom: 0;
  margin: 0;
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.2;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  pointer-events: none;
}

/* Overlay caption on the image (sticky within the figure scroll/box) */
.chat-attachment-figure .chat-attachment-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 0 0 0.375rem 0.375rem;
}

.chat-attachment-lightbox .attachment-lightbox-filename {
  margin-top: 0.65rem;
  max-width: min(90vw, 48rem);
}

.chat-day-separator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.85rem 0 0.65rem;
  user-select: none;
}

.chat-day-separator::before,
.chat-day-separator::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--bs-border-color-translucent, var(--bs-border-color));
}

.chat-day-separator-label {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--bs-secondary-color);
  background: var(--bs-body-tertiary);
  border: 1px solid var(--bs-border-color-translucent, var(--bs-border-color));
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  line-height: 1.2;
}

.chat-presentation-mode .chat-day-separator-label {
  background: var(--bs-body-bg);
}

.chat-load-older-status {
  z-index: 3;
  background: color-mix(in srgb, var(--bs-body-tertiary) 92%, transparent);
  backdrop-filter: blur(2px);
  border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.075));
}

.chat-decrypt-failed {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--bs-secondary-color);
  font-style: italic;
  opacity: 0.9;
}

.chat-hub-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chat-messages-panel {
  min-height: 0;
}

.chat-jump-to-present {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  border-radius: 999px;
  padding-inline: 0.9rem;
  white-space: nowrap;
}

.chat-composer-area {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: min(42vh, 280px);
  /* Visible so @mention / #ref popovers above the input are not clipped */
  overflow: visible;
  background: var(--bs-body-bg);
  border-top: 1px solid var(--bs-border-color);
  z-index: 6;
  position: relative;
}

.chat-typing-indicator {
  flex-shrink: 0;
  border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.075));
}

.chat-composer {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
  border-top: 0 !important;
  padding: 0.5rem 1rem 0.75rem;
  position: relative;
  border-radius: 0.5rem;
  transition:
    background-color 0.15s ease,
    box-shadow 0.15s ease,
    outline-color 0.15s ease;
}

/* Quote + pending attachments scroll when the composer is capped */
.chat-composer-chrome {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-composer-pending {
  max-height: 6.5rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-composer-toolbar {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
  margin-bottom: 0.25rem;
}

.chat-composer-tool {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  text-decoration: none !important;
  margin: 0;
}

.chat-composer-tool:hover,
.chat-composer-tool:focus-visible {
  color: var(--bs-primary) !important;
  background: var(--bs-primary-bg-subtle);
}

.chat-composer-tool:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 1px;
}

.chat-composer-md-hint {
  margin-left: 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  opacity: 0.65;
  user-select: none;
  cursor: help;
}

.chat-composer-limits {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.chat-composer-input {
  flex-shrink: 0;
  position: relative;
  z-index: 7;
  overflow: visible;
  align-items: flex-end;
}

.chat-composer-input > .btn-primary {
  align-self: flex-end;
}

/* Drag-and-drop file feedback — strong composer target + soft panel cue */
.chat-room-panel.chat-composer-dragover-panel {
  position: relative;
}

.chat-room-panel.chat-composer-dragover-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: color-mix(in srgb, var(--bs-body-bg) 55%, transparent);
  border-radius: inherit;
}

.chat-composer.chat-composer-dragover {
  z-index: 6;
  outline: 2px dashed var(--bs-primary);
  outline-offset: -3px;
  background: var(--bs-primary-bg-subtle) !important;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--bs-primary) 40%, transparent),
    0 0 0 4px color-mix(in srgb, var(--bs-primary) 12%, transparent);
}

.chat-composer.chat-composer-dragover::after {
  content: "Drop files to attach";
  position: absolute;
  inset: 0.35rem;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  pointer-events: none;
  border-radius: 0.375rem;
  background: color-mix(in srgb, var(--bs-primary-bg-subtle) 88%, var(--bs-body-bg));
  color: var(--bs-primary);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.chat-presence-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.chat-dm-presence {
  margin-top: 0.1rem;
  line-height: 1.2;
}

.chat-dm-presence .chat-presence-dot {
  width: 0.45rem;
  height: 0.45rem;
}

.chat-presence-online {
  background-color: var(--bs-success, #198754);
}

.chat-presence-offline {
  background-color: var(--bs-secondary-bg, #adb5bd);
  border: 1px solid var(--bs-border-color, #ced4da);
}

.chat-composer textarea[data-chat-send] {
  min-height: 2.375rem;
  max-height: 8rem;
  resize: none;
  overflow-y: auto;
}

.chat-bubble-body {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

.chat-bubble-edit {
  min-height: 2.5rem;
  max-height: 8rem;
  resize: none;
  overflow-y: auto;
}

.chat-code-inline {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9em;
  padding: 0.15em 0.4em;
  border-radius: 0.3rem;
  background: var(--bs-secondary-bg, rgba(0, 0, 0, 0.08));
  border: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.08));
  color: var(--bs-body-color);
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-code-block-wrap {
  display: flex;
  flex-direction: column;
  margin: 0.6rem 0;
  border-radius: 0.5rem;
  background: var(--bs-secondary-bg, #f6f8fa);
  border: 1px solid var(--bs-border-color, rgba(0, 0, 0, 0.12));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  overflow: hidden;
  max-width: 100%;
}

.chat-code-block-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  gap: 0.25rem;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid var(--bs-border-color, rgba(0, 0, 0, 0.08));
  background: color-mix(in srgb, var(--bs-secondary-bg, #f6f8fa) 88%, var(--bs-body-bg));
}

.chat-code-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: none;
  border-radius: 0.3rem;
  background: transparent;
  color: var(--bs-secondary-color, #6c757d);
  line-height: 1;
  cursor: pointer;
}

.chat-code-copy-btn:hover {
  background: var(--bs-tertiary-bg, rgba(0, 0, 0, 0.06));
  color: var(--bs-body-color);
}

.chat-code-copy-btn:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 1px;
}

.chat-code-copy-btn.is-copied {
  color: var(--bs-success, #198754);
}

.chat-code-block {
  display: block;
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow-x: auto;
  max-height: 22rem;
  overflow-y: auto;
  white-space: pre;
  word-break: normal;
  tab-size: 4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--bs-body-color);
}

.chat-code-block code {
  font-family: inherit;
  font-size: inherit;
  background: transparent;
  padding: 0;
  white-space: inherit;
  color: inherit;
}

/* Own bubble code uses the same readable dark panels as other bubbles. */

[data-bs-theme="dark"] .chat-code-block-wrap {
  background: #161b22;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

[data-bs-theme="dark"] .chat-code-block-toolbar {
  background: rgba(255, 255, 255, 0.03);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .chat-code-block {
  background: transparent;
  border: none;
  box-shadow: none;
  color: #e6edf3;
}

[data-bs-theme="dark"] .chat-code-inline {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

/* Keep timer FAB above chat composer; leave room for send button */
body:has(.chat-page) .time-tracker-widget {
  bottom: 5.75rem;
  right: 1.25rem;
}

body:has(.chat-page) .chat-composer-area {
  padding-right: 3.75rem;
  padding-bottom: 0.25rem;
}

.chat-room-icon-picker-btn {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Chat presentation mode (standalone tab) */
.chat-presentation-mode {
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem;
  background: var(--bs-body-bg);
  overflow: hidden;
  box-sizing: border-box;
}

.chat-presentation-shell {
  min-height: 0;
}

.chat-presentation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.chat-presentation-room-panel {
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  background: var(--bs-body-bg);
  overflow: hidden;
}

.chat-presentation-mode .chat-messages-scroll {
  background: var(--bs-body-tertiary);
}

.chat-presentation-mode .chat-message-bubble {
  max-width: min(920px, 92%) !important;
}

.chat-presentation-mode .chat-composer-area {
  padding-right: 0.5rem;
}

/* Kanban user story presentation mode (standalone tab) */
.kanban-presentation-mode {
  min-height: 100vh;
  padding: 1rem 1.25rem;
  background: var(--bs-body-bg);
}

.kanban-presentation-mode .kanban-board-table {
  max-width: 100%;
}

.kanban-presentation-mode .kanban-story-card {
  margin-bottom: 0;
}

.kanban-presentation-mode .kanban-story-tasks-scroll-expanded {
  max-height: none;
}
