@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
:root {
  --navy: #1d2340;
  --navy-2: #2b3256;
  --cream: #f6f3ee;
  --paper: #fffdf9;
  --line: #e6e0d5;
  --muted: #7c8099;
  --gold: #a9844c;
  --gold-soft: #f1e8d8;
  --green: #3f7d5a;
  --green-soft: #e3efe7;
  --red: #a4453c;
  --red-soft: #f6e4e1;
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 35, 64, .05), 0 4px 16px rgba(29, 35, 64, .05);
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--cream); color: var(--navy); font-family: var(--sans); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; overflow-x: hidden; }
a { color: var(--navy); }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

h1, h2, h3, .serif { font-family: var(--serif); font-weight: 500; letter-spacing: .01em; }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 .4rem; }
h2 { font-size: 1.35rem; margin: 1.8rem 0 .6rem; }
h3 { font-size: 1.1rem; margin: 1.2rem 0 .4rem; }
.eyebrow { font-size: .72rem; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100dvh; }
.side { display: none; }
.main { flex: 1; min-width: 0; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(246, 243, 238, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); padding: calc(var(--safe-t) + 10px) 16px 10px; display: flex; align-items: center; gap: 12px; }
.topbar .back { border: 0; background: none; padding: 6px; margin-left: -6px; display: flex; cursor: pointer; }
.topbar .title { font-family: var(--serif); font-size: 1.1rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wordmark { font-family: var(--serif); letter-spacing: .38em; font-size: 1rem; flex: 1; }
.icon-btn { border: 0; background: none; padding: 8px; border-radius: 10px; cursor: pointer; display: flex; }
.icon-btn:hover { background: rgba(29, 35, 64, .06); }
.page { max-width: 760px; margin: 0 auto; padding: 20px 16px 8px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--paper); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: var(--safe-b); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: var(--nav-h); text-decoration: none; color: var(--muted); font-size: .7rem; letter-spacing: .04em; position: relative; }
.tabbar a.on { color: var(--navy); }
.tabbar a.on::before { content: ""; position: absolute; top: 0; width: 28px; height: 2px; background: var(--gold); border-radius: 2px; }
.tabbar .dot { position: absolute; top: 10px; margin-left: 22px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }

@media (min-width: 900px) {
  .side { display: flex; flex-direction: column; width: 250px; flex-shrink: 0; border-right: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; height: 100dvh; padding: 28px 14px; overflow-y: auto; }
  .side .wordmark { padding: 0 12px 4px; font-size: 1.15rem; flex: 0; }
  .side .sub { padding: 0 12px 22px; font-size: .62rem; letter-spacing: .4em; color: var(--muted); }
  .side a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--navy); font-size: .93rem; }
  .side a:hover { background: var(--cream); }
  .side a.on { background: var(--navy); color: var(--paper); }
  .side .grp { font-size: .66rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); padding: 16px 12px 6px; }
  .tabbar { display: none; }
  .main { padding-bottom: 40px; }
  .topbar .wordmark { visibility: hidden; }
  .page { padding: 32px 32px 8px; }
}

/* ---------- cards & lists ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card.navy { background: var(--navy); color: var(--paper); border-color: var(--navy); }
.card.navy .muted, .card.navy .eyebrow { color: #b9bcd0; }
.card.gold { background: var(--gold-soft); border-color: #e6d6b9; }
.card h3:first-child, .card h2:first-child { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 600px) { .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; } }

.list { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:hover { background: #fbf8f2; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 600; font-size: .96rem; }
.row .s { color: var(--muted); font-size: .85rem; margin-top: 1px; }
.row .num { font-family: var(--serif); color: var(--gold); width: 26px; font-size: 1.05rem; text-align: center; flex-shrink: 0; }
.chev { color: #b8b3a8; flex-shrink: 0; }

.tile { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: inherit; box-shadow: var(--shadow); min-height: 96px; cursor: pointer; text-align: left; }
.tile .t { font-weight: 600; font-size: .93rem; }
.tile .s { font-size: .8rem; color: var(--muted); }
.tile svg { color: var(--gold); }

.badge { display: inline-block; font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; padding: 3px 7px; border-radius: 999px; background: var(--gold); color: #fff; vertical-align: middle; font-weight: 600; }
.badge.soft { background: var(--gold-soft); color: var(--gold); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.grey { background: #ece9e3; color: var(--muted); }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--navy); background: var(--navy); color: var(--paper); padding: 12px 20px; border-radius: 12px; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; min-height: 46px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--navy); }
.btn.gold { background: var(--gold); border-color: var(--gold); }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.small { padding: 7px 12px; min-height: 34px; font-size: .85rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

label.f { display: block; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; }
.req::after { content: " *"; color: var(--gold); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=url], input[type=search], textarea, select {
  width: 100%; font: inherit; color: var(--navy); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(169, 132, 76, .15); }
textarea { min-height: 110px; resize: vertical; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; cursor: pointer; font-size: .9rem; }
.chip.on { background: var(--navy); border-color: var(--navy); color: var(--paper); }
.yn { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.yn .chips { flex-shrink: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: .9rem; cursor: pointer; margin-top: 16px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--navy); }

.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 6px 0 18px; }
.progress > div { height: 100%; background: var(--gold); transition: width .3s; }

/* ---------- checklist & todos ---------- */
.tick { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; }
.tick:last-child { border-bottom: 0; }
.box { width: 24px; height: 24px; border-radius: 8px; border: 1.5px solid #c8c1b3; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: all .15s; background: #fff; }
.tick.done .box { background: var(--green); border-color: var(--green); }
.tick.done .box::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.tick.done .lbl { color: var(--muted); text-decoration: line-through; }
.tick .lbl { flex: 1; }
.tick .meta { font-size: .78rem; color: var(--muted); }
.streak { display: flex; align-items: baseline; gap: 6px; }
.streak b { font-family: var(--serif); font-size: 1.8rem; font-weight: 400; color: var(--gold); }

/* ---------- prose (markdown) ---------- */
.prose { font-size: 1rem; }
.prose h2 { font-size: 1.25rem; border-top: 1px solid var(--line); padding-top: 1.4rem; }
.prose h2:first-child { border-top: 0; padding-top: 0; margin-top: .4rem; }
.prose p, .prose ul, .prose ol { margin: .6rem 0; }
.prose li { margin: .3rem 0; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose strong { font-weight: 650; }
.prose em { color: var(--navy-2); }
.prose table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .92rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.prose blockquote { margin: 1rem 0; padding: 4px 16px; border-left: 3px solid var(--gold); color: var(--navy-2); }
.prose a { color: var(--gold); }
.prose code { background: var(--gold-soft); padding: 1px 5px; border-radius: 5px; font-size: .9em; }

.note { background: var(--gold-soft); border: 1px solid #e6d6b9; border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.note .eyebrow { color: var(--gold); }

/* ---------- misc ---------- */
.center { text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; font-size: .92rem; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translateX(-50%); background: var(--navy); color: var(--paper); padding: 11px 18px; border-radius: 12px; font-size: .9rem; z-index: 100; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
@media (min-width: 900px) { .toast { bottom: 24px; } }
.spinner { width: 26px; height: 26px; border: 2.5px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.fade { animation: fade .25s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.video { position: relative; padding-top: 56.25%; border-radius: var(--radius); overflow: hidden; background: var(--navy); margin: 12px 0; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.seg { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 0 -16px 14px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg .chip { white-space: nowrap; flex-shrink: 0; }
.hookline { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.hookline:last-child { border-bottom: 0; }
.hookline p { margin: 0; flex: 1; font-family: var(--serif); font-size: 1.02rem; }
.copy { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 9px; font-size: .75rem; cursor: pointer; color: var(--muted); flex-shrink: 0; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px calc(32px + var(--safe-b)); text-align: center; }
.login .mark { font-family: var(--serif); font-size: 2.3rem; letter-spacing: .42em; margin-right: -.42em; }
.login .rule { width: 160px; height: 1px; background: #cfc8bc; margin: 18px auto 14px; }
.login .sub { letter-spacing: .5em; font-size: .72rem; color: var(--muted); margin-right: -.5em; }
.login form { width: 100%; max-width: 340px; margin-top: 48px; }
.login input { text-align: center; font-size: 1.35rem; letter-spacing: .25em; text-transform: uppercase; font-family: var(--serif); padding: 15px; }
.login .err { color: var(--red); font-size: .88rem; min-height: 1.3em; margin: 10px 0; }
.install { margin-top: 28px; font-size: .82rem; color: var(--muted); max-width: 320px; }
