:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1a1d23;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --primary: #4f6ef7;
  --primary-soft: #eef1fe;
  --primary-dark: #3b5ae0;
  --success: #22c55e;
  --success-soft: #ecfdf5;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --p1: #ef4444;
  --p2: #f59e0b;
  --p3: #4f6ef7;
  --p4: #9ca3af;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.08);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, 'PingFang SC', sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== App Container ===== */
#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 100px;
  min-height: 100vh;
  animation: fadeIn 0.3s ease;
}

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

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

/* ===== Tab Bar ===== */
#tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 6px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 8px;
  flex: 1;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.tab-item svg {
  width: 22px;
  height: 22px;
  transition: transform var(--transition);
}

.tab-item.active {
  color: var(--primary);
}

.tab-item.active svg {
  transform: scale(1.1);
}

/* ===== Page Header ===== */
.page-header {
  padding: 8px 0 20px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* ===== Card ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* ===== Task Page ===== */

/* Quick-add Bar */
.quick-add {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 14px;
  margin-bottom: 8px;
}

.quick-add-input {
  flex: 1;
  border: none;
  font-size: 15px;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
}

.quick-add-input::placeholder {
  color: var(--text-secondary);
}

.quick-add-toggle {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.quick-add-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition);
}

.quick-add-toggle.open svg {
  transform: rotate(45deg);
}

.quick-add-toggle:hover {
  background: var(--primary);
  color: #fff;
}

/* Options toolbar (collapsible) */
.quick-add-opts {
  display: flex;
  gap: 8px;
  padding: 0 4px;
  margin-bottom: 12px;
  overflow: hidden;
  max-height: 48px;
  opacity: 1;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.25s ease;
}

.quick-add-opts.collapsed {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
}

.opt-select,
.opt-due,
.opt-notes {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  font-family: inherit;
  transition: border-color var(--transition);
}

.opt-select {
  width: 72px;
}

.opt-due {
  width: auto;
}

.opt-notes {
  flex: 1;
  min-width: 0;
}

.opt-select:focus,
.opt-due:focus,
.opt-notes:focus {
  border-color: var(--primary);
}

/* Compact Toolbar */
.task-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.task-count {
  font-size: 13px;
  color: var(--text-secondary);
  margin-right: auto;
}

.toolbar-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  font-family: inherit;
}

.toolbar-btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}

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

/* Task Item */
.task-list {
  list-style: none;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 6px;
  transition: all var(--transition);
  cursor: default;
}

.task-item:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

/* Priority Dot */
.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.priority-dot.p1 {
  background: var(--p1);
}

.priority-dot.p2 {
  background: var(--p2);
}

.priority-dot.p3 {
  background: var(--p3);
}

.priority-dot.p4 {
  background: var(--p4);
}

.task-check {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.task-check:checked {
  background: var(--success);
  border-color: var(--success);
}

.task-check:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task-check:hover {
  border-color: var(--primary);
}

.task-content {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.task-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  word-break: break-word;
}

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

.task-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-secondary);
}

.meta-notes {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta-due {
  white-space: nowrap;
}

.meta-due.overdue {
  color: var(--danger);
}

/* Hover Actions */
.task-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
  flex-shrink: 0;
}

.task-item:hover .task-actions {
  opacity: 1;
}

.action-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all var(--transition);
}

.action-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

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

.action-delete:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-secondary);
}

.empty-state svg {
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
  opacity: 0.4;
}

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

/* ===== Shared Components ===== */
.form-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.form-options select,
.form-options input[type="datetime-local"] {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  font-family: inherit;
  transition: border-color var(--transition);
}

.form-options select:focus,
.form-options input[type="datetime-local"]:focus {
  border-color: var(--primary);
}

.form-row {
  margin-bottom: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.btn {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

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

.modal-card textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  resize: vertical;
  min-height: 82px;
  outline: none;
  color: var(--text);
  background: var(--bg);
  font-family: inherit;
}

.modal-card textarea:focus {
  border-color: var(--primary);
}

/* ===== Focus Page ===== */
.focus-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
}

.timer-ring-wrap {
  position: relative;
  width: 260px;
  height: 260px;
  margin-bottom: 32px;
}

.timer-ring-wrap svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}

.timer-ring-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

.timer-ring-progress.on-break {
  stroke: var(--success);
}

.timer-display {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer-time {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

.timer-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.focus-settings {
  width: 100%;
  max-width: 360px;
}

.focus-settings .card {
  padding: 14px 16px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.setting-row+.setting-row {
  border-top: 1px solid var(--border);
}

.setting-row label {
  font-size: 14px;
  color: var(--text);
}

.setting-row select,
.setting-row input[type="number"] {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  width: 80px;
  text-align: center;
  outline: none;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition);
}

.setting-row select {
  width: auto;
  max-width: 180px;
  text-align: left;
}

.setting-row select:focus,
.setting-row input[type="number"]:focus {
  border-color: var(--primary);
}

.focus-action {
  margin-top: 24px;
  width: 100%;
  max-width: 360px;
}

.btn-focus {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

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

.btn-start:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 110, 247, 0.35);
}

.btn-stop {
  background: var(--danger);
  color: #fff;
}

.btn-stop:hover {
  background: #dc2626;
}

.btn-ghost-control {
  margin-top: 10px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost-control:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.hidden {
  display: none;
}

.timer-segment {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ===== Focus History ===== */
.focus-history {
  margin-top: 32px;
  width: 100%;
  max-width: 420px;
  align-self: center;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.history-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.history-summary {
  display: flex;
  gap: 6px;
}

.summary-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
}

.summary-pill.done {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.summary-pill.cancel {
  background: rgba(239, 68, 68, 0.10);
  color: #dc2626;
}

.summary-pill.total {
  background: rgba(99, 102, 241, 0.10);
  color: var(--primary);
}

.history-list {
  display: flex;
  flex-direction: column;
}

.history-item {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  min-height: 52px;
}

.history-time {
  width: 48px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding-top: 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.history-dot-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 28px;
  flex-shrink: 0;
  position: relative;
}

.history-dot-col::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--border);
  transform: translateX(-50%);
}

.history-item:first-child .history-dot-col::before {
  top: 50%;
}

.history-item:last-child .history-dot-col::before {
  bottom: 50%;
}

.history-item:only-child .history-dot-col::before {
  display: none;
}

.history-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 11px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.history-dot.completed {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.history-dot.cancelled {
  background: var(--text-secondary);
  box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.12);
}

.history-body {
  flex: 1;
  min-width: 0;
  padding: 6px 0 6px 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  border-bottom: 1px solid var(--border);
}

.history-item:last-child .history-body {
  border-bottom: none;
}

.history-task {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item.cancelled .history-task {
  color: var(--text-secondary);
}

.history-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 0;
  color: var(--text-secondary);
  opacity: 0.5;
}

.history-empty p {
  font-size: 13px;
  margin: 0;
}

/* ===== Stats Page ===== */
.stats-hero {
  background: linear-gradient(135deg, var(--primary), #7c5ce7);
  border-radius: var(--radius);
  padding: 24px;
  color: #fff;
  margin-bottom: 16px;
}

.stats-hero-title {
  font-size: 14px;
  opacity: 0.85;
  margin-bottom: 8px;
}

.stats-hero-value {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -1px;
}

.stats-hero-sub {
  font-size: 13px;
  opacity: 0.75;
  margin-top: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.priority-dist {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.priority-dist h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
}

.priority-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.priority-bar-row:last-child {
  margin-bottom: 0;
}

.priority-bar-label {
  font-size: 13px;
  font-weight: 600;
  width: 28px;
  flex-shrink: 0;
}

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

.priority-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.priority-bar-fill.p1 {
  background: var(--p1);
}

.priority-bar-fill.p2 {
  background: var(--p2);
}

.priority-bar-fill.p3 {
  background: var(--p3);
}

.priority-bar-fill.p4 {
  background: var(--p4);
}

.priority-bar-count {
  font-size: 13px;
  color: var(--text-secondary);
  width: 24px;
  text-align: right;
  flex-shrink: 0;
}

/* ===== Heatmap ===== */
.heatmap-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
  position: relative;
}

.heatmap-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.heatmap-scroll {
  overflow-x: auto;
  padding-left: 24px;
}

.heatmap-week-labels {
  position: absolute;
  left: 16px;
  top: 52px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
  color: var(--text-secondary);
}

.heatmap-week-labels span {
  height: 14px;
  line-height: 14px;
}

.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 14px);
  grid-auto-flow: column;
  grid-auto-columns: 14px;
  gap: 3px;
}

.heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  transition: transform 0.15s ease;
}

.heatmap-cell:hover:not(.empty) {
  transform: scale(1.3);
}

.heatmap-cell.empty {
  visibility: hidden;
}

.heatmap-cell.level-0 {
  background: var(--bg);
}

.heatmap-cell.level-1 {
  background: #c7d2fe;
}

.heatmap-cell.level-2 {
  background: #818cf8;
}

.heatmap-cell.level-3 {
  background: #6366f1;
}

.heatmap-cell.level-4 {
  background: #4338ca;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  justify-content: flex-end;
  font-size: 11px;
  color: var(--text-secondary);
}

.heatmap-legend .heatmap-cell {
  width: 12px;
  height: 12px;
}

/* ===== Trend Chart ===== */
.trend-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.trend-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.trend-canvas-wrap {
  width: 100%;
  overflow-x: auto;
}

.trend-canvas {
  display: block;
  max-width: 100%;
}

.trend-labels {
  display: flex;
  justify-content: space-between;
  padding: 6px 16px 0 44px;
  font-size: 11px;
  color: var(--text-secondary);
}

.btn-inline {
  padding: 6px 10px;
  border: 1px solid transparent;
}

.btn-inline:hover {
  border-color: var(--border);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 34, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 18px;
}

.modal-card h3 {
  font-size: 20px;
  margin-bottom: 12px;
}

.modal-card input[type="text"],
.modal-card input[type="number"],
.modal-card input[type="color"],
.modal-card input[type="datetime-local"],
.modal-card select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--bg);
  font-family: inherit;
  outline: none;
}

.modal-card input[type="text"]:focus,
.modal-card input[type="number"]:focus,
.modal-card input[type="datetime-local"]:focus,
.modal-card select:focus {
  border-color: var(--primary);
}

.edit-completed-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-top: 4px;
}

.toast-holder {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 140;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: rgba(16, 24, 40, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.16s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  #app {
    padding: 16px 12px 90px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .timer-ring-wrap {
    width: 220px;
    height: 220px;
  }

  .timer-time {
    font-size: 44px;
  }

  .task-controls {
    grid-template-columns: 1fr;
  }

  .sort-bar {
    flex-wrap: wrap;
  }

  .task-delete,
  .task-edit {
    opacity: 1;
  }
}

.reorder-tip {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 2px 0 10px;
}

.reorder-tip.disabled {
  opacity: 0.75;
}

.task-item.draggable {
  cursor: grab;
}

.task-item.dragging {
  opacity: 0.45;
  transform: scale(0.99);
}

.task-drag {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: grab;
  width: 20px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.task-drag svg {
  width: 14px;
  height: 14px;
}

.task-drag:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ===== Habits Page ===== */
.habit-quick-add {
  margin-bottom: 14px;
}

.habit-quick-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.habit-quick-meta {
  grid-template-columns: 1fr 90px 56px;
  margin-top: 8px;
}

.habit-quick-add input[type="text"],
.habit-quick-add input[type="number"],
.habit-quick-add input[type="color"] {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  color: var(--text);
}

.habit-quick-add input:focus {
  border-color: var(--primary);
}

.habit-create-btn {
  padding: 10px 16px;
}

.habit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.habit-card {
  margin-bottom: 0;
}

.habit-main {
  display: flex;
  gap: 12px;
}

.habit-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.habit-info {
  min-width: 0;
  flex: 1;
}

.habit-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.habit-title-row h3 {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.habit-target {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.habit-notes {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.habit-metrics {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 12px;
}

.habit-days {
  margin-top: 10px;
  display: flex;
  gap: 6px;
}

.habit-day-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e5e7eb;
}

.habit-day-dot.done {
  background: var(--success);
}

.habit-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.habit-actions .btn {
  padding: 8px 12px;
}

@media (max-width: 480px) {
  .habit-quick-row {
    grid-template-columns: 1fr;
  }

  .habit-quick-meta {
    grid-template-columns: 1fr 1fr 60px;
  }

  .habit-actions {
    justify-content: stretch;
  }

  .habit-actions .btn {
    flex: 1;
  }
}
