/* Components Design System */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-4);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.btn-sm {
  height: 30px;
  padding: 0 var(--space-3);
  font-size: 12.5px;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-hover);
}

.btn-danger {
  background-color: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background-color: #B91C1C;
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-sm {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

/* Form Controls */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.form-label .required-mark {
  color: var(--danger);
  margin-left: 2px;
}

.form-control,
.form-select {
  width: 100%;
  height: 36px;
  padding: 0 var(--space-3);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

textarea.form-control {
  height: auto;
  min-height: 80px;
  padding: var(--space-2) var(--space-3);
  resize: vertical;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

/* Cards & Panels */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: var(--space-5);
}

/* Dense Data Table (YouTrack Style) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table-dense {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table-dense th {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 10px var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table-dense td {
  padding: 10px var(--space-4);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-primary);
}

.table-dense tbody tr:hover {
  background-color: var(--bg-hover);
}

.issue-key-badge {
  font-family: monospace;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--primary);
  text-decoration: none;
}

.issue-key-badge:hover {
  text-decoration: underline;
}

/* Đã giải quyết / Resolved styling trong Issues Workspace */
.issue-table-row.is-resolved td {
  color: var(--text-muted);
}

.issue-table-row.is-resolved .issue-key-badge,
.issue-table-row.is-resolved .issue-title-text,
.issue-table-row.is-resolved .trigger-quick-view {
  color: var(--text-muted) !important;
  text-decoration: line-through !important;
}

.issue-table-row.is-resolved .issue-key-badge:hover,
.issue-table-row.is-resolved .issue-title-text:hover,
.issue-table-row.is-resolved .trigger-quick-view:hover {
  color: var(--text-secondary) !important;
}

/* Project Icon Badge (3-4 chữ cái hoa, nền màu riêng biệt của dự án) */
.project-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 10px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
  line-height: 1.3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  text-transform: uppercase;
}

/* Kanban Card Modern Styling */
.kanban-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  height: auto;
  min-height: fit-content;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-focus);
}

.kanban-card-top-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.4;
  margin-bottom: 6px;
}

.kanban-card-top-content {
  display: block;
  line-height: 1.4;
  margin-bottom: 4px;
}

.kanban-card-top-content .issue-key-badge {
  display: inline-flex;
  vertical-align: middle;
}

.kanban-card-title {
  display: inline;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.35;
  word-break: break-word;
}

.kanban-card-title:hover {
  color: var(--primary);
}

.kanban-card-fields-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--border-color);
  font-size: 11px;
}

/* Issue Detail Workspace (2-Column Layout) */
.workspace-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--space-6);
  align-items: start;
}

@media (max-width: 1024px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }
}

.workspace-main {
  min-width: 0;
}

.issue-header-area {
  margin-bottom: var(--space-5);
}

.issue-key-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-top: var(--space-2);
}

.issue-description-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Properties Panel (Right Column) */
.properties-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.properties-panel-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-color);
}

.property-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

/* 1-Line Modern Attribute Row Layout (YouTrack / Linear Style) */
.property-row-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--space-3);
  font-size: 12.5px;
}

.property-row-inline .property-label {
  color: var(--text-muted);
  font-weight: 500;
  width: 95px;
  flex-shrink: 0;
  margin: 0;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.property-row-inline .property-val {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.property-row-inline .property-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  font-size: 12.5px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.property-row-inline .property-link:hover {
  text-decoration: underline;
}

.property-inline-control {
  width: 100% !important;
  max-width: 180px;
  height: 28px !important;
  font-size: 12px !important;
  padding: 0 8px !important;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.property-inline-control:focus {
  border-color: var(--primary) !important;
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* Đảm bảo icon lịch của input[type="date"] luôn hiển thị rõ ràng và có thể click */
input[type="date"].property-inline-control,
input[type="date"].form-control {
  cursor: pointer;
}

input[type="date"].property-inline-control::-webkit-calendar-picker-indicator,
input[type="date"].form-control::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
  filter: invert(0.4);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

input[type="date"].property-inline-control::-webkit-calendar-picker-indicator:hover,
input[type="date"].form-control::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  transform: scale(1.1);
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.9);
}

.property-label {
  color: var(--text-muted);
  font-weight: 500;
  width: 110px;
  flex-shrink: 0;
}

.property-value {
  flex: 1;
  text-align: right;
  color: var(--text-primary);
  font-weight: 500;
}

/* ==========================================================================
   YouTrack Style Unified Activity Timeline
   ========================================================================== */
.yt-activity-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-5);
}

.yt-tabs-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface-2);
}

.yt-filter-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 8px;
  height: 28px;
  border-radius: var(--radius-full, 9999px);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
  user-select: none;
}

.yt-filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.yt-filter-btn.active {
  background: var(--primary-light, rgba(99, 102, 241, 0.12));
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.yt-filter-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 9999px;
  background: var(--bg-hover);
  color: var(--text-muted);
}

.yt-filter-btn.active .yt-filter-badge {
  background: var(--primary);
  color: #fff;
}

.yt-activity-body {
  padding: 20px;
}

.youtrack-activity-feed {
  position: relative;
  padding-left: 44px;
  min-height: 40px;
}

.youtrack-activity-feed::before {
  content: '';
  position: absolute;
  left: 17px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background-color: var(--border-color);
}

.yt-timeline-entry {
  position: relative;
  margin-bottom: 22px;
  font-size: 13px;
}

.yt-timeline-entry:last-child {
  margin-bottom: 6px;
}

/* 1. History Block Start Icon */
.yt-node-history {
  position: absolute;
  left: -44px;
  top: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--bg-surface-2, #1e293b);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  z-index: 2;
}

/* 2. History Continuation Dot */
.yt-node-dot {
  position: absolute;
  left: -33.5px;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
  z-index: 2;
  box-shadow: 0 0 0 3px var(--bg-surface);
}

/* 3. Comment User Avatar */
.yt-node-avatar {
  position: absolute;
  left: -44px;
  top: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #06b6d4;
  color: #ffffff;
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  z-index: 2;
  box-shadow: 0 0 0 2px var(--bg-surface);
}

/* Content Container */
.yt-entry-content {
  display: flex;
  flex-direction: column;
}

.yt-entry-header {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
  margin-bottom: 3px;
}

.yt-entry-author {
  color: #38bdf8;
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
}

.yt-entry-author:hover {
  text-decoration: underline;
}

.yt-entry-dot {
  color: #22c55e;
  font-size: 12px;
}

.yt-entry-meta {
  color: var(--text-muted, #94a3b8);
  font-size: 12.5px;
}

/* Change Rows */
.yt-change-row {
  color: var(--text-muted, #94a3b8);
  font-size: 13px;
  line-height: 1.6;
}

.yt-change-field {
  color: var(--text-muted, #94a3b8);
  margin-right: 5px;
}

.yt-change-values {
  color: var(--text-primary, #f8fafc);
  font-weight: 600;
}

.yt-change-arrow {
  color: var(--text-muted, #94a3b8);
  font-weight: normal;
  margin: 0 5px;
}

.yt-change-details {
  display: inline-block;
  margin-left: 2px;
}

.yt-change-details summary {
  color: #38bdf8;
  cursor: pointer;
  outline: none;
  font-weight: 500;
}

.yt-change-details summary:hover {
  text-decoration: underline;
}

.yt-grouped-changes {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.yt-subchange-item {
  display: block;
  line-height: 1.5;
}

.yt-diff-box {
  margin-top: 6px;
  padding: 8px 12px;
  background: var(--bg-canvas, #090d16);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  white-space: pre-wrap;
  line-height: 1.4;
}

/* Comment Body */
.yt-comment-body {
  color: var(--text-primary, #f1f5f9);
  font-size: 13.5px;
  line-height: 1.6;
  margin-top: 2px;
}

.yt-comment-body strong {
  color: var(--text-primary);
  font-weight: 700;
}

.timeline-embedded-image {
  margin-top: 10px;
  max-width: 100%;
}

.timeline-embedded-image img {
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  display: block;
  transition: transform 0.15s ease;
}

.timeline-embedded-image img:hover {
  transform: scale(1.01);
}

.user-mention {
  color: #38bdf8;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.1);
  padding: 1px 4px;
  border-radius: 3px;
}

/* Custom Modal Dialog (Replaces native alert/confirm) */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-dialog);
  width: 100%;
  max-width: 480px;
  transform: scale(0.96);
  transition: transform 0.2s ease;
}

#quick-create-modal .modal-dialog {
  max-width: 820px;
  width: 92vw;
  height: auto;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#quick-create-modal form {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

#quick-create-modal .modal-body {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  padding-right: var(--space-4);
  display: flex;
  flex-direction: column;
}

.modal-backdrop.active .modal-dialog {
  transform: scale(1);
}

.modal-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-5);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-footer {
  padding: var(--space-3) var(--space-5);
  background-color: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* Safe Delete OTP PIN Styling */
.safe-delete-otp-container {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.safe-delete-pin-cell {
  width: 44px;
  height: 52px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-family: monospace;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.safe-delete-pin-cell:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
  transform: translateY(-1px);
}

.safe-delete-pin-cell.is-matched {
  border-color: var(--success);
  background-color: rgba(22, 163, 74, 0.05);
  color: var(--success);
}

/* Alerts */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.alert-danger {
  background-color: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.alert-success {
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(22, 163, 74, 0.2);
}

/* User Avatar Helper */
.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

/* ========================================================
   Phase 2: Side Drawer Quick View (Không rời trang)
   ======================================================== */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(1px);
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
}

.drawer-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 920px;
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-dialog);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.2s ease;
  z-index: 81;
  border-left: 1px solid var(--border-color);
}

.drawer-panel.drawer-expanded {
  max-width: 75vw;
  min-width: 680px;
}

.drawer-backdrop.active .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  height: var(--topbar-height);
  padding: 0 var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  background-color: var(--bg-surface);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
}

.drawer-layout-2col {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-5);
  align-items: start;
}

.drawer-col-main {
  min-width: 0;
}

.drawer-col-properties {
  min-width: 0;
}

@media (max-width: 820px) {

  .drawer-panel,
  .drawer-panel.drawer-expanded {
    max-width: 96vw;
    min-width: 0;
  }

  .drawer-layout-2col {
    grid-template-columns: 1fr;
  }
}

/* ========================================================
   Phase 2: Command Palette (Ctrl/Cmd + K)
   ======================================================== */
.command-backdrop {
  z-index: 95;
}

.command-dialog {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-dialog);
  width: 100%;
  max-width: 560px;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s ease;
}

.command-backdrop.active .command-dialog {
  transform: scale(1);
}

.command-search-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px var(--space-4);
  border-bottom: 1px solid var(--border-color);
}

.command-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 14.5px;
  outline: none;
  font-family: inherit;
}

.command-esc-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-muted);
}

.command-results-container {
  max-height: 380px;
  overflow-y: auto;
  padding: var(--space-2);
}

.command-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  padding: 8px var(--space-3) 4px;
}

.command-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13.5px;
  text-decoration: none;
  transition: background-color 0.1s ease;
}

.command-item:hover,
.command-item.selected {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.command-item-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.command-kbd {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  background-color: var(--bg-hover);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* ========================================================
   Phase 2: Floating Bulk Actions Bar
   ======================================================== */
.floating-bulk-bar {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  background-color: #0F172A;
  color: #FFFFFF;
  padding: var(--space-3) var(--space-6);
  border-radius: 50px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 20px);
    opacity: 0;
  }

  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* ========================================================
   Phase 2: Drag & Drop Zone & Progress Bar
   ======================================================== */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
  cursor: pointer;
  background-color: var(--bg-surface);
  transition: border-color 0.15s, background-color 0.15s;
}

.drop-zone.drag-over {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background-color: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary);
  width: 0%;
  transition: width 0.15s ease;
}

/* ========================================================
   Phase 2: Collapsed Sidebar
   ======================================================== */
.app-sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.app-sidebar.collapsed .brand-name,
.app-sidebar.collapsed .nav-group-title,
.app-sidebar.collapsed .nav-item span,
.app-sidebar.collapsed .user-name,
.app-sidebar.collapsed .logout-btn {
  display: none !important;
}

.app-sidebar.collapsed .sidebar-header {
  justify-content: center !important;
  padding: 12px 0 !important;
}

.app-sidebar.collapsed .sidebar-header .sidebar-collapse-trigger {
  display: none !important;
}

.app-sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}

.app-sidebar.collapsed .sidebar-footer {
  flex-direction: column !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 10px 4px !important;
}

.app-sidebar.collapsed .sidebar-user-info {
  justify-content: center !important;
  flex: none !important;
}

.app-sidebar.collapsed .sidebar-actions {
  flex-direction: column !important;
  align-items: center !important;
  gap: 6px !important;
}

/* User Avatar Dropdown Context Menu */
.sidebar-user-dropdown {
  position: relative;
  flex: 1;
  min-width: 0;
}

.app-sidebar.collapsed .sidebar-user-dropdown {
  flex: none;
  display: flex;
  justify-content: center;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.sidebar-user-info:hover {
  background: var(--bg-hover);
}

.sidebar-user-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 210px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dialog);
  padding: 6px;
  z-index: 1100;
  display: none;
  flex-direction: column;
  gap: 2px;
  animation: popoverShowUpward 0.15s ease-out;
}

.sidebar-user-dropdown.is-open .sidebar-user-menu {
  display: flex;
}

.app-sidebar.collapsed .sidebar-user-menu {
  left: calc(100% + 8px);
  bottom: 0;
}

.sidebar-user-menu-header {
  padding: 8px 10px;
}

.sidebar-user-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

.sidebar-user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  text-align: left;
}

.sidebar-user-menu-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-user-menu-item.text-danger {
  color: var(--danger);
}

.sidebar-user-menu-item.text-danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* Xoay ngược icon mũi tên sang phải (>> expand) khi sidebar đang thu gọn */
.app-sidebar.collapsed .collapse-icon {
  transform: rotate(180deg);
}

.app-main.collapsed {
  margin-left: var(--sidebar-collapsed-width);
}

/* ========================================================
   Phase 2: Toast Notifications Container
   ======================================================== */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 120;
  pointer-events: none;
}

.toast-message {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  pointer-events: auto;
  animation: toastIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
  from {
    transform: translateY(12px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ========================================================
   Quill.js Rich Text Editor Styling (Word / YouTrack Style)
   ======================================================== */
.wetrack-quill-wrapper {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.wetrack-quill-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* Quill Toolbar - Dạng thanh Ribbon gọn nhẹ của Word */
.ql-toolbar.ql-snow {
  background-color: var(--bg-surface-2, #EEF0F3) !important;
  border: none !important;
  border-bottom: 1px solid var(--border-color) !important;
  border-top-left-radius: var(--radius-md) !important;
  border-top-right-radius: var(--radius-md) !important;
  padding: 6px 10px !important;
  font-family: inherit !important;
}

/* Biểu tượng nút bấm trên toolbar */
.ql-snow .ql-stroke {
  stroke: var(--text-secondary) !important;
}

.ql-snow .ql-fill {
  fill: var(--text-secondary) !important;
}

.ql-snow .ql-picker {
  color: var(--text-secondary) !important;
  font-size: 12.5px !important;
}

.ql-snow .ql-picker-options {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-dialog) !important;
  border-radius: var(--radius-md) !important;
  padding: 4px !important;
}

.ql-snow .ql-picker-item:hover,
.ql-snow .ql-picker-item.ql-selected {
  color: var(--primary) !important;
  background-color: var(--bg-hover) !important;
}

.ql-snow button:hover,
.ql-snow button.ql-active,
.ql-snow .ql-picker-label:hover,
.ql-snow .ql-picker-label.ql-active {
  color: var(--primary) !important;
}

.ql-snow button:hover .ql-stroke,
.ql-snow button.ql-active .ql-stroke {
  stroke: var(--primary) !important;
}

.ql-snow button:hover .ql-fill,
.ql-snow button.ql-active .ql-fill {
  fill: var(--primary) !important;
}

/* Quill Editor Area - Trang giấy văn bản Word liền mạch */
.ql-container.ql-snow {
  border: none !important;
  font-family: inherit !important;
  font-size: 13.5px !important;
  color: var(--text-primary) !important;
  background-color: var(--bg-surface) !important;
  border-bottom-left-radius: var(--radius-md) !important;
  border-bottom-right-radius: var(--radius-md) !important;
}

.ql-editor {
  padding: 12px 16px !important;
  min-height: 120px;
  line-height: 1.65;
  color: var(--text-primary) !important;
}

.ql-editor.ql-blank::before {
  color: var(--text-muted) !important;
  font-style: normal !important;
  left: 16px !important;
}

.ql-editor p {
  margin-bottom: 6px !important;
}

.ql-editor h1, .ql-editor h2, .ql-editor h3 {
  font-weight: 700 !important;
  color: var(--text-primary) !important;
  margin: 12px 0 6px 0 !important;
}

.ql-editor blockquote {
  border-left: 3px solid var(--primary) !important;
  padding-left: 12px !important;
  margin: 8px 0 !important;
  color: var(--text-secondary) !important;
  background-color: var(--bg-subtle) !important;
  border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
  padding: 6px 12px !important;
}

.ql-editor pre.ql-syntax,
.ql-editor pre {
  background-color: var(--bg-subtle) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  padding: 8px 12px !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-size: 12.5px !important;
}

/* Trường hợp container drawer desc */
#drawer-desc-editor .wetrack-quill-wrapper {
  border: none !important;
  box-shadow: none !important;
}

#qc-description-editor .ql-editor {
  min-height: 140px !important;
  max-height: calc(90vh - 350px) !important;
}

.wetrack-editor-compact .ql-editor {
  min-height: 70px !important;
  padding: 8px 12px !important;
}

.wetrack-editor-container.has-topbar {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: none;
}

.editor-topbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.editor-topbar-divider {
  width: 1px;
  height: 16px;
  background-color: var(--border-color);
  margin: 0 4px;
}

.editor-topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  padding: 0;
}

.editor-topbar-btn:hover {
  background-color: var(--bg-hover);
  color: var(--primary);
}

.editor-topbar-btn:active {
  transform: scale(0.95);
}

.editor-topbar-dropdown-wrapper {
  position: relative;
  display: inline-flex;
}

.editor-topbar-color-btn {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.editor-topbar-color-btn .color-indicator {
  width: 12px;
  height: 2.5px;
  border-radius: 1px;
}

.editor-color-palette-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dialog);
  padding: 8px;
  z-index: 1000;
  display: none;
  width: 156px;
}

.editor-color-palette-dropdown.is-show {
  display: block;
}

.color-palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  padding: 0;
  transition: transform var(--transition-fast);
}

.color-swatch:hover {
  transform: scale(1.18);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.color-palette-footer {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.color-reset-btn {
  font-size: 11px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.color-reset-btn:hover {
  color: var(--primary);
  background-color: var(--bg-hover);
}

.editor-topbar-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  padding-right: 6px;
}

.wetrack-editor-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

#drawer-desc-editor .wetrack-quill-wrapper,
#drawer-desc-editor .wetrack-quill-wrapper:focus-within {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

#qc-description-editor {
  min-height: 140px;
  overflow: hidden;
}

.wetrack-editor-compact {
  min-height: 80px;
  padding: 8px 12px;
}

/* Codex Editor Core Overrides (Đảm bảo độ tương phản cao, không bị chìm màu) */
.codex-editor {
  text-align: left;
  color: var(--text-primary) !important;
}

.codex-editor__redactor {
  padding-bottom: 8px !important;
  margin-right: 0 !important;
}

.ce-block {
  margin-bottom: 0 !important;
}

.ce-block:last-child {
  margin-bottom: 0 !important;
}

/* Khối văn bản liền mạch như Microsoft Word / YouTrack (Không viền thẻ riêng, không bóng) */
.ce-block__content {
  max-width: 100% !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 2px 0 !important;
  background-color: transparent !important;
  box-shadow: none !important;
  transition: none !important;
}

/* Bỏ viền khi hover và focus từng dòng */
.ce-block:hover .ce-block__content,
.ce-block:focus-within .ce-block__content {
  border: none !important;
  box-shadow: none !important;
  background-color: transparent !important;
}

.ce-toolbar__content {
  max-width: 100% !important;
}

/* Các loại khối văn bản bên trong Editor.js */
.ce-paragraph,
.ce-header,
.cdx-list__item,
.cdx-checklist__item-text,
.codex-editor [contenteditable] {
  color: var(--text-primary) !important;
  caret-color: var(--text-primary) !important;
}

.ce-paragraph {
  font-size: 13.5px;
  line-height: 1.65;
  margin: 2px 0 6px 0 !important;
}

.ce-header {
  font-weight: 700;
  margin: 12px 0 6px 0;
  line-height: 1.4;
}

/* Fix dứt điểm Placeholder: Rõ ràng, dễ đọc, không bị mờ đục hoặc trắng trên nền trắng */
.codex-editor [data-placeholder]:empty:before,
.codex-editor [data-placeholder]:empty::before,
.ce-paragraph[data-placeholder]:empty:before,
.ce-paragraph[data-placeholder]:empty::before,
.ce-header[data-placeholder]:empty:before,
.ce-header[data-placeholder]:empty::before {
  color: var(--text-muted) !important;
  opacity: 1 !important;
  -webkit-text-fill-color: var(--text-muted) !important;
  font-style: normal !important;
  font-weight: 400 !important;
}

/* Khối Code bên trong Editor.js */
.ce-code__textarea {
  background-color: var(--bg-subtle) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-size: 12.5px !important;
  line-height: 1.5 !important;
  padding: 10px 12px !important;
}

/* Khối Table bên trong Editor.js */
.tc-table {
  border-color: var(--border-color) !important;
}

.tc-cell {
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
  background-color: var(--bg-surface) !important;
  padding: 6px 10px !important;
  font-size: 13px !important;
}

.tc-row--header .tc-cell {
  background-color: var(--bg-subtle) !important;
  color: var(--text-primary) !important;
  font-weight: 600 !important;
}

/* Khối Checklist bên trong Editor.js */
.cdx-checklist {
  margin: 4px 0 !important;
}

.cdx-checklist__item {
  color: var(--text-primary) !important;
  padding: 4px 0 !important;
}

.cdx-checklist__item-checkbox-check {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
}

.cdx-checklist__item--checked .cdx-checklist__item-checkbox-check {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}

.cdx-checklist__item--checked .cdx-checklist__item-checkbox-check svg path {
  stroke: #ffffff !important;
}

.cdx-checklist__item-text {
  color: var(--text-primary) !important;
}

/* Khối Inline Code bên trong Editor.js */
.cdx-inline-code {
  background-color: var(--bg-subtle) !important;
  color: var(--primary) !important;
  border: 1px solid var(--border-color) !important;
  padding: 2px 5px !important;
  border-radius: var(--radius-sm) !important;
}

/* Khối Delimiter bên trong Editor.js */
.ce-delimiter:before {
  color: var(--text-muted) !important;
}

/* Khối Quote / Trích dẫn bên trong Editor.js */
.cdx-quote {
  border-left: 3px solid var(--primary) !important;
  padding: 8px 14px !important;
  margin: 8px 0 !important;
  background-color: var(--bg-subtle) !important;
  border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
}

.cdx-quote__text {
  min-height: 38px !important;
  margin-bottom: 0 !important;
  color: var(--text-primary) !important;
  font-style: italic;
  line-height: 1.6;
}

.cdx-quote__caption {
  display: none !important;
}

/* Khối Đang Được Chọn (Selected Block) - Fix nền xanh nhạt chói mắt */
.ce-block--selected .ce-block__content {
  background-color: var(--primary-light, rgba(99, 102, 241, 0.15)) !important;
  border-radius: var(--radius-sm) !important;
}

/* Ẩn hoàn toàn các nút nổi bên cạnh khối (Nút thêm + và Nút tùy chỉnh tune ::)
   Người dùng bôi đen chữ để hiện Inline Toolbar hoặc dùng thanh Top Toolbar như làm việc với Microsoft Word / YouTrack */
.ce-toolbar__plus,
.ce-toolbar__settings-btn,
.ce-toolbar__actions {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Popover Menu (Hộp chọn khối: Unordered, Ordered, Heading, Code, v.v.) */
.ce-popover,
.ce-popover__container,
.ce-inline-toolbar {
  --color-background: var(--bg-surface) !important;
  --color-text-primary: var(--text-primary) !important;
  --color-border: var(--border-color) !important;
  --color-background-item-hover: var(--bg-hover) !important;
  --color-background-item-focus: var(--bg-hover) !important;
  background-color: var(--bg-surface) !important;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-dialog) !important;
  border-radius: var(--radius-lg) !important;
  z-index: 1000 !important;
}

/* Khung Tìm Kiếm bên trong Popover (Filter) */
.cdx-search-field {
  background-color: var(--bg-subtle) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  padding: 4px 8px !important;
  margin-bottom: 6px !important;
}

.cdx-search-field__input {
  color: var(--text-primary) !important;
  font-size: 13px !important;
  background: transparent !important;
}

.cdx-search-field__input::placeholder,
.cdx-search-field__input::-webkit-input-placeholder {
  color: var(--text-muted) !important;
  opacity: 1 !important;
}

.cdx-search-field__icon svg {
  color: var(--text-muted) !important;
  fill: currentColor !important;
}

/* Các Mục Lựa Chọn bên trong Popover (Unordered, Ordered,...) */
.ce-popover-item {
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm) !important;
  padding: 6px 8px !important;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.ce-popover-item__title {
  color: var(--text-primary) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

.ce-popover-item__secondary-title {
  color: var(--text-muted) !important;
}

.ce-popover-item:hover,
.ce-popover-item:hover:not(.ce-popover-item--no-hover),
.ce-popover-item--focused,
.ce-popover-item--focused:not(.ce-popover-item--no-focus) {
  background-color: var(--bg-hover) !important;
}

.ce-popover-item:hover .ce-popover-item__title,
.ce-popover-item--focused .ce-popover-item__title {
  color: var(--primary) !important;
}

/* Icon của từng mục trong Popover */
.ce-popover-item__icon {
  background-color: var(--bg-subtle) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: none !important;
  width: 28px !important;
  height: 28px !important;
}

.ce-popover-item__icon svg {
  color: var(--text-primary) !important;
  fill: currentColor !important;
  width: 16px !important;
  height: 16px !important;
}

.ce-popover-item:hover .ce-popover-item__icon,
.ce-popover-item--focused .ce-popover-item__icon {
  background-color: var(--primary-light) !important;
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}

.ce-popover-item:hover .ce-popover-item__icon svg,
.ce-popover-item--focused .ce-popover-item__icon svg {
  color: var(--primary) !important;
  fill: currentColor !important;
}

.ce-popover-item-separator__line {
  background-color: var(--border-color) !important;
}

/* Inline Toolbar Tools */
.ce-inline-tool {
  color: var(--text-secondary) !important;
}

.ce-inline-tool:hover {
  background-color: var(--bg-hover) !important;
  color: var(--primary) !important;
}

.ce-inline-tool--active {
  background-color: var(--primary-light) !important;
  color: var(--primary) !important;
}

.cdx-input {
  background-color: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

/* ========================================================
   Inline Toolbar: Popup "Convert to" mở hướng lên trên (Upward)
   Giúp popup không bị tràn mép dưới màn hình, modal hoặc drawer
   ======================================================== */
.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container,
.ce-popover--inline .ce-popover--nested .ce-popover__container {
  --offset: 6px;
  left: 0 !important;
  top: auto !important;
  bottom: calc(100% + var(--offset, 6px)) !important;
  transform-origin: bottom left !important;
  max-height: min(280px, calc(100vh - 120px)) !important;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.28), 0 0 0 1px var(--border-color) !important;
}

/* Đảo chiều mũi tên chevron của nút Convert thành hướng lên trên */
.ce-popover--inline .ce-popover-item__icon--chevron-right {
  -webkit-transform: rotate(-90deg) !important;
  transform: rotate(-90deg) !important;
}

/* Animation mượt mà khi mở popup từ dưới lên */
@keyframes popoverShowUpward {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ce-popover--inline .ce-popover--nested-level-1.ce-popover--opened>.ce-popover__container,
.ce-popover--inline .ce-popover--nested.ce-popover--opened>.ce-popover__container {
  animation: popoverShowUpward 0.15s ease-out !important;
}

/* ========================================================
   Editor Rendered HTML Content Styles (Quill & Markdown)
   ======================================================== */
.editorjs-content,
.ql-editor-view {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-secondary);
  word-break: break-word;
}

.ql-editor-view p {
  margin-bottom: 8px;
}

.ql-editor-view strong,
.editorjs-content strong {
  color: var(--text-primary);
  font-weight: 700;
}

.ql-editor-view h1, .ql-editor-view h2, .ql-editor-view h3 {
  color: var(--text-primary);
  font-weight: 700;
  margin: 12px 0 6px 0;
  line-height: 1.35;
}

.ql-editor-view blockquote {
  border-left: 4px solid var(--primary);
  padding: 8px 14px;
  background-color: var(--bg-subtle);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 10px 0;
  color: var(--text-primary);
  font-style: italic;
}

.ql-editor-view pre {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  overflow-x: auto;
  margin: 10px 0;
  color: var(--text-primary);
}

.ql-editor-view ul, .ql-editor-view ol {
  padding-left: 22px;
  margin-bottom: 10px;
}

.editorjs-content .editorjs-header {
  color: var(--text-primary);
  font-weight: 700;
  margin: 12px 0 6px 0;
  line-height: 1.35;
}

.editorjs-content h1.editorjs-header {
  font-size: 19px;
}

.editorjs-content h2.editorjs-header {
  font-size: 17px;
}

.editorjs-content h3.editorjs-header {
  font-size: 15px;
}

.editorjs-content h4.editorjs-header {
  font-size: 14px;
}

.editorjs-content .editorjs-paragraph {
  margin-bottom: 8px;
}

.editorjs-content .editorjs-paragraph:last-child {
  margin-bottom: 0;
}

.editorjs-content .editorjs-list {
  padding-left: 22px;
  margin-bottom: 10px;
}

.editorjs-content .editorjs-list li {
  margin-bottom: 4px;
}

.editorjs-content .editorjs-checklist,
.ql-editor-view .editorjs-checklist,
.editorjs-content ul:has(.checklist-item),
.ql-editor-view ul:has(.checklist-item) {
  list-style: none;
  padding-left: 0;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.editorjs-content .checklist-item,
.ql-editor-view .checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13.5px;
  line-height: 1.5;
  padding: 3px 0;
  transition: all 0.2s ease;
}

.checklist-item input[type="checkbox"].interactive-checklist-checkbox {
  appearance: auto;
  -webkit-appearance: auto;
  cursor: pointer;
  width: 16px;
  height: 16px;
  margin-top: 2.5px;
  flex-shrink: 0;
  accent-color: var(--primary);
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.checklist-item input[type="checkbox"].interactive-checklist-checkbox:hover {
  transform: scale(1.1);
}

.checklist-item input[type="checkbox"].interactive-checklist-checkbox:disabled {
  opacity: 0.5;
  cursor: wait;
}

.checklist-item span {
  flex: 1;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.checklist-item.is-checked span {
  text-decoration: line-through;
  color: var(--text-muted);
  opacity: 0.75;
}

.editorjs-content .editorjs-code {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  overflow-x: auto;
  margin: 10px 0;
  color: var(--text-primary);
}

.editorjs-content .editorjs-delimiter {
  text-align: center;
  letter-spacing: 0.5em;
  color: var(--text-muted);
  margin: 16px 0;
  font-weight: 700;
  font-size: 14px;
}

.editorjs-content .editorjs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
}

.editorjs-content .editorjs-table th,
.editorjs-content .editorjs-table td {
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  text-align: left;
}

.editorjs-content .editorjs-table th {
  background-color: var(--bg-surface-2);
  font-weight: 600;
  color: var(--text-primary);
}

.editorjs-content .editorjs-image {
  margin: 12px 0;
  text-align: center;
}

.editorjs-content .editorjs-image img {
  max-width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.editorjs-content .editorjs-image figcaption {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Khối Quote Rendered HTML & Comment Body Blockquote */
.editorjs-content .editorjs-quote,
.yt-comment-body .editorjs-quote,
.yt-comment-body blockquote,
blockquote.editorjs-quote {
  border-left: 4px solid var(--primary) !important;
  margin: 10px 0 !important;
  padding: 8px 14px !important;
  background-color: var(--bg-subtle) !important;
  border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
  display: block !important;
}

.editorjs-content .editorjs-quote.is-center,
.yt-comment-body .editorjs-quote.is-center {
  text-align: center !important;
  border-left: none !important;
  border-top: 2px solid var(--primary) !important;
  border-bottom: 2px solid var(--primary) !important;
  border-radius: var(--radius-md) !important;
}

.editorjs-content .editorjs-quote-text,
.yt-comment-body .editorjs-quote-text,
.yt-comment-body blockquote p {
  margin: 0 !important;
  font-style: italic !important;
  line-height: 1.6 !important;
  color: var(--text-primary) !important;
}

.editorjs-content .editorjs-quote-caption {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-style: normal;
  margin-top: 4px;
}

/* Editor.js Inline Color Plugin & Popover Overrides */
.colorPlugin.ce-inline-tool {
  color: var(--text-primary) !important;
}

.colorPlugin.ce-inline-tool svg {
  fill: currentColor !important;
}

xy-popcon {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-dialog) !important;
}

.color-sign {
  background: var(--bg-surface) !important;
}

/* Grid Cell Inline Editing (Chỉnh sửa ngay trên Table/Grid) */
.grid-inline-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: none;
  border-bottom: 1px dashed var(--grid-border-fallback, var(--border-color));
  border-radius: 0;
  padding: 3px 18px 3px 4px;
  font-size: 11.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: right 2px center;
  background-size: 9px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  transition: all 0.15s ease;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
}

.grid-inline-select:hover {
  border-bottom-color: var(--text-muted);
  border-bottom-style: solid;
}

[data-theme="dark"] .grid-inline-select:hover {
}

.grid-inline-select:focus {
  outline: none;
  border-bottom: 1px solid var(--primary) !important;
  box-shadow: none !important;
  background-color: var(--bg-surface) !important;
  color: var(--text-primary) !important;
}

.grid-inline-select option {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12.5px;
  padding: 6px 10px;
}

.grid-inline-input {
  border: none;
  border-bottom: 1px dashed var(--grid-border-fallback, var(--border-color));
  border-radius: 0;
  padding: 3px 4px;
  font-size: 11.5px;
  font-family: inherit;
  background-color: transparent;
  color: var(--text-primary);
  transition: all 0.15s ease;
  max-width: 100%;
}

.grid-inline-input:hover {
  border-bottom-color: var(--text-muted);
  border-bottom-style: solid;
}

[data-theme="dark"] .grid-inline-input:hover {
}

.grid-inline-input:focus {
  outline: none;
  border-bottom: 1px solid var(--primary) !important;
  box-shadow: none !important;
  background-color: var(--bg-surface) !important;
}

.grid-inline-input[type="date"] {
  cursor: pointer;
  min-width: 118px;
}

.grid-inline-input[type="number"] {
  width: 75px;
}

/* ========================================================
   Pagination Component Styles (Chuẩn bàn làm việc gọn nhẹ YouTrack/Linear)
   ======================================================== */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.pagination-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.pagination-limit-select {
  height: 28px;
  padding: 0 20px 0 8px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pagination-btn:hover:not(.disabled):not(.active) {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.pagination-btn.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff !important;
  font-weight: 600;
  cursor: default;
}

.pagination-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

.pagination-ellipsis {
  padding: 0 4px;
  color: var(--text-dim);
}

/* ========================================================
   Smart Compact Attachments Widget (Linear / GitHub Refined)
   ======================================================== */
.attachment-widget {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
  transition: all 0.2s ease;
  position: relative;
}

.attachment-widget.dragover {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px var(--primary-light) !important;
  background-color: var(--primary-light);
}

.attachment-widget.dragover .attachment-widget-header {
  background-color: rgba(99, 102, 241, 0.12);
}

.attachment-widget.dragover .attachment-dropzone {
  border-color: var(--primary);
  background: var(--bg-surface);
}

.attachment-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
}

.attachment-widget-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.attachment-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.attachment-dropzone {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  margin: 10px 14px;
  background: var(--bg-page);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 12px;
  color: var(--text-muted);
}

.attachment-dropzone:hover,
.attachment-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.attachment-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.attachment-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  padding: 10px 14px 14px;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  position: relative;
  text-decoration: none;
  min-width: 0;
}

.attachment-chip:hover {
  background: var(--bg-surface-2);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-sm);
}

.attachment-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.attachment-icon-image {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.attachment-icon-pdf {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.attachment-icon-code {
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
}

.attachment-icon-doc {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.attachment-icon-archive {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.attachment-icon-other {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.attachment-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.attachment-filename {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}

.attachment-filename:hover {
  color: var(--primary);
}

.attachment-meta {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.attachment-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.attachment-chip:hover .attachment-actions {
  opacity: 1;
}

.attachment-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.15s ease;
  text-decoration: none;
}

.attachment-action-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.attachment-action-btn.delete-btn:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.attachment-empty-hint {
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
}

/* Biến thể hiển thị Card Ảnh trong danh sách Tệp đính kèm */
.attachment-card-image {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  gap: 0;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.attachment-image-preview-box {
  width: 100%;
  height: 110px;
  background-color: var(--bg-hover);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.attachment-image-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
  display: block;
}

.attachment-card-image:hover .attachment-image-preview-box img {
  transform: scale(1.04);
}

.attachment-image-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11.5px;
  gap: 6px;
  font-weight: 500;
}

.attachment-card-image:hover .attachment-image-overlay {
  opacity: 1;
}

.attachment-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-page);
  border-top: 1px solid var(--border-color);
  gap: 8px;
}

/* Biến thể Single-Line Horizontal Scroll cho Drawer Attachments */
#drawer-attachments-list {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  gap: 10px !important;
  padding: 8px 12px 12px !important;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

#drawer-attachments-list .attachment-chip {
  flex: 0 0 auto !important;
  width: 220px !important;
  max-width: 220px !important;
}

#drawer-attachments-list .attachment-card-image {
  flex: 0 0 auto !important;
  width: 180px !important;
  max-width: 180px !important;
}

#drawer-attachments-list .attachment-card-image .attachment-image-preview-box {
  height: 90px;
}

#drawer-attachments-list::-webkit-scrollbar {
  height: 6px;
}

#drawer-attachments-list::-webkit-scrollbar-track {
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
  border-radius: 999px;
}

#drawer-attachments-list::-webkit-scrollbar-thumb {
  background: var(--border-color, #cbd5e1);
  border-radius: 999px;
}

#drawer-attachments-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted, #94a3b8);
}

/* File Preview Modal Styles - Fullscreen Web Viewer */
.file-preview-backdrop {
  z-index: 2000;
  padding: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.file-preview-dialog {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

.file-preview-header {
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  flex-shrink: 0;
  z-index: 10;
}

.file-preview-body {
  padding: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  overflow: hidden;
  position: relative;
  user-select: none;
}

.file-preview-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: default;
  position: relative;
}

.file-preview-viewport.is-zoomed {
  cursor: grab;
}

.file-preview-viewport.is-dragging {
  cursor: grabbing !important;
}

.file-preview-image-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  transition: transform 0.05s ease-out;
  will-change: transform;
  width: 100%;
  height: 100%;
}

.file-preview-image-wrapper img {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: calc(100vh - 55px);
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.file-preview-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.file-preview-generic {
  padding: 40px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Member Role Cell Button / Badge Trigger */
.member-role-cell-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  text-align: left;
}

.member-role-cell-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.member-role-cell-btn .role-edit-icon {
  opacity: 0.6;
  font-size: 11px;
  transition: opacity 0.15s ease;
}

.member-role-cell-btn:hover .role-edit-icon {
  opacity: 1;
}

/* Modal Lựa chọn vai trò (2 cột: Label & Description) */
.role-select-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.role-select-table th {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.role-select-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.role-select-row td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.role-select-row:last-child td {
  border-bottom: none;
}

.role-select-row:hover td {
  background-color: var(--bg-hover);
}

.role-select-row.is-active td {
  background-color: rgba(59, 130, 246, 0.08);
}

.role-select-row .role-label-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12.5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm, 4px);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.role-select-row.is-active .role-label-badge {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(59, 130, 246, 0.12);
}

.role-select-desc-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  font-size: 13px;
}

.role-select-desc-text {
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.5;
}

/* ==========================================================================
   Welcome Popup (Bottom-Right Daily Greeting)
   ========================================================================== */
.wetrack-welcome-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  z-index: 1050;
  animation: welcomeSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
}

.wetrack-welcome-popup.closing {
  animation: welcomeSlideOut 0.25s ease-in forwards;
}

@keyframes welcomeSlideIn {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes welcomeSlideOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
}

.welcome-popup-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.16), 0 6px 16px -2px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.welcome-popup-progress-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .welcome-popup-progress-track {
  background: rgba(255, 255, 255, 0.06);
}

.welcome-popup-progress-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--primary, #3b82f6), #6366f1);
  border-radius: 0 2px 2px 0;
}

.welcome-popup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px 16px;
}

.welcome-popup-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.welcome-popup-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.welcome-popup-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.welcome-popup-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: capitalize;
}

.welcome-popup-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm, 4px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.welcome-popup-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.welcome-popup-body {
  padding: 0 16px 14px 16px;
}

.welcome-popup-notifs {
  background: var(--bg-subtle, rgba(0, 0, 0, 0.02));
  border: 1px solid var(--border-subtle, var(--border-color));
  border-radius: var(--radius-md, 8px);
  padding: 10px 12px;
}

.welcome-popup-notif-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 6px;
}

.welcome-notif-badge {
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  border-radius: 999px;
  text-align: center;
  padding: 0 5px;
}

.welcome-popup-notif-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.welcome-popup-notif-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.welcome-notif-bullet {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary, #3b82f6);
  flex-shrink: 0;
}

.welcome-notif-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.welcome-popup-empty-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md, 8px);
}

.welcome-empty-icon {
  color: var(--success, #10b981);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.welcome-empty-text {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.welcome-popup-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 16px 14px 16px;
  border-top: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.05));
  gap: 8px;
}

.welcome-popup-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   Custom Field Badge & Trigger Elements
   ========================================================================== */
.grid-field-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: var(--radius-sm, 5px);
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  max-width: 100%;
  box-sizing: border-box;
  text-decoration: none;
  background-color: var(--bg-subtle, rgba(0, 0, 0, 0.04));
  color: var(--text-primary);
}

.grid-field-badge:hover,
.grid-field-badge:focus-visible {
  filter: brightness(0.95);
  box-shadow: 0 0 0 1.5px rgba(59, 130, 246, 0.3);
  outline: none;
}

[data-theme="dark"] .grid-field-badge:hover,
[data-theme="dark"] .grid-field-badge:focus-visible {
  filter: brightness(1.15);
}

.grid-field-badge .badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.grid-field-badge .badge-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-field-badge.is-user-badge {
  background-color: transparent;
  border-color: transparent;
  color: var(--text-primary);
  font-size: 12px;
  padding: 1px 4px;
}

.grid-field-badge.is-user-badge:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-color);
}

.grid-field-badge.is-updating {
  opacity: 0.5;
  pointer-events: none;
}

/* ==========================================================================
   YouTrack-Style Custom Field Value Picker Popover
   ========================================================================== */
.cf-picker-popover {
  position: fixed;
  width: 360px;
  max-width: calc(100vw - 24px);
  max-height: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.22), 0 6px 16px -2px rgba(0, 0, 0, 0.12);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cfPickerPop 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  outline: none;
  backdrop-filter: blur(8px);
}

.cf-picker-popover.closing {
  animation: cfPickerFadeOut 0.12s ease-out forwards;
}

@keyframes cfPickerPop {
  0% {
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes cfPickerFadeOut {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.96);
  }
}

.cf-picker-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle, var(--border-color));
  background: var(--bg-subtle, rgba(0, 0, 0, 0.02));
}

.cf-picker-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm, 6px);
  padding: 0 10px;
  height: 32px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cf-picker-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.cf-picker-search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.cf-picker-search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 12.5px;
  color: var(--text-primary);
  font-family: inherit;
  padding: 0;
}

.cf-picker-search-input::placeholder {
  color: var(--text-muted);
}

.cf-picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
  max-height: 280px;
}

.cf-picker-list::-webkit-scrollbar {
  width: 5px;
}
.cf-picker-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.cf-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
}

.cf-picker-item:hover,
.cf-picker-item.is-highlighted {
  background: var(--bg-hover, rgba(59, 130, 246, 0.08));
}

.cf-picker-item.is-selected {
  background: rgba(59, 130, 246, 0.12);
}

.cf-picker-col-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.cf-picker-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cf-picker-dot.is-none {
  border: 1px dashed var(--text-muted);
  background: transparent;
}

.cf-picker-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.cf-picker-name {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cf-picker-tag-resolved {
  color: var(--success, #10b981);
  font-size: 11px;
  margin-left: 2px;
}

.cf-picker-check-icon {
  color: var(--primary, #3b82f6);
  display: flex;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

.cf-picker-col-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  text-align: right;
  flex-shrink: 0;
}

.cf-picker-item.is-none-item .cf-picker-name {
  color: var(--text-muted);
  font-style: italic;
}

.cf-picker-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Kanban Interactive Custom Field Badges */
.kanban-cf-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.kanban-cf-badge:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .kanban-cf-badge:hover {
  filter: brightness(1.2);
}

.kanban-cf-badge:active {
  transform: translateY(0);
}

.kanban-cf-badge.is-updating {
  opacity: 0.5;
  pointer-events: none;
}