/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- tokens ---------- */
:root {
  --font-serif: 'Newsreader', Georgia, 'Nanum Myeongjo', 'Noto Serif KR', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard',
               'Malgun Gothic', 'Noto Sans KR', system-ui, sans-serif;

  --bg:        #f4f0e8;
  --bg-2:      #efe9de;
  --surface:   #fffdf8;
  --surface-2: #faf6ee;
  --ink:       #241f18;
  --muted:     #6d6556;
  --faint:     #9a917f;
  --line:      #e4dccd;
  --line-2:    #d8cfbc;

  --accent:    #2f6f63;   /* pine/teal ink */
  --accent-ink:#1f4f47;
  --accent-bg: #e5efec;
  --gold:      #b0762a;   /* highlight */
  --gold-bg:   #f6ecd9;
  --rose:      #b0503a;

  --ring:      #2f6f63;
  --shadow:    0 1px 2px rgba(40,33,22,.04), 0 6px 20px rgba(40,33,22,.06);
  --shadow-lg: 0 10px 40px rgba(40,33,22,.12);
  --radius:    16px;
  --radius-sm: 10px;
  --maxw:      960px;
}
:root[data-theme="dark"] {
  --bg:        #14120d;
  --bg-2:      #100e0a;
  --surface:   #1e1b14;
  --surface-2: #262117;
  --ink:       #ece6d9;
  --muted:     #a89e8b;
  --faint:     #7b7362;
  --line:      #322c20;
  --line-2:    #40382a;
  --accent:    #5cb3a3;
  --accent-ink:#8fd0c3;
  --accent-bg: #17322c;
  --gold:      #d6a24e;
  --gold-bg:   #33270f;
  --rose:      #d97a63;
  --shadow:    0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.35);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#14120d; --bg-2:#100e0a; --surface:#1e1b14; --surface-2:#262117;
    --ink:#ece6d9; --muted:#a89e8b; --faint:#7b7362; --line:#322c20; --line-2:#40382a;
    --accent:#5cb3a3; --accent-ink:#8fd0c3; --accent-bg:#17322c; --gold:#d6a24e; --gold-bg:#33270f; --rose:#d97a63;
    --shadow:0 1px 2px rgba(0,0,0,.3),0 6px 20px rgba(0,0,0,.35); --shadow-lg:0 10px 40px rgba(0,0,0,.5);
  }
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: 84px; /* room for mobile tab bar */
}
.serif { font-family: var(--font-serif); }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: baseline; gap: 9px; text-decoration: none; margin-right: auto; }
.brand-mark { font-family: var(--font-serif); font-weight: 600; font-size: 1.35rem; letter-spacing: .14em; color: var(--ink); }
.brand-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); align-self: center; }
.brand-sub { font-size: .72rem; color: var(--faint); letter-spacing: .04em; }
.tbtn {
  border: 1px solid var(--line-2); background: var(--surface);
  padding: 7px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  cursor: pointer; color: var(--muted); transition: .15s; white-space: nowrap;
}
.tbtn:hover { color: var(--ink); border-color: var(--accent); }
.tbtn-login { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 40%, var(--line-2)); }
.acct { display: inline-flex; align-items: center; gap: 6px; max-width: 160px; }
.acct .acct-av { font-size: 1rem; line-height: 1; }
.acct .acct-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* desktop nav row */
.desknav { display: none; gap: 4px; }
.desknav a {
  text-decoration: none; color: var(--muted); font-size: .88rem; font-weight: 600;
  padding: 8px 14px; border-radius: 999px; transition: .15s;
}
.desknav a:hover { color: var(--ink); background: var(--surface-2); }
.desknav a.active { color: var(--accent-ink); background: var(--accent-bg); }

/* ---------- bottom tab bar (mobile) ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; text-decoration: none; color: var(--faint);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: .64rem; font-weight: 600; padding: 4px 2px; border-radius: 10px; transition: .15s;
}
.tabbar a .ic { font-size: 1.18rem; line-height: 1; }
.tabbar a.active { color: var(--accent-ink); }
.tabbar a.active .ic { transform: translateY(-1px); }

/* ---------- generic ---------- */
.view { padding: 26px 0 40px; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to {opacity:1; transform:none;} }
.section-title {
  font-family: var(--font-serif); font-size: 1.35rem; font-weight: 600;
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: .7rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px;
}
.pill.book   { background: var(--accent-bg); color: var(--accent-ink); }
.pill.orientation { background: var(--gold-bg); color: var(--gold); }
.pill.break  { background: color-mix(in srgb, var(--rose) 14%, transparent); color: var(--rose); }
.pill.wrap   { background: var(--gold-bg); color: var(--gold); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: none; border-radius: 999px;
  padding: 12px 20px; font-weight: 700; font-size: .92rem; cursor: pointer;
  text-decoration: none; transition: .15s; box-shadow: var(--shadow);
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn.sm { padding: 8px 14px; font-size: .82rem; }

/* ---------- hero ---------- */
.hero { position: relative; padding: 30px 0 8px; }
.hero-grid { display: grid; gap: 22px; }
.hero h1 {
  font-family: var(--font-serif); font-weight: 600; line-height: 1.08;
  font-size: clamp(2.1rem, 7vw, 3.4rem); letter-spacing: -.01em; margin-bottom: 12px;
}
.hero h1 .em { color: var(--accent); font-style: italic; }
.hero .lead { color: var(--muted); font-size: 1.02rem; max-width: 44ch; }
.hero .lead em { color: var(--ink); font-style: italic; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.hero-art { display: flex; justify-content: center; }
.hero-art svg { width: 100%; max-width: 380px; height: auto; filter: drop-shadow(var(--shadow)); }

/* ---------- mission (do/dont) ---------- */
.mission { display: grid; gap: 14px; margin-top: 30px; }
.mission-col h3 { font-family: var(--font-serif); font-size: 1.05rem; margin-bottom: 10px; display:flex; align-items:center; gap:8px; }
.mission ul { list-style: none; padding: 0; display: grid; gap: 9px; }
.mission li { display: flex; gap: 10px; font-size: .92rem; color: var(--muted); align-items:flex-start; }
.mission li::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; margin-top: 9px; }
.mission .do li::before  { background: var(--accent); }
.mission .dont li::before{ background: var(--rose); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 30px; }
.stat { text-align: center; padding: 16px 8px; }
.stat .num { font-family: var(--font-serif); font-size: 2rem; font-weight: 600; color: var(--accent); line-height: 1; }
.stat .lab { font-size: .74rem; color: var(--faint); margin-top: 6px; letter-spacing: .02em; }

/* ---------- timeline / week grid ---------- */
.weekgrid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: 6px; }
.weekcard {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; text-decoration: none; box-shadow: var(--shadow);
  transition: .16s; position: relative; overflow: hidden;
}
.weekcard::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line-2);
}
.weekcard.k-book::before { background: var(--accent); }
.weekcard.k-orientation::before, .weekcard.k-wrap::before { background: var(--gold); }
.weekcard.k-break::before { background: var(--rose); }
.weekcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.weekcard.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg), var(--shadow); }
.weekcard .emoji {
  width: 46px; height: 46px; display: grid; place-items: center; font-size: 1.5rem;
  background: var(--surface-2); border-radius: 12px; border: 1px solid var(--line);
}
.weekcard .wmeta { min-width: 0; }
.weekcard .wnum { font-size: .68rem; font-weight: 700; letter-spacing: .08em; color: var(--faint); text-transform: uppercase; }
.weekcard .wtitle { font-family: var(--font-serif); font-size: 1.06rem; font-weight: 600; line-height: 1.25; }
.weekcard .wtitle span { color: var(--faint); font-family: var(--font-sans); font-size: .78rem; font-weight: 600; }
.weekcard .wright { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.done-check {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2);
  display: grid; place-items: center; font-size: .8rem; color: transparent; flex: none;
}
.weekcard.done .done-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.current-flag { font-size: .62rem; font-weight: 800; color: var(--accent-ink); letter-spacing:.06em; }

/* ---------- week detail ---------- */
.detail-head { margin-bottom: 18px; }
.detail-head .crumb { font-size: .78rem; color: var(--faint); font-weight: 600; letter-spacing: .04em; }
.detail-head h1 {
  font-family: var(--font-serif); font-size: clamp(1.7rem, 5.5vw, 2.5rem); font-weight: 600;
  line-height: 1.12; margin: 8px 0 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.detail-head h1 .demoji { font-size: 1.7rem; }
.detail-head .chips { display: flex; gap: 8px; flex-wrap: wrap; }
.block { margin-top: 16px; }
.block-label {
  font-size: .72rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 8px; display: flex; align-items: center; gap: 7px;
}
.focus-text { font-size: 1.05rem; color: var(--ink); }
.key-quote {
  border-left: 3px solid var(--accent); background: var(--accent-bg);
  padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-serif); font-size: 1.04rem; font-style: italic; color: var(--accent-ink);
}
.bookref {
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: var(--radius); padding: 12px 16px; background: var(--accent-bg);
}
.bookref .br-chap {
  font-family: var(--font-serif); font-weight: 600; font-size: 1.02rem;
  color: var(--accent-ink); margin-bottom: 4px;
}
.bookref .br-note { font-size: .92rem; color: var(--muted); }
.bookref .br-ed {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line);
  font-size: .78rem; color: var(--muted); line-height: 1.45;
}
.bookref .br-ed em { font-style: italic; }

/* auth / onboarding views */
.wrap.narrow { max-width: 520px; }
.auth-lead { color: var(--muted); font-size: .98rem; line-height: 1.6; margin: 6px 0 18px; }
.auth-box { display: flex; flex-direction: column; gap: 12px; }
.auth-input {
  width: 100%; box-sizing: border-box; padding: 12px 14px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface);
  color: var(--ink); font-size: 1rem; font-family: inherit;
}
.auth-input:focus { outline: none; border-color: var(--accent); }
.btn-primary {
  padding: 12px 18px; border: none; border-radius: 10px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: .98rem; font-weight: 600;
  transition: .15s;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: .55; cursor: default; }
.auth-msg { font-size: .9rem; line-height: 1.5; min-height: 1em; }
.auth-msg.ok { color: var(--accent-ink); }
.auth-msg.err { color: var(--danger, #c0392b); }
.auth-err {
  border: 1px solid var(--danger, #c0392b); background: color-mix(in srgb, var(--danger, #c0392b) 8%, transparent);
  color: var(--danger, #c0392b); padding: 10px 14px; border-radius: 10px; font-size: .9rem; margin-bottom: 14px;
}
.auth-devlink { margin-top: 10px; font-size: .82rem; word-break: break-all; }
.auth-devlink a { color: var(--accent-ink); }
.auth-sublabel { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.avatar-row { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-opt {
  width: 44px; height: 44px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface); font-size: 1.3rem; cursor: pointer; transition: .12s;
}
.avatar-opt:hover { border-color: var(--accent); }
.avatar-opt.on { border-color: var(--accent); background: var(--accent-bg); transform: scale(1.05); }
.prompt-card {
  background: var(--gold-bg); border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line));
  border-radius: var(--radius); padding: 16px 18px;
}
.prompt-card .block-label { color: var(--gold); }
.prompt-card p { font-size: 1.02rem; color: var(--ink); }

/* days */
.days { display: grid; gap: 8px; }
.day {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: flex-start;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; transition: .12s; user-select: none;
}
.day:hover { border-color: var(--line-2); }
.day.checked { background: var(--surface-2); }
.day .dbox {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line-2);
  display: grid; place-items: center; font-size: .78rem; color: transparent; flex: none; margin-top: 1px; transition:.12s;
}
.day.checked .dbox { background: var(--accent); border-color: var(--accent); color: #fff; }
.day .dtext { font-size: .94rem; }
.day.checked .dtext { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.day .dtag { font-size: .64rem; font-weight: 800; color: var(--accent); letter-spacing:.05em; display:block; margin-bottom:2px; }

/* forms */
.formlist { display: grid; gap: 8px; }
.formlink {
  display: flex; align-items: center; gap: 11px; text-decoration: none;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); transition: .14s; font-size: .92rem; font-weight: 600;
}
.formlink:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--surface-2); }
.formlink .fic { font-size: 1.05rem; }
.formlink .farrow { margin-left: auto; color: var(--faint); }
.note { font-size: .8rem; color: var(--faint); margin-top: 8px; }

/* log */
.logfield { margin-bottom: 14px; }
.logfield label { display: block; font-size: .82rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.logfield textarea, .logfield input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 11px 13px; font-size: .95rem; resize: vertical; transition: .14s;
}
.logfield textarea { min-height: 66px; }
.logfield textarea:focus, .logfield input:focus { border-color: var(--accent); background: var(--surface); }
.log-status { font-size: .74rem; color: var(--accent); height: 16px; transition:.2s; opacity:0; }
.log-status.show { opacity: 1; }
.mins { max-width: 140px; }

.detail-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }
.detail-nav a { flex: 1; }
.detail-nav .btn.ghost { justify-content: space-between; width:100%; }
.detail-nav .disabled { visibility: hidden; }

/* ---------- dashboard ---------- */
.dash-top { display: grid; gap: 16px; grid-template-columns: 1fr; align-items:center; }
.ring-wrap { display: flex; align-items: center; gap: 20px; }
.ring { --p: 0; width: 108px; height: 108px; flex: none; }
.dash-nums { display: flex; gap: 24px; flex-wrap: wrap; }
.dash-nums .num { font-family: var(--font-serif); font-size: 1.8rem; font-weight: 600; color: var(--ink); }
.dash-nums .lab { font-size: .74rem; color: var(--faint); }
.dash-weeks { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px,1fr)); gap: 8px; margin-top: 6px; }
.dw {
  aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; font-size: .82rem; font-weight: 700; text-decoration: none; color: var(--muted);
  position: relative; transition:.14s;
}
.dw:hover { border-color: var(--accent); }
.dw.done { background: var(--accent); color: #fff; border-color: var(--accent); }
.dw.break { border-style: dashed; color: var(--rose); }
.dw.current { box-shadow: 0 0 0 2px var(--accent-bg); border-color: var(--accent); }

.code-area {
  width: 100%; min-height: 74px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .74rem; background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 12px; resize: vertical; word-break: break-all;
}
.code-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mini-status { font-size:.78rem; color: var(--accent); align-self:center; }
.danger { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 40%, var(--line-2)); }
.danger:hover { border-color: var(--rose); color: var(--rose); }

/* ---------- prose (about) ---------- */
.prose p { color: var(--muted); margin-bottom: 12px; }
.prose h3 { font-family: var(--font-serif); font-size: 1.12rem; margin: 20px 0 8px; color: var(--ink); }
.prose strong { color: var(--ink); }
.prose em { font-style: italic; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); margin-top: 30px; padding: 24px 0 10px; }
.foot .motto { font-family: var(--font-serif); font-style: italic; color: var(--muted); }
.foot .links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: .82rem; }
.foot .links a { color: var(--faint); text-decoration: none; }
.foot .links a:hover { color: var(--accent-ink); }
.foot .fine { font-size: .72rem; color: var(--faint); margin-top: 14px; line-height:1.5; }

/* ---------- fill-in forms: index cards ---------- */
.formcards { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: 6px; }
.formcard {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-decoration: none; box-shadow: var(--shadow); transition: .16s; position: relative;
}
.formcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.formcard .fc-emoji {
  width: 46px; height: 46px; display: grid; place-items: center; font-size: 1.5rem;
  background: var(--accent-bg); border-radius: 12px; flex: none;
}
.formcard .fc-tag { font-size: .66rem; font-weight: 800; letter-spacing: .08em; color: var(--accent); text-transform: uppercase; }
.formcard .fc-title { font-family: var(--font-serif); font-size: 1.12rem; font-weight: 600; line-height: 1.2; margin: 2px 0 4px; }
.formcard .fc-desc { font-size: .86rem; color: var(--muted); line-height: 1.45; }
.formcard .fc-open { grid-column: 2; font-size: .8rem; font-weight: 700; color: var(--accent-ink); margin-top: 8px; }

/* ---------- fill-in form: detail ---------- */
.form-back {
  display: inline-block; text-decoration: none; color: var(--muted);
  font-size: .84rem; font-weight: 700; margin-bottom: 12px;
}
.form-back:hover { color: var(--accent-ink); }
.form-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.form-head-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.form-head .form-emoji {
  width: 52px; height: 52px; display: grid; place-items: center; font-size: 1.7rem;
  background: var(--accent-bg); border-radius: 14px; flex: none;
}
.form-head .crumb { font-size: .72rem; color: var(--faint); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.form-head h1 { font-family: var(--font-serif); font-size: clamp(1.5rem, 5vw, 2.1rem); font-weight: 600; line-height: 1.15; }
.form-desc { color: var(--muted); font-size: .95rem; margin: 12px 0 16px; }

.fmt-toggle { display: flex; align-items: center; gap: 6px; }
.fmt-toggle .fmt-lab { font-size: .72rem; color: var(--faint); font-weight: 700; margin-right: 2px; }
.fmt-toggle button {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--muted);
  padding: 6px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; cursor: pointer; transition: .14s;
}
.fmt-toggle button:hover { border-color: var(--accent); color: var(--ink); }
.fmt-toggle button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.form-sheet { padding: 22px; }
.form-heading {
  font-family: var(--font-serif); font-size: 1.05rem; font-weight: 600; color: var(--accent-ink);
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin: 22px 0 14px;
}
.form-heading:first-child { margin-top: 0; }
.form-note { font-size: .82rem; color: var(--faint); margin-bottom: 14px; font-style: italic; }

.ffield { margin-bottom: 16px; }
.ff-label { display: block; font-size: .84rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.ffield input[type="text"], .ffield input[type="date"], .ffield input[type="number"],
.ffield textarea, .ffield select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 11px 13px; font-size: .95rem; transition: .14s;
}
.ffield textarea { min-height: 70px; resize: vertical; }
.ffield input:focus, .ffield textarea:focus, .ffield select:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.ff-num { display: flex; align-items: center; gap: 8px; }
.ff-num input { max-width: 150px; }
.ff-unit { font-size: .84rem; color: var(--faint); font-weight: 600; }

/* single checkbox row */
.fcheck {
  display: flex; align-items: flex-start; gap: 11px; padding: 11px 13px; margin-bottom: 10px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  cursor: pointer; transition: .12s; user-select: none;
}
.fcheck:hover { border-color: var(--line-2); }
.fcheck.on { background: var(--accent-bg); border-color: var(--accent); }
.fcheck input { position: absolute; opacity: 0; width: 0; height: 0; }
.fcheck .fbox {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line-2); flex: none; margin-top: 1px;
  display: grid; place-items: center; font-size: .78rem; color: transparent; transition: .12s;
}
.fcheck.on .fbox { background: var(--accent); border-color: var(--accent); color: #fff; }
.fcheck .fctext { font-size: .92rem; }

/* scale */
.fscale { display: flex; gap: 8px; }
.fs-dot {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2);
  font-weight: 700; color: var(--muted); cursor: pointer; transition: .12s;
}
.fs-dot:hover { border-color: var(--accent); }
.fs-dot.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.fs-ends { display: flex; justify-content: space-between; max-width: 232px; font-size: .72rem; color: var(--faint); margin-top: 5px; }

/* table */
.ftable-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ftable { border-collapse: collapse; width: 100%; min-width: 380px; }
.ftable th, .ftable td { border: 1px solid var(--line); padding: 4px; text-align: left; }
.ftable thead th { font-size: .74rem; color: var(--muted); font-weight: 700; background: var(--surface-2); padding: 8px; }
.ftable .ft-row { font-size: .82rem; color: var(--muted); font-weight: 700; background: var(--surface-2); white-space: nowrap; padding: 8px 10px; }
.ftable td input {
  width: 100%; border: none; background: transparent; padding: 8px 9px; font-size: .9rem; border-radius: 6px;
}
.ftable td input:focus { outline: none; background: var(--accent-bg); }
.ftable tfoot .ft-total { font-family: var(--font-serif); font-weight: 700; color: var(--accent-ink); text-align: center; background: var(--surface-2); }

/* preview */
.ff-preview .fpreview {
  background: var(--gold-bg); border: 1px solid color-mix(in srgb, var(--gold) 30%, var(--line));
  border-radius: var(--radius-sm); padding: 13px 15px; font-family: var(--font-serif);
  font-size: 1rem; line-height: 1.6; color: var(--ink);
}
.ff-preview .fpreview.empty { color: var(--faint); font-style: italic; }

.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; }
.form-ref { margin-top: 22px; }
.form-ref > span { display: block; font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }

/* ---------- print ---------- */
@media print {
  .topbar, .tabbar, .foot, .form-back, .fmt-toggle, .form-actions, .form-ref { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .form-sheet { box-shadow: none; border: none; padding: 0; }
  .card { box-shadow: none; }
  .ffield input, .ffield textarea, .ffield select, .fcheck, .fs-dot, .ftable th, .ftable td { background: #fff !important; }
  .view { animation: none; }
}

/* ---------- responsive ---------- */
@media (min-width: 720px) {
  .tabbar { display: none; }
  body { padding-bottom: 0; }
  .desknav { display: flex; }
  .hero-grid { grid-template-columns: 1.15fr .85fr; align-items: center; }
  .mission { grid-template-columns: 1fr 1fr; gap: 18px; }
  .weekgrid { grid-template-columns: 1fr 1fr; }
  .dash-top { grid-template-columns: 1fr; }
  .formcards { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 720px) and (max-width: 980px) { .wrap { max-width: 760px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- social: feed / share ---------- */
.auth-gate { text-align: center; }
.auth-gate p { margin: 0 0 12px; color: var(--muted); }
.feed-bar { display: flex; gap: 8px; margin: 14px 0 4px; align-items: center; }
.feed-week { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  font-family: var(--font-sans); font-size: .92rem; }
.compose-wrap:not(:empty) { margin: 12px 0; }
.feed-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.feed-loading, .feed-empty { color: var(--faint); text-align: center; padding: 22px 0; font-size: .92rem; }
.share-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); }
.sc-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .78rem; margin-bottom: 8px; }
.sc-prompt { background: var(--accent-bg); color: var(--accent-ink); font-weight: 600;
  padding: 2px 9px; border-radius: 20px; }
.sc-week { color: var(--muted); }
.sc-time { color: var(--faint); }
.sc-mine { margin-left: auto; background: var(--gold-bg); color: var(--gold); padding: 2px 8px; border-radius: 20px; }
.sc-q { font-size: .82rem; color: var(--muted); font-style: italic; margin-bottom: 6px; }
.sc-body { white-space: pre-wrap; line-height: 1.6; color: var(--ink); font-size: .95rem; }
.sc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sc-btn { display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink);
  padding: 5px 11px; border-radius: 20px; font-family: var(--font-sans); text-decoration: none; }
.sc-btn:hover { border-color: var(--accent); }
.sc-btn.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-ink); }
.sc-btn .cnt { font-weight: 600; }
.sc-btn.danger:hover { border-color: var(--rose); color: var(--rose); }
.sc-btn.subtle { background: transparent; border-color: transparent; color: var(--faint); }
.sc-btn.subtle:hover { color: var(--rose); }

/* compose */
.compose { display: flex; flex-direction: column; gap: 10px; }
.prompt-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.prompt-chip { font-size: .82rem; padding: 5px 12px; border-radius: 20px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink); font-family: var(--font-sans); }
.prompt-chip.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.compose-q { font-size: .84rem; color: var(--muted); font-style: italic; }
.compose-body { width: 100%; min-height: 120px; resize: vertical; padding: 11px 13px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--ink); font-family: var(--font-sans); font-size: .95rem; line-height: 1.6; }
.compose-row { display: flex; align-items: center; gap: 10px; }

/* feedback */
.fb-list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 18px; }
.fb-item { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.fb-head { display: flex; align-items: center; gap: 7px; font-size: .8rem; margin-bottom: 5px; }
.fb-av { font-size: 1.05rem; }
.fb-name { font-weight: 600; color: var(--ink); }
.fb-time { color: var(--faint); margin-left: auto; }
.fb-body { white-space: pre-wrap; line-height: 1.6; font-size: .92rem; color: var(--ink); }
.fb-actions { margin-top: 8px; }
.fb-back { display: inline-block; margin-bottom: 12px; color: var(--accent); text-decoration: none; font-size: .88rem; }
.fb-back:hover { text-decoration: underline; }

/* report modal */
.modal-ov { position: fixed; inset: 0; background: rgba(30,24,16,.45); display: flex;
  align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 20px; max-width: 360px; width: 100%;
  box-shadow: var(--shadow-lg); }
.modal-title { font-weight: 600; margin-bottom: 14px; }
.report-reasons { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.report-reason { text-align: left; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer; font-family: var(--font-sans); font-size: .9rem; color: var(--ink); }
.report-reason:hover { border-color: var(--rose); color: var(--rose); }

/* week share cta */
.week-share-cta { display: flex; align-items: center; justify-content: space-between; margin-top: 18px;
  padding: 14px 18px; border: 1px dashed var(--accent); border-radius: var(--radius); color: var(--accent-ink);
  background: var(--accent-bg); text-decoration: none; font-weight: 600; }
.week-share-cta:hover { background: var(--surface); }

/* dashboard social */
.dash-social { display: flex; flex-direction: column; gap: 16px; }
.social-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ss-cell { text-align: center; background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 8px; }
.ss-cell .num { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 600; color: var(--accent-ink); }
.ss-cell .lab { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.week-rates { display: flex; flex-direction: column; gap: 6px; }
.wr-row { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.wr-n { width: 20px; text-align: right; font-size: .82rem; color: var(--muted); }
.wr-bar { flex: 1; height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; }
.wr-fill { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.wr-pct { width: 40px; text-align: right; font-size: .78rem; color: var(--faint); }
.wr-row:hover .wr-fill { background: var(--accent-ink); }

/* topics */
.topics-search { display: flex; gap: 8px; margin: 14px 0 6px; }
.topics-search .auth-input { flex: 1; }
.topics-results { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.paper-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.pc-title { font-family: var(--font-serif); font-size: 1.02rem; line-height: 1.4; }
.pc-title a { color: var(--ink); text-decoration: none; }
.pc-title a:hover { color: var(--accent); text-decoration: underline; }
.pc-meta { font-size: .82rem; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pc-tag { font-size: .74rem; padding: 2px 8px; border-radius: 20px; background: var(--surface-2);
  border: 1px solid var(--line-2); color: var(--muted); text-decoration: none; }
.pc-tag.oa { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-ink); }
.pc-tag.link:hover { border-color: var(--accent); color: var(--accent); }
.tool-links { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 10px; }
.tool-link { display: flex; flex-direction: column; padding: 10px 12px; border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); text-decoration: none; background: var(--surface-2); }
.tool-link:hover { border-color: var(--accent); }
.tl-name { font-weight: 600; color: var(--accent-ink); font-size: .9rem; }
.tl-desc { font-size: .8rem; color: var(--muted); margin-top: 2px; }

@media (min-width: 720px) {
  .social-stats { grid-template-columns: repeat(4, 1fr); }
}
