:root {
  color-scheme: light dark;
  --ink: #14213d;
  --muted: #5c667a;
  --paper: #f5f7fb;
  --surface: rgba(255, 255, 255, 0.9);
  --line: #dbe1eb;
  --indigo: #3d4ed7;
  --indigo-deep: #2838a8;
  --mint: #00a878;
  --danger: #b42318;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: radial-gradient(circle at top right, #e8ecff 0, transparent 33rem), var(--paper); }
button, textarea { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 650; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { cursor: wait; opacity: .58; }
textarea { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 12px; padding: 12px; color: inherit; background: color-mix(in srgb, var(--surface) 94%, transparent); line-height: 1.45; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }

.shell { width: min(980px, calc(100% - 32px)); margin: 0 auto; padding: 40px 0 80px; }
.masthead { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 25px; }
.masthead h1 { margin: 4px 0 0; letter-spacing: -.04em; font-size: clamp(2rem, 5vw, 3.4rem); }
.eyebrow { margin: 0; color: var(--indigo); font-size: .72rem; letter-spacing: .15em; font-weight: 800; }
.privacy-badge, .count { margin: 0; padding: 6px 10px; color: var(--indigo-deep); border-radius: 999px; background: #e4e8ff; font-size: .8rem; font-weight: 700; white-space: nowrap; }

.panel, .summary-card { border: 1px solid color-mix(in srgb, var(--line) 86%, transparent); border-radius: 20px; background: var(--surface); box-shadow: 0 14px 40px rgba(40, 56, 90, .06); }
.panel { padding: 22px; }
.panel-heading { display: flex; justify-content: space-between; gap: 18px; align-items: start; margin-bottom: 14px; }
.panel-heading.inline { align-items: center; }
.panel-heading h2 { margin: 4px 0 0; letter-spacing: -.02em; font-size: 1.35rem; }
.unlock-panel { max-width: 720px; margin: 8vh auto 0; }
.unlock-panel > p { color: var(--muted); line-height: 1.6; }
.lock-mark { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 14px; color: white; background: linear-gradient(135deg, var(--indigo), #6f77ef); font-size: 1.5rem; }
.field-label { display: block; margin: 22px 0 8px; font-size: .82rem; font-weight: 750; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 13px; }
.button-row.compact { margin: 0; }
.primary { color: white; background: var(--indigo); box-shadow: 0 6px 15px rgba(61, 78, 215, .22); }
.primary:hover:not(:disabled) { background: var(--indigo-deep); }
.secondary { color: var(--indigo-deep); background: #e8ebff; }
.quiet { color: var(--muted); background: transparent; }
.hint { color: var(--muted); font-size: .82rem; line-height: 1.5; }

.app-panel { display: grid; gap: 18px; }
.sync-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.sync-bar #sync-status { margin: 4px 0 0; font-weight: 650; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.summary-card { min-height: 146px; padding: 18px; display: flex; flex-direction: column; justify-content: flex-end; }
.summary-card p { margin: 0 auto auto 0; color: var(--muted); font-size: .86rem; font-weight: 650; }
.summary-card strong { font-size: 1.2rem; letter-spacing: -.02em; }
.balance-card { color: white; border-color: transparent; background: linear-gradient(145deg, var(--indigo-deep), #5368ed); }
.balance-card p, .balance-card span { color: rgba(255,255,255,.74); }
.balance-card strong { font-size: 2rem; }
.summary-card span { margin-top: 6px; color: var(--muted); font-size: .78rem; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px; }
.tabs button { color: var(--muted); background: transparent; white-space: nowrap; }
.tabs button.active { color: var(--indigo-deep); background: #e4e8ff; }
.record-list { display: grid; gap: 10px; }
.record-card { display: flex; align-items: center; gap: 16px; min-height: 72px; padding: 14px; border-radius: 15px; background: color-mix(in srgb, var(--paper) 65%, white); }
.record-main { min-width: 0; flex: 1; }
.record-main h3 { overflow: hidden; margin: 0 0 4px; text-overflow: ellipsis; white-space: nowrap; font-size: .98rem; }
.record-main p { overflow: hidden; margin: 0; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.record-meta { color: var(--muted); text-align: right; font-size: .78rem; }
.record-actions { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.record-photo { width: 52px; height: 52px; object-fit: cover; border-radius: 11px; }
.image-button { flex: none; padding: 7px 9px; color: var(--indigo-deep); background: #e8ebff; font-size: .78rem; }
.empty { padding: 30px 12px; color: var(--muted); text-align: center; }
.editor-panel summary { display: flex; justify-content: space-between; cursor: pointer; font-weight: 750; }
.editor-panel summary small { color: var(--muted); font-weight: 500; }
.editor-panel p { color: var(--muted); line-height: 1.55; font-size: .84rem; }

@media (max-width: 700px) {
  .shell { width: min(100% - 24px, 980px); padding-top: 26px; }
  .masthead, .sync-bar { align-items: start; flex-direction: column; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 110px; }
  .balance-card strong { font-size: 1.8rem; }
}

@media (prefers-color-scheme: dark) {
  :root { --ink: #edf0ff; --muted: #b7bfd4; --paper: #121629; --surface: rgba(29, 35, 58, .9); --line: #3b435e; --indigo: #8392ff; --indigo-deep: #bdc6ff; }
  body { background: radial-gradient(circle at top right, #202755 0, transparent 33rem), var(--paper); }
  .privacy-badge, .count, .secondary, .tabs button.active, .image-button { color: #172463; background: #c6ceff; }
  .record-card { background: #1b2139; }
  textarea { background: #161c31; }
}
