/* self_note — calm, fast, capture-first. Light + dark, mobile-first, iOS safe-area aware. */
:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f0f0ec;
  --text: #1c1c1a;
  --text-dim: #6b6b66;
  --border: #e4e4de;
  --accent: #0f766e;
  --accent-soft: #d7efe9;
  --danger: #b4341f;
  --warn: #b8860b;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --radius: 16px;
  --tabbar-h: 64px;
  --header-h: 52px;
  font-synthesis: none;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --surface: #1f2125;
    --surface-2: #26282d;
    --text: #ececec;
    --text-dim: #9a9a96;
    --border: #313338;
    --accent: #3bb3a0;
    --accent-soft: #14342f;
    --danger: #e0735f;
    --warn: #d8a93a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ---------- header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex; align-items: center; justify-content: space-between;
  padding-left: 18px; padding-right: 14px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: .02em; }
.brand-mark { color: var(--accent); font-size: 20px; }
.brand-name { font-size: 17px; }
.status-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 5px 10px; border-radius: 999px; font-size: 12px; color: var(--text-dim);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #aaa; flex: none; }
.dot.ok { background: #1faa6b; box-shadow: 0 0 0 3px color-mix(in srgb,#1faa6b 22%, transparent); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--danger); }

/* ---------- view container ---------- */
.view {
  max-width: 720px; margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  min-height: 100%;
}
.section-title { font-size: 13px; color: var(--text-dim); font-weight: 600; margin: 18px 4px 8px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- capture ---------- */
.capture-wrap { display: flex; flex-direction: column; gap: 12px; padding-top: 6px; }
.capture-hint { color: var(--text-dim); font-size: 14px; padding: 2px 4px; }
.capture-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
#captureInput {
  border: none; outline: none; resize: none; background: transparent;
  width: 100%; min-height: 130px; font-size: 18px; line-height: 1.55;
}
.capture-actions { display: flex; align-items: center; gap: 10px; }
.mic-btn {
  width: 46px; height: 46px; border-radius: 50%; background: var(--surface-2);
  border: 1px solid var(--border); font-size: 20px; display: grid; place-items: center; flex: none;
  transition: transform .1s ease;
}
.mic-btn.recording { background: var(--danger); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100%{ box-shadow: 0 0 0 0 color-mix(in srgb,var(--danger) 50%, transparent);} 50%{ box-shadow: 0 0 0 10px transparent;} }
.spacer { flex: 1; }
.btn {
  background: var(--accent); color: #fff; padding: 12px 22px; border-radius: 12px;
  font-weight: 650; font-size: 16px; transition: filter .12s ease, transform .06s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { filter: grayscale(.6) opacity(.6); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 8px 14px; font-size: 14px; border-radius: 10px; }

/* recent captures under the box */
.mini-feed { display: flex; flex-direction: column; gap: 8px; }

/* ---------- note cards ---------- */
.note-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--shadow); position: relative;
}
.note-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.type-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.type-note { background: var(--accent-soft); color: var(--accent); }
.type-idea { background: #fdeecd; color: #9a6b00; }
.type-task { background: #ffe0d6; color: #b4341f; }
.type-event { background: #dfe7ff; color: #2d50b8; }
.type-bookmark { background: #e9e0ff; color: #6b46c1; }
.note-title { font-weight: 650; font-size: 16px; flex: 1; min-width: 0; }
.note-time { font-size: 12px; color: var(--text-dim); }
.note-body { color: var(--text); font-size: 15px; white-space: pre-wrap; word-break: break-word; margin: 2px 0; }
.note-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.tag { font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); padding: 2px 9px; border-radius: 999px; }
.cat { font-size: 12px; color: var(--accent); font-weight: 600; }
.note-when { font-size: 12px; color: var(--warn); font-weight: 600; }
.note-actions { display: flex; gap: 4px; }
.icon-btn { color: var(--text-dim); font-size: 15px; padding: 4px 7px; border-radius: 8px; }
.icon-btn:active { background: var(--surface-2); }
.structuring { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12px; }
.spin { width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- filters / chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px; margin: 0 -4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); padding: 6px 13px; border-radius: 999px; font-size: 14px; }
.chip.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.search-row { display: flex; gap: 8px; margin: 10px 0; }
.search-input { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px; outline: none; font-size: 15px; }
.search-input:focus { border-color: var(--accent); }
.feed-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

/* ---------- ask ---------- */
.ask-answer { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); white-space: pre-wrap; word-break: break-word; min-height: 40px; font-size: 15px; line-height: 1.6; }
.ask-answer.empty { color: var(--text-dim); }
.cursor::after { content: '▍'; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.sources { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.source-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.source-card .sc-top { display: flex; gap: 8px; align-items: center; }
.sc-idx { font-weight: 700; color: var(--accent); }

/* ---------- schedule ---------- */
.day-group { margin-bottom: 16px; }
.day-head { font-weight: 700; font-size: 14px; color: var(--accent); margin: 0 4px 8px; }

/* ---------- settings ---------- */
.settings-group { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.settings-group h3 { margin: 0 0 4px; font-size: 15px; }
.settings-group .desc { color: var(--text-dim); font-size: 13px; margin: 0 0 10px; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 4px; }
.field input, .field select { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; outline: none; }
.field input:focus, .field select:focus { border-color: var(--accent); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 76px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text-dim); font-size: 14px; }
.seg button.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.health-line { font-size: 13px; display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; }
.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 12px; }

/* ---------- misc ---------- */
.empty-state { text-align: center; color: var(--text-dim); padding: 48px 20px; }
.empty-state .big { font-size: 40px; opacity: .5; margin-bottom: 8px; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px); border-top: 1px solid var(--border);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-dim); font-size: 11px; }
.tab .ico { font-size: 20px; line-height: 1; }
.tab.is-active { color: var(--accent); }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  background: #222; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 40;
  box-shadow: 0 6px 24px rgba(0,0,0,.3); max-width: 90vw;
}
@media (prefers-color-scheme: dark) { .toast { background: #3a3c42; } }

/* 落款 — 李锐 / 锐制馥业 出品 */
.maker-mark { text-align: center; color: var(--text-dim); font-size: 12px; letter-spacing: .22em; opacity: .55; padding: 14px 0 6px; user-select: none; }
