/* Catchly｜Field Notes：紙張、墨水、一顆番茄紅的球。英文大標用襯線，中文一律黑體。 */
:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --surface-2: #f3ece0;
  --ink: #1c1a17;
  --ink-2: #5b554c;
  --ink-3: #8f877b;
  --line: #e6dccb;
  --line-2: #ece3d3;
  --ball: #e8492b;
  --ball-soft: #fde2da;
  --ball-ink: #c2381c;
  --sage: #d9e4d1;
  --sage-ink: #35603a;
  --sand: #f3e9d6;
  --sand-ink: #7a6440;
  --brand: var(--ink);          /* 主要按鈕：墨水黑 */
  --brand-ink: #fffdf8;
  --brand-soft: #efe6d6;        /* 選中、焦點底色 */
  --red: #c2381c; --red-soft: #fde2da;
  --yellow: #a8741a; --yellow-soft: #f7ead0;
  --green: #3f7d4e; --green-soft: #dfeadb;
  --radius: 16px;
  --shadow: 0 1px 0 rgba(28, 26, 23, .04), 0 8px 24px -12px rgba(28, 26, 23, .12);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --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'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161411; --surface: #1f1c18; --surface-2: #27231e; --ink: #f3ede2; --ink-2: #b9b0a2; --ink-3: #8a8174;
    --line: #342f28; --line-2: #2c2822; --ball: #ff7a59; --ball-soft: #3a221b; --ball-ink: #ff9a80;
    --sage: #24331f; --sage-ink: #a6c99c; --sand: #33291b; --sand-ink: #d9bf8e;
    --brand: #f3ede2; --brand-ink: #161411; --brand-soft: #2b2720;
    --red: #ff8a6e; --red-soft: #3a221b; --yellow: #e2b55f; --yellow-soft: #33291b; --green: #8fc69a; --green-soft: #1f3122;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg) var(--grain); color: var(--ink);
  font: 15px/1.75 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ball); }
h1, h2, h3 { line-height: 1.3; margin: 0; font-weight: 700; letter-spacing: .01em; }
h1 { font-size: 26px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -.015em; }
.serif em, em.ball { font-style: italic; color: var(--ball); }
.eyebrow { display: block; font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }

/* logo */
.logo { display: inline-flex; align-items: baseline; font: italic 400 26px/1 var(--serif); letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.logo i { width: 7px; height: 7px; border-radius: 50%; background: var(--ball); display: inline-block; margin-left: 2px; transform: translateY(-1px); box-shadow: inset -2px -2px 0 rgba(0,0,0,.12); }
.logo.lg { font-size: 44px; } .logo.lg i { width: 11px; height: 11px; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; }
.brand { padding: 2px 12px 20px; }
.org-name { font: 500 12px var(--sans); color: var(--ink-3); margin-top: 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--brand-soft); color: var(--ink); }
.nav a.on .ico { color: var(--ball); }
.nav .ico { width: 18px; height: 18px; display: inline-grid; place-items: center; color: var(--ink-3); }
.side-foot { margin-top: auto; font-size: 13px; color: var(--ink-3); padding: 0 12px; }
.side-foot button { background: none; border: 0; padding: 0; color: var(--ink-3); cursor: pointer; text-decoration: underline; }
.main { padding: 36px 40px 80px; max-width: 1120px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); }
.greet { font: 400 44px/1.05 var(--serif); letter-spacing: -.02em; margin: 0; }

/* components */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.stats { grid-template-columns: repeat(3, 1fr); }
.grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; color: var(--ink-3); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.empty { text-align: center; color: var(--ink-3); padding: 32px 10px; }
.empty .big { display: block; font: italic 400 30px/1.1 var(--serif); color: var(--ink-2); margin-bottom: 8px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 16px; border-radius: 99px; cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; transition: transform .12s, background .12s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.15); background: var(--brand); }
.btn.ball { background: var(--ball); border-color: var(--ball); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; font-weight: 500; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 9px 13px; outline: none; transition: border-color .12s, box-shadow .12s; }
.input:focus { border-color: var(--ink-3); box-shadow: 0 0 0 4px var(--brand-soft); }
textarea.input { min-height: 90px; resize: vertical; }

.pill { display: inline-flex; align-items: center; gap: 4px; font: 500 11.5px/1.6 var(--sans); padding: 1px 10px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.brand { background: var(--brand-soft); color: var(--ink); }
.pill.accent { background: var(--sand); color: var(--sand-ink); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.yellow { background: var(--yellow-soft); color: var(--yellow); }
.pill.green { background: var(--green-soft); color: var(--green); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.red { background: var(--ball); } .dot.yellow { background: var(--yellow); } .dot.green { background: var(--green); } .dot.none { background: var(--ink-3); }

.stat { padding: 18px 20px; }
.stat b { display: block; font: 400 40px/1 var(--serif); letter-spacing: -.02em; margin-bottom: 6px; }
.stat span { color: var(--ink-2); font-size: 13px; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-top: 1px solid var(--line-2); }
.list > li:first-child { border-top: 0; padding-top: 2px; }
.item-title { font-weight: 700; }

.project-card { display: block; color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.project-card:hover { transform: translateY(-2px); box-shadow: 0 1px 0 rgba(28,26,23,.04), 0 18px 32px -16px rgba(28,26,23,.22); }
.project-card h3 { font-size: 16px; }
.progress { height: 5px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ink); border-radius: 99px; }

.check { display: flex; gap: 12px; align-items: flex-start; }
.check input[type=checkbox] { appearance: none; width: 19px; height: 19px; margin-top: 3px; border: 1.5px solid var(--ink-3); border-radius: 50%; flex: none; cursor: pointer; display: grid; place-items: center; background: var(--surface); }
.check input[type=checkbox]:checked { background: var(--ball); border-color: var(--ball); box-shadow: inset -2px -2px 0 rgba(0,0,0,.12); }
.check input[type=checkbox]:checked::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.check.done .item-title { text-decoration: line-through; text-decoration-color: var(--ink-3); color: var(--ink-3); }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 16px 44px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font: italic 400 18px var(--serif); }
.code-box { font: 500 34px/1 var(--mono); letter-spacing: 8px; background: var(--ink); color: var(--bg); border-radius: 14px; padding: 16px 20px; display: inline-block; }

.digest { position: relative; padding-left: 16px; }
.digest::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 4px; width: 2px; background: var(--line); border-radius: 2px; }
.digest + .digest { margin-top: 18px; }
.digest ul { margin: 6px 0 0; padding-left: 18px; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: var(--surface); padding: 6px 15px; border-radius: 99px; cursor: pointer; color: var(--ink-2); }
.tabs button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font: 500 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }

dialog { border: 1px solid var(--line); border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(28, 26, 23, .4); backdrop-filter: blur(2px); }
dialog h2 { font: 400 28px/1.15 var(--serif); letter-spacing: -.01em; margin-bottom: 6px; }
.dlg-body { padding: 24px 24px 8px; }
.dlg-foot { padding: 12px 24px 22px; display: flex; justify-content: flex-end; gap: 8px; }

.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 20px; border-radius: 99px; font-size: 14px; z-index: 99; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: rise .25s ease both; }
.toast.err { background: var(--ball); color: #fff; }

.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.center-card { width: min(460px, 100%); }
.hero-title { font: 400 40px/1.05 var(--serif); letter-spacing: -.02em; margin: 18px 0 10px; }

@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.main > * { animation: fadeup .45s cubic-bezier(.2,.7,.2,1) both; }
.main > *:nth-child(2) { animation-delay: .05s; } .main > *:nth-child(3) { animation-delay: .1s; } .main > *:nth-child(4) { animation-delay: .15s; }
@media (prefers-reduced-motion: reduce) { .main > *, .toast { animation: none; } }

/* 手機：上方 logo、下方分頁列 */
.mobile-top, .tabbar { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .side.open { display: flex; position: fixed; inset: 0 25% 0 0; z-index: 60; box-shadow: 0 0 60px rgba(0,0,0,.35); }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
  .mobile-top .org-name { margin: 0; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--ink-3); text-decoration: none; background: none; border: 0; padding: 4px 0; cursor: pointer; }
  .tabbar .on { color: var(--ink); }
  .tabbar .on svg { color: var(--ball); }
  .main { padding: 22px 16px 110px; }
  .greet { font-size: 36px; }
  .grid-2, .grid-3, .grid-main { grid-template-columns: 1fr; }
  .stats { gap: 8px; }
  .stat { padding: 14px; }
  .stat b { font-size: 32px; }
  .table .hide-sm { display: none; }
}

/* 問 Catchly */
.ask-fab { position: fixed; right: 24px; bottom: 24px; z-index: 40; display: inline-flex; align-items: center; gap: 10px; background: var(--ink); color: var(--bg); border: 0; border-radius: 99px; padding: 10px 18px 10px 12px; cursor: pointer; font: 500 14px var(--sans); box-shadow: 0 14px 30px -12px rgba(28,26,23,.5); transition: transform .15s; }
.ask-fab:hover { transform: translateY(-2px); }
.ask-fab .orb { width: 22px; height: 22px; border-radius: 50%; background: var(--ball); box-shadow: inset -4px -4px 0 rgba(0,0,0,.15); }
.ask-fab em { font: italic 400 17px var(--serif); }
.ask { position: fixed; top: 16px; right: 16px; bottom: 16px; width: min(420px, calc(100vw - 32px)); z-index: 70; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.35); display: flex; flex-direction: column; overflow: hidden; animation: slidein .25s cubic-bezier(.2,.7,.2,1) both; }
.ask[hidden] { display: none; }
@keyframes slidein { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.ask-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; border-bottom: 1px solid var(--line-2); }
.ask-head .t { font: 400 24px/1 var(--serif); letter-spacing: -.01em; }
.ask-head .t em { color: var(--ball); }
.ask-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 88%; font-size: 14.5px; line-height: 1.75; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 18px 18px 4px 18px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; }
.msg.assistant p { margin: 0 0 6px; }
.msg.assistant ul { margin: 2px 0 6px; padding-left: 18px; }
.msg .used { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.msg .used span { font: 500 11px var(--mono); color: var(--ink-3); border: 1px dashed var(--line); border-radius: 99px; padding: 1px 8px; }
.confirm { align-self: stretch; border: 1px solid var(--ball); background: var(--ball-soft); border-radius: 16px; padding: 14px 16px; }
.confirm .eyebrow { color: var(--ball-ink); }
.confirm ul { margin: 0 0 12px; padding-left: 18px; font-weight: 500; }
.ask-empty { margin: auto 0; }
.ask-empty h3 { font: 400 30px/1.1 var(--serif); margin: 0 0 6px; letter-spacing: -.01em; }
.chips { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.chips button { text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 10px 14px; cursor: pointer; color: var(--ink); }
.chips button:hover { border-color: var(--ink-3); }
.typing { align-self: flex-start; display: inline-flex; gap: 8px; align-items: center; color: var(--ink-3); font-size: 13px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ball); animation: bob 1s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-4px); opacity: 1; } }
.ask-foot { border-top: 1px solid var(--line-2); padding: 12px; display: flex; gap: 8px; align-items: flex-end; }
.ask-foot textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; border-radius: 14px; }
@media (max-width: 860px) {
  .ask-fab { right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); padding: 9px 14px 9px 10px; }
  .ask { inset: 0; width: auto; border-radius: 0; border: 0; }
}
