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

:root {
  --bg: #eef0fb; --bg2: #fdf1f7;
  --card: #fff; --card2: #f5f6fd;
  --text: #1d2033; --text2: #646a8f;
  --accent: #5b5ff0; --accent2: #8b5cf6;
  --accent-soft: rgba(91, 95, 240, 0.12);
  --border: #e4e6f3;
  --shadow: 0 12px 32px rgba(70, 76, 180, 0.10);
  --topbar: rgba(255, 255, 255, 0.78);
  --danger: #e5484d; --success: #0ca678; --warn: #f59f00;
}

body.dark {
  --bg: #0e1120; --bg2: #151229;
  --card: #1a1e33; --card2: #222741;
  --text: #eef0fb; --text2: #9aa1c7;
  --accent: #818cf8; --accent2: #a78bfa;
  --accent-soft: rgba(129, 140, 248, 0.16);
  --border: #2a2f4a;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --topbar: rgba(26, 30, 51, 0.78);
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg), var(--bg2)) fixed;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 15px; color: var(--text); }
::placeholder { color: var(--text2); opacity: 0.7; }

.topbar {
  position: sticky; top: 0; z-index: 30; height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  background: var(--topbar);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; }
.brand em { font-style: normal; color: var(--text2); font-size: 12px; font-weight: 700; margin-left: 2px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: 17px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
  box-shadow: 0 6px 16px var(--accent-soft);
}
.top-actions { display: flex; align-items: center; gap: 8px; }
.sync { font-size: 12px; font-weight: 700; color: var(--text2); white-space: nowrap; }
.sync.ok { color: var(--success); }
.sync.err { color: var(--danger); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 16px;
  background: var(--card2); border: 1px solid var(--border); transition: transform 0.15s ease, background 0.15s ease;
}
.icon-btn:hover { transform: translateY(-1px); background: var(--accent-soft); }

.tabs {
  position: sticky; top: 58px; z-index: 20; display: flex; gap: 8px;
  overflow-x: auto; padding: 10px 16px;
}
.tab-btn {
  flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 9px 15px;
  border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--text2);
  background: var(--card); border: 1px solid var(--border); transition: 0.18s ease;
}
.tab-btn:hover { color: var(--accent); transform: translateY(-1px); }
.tab-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-color: transparent;
  box-shadow: 0 8px 18px var(--accent-soft);
}
.tabs::-webkit-scrollbar { display: none; }

main { max-width: 820px; margin: 0 auto; padding: 18px 16px 46px; }
.tab-panel { display: none; animation: fadeUp 0.28s ease; }
.tab-panel.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card h2 { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card h2 .sub { font-size: 11.5px; font-weight: 600; color: var(--text2); margin-left: auto; }
.hint { font-size: 12.5px; color: var(--text2); line-height: 1.6; margin-bottom: 12px; }

.hero {
  position: relative; overflow: hidden; padding: 24px 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 24px; color: #fff; box-shadow: 0 18px 40px var(--accent-soft);
  margin-bottom: 16px;
}
.hero::after {
  content: ""; position: absolute; right: -44px; top: -56px; width: 190px; height: 190px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.14);
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; z-index: 1; }
.hero h1 { font-size: 21px; font-weight: 900; letter-spacing: 0.5px; }
.hero p { opacity: 0.92; margin-top: 5px; font-size: 13px; }
.hero-big { text-align: right; white-space: nowrap; }
.hero-big .num { font-size: 38px; font-weight: 900; line-height: 1; }
.hero-big .unit { font-size: 12px; font-weight: 700; opacity: 0.9; display: block; margin-top: 2px; }
.hero-chips { display: flex; gap: 8px; margin-top: 16px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero-chips span {
  padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, 0.18);
  font-size: 12px; font-weight: 700;
}

.countdown-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.cd-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
  padding: 16px 12px; text-align: center;
}
.cd-label { font-size: 12px; font-weight: 700; color: var(--text2); }
.cd-num {
  font-size: 30px; font-weight: 900; margin: 6px 0 2px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cd-card.done .cd-num { color: var(--text2); background: none; -webkit-background-clip: initial; background-clip: initial; }
.cd-sub { font-size: 11px; color: var(--text2); line-height: 1.4; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat {
  padding: 16px 8px; border-radius: 18px; background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow); text-align: center;
}
.stat .num {
  font-size: 24px; font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .label { font-size: 12px; color: var(--text2); margin-top: 4px; font-weight: 600; }

.input {
  padding: 11px 13px; border-radius: 13px; border: 1px solid var(--border);
  background: var(--card2); outline: none; transition: 0.15s; min-width: 0;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 17px; border-radius: 13px; font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 18px var(--accent-soft); transition: 0.18s; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 11px; }
.btn.danger { background: linear-gradient(135deg, #f87171, #e5484d); }

.day { margin-bottom: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.day-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--card2); border-bottom: 1px solid var(--border);
}
.day-date { font-weight: 900; font-size: 14px; color: var(--accent); }
.day.today .day-date::after { content: " · 今天"; color: var(--danger); font-size: 12px; }
.day-summary { font-size: 13px; color: var(--text2); font-weight: 600; }
.hotel-chip {
  margin-left: auto; font-size: 11.5px; font-weight: 800; padding: 5px 10px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border); color: var(--text2);
}
.hotel-chip.st-temp { color: #c06a00; border-color: #f5b04c; background: rgba(245, 159, 0, 0.10); }
.hotel-chip.st-pending { color: #b45309; border-color: #e5b15b; background: rgba(245, 159, 0, 0.14); }
.hotel-chip.st-unknown { color: var(--danger); border-color: #ef9a9c; background: rgba(229, 72, 77, 0.08); }
.hotel-chip.st-ok { color: var(--success); border-color: #6fd3b4; background: rgba(12, 166, 120, 0.10); }

.irow {
  display: grid; grid-template-columns: 118px 130px 1fr; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--border); align-items: start;
}
.irow:last-child { border-bottom: none; }
.itime { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.iplace { font-size: 12.5px; color: var(--text2); font-weight: 600; line-height: 1.5; }
.idesc { font-size: 13.5px; line-height: 1.6; }

.tag {
  display: inline-block; font-size: 11px; font-weight: 800; padding: 2.5px 8px;
  border-radius: 7px; margin-right: 6px; vertical-align: 1px;
}
.tag-flight { background: #dceaff; color: #1656b8; }
.tag-hsr { background: #ffe8d6; color: #c2570a; }
.tag-event { background: #ddf5e6; color: #0e7a4e; }
body.dark .tag-flight { background: #12365f; color: #9cc3f5; }
body.dark .tag-hsr { background: #4a2d14; color: #f0b27e; }
body.dark .tag-event { background: #143c2c; color: #86d9b1; }

.hotel-link-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.hotel-link-row:last-child { border-bottom: none; }
.hotel-link-row .hl-name { font-weight: 800; font-size: 13.5px; }
.hotel-link-row .hl-note { font-size: 11.5px; color: var(--text2); width: 100%; }
.copy-btn {
  padding: 6px 11px; border-radius: 10px; font-size: 12px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); border: 1px solid transparent;
}
.copy-btn:hover { border-color: var(--accent); }

.todo-form {
  display: grid; grid-template-columns: 1fr 128px 110px 140px 118px auto; gap: 9px;
}
.progress-head { display: flex; align-items: center; justify-content: space-between; font-weight: 800; font-size: 13.5px; margin-bottom: 8px; }
.progress-head .sub { font-size: 11.5px; font-weight: 600; color: var(--text2); }
.progress { height: 9px; background: var(--card2); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.progress-bar {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width 0.3s ease;
}
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-select { width: 150px; }
.chip-filters { display: flex; gap: 6px; }
.filter-btn {
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  color: var(--text2); background: var(--card2); border: 1px solid var(--border);
}
.filter-btn.active { background: var(--accent); color: #fff; border-color: transparent; }

.todo-group-title { font-size: 12.5px; font-weight: 900; color: var(--text2); margin: 14px 0 4px; display: flex; align-items: center; gap: 6px; }
.todo-group-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.todo-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.todo-item:last-child { border-bottom: none; }
.todo-check {
  width: 25px; height: 25px; flex-shrink: 0; margin-top: 1px; border-radius: 9px;
  border: 2px solid var(--border); display: grid; place-items: center; font-size: 13px;
  color: transparent; background: var(--card2); transition: 0.15s;
}
.todo-check.on { background: linear-gradient(135deg, var(--success), #12b886); border-color: transparent; color: #fff; }
.todo-main { flex: 1; min-width: 0; }
.todo-text { font-size: 14.5px; font-weight: 600; line-height: 1.5; word-break: break-word; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--text2); }
.todo-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.chip {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--card2); color: var(--text2); border: 1px solid var(--border);
}
.chip.st-ok { color: var(--success); border-color: #6fd3b4; background: rgba(12, 166, 120, 0.10); }
.chip.st-temp { color: #c06a00; border-color: #f5b04c; background: rgba(245, 159, 0, 0.10); }
.chip.st-pending { color: #b45309; border-color: #e5b15b; background: rgba(245, 159, 0, 0.14); }
.chip.st-unknown { color: var(--danger); border-color: #ef9a9c; background: rgba(229, 72, 77, 0.08); }
.chip.due { color: var(--danger); border-color: #ef9a9c; background: rgba(229, 72, 77, 0.07); }
.delete-btn {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  font-size: 14px; color: var(--text2); background: var(--card2); flex-shrink: 0;
}
.delete-btn:hover { color: var(--danger); background: rgba(229, 72, 77, 0.10); }
.empty { text-align: center; color: var(--text2); padding: 30px 10px; font-size: 14px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 10px; }

.quick-add { display: flex; gap: 10px; }
.note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 14px; }
.note-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 16px;
  box-shadow: var(--shadow); cursor: pointer; transition: 0.18s;
  display: flex; flex-direction: column; gap: 8px; min-height: 130px;
}
.note-card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px var(--accent-soft); }
.note-card .t { font-weight: 800; font-size: 14.5px; line-height: 1.4; }
.note-card .b {
  color: var(--text2); font-size: 13px; line-height: 1.6; white-space: pre-wrap;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
}
.note-card .d { font-size: 11px; color: var(--text2); margin-top: auto; }

.today-box { display: flex; flex-direction: column; gap: 8px; }
.today-item { display: flex; gap: 10px; align-items: baseline; font-size: 14px; line-height: 1.6; }
.today-item .ti-time { font-weight: 800; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.today-note { font-size: 13.5px; color: var(--text2); line-height: 1.7; }
.today-note b { color: var(--accent); }

.modal-overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(20, 22, 40, 0.45);
  backdrop-filter: blur(4px); display: none; align-items: flex-end; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  width: 100%; max-width: 540px; max-height: 88vh; overflow-y: auto;
  background: var(--card); border-radius: 24px 24px 0 0; padding: 22px;
  animation: slideUp 0.25s ease; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
}
@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: 20px; }
  .modal { border-radius: 24px; }
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.modal h2 { font-size: 16px; font-weight: 900; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.field { margin-bottom: 14px; }
.ta { resize: vertical; min-height: 150px; line-height: 1.7; width: 100%; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(16px);
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transition: 0.25s;
  z-index: 60; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.foot { text-align: center; font-size: 11.5px; color: var(--text2); padding: 8px 16px 28px; line-height: 1.7; }

@media (max-width: 720px) {
  .tabs {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; justify-content: space-around;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    background: var(--card); border-top: 1px solid var(--border);
    box-shadow: 0 -6px 24px rgba(30, 33, 52, 0.08);
  }
  main { padding-bottom: 120px; }
  .tab-btn { padding: 8px 4px; flex: 1; justify-content: center; font-size: 12px; }
  .countdown-grid { gap: 8px; }
  .cd-num { font-size: 24px; }
  .irow { grid-template-columns: 1fr; gap: 4px; padding: 11px 14px; }
  .itime { font-size: 12px; }
  .hotel-chip { margin-left: 0; }
  .todo-form { grid-template-columns: 1fr 1fr; }
  .todo-form #todoText { grid-column: 1 / -1; }
  .stats { gap: 8px; }
  .stat { padding: 12px 6px; }
  .stat .num { font-size: 20px; }
  .hero-big .num { font-size: 32px; }
  .sync { display: none; }
}
