:root {
  --ink: #2c2a33;
  --muted: #8d8a95;
  --line: #eee8e7;
  --surface: #fff;
  --bg: #fffaf7;
  --pink: #ff7f9e;
  --pink-deep: #ef5e83;
  --violet: #8c7cf3;
  --mint: #54c6aa;
  --peach: #fff0e9;
  --shadow: 0 12px 30px rgba(76, 47, 61, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
body { min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
.app-shell { min-height: 100dvh; padding-bottom: 84px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 13px; background: rgba(255,250,247,.94); backdrop-filter: blur(18px); border-bottom: 1px solid rgba(238,232,231,.8); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 13px; color: #fff; background: linear-gradient(145deg, #ff93ae, #8e80f4); box-shadow: 0 7px 18px rgba(239, 94, 131, .22); font-size: 19px; }
.brand-name { font-weight: 800; letter-spacing: .02em; }
.brand-sub { color: var(--muted); font-size: 11px; margin-top: 1px; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 3px 12px rgba(76,47,61,.06); }
.page { width: min(100%, 760px); margin: 0 auto; padding: 20px 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 17px; }
.page-title { margin: 0; font-size: 28px; line-height: 1.12; letter-spacing: -.03em; }
.page-kicker { color: var(--muted); font-size: 13px; margin-top: 7px; }
.hero-card { position: relative; overflow: hidden; padding: 21px; border-radius: 24px; background: linear-gradient(135deg, #fff0f2, #f3f0ff 85%); box-shadow: var(--shadow); }
.hero-card::after { content: ""; position: absolute; right: -25px; top: -35px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.58); }
.hero-title { position: relative; z-index: 1; margin: 0 0 7px; font-size: 20px; }
.hero-copy { position: relative; z-index: 1; max-width: 270px; margin: 0; color: #716b78; font-size: 13px; line-height: 1.6; }
.hero-actions { position: relative; z-index: 1; display: flex; gap: 9px; margin-top: 16px; }
.btn { min-height: 42px; padding: 0 16px; border-radius: 14px; font-weight: 700; transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease; }
.btn:active { transform: scale(.97); }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--pink), var(--pink-deep)); box-shadow: 0 8px 16px rgba(239,94,131,.22); }
.btn-secondary { color: #6554cf; background: #efedff; }
.btn-plain { color: var(--pink-deep); background: transparent; padding-inline: 6px; }
.btn-outline { color: var(--ink); background: var(--surface); border: 1px solid var(--line); }
.btn-danger { color: #c9515f; background: #fff0f1; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 18px; }
.stat-card { padding: 15px 13px; border-radius: 17px; background: var(--surface); border: 1px solid rgba(238,232,231,.8); box-shadow: 0 4px 16px rgba(76,47,61,.04); }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { margin-top: 6px; font-size: 22px; font-weight: 800; }
.stat-value.warn { color: var(--pink-deep); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 24px 2px 12px; font-weight: 800; }
.section-title small { color: var(--muted); font-size: 12px; font-weight: 500; }
.toolbar { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin-bottom: 12px; }
.input, .select, .textarea { width: 100%; min-height: 43px; padding: 0 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 13px; outline: 0; background: var(--surface); }
.textarea { min-height: 82px; padding-block: 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: #b9adfb; box-shadow: 0 0 0 3px rgba(140,124,243,.11); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 1px 7px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 9px 13px; color: #76717b; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; font-size: 12px; }
.chip.active { color: #fff; border-color: var(--violet); background: var(--violet); box-shadow: 0 6px 12px rgba(140,124,243,.2); }
.subtoolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 4px 0 13px; }
.segmented { display: flex; padding: 3px; border-radius: 12px; background: #f3eeed; }
.segmented button { padding: 7px 11px; border-radius: 9px; color: var(--muted); background: transparent; font-size: 12px; }
.segmented button.active { color: var(--ink); background: var(--surface); box-shadow: 0 2px 8px rgba(76,47,61,.08); }
.color-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.color-card { padding: 12px; border-radius: 18px; background: var(--surface); border: 1px solid rgba(238,232,231,.8); box-shadow: 0 4px 13px rgba(76,47,61,.05); }
.color-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.color-code { font-size: 16px; font-weight: 800; }
.color-series { margin-top: 2px; color: var(--muted); font-size: 10px; }
.dot { width: 29px; height: 29px; border-radius: 10px; border: 2px solid rgba(255,255,255,.9); box-shadow: inset 0 0 0 1px rgba(44,42,51,.12); }
.color-qty { display: flex; justify-content: space-between; align-items: baseline; margin-top: 15px; padding: 10px 11px; border-radius: 12px; background: color-mix(in srgb, var(--color) 22%, #fff 78%); }
.color-qty strong { font-size: 22px; }
.color-qty span { color: var(--muted); font-size: 11px; }
.stock-tag { margin-top: 9px; color: var(--mint); font-size: 11px; }
.stock-tag.low { color: var(--pink-deep); }
.list { display: grid; gap: 10px; }
.record-card, .pattern-card, .chat-card { padding: 15px; border-radius: 17px; background: var(--surface); border: 1px solid var(--line); }
.record-row, .pattern-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.record-type { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; }
.record-type::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); }
.record-type.out::before { background: var(--pink); }
.record-meta { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.record-total { color: var(--violet); font-weight: 800; }
.pattern-image { width: 68px; height: 68px; object-fit: cover; border-radius: 14px; background: #f4eff2; }
.pattern-info { flex: 1; min-width: 0; }
.pattern-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.pattern-meta { margin-top: 7px; color: var(--muted); font-size: 12px; }
.pattern-status { color: var(--violet); font-size: 12px; font-weight: 700; }
.empty { padding: 32px 18px; color: var(--muted); text-align: center; border: 1px dashed #e4dedd; border-radius: 18px; }
.bottom-nav { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.94); backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.nav-item { display: grid; justify-items: center; gap: 3px; padding: 6px 2px; color: #a19ca4; background: transparent; font-size: 11px; }
.nav-icon { font-size: 20px; line-height: 1; }
.nav-item.active { color: var(--pink-deep); font-weight: 800; }
.fab { position: fixed; z-index: 22; right: 20px; bottom: 91px; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 18px; color: #fff; background: linear-gradient(145deg, #8e80f4, #ff7f9e); box-shadow: 0 12px 22px rgba(127,105,220,.28); font-size: 23px; }
.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; align-items: end; background: rgba(44,42,51,.32); }
.modal { width: 100%; max-height: min(88dvh, 780px); overflow: auto; padding: 20px 17px calc(20px + env(safe-area-inset-bottom)); border-radius: 25px 25px 0 0; background: var(--bg); box-shadow: 0 -15px 40px rgba(44,42,51,.15); animation: rise .2s ease-out; }
@keyframes rise { from { transform: translateY(18px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 17px; }
.modal-title { margin: 0; font-size: 20px; }
.close { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 50%; color: var(--muted); background: #f1eceb; }
.form-grid { display: grid; gap: 11px; }
.field-label { display: block; margin: 1px 0 6px; color: #77717b; font-size: 12px; font-weight: 700; }
.button-row { display: flex; gap: 9px; margin-top: 15px; }
.button-row > * { flex: 1; }
.notice { padding: 11px 13px; border-radius: 12px; color: #8b6870; background: #fff0f2; font-size: 12px; line-height: 1.6; }
.notice.info { color: #665cb0; background: #efedff; }
.auth-page { display: grid; place-items: center; min-height: 100dvh; padding: 24px 18px; background: radial-gradient(circle at 10% 10%, #fff0f2, transparent 38%), radial-gradient(circle at 90% 90%, #efedff, transparent 40%), var(--bg); }
.auth-card { width: min(100%, 420px); padding: 25px 20px; border-radius: 28px; background: rgba(255,255,255,.9); box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 25px; }
.auth-brand .brand-mark { width: 46px; height: 46px; border-radius: 16px; font-size: 22px; }
.auth-title { margin: 0; font-size: 27px; }
.auth-copy { margin: 8px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.auth-tabs { display: flex; gap: 20px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.auth-tab { padding: 0 0 10px; color: var(--muted); background: transparent; font-weight: 800; }
.auth-tab.active { color: var(--pink-deep); border-bottom: 2px solid var(--pink); }
.code-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.code-button { min-width: 100px; color: #6f60d8; background: #efedff; border-radius: 12px; font-size: 12px; }
.chat-list { display: grid; gap: 10px; max-height: 49dvh; overflow-y: auto; padding: 2px 1px; }
.chat-bubble { max-width: 88%; padding: 11px 13px; border-radius: 15px; line-height: 1.55; font-size: 13px; white-space: pre-wrap; }
.chat-bubble.user { justify-self: end; color: #fff; border-bottom-right-radius: 5px; background: linear-gradient(135deg, #8b7bf0, #ad9ef6); }
.chat-bubble.assistant { justify-self: start; border-bottom-left-radius: 5px; background: var(--surface); border: 1px solid var(--line); }
.plan { margin-top: 10px; padding: 11px; border-radius: 12px; background: #fff4ef; }
.plan-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 12px; }
.plan-row strong { color: var(--pink-deep); }
.chat-input { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 11px; }
.chat-input .input { min-height: 46px; }
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); font-size: 12px; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: 92px; max-width: calc(100% - 32px); padding: 11px 15px; color: #fff; background: rgba(44,42,51,.9); border-radius: 13px; box-shadow: 0 9px 22px rgba(44,42,51,.18); font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #cf5a6b; }
@media (min-width: 680px) {
  .page { padding: 28px 22px; }
  .color-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { width: min(100%, 560px); border-radius: 25px; }
}
