/* 工坊配方 · 移动端手作风样式 */
:root {
    --paper: #f7f1e6;
    --paper-2: #fffaf1;
    --paper-3: #f1e8d8;
    --ink: #2f2a24;
    --ink-2: #55493d;
    --muted: #8c8273;
    --line: #e6dccb;
    --clay: #c25b2e;
    --clay-deep: #a4471f;
    --clay-soft: #f5e0d2;
    --green: #3f5c45;
    --green-soft: #e2ebdf;
    --gold: #c9a227;
    --danger: #b8452f;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 6px 24px rgba(101, 79, 50, .08);
    --shadow-lg: 0 16px 40px rgba(101, 79, 50, .14);
    --tabbar-h: 62px;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% 8%, rgba(194, 91, 46, .07), transparent 42%),
        radial-gradient(circle at 92% 4%, rgba(63, 92, 69, .06), transparent 38%);
    z-index: 0;
}

#app { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 15px; color: var(--ink); }
img { display: block; max-width: 100%; }

.shell {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px);
}

/* ---------- 启动屏 ---------- */
.boot-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}
.boot-mark {
    width: 64px; height: 64px;
    border-radius: 22px;
    display: grid; place-items: center;
    background: linear-gradient(145deg, var(--clay), var(--clay-deep));
    color: #fff6ea;
    font-size: 30px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
}
.boot-name { color: var(--muted); letter-spacing: .18em; font-size: 13px; }
.boot-spinner, .spinner {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(194, 91, 46, .18);
    border-top-color: var(--clay);
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 顶栏 ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    max-width: 520px;
    margin: 0 auto;
    padding: calc(14px + var(--safe-t)) 18px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(247, 241, 230, .92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand-mark {
    width: 38px; height: 38px;
    border-radius: 13px;
    display: grid; place-items: center;
    background: linear-gradient(145deg, var(--clay), var(--clay-deep));
    color: #fff6ea;
    font-size: 19px;
    font-weight: 600;
    flex: none;
}
.brand-name { font-size: 17px; font-weight: 600; letter-spacing: .02em; line-height: 1.25; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .08em; }
.avatar-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--paper-2);
    display: grid; place-items: center;
    color: var(--green);
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    flex: none;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

.page { padding: 14px 18px 0; animation: fadeUp .32s ease both; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- 搜索 ---------- */
.searchbar {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 10px 15px;
    box-shadow: 0 2px 10px rgba(101, 79, 50, .04);
}
.searchbar svg { width: 17px; height: 17px; stroke: var(--muted); flex: none; }
.searchbar input {
    flex: 1;
    min-width: 0;
    background: none;
    border: 0;
    outline: 0;
    padding: 0;
    font-size: 14px;
}
.searchbar input::placeholder { color: #b3a794; }

/* ---------- 分段器 ---------- */
.segmented {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-top: 14px;
    background: var(--paper-3);
    border-radius: 999px;
}
.segmented button {
    flex: 1;
    border: 0;
    background: transparent;
    border-radius: 999px;
    padding: 8px 0;
    font-size: 13.5px;
    color: var(--muted);
    font-weight: 500;
    transition: all .2s;
}
.segmented button.active {
    background: var(--paper-2);
    color: var(--ink);
    box-shadow: 0 2px 8px rgba(101, 79, 50, .1);
    font-weight: 600;
}

.chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 13px 0 3px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: none;
    border: 1px solid var(--line);
    background: var(--paper-2);
    color: var(--ink-2);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12.5px;
    white-space: nowrap;
    transition: all .18s;
}
.chip.active {
    background: var(--green);
    border-color: var(--green);
    color: #f3f6ef;
}
.chip .chip-count { opacity: .6; margin-left: 3px; font-size: 11px; }

/* ---------- 配方卡 ---------- */
.list { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }

.recipe-card {
    display: flex;
    gap: 13px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
    transition: transform .16s ease, box-shadow .16s ease;
}
.recipe-card:active { transform: scale(.985); }
.recipe-cover {
    width: 86px; height: 86px;
    flex: none;
    border-radius: 14px;
    overflow: hidden;
    display: grid;
    place-items: center;
    color: #fff8ee;
    font-size: 30px;
    font-weight: 600;
    position: relative;
}
.recipe-cover img { width: 100%; height: 100%; object-fit: cover; }
.recipe-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .22), transparent 60%);
    pointer-events: none;
}
.recipe-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.recipe-title {
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.recipe-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.recipe-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; align-items: center; }
.recipe-stats { font-size: 11.5px; color: var(--muted); margin-top: 7px; letter-spacing: .01em; }
.recipe-stats b { color: var(--ink-2); font-weight: 600; }

/* ---------- 渐变底色 ---------- */
.tone-1 { background: linear-gradient(140deg, #d98756, #b4572c); }
.tone-2 { background: linear-gradient(140deg, #7e9b76, #45604a); }
.tone-3 { background: linear-gradient(140deg, #d8b25f, #b0872c); }
.tone-4 { background: linear-gradient(140deg, #9d8fbd, #6d5f92); }
.tone-5 { background: linear-gradient(140deg, #d68a8a, #ad5050); }
.tone-6 { background: linear-gradient(140deg, #7fa6b3, #4c7787); }

/* ---------- 徽标 ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.7;
    white-space: nowrap;
}
.badge-soft { background: var(--paper-3); color: var(--ink-2); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-clay { background: var(--clay-soft); color: var(--clay-deep); }
.badge-gold { background: #f6ecd2; color: #96771a; }
.badge-red { background: #f7dfd9; color: var(--danger); }
.badge-blue { background: #dfe8ec; color: #47697a; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-top: 13px;
}
.card.flush { padding: 0; overflow: hidden; }
.section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
}
.section-title span { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.section-title .link { color: var(--clay); font-size: 12px; font-weight: 500; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--line);
    background: var(--paper-2);
    color: var(--ink-2);
    border-radius: 999px;
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .16s;
    line-height: 1.35;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary {
    background: linear-gradient(145deg, var(--clay), var(--clay-deep));
    border-color: transparent;
    color: #fff8ef;
    box-shadow: 0 6px 18px rgba(164, 71, 31, .22);
}
.btn-green { background: var(--green); border-color: var(--green); color: #f4f7f0; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: #e7c9c2; background: #fdf4f1; }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn svg { width: 16px; height: 16px; }

.fab {
    position: fixed;
    right: max(18px, calc(50% - 242px));
    bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px);
    z-index: 40;
    width: 54px; height: 54px;
    border: 0;
    border-radius: 19px;
    background: linear-gradient(145deg, var(--clay), var(--clay-deep));
    color: #fff7ec;
    font-size: 25px;
    line-height: 1;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 26px rgba(164, 71, 31, .32);
    transition: transform .18s;
}
.fab:active { transform: scale(.94); }

/* ---------- 底部导航 ---------- */
.tabbar {
    position: fixed;
    left: 0; right: 0;
    bottom: 0;
    z-index: 35;
    height: calc(var(--tabbar-h) + var(--safe-b));
    padding-bottom: var(--safe-b);
    background: rgba(255, 250, 241, .94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
}
.tabbar-inner {
    max-width: 520px;
    height: var(--tabbar-h);
    margin: 0 auto;
    display: flex;
}
.tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #a3988a;
    font-size: 10.5px;
    letter-spacing: .04em;
    transition: color .18s;
}
.tabbar svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.tabbar a.active { color: var(--clay); font-weight: 600; }

/* ---------- 详情封面 ---------- */
.detail-cover {
    position: relative;
    height: 218px;
    margin: 0 auto;
    max-width: 520px;
    display: grid;
    place-items: center;
    color: #fff8ee;
    overflow: hidden;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.detail-cover .cover-char { font-size: 64px; font-weight: 600; opacity: .92; letter-spacing: .08em; }
.detail-cover::before {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(circle at 28% 22%, rgba(255, 255, 255, .22), transparent 55%);
}
.detail-cover::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, rgba(30, 24, 18, .18), rgba(30, 24, 18, .06) 40%, rgba(30, 24, 18, .58));
}
.back-btn {
    position: absolute;
    top: calc(14px + var(--safe-t));
    left: 16px;
    z-index: 3;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .4);
    background: rgba(30, 24, 18, .28);
    backdrop-filter: blur(8px);
    color: #fff;
    display: grid; place-items: center;
}
.back-btn svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2; }
.cover-actions { position: absolute; top: calc(14px + var(--safe-t)); right: 16px; z-index: 3; display: flex; gap: 8px; }
.cover-actions .round-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .4);
    background: rgba(30, 24, 18, .28);
    backdrop-filter: blur(8px);
    color: #fff;
    display: grid; place-items: center;
}
.round-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.cover-text {
    position: absolute;
    left: 20px; right: 20px; bottom: 16px;
    z-index: 2;
}
.cover-text h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: .01em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .28);
}
.cover-text .cover-meta {
    margin-top: 7px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11.5px;
    color: rgba(255, 255, 255, .86);
}
.cover-text .cover-meta .dot { opacity: .5; }

/* ---------- 描述 ---------- */
.desc { margin: 0; font-size: 14px; line-height: 1.75; color: var(--ink-2); }
.desc-empty { color: #b5a996; font-size: 13px; }

/* ---------- 换算 ---------- */
.yield-box { display: flex; flex-direction: column; gap: 10px; }
.yield-input {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}
.yield-input input {
    flex: 1;
    border: 0;
    background: none;
    outline: 0;
    font-size: 22px;
    font-weight: 600;
    color: var(--ink);
    width: 100%;
    min-width: 0;
}
.yield-input .unit { color: var(--muted); font-size: 13px; flex: none; }
.quick-row { display: flex; gap: 8px; }
.quick-row button {
    flex: 1;
    border: 1px solid var(--line);
    background: var(--paper-2);
    border-radius: 10px;
    padding: 7px 0;
    font-size: 12px;
    color: var(--ink-2);
}
.quick-row button:active { background: var(--clay-soft); border-color: #e9c7b4; }
.ratio-line { font-size: 12px; color: var(--muted); }
.ratio-line b { color: var(--clay); font-weight: 600; }

.material-table { display: flex; flex-direction: column; }
.material-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 13.5px;
}
.material-row:last-child { border-bottom: 0; }
.material-name { flex: 1; min-width: 0; }
.material-name .key-dot { color: var(--clay); font-size: 11px; margin-left: 4px; }
.material-amount { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.material-amount small { font-weight: 400; color: var(--muted); margin-left: 3px; font-size: 11.5px; }
.material-remark { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ---------- 工序 ---------- */
.steps { display: flex; flex-direction: column; gap: 0; }
.step { display: flex; gap: 13px; position: relative; padding-bottom: 18px; }
.step:last-child { padding-bottom: 0; }
.step::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 32px;
    bottom: 0;
    width: 1px;
    background: var(--line);
}
.step:last-child::before { display: none; }
.step-no {
    width: 27px; height: 27px;
    flex: none;
    border-radius: 50%;
    background: var(--clay-soft);
    color: var(--clay-deep);
    display: grid; place-items: center;
    font-size: 12px;
    font-weight: 600;
    margin-top: 2px;
}
.step-body { flex: 1; min-width: 0; }
.step-title { font-size: 14.5px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.step-title .step-time, .step-title .step-temp {
    font-size: 11px;
    font-weight: 400;
    color: var(--muted);
    background: var(--paper-3);
    border-radius: 6px;
    padding: 1px 7px;
}
.step-content { margin: 5px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.75; white-space: pre-wrap; }
.step-tips {
    margin-top: 8px;
    padding: 8px 11px;
    background: #fdf6e8;
    border-left: 2px solid var(--gold);
    border-radius: 0 8px 8px 0;
    font-size: 12.5px;
    color: #7d6a3a;
    line-height: 1.65;
}
.step-img { margin-top: 9px; border-radius: 10px; overflow: hidden; max-height: 220px; }
.step-img img { width: 100%; object-fit: cover; }

/* ---------- 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: .02em;
}
.field .req { color: var(--clay); margin-left: 2px; }
.input, .select, .textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--paper);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    outline: 0;
    font-size: 15px;
    transition: border-color .18s, box-shadow .18s;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: #d5b19a;
    box-shadow: 0 0 0 3px rgba(194, 91, 46, .09);
    background: var(--paper-2);
}
.textarea { min-height: 82px; resize: vertical; line-height: 1.65; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238c8273' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
.form-row { display: flex; gap: 10px; }
.form-row .field { flex: 1; }
.field-hint { font-size: 11.5px; color: var(--muted); }
.field-hint.error { color: var(--danger); }

.switch-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.switch-line .switch-label { font-size: 13.5px; }
.switch-line .switch-desc { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.switch {
    position: relative;
    width: 46px; height: 27px;
    flex: none;
}
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.switch .track {
    position: absolute; inset: 0;
    border-radius: 999px;
    background: #ddd2c0;
    transition: background .2s;
}
.switch .track::after {
    content: "";
    position: absolute;
    top: 3px; left: 3px;
    width: 21px; height: 21px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .16);
    transition: transform .2s;
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(19px); }

/* ---------- 动态编辑器 ---------- */
.editor-block {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 13px;
    background: var(--paper);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
}
.editor-head .idx {
    display: inline-grid; place-items: center;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--clay-soft);
    color: var(--clay-deep);
    font-size: 11px;
    margin-right: 6px;
}
.remove-btn {
    border: 0;
    background: none;
    color: #b6a794;
    padding: 2px 4px;
    font-size: 12px;
}
.remove-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; display: block; }
.editor-grid { display: flex; gap: 8px; }
.editor-grid .input, .editor-grid .select { padding: 8px 10px; font-size: 13.5px; border-radius: 10px; }
.editor-grid .grow { flex: 1; min-width: 0; }
.editor-grid .shrink { width: 92px; flex: none; }
.editor-grid .mini { width: 76px; flex: none; }
.mini-label { font-size: 11px; color: var(--muted); }
.add-row-btn {
    border: 1px dashed #d9cbb6;
    background: transparent;
    color: var(--clay);
    border-radius: 12px;
    padding: 10px;
    font-size: 13px;
    width: 100%;
}
.key-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--ink-2);
    white-space: nowrap;
}
.key-check input { accent-color: var(--clay); }

/* ---------- 图片上传 ---------- */
.uploader { display: flex; flex-wrap: wrap; gap: 9px; }
.thumb {
    position: relative;
    width: 78px; height: 78px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .del {
    position: absolute;
    top: 3px; right: 3px;
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 0;
    background: rgba(30, 24, 18, .62);
    color: #fff;
    display: grid; place-items: center;
    font-size: 12px;
}
.add-thumb {
    width: 78px; height: 78px;
    border-radius: 12px;
    border: 1px dashed #d9cbb6;
    background: var(--paper);
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 10.5px;
}
.add-thumb svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.cover-picker {
    display: flex;
    align-items: center;
    gap: 13px;
}
.cover-preview {
    width: 74px; height: 74px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    display: grid; place-items: center;
    color: #fff8ee;
    font-size: 24px;
    font-weight: 600;
    flex: none;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 批次卡片 ---------- */
.batch-card {
    display: block;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 15px;
    box-shadow: var(--shadow);
}
.batch-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.batch-no { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.batch-title { font-size: 15.5px; font-weight: 600; margin-top: 5px; }
.batch-metrics {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
}
.batch-metric { font-size: 11.5px; color: var(--muted); }
.batch-metric b { display: block; font-size: 14px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.batch-metric b small { font-size: 10.5px; font-weight: 400; color: var(--muted); margin-left: 2px; }

/* ---------- 统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 8px;
    text-align: center;
}
.stat b { display: block; font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat span { font-size: 11px; color: var(--muted); }
.stat.highlight b { color: var(--clay); }

/* ---------- 我的 ---------- */
.profile-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(150deg, #fffaf1, #f3e9d8);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 18px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.profile-card::after {
    content: "";
    position: absolute;
    right: -30px; top: -40px;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(194, 91, 46, .1), transparent 70%);
}
.profile-avatar {
    width: 58px; height: 58px;
    border-radius: 20px;
    background: linear-gradient(145deg, var(--clay), var(--clay-deep));
    color: #fff7ec;
    display: grid; place-items: center;
    font-size: 23px;
    font-weight: 600;
    overflow: hidden;
    flex: none;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: 18px; font-weight: 600; }
.profile-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.menu-list {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 13px;
    box-shadow: var(--shadow);
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    width: 100%;
    background: none;
    border-left: 0; border-right: 0; border-top: 0;
    text-align: left;
    font-size: 14.5px;
    color: var(--ink);
}
.menu-item:last-child { border-bottom: 0; }
.menu-item .menu-icon {
    width: 32px; height: 32px;
    border-radius: 10px;
    background: var(--paper-3);
    display: grid; place-items: center;
    flex: none;
}
.menu-item .menu-icon svg { width: 17px; height: 17px; stroke: var(--ink-2); fill: none; stroke-width: 1.7; }
.menu-item .menu-text { flex: 1; }
.menu-item .menu-desc { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.menu-item .chev { color: #c2b5a2; }
.menu-item .chev svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger .menu-icon { background: #f7e2dc; }
.menu-item.danger .menu-icon svg { stroke: var(--danger); }

/* ---------- 空状态 / 加载 ---------- */
.empty {
    text-align: center;
    padding: 46px 20px;
    color: var(--muted);
}
.empty .empty-mark {
    width: 62px; height: 62px;
    margin: 0 auto 14px;
    border-radius: 20px;
    background: var(--paper-3);
    display: grid; place-items: center;
    font-size: 26px;
    color: #b9a98f;
}
.empty h3 { font-size: 14.5px; color: var(--ink-2); margin: 0 0 5px; font-weight: 600; }
.empty p { font-size: 12.5px; margin: 0 0 16px; }

.loading-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 26px 0;
    color: var(--muted);
    font-size: 12.5px;
}
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }

.load-more {
    width: 100%;
    margin: 16px 0 8px;
    border: 1px solid var(--line);
    background: var(--paper-2);
    color: var(--muted);
    border-radius: 999px;
    padding: 11px;
    font-size: 13px;
}

/* ---------- 底部操作条 ---------- */
.bottom-bar {
    position: fixed;
    left: 0; right: 0;
    bottom: 0;
    z-index: 36;
    background: rgba(255, 250, 241, .95);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 12px 18px calc(12px + var(--safe-b));
}
.bottom-bar-inner {
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    align-items: center;
}
.bottom-bar .btn { flex: 1; }
.shell.has-bottom-bar { padding-bottom: calc(86px + var(--safe-b)); }

/* ---------- Toast ---------- */
.toast-wrap {
    position: fixed;
    left: 0; right: 0;
    top: calc(18px + var(--safe-t));
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.toast {
    max-width: 82vw;
    background: rgba(46, 40, 33, .93);
    color: #fff9f0;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 13px;
    box-shadow: 0 10px 30px rgba(30, 24, 18, .22);
    animation: toastIn .24s ease both;
    display: flex;
    align-items: center;
    gap: 7px;
}
.toast.success { background: rgba(56, 82, 61, .95); }
.toast.error { background: rgba(150, 56, 38, .95); }
.toast.leaving { animation: toastOut .22s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px) scale(.97); } }

/* ---------- 弹层 ---------- */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(36, 30, 24, .42);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: overlayIn .2s ease both;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    width: 100%;
    max-width: 520px;
    background: var(--paper-2);
    border-radius: 22px 22px 0 0;
    padding: 20px 20px calc(20px + var(--safe-b));
    box-shadow: 0 -10px 40px rgba(30, 24, 18, .16);
    animation: modalUp .26s cubic-bezier(.22, .8, .32, 1) both;
    max-height: 88vh;
    overflow-y: auto;
}
@keyframes modalUp { from { transform: translateY(26px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.modal-desc { font-size: 13px; color: var(--muted); margin: 0 0 16px; line-height: 1.7; }
.modal .form { gap: 12px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.modal-center {
    border-radius: 20px;
    margin: 0 22px;
    max-width: 400px;
    align-self: center;
    animation: popIn .22s ease both;
}
.overlay.center { align-items: center; }
@keyframes popIn { from { transform: scale(.94); opacity: .5; } to { transform: none; opacity: 1; } }

/* ---------- 详情操作 ---------- */
.detail-actions {
    display: flex;
    gap: 9px;
    margin-top: 16px;
}
.detail-actions .btn { flex: 1; }

.owner-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding-top: 13px;
    border-top: 1px dashed var(--line);
    font-size: 12px;
    color: var(--muted);
}
.owner-strip .owner-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--paper-3);
    display: grid; place-items: center;
    font-size: 12px;
    color: var(--ink-2);
    overflow: hidden;
}
.owner-strip .owner-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 分类管理 ---------- */
.cat-group { margin-top: 13px; }
.cat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 14px;
    margin-bottom: 8px;
}
.cat-item.child { margin-left: 22px; background: var(--paper); }
.cat-name { flex: 1; font-size: 14px; }
.cat-count { font-size: 11px; color: var(--muted); background: var(--paper-3); border-radius: 999px; padding: 2px 8px; }
.cat-actions { display: flex; gap: 2px; }
.cat-actions button { border: 0; background: none; padding: 4px; color: #b6a794; }
.cat-actions button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; display: block; }
.cat-actions button.del { color: #c58d7d; }

/* ---------- 工具 ---------- */
.hidden { display: none !important; }
.mt-0 { margin-top: 0 !important; }
.stack-8 { display: flex; flex-direction: column; gap: 8px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12.5px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- 登录页 ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: calc(40px + var(--safe-t)) 24px calc(30px + var(--safe-b));
    max-width: 520px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: "";
    position: absolute;
    top: -110px; right: -90px;
    width: 260px; height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(194, 91, 46, .16), transparent 68%);
}
.login-page::after {
    content: "";
    position: absolute;
    bottom: -120px; left: -100px;
    width: 280px; height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(63, 92, 69, .13), transparent 68%);
}
.login-hero { position: relative; z-index: 1; margin-bottom: 30px; }
.login-mark {
    width: 64px; height: 64px;
    border-radius: 22px;
    display: grid; place-items: center;
    background: linear-gradient(145deg, var(--clay), var(--clay-deep));
    color: #fff6ea;
    font-size: 30px;
    font-weight: 600;
    box-shadow: 0 14px 30px rgba(164, 71, 31, .28);
    margin-bottom: 20px;
}
.login-hero h1 { font-size: 27px; margin: 0 0 10px; font-weight: 600; letter-spacing: .02em; }
.login-hero p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.85; }
.login-tags { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.login-tags span {
    font-size: 11.5px;
    color: var(--green);
    background: rgba(63, 92, 69, .09);
    border-radius: 999px;
    padding: 4px 11px;
}
.login-card {
    position: relative;
    z-index: 1;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.login-note { margin: 0; font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.7; }
.login-foot {
    position: relative;
    z-index: 1;
    margin-top: 26px;
    text-align: center;
    font-size: 11px;
    color: #b0a390;
    letter-spacing: .16em;
}

/* ---------- 无底色返回按钮 ---------- */
.plain-back {
    width: 34px; height: 34px;
    flex: none;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--paper-2);
    color: var(--ink-2);
    display: grid; place-items: center;
}
.plain-back svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ---------- 批次投料行 ---------- */
.batch-material {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 0;
    border-bottom: 1px dashed var(--line);
}
.batch-material:last-child { border-bottom: 0; }
.batch-material .material-name { flex: 1; min-width: 0; font-size: 13.5px; }
.batch-real-input {
    width: 98px;
    flex: none;
    text-align: right;
    padding: 8px 10px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}
.batch-unit { width: 28px; flex: none; font-size: 12px; color: var(--muted); }
.batch-metrics { flex-wrap: wrap; }

@media (min-width: 560px) {
    body { background: #efe7d9; }
    .shell { background: var(--paper); box-shadow: 0 0 60px rgba(80, 62, 40, .08); }
    .topbar { background: rgba(247, 241, 230, .96); }
    .overlay { align-items: center; }
    .modal { border-radius: 22px; margin: 0 20px; max-height: 82vh; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
