/* 拾光码 · base */
:root {
    --paper: #f4f0e6;
    --paper-2: #ece6d8;
    --cream: #fbf8f1;
    --white: #fffdf8;
    --ink: #17211c;
    --ink-soft: #2c3630;
    --muted: #70766f;
    --muted-2: #93978f;
    --line: rgba(23, 33, 28, .13);
    --line-light: rgba(23, 33, 28, .08);
    --green: #14503b;
    --green-deep: #0c3527;
    --green-soft: #e5ede7;
    --coral: #d9704b;
    --gold: #c3a269;
    --danger: #b44834;
    --ok: #2f7658;
    --warn: #b0792e;
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 2px 8px rgba(30, 39, 31, .05);
    --shadow: 0 18px 50px rgba(30, 39, 31, .09);
    --shadow-lg: 0 34px 90px rgba(20, 30, 24, .16);
    --sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --serif: "Iowan Old Style", "Palatino Linotype", "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
    --hand: "Segoe Script", "Bradley Hand", "Kaiti SC", "KaiTi", cursive;
    --ease: cubic-bezier(.2, .75, .25, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
body::selection { background: #d8e5d5; }
h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
svg { display: inline-block; flex: 0 0 auto; }
.icon { vertical-align: -3px; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }
::placeholder { color: #9b9e96; opacity: 1; }
[hidden] { display: none !important; }
em { font-style: normal; }

/* brand */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--green); }
.brand-mark { flex: 0 0 auto; filter: drop-shadow(0 2px 5px rgba(20, 80, 59, .16)); }
.brand-word { font-family: var(--serif); font-size: 21px; font-weight: 700; letter-spacing: .08em; color: var(--ink); }
.brand-link { display: inline-flex; align-items: center; }
.brand-link.light .brand { color: #e8f0e8; }
.brand-link.light .brand-word { color: #f6f2e7; }

/* buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; padding: 0 20px; border: 1px solid transparent; border-radius: 999px;
    font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap;
    transition: transform .2s var(--ease), background .2s, border-color .2s, color .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--green); color: #fbf8ef; box-shadow: 0 8px 24px rgba(20, 80, 59, .18); }
.btn-primary:hover { background: var(--green-deep); box-shadow: 0 12px 30px rgba(20, 80, 59, .24); }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { background: rgba(255, 255, 255, .5); border-color: rgba(23, 33, 28, .3); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: rgba(23, 33, 28, .06); }
.btn-light { background: #f6f1e4; color: var(--green-deep); }
.btn-light:hover { background: #fffdf6; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: rgba(180, 72, 52, .22); }
.btn-danger-ghost:hover { background: rgba(180, 72, 52, .07); }
.btn-sm { min-height: 36px; padding: 0 15px; font-size: 13px; }
.btn-lg { min-height: 50px; padding: 0 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
    border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink);
    transition: background .2s, border-color .2s;
}
.icon-btn:hover { background: rgba(23, 33, 28, .05); }
.icon-btn.ghost { border-color: transparent; }
.text-link { color: var(--ink); font-size: 14px; font-weight: 600; border-bottom: 1px solid transparent; transition: border-color .2s; }
.text-link:hover { border-color: var(--ink); }
.arrow-link { display: inline-flex; align-items: center; gap: 5px; color: var(--green); }
.arrow-link:hover { color: var(--green-deep); }

/* forms */
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); display: flex; align-items: center; gap: 7px; }
.field-label em { font-size: 11px; font-weight: 500; color: var(--coral); }
.field-label em.muted { color: var(--muted-2); }
.field-wrap {
    position: relative; display: flex; align-items: center;
    background: #fffdf7; border: 1px solid var(--line); border-radius: 12px;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.field-wrap:focus-within { border-color: rgba(20, 80, 59, .55); box-shadow: 0 0 0 4px rgba(20, 80, 59, .08); background: #fff; }
.field-wrap > input, .field-wrap > textarea, .field-wrap > select {
    width: 100%; border: 0; outline: 0; background: transparent; padding: 12px 14px;
    font-size: 14px; border-radius: 12px;
}
.field-wrap > textarea { resize: vertical; min-height: 96px; line-height: 1.7; }
.field-wrap > select { appearance: none; cursor: pointer; }
.field-icon { display: inline-flex; padding-left: 14px; color: var(--muted-2); }
.field-icon + input { padding-left: 10px; }
.field-action {
    display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
    border: 0; background: transparent; color: var(--muted); border-radius: 10px; margin-right: 2px;
}
.field-action:hover { color: var(--ink); background: rgba(23, 33, 28, .05); }
.field-hint { font-size: 12px; color: var(--muted-2); }
.field-hint:empty { display: none; }
.field-hint strong { color: var(--ink-soft); }
.checkline { position: relative; display: inline-flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--muted); cursor: pointer; line-height: 1.5; }
.checkline input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
.checkbox {
    flex: 0 0 auto; width: 17px; height: 17px; margin-top: 1px; border: 1px solid rgba(23, 33, 28, .3);
    border-radius: 5px; background: #fffdf7; display: inline-block; position: relative; transition: all .15s;
}
.checkline input:checked + .checkbox { background: var(--green); border-color: var(--green); }
.checkline input:checked + .checkbox::after {
    content: ""; position: absolute; left: 5px; top: 2px; width: 5px; height: 9px;
    border: solid #fff; border-width: 0 1.8px 1.8px 0; transform: rotate(42deg);
}
.checkline input:focus-visible + .checkbox { outline: 2px solid var(--coral); outline-offset: 3px; }

/* flash */
.flash-stack {
    position: fixed; z-index: 2000; top: max(18px, env(safe-area-inset-top)); left: 50%;
    transform: translateX(-50%); width: min(560px, calc(100vw - 32px));
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.flash {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 16px;
    border-radius: 13px; background: rgba(255, 253, 247, .96); border: 1px solid var(--line);
    box-shadow: 0 16px 40px rgba(20, 30, 24, .17); backdrop-filter: blur(12px);
    pointer-events: auto; animation: flashIn .35s var(--ease);
}
.flash p { flex: 1; font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.flash-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: 0 0 auto; }
.flash-error .flash-dot { background: var(--danger); }
.flash-info .flash-dot { background: #52739a; }
.flash-close { border: 0; background: transparent; color: var(--muted); padding: 2px; display: inline-flex; }
.flash-close:hover { color: var(--ink); }
@keyframes flashIn { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }

/* shared */
.eyebrow {
    display: flex; align-items: center; gap: 9px; margin: 0 0 20px;
    font-size: 11px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; color: var(--muted);
}
.eyebrow .eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 4px rgba(217, 112, 75, .12); }
.eyebrow.light { color: rgba(246, 242, 231, .62); }
.eyebrow.dark { color: var(--muted); }
.eyebrow.dark::before { content: ""; width: 22px; height: 1px; background: var(--coral); }
.eyebrow.light::before { content: ""; width: 22px; height: 1px; background: rgba(246, 242, 231, .4); }
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--coral); }
.eyebrow .eyebrow-dot { display: none; }
.muted { color: var(--muted) !important; }
.panel { background: var(--white); border: 1px solid var(--line-light); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 26px 0; }
.panel-head h3 { font-size: 17px; letter-spacing: -.01em; }
.panel-head p { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.panel-head.slim { align-items: center; }
.panel-kicker { display: block; font-size: 10px; font-weight: 700; letter-spacing: .15em; color: var(--muted-2); margin-bottom: 7px; }
.panel-empty { padding: 20px 26px 26px; font-size: 13px; color: var(--muted); }
.mini-tag { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--paper); border-radius: 999px; padding: 4px 9px; }
.status-chip {
    display: inline-flex; align-items: center; gap: 4px; width: fit-content;
    font-size: 10.5px; line-height: 1; font-weight: 700; letter-spacing: .02em;
    padding: 6px 9px; border-radius: 999px; white-space: nowrap;
}
.status-ok { color: #236346; background: #e7f1e9; }
.status-warn { color: #8c5e16; background: #f6ead2; }
.status-danger { color: #993c2b; background: #f7e5df; }
.status-muted { color: #6f736c; background: #ecece7; }

/* empty */
.empty-state { text-align: center; padding: 72px 24px; border: 1px dashed rgba(23, 33, 28, .2); border-radius: var(--radius-lg); background: rgba(255, 253, 247, .45); }
.empty-state.compact { padding: 42px 20px; border: 0; background: transparent; }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); }
.empty-state h3, .empty-state h4 { font-family: var(--serif); font-size: 22px; margin-bottom: 7px; }
.empty-state p { max-width: 380px; margin: 0 auto 18px; color: var(--muted); font-size: 13.5px; }

/* error */
.error-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 24px; background: var(--paper); }
.error-code { font-family: var(--serif); font-size: 100px; line-height: 1; color: rgba(20, 80, 59, .16); margin: 30px 0 4px; letter-spacing: -.05em; }
.error-page h1 { font-family: var(--serif); font-size: 34px; font-weight: 600; }
.error-page p { color: var(--muted); margin: 10px 0 24px; }

@media (max-width: 640px) {
    .btn-lg { min-height: 46px; padding: 0 20px; }
    .flash-stack { top: 12px; }
    .error-code { font-size: 72px; }
}

/* keep flashes clear of navigation */
body.page-app .flash-stack {
    top: auto; right: 24px; bottom: 24px; left: auto; transform: none;
    width: min(390px, calc(100vw - 32px));
}
body.page-app .flash { animation-name: flashUp; }
@keyframes flashUp { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
body.page-home .flash-stack, body.page-public .flash-stack { top: 86px; }
@media (max-width: 760px) {
    body.page-app .flash-stack { top: auto; right: 12px; bottom: 12px; width: calc(100vw - 24px); }
    body.page-home .flash-stack, body.page-public .flash-stack { top: 74px; }
}
