* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f4f6f9; --card: #fff; --primary: #5b7ff7; --primary-light: #eaf0ff;
  --danger: #f2605e; --warning: #f0a030; --success: #3dba6f;
  --text: #1e2a3a; --text2: #5a6577; --text3: #9aa3b2;
  --border: #e3e8f0; --shadow: 0 2px 16px rgba(30,42,58,.06);
  --radius: 14px;
}
body { font-family: -apple-system, 'Segoe UI', 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* Header */
.header { background: linear-gradient(135deg, #5b7ff7 0%, #8b5cf6 100%); color: #fff; padding: 20px 36px; display: flex; align-items: center; justify-content: space-between; }
.header h1 { font-size: 22px; font-weight: 700; }
.header-date { font-size: 15px; opacity: .85; }

/* Main */
.main { max-width: 800px; margin: 0 auto; padding: 24px 20px; }

/* FAB button */
.fab { position: fixed; right: 32px; bottom: 32px; width: 54px; height: 54px; border-radius: 50%; cursor: pointer; transition: all .25s; border: none; background: linear-gradient(135deg, #5b7ff7 0%, #8b5cf6 100%); color: #fff; font-size: 28px; font-weight: 300; box-shadow: 0 4px 20px rgba(91,127,247,.4); z-index: 100; display: flex; align-items: center; justify-content: center; line-height: 1; }
.fab:hover { transform: translateY(-3px) scale(1.06); box-shadow: 0 8px 28px rgba(91,127,247,.5); }

/* Timer row in modal */
.timer-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 10px 14px; background: #f8f9fc; border-radius: 10px; }
.timer-row > label { font-size: 13px; font-weight: 600; color: var(--text3); white-space: nowrap; }
.timer-inputs { display: flex; align-items: center; gap: 4px; flex: 1; }
.timer-num { width: 48px; padding: 6px 8px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 15px; font-weight: 700; text-align: center; outline: none; background: #fff; color: var(--text); transition: border .2s; }
.timer-num:focus { border-color: var(--primary); }
.timer-sep { font-size: 12px; color: var(--text3); }

/* Task timer badge */
.task-timer { display: flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; transition: all .15s; flex-shrink: 0; letter-spacing: .5px; }
.task-timer.idle { background: #f0f2f5; color: var(--text3); border: 1.5px solid #e3e8f0; }
.task-timer.idle:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.task-timer.running { background: #fff5e6; color: #e08e10; border: 1.5px solid #f5d89a; }
.task-timer.paused { background: #eaf0ff; color: var(--primary); border: 1.5px solid #c4d4ff; }

/* Task List */
.list-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; }
.list-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; gap: 10px; }
.list-header h2 { font-size: 17px; font-weight: 700; }
.clear-btn { border: none; background: none; color: var(--text3); font-size: 13px; cursor: pointer; padding: 4px 10px; border-radius: 8px; transition: all .15s; white-space: nowrap; }
.clear-btn:hover { color: var(--danger); background: #fef0f0; }
.list-count { font-size: 13px; color: var(--primary); background: var(--primary-light); padding: 4px 12px; border-radius: 20px; font-weight: 600; }

/* Task list - grid layout for row height sync */
.task-list {
  display: grid; grid-template-columns: 130px 1fr; gap: 6px 10px;
  padding: 0 8px 8px;
}

/* Time block */
.time-block {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: linear-gradient(135deg, #f0f4ff, #f6f0ff); border-radius: 10px;
  cursor: grab; transition: all .2s; border: 1.5px solid transparent;
}
.time-block:hover { border-color: var(--primary-light); box-shadow: 0 2px 8px rgba(91,127,247,.1); }
.time-block .t { font-size: 18px; font-weight: 800; color: var(--primary); letter-spacing: .5px; }
.time-block .d { font-size: 11px; color: var(--text3); font-weight: 500; }
.time-block .drag-h { margin-left: auto; }
.time-block.dragging { opacity: .35; transform: scale(.95); }
.time-block.drag-over { border-color: var(--primary); background: var(--primary-light); }

/* Task block */
.task-block {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--card); border-radius: 12px; box-shadow: 0 1px 6px rgba(30,42,58,.04);
  cursor: grab; transition: all .2s; border: 1.5px solid transparent; min-width: 0;
}
.task-block:hover { box-shadow: 0 2px 10px rgba(91,127,247,.08); border-color: var(--primary-light); }
.task-block.dragging { opacity: .35; transform: scale(.95); }
.task-block.drag-over { border-color: var(--primary); background: var(--primary-light); }
.task-block.done { opacity: .45; }
.task-block.done .task-name { text-decoration: line-through; color: var(--text3); }

/* Content */
.task-info { flex: 1; min-width: 0; }
.task-name { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-meta { display: flex; gap: 8px; margin-top: 5px; align-items: center; }
.tag { padding: 2px 9px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.tag-work { background: #eaf0ff; color: #5b7ff7; }
.tag-life { background: #e8f8ee; color: #3dba6f; }
.tag-study { background: #fff5e6; color: #f0a030; }
.tag-health { background: #fde8e8; color: #f2605e; }
.tag-other { background: #f0f2f5; color: #9aa3b2; }
.pdot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.pdot.high { background: var(--danger); }
.pdot.medium { background: var(--warning); }
.pdot.low { background: var(--success); }

/* Actions */
.task-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; align-items: center; flex-shrink: 0; }
.task-block:hover .task-actions { opacity: 1; }
.task-actions button { background: none; border: none; cursor: pointer; width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--text3); transition: all .15s; }
.task-actions button:hover { background: #f0f1f4; }
.task-actions button.del:hover { color: var(--danger); background: #fef0f0; }

/* Drag handle */
.drag-h { display: flex; align-items: center; justify-content: center; color: var(--text3); font-size: 13px; cursor: grab; opacity: 0; transition: opacity .15s; flex-shrink: 0; }
.time-block:hover .drag-h, .task-block:hover .drag-h { opacity: .5; }
.drag-h:hover { opacity: 1 !important; }

/* Check */
.task-check {
  width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid var(--border);
  cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: all .2s; font-size: 12px; color: transparent;
}
.task-check:hover { border-color: var(--success); color: var(--success); }
.task-block.done .task-check { background: var(--success); border-color: var(--success); color: #fff; }

/* Empty */
.empty { text-align: center; padding: 56px 20px; color: var(--text3); }
.empty .ico { font-size: 56px; margin-bottom: 14px; }
.empty p { font-size: 16px; line-height: 1.7; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(30,42,58,.3); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 200; }
.modal-bg.show { display: flex; }
.modal { background: var(--card); border-radius: 18px; padding: 28px; width: 440px; max-width: 92vw; box-shadow: 0 20px 60px rgba(30,42,58,.15); }
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.modal .fg { margin-bottom: 14px; }
.modal .fg label { display: block; font-size: 13px; font-weight: 600; color: var(--text3); margin-bottom: 5px; }
.modal .fg input, .modal .fg select, .modal .fg textarea { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 15px; outline: none; transition: border .2s; font-family: inherit; background: #fafbfd; }
.modal .fg input:focus, .modal .fg select:focus, .modal .fg textarea:focus { border-color: var(--primary); background: #fff; }
.modal .fr { display: flex; gap: 12px; }
.modal .fr .fg { flex: 1; }
.modal .br { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.btn { padding: 10px 24px; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s; }
.btn-p { background: var(--primary); color: #fff; }
.btn-p:hover { background: #4a6ee6; }
.btn-g { background: none; color: var(--text2); }
.btn-g:hover { background: #f5f6f8; }

/* Time stepper */
.time-step {
  display: flex; align-items: center; gap: 8px; margin: 0 auto 20px;
  justify-content: center;
}
.time-step .ts-group {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.time-step .ts-btn {
  width: 48px; height: 18px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer; padding: 0;
  border-radius: 8px; transition: all .15s;
}
.time-step .ts-btn svg {
  width: 10px; height: 10px; stroke: #b0b7cc; stroke-width: 2;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
  transition: all .15s;
}
.time-step .ts-btn:hover { background: rgba(91,127,247,.08); }
.time-step .ts-btn:hover svg { stroke: var(--primary); }
.time-step .ts-btn:active { background: rgba(91,127,247,.15); transform: scale(.9); }
.time-step .ts-btn:active svg { stroke: #4a6ae0; }
.time-step .ts-val {
  width: 52px; height: 42px; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: var(--primary);
  background: #f5f6fb; border-radius: 12px; user-select: none;
  transition: background .2s;
}
.time-step .sep {
  font-size: 24px; font-weight: 700; color: #c0c6d8;
  user-select: none; margin-top: -10px;
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
@media (max-width: 600px) {
  .task-list { grid-template-columns: 100px 1fr; }
  .time-block .t { font-size: 16px; }
}
