*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Microsoft YaHei UI', 'Segoe UI', sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

.app {
  width: 100%;
  max-width: 520px;
  height: min(95dvh, 780px);
}

.window {
  background: white;
  border-radius: 14px;
  border: 1px solid #e4e6eb;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

@media (max-width: 540px) {
  html, body { position: fixed; overflow: hidden; width: 100%; height: 100%; }
  body { padding: 0; }
  .app { height: 100%; max-width: 100%; }
  .window { border-radius: 0; border: none; box-shadow: none; }
  .task-title-input, .record-input-edit { font-size: 16px; }
}

/* ─── Header / Page Nav ────────────────── */
.header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
  gap: 4px;
}
.page-nav-btn {
  padding: 6px 18px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: #8c8c8c;
  cursor: pointer;
  border-radius: 8px;
  font-family: inherit;
  transition: all .2s;
}
.page-nav-btn.active {
  background: #5b7fff;
  color: white;
}
.page-nav-btn:hover:not(.active) { background: #f0f0f0; color: #333; }

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

/* ─── Top Panel ───────────────────────── */
.top-panel {
  flex: 2;
  display: flex;
  flex-direction: column;
  min-height: 120px;
  overflow: hidden;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
  flex-shrink: 0;
}
.tabs {
  display: flex;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 3px;
}
.tab {
  padding: 5px 18px;
  border: none;
  background: transparent;
  color: #999;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  transition: all .2s;
}
.tab.active {
  background: white;
  color: #1a1a1a;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  font-weight: 500;
}
.tab:hover:not(.active) { color: #555; }

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-add-task {
  width: 28px; height: 28px;
  border: none; background: transparent;
  font-size: 14px; cursor: pointer;
  border-radius: 6px; line-height: 1;
  transition: background .15s;
}
.btn-add-task:hover { background: #e8f0fe; }

.task-count {
  font-size: 12px;
  color: #b0b0b0;
  flex-shrink: 0;
}

.task-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 8px 8px;
  min-height: 0;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  min-height: 40px;
  cursor: pointer;
  transition: background .15s;
  border-left: 3px solid transparent;
}
.task-item:hover { background: #f5f5f5; }
.task-item.selected { background: #eef1ff; border-left-color: #5b7fff; }

.task-check {
  width: 28px; height: 28px;
  border: none; background: transparent;
  cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border-radius: 6px;
  transition: background .15s;
}
.task-check:hover { background: #e0e0e0; }

.task-title-area {
  flex: 1;
  min-width: 0;
}
.task-title-text {
  font-size: 15px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: text;
}
.task-title-input {
  width: 100%;
  font-size: 15px;
  padding: 4px 6px;
  border: 1px solid #5b7fff;
  border-radius: 6px;
  outline: none;
  font-family: inherit;
  background: #fafbff;
}

.task-record-badge {
  background: #e8e8e8;
  border-radius: 10px;
  min-width: 24px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #777;
  padding: 0 6px;
  flex-shrink: 0;
  font-weight: 500;
}

.task-delete {
  width: 26px; height: 26px;
  border: none; background: transparent;
  color: #ccc; font-size: 13px;
  cursor: pointer; border-radius: 6px;
  transition: all .15s;
  opacity: 0;
}
.task-item:hover .task-delete { opacity: 1; }
.task-delete:hover { color: #e55; background: #fee; }

/* ─── Bottom Panel ────────────────────── */
.bottom-panel {
  flex: 3;
  display: flex;
  flex-direction: column;
  min-height: 120px;
  border-top: 1px solid #e8e8e8;
  background: #fafafa;
}
.sel-task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: white;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
}
.sel-task-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}
.sel-task-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sel-task-count {
  font-size: 12px;
  color: #b0b0b0;
}
.btn-add-record {
  width: 28px; height: 28px;
  border: none; background: transparent;
  font-size: 14px; cursor: pointer;
  border-radius: 6px; line-height: 1;
  transition: background .15s;
}
.btn-add-record:hover { background: #e8f0fe; }

.records-area {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px 10px;
}
.empty-records {
  text-align: center;
  color: #bbb;
  font-size: 14px;
  padding: 24px 0;
}

.record-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  margin: 4px 2px 2px;
  background: #eef0f2;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  user-select: none;
}
.record-group-header:hover { background: #e6e8ea; }
.group-toggle {
  font-size: 9px;
  color: #999;
}

.record-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  margin: 1px 2px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.record-item:hover { background: #f0f0f0; }
.record-item.selected { background: #eef1ff; }
.record-item.selected .record-time { color: #5b7fff; font-weight: 500; }
.record-item.editing { background: #f0f5ff; }
.record-item.done { opacity: 0.55; }

.record-check {
  width: 26px; height: 26px;
  border: none; background: transparent;
  cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; border-radius: 6px;
  transition: background .15s;
}
.record-check:hover { background: #dce0e6; }
.record-check:active { transform: scale(.9); }

.record-time {
  font-size: 12px;
  color: #b0b0b0;
  min-width: 34px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.record-content {
  flex: 1;
  font-size: 14px;
  color: #323232;
  line-height: 1.5;
  word-break: break-word;
  padding: 1px 0;
  cursor: default;
}
.record-content.done-text { text-decoration: line-through; color: #aaa; }
.record-input-edit {
  width: 100%;
  font-size: 14px;
  padding: 4px 6px;
  border: 1px solid #5b7fff;
  border-radius: 6px;
  outline: none;
  font-family: inherit;
  background: #fafbff;
}
.record-path-btn {
  width: 26px; height: 26px;
  border: none; background: transparent;
  font-size: 13px; cursor: pointer;
  flex-shrink: 0;
  border-radius: 5px;
  transition: background .15s;
}
.record-path-btn:hover { background: #e0e0e0; }

.record-remind {
  width: 24px; height: 24px;
  border: none; background: transparent;
  font-size: 11px; cursor: pointer;
  border-radius: 5px; flex-shrink: 0;
  opacity: 0.4;
  transition: opacity .2s;
}
.record-item:hover .record-remind { opacity: 1; }
.record-remind:hover { background: #fff3cd; }

.record-delete {
  width: 24px; height: 24px;
  border: none; background: transparent;
  color: #ccc; font-size: 11px;
  cursor: pointer; flex-shrink: 0;
  border-radius: 5px;
  opacity: 0;
  transition: opacity .15s;
}
.record-item:hover .record-delete { opacity: 1; }
.record-delete:hover { color: #e55; background: #fee; }

/* ─── Reminder Modal ──────────────────────── */
.reminder-modal {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.reminder-modal-content {
  background: white; border-radius: 14px; padding: 20px;
  width: 100%; max-width: 320px;
  box-shadow: 0 8px 40px rgba(0,0,0,.15);
}
.reminder-modal-title {
  font-size: 15px; font-weight: 600; text-align: center;
  margin-bottom: 16px;
}
.reminder-presets {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
}
.rm-btn {
  padding: 6px 14px; border: 1px solid #d0d0d0; border-radius: 8px;
  background: #f8f8f8; font-size: 13px; cursor: pointer;
  font-family: inherit;
}
.rm-btn:hover { background: #eef0ff; border-color: #5b7fff; }
.reminder-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0; font-size: 12px; color: #999;
}
.reminder-divider::before, .reminder-divider::after {
  content: ''; flex: 1; height: 1px; background: #e8e8e8;
}
.rm-picker {
  width: 100%; height: 40px; font-size: 15px; padding: 0 8px;
  border: 1px solid #d0d0d0; border-radius: 8px;
  font-family: inherit; outline: none;
}
.rm-picker:focus { border-color: #5b7fff; }
.reminder-actions {
  display: flex; gap: 10px; margin-top: 14px;
}
.rm-cancel, .rm-confirm {
  flex: 1; height: 38px; border: none; border-radius: 8px;
  font-size: 14px; cursor: pointer; font-family: inherit;
}
.rm-cancel { background: #f0f0f0; color: #666; }
.rm-confirm { background: #5b7fff; color: white; }
.rm-cancel:hover { background: #e0e0e0; }
.rm-confirm:hover { background: #4a6ee8; }

/* ─── New Record Modal ──────────────────── */
.nr-input {
  width: 100%;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  font-family: inherit;
  outline: none;
  resize: vertical;
}
.nr-input:focus { border-color: #5b7fff; }
.nr-hint {
  font-size: 12px;
  color: #b0b0b0;
  margin: 6px 0 2px;
  text-align: center;
}

/* ─── Quick Reminder Modal ───────────────── */
.reminder-modal-content textarea.qr-input-text { margin-bottom: 12px; }

/* ─── Quick Reminders ──────────────────── */
.qr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #e8e8e8;
  background: white;
  flex-shrink: 0;
}
.qr-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}
.btn-add-qr {
  width: 28px; height: 28px;
  border: none; background: transparent;
  font-size: 14px; cursor: pointer;
  border-radius: 6px; line-height: 1;
  transition: background .15s;
}
.btn-add-qr:hover { background: #e8f0fe; }

.qr-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.qr-input-text {
  width: 100%;
  font-size: 15px;
  padding: 8px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  font-family: inherit;
  outline: none;
  resize: vertical;
  margin-bottom: 12px;
}
.qr-input-text:focus { border-color: #5b7fff; }
.qr-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  background: #f7f8fa;
  position: relative;
  transition: background .15s;
}
.qr-item:hover { background: #f0f0f0; }
.qr-content {
  font-size: 15px;
  color: #333;
  word-break: break-word;
  padding-right: 24px;
  line-height: 1.4;
}
.qr-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #b0b0b0;
}
.qr-status { color: #999; }
.qr-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px; height: 24px;
  border: none; background: transparent;
  color: #ccc; font-size: 11px;
  cursor: pointer; border-radius: 5px;
  opacity: 0;
  transition: opacity .15s;
}
.qr-item:hover .qr-delete { opacity: 1; }
.qr-delete:hover { color: #e55; background: #fee; }


