/* ==================== CSS Reset & Base ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

img, svg {
  max-width: 100%;
  height: auto;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

:root {
  /* Brand Colors */
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Neumorphic Neutrals (Light Mode) */
  --neu-bg: #e0e5ec;
  --neu-bg-light: #ffffff;
  --neu-bg-dark: #c8d0dc;
  --neu-shadow-light: #ffffff;
  --neu-shadow-dark: #a3b1c6;

  /* Text Colors */
  --text-dark: #1e293b;
  --text-medium: #475569;
  --text-light: #64748b;

  /* Borders */
  --border: #d1d9e6;

  /* Radii & Transitions */
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s ease;

  /* Legacy shadows (kept for compatibility) */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);

  /* FIX: second variable family used by analytics/detail-modal/comments/
     time-tracker components. These were previously only referenced via
     var(--x, fallback) with no real declaration anywhere, so they always
     rendered with their light-mode fallback color, even in dark mode.
     Aliased to the existing neumorphic tokens so both systems stay in sync. */
  --bg-secondary: #ececec;
  --card-bg: #fafafa;
  --border-color: var(--border);
  --primary-color: var(--primary);
  --hover-bg: #f0f0f0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--neu-bg);
  min-height: 100dvh; /* CHANGED: Uses dynamic viewport height */
  color: var(--text-dark);
  line-height: 1.5;
  transition: background var(--transition), color var(--transition);
}

/* ==================== Neumorphic Helper Classes ==================== */
.neu-elevated {
  background: var(--neu-bg);
  box-shadow: 
    8px 8px 16px var(--neu-shadow-dark),
    -8px -8px 16px var(--neu-shadow-light);
  border-radius: var(--radius);
}

.neu-inset {
  background: var(--neu-bg);
  box-shadow: 
    inset 6px 6px 12px var(--neu-shadow-dark),
    inset -6px -6px 12px var(--neu-shadow-light);
  border-radius: var(--radius);
}

.neu-flat {
  background: var(--neu-bg);
  box-shadow: none;
}

/* ==================== Authentication ==================== */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.auth-card {
  background: var(--neu-bg);
  border-radius: var(--radius);
  box-shadow: 
    8px 8px 16px var(--neu-shadow-dark),
    -8px -8px 16px var(--neu-shadow-light);
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  transition: var(--transition);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header i {
  font-size: 2rem;
  color: var(--primary);
  background: var(--neu-bg);
  box-shadow: 
    inset 6px 6px 12px var(--neu-shadow-dark),
    inset -6px -6px 12px var(--neu-shadow-light);
  width: 60px;
  height: 60px;
  line-height: 60px;
  border-radius: 50%;
  margin-bottom: 0.5rem;
  transition: var(--transition);
}

.auth-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--neu-bg);
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  box-shadow: 
    inset 6px 6px 12px var(--neu-shadow-dark),
    inset -6px -6px 12px var(--neu-shadow-light);
  margin-bottom: 2rem;
}

.auth-tab {
  flex: 1;
  padding: 0.8rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-medium);
  border-radius: 6px;
  transition: var(--transition);
  font-size: 0.95rem;
}

.auth-tab.active {
  background: var(--neu-bg);
  color: var(--primary);
  box-shadow: 
    4px 4px 8px var(--neu-shadow-dark),
    -4px -4px 8px var(--neu-shadow-light);
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 1.2rem;
  animation: fadeIn 0.3s ease;
}

.auth-form.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-subtitle {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  text-align: center;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group i {
  position: absolute;
  left: 1rem;
  color: var(--text-light);
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 0.9rem 1rem 0.9rem 2.8rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  transition: var(--transition);
  background: var(--neu-bg);
  color: var(--text-dark);
  box-shadow: 
    inset 4px 4px 8px var(--neu-shadow-dark),
    inset -4px -4px 8px var(--neu-shadow-light);
}

.input-group input:focus,
.input-group select:focus {
  outline: none;
  box-shadow: 
    inset 2px 2px 4px var(--neu-shadow-dark),
    inset -2px -2px 4px var(--neu-shadow-light),
    0 0 0 3px rgba(79, 70, 229, 0.2);
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem;
  background: var(--neu-bg);
  color: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 
    6px 6px 12px var(--neu-shadow-dark),
    -6px -6px 12px var(--neu-shadow-light);
}

.btn-primary:hover {
  box-shadow: 
    4px 4px 8px var(--neu-shadow-dark),
    -4px -4px 8px var(--neu-shadow-light);
  transform: translateY(-1px);
}

.btn-primary:active {
  box-shadow: 
    inset 4px 4px 8px var(--neu-shadow-dark),
    inset -4px -4px 8px var(--neu-shadow-light);
  transform: translateY(0);
}

.btn-block {
  width: 100%;
}

/* ==================== Dashboard ==================== */
.dashboard {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--neu-bg);
  border-radius: var(--radius);
  box-shadow: 
    8px 8px 16px var(--neu-shadow-dark),
    -8px -8px 16px var(--neu-shadow-light);
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.brand i {
  font-size: 2rem;
  color: var(--primary);
}

.brand h1 {
  font-size: 1.2rem;
  font-weight: 700;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  flex-direction: column;
  align-items: flex-start;
}

.user-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.user-name {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 0.95rem;
}

.user-role {
  background: var(--neu-bg);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 
    inset 3px 3px 6px var(--neu-shadow-dark),
    inset -3px -3px 6px var(--neu-shadow-light);
}

.btn-signout {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  background: var(--neu-bg);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-medium);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  box-shadow: 
    4px 4px 8px var(--neu-shadow-dark),
    -4px -4px 8px var(--neu-shadow-light);
}

.btn-signout:hover {
  color: var(--danger);
  box-shadow: 
    inset 4px 4px 8px var(--neu-shadow-dark),
    inset -4px -4px 8px var(--neu-shadow-light);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.dashboard-main {
  display: grid;
  gap: 1.5rem;
}

.tasks-section,
.milestones-section {
  min-width: 0;
}

.card {
  background: var(--neu-bg);
  border-radius: var(--radius);
  box-shadow: 
    8px 8px 16px var(--neu-shadow-dark),
    -8px -8px 16px var(--neu-shadow-light);
  padding: 1rem;
  transition: var(--transition);
}

.card:hover {
  box-shadow: 
    6px 6px 12px var(--neu-shadow-dark),
    -6px -6px 12px var(--neu-shadow-light);
}

.card-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dark);
}

.card-header i {
  color: var(--primary);
}

/* Task Controls */
.task-controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.task-filters {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.task-filters label {
  font-size: 0.85rem;
  color: var(--text-medium);
  font-weight: 500;
}

.task-filters select {
  width: 100%;
  padding: 0.5rem 0.8rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--neu-bg);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 
    inset 3px 3px 6px var(--neu-shadow-dark),
    inset -3px -3px 6px var(--neu-shadow-light);
}

.task-filters select:focus {
  outline: none;
  box-shadow: 
    inset 2px 2px 4px var(--neu-shadow-dark),
    inset -2px -2px 4px var(--neu-shadow-light),
    0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Lists */
.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list li {
  background: var(--neu-bg);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  transition: var(--transition);
  border-left: 4px solid transparent;
  box-shadow: 
    4px 4px 8px var(--neu-shadow-dark),
    -4px -4px 8px var(--neu-shadow-light);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.list li:hover {
  transform: translateX(4px);
  box-shadow: 
    2px 2px 4px var(--neu-shadow-dark),
    -2px -2px 4px var(--neu-shadow-light);
}

.list li strong {
  font-size: 0.9rem;
}

/* Status badges */
.task-status {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--neu-bg);
  color: var(--text-medium);
  text-transform: uppercase;
  box-shadow: 
    inset 2px 2px 4px var(--neu-shadow-dark),
    inset -2px -2px 4px var(--neu-shadow-light);
}

/* Approval Actions */
.btn-approve,
.btn-reject {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: var(--transition);
  color: white;
  box-shadow: 
    3px 3px 6px var(--neu-shadow-dark),
    -3px -3px 6px var(--neu-shadow-light);
}

.btn-approve { background-color: var(--success); }
.btn-approve:hover { box-shadow: inset 3px 3px 6px rgba(0,0,0,0.2), inset -3px -3px 6px rgba(255,255,255,0.2); }

.btn-reject { background-color: var(--danger); }
.btn-reject:hover { box-shadow: inset 3px 3px 6px rgba(0,0,0,0.2), inset -3px -3px 6px rgba(255,255,255,0.2); }

/* User Management */
.user-role-select {
  width: 100%;
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--neu-bg);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 
    inset 3px 3px 6px var(--neu-shadow-dark),
    inset -3px -3px 6px var(--neu-shadow-light);
}

.user-role-select:focus {
  outline: none;
  box-shadow: 
    inset 2px 2px 4px var(--neu-shadow-dark),
    inset -2px -2px 4px var(--neu-shadow-light),
    0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* ==================== Modals ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-content {
  background: var(--neu-bg);
  border-radius: var(--radius);
  padding: 1.25rem;
  width: 95%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 
    12px 12px 24px var(--neu-shadow-dark),
    -12px -12px 24px var(--neu-shadow-light);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  transition: var(--transition);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: 
    3px 3px 6px var(--neu-shadow-dark),
    -3px -3px 6px var(--neu-shadow-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--danger);
  box-shadow: 
    inset 3px 3px 6px var(--neu-shadow-dark),
    inset -3px -3px 6px var(--neu-shadow-light);
}

.task-form input,
.task-form select,
.task-form textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--neu-bg);
  color: var(--text-dark);
  box-shadow: 
    inset 4px 4px 8px var(--neu-shadow-dark),
    inset -4px -4px 8px var(--neu-shadow-light);
}

.task-form input:focus,
.task-form select:focus,
.task-form textarea:focus {
  outline: none;
  box-shadow: 
    inset 2px 2px 4px var(--neu-shadow-dark),
    inset -2px -2px 4px var(--neu-shadow-light),
    0 0 0 3px rgba(79, 70, 229, 0.2);
}

.form-group {
  margin-bottom: 0.75rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-medium);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.modal-actions button {
  width: 100%;
}

.btn-secondary {
  padding: 0.8rem 1.5rem;
  background: var(--neu-bg);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
  color: var(--text-medium);
  box-shadow: 
    4px 4px 8px var(--neu-shadow-dark),
    -4px -4px 8px var(--neu-shadow-light);
}

.btn-secondary:hover {
  box-shadow: 
    inset 4px 4px 8px var(--neu-shadow-dark),
    inset -4px -4px 8px var(--neu-shadow-light);
}

/* ==================== Buttons ==================== */
.btn-add-task-small,
.btn-add-small {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--neu-bg);
  color: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
  box-shadow: 
    4px 4px 8px var(--neu-shadow-dark),
    -4px -4px 8px var(--neu-shadow-light);
}

.btn-add-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  padding: 0;
}

.btn-add-task-small:hover,
.btn-add-small:hover {
  box-shadow: 
    inset 4px 4px 8px var(--neu-shadow-dark),
    inset -4px -4px 8px var(--neu-shadow-light);
  transform: translateY(-1px);
}

/* Toast Notifications – Improved */
.toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-1rem);
  width: auto;
  min-width: 280px;
  max-width: calc(100vw - 2rem);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  color: var(--text-dark);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
              0 4px 6px -2px rgba(0, 0, 0, 0.05);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  font-size: 0.875rem;
  line-height: 1.4;
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Toast variants */
.toast-success {
  border-left: 4px solid var(--success);
  background: #f0fdf4;      /* light green tint */
}
.toast-error {
  border-left: 4px solid var(--danger);
  background: #fef2f2;      /* light red tint */
}
.toast-warning {
  border-left: 4px solid var(--warning);
  background: #fffbeb;      /* light yellow tint */
}
.toast-info {
  border-left: 4px solid var(--primary);
  background: var(--card-bg);
}

/* Optional icon placeholder (add <i> in JS) */
.toast .toast-icon {
  font-size: 1.25rem;
  color: currentColor;
}

/* Optional close button */
.toast .toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0.25rem;
}
.toast .toast-close:hover {
  opacity: 1;
}

/* Dark mode tints */
[data-theme="dark"] .toast-success { background: #052e1f; }
[data-theme="dark"] .toast-error   { background: #3b1212; }
[data-theme="dark"] .toast-warning { background: #3b2f0f; }

/* ==================== Kanban Board ==================== */
.kanban-board {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-x: visible;
  overflow-y: auto;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.kanban-column {
  flex: 1 0 auto;
  min-width: 100%;
  max-width: 100%;
  min-height: auto;
  background: var(--neu-bg);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  box-shadow: 
    inset 6px 6px 12px var(--neu-shadow-dark),
    inset -6px -6px 12px var(--neu-shadow-light);
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text-dark);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.kanban-column-header .task-count {
  background: var(--neu-bg);
  border-radius: 12px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  color: var(--text-medium);
  box-shadow: 
    inset 2px 2px 4px var(--neu-shadow-dark),
    inset -2px -2px 4px var(--neu-shadow-light);
}

.kanban-cards {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 50px;
  max-height: 300px;
  overflow-y: auto;
}

.kanban-card {
  background: var(--neu-bg);
  border-radius: 6px;
  padding: 0.6rem;
  box-shadow: 
    4px 4px 8px var(--neu-shadow-dark),
    -4px -4px 8px var(--neu-shadow-light);
  cursor: grab;
  transition: var(--transition);
  border-left: 4px solid transparent;
}

.kanban-card:hover {
  box-shadow: 
    6px 6px 12px var(--neu-shadow-dark),
    -6px -6px 12px var(--neu-shadow-light);
  transform: translateY(-1px);
}

.kanban-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
  box-shadow: 
    inset 4px 4px 8px var(--neu-shadow-dark),
    inset -4px -4px 8px var(--neu-shadow-light);
}

.kanban-column.done-column {
  border: 1px solid #c8e6c9;
}

.kanban-column.done-column .kanban-column-header {
  color: #2e7d32;
}

/* Task Meta & Priority */
.task-meta {
  font-size: 0.75rem;
  color: var(--text-light);
  margin: 0.3rem 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.priority-low { border-left-color: #10b981; }
.priority-medium { border-left-color: #3b82f6; }
.priority-high { border-left-color: #f59e0b; }
.priority-critical { border-left-color: #ef4444; }

/* Deadline Donut */
.deadline-donut {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.deadline-donut svg {
  transform: rotate(-90deg);
}

.donut-bg {
  fill: none;
  stroke: var(--neu-shadow-dark);
  stroke-width: 3;
  opacity: 0.3;
}

.donut-progress {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease;
}

.donut-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.55rem;
  font-weight: 700;
  color: currentColor;
}

.deadline-donut.low { color: #10b981; }
.deadline-donut.medium { color: #f59e0b; }
.deadline-donut.high { color: #ef4444; }
.deadline-donut.overdue { color: #dc2626; }

/* Drag Over */
.drag-over {
  background: rgba(79, 70, 229, 0.1);
  box-shadow: 
    inset 0 0 0 2px var(--primary),
    inset 6px 6px 12px var(--neu-shadow-dark),
    inset -6px -6px 12px var(--neu-shadow-light);
}

/* Task Actions */
.task-actions {
  display: flex;
  gap: 0.4rem;
  margin: 0.4rem 0;
}

/* Card Status Select */
.card-status-select {
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: none;
  border-radius: 4px;
  font-size: 0.75rem;
  background: var(--neu-bg);
  color: var(--text-medium);
  cursor: pointer;
  margin-top: 0.3rem;
  box-shadow: 
    inset 2px 2px 4px var(--neu-shadow-dark),
    inset -2px -2px 4px var(--neu-shadow-light);
}

.card-status-select:focus {
  outline: none;
  box-shadow: 
    inset 2px 2px 4px var(--neu-shadow-dark),
    inset -2px -2px 4px var(--neu-shadow-light),
    0 0 0 2px rgba(79, 70, 229, 0.2);
}

/* ==================== Utility ==================== */
.hidden {
  display: none !important;
}

.text-center { text-align: center; }
.w-full { width: 100%; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ==================== Dark Theme ==================== */
[data-theme="dark"] {
  --primary: #818cf8;
  --primary-dark: #6366f1;
  --primary-light: #1e293b;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;

  --neu-bg: #1e293b;
  --neu-bg-light: #2d3a4f;
  --neu-bg-dark: #151f2e;
  --neu-shadow-light: #2d3a4f;
  --neu-shadow-dark: #0f172a;

  --text-dark: #f1f5f9;
  --text-medium: #cbd5e1;
  --text-light: #94a3b8;

  --border: #334155;

  /* FIX: dark-mode values for the second variable family (see :root note
     above). Without these, analytics charts, the task-detail modal,
     comments, and the time-tracking widget stayed light-themed. */
  --bg-secondary: #263346;
  --card-bg: #1e293b;
  --border-color: #334155;
  --primary-color: #818cf8;
  --hover-bg: #2d3a4f;
}

[data-theme="dark"] body {
  background: var(--neu-bg);
}

[data-theme="dark"] .card,
[data-theme="dark"] .auth-card,
[data-theme="dark"] .dashboard-header,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .list li,
[data-theme="dark"] .kanban-card {
  background: var(--neu-bg);
  box-shadow: 
    8px 8px 16px var(--neu-shadow-dark),
    -8px -8px 16px var(--neu-shadow-light);
}

[data-theme="dark"] .input-group input,
[data-theme="dark"] .input-group select,
[data-theme="dark"] .task-form input,
[data-theme="dark"] .task-form select,
[data-theme="dark"] .task-form textarea,
[data-theme="dark"] .user-role-select,
[data-theme="dark"] .task-filters select,
[data-theme="dark"] .card-status-select {
  background: var(--neu-bg);
  box-shadow: 
    inset 4px 4px 8px var(--neu-shadow-dark),
    inset -4px -4px 8px var(--neu-shadow-light);
  color: var(--text-dark);
}

[data-theme="dark"] .drag-over {
  background: rgba(129, 140, 248, 0.15);
}

/* FIX: dark-mode text/border tweaks for the comment textarea, which was
   using hardcoded light-mode colors (#cbd5e0 border) with no dark override. */
[data-theme="dark"] .comment-input-wrapper textarea,
[data-theme="dark"] .manual-log-form input {
  background: var(--card-bg);
  color: var(--text-dark);
  border-color: var(--border-color);
}

[data-theme="dark"] .mention-dropdown {
  background: var(--card-bg);
  border-color: var(--border-color);
}

/* ==================== Theme Toggle ==================== */
.theme-toggle {
  position: fixed;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1100;
  background: var(--neu-bg);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 
    4px 4px 8px var(--neu-shadow-dark),
    -4px -4px 8px var(--neu-shadow-light);
  transition: var(--transition);
}

.theme-toggle:hover {
  box-shadow: 
    inset 4px 4px 8px var(--neu-shadow-dark),
    inset -4px -4px 8px var(--neu-shadow-light);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: var(--text-dark);
  transition: fill 0.3s ease;
}

/* ==================== Responsive - Tablet (≥640px) ==================== */
@media (min-width: 640px) {
  .auth-card { padding: 2rem; }
  .auth-header h1 { font-size: 1.8rem; }
  .auth-header i {
    width: 70px;
    height: 70px;
    line-height: 70px;
    font-size: 2.2rem;
  }

  .dashboard { padding: 1rem; }
  .dashboard-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
  }
  .user-info {
    width: auto;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }
  .user-details { align-items: flex-end; }

  .dashboard-grid {
    grid-template-columns: minmax(0, 2.3fr) minmax(0, 1fr);
    gap: 1rem;
  }
  .card { padding: 1.25rem; }
  .card-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .card-header h2 { font-size: 1.2rem; }

  .task-controls {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    width: auto;
  }
  .task-filters {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    width: auto;
  }
  .task-filters select { width: auto; min-width: 150px; }

  .kanban-board {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0.75rem;
  }
  .kanban-column {
    flex: 1 0 220px;
    min-width: 220px;
    max-width: 280px;
  }
  .kanban-cards { max-height: 400px; }

  .modal-content { padding: 1.75rem; }
  .form-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  .modal-actions {
    flex-direction: row;
    justify-content: flex-end;
  }
  .modal-actions button { width: auto; }

  .toast {
    left: auto;
    top: 1.5rem;
    right: 1.5rem;
    bottom: auto;
    max-width: 350px;
    text-align: left;
  }

  .theme-toggle {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }
}

/* ==================== Responsive - Desktop (≥1024px) ==================== */
@media (min-width: 1024px) {
  .auth-container { padding: 2rem; }
  .auth-card { padding: 2.5rem; }

  .dashboard { padding: 1.5rem; }
  .dashboard-header { padding: 1.5rem 2rem; }
  .brand h1 { font-size: 1.5rem; }

  .dashboard-grid {
    grid-template-columns: minmax(0, 2.5fr) minmax(0, 1fr);
    gap: 1.5rem;
  }
  .card { padding: 1.5rem; }

  .kanban-board { gap: 1rem; }
  .kanban-column {
    flex: 1 0 240px;
    min-width: 240px;
    max-width: 300px;
  }
  .kanban-cards { max-height: 500px; }
  .kanban-card { padding: 0.75rem; }

  .modal-content { padding: 2rem; }
  .form-row { gap: 1rem; }
}

/* ==================== Responsive - Large Desktop (≥1440px) ==================== */
@media (min-width: 1440px) {
  .dashboard {
    max-width: 1600px;
    padding: 2rem;
  }
  .dashboard-grid { gap: 2rem; }
  .kanban-column {
    flex: 1 0 280px;
    min-width: 280px;
    max-width: 340px;
  }
  .card { padding: 2rem; }
}

/* ==================== Landscape Mobile ==================== */
@media (max-height: 500px) and (orientation: landscape) {
  .auth-card { padding: 1rem; }
  .auth-header { margin-bottom: 1rem; }
  .auth-header i {
    width: 40px;
    height: 40px;
    line-height: 40px;
    font-size: 1.5rem;
  }
  .auth-header h1 { font-size: 1.2rem; }
  .modal-content {
    max-height: 90vh;
    padding: 1rem;
  }
}

/* ==================== Safe Area Support ==================== */
@supports (padding: max(0px)) {
  .dashboard,
  .auth-container {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  .toast {
    top: calc(1rem + env(safe-area-inset-top, 0px));
  }
}

/* ==================== Touch Devices ==================== */
@media (hover: none) {
  .btn-primary,
  .btn-secondary,
  .btn-signout,
  .btn-add-task-small,
  .btn-add-small,
  .auth-tab,
  .modal-close {
    min-height: 44px;
  }

  .input-group input,
  .input-group select,
  .task-form input,
  .task-form select,
  .task-form textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .kanban-card { cursor: default; }

  .card-status-select,
  .user-role-select,
  .task-filters select {
    min-height: 36px;
    font-size: 16px;
  }
}

/* ==================== Print Styles ==================== */
@media print {
  .theme-toggle,
  .btn-signout,
  .btn-add-task-small,
  .btn-add-small,
  .modal,
  .toast {
    display: none !important;
  }

  .dashboard { padding: 0; }
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ==================== Scrollbar Styling ==================== */
.kanban-board,
.kanban-cards {
  scrollbar-width: thin;
  scrollbar-color: var(--neu-shadow-dark) transparent;
}

.kanban-board::-webkit-scrollbar,
.kanban-cards::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.kanban-board::-webkit-scrollbar-track,
.kanban-cards::-webkit-scrollbar-track {
  background: transparent;
}

.kanban-board::-webkit-scrollbar-thumb,
.kanban-cards::-webkit-scrollbar-thumb {
  background-color: var(--neu-shadow-dark);
  border-radius: 3px;
}

/* ==================== Tags & Labels ==================== */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.4rem 0;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.tag-option {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}

/* ==================== Task Detail Modal ==================== */
.task-detail-content {
  max-width: 720px;
  width: 92%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
}

.detail-title-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* FIX: previously unstyled — rendered with browser defaults. Badge for the
   comment count next to the "Comments" tab. */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary-color);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.detail-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.detail-tab {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-medium);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.detail-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: var(--card-bg);
}

.detail-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
  background: var(--card-bg);
  color: var(--text-dark);
}

.detail-tab-pane {
  display: none;
}

.detail-tab-pane.active {
  display: block;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  background: var(--bg-secondary);
  padding: 0.85rem;
  border-radius: 8px;
  margin: 1rem 0;
  font-size: 0.85rem;
}

.detail-section {
  margin-top: 1.25rem;
}

.detail-section h4 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

/* FIX: previously unstyled. Plain-language task description text in the
   overview tab. */
/* Enhanced Task Description Card */
.detail-description {
  font-size: 0.9rem;
  color: var(--text-medium);
  line-height: 1.6;
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Optional: Add a label above the description */
.detail-description-wrapper {
  position: relative;
}

.detail-description-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light, #64748b);
  margin-bottom: 0.5rem;
}
/* FIX: previously unstyled. Wrapper around the subtask completion bar. */
.progress-bar-container {
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-light);
}

/* FIX: previously unstyled — rendered as a bare bulleted <ul>. Subtask
   checklist inside the task-detail overview tab. */
.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.checklist li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==================== Comments Stream & Mentions ==================== */
.comments-stream {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 0.25rem;
  margin-bottom: 1rem;
}

.comment-card {
  display: flex;
  gap: 0.75rem;
  background: var(--bg-secondary);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border-left: 3px solid var(--primary-color);
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.comment-content {
  flex: 1;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
}

.comment-author {
  font-weight: 600;
  color: var(--text-dark);
}

.comment-time {
  color: var(--text-light);
}

.comment-text {
  font-size: 0.88rem;
  color: var(--text-medium);
  white-space: pre-wrap;
  word-break: break-word;
}

.mention-highlight {
  background: rgba(49, 130, 206, 0.15);
  color: #2b6cb0;
  font-weight: 600;
  padding: 0 4px;
  border-radius: 4px;
}

.comment-input-wrapper {
  position: relative;
  margin-bottom: 0.75rem;
}

.comment-input-wrapper textarea {
  width: 100%;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 0.88rem;
  resize: vertical;
  background: var(--card-bg);
  color: var(--text-dark);
}

.mention-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 150px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
  z-index: 10;
}

.mention-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
}

.mention-item:hover, .mention-item.selected {
  background: var(--hover-bg);
}

/* ==================== Activity Audit Timeline ==================== */
.activity-timeline {
  list-style: none;
  padding: 0 0 0 1rem;
  margin: 0;
  border-left: 2px solid var(--border-color);
}

.activity-item {
  position: relative;
  padding-bottom: 1.25rem;
  padding-left: 1rem;
  font-size: 0.83rem;
}

.activity-item::before {
  content: '';
  position: absolute;
  left: -1.35rem;
  top: 0.2rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary-color);
  border: 2px solid var(--card-bg);
}

.activity-time {
  display: block;
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

/* ==================== Mobile Responsiveness ==================== */
@media (max-width: 640px) {
  .task-detail-content {
    width: 96%;
    max-height: 94vh;
  }
  .detail-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .detail-tab {
    padding: 0.6rem 0.4rem;
    font-size: 0.75rem;
  }
  .detail-meta-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* ==================== Managerial Analytics ==================== */
.analytics-section {
  margin-bottom: 1.5rem;
  /* FIX: `grid-column: 1 / -1` removed — #analytics-section is a direct
     child of <main class="dashboard-main">, which is not a grid container
     anywhere in this stylesheet, so the rule was a no-op. Full-width
     placement is already achieved naturally as a block-level section. */
}

.export-actions {
  display: flex;
  gap: 0.5rem;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.chart-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.chart-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
  text-align: center;
}

.chart-wrapper {
  position: relative;
  flex: 1;
  min-height: 220px;
  max-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==================== Time Tracking Widget ==================== */
.time-tracking-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 0.85rem;
  margin-top: 1rem;
}

.time-tracker-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  align-items: center;
}

.time-stats {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.time-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.25rem;
}

#time-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.timer-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timer-display {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: #e53e3e;
  animation: blink 1s infinite;
}

@keyframes blink {
  50% { opacity: 0.5; }
}

.manual-log-form {
  display: flex;
  gap: 0.4rem;
}

.manual-log-form input {
  width: 100px;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.82rem;
  background: var(--card-bg);
  color: var(--text-dark);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

@media (max-width: 768px) {
  .export-actions {
    flex-direction: column;
    width: 100%;
  }
}
/* ==================== Save Progress System ==================== */

.save-progress {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 1;
  transition: opacity 0.25s ease;
}

.save-progress.hidden {
  display: none;
}

.save-progress-card {
  width: min(420px, 100%);
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e5e7eb);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.18);
  animation: saveProgressIn 0.25s ease;
}

.save-progress-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  font-size: 18px;
}

.save-progress-content {
  flex: 1;
  min-width: 0;
}

.save-progress-content strong {
  display: block;
  font-size: 14px;
  margin-bottom: 3px;
}

.save-progress-content span {
  display: block;
  font-size: 12px;
  opacity: 0.65;
  margin-bottom: 9px;
}

.save-progress-bar {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(128, 128, 128, 0.18);
}

#save-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  transition: width 0.3s ease;
}

#save-progress-percent {
  min-width: 38px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.65;
}

.save-progress.success .save-progress-icon {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
}

.save-progress.error .save-progress-icon {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

@keyframes saveProgressIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
/* ==================== Messenger In-App Browser & Mobile WebView Fixes ==================== */

/* 1. Prevent horizontal scrolling */
html, body {
  overflow-x: hidden;
  width: 100%;
}

/* 2. Fix 100vh issues in WebViews */
@supports (-webkit-touch-callout: none) {
  body {
    min-height: -webkit-fill-available;
  }
  .dashboard, .auth-container {
    min-height: 100vh;
    min-height: -webkit-fill-available;
  }
}

/* 3. Handle iPhone Safe Areas (Notch & Home Bar) */
@supports (padding: max(0px)) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .toast {
    top: calc(1rem + env(safe-area-inset-top, 0px));
  }
  
  .kanban-board, .kanban-cards, .comments-stream {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  
  .dashboard, .auth-container {
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* 4. Prevent iOS auto-zoom on inputs */
input, select, textarea {
  font-size: 16px !important;
  max-width: 100%;
  -webkit-text-size-adjust: 100%;
}

/* 5. Smooth scrolling & Remove tap flash */
body, .kanban-board, .kanban-cards, .comments-stream, .modal-content {
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation;
}

* {
  -webkit-tap-highlight-color: transparent;
}

/* 6. Fixed Theme Toggle Safe Area */
.theme-toggle {
  position: fixed;
  top: calc(0.5rem + env(safe-area-inset-top, 0px));
  right: calc(0.5rem + env(safe-area-inset-right, 0px));
  z-index: 1200;
}

/* 7. Modal centering & Keyboard handling */
.modal {
  align-items: flex-start;
  padding-top: 5vh;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (min-height: 600px) {
  .modal {
    align-items: center;
    padding-top: 0;
  }
}

/* 8. Hide elements when keyboard is open (small heights) */
@media (max-height: 500px) {
  .modal-content, .detail-body, .auth-card {
    max-height: 90vh !important;
    overflow-y: auto !important;
  }
  
  .dashboard-header .user-details {
    display: none !important;
  }
}

/* 9. Reduce shadows on small screens to prevent blur/clipping */
@media (max-width: 480px) {
  .card, .auth-card, .modal-content {
    box-shadow: 
      4px 4px 8px var(--neu-shadow-dark),
      -4px -4px 8px var(--neu-shadow-light) !important;
  }
  
  .kanban-column, .input-group input {
    box-shadow: 
      inset 3px 3px 6px var(--neu-shadow-dark),
      inset -3px -3px 6px var(--neu-shadow-light) !important;
  }
}


/* ==================== Announcements with Readable Colors ==================== */
.announcements-section {
  margin-bottom: 1.5rem;
}

.announcements-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.announcement-card {
  position: relative;
  background: var(--neu-bg);
  border-radius: var(--radius-sm);
  padding: 1rem;
  box-shadow: 
    4px 4px 8px var(--neu-shadow-dark),
    -4px -4px 8px var(--neu-shadow-light);
  border-left: 4px solid var(--primary);
  transition: var(--transition);
  animation: slideIn 0.3s ease;
}

.announcement-card:hover {
  transform: translateX(4px);
  box-shadow: 
    6px 6px 12px var(--neu-shadow-dark),
    -6px -6px 12px var(--neu-shadow-light);
}

/* Priority-based border colors */
.announcement-card.priority-normal {
  border-left-color: #3b82f6; /* Blue */
}

.announcement-card.priority-important {
  border-left-color: #f59e0b; /* Orange */
}

.announcement-card.priority-urgent {
  border-left-color: #ef4444; /* Red */
  animation: pulse 2s infinite;
}

.announcement-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Readable Title - Solid Colors */
.announcement-title {
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #667eea; /* Solid purple for normal */
}

.announcement-title i {
  color: #667eea;
}

/* Priority-specific title colors */
.priority-important .announcement-title {
  color: #d53f8c; /* Solid pink for important */
}

.priority-important .announcement-title i {
  color: #d53f8c;
}

.priority-urgent .announcement-title {
  color: #e53e3e; /* Solid red for urgent */
  font-weight: 800;
  animation: urgentPulse 1.5s infinite;
}

.priority-urgent .announcement-title i {
  color: #e53e3e;
}

/* Colorful Priority Badge */
.announcement-priority-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.priority-normal .announcement-priority-badge {
  background-color: #667eea; /* Solid purple */
}

.priority-important .announcement-priority-badge {
  background-color: #d53f8c; /* Solid pink */
}

.priority-urgent .announcement-priority-badge {
  background-color: #e53e3e; /* Solid red */
  animation: pulse 1.5s infinite;
}

/* Readable Message - Solid Backgrounds */
.announcement-message {
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0.75rem 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #2d3748;
  background-color: #edf2f7; /* Solid light gray-blue */
  padding: 0.75rem;
  border-radius: 8px;
  border-left: 3px solid #667eea;
}

.priority-important .announcement-message {
  color: #744210;
  background-color: #fefcbf; /* Solid light yellow */
  border-left-color: #f59e0b;
}

.priority-urgent .announcement-message {
  color: #742a2a;
  background-color: #fed7d7; /* Solid light red */
  border-left-color: #ef4444;
}

/* Readable Footer */
.announcement-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.announcement-author {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: #667eea; /* Solid purple */
  font-weight: 600;
}

.announcement-author i {
  color: #764ba2;
}

.priority-important .announcement-author {
  color: #d53f8c; /* Solid pink */
}

.priority-urgent .announcement-author {
  color: #e53e3e; /* Solid red */
}

.announcement-date {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: #718096;
}

.author-role {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  background-color: #667eea; /* Solid purple */
  color: white;
}

/* NEW Badge */
.new-badge {
  display: inline-block;
  background-color: #f59e0b; /* Solid orange */
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  animation: fadeInOut 2s infinite;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Dark mode adjustments */
[data-theme="dark"] .announcement-title {
  color: #a78bfa; /* Solid light purple */
}

[data-theme="dark"] .priority-important .announcement-title {
  color: #f472b6; /* Solid light pink */
}

[data-theme="dark"] .priority-urgent .announcement-title {
  color: #f87171; /* Solid light red */
}

[data-theme="dark"] .announcement-message {
  color: #e2e8f0;
  background-color: #2d3748; /* Solid dark gray */
  border-left-color: #667eea;
}

[data-theme="dark"] .priority-important .announcement-message {
  color: #fbd38d;
  background-color: #744210; /* Solid dark brown */
  border-left-color: #f59e0b;
}

[data-theme="dark"] .priority-urgent .announcement-message {
  color: #fed7d7;
  background-color: #742a2a; /* Solid dark red */
  border-left-color: #ef4444;
}

[data-theme="dark"] .announcement-author {
  color: #a78bfa;
}

[data-theme="dark"] .priority-important .announcement-author {
  color: #f472b6;
}

[data-theme="dark"] .priority-urgent .announcement-author {
  color: #f87171;
}

[data-theme="dark"] .author-role {
  background-color: #a78bfa;
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 
      4px 4px 8px var(--neu-shadow-dark),
      -4px -4px 8px var(--neu-shadow-light);
  }
  50% {
    box-shadow: 
      6px 6px 16px var(--neu-shadow-dark),
      -6px -6px 16px var(--neu-shadow-light),
      0 0 20px rgba(239, 68, 68, 0.3);
  }
}

@keyframes urgentPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes fadeInOut {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
}

.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  color: #667eea; /* Solid purple instead of gradient */
}

.empty-state p {
  font-size: 0.95rem;
  font-weight: 500;
}
[data-theme="dark"] .mention-highlight {
  background: rgba(129, 140, 248, 0.2);
  color: #a5b4fc;
}
/* Batch action bar */
.batch-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--primary-light);
  border-radius: 6px;
  border: 1px solid var(--primary);
}
.batch-actions.hidden { display: none; }

/* Selected card highlight */
.kanban-card.selected {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

/* Card checkbox (shown on hover for desktop) */
.card-checkbox {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s;
}
.kanban-card:hover .card-checkbox,
.kanban-card.selected .card-checkbox {
  opacity: 1;
}
.kanban-card { position: relative; }  /* make sure card is relative */

/* Inline edit form */
.inline-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.inline-edit-form input,
.inline-edit-form textarea {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.85rem;
  background: var(--card-bg);
  color: var(--text-dark);
}
.inline-edit-actions {
  display: flex;
  gap: 0.4rem;
}

/* Collapsed column */
.kanban-column.collapsed {
  min-width: 40px;
  max-width: 40px;
  overflow: hidden;
  cursor: pointer;
}
.kanban-column.collapsed .kanban-cards,
.kanban-column.collapsed .kanban-column-header .task-count {
  display: none;
}
.kanban-column.collapsed .kanban-column-header {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

@media (max-width: 640px) {
  .kanban-column.collapsed {
    min-width: 100%;
    max-width: 100%;
    writing-mode: horizontal-tb;
    transform: none;
  }
  .kanban-column.collapsed .kanban-cards {
    display: none; /* still hide content */
  }
}
/* ==================== Missing styles for new Kanban features ==================== */

/* Danger button used in batch actions */
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
  background-color: var(--danger);
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.btn-danger:hover {
  background-color: #dc2626;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Edit button on kanban cards */
.card-edit-btn {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 0.8rem;
  transition: color 0.2s;
}
.card-edit-btn:hover {
  color: var(--primary);
}

/* Collapse-empty toggle */
.collapse-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-medium);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.collapse-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Announcement toast (used by showAnnouncementToast) */
.announcement-toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  max-width: 350px;
  width: calc(100% - 2rem);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  z-index: 9999;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
  font-size: 0.9rem;
  color: var(--text-dark);
}
.announcement-toast.priority-important {
  border-left: 4px solid var(--warning);
}
.announcement-toast.priority-urgent {
  border-left: 4px solid var(--danger);
}
.announcement-toast strong {
  display: block;
  margin-bottom: 0.3rem;
}
.announcement-toast p {
  margin: 0.5rem 0;
  font-size: 0.85rem;
}
.announcement-toast small {
  display: block;
  opacity: 0.7;
}
#edit-title-input,
#edit-desc-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.95rem;
  background: var(--card-bg);
  color: var(--text-dark);
}
#edit-desc-textarea {
  resize: vertical;
  min-height: 100px;
}

/* Notification Bell */
.notification-wrapper {
  position: relative;
  display: inline-block;
}

.notification-bell {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-medium);
  cursor: pointer;
  position: relative;
  padding: 0.5rem;
  transition: color 0.2s;
}
.notification-bell:hover {
  color: var(--primary);
}

.notification-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notification-badge.hidden {
  display: none;
}

/* Notification Panel */
.notification-panel {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  z-index: 2000;
}
.notification-panel.hidden {
  display: none;
}

.notification-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}
.notification-panel-header h3 {
  font-size: 1rem;
  margin: 0;
}

.notification-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.notification-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s;
}
.notification-item:hover {
  background: var(--hover-bg);
}
.notification-item.unread {
  background: var(--primary-light);
}
.notification-item .notification-message {
  font-size: 0.85rem;
  color: var(--text-dark);
}
.notification-item .notification-time {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}
.notification-wrapper {
  position: relative;   /* ensure this is present */
  display: inline-block;
}

.notification-panel {
  position: absolute;
  top: 100%;
  right: 0;
  width: min(320px, calc(100vw - 2rem));  /* responsive width */
  max-height: 400px;
  overflow-y: auto;
  z-index: 2000;          /* above modals (1000) */
  /* rest unchanged */
}

/* Mobile adjustment */
@media (max-width: 480px) {
  .notification-panel {
    position: fixed;
    top: 4rem;
    right: 1rem;
    left: 1rem;
    width: auto;
    max-height: 60vh;
  }
}

/* Chat Widget */
.chat-wrapper {
  position: relative;
  display: inline-block;
}

.chat-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-medium);
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.2s;
}
.chat-button:hover {
  color: var(--primary);
}

.chat-panel {
  position: absolute;
  top: 100%;
  right: 0;
  width: min(400px, calc(100vw - 2rem));
  height: 500px;
  max-height: 80vh;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  z-index: 2000;
}
.chat-panel.hidden {
  display: none;
}

.chat-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}
.chat-panel-header h3 {
  font-size: 1rem;
  margin: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-message {
  max-width: 80%;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  word-wrap: break-word;
  background: var(--bg-secondary);
  color: var(--text-dark);
  align-self: flex-start;
}
.chat-message.own {
  background: var(--primary);
  color: #fff;
  align-self: flex-end;
}
.chat-message .chat-sender {
  font-weight: 700;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}
.chat-message .chat-time {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 0.25rem;
  display: block;
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border-color);
}
.chat-form input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--card-bg);
  color: var(--text-dark);
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .chat-panel {
    position: fixed;
    top: 4rem;
    right: 1rem;
    left: 1rem;
    width: auto;
    height: 70vh;
  }
}

/* Reply Banner */
.reply-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  background: var(--primary-light);
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
}
.reply-banner.hidden {
  display: none;
}

/* Reply Button on Messages */
.chat-message .reply-btn {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  font-size: 0.75rem;
  margin-left: 0.5rem;
  padding: 0;
}
.chat-message .reply-btn:hover {
  opacity: 1;
}

/* Indented Replies */
.chat-message.is-reply {
  margin-left: 2rem;
  border-left: 2px solid var(--border-color);
  padding-left: 0.5rem;
}
/* Chat Badge */
.chat-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-badge.hidden {
  display: none;
}

.chat-button {
  position: relative;
  /* existing styles remain */
}