:root {
  --accent: #b96f4d;
  --accent-deep: #8f4f34;
  --accent-soft: #f1ded0;
  --accent-pale: #fbf1e9;
  --ink: #342d28;
  --muted: #7d7168;
  --faint: #a79b91;
  --line: #ded4ca;
  --line-soft: #ebe4dc;
  --canvas: #f4efe7;
  --surface: #fffdf9;
  --sidebar: #2d2925;
  --sidebar-muted: #bcb2a9;
  --success: #557965;
  --success-soft: #e6efe8;
  --warning: #9a6d24;
  --warning-soft: #f6ebd2;
  --danger: #a55049;
  --danger-soft: #f6e3e0;
  --shadow: 0 20px 60px rgba(55, 42, 32, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; font-size: 14px; }
button, input, textarea, select { font: inherit; }
button, a, label[for] { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:disabled { cursor: not-allowed; opacity: .56; }
:focus-visible { outline: 3px solid rgba(185, 111, 77, .28); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* 登录 */
.auth-screen { min-height: 100svh; position: relative; display: grid; place-items: center; overflow: hidden; padding: 80px 24px; background: var(--sidebar); color: #fffaf4; }
.auth-screen::before { content: ""; position: absolute; width: 520px; height: 520px; left: -180px; top: -190px; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.018), 0 0 0 140px rgba(255,255,255,.012); }
.auth-screen::after { content: "♡"; position: absolute; right: clamp(30px, 8vw, 120px); bottom: -110px; color: rgba(255,255,255,.035); font-family: Georgia, serif; font-size: min(46vw, 580px); line-height: 1; }
.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-screen > .auth-brand { position: absolute; left: clamp(24px, 5vw, 72px); top: 35px; z-index: 1; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.25); border-radius: 13px; background: var(--accent); color: white; font: 23px Georgia, serif; }
.auth-brand div { display: grid; gap: 1px; }
.auth-brand strong { font-size: 15px; letter-spacing: .08em; }
.auth-brand small { color: #bfb5ac; font-size: 10px; letter-spacing: .12em; }
.auth-panel { width: min(100%, 420px); position: relative; z-index: 1; display: grid; gap: 17px; padding: 38px; border: 1px solid rgba(255,255,255,.12); border-radius: 24px; background: rgba(255,253,249,.97); color: var(--ink); box-shadow: 0 35px 90px rgba(0,0,0,.28); animation: authEnter 520ms cubic-bezier(.2,.8,.2,1) both; }
.auth-panel h1 { margin: 1px 0 -7px; font-family: Georgia, "Songti SC", serif; font-size: 34px; font-weight: 500; letter-spacing: -.04em; }
.auth-panel > p:not(.form-error) { margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.auth-panel label, .admin-dialog label, .detail-drawer form > label { display: grid; gap: 7px; }
.auth-panel label > span, .admin-dialog label > span, .detail-drawer form > label > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.auth-submit { width: 100%; margin-top: 4px; justify-content: space-between; }
.auth-hint { color: var(--muted); font-size: 10px; line-height: 1.65; text-align: center; }
.form-error { min-height: 16px; margin: -5px 0 0; color: var(--danger); font-size: 11px; text-align: center; }
.auth-foot { position: absolute; z-index: 1; bottom: 28px; color: #8f877f; font-size: 10px; letter-spacing: .1em; }

/* 框架与导航 */
.admin-shell { min-height: 100svh; display: grid; grid-template-columns: 248px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; z-index: 10; height: 100svh; display: flex; flex-direction: column; padding: 27px 18px 19px; background: var(--sidebar); color: #fffaf4; }
.brand-lockup { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-lockup > span { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.2); border-radius: 14px; background: var(--accent); color: white; font: 24px Georgia, serif; box-shadow: 0 10px 28px rgba(185,111,77,.28); }
.brand-lockup div { display: grid; gap: 2px; }
.brand-lockup strong { font-size: 15px; letter-spacing: .08em; }
.brand-lockup small { color: var(--sidebar-muted); font-size: 9px; letter-spacing: .12em; }
.side-nav { display: grid; gap: 3px; margin-top: 39px; }
.side-nav a { min-height: 46px; display: flex; align-items: center; gap: 13px; position: relative; padding: 0 13px; border-radius: 11px; color: var(--sidebar-muted); font-size: 12px; transition: color 160ms ease, background 160ms ease, transform 160ms ease; }
.side-nav a > span { width: 19px; color: #716a64; font: 9px Georgia, serif; letter-spacing: .06em; }
.side-nav a:hover { color: #fff; transform: translateX(2px); }
.side-nav a.active { background: rgba(255,255,255,.085); color: white; font-weight: 750; }
.side-nav a.active::before { content: ""; width: 3px; height: 18px; position: absolute; left: -1px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-nav a b { min-width: 20px; height: 20px; display: grid; place-items: center; margin-left: auto; border-radius: 20px; background: var(--accent); color: white; font-size: 9px; }
.sidebar-account { min-height: 58px; display: grid; grid-template-columns: 34px 1fr auto; gap: 9px; align-items: center; margin-top: auto; padding: 11px 9px 0; border-top: 1px solid rgba(255,255,255,.1); }
.account-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #48413b; color: #ead8c9; font-size: 11px; }
.sidebar-account > div:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.sidebar-account strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; }
.sidebar-account small { display: flex; align-items: center; gap: 5px; color: #928b84; font-size: 9px; }
.sidebar-account small i { width: 6px; height: 6px; border-radius: 50%; background: #79aa89; box-shadow: 0 0 0 3px rgba(121,170,137,.12); }
.sidebar-account button { width: 30px; height: 30px; border: 0; border-radius: 9px; background: transparent; color: #8f8780; }
.sidebar-account button:hover { background: rgba(255,255,255,.08); color: white; }
.admin-main { min-width: 0; padding: 39px clamp(24px, 4vw, 64px) 80px; }
.admin-module { max-width: 1500px; margin: 0 auto; animation: riseIn 320ms ease both; }
.mobile-bar { display: none; }

/* 通用标题与操作 */
.admin-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 27px; }
.compact-top { align-items: center; }
.eyebrow, .section-kicker { display: block; color: var(--accent); font-size: 9px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.admin-top h1 { margin: 7px 0 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(31px,4vw,45px); font-weight: 500; letter-spacing: -.045em; }
.admin-top p { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.primary-action, .secondary-action, .ai-action { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 17px; border-radius: 11px; font-size: 11px; font-weight: 800; transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease; }
.primary-action { border: 1px solid var(--accent-deep); background: var(--accent); color: white; box-shadow: 0 9px 22px rgba(185,111,77,.18); }
.primary-action:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 13px 26px rgba(185,111,77,.25); }
.secondary-action { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.secondary-action:hover:not(:disabled) { border-color: #c9b9ab; background: var(--accent-pale); }
.text-action { border: 0; background: transparent; color: var(--muted); font-size: 10px; }
.text-action:hover { color: var(--accent-deep); }
.danger-action { color: var(--danger); }
.full-action { width: 100%; }

input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); outline: 0; color-scheme: light; transition: border-color 140ms ease, box-shadow 140ms ease; }
input, select { min-height: 42px; padding: 0 11px; }
textarea { resize: vertical; padding: 11px; line-height: 1.65; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(185,111,77,.1); }
input::placeholder, textarea::placeholder { color: #b4aaa1; }

/* 总览 */
.overview-kpis { display: grid; grid-template-columns: 1.35fr repeat(3,1fr); margin-bottom: 20px; border-block: 1px solid var(--line); }
.overview-kpis article { min-width: 0; display: grid; gap: 7px; padding: 20px 23px; border-left: 1px solid var(--line); }
.overview-kpis article:first-child { border-left: 0; }
.overview-kpis span { color: var(--muted); font-size: 10px; }
.overview-kpis strong { font: 500 28px Georgia, serif; letter-spacing: -.025em; }
.overview-kpis small { color: var(--faint); font-size: 9px; }
.overview-kpis .kpi-primary strong { color: var(--accent-deep); font-size: 34px; }
.overview-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(300px,.75fr); gap: 17px; }
.data-panel { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: 0 14px 36px rgba(57,43,31,.045); }
.recent-panel { grid-column: 1; }
.pending-panel { grid-column: 2; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-heading h2, .table-title h2 { margin: 4px 0 0; font-size: 16px; }
.legend { display: flex; gap: 13px; color: var(--muted); font-size: 9px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; }
.activity-dot { background: var(--accent); }
.expense-dot { background: #423b35; }
.trend-chart { height: 220px; display: grid; grid-template-columns: repeat(7,1fr); gap: clamp(8px,2vw,20px); align-items: end; padding-top: 14px; border-bottom: 1px solid var(--line); }
.trend-column { height: 100%; min-width: 0; display: grid; grid-template-rows: 1fr auto; gap: 10px; align-items: end; text-align: center; }
.trend-bars { height: 100%; display: flex; align-items: end; justify-content: center; gap: 4px; }
.trend-bars i { width: min(18px,35%); min-height: 3px; display: block; border-radius: 4px 4px 0 0; background: var(--accent); transform-origin: bottom; animation: barGrow 520ms ease both; }
.trend-bars i.expense-bar { background: #443d37; animation-delay: 70ms; }
.trend-column small { color: var(--muted); font-size: 9px; white-space: nowrap; }
.trend-column b { display: block; margin-bottom: 3px; color: var(--faint); font-size: 8px; font-weight: 600; }
.category-breakdown { display: grid; gap: 15px; }
.category-row { display: grid; grid-template-columns: minmax(72px,.7fr) 1fr auto; gap: 10px; align-items: center; }
.category-row > span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.category-track { height: 6px; overflow: hidden; border-radius: 6px; background: var(--line-soft); }
.category-track i { height: 100%; display: block; border-radius: inherit; background: var(--accent); transform-origin: left; animation: widthGrow 520ms ease both; }
.category-row strong { min-width: 58px; font: 500 11px Georgia,serif; text-align: right; }
.empty-inline { min-height: 150px; display: grid; place-items: center; color: var(--faint); font-size: 11px; text-align: center; }
.activity-list, .pending-list { display: grid; }
.activity-item { min-height: 63px; display: grid; grid-template-columns: 9px minmax(0,1fr) auto; gap: 13px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.activity-item:first-child { border-top: 0; padding-top: 0; }
.activity-item > i { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.activity-copy { min-width: 0; display: grid; gap: 4px; }
.activity-copy strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.activity-copy small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.activity-item time { color: var(--faint); font-size: 9px; white-space: nowrap; }
.count-badge, .status-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; padding: 0 9px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-deep); font-size: 9px; font-weight: 800; white-space: nowrap; }
.pending-item { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 11px; padding: 13px 0; border-top: 1px solid var(--line-soft); }
.pending-item:first-child { padding-top: 0; border-top: 0; }
.pending-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--warning-soft); color: var(--warning); font-size: 11px; }
.pending-item div { min-width: 0; }
.pending-item strong { display: block; margin-bottom: 4px; font-size: 11px; }
.pending-item small { color: var(--muted); font-size: 9px; }

/* 工具条和表格 */
.toolbar-line { min-height: 62px; display: flex; align-items: center; gap: 9px; margin-bottom: 13px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,253,249,.62); }
.toolbar-line select { width: auto; min-width: 132px; }
.search-box { min-height: 42px; display: grid; grid-template-columns: auto 1fr; align-items: center; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(185,111,77,.1); }
.search-box span { color: var(--accent); font: 19px Georgia,serif; }
.search-box input { min-width: 0; min-height: 38px; border: 0; padding-right: 0; background: transparent; box-shadow: none; }
.wide-search { flex: 1; min-width: 220px; }
.result-count { margin-left: auto; padding: 0 8px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.month-control { min-width: 150px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.month-control > span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.table-panel { overflow: hidden; margin-top: 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 12px 35px rgba(57,43,31,.035); }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { height: 45px; padding: 0 17px; border-bottom: 1px solid var(--line); background: #faf7f2; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .04em; white-space: nowrap; }
.data-table td { min-height: 67px; padding: 13px 17px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; font-size: 11px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background 130ms ease; }
.data-table tbody tr:hover { background: var(--accent-pale); }
.user-cell { min-width: 180px; display: flex; align-items: center; gap: 10px; }
.mini-avatar { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent-deep); font: 600 10px Georgia,serif; }
.user-cell div, .stacked-cell { min-width: 0; display: grid; gap: 4px; }
.user-cell strong, .stacked-cell strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.user-cell small, .stacked-cell small { color: var(--muted); font-size: 9px; }
.user-group-table { min-width: 1120px; table-layout: fixed; }
.user-group-table th:nth-child(1) { width: 29%; }
.user-group-table th:nth-child(2) { width: 12%; }
.user-group-table th:nth-child(3) { width: 14%; }
.user-group-table th:nth-child(4) { width: 14%; }
.user-group-table th:nth-child(5) { width: 10%; }
.user-group-table th:nth-child(6) { width: 10%; }
.user-group-table th:nth-child(7) { width: 11%; }
.user-group-row { animation: riseIn 180ms both; animation-delay: calc(var(--row-index, 0) * 28ms); }
.group-members { min-width: 270px; display: grid; align-items: center; gap: 8px; }
.group-members.is-paired { grid-template-columns: minmax(0,1fr) 22px minmax(0,1fr); }
.group-members.is-single { grid-template-columns: minmax(0,1fr); }
.group-members.is-multi { grid-template-columns: minmax(0,1fr); gap: 10px; }
.group-member { min-width: 0; display: grid; grid-template-columns: 36px minmax(0,1fr); align-items: center; gap: 9px; }
.group-member > div { min-width: 0; display: grid; gap: 4px; }
.group-member small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.member-name-line { min-width: 0; display: flex; align-items: center; gap: 6px; }
.member-name-line strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.member-name-line em { flex: 0 0 auto; color: var(--accent-deep); font-size: 8px; font-style: normal; }
.pair-connector { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--accent-soft); border-radius: 50%; color: var(--accent); font: 15px Georgia,serif; transition: color 150ms ease, transform 150ms ease, background 150ms ease; }
.user-group-row:hover .pair-connector { transform: scale(1.1); background: var(--accent-soft); color: var(--accent-deep); }
.relationship-cell strong { color: var(--accent-deep); }
.group-metric em { color: var(--faint); font-size: 8px; font-style: normal; }
.group-metric small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-status-list, .member-actions { display: grid; justify-items: start; gap: 6px; }
.group-status-list .status-badge { min-width: 72px; justify-content: flex-start; gap: 4px; }
.group-status-list .status-badge b { overflow: hidden; max-width: 42px; text-overflow: ellipsis; }
.member-action { width: 100%; max-width: 92px; text-align: left; transition: border-color 130ms ease, color 130ms ease, transform 130ms ease; }
.member-action:hover { transform: translateX(2px); }
.table-number { font: 500 13px Georgia,serif; }
.status-badge.success { background: var(--success-soft); color: var(--success); }
.status-badge.disabled, .status-badge.voided { background: var(--danger-soft); color: var(--danger); }
.status-badge.pending { background: var(--warning-soft); color: var(--warning); }
.row-action { min-height: 31px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 9px; white-space: nowrap; }
.row-action:hover { border-color: var(--accent); color: var(--accent-deep); }
.row-action.danger { color: var(--danger); }
.empty-state { min-height: 210px; place-items: center; color: var(--muted); font-size: 11px; }
.empty-state:not([hidden]) { display: grid; }
.table-title { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.table-title > span { color: var(--muted); font-size: 10px; }

/* 财务 */
.finance-kpis { display: grid; grid-template-columns: repeat(4,1fr); margin: 16px 0; border-block: 1px solid var(--line); }
.finance-kpis > div { display: grid; gap: 7px; padding: 17px 20px; border-left: 1px solid var(--line); }
.finance-kpis > div:first-child { border-left: 0; }
.finance-kpis span { color: var(--muted); font-size: 9px; }
.finance-kpis strong { font: 500 25px Georgia,serif; }
.finance-kpis small { color: var(--faint); font-size: 9px; }
.finance-grid { display: grid; grid-template-columns: 1.45fr .75fr; gap: 15px; }
.finance-trend { height: 200px; display: grid; grid-template-columns: repeat(6,1fr); gap: 12px; align-items: end; padding: 10px 3px 0; border-bottom: 1px solid var(--line); }
.finance-month { height: 100%; display: grid; grid-template-rows: 1fr auto; gap: 9px; align-items: end; text-align: center; }
.finance-month-bars { height: 100%; display: flex; align-items: end; justify-content: center; gap: 5px; }
.finance-month-bars i { width: min(20px,38%); min-height: 2px; display: block; border-radius: 4px 4px 0 0; background: var(--accent); animation: barGrow 520ms ease both; transform-origin: bottom; }
.finance-month-bars i.income { background: var(--success); }
.finance-month small { color: var(--muted); font-size: 9px; }
.budget-panel { margin-top: 16px; }
.budget-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); }
.budget-item { display: grid; gap: 10px; padding: 17px 20px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.budget-item-heading { display: flex; justify-content: space-between; gap: 10px; }
.budget-item strong { font-size: 11px; }
.budget-item small { color: var(--muted); font-size: 9px; }
.budget-track { height: 7px; overflow: hidden; border-radius: 6px; background: var(--line-soft); }
.budget-track i { height: 100%; display: block; border-radius: inherit; background: var(--success); }
.budget-item.warning .budget-track i { background: var(--danger); }
.budget-item button { justify-self: start; border: 0; padding: 0; background: transparent; color: var(--accent-deep); font-size: 9px; }
.amount-expense { color: var(--danger); }
.amount-income { color: var(--success); }
.voided-row { opacity: .58; }
.voided-row .table-number { text-decoration: line-through; }

/* 动态和审计 */
.segmented-control { width: fit-content; display: flex; margin-bottom: 13px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: #eae3dc; }
.segmented-control button { min-height: 34px; padding: 0 18px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 10px; }
.segmented-control button.active { background: var(--surface); color: var(--ink); font-weight: 800; box-shadow: 0 3px 10px rgba(50,40,30,.08); }
.operation-stream { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.operation-entry { min-height: 76px; display: grid; grid-template-columns: 98px 36px minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--line-soft); }
.operation-entry:last-child { border-bottom: 0; }
.operation-entry time { color: var(--muted); font-size: 9px; line-height: 1.5; }
.operation-symbol { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-pale); color: var(--accent-deep); font-size: 10px; font-weight: 800; }
.operation-content { min-width: 0; display: grid; gap: 4px; }
.operation-content strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.operation-content small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.operation-actions { display: flex; gap: 6px; }
.stream-empty { min-height: 240px; display: grid; place-items: center; color: var(--muted); font-size: 11px; }

/* 用户抽屉与弹窗 */
.drawer-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: flex-end; background: rgba(38,31,26,.38); backdrop-filter: blur(3px); }
.detail-drawer { width: min(92vw,440px); height: 100%; position: relative; overflow-y: auto; padding: 34px; background: var(--surface); box-shadow: -30px 0 80px rgba(30,24,20,.18); animation: drawerIn 240ms ease both; }
.drawer-close { width: 34px; height: 34px; position: absolute; right: 22px; top: 22px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); font-size: 19px; }
.drawer-profile { display: flex; align-items: center; gap: 14px; padding: 20px 0 25px; border-bottom: 1px solid var(--line); }
.large-avatar { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent-deep); font: 600 17px Georgia,serif; }
.drawer-profile h2 { margin: 4px 0 2px; font: 500 25px Georgia,"Songti SC",serif; }
.drawer-profile p { margin: 0; color: var(--muted); font-size: 9px; }
.detail-drawer form { display: grid; gap: 15px; padding-top: 22px; }
.drawer-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; margin-bottom: 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.drawer-facts div { display: grid; gap: 5px; padding: 13px; background: var(--surface); }
.drawer-facts span { color: var(--muted); font-size: 9px; }
.drawer-facts strong { font-size: 11px; }
.switch-row { min-height: 58px; grid-template-columns: 1fr auto; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.switch-row > span { display: grid; gap: 4px; }
.switch-row b { color: var(--ink); font-size: 11px; }
.switch-row small { font-weight: 400; }
.switch-row input { width: 42px; min-height: 23px; appearance: none; position: relative; border: 0; border-radius: 22px; background: #cfc6bd; transition: background 160ms ease; }
.switch-row input::after { content: ""; width: 17px; height: 17px; position: absolute; top: 3px; left: 3px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: transform 160ms ease; }
.switch-row input:checked { background: var(--success); }
.switch-row input:checked::after { transform: translateX(19px); }
.admin-dialog { width: min(calc(100vw - 28px),550px); padding: 0; border: 0; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 100px rgba(30,24,20,.3); }
.admin-dialog::backdrop { background: rgba(38,31,26,.48); backdrop-filter: blur(3px); }
.admin-dialog form { display: grid; gap: 15px; padding: 27px; }
.compact-dialog { max-width: 430px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 2px; }
.dialog-heading h2 { margin: 4px 0 0; font-size: 21px; }
.dialog-heading p { margin: 7px 0 0; color: var(--muted); font-size: 10px; }
.dialog-heading > button { width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); font-size: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 5px; }

/* 菜单管理 */
.menu-account-context { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(300px,390px); align-items: center; gap: 24px; margin-bottom: 17px; padding: 18px 21px; border: 1px solid rgba(255,255,255,.08); border-radius: 16px; background: var(--sidebar); color: white; box-shadow: 0 14px 34px rgba(38,31,26,.12); }
.menu-account-context.is-missing { background: #48413b; }
.menu-account-copy { min-width: 0; }
.menu-account-context .editor-state { color: #eeb08c; }
.menu-account-copy h2 { margin: 5px 0 0; overflow: hidden; color: white; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.menu-account-copy p { margin: 7px 0 0; color: #d8cec6; font-size: 9px; line-height: 1.55; }
.menu-account-count { min-width: 112px; display: grid; justify-items: center; gap: 3px; padding: 2px 24px; border-inline: 1px solid rgba(255,255,255,.13); }
.menu-account-count span, .menu-account-count small { color: #cfc4bb; font-size: 8px; }
.menu-account-count strong { font: 500 29px Georgia,serif; }
.menu-account-selector { display: grid; gap: 7px; }
.menu-account-selector > span { color: #e9ddd5; font-size: 9px; font-weight: 800; }
.menu-account-selector select { min-height: 45px; border-color: transparent; background: #fffdfa; color: var(--ink); font-size: 11px; font-weight: 750; }
.menu-account-selector select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(190,112,76,.18); }
.menu-stats { display: grid; grid-template-columns: repeat(4,1fr); margin-bottom: 17px; border-block: 1px solid var(--line); }
.menu-stats > div { display: grid; gap: 6px; padding: 15px 21px; border-left: 1px solid var(--line); }
.menu-stats > div:first-child { border-left: 0; }
.menu-stats span { color: var(--muted); font-size: 9px; }
.menu-stats strong { font: 500 23px Georgia,serif; }
.content-workspace { display: grid; grid-template-columns: minmax(310px,370px) minmax(540px,1fr); gap: 16px; align-items: start; }
.dish-library { position: sticky; top: 18px; max-height: calc(100svh - 36px); display: grid; grid-template-rows: auto auto minmax(0,1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.library-toolbar { display: grid; gap: 8px; padding: 13px; border-bottom: 1px solid var(--line); }
.library-toolbar select { min-height: 37px; }
.library-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 15px 11px; }
.library-heading > div { display: grid; gap: 4px; }
.library-heading strong { font-size: 12px; }
.library-heading > small { color: var(--muted); font-size: 9px; }
.dish-list { display: grid; gap: 11px; padding: 0 12px 12px; overflow-y: auto; scrollbar-width: thin; }
.dish-list-empty { padding: 42px 21px; color: var(--muted); text-align: center; font-size: 10px; line-height: 1.7; }
.dish-list-item { width: 100%; min-width: 0; display: grid; padding: 0; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 13px; background: var(--surface); color: inherit; text-align: left; transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
.dish-list-item:hover { border-color: #cfa58d; box-shadow: 0 10px 24px rgba(81,54,40,.10); transform: translateY(-2px); }
.dish-list-item.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-pale); }
.dish-card-media { aspect-ratio: 16/9; position: relative; display: block; overflow: hidden; background: var(--accent-soft); }
.dish-card-media img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform 320ms ease; }
.dish-list-item:hover .dish-card-media img { transform: scale(1.035); }
.dish-card-copy { min-width: 0; display: flex; align-items: end; justify-content: space-between; gap: 12px; padding: 12px 13px 13px; }
.dish-card-title, .dish-card-meta { min-width: 0; display: grid; gap: 4px; }
.dish-card-title strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.dish-card-title small, .dish-card-meta small { color: var(--muted); font-size: 8px; line-height: 1.45; }
.dish-card-meta { flex: 0 0 auto; justify-items: end; }
.dish-card-meta b { color: var(--accent-deep); font: 500 13px Georgia,serif; }
.status-dot { min-width: 39px; min-height: 22px; position: absolute; top: 9px; right: 9px; display: grid; place-items: center; padding: 0 8px; border-radius: 20px; background: rgba(39,34,30,.76); color: white; font-size: 8px; backdrop-filter: blur(7px); }
.status-dot.published { background: var(--success-soft); color: var(--success); }
.recipe-editor { min-width: 0; padding: clamp(20px,3vw,34px); border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
.editor-heading { position: sticky; top: 0; z-index: 5; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin: calc(clamp(20px,3vw,34px) * -1) calc(clamp(20px,3vw,34px) * -1) 0; padding: 20px clamp(20px,3vw,34px); border-bottom: 1px solid var(--line); border-radius: 17px 17px 0 0; background: rgba(255,253,249,.94); backdrop-filter: blur(14px); }
.editor-state { display: block; color: var(--accent); font-size: 9px; font-weight: 850; letter-spacing: .09em; }
.editor-heading h2 { margin: 4px 0 0; font-size: 20px; }
.editor-owner-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-top: 7px; color: var(--muted); font-size: 8px; font-style: normal; }
.editor-owner-line strong { color: var(--accent-deep); font-size: 9px; }
.editor-owner-line em { color: var(--muted); font-style: normal; }
.dirty-note { display: block; margin-top: 4px; color: var(--warning); font-size: 8px; }
.editor-actions { display: flex; align-items: center; gap: 7px; }
.image-and-basics { display: grid; grid-template-columns: minmax(230px,.85fr) minmax(290px,1.15fr); gap: 23px; padding: 27px 0; }
.image-uploader { min-height: 260px; position: relative; overflow: hidden; border-radius: 16px; background: var(--accent-soft); cursor: pointer; }
.image-uploader img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; transition: transform 400ms ease; }
.image-uploader:hover img { transform: scale(1.025); }
.recipe-editor.is-context-missing .image-uploader { pointer-events: none; filter: saturate(.45); opacity: .62; }
.recipe-editor input:disabled, .recipe-editor select:disabled, .recipe-editor textarea:disabled { background: #f1ece6; color: #9a9088; cursor: not-allowed; }
.image-overlay { position: absolute; inset: auto 10px 10px; display: grid; gap: 3px; padding: 11px 13px; border-radius: 11px; background: rgba(37,32,28,.88); backdrop-filter: blur(10px); }
.image-overlay b { color: white; font-size: 10px; }
.image-overlay small { color: #d8cec6; font-size: 8px; }
.basic-fields { display: grid; align-content: start; gap: 14px; }
.basic-fields label, .metric-fields label, .large-field { display: grid; gap: 7px; }
.basic-fields label > span, .metric-fields label > span { color: var(--muted); font-size: 10px; font-weight: 700; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.ai-studio { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 16px; border-radius: 14px; background: var(--accent-pale); }
.ai-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--accent); color: white; font: 700 11px Georgia,serif; }
.ai-studio strong { font-size: 11px; }
.ai-studio p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.ai-action { border: 1px solid var(--line); background: var(--surface); color: var(--accent-deep); }
.editor-section { padding: 25px 0 2px; }
.editor-section + .editor-section { margin-top: 8px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.section-heading > div { display: flex; align-items: center; gap: 9px; }
.section-heading span { color: var(--accent); font: 9px Georgia,serif; }
.section-heading h3 { margin: 0; font-size: 14px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 8px; }
.metric-fields { display: grid; grid-template-columns: repeat(3,1fr); gap: 11px; }
.large-field small { color: var(--muted); font-size: 8px; }
.is-generating .ai-mark { animation: pulse 850ms ease-in-out infinite; }

/* 分类管理 */
.category-management-workspace { width: 100%; display: grid; grid-template-columns: minmax(260px,330px) minmax(520px,1fr); gap: 16px; align-items: start; }
.category-create-panel, .category-list-panel { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.category-create-panel { position: sticky; top: 20px; display: grid; gap: 23px; padding: 23px; }
.category-create-panel h2, .category-list-heading h2 { margin: 4px 0 0; font-size: 18px; }
.category-create-panel p { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.category-create-row { display: grid; gap: 8px; }
.category-list-panel { overflow: hidden; }
.category-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.category-list-heading > strong { color: var(--muted); font-size: 10px; }
.category-list-heading > strong b { color: var(--accent-deep); font: 500 23px Georgia,serif; }
.category-admin-list { display: grid; }
.category-admin-row { min-height: 96px; display: grid; grid-template-columns: 35px 118px minmax(0,1fr) auto; gap: 13px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line-soft); }
.category-admin-row:last-child { border-bottom: 0; }
.category-index { color: var(--accent); font: 10px Georgia,serif; }
.category-cover-preview { width: 118px; height: 76px; position: relative; display: block; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--accent-soft); }
.category-cover-images { position: absolute; inset: 0; display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; background: var(--surface); }
.category-cover-images img { width: 100%; height: 100%; min-width: 0; min-height: 0; display: block; object-fit: cover; transition: transform 260ms ease; }
.category-cover-images img:first-child { grid-row: 1/-1; }
.category-cover-images[data-image-count="1"] img:first-child { grid-column: 1/-1; }
.category-cover-images[data-image-count="2"] img:nth-child(2) { grid-row: 1/-1; }
.category-cover-preview:hover .category-cover-images img { transform: scale(1.045); }
.category-cover-caption { position: absolute; right: 6px; bottom: 6px; padding: 4px 6px; border-radius: 6px; background: rgba(39,34,30,.78); color: white; font-size: 7px; font-weight: 800; backdrop-filter: blur(6px); }
.category-cover-preview.empty .category-cover-images img { opacity: .58; }
.category-edit-field { min-width: 0; display: grid; gap: 4px; }
.category-edit-field input { min-height: 37px; border-color: transparent; background: var(--accent-pale); font-size: 12px; font-weight: 750; }
.category-edit-field small { color: var(--muted); font-size: 9px; }
.category-row-actions { display: flex; gap: 6px; }
.category-row-actions button { min-height: 31px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 9px; }
.category-row-actions .category-open-action { background: var(--sidebar); color: white; font-weight: 800; }
.category-row-actions .category-save-action { background: var(--accent-pale); color: var(--accent-deep); font-weight: 800; }
.category-row-actions .category-delete-action { color: var(--danger); }
.category-empty { min-height: 210px; display: grid; place-items: center; color: var(--muted); font-size: 10px; }

/* 反馈 */
.admin-toast { max-width: min(360px,calc(100vw - 30px)); position: fixed; right: 25px; bottom: 25px; z-index: 80; padding: 12px 15px; border-radius: 11px; background: var(--sidebar); color: white; font-size: 10px; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity 160ms ease, transform 160ms ease; box-shadow: 0 16px 45px rgba(30,24,20,.25); }
.admin-toast.show { opacity: 1; transform: translateY(0); }
.admin-toast.error { background: var(--danger); }
.global-loading { position: fixed; inset: 0; z-index: 90; display: grid; place-content: center; justify-items: center; gap: 12px; background: rgba(244,239,231,.68); backdrop-filter: blur(5px); color: var(--muted); font-size: 10px; }
.global-loading span { width: 30px; height: 30px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 700ms linear infinite; }

@keyframes authEnter { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes drawerIn { from { transform: translateX(35px); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes barGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes widthGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pulse { 50% { transform: scale(.9); opacity: .65; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1120px) {
  .admin-shell { grid-template-columns: 218px minmax(0,1fr); }
  .sidebar { padding-inline: 13px; }
  .overview-grid, .finance-grid { grid-template-columns: 1fr; }
  .recent-panel, .pending-panel { grid-column: 1; }
  .content-workspace { grid-template-columns: 290px minmax(0,1fr); }
  .image-and-basics { grid-template-columns: 1fr; }
  .image-uploader { min-height: 300px; }
}

@media (max-width: 860px) {
  .admin-shell { display: block; }
  .sidebar { width: 270px; height: 100svh; position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-101%); transition: transform 200ms ease; box-shadow: 25px 0 60px rgba(30,24,20,.24); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { padding: 20px 18px 60px; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
  .mobile-bar .auth-brand { color: var(--ink); }
  .mobile-bar .brand-mark { width: 32px; height: 32px; font-size: 19px; }
  .mobile-bar button { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: 10px; }
  .overview-kpis, .finance-kpis { grid-template-columns: repeat(2,1fr); }
  .overview-kpis article:nth-child(3), .finance-kpis > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .overview-kpis article:nth-child(4), .finance-kpis > div:nth-child(4) { border-top: 1px solid var(--line); }
  .menu-account-context { grid-template-columns: minmax(0,1fr) auto; }
  .menu-account-count { border-right: 0; }
  .menu-account-selector { grid-column: 1/-1; }
  .content-workspace, .category-management-workspace { grid-template-columns: 1fr; }
  .dish-library, .category-create-panel { position: static; max-height: 520px; }
  .dish-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .operation-entry { grid-template-columns: 72px 32px minmax(0,1fr); }
  .operation-actions { grid-column: 3; }
}

@media (max-width: 620px) {
  .auth-panel { padding: 28px 22px; }
  .admin-main { padding-inline: 13px; }
  .admin-top { align-items: stretch; flex-direction: column; }
  .admin-top h1 { font-size: 34px; }
  .admin-top > .primary-action, .admin-top > .secondary-action { width: 100%; }
  .menu-account-context { grid-template-columns: 1fr; gap: 13px; padding: 16px; }
  .menu-account-copy h2 { white-space: normal; }
  .menu-account-count { min-width: 0; justify-items: start; padding: 11px 0; border: 0; border-block: 1px solid rgba(255,255,255,.13); }
  .menu-account-selector { grid-column: 1; }
  .overview-grid { gap: 12px; }
  .data-panel { padding: 18px 15px; }
  .overview-kpis, .finance-kpis { grid-template-columns: 1fr 1fr; }
  .overview-kpis article, .finance-kpis > div { padding: 15px 13px; }
  .overview-kpis strong { font-size: 23px; }
  .overview-kpis .kpi-primary strong { font-size: 27px; }
  .toolbar-line { align-items: stretch; flex-direction: column; }
  .toolbar-line select, .wide-search, .month-control { width: 100%; min-width: 0; }
  .result-count { margin: 2px 0; }
  .trend-chart { height: 180px; gap: 6px; }
  .trend-column small { font-size: 8px; }
  .category-row { grid-template-columns: 68px 1fr auto; }
  .table-panel { border-radius: 13px; }
  .data-table th, .data-table td { padding-inline: 12px; }
  .user-group-table { min-width: 0; table-layout: auto; }
  .user-group-table thead { display: none; }
  .user-group-table, .user-group-table tbody { display: block; }
  .user-group-table .user-group-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px 16px; padding: 16px; border-bottom: 1px solid var(--line-soft); }
  .user-group-table .user-group-row:last-child { border-bottom: 0; }
  .user-group-table .user-group-row:hover { background: var(--surface); }
  .user-group-table td { min-height: 0; display: grid; align-content: start; gap: 7px; padding: 0; border: 0; }
  .user-group-table td::before { content: attr(data-label); color: var(--faint); font-size: 8px; font-weight: 800; letter-spacing: .05em; }
  .user-group-table td:first-child, .user-group-table td:last-child { grid-column: 1/-1; }
  .group-members { min-width: 0; padding-bottom: 13px; border-bottom: 1px solid var(--line-soft); }
  .group-members.is-paired { grid-template-columns: minmax(0,1fr) 20px minmax(0,1fr); }
  .group-member { grid-template-columns: 32px minmax(0,1fr); gap: 7px; }
  .group-member .mini-avatar { width: 32px; height: 32px; }
  .member-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .member-action { max-width: none; text-align: center; }
  .editor-heading { position: static; flex-direction: column; margin-top: -20px; }
  .editor-owner-line { align-items: flex-start; flex-direction: column; }
  .editor-actions { width: 100%; display: grid; grid-template-columns: auto 1fr 1fr; }
  .recipe-editor { padding: 20px 15px; }
  .image-uploader { min-height: 230px; }
  .field-pair, .metric-fields { grid-template-columns: 1fr; }
  .ai-studio { grid-template-columns: auto 1fr; }
  .ai-action { grid-column: 1/-1; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .dish-list { grid-template-columns: 1fr; }
  .category-admin-row { grid-template-columns: 25px 90px minmax(0,1fr); gap: 9px; padding-inline: 11px; }
  .category-cover-preview { width: 90px; height: 66px; }
  .category-row-actions { grid-column: 2/-1; flex-wrap: wrap; }
  .detail-drawer { padding: 25px 20px; }
  .operation-entry { grid-template-columns: 1fr auto; gap: 8px 12px; padding: 14px; }
  .operation-entry time { grid-column: 1; }
  .operation-symbol { grid-column: 2; grid-row: 1; }
  .operation-content { grid-column: 1/-1; }
  .operation-actions { grid-column: 1/-1; }
  .finance-trend { gap: 6px; }
}

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