/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-tertiary: #1c1c1e;
  --bg-card: #1c1c1e;
  --bg-card-hover: #2c2c2e;
  --bg-modal: #1c1c1e;
  --bg-input: #2c2c2e;
  --border: rgba(255,255,255,0.08);
  --border-focus: rgba(255,255,255,0.25);
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #636366;
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --green: #30d158;
  --yellow: #ffd60a;
  --orange: #ff9f0a;
  --red: #ff453a;
  --purple: #bf5af2;
  --pink: #ff2d55;
  --teal: #5ac8fa;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-focus); border-radius: 3px; }

/* ===== LAYOUT ===== */
#app { display: flex; flex-direction: column; height: 100vh; }

/* ===== TOPBAR ===== */
#topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(20,20,20,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  margin-right: 4px;
}

.topbar-nav {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.nav-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.nav-btn.active { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }

.topbar-spacer { flex: 1; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); }
.btn-secondary:hover { background: var(--bg-card-hover); }
.btn-ghost { background: none; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-input); color: var(--text-primary); }
.btn-danger { background: rgba(255,69,58,0.15); color: var(--red); }
.btn-danger:hover { background: rgba(255,69,58,0.25); }
.btn-icon { padding: 7px; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Sync indicator */
.sync-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  cursor: default;
  white-space: nowrap;
}
.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-tertiary);
  transition: background 0.3s;
}
.sync-indicator.synced .sync-dot { background: var(--green); }
.sync-indicator.saving .sync-dot {
  background: var(--orange);
  animation: syncPulse 0.8s ease infinite;
}
.sync-indicator.offline .sync-dot { background: var(--red); }
.sync-indicator.error .sync-dot { background: var(--red); }
@keyframes syncPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.sync-label { color: var(--text-secondary); font-size: 11px; font-weight: 500; }

@media (max-width: 640px) {
  .sync-label { display: none; }
  .sync-indicator { padding: 4px 6px; }
}

/* User selector */
.user-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
  color: var(--text-primary);
}
.user-selector:hover { border-color: var(--border-focus); }

.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
}
.avatar-sm { width: 20px; height: 20px; font-size: 9px; }
.avatar-lg { width: 32px; height: 32px; font-size: 14px; }

/* ===== MAIN CONTENT ===== */
#main { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

.view { display: none; flex: 1; overflow: hidden; flex-direction: column; }
.view.active { display: flex; }

/* ===== BOARD & LIST SHARED ===== */
.view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 12px;
  flex-shrink: 0;
}
.view-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* ===== BOARD VIEW ===== */
#board-view .board-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 20px 20px;
}
.board-columns {
  display: flex;
  gap: 14px;
  height: 100%;
  align-items: flex-start;
  padding-bottom: 8px;
}
.board-column {
  flex-shrink: 0;
  width: 272px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 180px);
}
.column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 10px;
  flex-shrink: 0;
}
.column-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.column-name {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  color: var(--text-primary);
}
.column-count {
  font-size: 12px;
  color: var(--text-tertiary);
  background: var(--bg-input);
  padding: 2px 7px;
  border-radius: 10px;
}
.column-cards {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}
.column-add {
  padding: 8px 10px 12px;
  flex-shrink: 0;
}
.column-add-btn {
  width: 100%;
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 13px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}
.column-add-btn:hover { border-color: var(--border-focus); color: var(--text-secondary); background: var(--bg-input); }

.board-add-column {
  flex-shrink: 0;
  width: 240px;
  display: flex;
  align-items: flex-start;
  padding-top: 4px;
}
.add-column-btn {
  background: var(--bg-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
  padding: 12px 18px;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.add-column-btn:hover { border-color: var(--border-focus); color: var(--text-secondary); }

/* ===== TASK CARD ===== */
.task-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 12px;
  cursor: grab;
  transition: all 0.15s ease;
  position: relative;
  user-select: none;
}
.task-card:hover { border-color: var(--border-focus); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.task-card:active { cursor: grabbing; }
.task-card.completed { opacity: 0.5; }
.task-card.dragging { opacity: 0.3; cursor: grabbing; }
.task-card.drag-over { border-color: var(--accent); background: rgba(10,132,255,0.05); }

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.card-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-focus);
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  margin-top: 1px;
}
.card-check:hover { border-color: var(--green); }
.card-check.checked { background: var(--green); border-color: var(--green); }
.card-check svg { width: 10px; height: 10px; color: #fff; display: none; }
.card-check.checked svg { display: block; }

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
}
.task-card.completed .card-title { text-decoration: line-through; color: var(--text-tertiary); }

.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.priority-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 10px;
}
.priority-low { background: rgba(48,209,88,0.15); color: var(--green); }
.priority-medium { background: rgba(255,159,10,0.15); color: var(--orange); }
.priority-high { background: rgba(255,69,58,0.15); color: var(--red); }

.card-assignee { margin-left: auto; }

.card-week-indicator {
  font-size: 11px;
  color: var(--teal);
  background: rgba(90,200,250,0.1);
  padding: 2px 7px;
  border-radius: 10px;
}

/* ===== LIST VIEW ===== */
#list-view .list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
}
.list-category {
  margin-bottom: 20px;
}
.list-category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.list-category-name {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
}
.list-item:hover { background: var(--bg-card); }
.list-item.completed .list-item-title { text-decoration: line-through; color: var(--text-tertiary); }
.list-item-title { font-size: 14px; font-weight: 500; flex: 1; }
.list-item-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.list-item-info { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ===== WEEK VIEW ===== */
#week-view {
  overflow: hidden;
}
#week-view .week-scroll {
  flex: 1;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.week-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Sticky day headers inside week grid */
.week-sticky-header {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 20;
}
.week-header-spacer {
  width: 52px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}
.week-header-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(80px, 1fr));
  flex: 1;
}
.week-day-header {
  padding: 8px 6px;
  text-align: center;
  border-right: 1px solid var(--border);
}
.week-day-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.week-day-date {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 1px;
  line-height: 1;
}
.week-day-header.today .week-day-date { color: var(--accent); }

/* Scrollable body */
.week-body-scroll {
  flex: 1;
  overflow: auto;
  display: flex;
}
.week-time-col {
  width: 52px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  position: sticky;
  left: 0;
  background: var(--bg-primary);
  z-index: 10;
}
.week-time-tick {
  height: 64px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 3px 8px 0 0;
  font-size: 11px;
  color: var(--text-tertiary);
  box-sizing: border-box;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.week-days-body {
  display: grid;
  grid-template-columns: repeat(7, minmax(80px, 1fr));
  flex: 1;
}
.week-day-col {
  position: relative;
  border-right: 1px solid var(--border);
}
.week-day-col:last-child { border-right: none; }
.week-day-col.drag-over { background: rgba(10,132,255,0.06); }
.week-hour-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.week-hour-line {
  height: 64px;
  box-sizing: border-box;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Absolute-positioned task blocks */
.week-task-block {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 6px;
  padding: 4px 6px 12px;
  font-size: 11px;
  font-weight: 500;
  overflow: hidden;
  cursor: grab;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  transition: opacity 0.1s, box-shadow 0.1s;
  user-select: none;
  z-index: 2;
  min-height: 20px;
}
.week-task-block:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.4); }
.week-task-block:active { cursor: grabbing; opacity: 0.7; }
.week-task-block .block-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-height: 0;
}
.week-task-block .block-assignee {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.8;
  margin-top: 2px;
  flex-shrink: 0;
}
.week-task-resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 10px;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 0 6px 6px;
  touch-action: none;
}
.week-task-resize-handle::after {
  content: '';
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,0.35);
  border-radius: 1px;
}
.week-task-resize-handle:hover::after { background: rgba(255,255,255,0.7); }

/* Drop ghost line in day col */
.week-drop-indicator {
  position: absolute;
  left: 2px;
  right: 2px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  pointer-events: none;
  z-index: 5;
}

/* Unscheduled panel */
.unscheduled-panel {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 10px 20px;
  background: var(--bg-secondary);
  max-height: 120px;
  overflow-y: auto;
}
.unscheduled-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.unscheduled-tasks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.unscheduled-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 500;
  cursor: grab;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  user-select: none;
  touch-action: none;
}
.unscheduled-chip:hover { border-color: var(--border-focus); }
.unscheduled-chip:active { cursor: grabbing; }

/* ===== TRASH VIEW ===== */
#trash-view .trash-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
}
.trash-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  border: 1px solid var(--border);
  opacity: 0.7;
}
.trash-item-info { flex: 1; }
.trash-item-title { font-size: 14px; font-weight: 500; text-decoration: line-through; color: var(--text-secondary); }
.trash-item-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.trash-item-actions { display: flex; gap: 6px; }

/* ===== PRIORITY VIEW ===== */
#priority-view .priority-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
}
.priority-section { margin-bottom: 24px; }
.priority-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 0 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.priority-section-title.high { color: var(--red); }
.priority-section-title.medium { color: var(--orange); }
.priority-section-title.low { color: var(--green); }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.2s ease;
  overflow: hidden;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-wide { max-width: 600px; }

.modal-header {
  display: flex;
  align-items: center;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 17px; font-weight: 600; flex: 1; }
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.modal-footer {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  justify-content: flex-end;
}

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-select option { background: var(--bg-tertiary); }

.priority-selector { display: flex; gap: 8px; }
.priority-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 12px;
  font-weight: 500;
  background: none;
  color: var(--text-secondary);
}
.priority-option:hover { border-color: var(--border-focus); }
.priority-option.selected-low { background: rgba(48,209,88,0.12); border-color: var(--green); color: var(--green); }
.priority-option.selected-medium { background: rgba(255,159,10,0.12); border-color: var(--orange); color: var(--orange); }
.priority-option.selected-high { background: rgba(255,69,58,0.12); border-color: var(--red); color: var(--red); }

/* ===== MANAGE PANELS ===== */
.manage-list { display: flex; flex-direction: column; gap: 6px; }
.manage-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--border);
}
.manage-item-name { flex: 1; font-size: 14px; font-weight: 500; }
.manage-item-actions { display: flex; gap: 4px; }
.manage-item input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  font-family: var(--font);
}
.color-dot-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.1s;
}
.color-dot.selected { border-color: #fff; }

/* ===== TASK HIGHLIGHT (navigate-to) ===== */
@keyframes taskHighlightPulse {
  0%   { box-shadow: 0 0 0 0 rgba(10,132,255,0.7); border-color: var(--accent); }
  40%  { box-shadow: 0 0 0 8px rgba(10,132,255,0.2); border-color: var(--accent); }
  100% { box-shadow: none; border-color: var(--border); }
}
.task-card.task-highlight {
  animation: taskHighlightPulse 1.6s ease forwards;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
  text-align: center;
}
.empty-state svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.toast {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.2s ease;
  max-width: 300px;
}
@keyframes slideInRight {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== DRAG PLACEHOLDER ===== */
.drop-placeholder {
  height: 80px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-md);
  background: rgba(10,132,255,0.05);
  pointer-events: none;
}

/* ===== ICON BTN SMALL ===== */
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  padding: 4px;
  border-radius: 4px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
}
.icon-btn:hover { color: var(--text-primary); background: var(--bg-input); }
.icon-btn.danger:hover { color: var(--red); }

/* ===== CONTEXT MENU ===== */
.context-menu {
  position: fixed;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 600;
  overflow: hidden;
  min-width: 160px;
}
.context-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}
.context-item:hover { background: var(--bg-input); }
.context-item.danger { color: var(--red); }
.context-divider { height: 1px; background: var(--border); margin: 3px 0; }

/* ===== RESPONSIVE ===== */

/* Tablet (768px) */
@media (max-width: 900px) {
  .topbar-title { display: none; }
  .topbar-nav { gap: 2px; }
  .nav-btn { padding: 5px 8px; font-size: 12px; }
  .modal { max-width: 96vw; }
  .modal-wide { max-width: 96vw; }
  .week-header-days { grid-template-columns: repeat(7, minmax(64px, 1fr)); }
  .week-days-body { grid-template-columns: repeat(7, minmax(64px, 1fr)); }
}

/* Mobile (640px) */
@media (max-width: 640px) {
  #topbar {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .topbar-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .topbar-nav::-webkit-scrollbar { display: none; }
  .topbar-spacer { display: none; }
  .topbar-actions { margin-left: auto; }

  /* User selector: compact */
  #topbar-username { display: none; }
  .user-selector { padding: 5px 7px; gap: 4px; }
  .user-selector svg { display: none; }

  .view-header { padding: 12px 12px 8px; }
  .view-title { font-size: 18px; }

  /* Board: horizontal scroll */
  #board-view .board-scroll { padding: 0 12px 12px; }
  .board-column { width: 240px; }

  /* List */
  #list-view .list-scroll { padding: 0 12px 12px; }
  .list-item-info .icon-btn { display: none; }
  .list-item-info .icon-btn:first-child { display: flex; }

  /* Week: fewer cols min-width so user can scroll */
  .week-header-days { grid-template-columns: repeat(7, minmax(52px, 1fr)); }
  .week-days-body { grid-template-columns: repeat(7, minmax(52px, 1fr)); }
  .week-day-date { font-size: 14px; }
  .week-day-name { font-size: 10px; }
  .week-time-col { width: 40px; }
  .week-header-spacer { width: 40px; }
  .week-time-tick { font-size: 10px; padding-right: 5px; }

  /* Unscheduled panel compact */
  .unscheduled-panel { padding: 8px 12px; max-height: 90px; }
  .unscheduled-chip span { max-width: 80px; }

  /* Priority / Trash */
  #priority-view .priority-scroll,
  #trash-view .trash-scroll { padding: 0 12px 12px; }
  .trash-item { flex-direction: column; align-items: flex-start; gap: 8px; }
  .trash-item-actions { width: 100%; }

  /* Modals full-screen on mobile */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh;
    max-width: 100%;
  }

  /* Buttons: larger touch targets */
  .btn { padding: 9px 14px; }
  .card-check { width: 22px; height: 22px; }
}

/* Touch: larger resize handle */
@media (hover: none) {
  .week-task-resize-handle { height: 16px; }
  .week-task-resize-handle::after { width: 30px; height: 3px; }
  .unscheduled-chip { padding: 8px 12px; }
}
