:root {
  --bg: #f6f4ef;
  --surface: #fffefb;
  --text: #211f1b;
  --muted: #716b62;
  --line: #e3ded4;
  --accent: #2f6f62;
  --accent-text: #fdfcf8;
  --accent-soft: #e2eeea;
  --danger: #a3392b;
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "Fira Code", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412;
    --surface: #1c1b19;
    --text: #ece8e0;
    --muted: #9d968b;
    --line: #2f2d29;
    --accent: #80c5b4;
    --accent-text: #10201c;
    --accent-soft: #1f2f2b;
    --danger: #e58372;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 2rem; margin: 0.4em 0 0.6em; }
h2 { font-size: 1.2rem; margin: 1.8em 0 0.6em; }
h2 a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.eyebrow { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; margin: 0; }

/* ---- public landing and login ---- */
.bare { min-height: 100svh; display: grid; place-items: center; }
.landing { text-align: center; padding: 16px; }
.landing h1 { font-size: clamp(2.6rem, 9vw, 4.8rem); margin: 0; font-weight: 500; }
.landing p { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: clamp(1.05rem, 3vw, 1.3rem); margin: 0.4em 0 0; }
.landing a.quiet { color: inherit; }
.landing a.quiet:hover { color: var(--accent); text-decoration: none; }
.login { width: min(340px, 100% - 32px); }
.login .card { display: grid; gap: 10px; }
.login label { font-size: 0.9rem; color: var(--muted); }
.login-foot { text-align: center; color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); margin: 0; font-size: 0.9rem; }

/* ---- app chrome ---- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.sections { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.sections::-webkit-scrollbar { display: none; }
.sections a {
  color: var(--muted); padding: 14px 10px; white-space: nowrap; font-size: 0.95rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.sections a:hover { color: var(--text); text-decoration: none; }
.sections a[aria-current] { color: var(--text); border-bottom-color: var(--accent); }
.mark { font-family: var(--serif); font-size: 1.5rem; line-height: 1; color: var(--accent); margin-right: 4px; }
.mark:hover { text-decoration: none; }
.tools { display: flex; align-items: center; gap: 12px; }
.tools a { color: var(--muted); display: flex; }
.tools a:hover { color: var(--text); text-decoration: none; }
.lang { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.05em; }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 48px; }
.foot {
  max-width: 760px; margin: 0 auto; padding: 24px 16px 40px;
  display: flex; justify-content: space-between; gap: 16px;
  border-top: 1px solid var(--line); font-size: 0.85rem;
}
.foot form { margin: 0; }
.foot a, .foot .link { color: var(--muted); }

/* ---- forms ---- */
input, textarea, select, button { font: inherit; color: inherit; }
input:not([type]), input[type=text], input[type=search], input[type=password], input[type=date],
input[type=url], input[type=email], input[type=number], input[type=tel], textarea, select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; line-height: 1.55; }
textarea.mono { font-family: var(--mono); font-size: 0.9rem; }
select { width: auto; }
.title-input { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  white-space: nowrap;
}
button:hover, .button:hover { border-color: var(--muted); text-decoration: none; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover, .button.primary:hover { filter: brightness(1.08); }
button.danger { background: var(--danger); border-color: var(--danger); color: var(--surface); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); }
button.link:hover { text-decoration: underline; text-underline-offset: 3px; }
button.link.danger { color: var(--danger); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row > form { margin: 0; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 12px; }
.inline { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.inline input { width: auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 16px; }
.card input, .card textarea, .card select { background: var(--bg); }
.crumb { margin: 4px 0 0; font-size: 0.9rem; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.actions { margin-top: 32px; }

details summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; width: fit-content; }
details summary:hover { color: var(--text); }
details.manage { margin-top: 32px; }
details.manage[open] > summary { margin-bottom: 12px; }
details.manage > * + * { margin-top: 12px; }
details.delete summary { color: var(--danger); list-style: none; }
details.delete summary::-webkit-details-marker { display: none; }
details.delete[open] summary { margin-bottom: 8px; }

/* ---- start ---- */
.hello { margin: 16px 0 20px; }
.hello h1 { margin: 0.15em 0 0.5em; font-size: clamp(1.8rem, 6vw, 2.4rem); }
.searchbar { margin: 0 0 20px; }
.quick textarea { border: 0; padding: 4px 2px; background: transparent; resize: none; }
.quick textarea:focus { outline: none; }
.quick .row { justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px 12px; min-width: 0; }
.panel h2 { font-size: 1rem; margin: 12px 0 8px; }
.panel .prose { font-size: 0.95rem; }
.memory { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 10px; }
.links-panel h2 { font-size: 1rem; }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 4px 0; overflow-wrap: anywhere; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips a, .chips li > a {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: 0.9rem;
}
.chips a:hover { border-color: var(--accent); text-decoration: none; }
.chips a[aria-current] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.tags { margin-bottom: 16px; }

.grid progress { display: block; margin-top: 6px; }
progress {
  appearance: none; width: 100%; max-width: 240px; height: 6px; border: 0;
  border-radius: 999px; background: var(--line); overflow: hidden; color: var(--accent);
}
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.progress { display: flex; align-items: center; gap: 10px; }

/* ---- lists of things ---- */
ul.entries { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
ul.entries > li { padding: 12px 2px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.entry-title { font-weight: 500; font-size: 1.05rem; color: var(--text); }
.entry-title:hover { color: var(--accent); }
.meta { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.meta a { color: var(--muted); }
ul.entries .prose { margin-top: 6px; color: var(--muted); }

ol.timeline { list-style: none; padding: 0; margin: 24px 0 0; }
ol.timeline > li { padding: 4px 0 16px 20px; border-left: 2px solid var(--line); position: relative; }
ol.timeline > li::before {
  content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
.day { font-size: 1rem; margin: 4px 0; }
.pager { margin-top: 16px; }

ul.checks { list-style: none; padding: 0; margin: 16px 0; }
ul.checks li { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
ul.checks li form { margin: 0; display: flex; }
ul.checks li.done .grow { color: var(--muted); text-decoration: line-through; }
.box {
  width: 22px; height: 22px; padding: 0; border-radius: 6px;
  border: 2px solid var(--muted); background: transparent; flex: none;
}
.box[aria-pressed=true] { background: var(--accent); border-color: var(--accent); position: relative; }
.box[aria-pressed=true]::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid var(--accent-text); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.remove { color: var(--muted) !important; font-size: 1.3rem; line-height: 1; opacity: 0.5; }
.remove:hover { opacity: 1; color: var(--danger) !important; text-decoration: none !important; }

/* ---- security ---- */
.notice { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; }
.notice.warn { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.notice.warn a { color: inherit; font-weight: 500; }
.prev-login { margin: -8px 0 14px; }
.prev-login a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.badge { font-size: 0.72rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.login-row { display: flex; gap: 12px; align-items: flex-start; }
.dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 8px; flex: none; }
.dot.ok { background: var(--accent); }
.dot.bad { background: var(--danger); }
.bad-text { color: var(--danger); font-weight: 600; }
.head-row form { margin: 0; }

/* ---- rendered markdown ---- */
.prose { overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol, .prose pre, .prose blockquote, .prose table { margin: 0 0 0.9em; }
.prose h1, .prose h2, .prose h3 { margin: 1.4em 0 0.5em; }
.prose code { font-family: var(--mono); font-size: 0.88em; background: var(--accent-soft); padding: 0.1em 0.35em; border-radius: 4px; }
.prose pre { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; font-size: 0.85rem; }
.prose blockquote { border-left: 3px solid var(--line); padding-left: 14px; color: var(--muted); margin-left: 0; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 4px 10px; }
.prose img { max-width: 100%; }
.prose ul:has(input[type=checkbox]) { list-style: none; padding-left: 4px; }
article .meta { margin-bottom: 20px; }
.why { color: var(--muted); margin-bottom: 16px; }

/* phones: sections move to a bottom tab bar, within thumb reach */
@media (max-width: 600px) {
  .top { min-height: 48px; backdrop-filter: none; background: var(--bg); }
  .tools { margin-left: auto; }
  .sections {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sections a {
    flex: 1; text-align: center; padding: 14px 2px; font-size: 0.78rem;
    border-bottom: 0; border-top: 2px solid transparent; margin: -1px 0 0;
  }
  .sections a[aria-current] { border-top-color: var(--accent); }
  body { padding-bottom: 56px; }
}
@media (max-width: 520px) {
  h1 { font-size: 1.7rem; }
  .quick .row button { flex: 1; }
  .foot { flex-direction: column; }
}

/* ---- job applications ---- */
.fld { display: grid; gap: 4px; color: var(--muted); font-size: 0.9rem; }
.fld input, .fld textarea, .fld select { color: var(--text); font-size: 1rem; }
.fld select { width: 100%; }
.stats { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 16px; }
.stats li { flex: 1 1 90px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; }
.stats b { display: block; font-size: 1.5rem; line-height: 1.2; }
.stats span { color: var(--muted); font-size: 0.8rem; }
.stats li.due { border-color: var(--danger); }
.stats li.due b { color: var(--danger); }
.filters { margin: 0 0 12px; }
.filters select { width: auto; }
ul.jobs > li.due { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.due-text { color: var(--danger); }
.pill { font-size: 0.75rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.pill.st-reply, .pill.st-interview { background: color-mix(in srgb, var(--h-azure) 16%, transparent); color: var(--a-azure); }
.pill.st-offer { background: color-mix(in srgb, var(--h-vert) 16%, transparent); color: var(--a-vert); }
.pill.st-rejected { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.pill.st-noreply { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.jobs-new { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.jobs-new > .card { margin: 0; }
@media (max-width: 860px) { .jobs-new { grid-template-columns: 1fr; } }
pre.letter { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font: 0.92rem/1.6 var(--serif); }
textarea.letter-edit { font-family: var(--serif); font-size: 0.95rem; color: var(--text); }

/* ---- publish box on the note form ---- */
fieldset.publish { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0; display: grid; gap: 8px; }
fieldset.publish p { margin: 0; }
label.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
label.check input { width: auto; }

/* ---- two-factor setup ---- */
ol.steps { padding-left: 1.2em; display: grid; gap: 14px; }
code.secret { display: inline-block; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); letter-spacing: .08em; font-size: 1.05rem; user-select: all; overflow-wrap: anywhere; }
ul.recovery { list-style: none; padding: 0; margin: 16px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 8px; }
ul.recovery code { display: block; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: 1.05rem; user-select: all; }

/* ---- weekly review ---- */
.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 18px; flex-wrap: wrap; }
.review-block { margin: 26px 0; }
.review-block h2 { margin-bottom: 8px; }
.daystrip { display: flex; gap: 6px; margin: 0 0 10px; }
.daystrip .day { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.daystrip .day.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.daystrip .day.future { opacity: .4; }
.card.planned { margin: 0 0 18px; }
form.reflect { margin-top: 30px; }
form.reflect textarea { width: 100%; }
