/* ==========================================================================
   Apple 风格主题（apple.css）
   加载在 bundle.css 之后，用 Apple 官网的设计语言整体覆盖原米绿主题。
   设计要素：SF Pro / 苹方、大标题紧字距、顶部毛玻璃导航、胶囊按钮、
   #f5f5f7 浅灰卡片、细发丝边框、iOS 系统色分类圆点。
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --fg: #1d1d1f;
  --fg-2: #6e6e73;
  --fg-3: #86868b;
  --line: #d2d2d7;
  --line-soft: #e8e8ed;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --red: #d70015;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --pill: 980px;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04);
  --shadow-lift: 0 8px 30px rgba(0, 0, 0, 0.08);
  --nav-h: 48px;
}

/* ---------- 基础 ---------- */

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.47;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(0, 113, 227, 0.18);
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-radius: var(--pill);
  padding: 8px 14px;
  font-size: 13px;
  transition: background-color 0.2s ease, color 0.2s ease,
    border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

input,
select,
textarea {
  background: #fff;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 11px 8px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

/* ---------- 整体布局：侧边栏 → 顶部导航 ---------- */

.app {
  display: block;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}

aside {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  height: var(--nav-h);
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-right: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  white-space: nowrap;
}

.brand span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  font-size: 12px;
  color: #fff;
  background: var(--fg);
  border-radius: 7px;
}

.aside-note {
  display: none;
}

nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

nav button {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 400;
  color: var(--fg);
  background: transparent;
  border-radius: var(--pill);
  opacity: 0.72;
}

nav button span {
  display: none;
}

nav button:hover {
  opacity: 1;
  background: var(--bg-soft);
}

nav .active {
  background: var(--fg);
  color: #fff;
  opacity: 1;
  font-weight: 500;
}

nav .active:hover {
  background: var(--fg);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 0 18px;
  padding-left: 18px;
  border-left: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--fg-3);
  white-space: nowrap;
}

.sidebar-footer small {
  display: inline;
  margin: 0 0 0 4px;
  font-size: 12px;
  color: var(--fg-3);
}

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0;
  border-radius: 50%;
  background: #34c759;
}

/* ---------- 主内容 ---------- */

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 64px 24px 96px;
}

header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 44px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--fg-3);
}

main h1 {
  margin: 0;
  font-size: clamp(34px, 4.6vw, 54px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--fg);
}

header .muted {
  margin: 12px 0 0;
  font-size: 15px;
  color: var(--fg-2);
}

.muted {
  color: var(--fg-2);
  font-size: 14px;
}

.primary {
  flex: none;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: var(--blue);
  border-radius: var(--pill);
}

.primary:hover {
  background: var(--blue-hover);
  filter: none;
}

.primary:active {
  transform: scale(0.98);
}

/* ---------- 提示条 ---------- */

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 20px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--fg);
  background: var(--bg-soft);
  border-radius: 12px;
}

.notice button {
  padding: 4px 8px;
  font-size: 15px;
  color: var(--fg-3);
  background: transparent;
}

/* ---------- 筛选胶囊 ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 28px;
}

.filters button {
  padding: 7px 16px;
  font-size: 13px;
  color: var(--fg-2);
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: var(--pill);
}

.filters button:hover {
  color: var(--fg);
  background: #ececf0;
  filter: none;
}

.filters .selected,
.selected {
  color: #fff;
  background: var(--fg);
  font-weight: 500;
}

.filters .selected:hover {
  background: var(--fg);
}

/* ---------- 数据概览 ---------- */

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0 0 40px;
  padding: 32px 8px;
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
}

.summary div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 28px;
  border-right: 1px solid var(--line);
}

.summary div:last-child {
  border-right: 0;
}

.summary b {
  font-size: clamp(32px, 4vw, 42px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--fg);
}

.summary span {
  font-size: 13px;
  color: var(--fg-2);
}

/* ---------- 区块标题 ---------- */

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 44px 0 16px;
}

.section-heading h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.section-heading span {
  font-size: 13px;
  color: var(--fg-3);
}

.section-heading button {
  padding: 6px 14px;
  font-size: 13px;
  color: var(--blue);
  background: transparent;
}

.section-heading button:hover {
  background: rgba(0, 113, 227, 0.08);
}

/* ---------- 事项卡片 ---------- */

.item {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.25s ease, transform 0.25s ease,
    border-color 0.25s ease;
}

.item:hover {
  border-color: var(--line);
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}

.check {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 1.5px solid #c7c7cc;
  border-radius: 50%;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

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

.completed {
  opacity: 0.72;
}

.completed .check {
  background: var(--fg);
  border-color: var(--fg);
  color: #fff;
}

.completed strong {
  text-decoration: line-through;
  opacity: 0.55;
}

.item-body {
  flex: 1;
  min-width: 0;
  padding: 0;
  text-align: left;
  background: transparent;
  border-radius: 0;
}

.item-body:hover {
  filter: none;
}

.item strong {
  display: block;
  margin: 6px 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
  overflow-wrap: anywhere;
}

.item small {
  display: block;
  font-size: 12.5px;
  color: var(--fg-3);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #1c7a3c;
  background: #e8f7ed;
  border-radius: var(--pill);
}

.tag.c0 {
  color: #1c7a3c;
  background: #e8f7ed;
}

.tag.c1 {
  color: #a35b00;
  background: #fff2e0;
}

.tag.c2 {
  color: #6b46c1;
  background: #f3edfd;
}

.tag.c3 {
  color: #0f7a80;
  background: #e6f6f8;
}

.priority {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--red);
}

/* ---------- 时间轴 ---------- */

.timeline {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
}

.timeline time {
  padding-top: 18px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--fg-3);
}

/* ---------- 空状态 ---------- */

.empty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 24px;
  font-size: 14px;
  color: var(--fg-2);
  background: var(--bg-soft);
  border: 0;
  border-radius: var(--radius-md);
}

.empty button {
  padding: 7px 16px;
  font-size: 13px;
  color: var(--blue);
  background: #fff;
  border-radius: var(--pill);
}

.empty button:hover {
  background: #fff;
  filter: brightness(0.98);
}

/* ---------- 日历 ---------- */

.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.calendar-toolbar > div {
  display: flex;
  flex-wrap: nowrap;
  flex: none;
  align-items: center;
  gap: 6px;
}

.calendar-toolbar button {
  flex: none;
  white-space: nowrap;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--fg);
  background: var(--bg-soft);
  border-radius: var(--pill);
}

.calendar-toolbar button:hover {
  background: #ececf0;
  filter: none;
}

.calendar-toolbar button.selected {
  color: #fff;
  background: var(--fg);
}

.calendar-toolbar input {
  flex: none;
  width: 150px;
  max-width: 150px;
  padding: 7px 10px;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.weekday {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--fg-3);
}

.day {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 92px;
  padding: 10px 11px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease,
    background-color 0.2s ease;
}

.day:hover {
  border-color: var(--line);
  box-shadow: var(--shadow-card);
  filter: none;
}

.day b {
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
}

.day span {
  font-size: 11px;
  color: var(--fg-3);
}

.day.today b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: -3px 0 0 -4px;
  color: #fff;
  background: var(--blue);
  border-radius: 50%;
  text-decoration: none;
}

.day.chosen {
  background: #f5f9ff;
  border-color: var(--blue);
  box-shadow: inset 0 0 0 0.5px var(--blue);
}

.day.chosen span {
  color: var(--fg-2);
}

.day.outside {
  opacity: 0.32;
}

/* 分类圆点：iOS 系统色 */
.day-dots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: auto;
}

.day-dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34c759;
}

.day-dot.c0 {
  background: #34c759;
}

.day-dot.c1 {
  background: #ff9500;
}

.day-dot.c2 {
  background: #af52de;
}

.day-dot.c3 {
  background: #30b0c7;
}

.day.chosen .day-dot {
  filter: none;
}

.dot-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 16px 2px 4px;
  font-size: 12px;
  color: var(--fg-2);
}

.dot-legend-label {
  color: var(--fg-3);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.dot-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---------- 周视图 ---------- */

.week {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.week section {
  padding: 18px;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
}

.week-date {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  background: transparent;
  border-radius: 8px;
  padding: 2px 0;
}

.week-date:hover {
  filter: none;
  color: var(--blue);
}

/* ---------- 设置页 ---------- */

.settings {
  margin-bottom: 18px;
  padding: 26px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.settings h2 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.settings p {
  margin: 8px 0;
  font-size: 14px;
  color: var(--fg-2);
}

.settings button {
  margin: 6px 8px 0 0;
  padding: 9px 18px;
  font-size: 13px;
  color: var(--fg);
  background: var(--bg-soft);
  border-radius: var(--pill);
}

.settings button:hover {
  background: #ececf0;
  filter: none;
}

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

.settings form {
  max-width: 380px;
  margin-top: 12px;
}

.settings label,
.editor label {
  display: block;
  margin: 14px 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-2);
}

.settings label input,
.editor label input,
.editor select,
.editor textarea {
  width: 100%;
  margin-top: 6px;
}

.conflict {
  border-color: #ffd6a8;
  background: #fffaf2;
}

/* ---------- 页脚 ---------- */

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--fg-3);
}

/* ---------- 编辑弹窗 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}

.editor {
  width: 100%;
  max-width: 520px;
  max-height: 92dvh;
  padding: 28px;
  overflow: auto;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.26);
}

.editor .section-heading {
  margin: 0 0 4px;
}

.editor .section-heading button {
  color: var(--fg-3);
  background: var(--bg-soft);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.editor .section-heading button:hover {
  color: var(--fg);
  background: #ececf0;
}

.editor .section-heading h2 {
  font-size: 22px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.editor-actions button {
  padding: 10px 20px;
  font-size: 14px;
  border-radius: var(--pill);
  background: var(--bg-soft);
}

.editor-actions .primary {
  background: var(--blue);
  color: #fff;
}

.danger {
  margin-right: auto;
  color: var(--red);
  background: transparent;
}

/* ---------- 响应式（iPhone 优先） ---------- */

@media (max-width: 700px) {
  .app {
    display: block;
  }

  aside {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    padding: 6px 12px max(6px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.82);
    border-bottom: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 60;
  }

  .brand,
  .aside-note,
  .sidebar-footer {
    display: none;
  }

  nav {
    flex: 1;
    justify-content: space-around;
    gap: 2px;
    margin: 0;
  }

  nav button {
    flex: 1;
    flex-direction: column;
    gap: 2px;
    padding: 6px 6px;
    font-size: 10.5px;
    opacity: 0.6;
  }

  nav button span {
    display: block;
    margin: 0;
    font-size: 19px;
    line-height: 1;
  }

  nav .active {
    background: transparent;
    color: var(--blue);
    opacity: 1;
  }

  main {
    padding: 32px 18px 104px;
  }

  header {
    flex-direction: row;
    align-items: center;
    margin-bottom: 26px;
  }

  main h1 {
    font-size: 30px;
    letter-spacing: -0.02em;
  }

  header .muted {
    margin-top: 6px;
    font-size: 13px;
  }

  .eyebrow {
    font-size: 10px;
    margin-bottom: 6px;
  }

  .primary {
    padding: 9px 16px;
    font-size: 13px;
  }

  .summary {
    padding: 20px 4px;
    margin-bottom: 28px;
    border-radius: 16px;
  }

  .summary div {
    padding: 0 14px;
  }

  .summary b {
    font-size: 26px;
  }

  .summary span {
    font-size: 11.5px;
  }

  .filters {
    gap: 6px;
    margin-bottom: 22px;
  }

  .filters button {
    padding: 6px 13px;
    font-size: 12px;
  }

  .section-heading {
    margin: 32px 0 12px;
  }

  .section-heading h2 {
    font-size: 18px;
  }

  .item {
    gap: 12px;
    padding: 14px;
    border-radius: 12px;
  }

  .timeline {
    grid-template-columns: 48px 1fr;
    gap: 8px;
  }

  .timeline time {
    font-size: 11.5px;
    padding-top: 16px;
  }

  .month-grid {
    gap: 4px;
  }

  .weekday {
    font-size: 10px;
  }

  .day {
    min-height: 64px;
    gap: 3px;
    padding: 6px 7px;
    border-radius: 8px;
  }

  .day b {
    font-size: 13px;
  }

  .day span {
    font-size: 9px;
  }

  .day.today b {
    width: 22px;
    height: 22px;
    margin: -2px 0 0 -3px;
  }

  .day-dot {
    width: 6px;
    height: 6px;
  }

  .day-dots {
    gap: 3px;
  }

  .dot-legend {
    gap: 6px 12px;
    font-size: 11px;
    margin-top: 12px;
  }

  .calendar-toolbar button {
    padding: 6px 12px;
    font-size: 12px;
  }

  .calendar-toolbar input {
    max-width: 132px;
    font-size: 12px;
  }

  .week {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .editor {
    padding: 22px 18px;
    border-radius: 20px;
  }

  .settings {
    padding: 20px;
    border-radius: 16px;
  }

  footer {
    margin-top: 44px;
    font-size: 11px;
  }
}
