/* =============================================================
   QP Task Management System — styles
   -------------------------------------------------------------
    1. Design tokens
    2. Base / reset + Bootstrap overrides
    3. Shared controls (buttons, pills, avatars, dropdowns)
    4. Desktop topbar
    5. Desktop board sub-header
    6. Kanban canvas + scrollbar
    7. Kanban list (column) shell
    8. Cards + drag/touch states
    9. Offcanvas: desktop board menu
   10. Mobile header + search overlay
   11. Floating action button
   12. Bottom sheet (filters) + mobile menu
   13. Modals (New Ticket)  ·  13b. Card details (dark)
   14. Toasts
   15. Responsive — tablet (≤ 991.98px)
   16. Responsive — mobile (< 768px)  ·  16b. Card details mobile (full-screen)
   17. Responsive — small phones (≤ 480px)
   18. Input-type & motion preferences
   ============================================================= */

/* 1. Design tokens ------------------------------------------- */
:root {
  /* Layout */
  --topbar-h: 48px;
  --board-header-h: 52px;
  --m-header-h: 52px;                  /* mobile header row */
  --m-search-h: 0px;                   /* mobile search bar (56px when open) */
  --list-w: 280px;
  --touch: 44px;                       /* minimum touch target */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Board palette */
  --board-bg: linear-gradient(135deg, #0c66e4 0%, #0055cc 50%, #09326c 100%);
  --list-bg: #f1f2f4;
  --card-bg: #ffffff;
  --text-primary: #172b4d;
  --text-secondary: #44546f;
  --text-on-dark: #ffffff;
  --border: #dcdfe4;

  /* Translucent surfaces (on top of the board gradient) */
  --glass-btn: rgba(255, 255, 255, 0.2);
  --glass-btn-hover: rgba(255, 255, 255, 0.3);
  --glass-active: rgba(255, 255, 255, 0.9);
  --topbar-bg: rgba(9, 30, 66, 0.55);
  --board-header-bg: rgba(0, 0, 0, 0.18);
  --glass-border: rgba(255, 255, 255, 0.16);

  /* Accents */
  --accent: #0c66e4;
  --accent-hover: #0055cc;
  --accent-soft: #e9f2ff;
  --focus-ring: #388bff;
  --create-bg: #579dff;
  --create-hover: #85b8ff;
  --danger: #e2483d;
  --online: #22a06b;
  --star: #f5cd47;

  /* Priorities */
  --priority-highest: #c9372c;
  --priority-high: #e56910;
  --priority-medium: #0c66e4;
  --priority-low: #8590a2;

  /* Neutral surfaces */
  --hover-subtle: rgba(9, 30, 66, 0.08);
  --hover-strong: rgba(9, 30, 66, 0.14);
  --neutral-btn: #f1f2f4;
  --neutral-btn-hover: #dcdfe4;
  --list-shadow: 0 1px 1px rgba(9, 30, 66, 0.25);
  --card-shadow: 0 1px 1px rgba(9, 30, 66, 0.25), 0 0 1px rgba(9, 30, 66, 0.31);
  --lift-shadow: 0 12px 24px rgba(9, 30, 66, 0.28), 0 2px 6px rgba(9, 30, 66, 0.2);
  --radius-list: 12px;
  --radius-card: 8px;
  --radius-btn: 6px;
}

/* 2. Base / reset + Bootstrap overrides ---------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

/* Horizontal scrolling is confined to the board canvas only —
   the window itself must never scroll sideways. */
html, body {
  height: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
}
body.m-search-open { --m-search-h: 56px; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--board-bg);
  background-attachment: fixed;
  overflow: hidden;                    /* the canvas owns scrolling */
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 500;
}
.btn-primary {
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: var(--accent-hover);
  --bs-btn-hover-border-color: var(--accent-hover);
  --bs-btn-active-bg: #09326c;
  --bs-btn-active-border-color: #09326c;
  --bs-btn-disabled-bg: var(--accent);
  --bs-btn-disabled-border-color: var(--accent);
}
.btn-light {
  --bs-btn-bg: var(--neutral-btn);
  --bs-btn-border-color: transparent;
  --bs-btn-color: var(--text-primary);
  --bs-btn-hover-bg: var(--neutral-btn-hover);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: #c1c7d0;
  --bs-btn-active-border-color: transparent;
}

.form-control,
.form-select {
  border-color: var(--border);
  color: var(--text-primary);
  font-size: 14px;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--focus-ring);
  box-shadow: inset 0 0 0 1px var(--focus-ring);
}
.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.modal-backdrop { --bs-backdrop-bg: #091e42; --bs-backdrop-opacity: 0.6; }
.offcanvas-backdrop { --bs-backdrop-bg: #091e42; --bs-backdrop-opacity: 0.5; }

/* 3. Shared controls ----------------------------------------- */
.tb-icon-btn,
.bh-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--text-on-dark);
  font-size: 1.05rem;
  transition: background-color 0.15s ease;
}
.tb-icon-btn:hover,
.bh-icon-btn:hover { background: var(--glass-btn-hover); }

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 32px;
  padding: 0 0.65rem;
  border: 0;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--text-on-dark);
  font-weight: 500;
  font-size: 0.875rem;
  transition: background-color 0.15s ease;
}
.tb-btn:hover,
.tb-btn.show { background: var(--glass-btn-hover); }

.bh-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 32px;
  padding: 0 0.75rem;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--glass-btn);
  color: var(--text-on-dark);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.bh-pill:hover,
.bh-pill.show { background: var(--glass-btn-hover); }
.bh-pill[aria-pressed="true"],
.bh-pill.is-active {
  background: var(--glass-active);
  color: var(--text-primary);
}

/* Avatars */
.avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 0;
  padding: 0;
  color: #fff;
  font-weight: 600;
  background: linear-gradient(135deg, #6e5dc6, #0c66e4);
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
.avatar-lg { width: 44px; height: 44px; font-size: 0.9rem; }
.avatar-md { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-sm { width: 28px; height: 28px; font-size: 0.7rem; }
.avatar-xs { width: 24px; height: 24px; font-size: 0.625rem; }
span.avatar { cursor: default; }

.avatar-online::after {
  content: '';
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid #1d2f4f;
}

.avatar-stack {
  display: flex;
  align-items: center;
  padding-left: 6px;
}
.avatar-stack .avatar {
  margin-left: -6px;
  box-shadow: 0 0 0 2px rgba(9, 50, 108, 0.9);
  transition: transform 0.15s ease;
}
.avatar-stack .avatar:hover { transform: translateY(-2px); z-index: 1; }
.avatar-more {
  margin-left: -6px;
  height: 28px;
  min-width: 28px;
  padding: 0 0.5rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--glass-btn);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(9, 50, 108, 0.9);
}

/* Dropdowns (light popovers) */
.dropdown-menu {
  font-size: 0.875rem;
  color: var(--text-primary);
  border: 0;
  border-radius: 8px;
  padding: 0.35rem 0;
  min-width: 220px;
  box-shadow: 0 8px 12px rgba(9, 30, 66, 0.15), 0 0 1px rgba(9, 30, 66, 0.31) !important;
}
.dropdown-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1rem;
  color: var(--text-primary);
}
.dropdown-item:hover { background: var(--hover-subtle); }
.dropdown-item.active,
.dropdown-item:active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
  box-shadow: inset 2px 0 0 var(--accent);
}
.dropdown-item .bi-check-lg { margin-left: auto; }

/* Priority dots */
.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.priority-highest { background: var(--priority-highest); }
.priority-high    { background: var(--priority-high); }
.priority-medium  { background: var(--priority-medium); }
.priority-low     { background: var(--priority-low); }

/* Brand badge (shared desktop + mobile) */
.brand-badge {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, #579dff, #0c66e4);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  color: #fff;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* Sheet drag handle (visible on mobile only) */
.sheet-handle {
  display: none;
  width: 40px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 2px;
  background: #c1c7d0;
  flex-shrink: 0;
}

/* 4. Desktop topbar ------------------------------------------ */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0.5rem;
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--glass-border);
  position: relative;
  z-index: 1030;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.topbar-right { gap: 0.4rem; }

.topbar-middle {
  flex: 1 1 auto;
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-btn);
  text-decoration: none;
  color: var(--text-on-dark);
}
.brand:hover { background: var(--glass-btn-hover); color: var(--text-on-dark); }
.brand-text {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Expandable search */
.search-box {
  position: relative;
  width: 220px;
  transition: width 0.2s ease;
}
.search-box:focus-within { width: 420px; }

.search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
  pointer-events: none;
  transition: color 0.15s ease;
}
.search-input {
  width: 100%;
  height: 32px;
  padding: 0 2.2rem 0 2rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-btn);
  background: var(--glass-btn);
  color: #fff;
  font-size: 0.875rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.search-input::placeholder { color: rgba(255, 255, 255, 0.8); }
.search-input:hover { background: var(--glass-btn-hover); }
.search-input:focus {
  outline: none;
  background: #fff;
  border-color: #85b8ff;
  color: var(--text-primary);
}
.search-box:focus-within .search-icon { color: var(--text-secondary); }

.search-kbd {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.search-kbd kbd {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  box-shadow: none;
}
.search-box:focus-within .search-kbd { opacity: 0; }

.btn-create {
  height: 32px;
  padding: 0 0.75rem;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--create-bg);
  color: #1d2125;
  font-weight: 600;
  font-size: 0.875rem;
}
.btn-create:hover,
.btn-create:focus-visible {
  background: var(--create-hover);
  color: #1d2125;
}

.notif-badge {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px #1d2f4f;
}
.notif-badge:empty { display: none; }

.notif-menu { width: 320px; }
.notif-item {
  display: flex;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.35;
}
.notif-item:hover { background: var(--hover-subtle); }
.notif-item.unread { background: var(--accent-soft); }
.notif-time {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* 5. Desktop board sub-header -------------------------------- */
.board-header {
  height: var(--board-header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0.75rem 0 1rem;
  background: var(--board-header-bg);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--text-on-dark);
  position: relative;
  z-index: 1020;
}

.bh-left,
.bh-center,
.bh-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.bh-left   { flex: 1 1 0; }
.bh-center { flex: 0 0 auto; }
.bh-right  { flex: 1 1 0; justify-content: flex-end; }

.board-title-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
}
.board-title {
  margin: 0;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-btn);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-on-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
  cursor: text;
  transition: background-color 0.15s ease;
}
.board-title:hover { background: var(--glass-btn-hover); }
.board-title[contenteditable="true"] {
  background: #fff;
  color: var(--text-primary);
  outline: 2px solid #85b8ff;
  text-overflow: clip;
}
.board-title-wrap .bh-icon-btn {
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}
.board-title-wrap:hover .bh-icon-btn,
.board-title-wrap .bh-icon-btn:focus-visible { opacity: 1; }

#starBtn[aria-pressed="true"] { color: var(--star); }

.privacy-badge { cursor: default; }
.privacy-badge:hover { background: var(--glass-btn); }

.clear-filters { background: transparent; }
.clear-filters:hover { background: var(--glass-btn); }

.btn-share {
  background: var(--glass-active);
  color: var(--text-primary);
  font-weight: 600;
}
.btn-share:hover { background: #fff; }

/* 6. Kanban canvas + scrollbar ------------------------------- */
.kanban-canvas {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  height: calc(100vh - 100px);         /* 48px topbar + 52px sub-header */
  height: calc(100dvh - 100px);
  padding: 12px 16px;
  gap: 12px;

  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.45) rgba(0, 0, 0, 0.15);
}
.kanban-canvas::-webkit-scrollbar { height: 12px; }
.kanban-canvas::-webkit-scrollbar-track {
  margin: 0 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.15);
}
.kanban-canvas::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
  background-color: rgba(255, 255, 255, 0.45);
}
.kanban-canvas::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.7); }

/* 7. Kanban list (column) shell ------------------------------ */
.kanban-list {
  width: var(--list-w);
  flex-shrink: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--list-bg);
  border-radius: var(--radius-list);
  padding: 8px 8px 4px 8px;
  box-shadow: var(--list-shadow);
}

.kanban-list-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 4px 4px 4px 8px;
  min-height: 36px;
}
.kanban-list-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 0 0 -6px;                  /* padding below keeps the text where it was */
  padding: 4px 6px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.kanban-list-title:focus-visible { outline-offset: 0; }

/* Inline rename: borderless input occupying exactly the title's box */
.kanban-list-title.is-editing {
  padding: 0;
  overflow: visible;
  cursor: text;
  background: transparent;
}
.column-title-input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 4px 6px;
  border: 0;
  border-radius: var(--radius-btn);
  outline: none;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--focus-ring);
  font: inherit;
  line-height: 20px;
  color: var(--text-primary);
}
.column-title-input::selection { background: #cce0ff; }

/* Column enter / leave animations */
.kanban-list.is-entering { animation: list-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.kanban-list.is-removing {
  overflow: hidden;
  pointer-events: none;
  animation: list-out 0.26s ease forwards;
}
@keyframes list-in {
  from { opacity: 0; transform: translateX(16px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes list-out {
  to {
    opacity: 0;
    transform: scale(0.96);
    width: 0;
    padding-left: 0;
    padding-right: 0;
    margin-right: -12px;               /* swallow the canvas gap so neighbours close up */
  }
}

/* Column "…" menu */
.list-menu { min-width: 232px; }
.list-menu .list-menu-danger:hover { background: #ffeceb; color: #ae2e24 !important; }
.list-menu-confirm { padding: 0 12px 8px; max-width: 260px; }
.list-menu-confirm .dropdown-header { padding-left: 0; padding-right: 0; }
.list-menu-confirm-text {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.list-menu-confirm-actions { display: flex; gap: 8px; }
.list-menu-confirm-actions .btn { flex: 1 1 0; }
.kanban-list-accent {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.kanban-count {
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--hover-subtle);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
}
.list-action-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
}
.list-action-btn:hover { background: var(--hover-strong); color: var(--text-primary); }

/* Body: SortableJS drop target; scrolls vertically on its own */
.kanban-cards-list {
  flex: 1 1 auto;
  min-height: 40px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 4px 4px;
  margin: 0 -4px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;      /* don't chain vertical scroll to the page */

  scrollbar-width: thin;
  scrollbar-color: rgba(9, 30, 66, 0.25) transparent;
}
.kanban-cards-list::-webkit-scrollbar { width: 8px; }
.kanban-cards-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
  background-color: rgba(9, 30, 66, 0.25);
}

.kanban-card[hidden] { display: none !important; }

.kanban-empty[hidden] { display: none; }
.kanban-empty {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

.kanban-list-footer { padding-top: 4px; }
.btn-add-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-add-card:hover { background: var(--hover-strong); color: var(--text-primary); }

/* "+ Add another list" shell: translucent button ↔ list-coloured composer */
.add-list {
  width: var(--list-w);
  flex-shrink: 0;
  align-self: flex-start;
}
.add-list-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 48px;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.add-list-btn:hover { background: rgba(255, 255, 255, 0.3); }
.add-list-btn:active { background: rgba(255, 255, 255, 0.36); }

.add-list-form {
  padding: 8px;
  border-radius: 12px;
  background: var(--list-bg);
  box-shadow: var(--list-shadow);
  animation: add-list-open 0.16s ease-out;
}
.add-list-form[hidden] { display: none; }
.add-list-input {
  display: block;
  width: 100%;
  height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-btn);
  outline: none;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}
.add-list-input:focus { box-shadow: inset 0 0 0 2px var(--focus-ring); }
.add-list-input.is-invalid {
  box-shadow: inset 0 0 0 2px var(--danger);
  animation: field-shake 0.3s ease;
}
.add-list-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}
.add-list-actions .btn { padding: 6px 12px; font-weight: 500; }
.add-list-cancel {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--text-secondary);
}
.add-list-cancel:hover { background: var(--hover-strong); color: var(--text-primary); }
@keyframes add-list-open {
  from { opacity: 0; transform: scaleY(0.92); transform-origin: top; }
  to   { opacity: 1; transform: none; }
}
@keyframes field-shake {
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* 8. Cards + drag/touch states ------------------------------- */
.kanban-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid rgba(9, 30, 66, 0.08);
  border-radius: var(--radius-card);   /* 8px */
  overflow: hidden;                    /* clip the cover to the rounded corners */
  flex-shrink: 0;                      /* never squash cards in a height-capped list (it scrolls instead) */
  padding: 0;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  outline: 2px solid transparent;
  transition: outline-color 0.1s ease, transform 0.15s ease, box-shadow 0.15s ease;

  /* Long-press = drag: suppress text selection + iOS callout */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.kanban-card:focus-visible { outline-color: var(--focus-ring); outline-offset: 0; }

/* Edge-to-edge cover image */
.card-cover {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  background: #dcdfe4;
  pointer-events: none;                /* keep drag/click on the card itself */
}
.card-content { padding: 10px 12px; }

.card-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}
.card-priority {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.card-label {
  height: 8px;
  min-width: 40px;
  border-radius: 4px;
}
.card-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: #172b4d;
  overflow-wrap: anywhere;
  /* max 2 lines, then ellipsis (full title is in aria-label + the modal) */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.card-ref { color: var(--text-secondary); font-weight: 600; }
/* Footer row: badges on the left, assignee avatar(s) pinned right */
.card-meta {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
.card-meta .card-id { font-weight: 600; }
.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 4px;
  border-radius: 4px;
}
.card-badge.due-soon { background: #f5cd47; color: #533f04; padding: 0 6px; }
.card-badge.overdue  { background: #c9372c; color: #fff; padding: 0 6px; }
.card-badge.is-done  { background: #1f845a; color: #fff; padding: 0 6px; }
.card-badge.is-complete { background: #1f845a; color: #fff; padding: 0 6px; }
.card-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  min-width: 0;
  flex: 1 1 auto;
}
.card-badges:empty { display: none; }
.card-members { display: flex; flex-shrink: 0; margin-left: auto; padding-left: 4px; }
.card-members .avatar { margin-left: -4px; box-shadow: 0 0 0 2px var(--card-bg); }
.card-members .avatar:first-child { margin-left: 0; }
.avatar-card { width: 26px; height: 26px; font-size: 0.66rem; }

/* Priority tints (board pills + modal) */
.prio-highest { background: #ffeceb; color: #ae2e24; }
.prio-high    { background: #fff3eb; color: #a54800; }
.prio-medium  { background: #e9f2ff; color: #0055cc; }
.prio-low     { background: #f1f2f4; color: #44546f; }

/* --- Card drag states (SortableJS hooks set in initCardSortable) ---
   card-chosen : the card as soon as it is picked up (immediately on mouse,
                 after the 200ms hold on touch) → lift + slight tilt.
   card-ghost  : the placeholder left in the list where the card will drop.
   card-dragging / sortable-fallback : the floating clone under the pointer.
   SortableJS moves the clone with an inline `transform: translate3d()`, so the
   tilt/scale use the independent `rotate` / `scale` properties, which that
   inline transform cannot overwrite. */
.card-chosen {
  box-shadow: 0 12px 24px -4px rgba(9, 30, 66, 0.25), 0 0 0 1px rgba(9, 30, 66, 0.08) !important;
  rotate: 1.5deg;
  outline-color: transparent;
  z-index: 2;
}

.card-ghost {
  opacity: 0.35;
  background: rgba(9, 30, 66, 0.08) !important;
  border: 2px dashed #0c66e4 !important;
  border-radius: 8px;
}
/* The placeholder is also "chosen": keep it flat and contentless */
.kanban-card.card-ghost {
  box-shadow: none !important;
  outline: 0 !important;
  rotate: none;
  scale: none;
}
.kanban-card.card-ghost > * { visibility: hidden; }

.card-dragging,
.kanban-card.sortable-fallback {
  scale: 1.03;
  rotate: 1.5deg;
  opacity: 0.97 !important;
  cursor: grabbing;
  transition: none !important;         /* follow the finger with zero lag */
}

/* Count badge "bump" after a card moves in or out of a column */
.kanban-count.is-bumped { animation: count-bump 0.36s ease; }
@keyframes count-bump {
  40% { transform: scale(1.3); background: var(--accent-soft); color: var(--accent); }
}

/* --- Column drag states (initColumnSortable, handle = header) --- */
.kanban-list-header {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.kanban-list-header:active {
  cursor: grabbing;
}
.kanban-list-header .list-action-btn { cursor: pointer; }
.kanban-list-header .column-title-input { user-select: text; -webkit-user-select: text; cursor: text; }

.kanban-list.list-ghost {
  background: rgba(9, 30, 66, 0.22);
  box-shadow: none;
  outline: 2px dashed rgba(255, 255, 255, 0.7);
  outline-offset: -2px;
}
.kanban-list.list-ghost > * { visibility: hidden; }
.kanban-list.list-dragging,
.kanban-list.sortable-fallback {
  rotate: 2deg;
  box-shadow: var(--lift-shadow) !important;
  opacity: 0.96 !important;
  transition: none !important;
}

body.is-dragging,
body.is-dragging * { cursor: grabbing !important; }

/* Dark theme (board wrapped in [data-bs-theme="dark"]) */
[data-bs-theme="dark"] .kanban-card { background: #22272b; border-color: #38414a; box-shadow: none; }
[data-bs-theme="dark"] .card-title { color: #b6c2cf; }
[data-bs-theme="dark"] .card-ref,
[data-bs-theme="dark"] .card-meta { color: #9fadbc; }
[data-bs-theme="dark"] .card-members .avatar { box-shadow: 0 0 0 2px #22272b; }
[data-bs-theme="dark"] .prio-highest { background: #5d1f1a; color: #ffd5d2; }
[data-bs-theme="dark"] .prio-high    { background: #702e00; color: #fedec8; }
[data-bs-theme="dark"] .prio-medium  { background: #09326c; color: #cce0ff; }
[data-bs-theme="dark"] .prio-low     { background: #38414a; color: #b6c2cf; }

/* Newly created card highlight */
.kanban-card.is-new { animation: card-pop 1.4s ease-out; }
@keyframes card-pop {
  0%   { box-shadow: 0 0 0 0 rgba(12, 102, 228, 0.65), var(--card-shadow); outline-color: var(--accent); }
  70%  { box-shadow: 0 0 0 10px rgba(12, 102, 228, 0), var(--card-shadow); outline-color: var(--accent); }
  100% { box-shadow: var(--card-shadow); outline-color: transparent; }
}

/* 9. Offcanvas: desktop board menu --------------------------- */
.board-menu { --bs-offcanvas-width: 340px; color: var(--text-primary); }
.board-menu .offcanvas-header { border-bottom: 1px solid var(--border); }
.board-menu .offcanvas-title { font-size: 1rem; font-weight: 600; margin: 0 auto; }
.board-menu-list { display: flex; flex-direction: column; gap: 2px; }
.board-menu-list a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-btn);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
}
.board-menu-list a:hover { background: var(--hover-subtle); }
.board-menu-list i { color: var(--text-secondary); font-size: 1rem; }

/* 10. Mobile header + slide-down search --------------------- */
.mobile-header {
  display: none;                       /* enabled < 768px */
  position: relative;
  z-index: 1031;
  align-items: center;
  gap: 4px;
  width: 100%;
  height: calc(var(--m-header-h) + var(--safe-top));
  padding: var(--safe-top) max(4px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-on-dark);
}

/* Left: compact QP badge + board title */
.m-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;                        /* lets the title ellipsize instead of pushing icons off-screen */
}
.m-brand .brand-badge { width: 30px; height: 30px; font-size: 0.72rem; border-radius: 8px; }
.m-board-name {
  min-width: 0;
  padding: 4px 6px;
  border-radius: 6px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
}
.m-board-name:active { background: var(--glass-btn); }
.m-board-name[contenteditable="true"] {
  flex: 1 1 auto;
  background: #fff;
  color: var(--text-primary);
  outline: 2px solid #85b8ff;
  text-overflow: clip;
}

/* Right: search, filter, avatar (44px targets) */
.m-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.m-icon-btn,
.m-avatar-btn {
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-on-dark);
  font-size: 1.2rem;
}
.m-icon-btn:active,
.m-icon-btn[aria-expanded="true"] { background: var(--glass-btn-hover); }
.m-avatar-btn { border-radius: 50%; }
.m-avatar-btn .avatar {
  pointer-events: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.28);
}
.m-avatar-btn .avatar-online::after { border-color: #1d2f4f; }
.m-avatar-btn .m-dot { top: 5px; right: 5px; }

.m-dot {
  position: absolute;
  top: 10px;
  right: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px #1d2f4f;
}
.m-dot-search { background: var(--star); }
.m-count {
  position: absolute;
  top: 6px;
  right: 4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--star);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px #1d2f4f;
}

/* Search bar: sits in normal flow directly below the header and slides down;
   the board canvas shrinks by the same amount, so nothing is covered. */
.m-search-bar {
  display: none;                       /* enabled < 768px */
  position: relative;
  z-index: 1030;
  width: 100%;
  height: var(--m-search-h);
  overflow: hidden;
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: height 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
body.m-search-open .m-search-bar { border-bottom: 1px solid var(--glass-border); }
.m-search-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 56px;
  padding: 0 max(4px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  transform: translateY(-100%);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
body.m-search-open .m-search-inner { transform: none; }
.m-search-field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.m-search-field i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}
.m-search-field input {
  width: 100%;
  height: var(--touch);
  padding: 0 12px 0 36px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: var(--text-primary);
  font-size: 16px;                     /* ≥16px prevents iOS auto-zoom */
}
.m-search-field input:focus { outline: 2px solid #85b8ff; outline-offset: 0; }

/* 11. Floating action button: Create Ticket ------------------ */
.mobile-fab {
  display: none;                       /* enabled < 768px */
  position: fixed;
  bottom: 20px;
  bottom: calc(20px + var(--safe-bottom));
  right: 20px;
  right: max(20px, env(safe-area-inset-right));
  width: 54px;
  height: 54px;
  border-radius: 50%;
  z-index: 1050;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, opacity 0.2s ease, background-color 0.15s ease;
}
.mobile-fab:active { transform: scale(0.94); background: var(--accent-hover); }
/* z-index 1050 is above Bootstrap offcanvas (1045): hide it while sheets/modals are open or a card is dragged */
body.is-dragging .mobile-fab,
body.sheet-open .mobile-fab,
body.modal-open .mobile-fab { opacity: 0; pointer-events: none; }

/* 12. Bottom sheet (filters) + mobile menu ------------------- */
.qp-sheet.offcanvas-bottom {
  height: auto;
  max-height: 88dvh;
  border: 0;
  border-radius: 16px 16px 0 0;
  color: var(--text-primary);
}
.qp-sheet .sheet-handle { display: block; }
.qp-sheet .offcanvas-header { padding: 8px 8px 4px 16px; }
.qp-sheet .offcanvas-title { font-size: 17px; font-weight: 700; }
.qp-sheet .offcanvas-body { padding: 0 0 8px; overscroll-behavior: contain; }

.sheet-section { padding: 8px 16px 12px; }
.sheet-section + .sheet-section { border-top: 1px solid #ebecf0; }
.sheet-section-title {
  margin: 4px 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.sheet-options { display: flex; flex-direction: column; gap: 2px; }
.sheet-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
}
.sheet-option:active { background: var(--hover-subtle); }
.sheet-option-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--neutral-btn);
  color: var(--text-secondary);
}
.sheet-option .check { margin-left: auto; color: var(--accent); visibility: hidden; font-size: 1.1rem; }
.sheet-option.active { background: var(--accent-soft); color: var(--accent); }
.sheet-option.active .sheet-option-icon { background: #cce0ff; color: var(--accent); }
.sheet-option.active .check { visibility: visible; }

.sheet-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 12px;
  margin: 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.sheet-toggle:active { background: var(--hover-subtle); }
.sheet-toggle > span:first-child { display: inline-flex; align-items: center; gap: 12px; }
.sheet-toggle > span:first-child i { color: var(--text-secondary); font-size: 1.1rem; }
.sheet-toggle .form-check-input { width: 2.75em; height: 1.5em; margin: 0; cursor: pointer; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--touch);
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}
.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.sheet-footer {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: #fff;
}
.sheet-footer .btn { min-height: 48px; font-size: 15px; font-weight: 600; }

/* Mobile menu */
.qp-menu { --bs-offcanvas-width: min(86vw, 340px); color: var(--text-primary); }
.qp-menu-header {
  padding: calc(16px + var(--safe-top)) 8px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.qp-menu-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.qp-menu-user .avatar-online::after { border-color: #fff; }
.qp-menu-user-text { min-width: 0; }
.qp-menu-name { font-size: 16px; font-weight: 700; }
.qp-menu-sub { font-size: 13px; color: var(--text-secondary); }
.qp-menu .btn-close { width: var(--touch); height: var(--touch); padding: 0; box-sizing: border-box; }

.mm-group { padding: 8px 8px 4px; }
.mm-group + .mm-group { border-top: 1px solid #ebecf0; }
.mm-title {
  margin: 8px 8px 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.mm-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
}
.mm-item > .bi:first-child { font-size: 1.15rem; color: var(--text-secondary); width: 20px; text-align: center; }
.mm-item:active { background: var(--hover-subtle); }
.mm-item-danger, .mm-item-danger > .bi:first-child { color: #ae2e24 !important; }
#mStarIcon.bi-star-fill { color: #e2b203; }
.mm-avatars { margin-left: auto; }
.mm-avatars .avatar,
.mm-avatars .avatar-more { box-shadow: 0 0 0 2px #fff; }
.mm-avatars .avatar-more { background: var(--neutral-btn-hover); color: var(--text-primary); }
.mm-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.mm-chevron { margin-left: auto; font-size: 0.85rem; transition: transform 0.2s ease; }
.mm-badge:not([hidden]) + .mm-chevron { margin-left: 8px; }
.mm-badge:not([hidden]) { margin-left: auto; }
.mm-item[aria-expanded="true"] .mm-chevron { transform: rotate(180deg); }
.mm-notifs .notif-item { padding: 10px 12px; border-radius: 10px; margin: 2px 0; }

/* 13. Modals (Card Details + New Ticket) --------------------- */
.qp-modal .modal-content {
  border: 0;
  border-radius: 12px;
  color: var(--text-primary);
  box-shadow: 0 12px 40px rgba(9, 30, 66, 0.3);
}
.qp-modal .modal-header {
  align-items: flex-start;
  gap: 12px;
  padding: 20px 24px 12px;
  border-bottom: 0;
}
.qp-modal .modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.qp-modal .modal-title i { color: var(--text-secondary); }
.qp-modal .modal-body { padding: 8px 24px 24px; }
.qp-modal .modal-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
}

/* 70 / 30 two-column layout */
.qp-layout {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  gap: 24px;
}
.qp-side {
  position: sticky;
  top: 0;
  align-self: start;
}

.qp-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.qp-field { margin-bottom: 16px; }
.qp-field:last-child { margin-bottom: 0; }

/* --- New ticket form --- */
.nt-title-input { height: 44px; font-size: 16px; font-weight: 600; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0;
  padding: 18px;
  border: 2px dashed #c1c7d0;
  border-radius: 10px;
  color: var(--text-secondary);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.dropzone i { font-size: 1.6rem; }
.dropzone:hover,
.dropzone.is-dragover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone:focus-within { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.dropzone-text b { color: var(--text-primary); font-weight: 600; }

.priority-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.pp-option { position: relative; margin: 0; }
.pp-option input { position: absolute; opacity: 0; pointer-events: none; }
.pp-option span {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.pp-option span:hover { background: var(--hover-subtle); }
.pp-option input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.pp-option input:focus-visible + span { outline: 2px solid var(--focus-ring); outline-offset: 1px; }

/* Attachment tiles (New Ticket file previews) */
.attach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.attach-grid:empty { display: none; }
#ntFiles { margin-top: 10px; }
.attach-tile {
  position: relative;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.attach-preview {
  display: grid;
  place-items: center;
  height: 84px;
  background: var(--kind, #626f86) center / cover no-repeat;
  color: #fff;
  font-size: 30px;
}
.attach-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 8px 8px;
  min-width: 0;
}
.attach-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attach-sub { font-size: 11px; color: var(--text-secondary); }
.attach-remove {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border: 0;
  background: transparent;
}
.attach-remove i {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(9, 30, 66, 0.6);
  color: #fff;
  font-size: 11px;
}
.attach-remove:hover i { background: rgba(9, 30, 66, 0.85); }

/* 13a. New Ticket modal — dark palette (matches the card details modal) ----
   The shared light rules above are all driven by tokens, so re-scoping the
   tokens here re-themes inputs, pills, dropzone and tiles in one place. */
.nt-modal {
  --border: #38414a;
  --text-primary: #e6ecf1;           /* headings, input text */
  --text-secondary: #9fadbc;
  --hover-subtle: rgba(166, 197, 226, 0.1);
  --accent: #579dff;
  --accent-soft: rgba(87, 157, 255, 0.14);
  --focus-ring: #85b8ff;
  --nt-bg: #22272b;
  --nt-surface: #1d2125;
  --nt-text: #b6c2cf;
  color-scheme: dark;                /* native date picker / scrollbars */
}
.nt-modal .modal-content {
  background: var(--nt-bg);
  color: var(--nt-text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}
.nt-modal .modal-title { color: var(--text-primary); }
.nt-modal .modal-footer { border-top-color: var(--border); background: var(--nt-surface); }
.nt-modal .sheet-handle { background: #454f59; }

.nt-badge {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #579dff, #0c66e4);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.qp-optional { font-weight: 400; color: #738496; }

.nt-modal .form-control,
.nt-modal .form-select {
  background-color: var(--nt-surface);
  border-color: var(--border);
  color: var(--text-primary);
}
.nt-modal .form-control::placeholder { color: #738496; }
.nt-modal .form-control:focus,
.nt-modal .form-select:focus { background-color: var(--nt-surface); }
.nt-modal .form-control.is-invalid { border-color: #f87168; }
.nt-modal .invalid-feedback { color: #fd9891; }
.nt-modal .btn-light {
  --bs-btn-bg: #38414a;
  --bs-btn-color: #b6c2cf;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: #454f59;
  --bs-btn-hover-color: #dee4ea;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: #596773;
}

.nt-modal .dropzone { border-color: #454f59; background: var(--nt-surface); }
.dropzone-hint { font-size: 12px; color: #738496; }
.nt-modal .attach-tile { background: var(--nt-surface); }

/* Priority pills: each option takes its own colour when selected */
.pp-option input[value="highest"] + span { --pp: var(--priority-highest); }
.pp-option input[value="high"]    + span { --pp: var(--priority-high); }
.pp-option input[value="medium"]  + span { --pp: #579dff; }
.pp-option input[value="low"]     + span { --pp: #8c9bab; }
.pp-option input:checked + span {
  border-color: var(--pp);
  background: color-mix(in srgb, var(--pp) 18%, transparent);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--pp);
}

/* Attachment preview tags (type + cover) */
.attach-tags {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: calc(100% - 48px);      /* keep clear of the remove button */
  pointer-events: none;
}
.attach-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  background: rgba(9, 30, 66, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.attach-tag.is-cover { background: #0c66e4; }

/* 13b. Card details modal — dark Trello theme ---------------- */
.cd-modal {
  --cd-bg: #22272b;
  --cd-bg-2: #1d2125;
  --cd-text: #b6c2cf;
  --cd-text-subtle: #9fadbc;
  --cd-border: #38414a;
  --cd-bubble: #282e33;
  --cd-btn: rgba(161, 189, 217, 0.08);
  --cd-btn-hover: rgba(166, 197, 226, 0.16);
  --cd-btn-active: rgba(166, 197, 226, 0.28);
  --cd-link: #579dff;
  --cd-input-border: #738496;
  color-scheme: dark;
}

.cd-dialog { max-width: 900px; }
.cd-modal .modal-content.cd-content {
  height: min(900px, calc(100dvh - 3.5rem));
  border: 1px solid var(--cd-border);
  border-radius: 12px;
  background: var(--cd-bg);
  color: var(--cd-text);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.cd-modal .sheet-handle { background: #454f59; }

.cd-scroll {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* --- A. Cover banner --- */
.cd-cover {
  position: relative;
  flex: 0 0 auto;
  min-height: 56px;
  background: var(--cd-bg);
  border-bottom: 1px solid var(--cd-border);
}
.cd-cover.has-cover { height: 160px; background: var(--cd-bg-2); }
.cd-cover-img {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
}
.cd-cover-controls {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 0 16px;
}
.cd-cover.has-cover .cd-cover-controls {
  padding-bottom: 28px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent);
}
.cd-cover-actions { display: flex; align-items: center; gap: 6px; }

.cd-list-pill,
.cd-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: rgba(29, 33, 37, 0.72);
  color: #dee4ea;
  font-size: 14px;
  font-weight: 600;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background-color 0.15s ease;
}
.cd-cover-controls > .dropdown { flex: 0 1 auto; min-width: 0; }   /* pill shrinks, buttons don't */
.cd-cover-actions { flex-shrink: 0; }
.cd-list-pill { padding: 0 10px 0 12px; max-width: 100%; }
.cd-list-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-list-pill .bi-chevron-down { font-size: 11px; }
.cd-icon-btn { min-width: 32px; padding: 0 8px; }
.cd-list-pill:hover,
.cd-icon-btn:hover,
.cd-list-pill.show,
.cd-icon-btn.show { background: rgba(56, 65, 74, 0.92); color: #fff; }
.cd-icon-btn[aria-pressed="true"] { color: #85b8ff; }
.cd-cover:not(.has-cover) .cd-list-pill,
.cd-cover:not(.has-cover) .cd-icon-btn { background: var(--cd-btn); backdrop-filter: none; }
.cd-cover:not(.has-cover) .cd-list-pill:hover,
.cd-cover:not(.has-cover) .cd-icon-btn:hover { background: var(--cd-btn-hover); }

/* --- Body: 65 / 35 split, columns scroll independently --- */
.cd-body {                              /* .modal-body-wrapper */
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
}
.cd-main     { flex: 0 0 65%; width: 65%; min-width: 0; }   /* .modal-main-content */
.cd-activity { flex: 0 0 35%; width: 35%; min-width: 0; }   /* .modal-sidebar-content */
.cd-main,
.cd-activity {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #454f59 transparent;
}
.cd-main { padding: 20px 24px 28px; }
.cd-activity {
  padding: 20px 20px 28px;
  background: var(--cd-bg-2);
  border-left: 1px solid var(--cd-border);
}

/* Shared dark buttons */
.cd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: var(--cd-btn);
  color: var(--cd-text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.cd-btn:hover,
.cd-btn.show { background: var(--cd-btn-hover); color: #dee4ea; }
.cd-btn:active { background: var(--cd-btn-active); }
.cd-btn[aria-pressed="true"] { background: var(--cd-btn-active); }
.cd-btn-ghost { background: transparent; }
.cd-btn .bi-chevron-down { font-size: 10px; color: var(--cd-text-subtle); }

.cd-round-btn,
.cd-square-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: var(--cd-btn);
  color: var(--cd-text);
}
.cd-round-btn { border-radius: 50%; }
.cd-square-btn { border-radius: 4px; }
.cd-round-btn:hover,
.cd-square-btn:hover { background: var(--cd-btn-hover); }

/* Title row */
.cd-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.cd-check {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 5px;
  padding: 0;
  border: 2px solid #738496;
  border-radius: 50%;
  background: transparent;
  color: transparent;
  font-size: 13px;
  transition: all 0.15s ease;
}
.cd-check:hover { border-color: #b6c2cf; color: #738496; }
.cd-check[aria-checked="true"] { background: #22a06b; border-color: #22a06b; color: #fff; }
.cd-title-wrap { flex: 1 1 auto; min-width: 0; }
.cd-title {
  margin: 0 0 0 -6px;
  padding: 2px 6px;
  border-radius: 6px;
  color: #dee4ea;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
  cursor: text;
}
.cd-title:hover { background: var(--cd-btn); }
.cd-title[contenteditable="true"] {
  background: var(--cd-bg-2);
  outline: 2px solid #85b8ff;
}
.cd-content.is-done .cd-title { color: var(--cd-text-subtle); }
.cd-ref { margin-top: 2px; font-size: 12px; color: var(--cd-text-subtle); }
.cd-ref b { color: var(--cd-text); font-weight: 600; }

/* Quick actions */
.cd-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 20px 32px;
}

/* Metadata */
.cd-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-left: 32px;
}
.cd-meta-group { min-width: 0; }
.cd-meta-label {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--cd-text-subtle);
}
.cd-meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.cd-avatars { display: flex; padding-left: 4px; }
.cd-avatars:empty { display: none; }
.cd-avatars .avatar {
  margin-left: -4px;
  box-shadow: 0 0 0 2px var(--cd-bg);
}
.cd-meta-row .cd-avatars + .dropdown { margin-left: 4px; }
.cd-label-list { display: flex; flex-wrap: wrap; gap: 4px; }
.cd-label-list:empty { display: none; }
.cd-label {
  display: inline-flex;
  align-items: center;
  height: 32px;
  min-width: 48px;
  padding: 0 12px;
  border-radius: 4px;
  color: #1d2125;
  font-size: 14px;
  font-weight: 600;
}
.cd-label-sm { height: 22px; min-width: 0; font-size: 12px; padding: 0 8px; }

.cd-date input {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  outline: none;
  color-scheme: dark;
}
.cd-date.due-soon { background: #7f5f01; color: #f8e6a0; }
.cd-date.overdue  { background: #ae2e24; color: #ffd5d2; }
.cd-date.is-done  { background: #216e4e; color: #baf3db; }

/* Sections */
.cd-section { margin: 28px 0 0 32px; }
.cd-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.cd-section-head h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: #dee4ea;
  font-size: 16px;
  font-weight: 600;
}
.cd-main .cd-section-head h3 > i { margin-left: -32px; width: 20px; color: var(--cd-text-subtle); }
.cd-activity .cd-section-head h3 { font-size: 14px; gap: 8px; }
.cd-activity .cd-section-head h3 > i { color: var(--cd-text-subtle); }
.cd-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--cd-btn);
  color: var(--cd-text-subtle);
  font-size: 12px;
  font-weight: 600;
}
.cd-count:empty { display: none; }
.cd-muted { margin: 0; color: var(--cd-text-subtle); font-size: 14px; }

/* Description (markdown preview) */
.cd-md {
  margin: 0 -8px;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.cd-md:hover { background: rgba(161, 189, 217, 0.05); }
.cd-md p { margin: 0 0 8px; }
.cd-md ul { margin: 0 0 8px; padding-left: 20px; }
.cd-md h4, .cd-md h5, .cd-md h6 { margin: 12px 0 6px; color: #dee4ea; font-weight: 600; }
.cd-md h4 { font-size: 18px; }
.cd-md h5 { font-size: 16px; }
.cd-md h6 { font-size: 14px; }
.cd-md > :last-child { margin-bottom: 0; }
.cd-md code {
  padding: 1px 5px;
  border-radius: 3px;
  background: #2c333a;
  color: #f87168;
  font-size: 0.875em;
}
.cd-md a,
.cd-bubble a { color: var(--cd-link); }
.cd-md-empty {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  background: var(--cd-btn);
  color: var(--cd-text-subtle);
  text-align: left;
}
.cd-md-empty:hover { background: var(--cd-btn-hover); }

.cd-modal .cd-input {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--cd-input-border);
  border-radius: 6px;
  background: var(--cd-bg-2);
  color: var(--cd-text);
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}
.cd-modal .cd-input:focus { outline: none; border-color: #85b8ff; box-shadow: inset 0 0 0 1px #85b8ff; }
.cd-editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.cd-hint { font-size: 12px; color: var(--cd-text-subtle); }
.cd-hint code { color: var(--cd-text); background: #2c333a; padding: 0 4px; border-radius: 3px; }

/* Checklist */
.cd-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cd-progress-pct { width: 34px; font-size: 12px; color: var(--cd-text-subtle); }
.cd-progress-bar { flex: 1 1 auto; height: 8px; border-radius: 4px; background: var(--cd-btn-hover); overflow: hidden; }
.cd-progress-bar span { display: block; height: 100%; background: #579dff; transition: width 0.2s ease; }
.cd-progress.is-complete .cd-progress-bar span { background: #22a06b; }
.cd-check-items { list-style: none; margin: 0 0 8px; padding: 0; }
.cd-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  margin: 0 -8px;
  padding: 0 0 0 8px;
  border-radius: 6px;
}
.cd-check-item:hover { background: var(--cd-btn); }
.cd-check-item label { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; margin: 0; cursor: pointer; }
.cd-check-item input { width: 16px; height: 16px; accent-color: #579dff; flex-shrink: 0; }
.cd-check-item.is-done label span { text-decoration: line-through; color: var(--cd-text-subtle); }
.cd-check-item .cd-icon-plain { opacity: 0; }
.cd-check-item:hover .cd-icon-plain,
.cd-check-item .cd-icon-plain:focus-visible { opacity: 1; }
.cd-check-add { display: flex; gap: 8px; }
.cd-check-add .cd-input { flex: 1 1 auto; }

.cd-icon-plain {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--cd-text-subtle);
}
.cd-icon-plain:hover { background: var(--cd-btn-hover); color: #dee4ea; }
.cd-icon-plain:disabled { opacity: 0.35; pointer-events: none; }

/* Attachments list */
.cd-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cd-file {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 -8px;
  padding: 6px 8px;
  border-radius: 6px;
}
.cd-file:hover { background: rgba(161, 189, 217, 0.05); }
.cd-file-thumb {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 72px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--kind, #2c333a);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.cd-file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cd-file-info { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.cd-file-name {
  color: #dee4ea;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cd-file-meta { font-size: 12px; color: var(--cd-text-subtle); }
.cd-cover-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  height: 20px;
  padding: 0 6px;
  border-radius: 3px;
  background: var(--cd-btn-hover);
  color: var(--cd-text);
  font-size: 11px;
  font-weight: 600;
}
.cd-file-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

/* Comments & activity */
.cd-composer { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 20px; }
.cd-composer-box { flex: 1 1 auto; min-width: 0; }
.cd-composer textarea {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--cd-border);
  border-radius: 8px;
  background: var(--cd-bg);
  color: var(--cd-text);
  font-size: 14px;
  line-height: 1.45;
  resize: none;
  overflow: hidden;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
  transition: min-height 0.15s ease, border-color 0.15s ease;
}
.cd-composer textarea::placeholder { color: var(--cd-text-subtle); }
.cd-composer textarea:focus { outline: none; border-color: #85b8ff; box-shadow: inset 0 0 0 1px #85b8ff; }
.cd-composer-actions { display: none; align-items: center; gap: 8px; margin-top: 8px; }
.cd-composer.is-active textarea { min-height: 84px; }
.cd-composer.is-active .cd-composer-actions { display: flex; }
.cd-composer-actions .cd-hint { margin-left: auto; }

.cd-thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.cd-entry { display: flex; align-items: flex-start; gap: 8px; }
.cd-entry-body { flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 1.45; }
.cd-entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.cd-entry-head b,
.cd-entry-activity b { color: #dee4ea; font-weight: 600; }
.cd-time { font-size: 12px; color: var(--cd-text-subtle); text-decoration: none; }
a.cd-time:hover { text-decoration: underline; color: var(--cd-text); }
.cd-entry-activity .cd-time { display: block; margin-top: 2px; }
.cd-bubble {
  margin-top: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--cd-bubble);
  color: var(--cd-text);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  transition: box-shadow 0.2s ease;
}
.cd-entry.is-flash .cd-bubble { box-shadow: 0 0 0 2px #579dff; }
.cd-mention { color: var(--cd-link); font-weight: 500; }
.cd-entry-actions { margin-top: 2px; }
.cd-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--cd-text-subtle);
  font-size: 12px;
  text-decoration: underline;
}
.cd-link:hover { color: var(--cd-text); }

/* Dark dropdowns inside the modal */
.cd-modal .dropdown-menu {
  min-width: 240px;
  border: 1px solid var(--cd-border);
  background: #282e33;
  color: var(--cd-text);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.45) !important;
}
.cd-modal .dropdown-header { color: var(--cd-text-subtle); }
.cd-modal .dropdown-item { color: var(--cd-text); }
.cd-modal .dropdown-item:hover,
.cd-modal .dropdown-item:focus { background: var(--cd-btn-hover); color: #dee4ea; }
.cd-modal .dropdown-item.active,
.cd-modal .dropdown-item:active {
  background: #1c2b41;
  color: #85b8ff;
  box-shadow: inset 2px 0 0 #579dff;
}
.cd-modal .dropdown-item.text-danger-emphasis { color: #fd9891 !important; }
.cd-modal .dropdown-divider { border-color: var(--cd-border); }
.cd-modal .btn-primary {
  --bs-btn-bg: #579dff;
  --bs-btn-border-color: #579dff;
  --bs-btn-color: #1d2125;
  --bs-btn-hover-bg: #85b8ff;
  --bs-btn-hover-border-color: #85b8ff;
  --bs-btn-hover-color: #1d2125;
  --bs-btn-active-bg: #cce0ff;
  --bs-btn-active-border-color: #cce0ff;
  --bs-btn-active-color: #1d2125;
}

/* 14. Toasts ------------------------------------------------- */
.qp-toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.qp-toast {
  width: auto;
  max-width: min(420px, calc(100vw - 32px));
  border: 0;
  border-radius: 10px;
  background: #172b4d;
  color: #fff;
  box-shadow: 0 8px 20px rgba(9, 30, 66, 0.35);
  pointer-events: auto;
}
.qp-toast-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 14px;
  font-size: 14px;
}
.qp-toast-body > span { flex: 1 1 auto; }
.qp-toast-body > .bi { color: #4bce97; font-size: 1.05rem; }
.qp-toast-body > .bi.bi-info-circle,
.qp-toast-body > .bi.bi-archive { color: #85b8ff; }
.qp-toast-body > .bi.bi-exclamation-circle { color: #f87168; }
.qp-toast-action {
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #85b8ff;
  font-weight: 600;
}
.qp-toast-action:hover { background: rgba(255, 255, 255, 0.1); }
.qp-toast .btn-close { margin: 0; padding: 0; width: 36px; height: 36px; box-sizing: border-box; background-size: 10px; }

/* 15. Responsive — tablet (≤ 991.98px) ----------------------- */
@media (max-width: 1199.98px) {
  .search-box:focus-within { width: 320px; }
}

@media (max-width: 991.98px) {
  .brand-text { display: none; }
  .search-box { width: 184px; }
  .search-box:focus-within { width: 240px; }
  .search-kbd { display: none; }
  .search-input { padding-right: 0.6rem; }   /* no "/" hint here, so reclaim its space */
  .board-title { max-width: 200px; }
  .board-title-wrap .bh-icon-btn { display: none; }
}

/* 16. Responsive — mobile (< 768px) -------------------------- */
@media (max-width: 767.98px) {
  /* --- Header: swap dual bars for compact mobile header --- */
  .topbar,
  .board-header { display: none; }
  .mobile-header { display: flex; }
  .m-search-bar { display: block; }

  /* --- Canvas: the ONLY horizontal scroller; one focused column + peek of the next ---
     Height = viewport − 52px header (− 56px search bar while it's open). */
  .kanban-canvas {
    display: flex;
    width: 100%;
    max-width: 100vw;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-padding-inline: 14px;
    overscroll-behavior-x: contain;
    padding: 12px 14px 80px 14px;      /* bottom space keeps lists clear of the FAB */
    gap: 12px;
    height: calc(100vh - var(--m-header-h) - var(--m-search-h) - var(--safe-top));
    height: calc(100dvh - var(--m-header-h) - var(--m-search-h) - var(--safe-top));
    transition: height 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    scrollbar-width: none;
  }
  .kanban-canvas::-webkit-scrollbar { display: none; }

  /* Free horizontal scroll while dragging, so auto-scroll isn't fought by snapping */
  body.is-dragging .kanban-canvas { scroll-snap-type: none; }

  /* Applies to columns created at runtime too: they use the same .kanban-list markup */
  .kanban-list,
  .add-list {
    width: min(86vw, 320px);           /* 86% of narrow phones, capped at 320px on wider ones */
    flex-shrink: 0;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }
  .add-list-input { height: var(--touch); font-size: 16px; }   /* 16px: no iOS zoom on focus */
  .add-list-actions .btn { min-height: var(--touch); }
  .add-list-cancel { width: var(--touch); height: var(--touch); }
  .column-title-input { font-size: 16px; }

  .kanban-list { padding: 8px 8px 6px; }
  /* Each column scrolls vertically on its own */
  .kanban-cards-list {
    overflow-y: auto;
    max-height: calc(100dvh - 180px);
    -webkit-overflow-scrolling: touch;
    gap: 10px;
  }
  .kanban-list-title { font-size: 15px; }
  .card-content { padding: 10px 12px; }
  .kanban-card:active:not(.card-chosen) { background: #f7f8f9; }
  .list-action-btn { width: var(--touch); height: var(--touch); margin: -6px -4px -6px 0; }
  .btn-add-card { height: var(--touch); font-size: 15px; }

  .mobile-fab { display: flex; }

  .dropdown-item { min-height: var(--touch); }

  /* Toasts sit above the FAB, centered */
  .qp-toasts {
    left: 14px;
    right: 14px;
    bottom: calc(86px + var(--safe-bottom));
    align-items: center;
  }
  .qp-toast-action { min-height: var(--touch); }
  .qp-toast .btn-close { width: var(--touch); height: var(--touch); }

  /* --- Modals → bottom sheets --- */
  .qp-modal .modal-dialog {
    margin: 0;
    max-width: none;
    width: 100%;
    min-height: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
  }
  .qp-modal .modal-content {
    width: 100%;
    max-height: calc(100% - 12px - var(--safe-top));
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 30px rgba(9, 30, 66, 0.25);
  }
  .qp-modal.fade .modal-dialog {
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .qp-modal.show .modal-dialog { transform: none; }
  .qp-modal .sheet-handle { display: block; }

  .qp-modal .modal-header { padding: 6px 8px 8px 16px; touch-action: none; }
  .qp-modal .modal-body { padding: 4px 16px 24px; overscroll-behavior: contain; }
  .qp-modal .modal-footer {
    flex-wrap: nowrap;
    padding: 10px 16px calc(10px + var(--safe-bottom));
  }
  .qp-modal .modal-footer .btn { flex: 1 1 0; min-height: 48px; font-size: 15px; }

  /* New Ticket: stack 70/30 into a single column */
  .qp-layout { grid-template-columns: 1fr; gap: 20px; }
  .qp-side { position: static; }

  /* Touch targets ≥ 44 × 44 */
  .qp-modal .btn,
  .qp-modal .form-select,
  .qp-modal .form-control:not(textarea) { min-height: var(--touch); }
  .qp-modal .btn-sm { padding: 0 16px; font-size: 14px; }
  .qp-modal .btn-close,
  .qp-sheet .btn-close {
    width: var(--touch);
    height: var(--touch);
    padding: 0;
    margin: 0 0 0 auto;                /* keep pinned to the right edge */
    box-sizing: border-box;
    background-size: 14px;
    flex-shrink: 0;
  }
  .qp-modal .form-control,
  .qp-modal .form-select { font-size: 16px; }   /* prevents iOS zoom on focus */
  .pp-option span { height: var(--touch); font-size: 14px; }
  .priority-picker { grid-template-columns: repeat(4, 1fr); }
  .pp-option span { justify-content: center; padding: 0 6px; }

  /* Attachments become a horizontal swipe slider */
  .attach-grid {
    display: grid;
    grid-auto-flow: column;
    grid-template-columns: none;
    grid-auto-columns: 46%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    margin: 0 -16px;
    padding: 2px 16px 6px;
    scroll-padding-inline: 16px;
    scrollbar-width: none;
  }
  .attach-grid::-webkit-scrollbar { display: none; }
  .attach-tile,
  .attach-add { scroll-snap-align: start; }

  .dropzone-desktop { display: none; }
}

/* 16b. Card details modal — mobile (< 768px) -----------------
   Full-screen, single vertical scroll:
   cover banner → title & meta → description → attachments → comments & activity */
@media (max-width: 767.98px) {
  .cd-modal .modal-dialog {
    margin: 0;
    max-width: 100%;
    width: 100%;
    min-height: 100%;
    height: 100%;
    align-items: stretch;
  }
  .cd-modal .modal-content.cd-content {
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .cd-modal .sheet-handle { display: none; }
  .cd-scroll {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* Cover: 120px so content isn't pushed too far down */
  .cd-cover { min-height: calc(68px + var(--safe-top)); }
  .cd-cover.has-cover { height: calc(120px + var(--safe-top)); }
  .cd-cover-img { height: calc(120px + var(--safe-top)); }
  .cd-cover-controls { padding: calc(12px + var(--safe-top)) 8px 0 12px; }

  /* Force the 65% / 35% split into one vertical stack */
  .modal-body-wrapper {
    flex-direction: column !important;
  }
  .modal-main-content, .modal-sidebar-content {
    width: 100% !important;
  }
  .cd-main,
  .cd-activity { flex: 0 0 auto; overflow: visible; }
  .cd-main { padding: 16px 16px 8px; }
  .cd-activity {
    padding: 20px 16px calc(24px + var(--safe-bottom));
    border-left: 0;
    border-top: 1px solid var(--cd-border);
  }

  .cd-title { font-size: 20px; }
  .cd-quick,
  .cd-meta,
  .cd-section { margin-left: 0; }
  .cd-quick { margin-top: 14px; }
  .cd-main .cd-section-head h3 > i { margin-left: 0; }
  .cd-section { margin-top: 24px; }
  .cd-section-head h3 { min-width: 0; }

  /* Quick actions: horizontal swipe row instead of wrapping */
  .cd-quick {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-left: -16px;
    margin-right: -16px;
    padding: 0 16px 2px;
    scrollbar-width: none;
  }
  .cd-quick::-webkit-scrollbar { display: none; }

  .cd-meta { gap: 14px 20px; }

  /* Touch targets ≥ 44px */
  .cd-list-pill,
  .cd-icon-btn,
  .cd-btn,
  .cd-label { height: var(--touch); }
  .cd-icon-btn { min-width: var(--touch); }
  .cd-round-btn,
  .cd-square-btn,
  .cd-icon-plain { width: var(--touch); height: var(--touch); }
  .cd-avatars .avatar { width: 36px; height: 36px; }
  .cd-icon-btn-label { display: none; }

  /* Complete checkbox: 44px button, 26px visual circle */
  .cd-check {
    position: relative;
    width: var(--touch);
    height: var(--touch);
    margin: -9px -8px -9px -11px;
    border: 0 !important;
    background: transparent !important;
  }
  .cd-check::before {
    content: '';
    position: absolute;
    inset: 9px;
    border: 2px solid #738496;
    border-radius: 50%;
    transition: background-color 0.15s ease, border-color 0.15s ease;
  }
  .cd-check[aria-checked="true"]::before { background: #22a06b; border-color: #22a06b; }
  .cd-check i { position: relative; }

  .cd-check-item { min-height: var(--touch); }
  .cd-check-item .cd-icon-plain { opacity: 1; }
  .cd-check-item input { width: 20px; height: 20px; }
  .cd-file-thumb { width: 64px; height: var(--touch); }
  .cd-link { min-height: var(--touch); padding: 0 4px; margin-left: -4px; font-size: 13px; }
  a.cd-time { display: inline-block; padding: 14px 4px; margin: -14px -4px; }   /* 44px hit area, same layout */
  .cd-thread { gap: 12px; }
  .cd-modal .cd-input,
  .cd-composer textarea { font-size: 16px; min-height: var(--touch); }  /* 16px prevents iOS zoom */
  .cd-composer.is-active textarea { min-height: 96px; }
  .cd-composer-actions .btn,
  .cd-editor-actions .btn { min-height: var(--touch); }
  .cd-hint { display: none; }
}

/* 17. Responsive — small phones (≤ 480px, < 360px) ----------- */
@media (max-width: 480px) {

  .attach-grid { grid-auto-columns: 64%; }
  .priority-picker { grid-template-columns: repeat(2, 1fr); }

  .sheet-section { padding: 6px 12px 10px; }
  .chip { padding: 0 14px; }

  .qp-menu-name { font-size: 15px; }
}

/* Very narrow phones (320–359px) */
@media (max-width: 359.98px) {
  .mobile-header { padding-left: max(10px, env(safe-area-inset-left)); }
  .m-brand { gap: 6px; }
  .m-brand .brand-badge { width: 28px; height: 28px; }
  .m-board-name { font-size: 15px; padding: 4px; }
  .sheet-footer { grid-template-columns: 1fr 1.6fr; }
  .chip { padding: 0 12px; }
  .cd-main { padding-left: 12px; padding-right: 12px; }
  .cd-activity { padding-left: 12px; padding-right: 12px; }
  .cd-meta { gap: 12px 14px; }
  .cd-file { gap: 10px; }
  .cd-file-thumb { width: 52px; }
}

/* 18. Input-type & motion preferences ------------------------ */
@media (hover: hover) {
  .kanban-list-title:not(.is-editing):hover { background: var(--hover-subtle); }
  .kanban-card:hover {
    outline-color: var(--accent);
    box-shadow: 0 4px 10px rgba(9, 30, 66, 0.18), 0 0 1px rgba(9, 30, 66, 0.31);
  }
}

/* Coarse pointers (touch tablets ≥ 768px too): enlarge key targets */
@media (pointer: coarse) {
  .tb-icon-btn, .bh-icon-btn { width: 40px; height: 40px; }
  .bh-pill, .tb-btn, .btn-create { height: 40px; }
  .list-action-btn { width: var(--touch); height: var(--touch); }
  .btn-add-card { height: var(--touch); }
  .board-title-wrap .bh-icon-btn { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
