*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface2: #eef0f7;
  --border: #dde1ee;
  --text: #1c1f2e;
  --text-muted: #5a6075;
  --primary: #5b52f0;
  --primary-hover: #4940d8;
  --danger: #c81e45;
  --danger-hover: #a81739;
  --success: #15803d;
  --warning: #b45309;
  --info: #1d4ed8;
  --radius: 10px;
  --shadow: 0 4px 20px rgba(30, 35, 60, 0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Mobile Header ── */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 30;
}

.btn-icon {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  width: 34px;
  height: 34px;
  font-size: 17px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 40, 0.4);
  z-index: 40;
}

.sidebar-backdrop.open {
  display: block;
}

/* ── Sidebar ── */
.sidebar {
  width: 244px;
  min-width: 244px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.sidebar-section {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 0 6px;
  margin-bottom: 8px;
}

.project-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.project-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.project-item.active {
  background: rgba(91, 82, 240, 0.14);
  color: var(--text);
  font-weight: 600;
}

.project-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.project-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-task-count {
  font-size: 11px;
  background: var(--surface2);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 10px;
}

.btn-add-project {
  width: 100%;
  margin-top: 10px;
  padding: 9px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-add-project:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(91, 82, 240, 0.06);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  background: var(--surface);
}

.sync-status-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.sync-status-btn:hover {
  border-color: var(--primary);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

.sync-dot.synced {
  background: #16a34a;
}

.sync-dot.syncing {
  background: #2563eb;
  animation: pulse 1.1s infinite;
}

.sync-dot.local {
  background: #d97706;
}

.sync-dot.error {
  background: var(--danger);
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

.backup-actions {
  display: flex;
  gap: 6px;
}

.btn-sidebar-util {
  flex: 1;
  padding: 6px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-sidebar-util:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(91, 82, 240, 0.06);
}

.btn-sidebar-logout {
  width: 100%;
  padding: 6px 8px;
  background: transparent;
  border: 1px solid rgba(200, 30, 69, 0.3);
  border-radius: 7px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-sidebar-logout:hover {
  background: rgba(200, 30, 69, 0.08);
}

/* ── Main ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  min-width: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-muted);
  padding: 24px;
  text-align: center;
}

.empty-icon {
  font-size: 56px;
}

.empty-state h2 {
  color: var(--text);
  font-size: 20px;
}

.empty-state p {
  font-size: 14px;
}

.project-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ── Project Header ── */
.project-header {
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.project-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.project-title-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.project-title-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-color-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
}

.project-title {
  font-size: 21px;
  font-weight: 700;
  word-break: break-word;
}

.project-desc {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 23px;
}

.project-manager-line {
  font-size: 12px;
  color: var(--text-muted);
  padding-left: 23px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.project-manager-line:empty {
  display: none;
}

.manager-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(91, 82, 240, 0.12);
  color: #4338ca;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.project-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: flex-start;
  flex-wrap: wrap;
}

.project-stats {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-val {
  font-size: 18px;
  font-weight: 700;
}

.stat-val.stat-todo {
  color: #475569;
}

.stat-val.stat-inprogress {
  color: var(--info);
}

.stat-val.stat-done {
  color: var(--success);
}

.stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.progress-wrap {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-left: 10px;
}

.progress-bar {
  height: 7px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 4px;
  transition: width 0.35s ease;
}

.progress-lbl {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Board Toolbar & Filters ── */
.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 28px;
  flex-shrink: 0;
}

.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  border-radius: 8px;
  padding: 3px;
}

.view-btn {
  padding: 6px 15px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.view-btn:hover {
  color: var(--text);
}

.view-btn.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(30, 35, 60, 0.10);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}

.filter-input,
.filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12.5px;
  padding: 6px 10px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.filter-input {
  width: 190px;
  max-width: 100%;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-filter-clear {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 12px;
  cursor: pointer;
}

.btn-filter-clear:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.filter-summary {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Board ── */
.board {
  display: flex;
  gap: 16px;
  padding: 0 28px 28px;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
}

.column {
  flex: 1;
  min-width: 265px;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#col-todo .column-header {
  border-top: 3px solid #64748b;
}

#col-inprogress .column-header {
  border-top: 3px solid #2563eb;
}

#col-done .column-header {
  border-top: 3px solid var(--success);
}

.column-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.column-count {
  font-size: 11px;
  background: var(--surface2);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}

.task-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}

.task-list.drag-over {
  background: rgba(91, 82, 240, 0.08);
  border-radius: 6px;
}

/* ── Task Card ── */
.task-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s, border-color 0.15s;
  user-select: none;
}

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(30, 35, 60, 0.12);
  border-color: var(--primary);
}

.task-card.dragging {
  opacity: 0.5;
  transform: scale(0.97);
}

.task-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.task-card-name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
  word-break: break-word;
}

.task-card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.task-card:hover .task-card-actions,
.task-card:focus-within .task-card-actions {
  opacity: 1;
}

.task-card-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}

.task-card-btn:hover {
  background: var(--surface);
  color: var(--text);
}

.task-card-btn.delete:hover {
  color: var(--danger);
}

.task-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.4;
}

.task-card-meta {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #4338ca;
  background: rgba(91, 82, 240, 0.12);
  padding: 2px 8px;
  border-radius: 10px;
}

.date-chip {
  font-size: 11px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 500;
}

.date-chip.overdue {
  color: var(--danger);
  font-weight: 600;
}

.date-chip.soon {
  color: var(--warning);
  font-weight: 600;
}

.date-chip.completed-chip {
  color: var(--success);
  font-weight: 600;
}

/* ── Variance ── */
.variance-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.variance-early {
  background: #dcfce7;
  color: #15803d;
}

.variance-ontime {
  background: #dbeafe;
  color: #1d4ed8;
}

.variance-late {
  background: #ffe4e6;
  color: #be123c;
}

.variance-group {
  justify-content: flex-end;
}

.variance-display {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 4px 0;
}

.variance-empty {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.priority-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.priority-low {
  background: #e5e7eb;
  color: #374151;
}

.priority-medium {
  background: #fef3c7;
  color: #92400e;
}

.priority-high {
  background: #fee2e2;
  color: #b91c1c;
}

.task-percent-chip {
  font-size: 11px;
  font-weight: 700;
  color: #4338ca;
  background: rgba(91, 82, 240, 0.13);
  padding: 2px 8px;
  border-radius: 10px;
}

/* ── Subtasks on Card ── */
.subtask-card-list {
  margin-top: 9px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subtask-card-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.subtask-card-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.subtask-card-item.done span {
  text-decoration: line-through;
  opacity: 0.6;
}

.subtask-card-item .subtask-percent-lbl {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 10.5px;
  color: var(--text-muted);
}

.subtask-bar {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subtask-bar-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.subtask-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s;
}

.subtask-bar-lbl {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
}

/* ── List View ── */
.list-view {
  flex: 1;
  overflow: auto;
  padding: 0 28px 28px;
}

.task-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 13.5px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.task-table th {
  text-align: left;
  padding: 11px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}

.task-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.task-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

.task-table tbody tr:hover td {
  background: var(--surface2);
}

.task-table tr:last-child td {
  border-bottom: none;
}

.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.status-todo {
  background: #e8eaf3;
  color: #475569;
}

.status-inprogress {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-done {
  background: #dcfce7;
  color: #15803d;
}

.no-tasks {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(200, 30, 69, 0.35);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-danger:hover {
  background: rgba(200, 30, 69, 0.1);
}

.btn-export {
  background: #ecfdf5;
  color: var(--success);
  border: 1px solid #a7f3d0;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-export:hover {
  background: #d1fae5;
}

.btn-export:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Modals ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 40, 0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 480px;
  max-width: 100%;
  box-shadow: var(--shadow);
  animation: modalIn 0.18s ease;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-lg {
  width: 550px;
}

.modal-sm {
  width: 380px;
}

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

  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface2);
}

.modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.modal-note {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-body label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.required {
  color: var(--danger);
}

.modal-body input[type="text"],
.modal-body input[type="date"],
.modal-body input[type="number"],
.modal-body input[type="password"],
.modal-body textarea,
.modal-body select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13.5px;
  padding: 9px 12px;
  transition: border-color 0.15s;
  font-family: inherit;
}

.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-body textarea {
  resize: vertical;
}

.modal-body select option {
  background: var(--surface);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.percent-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.percent-input-wrap input[type="number"] {
  width: 88px;
}

.percent-input-wrap .percent-sign {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.percent-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
}

.form-error {
  font-size: 12px;
  font-weight: 600;
  color: var(--danger);
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 7px;
  padding: 7px 10px;
}

/* Color Picker */
.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.1s, border-color 0.1s;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.selected {
  border-color: var(--text);
  transform: scale(1.1);
}

/* Subtask Section in Modal */
.subtask-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.subtask-modal-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

.subtask-modal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
}

.subtask-modal-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.subtask-modal-item span {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}

.subtask-modal-item.done span {
  text-decoration: line-through;
  color: var(--text-muted);
}

.subtask-percent-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.subtask-percent-wrap input[type="number"] {
  width: 54px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 12px;
  text-align: center;
  padding: 3px 4px;
}

.subtask-percent-wrap input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
}

.subtask-percent-wrap .percent-sign {
  font-size: 11px;
  color: var(--text-muted);
}

.subtask-del-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 4px;
  transition: color 0.15s;
}

.subtask-del-btn:hover {
  color: var(--danger);
}

.subtask-add-row {
  display: flex;
  gap: 8px;
}

.subtask-add-row input {
  flex: 1;
}

.btn-add-sub {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.btn-add-sub:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Gantt ── */
.gantt-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 28px 28px;
  overflow: hidden;
}

.gantt-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 2px 2px 12px;
}

.gantt-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.gantt-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gantt-ctrl-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.gantt-ctrl-label:not(:first-child) {
  margin-left: 6px;
}

.gantt-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 12.5px;
  cursor: pointer;
}

.gantt-select:focus {
  outline: none;
  border-color: var(--primary);
}

.gantt-zoom {
  display: flex;
  gap: 3px;
  background: var(--surface2);
  border-radius: 8px;
  padding: 3px;
}

.gantt-zoom-btn {
  padding: 5px 11px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}

.gantt-zoom-btn:hover {
  color: var(--text);
}

.gantt-zoom-btn.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(30, 35, 60, 0.10);
}

.gantt-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gantt-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.gantt-today-key {
  width: 2px;
  height: 14px;
  background: var(--warning);
  display: inline-block;
  border-radius: 1px;
}

.gantt-scroll {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.gantt-chart {
  position: relative;
}

/* Header */
.gantt-headrow {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.gantt-corner {
  flex-shrink: 0;
  position: sticky;
  left: 0;
  z-index: 6;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.gantt-timeline-head {
  position: relative;
  height: 36px;
  flex-shrink: 0;
}

.gantt-tick {
  position: absolute;
  top: 0;
  height: 100%;
  border-left: 1px solid var(--border);
  padding-left: 5px;
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.gantt-tick.major {
  color: var(--text);
  font-weight: 600;
}

/* Rows */
.gantt-row {
  display: flex;
  height: 38px;
  border-bottom: 1px solid var(--border);
}

.gantt-row:last-child {
  border-bottom: none;
}

.gantt-row:hover .gantt-rowlabel {
  background: var(--surface2);
}

.gantt-rowlabel {
  flex-shrink: 0;
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  transition: background 0.15s;
  cursor: pointer;
}

.gantt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.gantt-rowlabel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-lane {
  position: relative;
  flex-shrink: 0;
}

.gantt-lane-grid {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--border);
  pointer-events: none;
}

.gantt-bar {
  position: absolute;
  top: 9px;
  height: 20px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(30, 35, 60, 0.18);
  transition: filter 0.15s;
}

.gantt-bar:hover {
  filter: brightness(1.08);
}

.gantt-bar.overdue {
  box-shadow: 0 0 0 2px var(--danger), 0 1px 3px rgba(30, 35, 60, 0.18);
}

.gantt-bar-milestone {
  width: 15px !important;
  height: 15px;
  padding: 0;
  top: 11px;
  border-radius: 3px;
  transform: rotate(45deg);
}

.gantt-today {
  position: absolute;
  top: 36px;
  width: 2px;
  background: var(--warning);
  z-index: 3;
  pointer-events: none;
}

.gantt-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 40px;
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  background: #1c1f2e;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 9px;
  box-shadow: 0 6px 20px rgba(15, 17, 23, 0.22);
  animation: toastIn 0.2s ease;
  max-width: 320px;
}

.toast.toast-error {
  background: var(--danger);
}

.toast.toast-success {
  background: var(--success);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Scrollbars ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Touch & Responsive ── */
@media (hover: none) {
  .task-card-actions {
    opacity: 1;
  }
}

@media (max-width: 820px) {
  body {
    flex-direction: column;
  }

  .mobile-header {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 4px 0 24px rgba(20, 24, 40, 0.18);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .project-header {
    padding: 14px 16px 12px;
  }

  .project-title-row {
    flex-direction: column;
    gap: 10px;
  }

  .project-actions {
    width: 100%;
  }

  .board-toolbar {
    padding: 10px 16px;
    gap: 10px;
  }

  .filter-bar {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
  }

  .filter-input {
    flex: 1;
    min-width: 140px;
  }

  .board {
    padding: 0 16px 18px;
  }

  .list-view {
    padding: 0 16px 18px;
  }

  .gantt-view {
    padding: 0 16px 18px;
  }

  .task-card-actions {
    opacity: 1;
  }

  .form-row {
    flex-direction: column;
    gap: 10px;
  }
}