:root {
  color-scheme:light dark;
  --canvas: #f4f1ec;
  --surface: #fbfaf8;
  --surface-strong: #ffffff;
  --ink: #111111;
  --sub: #5f5a60;
  --soft:#6f6a70;
  --line: #d9d4d0;
  --line-strong: #c9c2c0;
  --purple: #75578d;
  --purple-deep: #624576;
  --purple-tint: #eee8f1;
  --danger: #93444e;
  --danger-tint: #f7e9e9;
  --focus: rgba(117, 87, 141, .4);
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  overflow-x:hidden;
  background: var(--canvas);
  color: var(--ink);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}
button, input, textarea, select, summary { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
.shell {
  width: min(920px, 100%);
  margin-inline: auto;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link { position: fixed; z-index: 9; left: 12px; top: 12px; min-height: 44px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--ink); color: var(--surface); display: flex; align-items: center; transform: translateY(-180%); }
.skip-link:focus { transform: none; }

.topbar { height: 68px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.topbar nav { display: flex; align-items: center; }
.brand { min-height: 44px; display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--purple-deep); }
.brand-lockup { display:block; width: 128px; height:auto; }
.private-label, .eyebrow { color: var(--purple); font-size: 10px; font-weight: 720; letter-spacing: .16em; }
.quiet-action, .note-actions button, .recovery summary { color: var(--sub); background: none; border: 0; }
.quiet-action, .note-actions button { min-width: 44px; min-height:44px; padding: 8px 10px; }
.quiet-action:hover, .note-actions button:hover, .recovery summary:hover { color: var(--purple-deep); }

.workspace { padding-block: 48px 80px; }
.workspace-head { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 40px; }
.eyebrow { margin: 0 0 10px; }
.workspace h1 { margin: 0; text-wrap: balance; font-size: clamp(28px, 3.4vw, 36px); font-weight: 640; line-height: 1.12; letter-spacing: -.035em; }
.workspace-copy { max-width: 300px; margin: 0; color: var(--soft); font-size: 12px; }
.composer, .notes-section { border-top: 1px solid var(--line-strong); padding-top: 18px; }
.section-heading { min-height: 44px; display: flex; align-items: start; justify-content: space-between; gap: 24px; margin-bottom: 14px; }
.section-heading h2 { margin: 0; font-size: 14px; font-weight: 690; letter-spacing: -.01em; }
.section-heading p { margin: 3px 0 0; color: var(--soft); font-size: 11px; }
.field-label { display: block; margin-bottom: 8px; color: var(--sub); font-size: 12px; font-weight: 650; }
.composer textarea, .inline-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
}
.composer textarea { display: block; min-height: 154px; padding: 16px; resize: vertical; line-height: 1.65; }
.composer textarea::placeholder { color: var(--soft); }
.composer textarea:focus { border-color: var(--purple); }
.composer textarea[aria-invalid="true"] { border-width: 2px; border-color: var(--danger); }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255, 255, 255, .35); }
.segmented button { min-height: 44px; min-width: 112px; border: 0; border-radius: var(--radius-sm); padding: 5px 13px; background: transparent; color: var(--sub); display: grid; align-content: center; text-align: left; }
.segmented button span { font-weight: 660; }
.segmented button small { color: var(--soft); font-size: 10px; }
.segmented button:not([aria-pressed="true"]):hover { background: var(--surface); color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--purple-tint); color: var(--purple-deep); }
.segmented button[aria-pressed="true"] small { color: var(--purple-deep); }
.save-cluster { display: flex; align-items: center; gap: 14px; color: var(--soft); font-size: 11px; font-variant-numeric: tabular-nums; }
.primary-action, .save-action { border: 0; border-radius: 10px; background: var(--purple); color: #fff; font-weight: 650; min-height: 46px; padding: 0 20px; }
.primary-action:hover, .save-action:hover { background: var(--purple-deep); }
.status-line { min-height: 20px; max-width: 55%; margin: 0 !important; text-align: right; }
.status-line[data-state="error"], .list-status[data-state="error"], .row-status[data-state="error"] { color: var(--danger); font-weight: 620; }
.status-line[data-state="success"], .row-status[data-state="success"] { color: var(--purple-deep); }

.notes-section { margin-top: 56px; }
.notes-heading { align-items: center; margin-bottom: 10px; }
.page-size { display: flex; align-items: center; gap: 8px; color: var(--soft); font-size: 11px; }
.page-size select { min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius-sm); background-color: var(--surface); color: var(--ink); padding: 0 30px 0 10px; }
.filter-row { display: flex; align-items: center; gap: 4px; min-height: 48px; border-bottom: 1px solid var(--line); }
.filter-row button { min-height: 44px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--sub); padding: 0 12px; }
.filter-row button:hover { color: var(--ink); }
.filter-row button[aria-pressed="true"] { border-bottom-color: var(--purple); color: var(--ink); font-weight: 660; }
.filter-row span { display: inline-block; min-width: 20px; margin-left: 4px; color: var(--soft); font-size: 10px; font-variant-numeric: tabular-nums; }
.list-status { min-height: 22px; margin: 12px 0 0; color: var(--soft); font-size: 11px; }
.note-list[aria-busy="true"] { opacity: .72; }
.note-row { padding: 20px 0; content-visibility: auto; contain-intrinsic-size: 148px; border-bottom: 1px solid var(--line); transition: opacity 160ms ease, transform 160ms ease; }
.note-row.is-removing { opacity: 0; transform: translateY(-4px); }
.note-header, .note-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lifecycle { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; background: var(--purple-tint); color: var(--purple-deep); font-size: 10px; font-weight: 680; }
.lifecycle[data-kind="temporary"] { background: transparent; border: 1px solid var(--line); color: var(--sub); }
.note-times { display: flex; flex-wrap: wrap; justify-content: end; gap: 6px 14px; color: var(--soft); font-size: 10px; font-variant-numeric: tabular-nums; }
.note-row pre { margin: 14px 0; white-space: pre-wrap; word-break: break-word; font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.note-footer { min-height: 44px; }
.row-status { color: var(--soft); font-size: 10px; }
.note-actions { display: flex; gap: 2px; margin-left: auto; }
.note-actions .danger-quiet { color: var(--danger); }
.empty-state { margin: 0; padding: 42px 0; color: var(--soft); font-size: 13px; }
.load-zone { position: relative; min-height: 62px; display: grid; place-items: center; }
.load-more { min-height: 44px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--sub); padding: 0 18px; }
.load-more:hover { border-color: var(--purple); color: var(--purple-deep); }
.segmented button:active, .filter-row button:active, .load-more:active, .note-actions button:active { opacity: .72; }
.load-more[hidden] { display: none; }
.load-sentinel { position: absolute; inset: auto 0 0; height: 1px; pointer-events: none; }

.auth-main { min-height: calc(100vh - 138px); display: grid; place-items: center; padding-block: 64px; }
.auth-panel { width: min(100%, 440px); }
.auth-panel h1 { margin: 0; text-wrap: balance; font-size: clamp(30px, 4vw, 44px); font-weight: 620; line-height: 1.12; letter-spacing: -.035em; }
.lede { max-width: 360px; margin: 18px 0 34px; color: var(--sub); font-size: 15px; }
.primary-action { width: 100%; display: flex; align-items: center; justify-content: space-between; text-align: left; min-height: 50px; }
.button-glyph { font-size: 20px; font-weight: 400; }
.recovery { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.recovery summary { min-height: 44px; display: flex; align-items: center; padding: 0; list-style: none; }
.recovery form { margin-top: 16px; }
.recovery label { display: block; margin-bottom: 9px; font-size: 12px; font-weight: 650; }
.inline-field { display: flex; gap: 8px; }
.inline-field input { min-width: 0; flex: 1; min-height: 46px; padding: 0 12px; }
.inline-field button { min-height: 46px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); padding: 0 16px; }
.inline-field button:hover { border-color: var(--purple); color: var(--purple-deep); }
.is-hidden { display: none; }

.quiet-footer { height: 70px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--soft); font-size: 10px; letter-spacing: .04em; }
button, input, textarea, select, summary { touch-action: manipulation; -webkit-tap-highlight-color: rgba(117, 87, 141, .12); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

@media(max-width:600px) {
  .shell { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .topbar { height: 64px; }
  .workspace { padding-block: 36px 64px; }
  .workspace-head { display: block; margin-bottom: 32px; }
  .workspace-copy { margin-top: 12px; }
  .workspace h1 { font-size: 30px; }
  .section-heading { gap: 12px; }
  .status-line { max-width: 58%; }
  .composer textarea { min-height: 148px; }
  .composer-toolbar { align-items: stretch; flex-direction: column; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; min-width: 0; }
  .save-cluster { justify-content: space-between; }
  .save-action { min-width: 112px; }
  .notes-section { margin-top: 44px; }
  .filter-row { overflow-x: auto; scrollbar-width: none; }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-row button { flex: 1 0 auto; }
  .note-header, .note-footer { align-items: flex-start; }
  .note-times { display: grid; justify-items: end; }
  .note-footer { flex-direction: column; }
  .note-actions { width: 100%; justify-content: flex-end; }
  .note-actions button { flex: 1; }
  .auth-main { min-height: calc(100vh - 128px); place-items: start center; padding-top: 72px; }
  .quiet-footer { height: 64px; }
}

@media(prefers-color-scheme:dark) {
  :root {
    --canvas: #1c1a1d;
    --surface: #242126;
    --surface-strong: #2b272d;
    --ink: #f0ecef;
    --sub: #c2bbc2;
    --soft: #aaa3aa;
    --line: #3c373d;
    --line-strong: #514951;
    --purple: #b99aca;
    --purple-deep: #d1b9dd;
    --purple-tint: #35283d;
    --danger: #ef9ba4;
    --danger-tint: #472b30;
    --focus: rgba(185, 154, 202, .55);
  }
  .segmented { background: rgba(0, 0, 0, .08); }
  .primary-action, .save-action { color: #1c1420; }
  .brand-lockup { filter: invert(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (prefers-contrast: more) {
  :root { --sub: #403b40; --soft: #514b50; --line: #91898d; --purple: #5f4278; }
  .composer textarea, .inline-field input, .page-size select { background: var(--surface-strong); border-width: 2px; }
  @media (prefers-color-scheme: dark) { :root { --sub: #e3dce2; --soft: #cfc7ce; --line: #8b818a; --purple: #d1b9dd; } }
}
