:root {
  --paper: #f3eee4;
  --slip: #fbf8f1;
  --ink: #1d1a16;
  --ink-2: #5d564b;
  --ink-3: #958c7d;
  --rule: #ddd4c4;
  --rule-2: #e9e2d5;
  --seal: #c3341f;
  --seal-soft: rgba(195, 52, 31, 0.09);
  --amber: #a8701a;
  --amber-soft: rgba(168, 112, 26, 0.11);
  --shadow: 0 1px 0 rgba(60, 45, 20, 0.04), 0 10px 30px -12px rgba(60, 45, 20, 0.22);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "Noto Serif CJK SC", serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.28 0 0 0 0 0.18 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14120f;
    --slip: #1d1a16;
    --ink: #ede6d8;
    --ink-2: #b3a995;
    --ink-3: #7c7364;
    --rule: #37312a;
    --rule-2: #2a2620;
    --seal: #e0553d;
    --seal-soft: rgba(224, 85, 61, 0.13);
    --amber: #d9a043;
    --amber-soft: rgba(217, 160, 67, 0.13);
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 14px 34px -14px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper) var(--grain);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shared pieces ---------- */
.kicker {
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--ink-3);
}
.serif { font-family: var(--serif); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative;
  border: 1px solid var(--rule);
  background: transparent;
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 14px;
  color: var(--ink-2);
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s var(--ease);
}
.chip:active { transform: scale(0.96); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--slip); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px;
  padding: 15px 22px;
  background: var(--ink); color: var(--slip);
  font-size: 16px; letter-spacing: 0.12em;
  transition: transform 0.15s var(--ease), opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); letter-spacing: 0.04em; }
.link { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule); }

/* The red seal — used for "received" and "done" */
.seal {
  display: inline-grid; place-items: center;
  width: 64px; height: 64px;
  border: 2.5px solid var(--seal);
  border-radius: 8px;
  color: var(--seal);
  font: 700 17px/1.05 var(--serif);
  letter-spacing: 0.08em;
  text-align: center;
  transform: rotate(-8deg);
  box-shadow: inset 0 0 0 3px var(--slip), inset 0 0 0 4px var(--seal);
  opacity: 0.92;
  mix-blend-mode: multiply;
  user-select: none;
  /* Uneven ink: a noise mask knocks small gaps out of the stamp */
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='i'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -3.2 3.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23i)'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='i'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -3.2 3.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23i)'/%3E%3C/svg%3E");
  -webkit-mask-size: 120px; mask-size: 120px;
}
@media (prefers-color-scheme: dark) { .seal { mix-blend-mode: normal; } }
.seal.small { width: 44px; height: 44px; font-size: 12px; border-width: 2px; border-radius: 6px; box-shadow: inset 0 0 0 2px var(--slip), inset 0 0 0 3px var(--seal); }
.stamp-in { animation: stamp 0.5s var(--ease) both; }
@keyframes stamp {
  0% { transform: rotate(-8deg) scale(2.2); opacity: 0; }
  55% { transform: rotate(-8deg) scale(0.94); opacity: 1; }
  100% { transform: rotate(-8deg) scale(1); opacity: 0.92; }
}

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; letter-spacing: 0.08em;
  padding: 3px 9px; border-radius: 999px;
  color: var(--ink-2); background: var(--rule-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.doing { color: var(--amber); background: var(--amber-soft); }
.badge.done { color: var(--seal); background: var(--seal-soft); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--slip);
  padding: 11px 18px; border-radius: 10px; font-size: 14px;
  transition: transform 0.35s var(--ease), opacity 0.35s;
  pointer-events: none; z-index: 50;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.lightbox {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: 20px;
  background: rgba(20, 16, 10, 0.86);
  animation: fade 0.25s both;
}
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 6px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- page layout: masthead + paper slip (colleague page, home page) ---------- */
.page { max-width: 540px; margin: 0 auto; padding: calc(28px + env(safe-area-inset-top)) 16px calc(48px + env(safe-area-inset-bottom)); }

.masthead { padding: 8px 6px 26px; animation: rise 0.7s var(--ease) both; }
.masthead h1 { margin: 10px 0 8px; font: 600 clamp(34px, 9vw, 44px)/1.15 var(--serif); letter-spacing: 0.04em; }
.masthead p { margin: 0; color: var(--ink-2); font-size: 15px; }
.masthead .urgent { margin-top: 14px; display: flex; gap: 10px; align-items: baseline; font-size: 13px; color: var(--ink-2); }
.masthead .urgent b { color: var(--seal); font-weight: 600; letter-spacing: 0.1em; flex: none; }

/* The slip: paper card with a perforated top edge */
.slip {
  position: relative;
  background: var(--slip);
  border-radius: 4px 4px 14px 14px;
  box-shadow: var(--shadow);
  padding: 30px 22px 24px;
  animation: rise 0.7s 0.08s var(--ease) both;
  transform-origin: 50% 0;
}
.slip::before {
  content: ""; position: absolute; left: 0; right: 0; top: -6px; height: 12px;
  background: radial-gradient(circle at 7px 0, transparent 5px, var(--slip) 5.5px) 0 6px / 14px 6px repeat-x;
}
.slip-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 14px; border-bottom: 1px dashed var(--rule); margin-bottom: 6px; }
.slip-head .kicker { letter-spacing: 0.4em; }
.slip-head time { font: 13px var(--serif); color: var(--ink-3); font-variant-numeric: tabular-nums; }

.field { padding: 18px 0; border-bottom: 1px solid var(--rule-2); }
.field:last-of-type { border-bottom: 0; }
.label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; font-size: 13px; color: var(--ink-2); letter-spacing: 0.1em; }
.label .opt { color: var(--ink-3); letter-spacing: 0; font-size: 12px; }
textarea.what::placeholder, .line::placeholder { color: var(--ink-3); opacity: 1; }
.line {
  width: 100%; border: 0; border-bottom: 1px solid var(--rule); background: transparent;
  padding: 8px 0; font-size: 17px; outline: none; border-radius: 0;
  transition: border-color 0.2s;
}
.line:focus { border-color: var(--ink); }
.submit { width: 100%; margin-top: 22px; padding: 17px; font-size: 17px; }
.error { color: var(--seal); font-size: 14px; min-height: 1.4em; margin: 12px 0 0; text-align: center; }
footer { margin-top: 40px; text-align: center; font-size: 12px; color: var(--ink-3); letter-spacing: 0.2em; }

.steps { display: none; }
@media (min-width: 960px) {
  .page { max-width: 1120px; display: grid; grid-template-columns: 1fr 520px; column-gap: 96px; align-items: start; padding-top: 80px; }
  .masthead { grid-row: 1 / span 2; position: sticky; top: 80px; padding: 24px 0 0; }
  .masthead h1 { font-size: 80px; line-height: 1.12; margin: 22px 0 22px; }
  .masthead h1 span { display: block; }
  .masthead h1 span + span { color: var(--seal); }
  .masthead p { font-size: 17px; }
  .masthead .urgent { margin-top: 22px; font-size: 14px; }
  .steps { display: block; list-style: none; margin: 56px 0 0; padding: 0; border-top: 1px solid var(--rule); counter-reset: s; }
  .steps li { counter-increment: s; display: grid; grid-template-columns: 56px 1fr; padding: 18px 0; border-bottom: 1px solid var(--rule); color: var(--ink-2); font-size: 15px; }
  .steps li::before { content: "0" counter(s); font: 600 13px var(--serif); color: var(--ink-3); letter-spacing: 0.1em; padding-top: 3px; }
  .steps b { display: block; font: 600 18px var(--serif); color: var(--ink); margin-bottom: 2px; letter-spacing: 0.06em; }
  .side { grid-column: 2; }
  footer { grid-column: 1 / -1; }
}

/* ---------- "what I understood" chips (colleague page, desk quick-add) ---------- */
.facts-preview { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; }
.facts-preview:not(:empty) { margin-top: 10px; }
.fact {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; border-radius: 999px; padding: 4px 10px 4px 8px;
  background: var(--rule-2); color: var(--ink-2); font-size: 13px;
  animation: pop 0.25s var(--ease) both;
}
.fact svg { width: 14px; height: 14px; flex: none; }
.fact .x { margin-left: 2px; color: var(--ink-3); }
.fact:hover .x { color: var(--seal); }
@keyframes pop { from { opacity: 0; transform: scale(0.9); } }
