/* ========================================
   Task Manager — CSS Design System
   ======================================== */

:root {
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f3f5;
  --bg-hover: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --border-color: #dee2e6;
  --border-light: #e9ecef;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fef2f2;
  --success: #22c55e;
  --success-light: #f0fdf4;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --sidebar-width: 280px;
  --transition-speed: .25s;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

body.dark-theme {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #1e2a45;
  --bg-hover: #253352;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #2d3a54;
  --border-light: #253352;
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-light: rgba(124,58,237,.15);
  --danger: #f87171;
  --danger-hover: #ef4444;
  --danger-light: rgba(248,113,113,.12);
  --success: #4ade80;
  --success-light: rgba(74,222,128,.12);
  --warning: #fbbf24;
  --warning-light: rgba(251,191,36,.12);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.4);
}

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition-speed), color var(--transition-speed);
}

/* ========================================
   Auth Screen
   ======================================== */

.auth-screen {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

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

.auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .3s ease;
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-logo p {
  color: var(--text-secondary);
  font-size: .88rem;
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: .88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.auth-tab.active {
  background: var(--primary);
  color: #fff;
}

.auth-tab:hover:not(.active) {
  background: var(--bg-hover);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-field label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.auth-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: .92rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.auth-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.auth-submit {
  padding: 11px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, transform .1s;
  margin-top: 4px;
}

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

.auth-submit:active {
  transform: scale(.98);
}

.auth-submit:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.auth-error {
  display: none;
  padding: 10px 14px;
  background: var(--danger-light);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: .84rem;
  font-weight: 500;
}

.auth-error.visible {
  display: block;
}

.auth-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  z-index: 10;
}

.auth-theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ========================================
   Layout
   ======================================== */

.app-layout {
  display: none;
  min-height: 100vh;
}

.app-layout.active {
  display: flex;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition-speed) ease, padding var(--transition-speed) ease;
  flex-shrink: 0;
  position: relative;
}

.sidebar.collapsed {
  width: 0;
  padding: 20px 0;
  overflow: hidden;
}

.sidebar.collapsed > *:not(.sidebar-toggle) {
  opacity: 0;
  pointer-events: none;
}

.sidebar-toggle {
  position: absolute;
  top: 16px;
  right: -36px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  z-index: 10;
  transition: background .15s, color .15s, right var(--transition-speed);
}

.sidebar.collapsed .sidebar-toggle {
  right: -44px;
}

.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.sidebar-section-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 10px;
  margin-top: 4px;
  white-space: nowrap;
}

/* Projects */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
  margin-bottom: 8px;
}

.project-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .88rem;
  color: var(--text-secondary);
  transition: background .15s, color .15s;
  white-space: nowrap;
  position: relative;
}

.project-item:hover,
.project-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.project-item.drag-over {
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
}

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

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

.btn-project-menu {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
}

.project-item:hover .btn-project-menu,
.project-item.menu-open .btn-project-menu {
  display: block;
}

.btn-project-menu:hover {
  color: var(--text-primary);
}

.project-menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 8px;
  z-index: 50;
  min-width: 130px;
  padding: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.project-item.menu-open .project-menu-dropdown {
  display: block;
}

.project-menu-item {
  display: block;
  width: 100%;
  padding: 6px 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: .85rem;
  text-align: left;
  cursor: pointer;
}

.project-menu-item:hover {
  background: var(--bg-hover);
}

.project-menu-item[data-action="delete"]:hover {
  color: var(--danger);
}

.btn-add-project {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-top: 6px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  width: 100%;
  white-space: nowrap;
}

.btn-add-project:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Filters */
.filter-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-group select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}

.filter-group select:focus {
  border-color: var(--primary);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 28px 36px;
  overflow-y: auto;
  min-width: 0;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.app-title {
  font-size: 1.5rem;
  font-weight: 800;
  white-space: nowrap;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.user-name {
  font-weight: 600;
  color: var(--text-primary);
}

.btn-logout {
  padding: 5px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: .78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.btn-logout:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}

.btn-invite {
  padding: 5px 12px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--primary);
  font-size: .78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.btn-invite:hover {
  background: var(--primary);
  color: #fff;
}

.search-input {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: .88rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-width: 200px;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-add-task {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: .88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}

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

.btn-add-task:active {
  transform: scale(.97);
}

/* Stats */
.stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stats-bar span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Task List */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100px;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  font-size: 1rem;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
}

/* Task Card */
.task-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px 14px 20px;
  position: relative;
  cursor: grab;
  transition: box-shadow .2s, transform .2s, opacity .2s, border-color .2s;
  box-shadow: var(--shadow-sm);
  animation: taskAppear .3s ease both;
}

.task-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--primary);
}

.task-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light), var(--shadow-md);
}

.task-card.dragging {
  opacity: .45;
  transform: rotate(1deg) scale(1.01);
  cursor: grabbing;
  z-index: 100;
}

.task-card.drag-over {
  border-top: 3px solid var(--primary);
}

.task-card.completed {
  opacity: .5;
}

.task-card.completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Priority Indicator */
.priority-indicator {
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 4px 4px 0;
}

.priority-high   { background: var(--danger); }
.priority-medium { background: var(--warning); }
.priority-low    { background: var(--success); }

/* Task Body */
.task-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Custom Checkbox */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
}

input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task-check {
  flex-shrink: 0;
}

.task-title {
  font-size: .95rem;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  outline: none;
  border-radius: 3px;
  padding: 1px 4px;
  margin: -1px -4px;
  transition: background .15s;
}

.task-title[contenteditable="true"] {
  background: var(--bg-primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.recurring-badge {
  font-size: .68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  white-space: nowrap;
}

.btn-delete-task {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
  line-height: 1;
  transition: color .15s;
  flex-shrink: 0;
}

.task-card:hover .btn-delete-task {
  display: block;
}

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

.task-description {
  font-size: .85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  outline: none;
  border-radius: 3px;
  padding: 1px 4px;
  margin: -1px -4px;
  transition: background .15s;
}

.task-description[contenteditable="true"] {
  background: var(--bg-primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.task-meta .due-date,
.task-meta .task-project,
.task-meta .task-author,
.task-meta .task-assignee {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .74rem;
  line-height: 1.5;
}

.task-meta .due-date {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.task-meta .due-date.overdue {
  background: var(--danger-light);
  color: var(--danger);
  font-weight: 600;
}

.task-meta .task-author {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.task-assignee {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}

/* ---- Help ---- */

.help-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, .45);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.help-overlay.active {
  display: flex;
}

.help-panel {
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-radius: var(--radius-md, 12px);
  box-shadow: var(--shadow-lg);
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-light);
}

.help-header h2 {
  font-size: 1.1rem;
  color: var(--text-primary);
}

.help-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.help-close:hover {
  color: var(--text-primary);
}

.help-body {
  padding: 18px 22px;
  overflow-y: auto;
  color: var(--text-primary);
  font-size: .9rem;
  line-height: 1.55;
}

.help-body h3 {
  margin: 16px 0 6px;
  font-size: .95rem;
}

.help-body ul {
  margin: 0 0 4px;
  padding-left: 20px;
}

.help-body li {
  margin-bottom: 4px;
}

.help-body a {
  color: var(--primary);
}

.help-keys {
  border-collapse: collapse;
}

.help-keys td {
  padding: 3px 14px 3px 0;
}

.help-keys kbd {
  padding: 1px 6px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-tertiary);
  font-size: .78rem;
}

.due-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.task-project {
  font-weight: 600;
}

/* Tags */
.task-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  background: var(--primary-light);
  color: var(--primary);
  cursor: pointer;
  transition: opacity .15s;
}

.tag:hover {
  opacity: .7;
}

/* Subtasks */
.subtask-list {
  margin-top: 4px;
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 2px solid var(--border-light);
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  color: var(--text-secondary);
  padding: 2px 0;
}

.subtask-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
}

.subtask-item input[type="checkbox"]:checked::after {
  left: 3px;
  top: 0;
  width: 5px;
  height: 8px;
}

.btn-del-sub {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}

.subtask-item:hover .btn-del-sub {
  display: block;
}

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

.subtask-progress {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 2px 0;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
  animation: fadeIn .2s ease;
}

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

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .25s ease;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal input[type="text"],
.modal input[type="date"],
.modal textarea,
.modal select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: .88rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.modal input:focus,
.modal textarea:focus,
.modal select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.modal textarea {
  resize: vertical;
  min-height: 70px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.btn-save-task,
.btn-cancel {
  padding: 8px 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.btn-save-task {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

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

.btn-cancel {
  background: var(--bg-primary);
  color: var(--text-secondary);
}

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

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--success);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  box-shadow: var(--shadow-md);
  font-size: .85rem;
  font-weight: 500;
  animation: toastIn .3s ease;
  pointer-events: auto;
}

.toast.error {
  border-left-color: var(--danger);
  color: var(--danger);
}

.toast.fade-out {
  animation: toastOut .4s ease forwards;
}

/* Context Menu */
.context-menu {
  position: fixed;
  z-index: 3000;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  min-width: 200px;
  animation: modalIn .15s ease;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: .85rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background .1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.context-menu-item:hover {
  background: var(--bg-hover);
}

.context-menu-item.danger {
  color: var(--danger);
}

.context-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

.context-menu-label {
  padding: 4px 16px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}

/* Keyboard Hint */
.keyboard-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  white-space: nowrap;
}

.kbd-hint {
  font-size: .68rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: .65rem;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.25);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  backdrop-filter: blur(2px);
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Animations */
@keyframes taskAppear {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(30px); }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 500;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.collapsed {
    width: 0;
    padding: 0;
  }

  .main-content {
    padding: 16px;
  }

  .header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    margin-left: 0;
  }

  .search-input {
    min-width: 0;
    flex: 1;
  }

  .modal {
    width: 95%;
    padding: 20px;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .keyboard-hints {
    display: none;
  }

  .auth-card {
    padding: 24px 20px;
  }
}
