/* 餐饮菜品成本卡系统 —— 样式 */
:root {
  --primary: #0f766e;
  --primary-600: #0d9488;
  --primary-700: #0f5f59;
  --primary-50: #f0fdfa;
  --accent: #f59e0b;
  --accent-50: #fffbeb;
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #1f2937;
  --text-2: #4b5563;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --danger: #dc2626;
  --danger-50: #fef2f2;
  --ok: #16a34a;
  --ok-50: #f0fdf4;
  --warn: #d97706;
  --warn-50: #fffbeb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --sidebar-w: 230px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }

/* ---------------- 布局 ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, #0b3b32 0%, #07231d 100%);
  color: #cfe9e3;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}
.brand { padding: 20px 18px 16px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.brand-logo {
  width: 30px; height: 30px; flex: 0 0 30px; object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .18));
}
.brand-title { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: .5px; }
.brand-sub { font-size: 10.5px; color: #7fb8ad; margin-top: 2px; letter-spacing: 1px; }
.nav { flex: 1; overflow-y: auto; padding: 8px 10px 18px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 4px; }
.nav-group {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; border: none; background: none; cursor: pointer;
  font-size: 10.5px; color: #5f8f85; letter-spacing: 1.3px;
  padding: 15px 10px 6px; text-align: left; user-select: none;
}
.nav-group:hover { color: #a7d8cd; }
.nav-chevron { font-size: 10px; opacity: .55; transition: transform .18s; }
.nav-group.collapsed .nav-chevron { transform: rotate(180deg); }
.nav-items { overflow: hidden; }
.nav-items.collapsed { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 1px 0;
  border-radius: 9px; cursor: pointer;
  color: #b9d9d2; font-size: 13px; line-height: 1.25;
  border: none; background: none; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: rgba(52, 211, 153, .16); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #34d399; }
.nav-icon { width: 19px; text-align: center; opacity: .9; font-size: 15px; flex: 0 0 19px; }
.sidebar-foot { padding: 11px 16px 14px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 10.5px; color: #6f9d93; line-height: 1.7; }
.sidebar-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #34d399; margin-right: 5px; }
.nav-legend { display: flex; gap: 12px; margin: 4px 0 5px; font-size: 10px; color: #7fb8ad; }
.nav-legend .legend-write { color: #6ee7b7; }
.nav-legend .legend-read { color: #fbbf24; }
.nav-item .perm-mark { margin-left: auto; font-size: 9px; line-height: 1; opacity: .8; flex: 0 0 auto; }
.nav-item.nav-readonly { color: #9ab7b1; }
.nav-item.nav-readonly .perm-mark { color: #fbbf24; }
.nav-item.nav-editable .perm-mark { color: #34d399; }
.nav-item.nav-readonly.active { color: #e2e8f0; }
.nav-subitem { padding-left: 32px !important; font-size: 12px; opacity: .92; }
.nav-subitem .nav-icon { font-size: 12px; }
.nav-parent { font-weight: 600; }
.site-icp-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  padding: 6px 12px; text-align: center;
  background: rgba(255,255,255,.96); border-top: 1px solid #e2e8f0;
  font-size: 11px; color: #64748b; line-height: 1.6;
}
.site-icp-footer a { color: #475569; text-decoration: none; }
.site-icp-footer a:hover { color: #0f766e; text-decoration: underline; }
@media (max-width: 640px) { .site-icp-footer { font-size: 10px; padding: 5px 8px; } }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-heading { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
#page-title { font-size: 17px; font-weight: 700; margin: 0; }
#page-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.conn { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.conn.on .conn-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .15); }
.conn.on { color: #15803d; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 20px; cursor: pointer; border: 1px solid var(--line); background: #fafafa; }
.user-chip:hover { border-color: var(--line-2); background: #f3f4f6; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #0d9488, #0f766e); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; }
.user-meta { line-height: 1.25; }
.user-name { font-size: 12.5px; font-weight: 600; }
.user-role { font-size: 10.5px; color: var(--muted); }
.user-menu { position: absolute; right: 26px; top: 56px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 160px; padding: 6px; z-index: 50; }
.user-menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: none; background: none; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.user-menu button:hover { background: #f3f4f6; color: var(--text); }
.page { padding: 22px 26px 48px; flex: 1; }
.readonly-bar { margin: 10px 26px 0; padding: 10px 14px; border-radius: 8px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-size: 12.5px; line-height: 1.7; }
.readonly-page .btn-primary, .readonly-page .link-btn, .readonly-page .btn-danger { opacity: .42; }
.search-select-mask { position: fixed; inset: 0; z-index: 3000; background: rgba(15, 23, 42, .35); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.search-select-box { width: min(520px, 92vw); max-height: 70vh; background: #fff; border-radius: 12px; box-shadow: 0 20px 50px rgba(15, 23, 42, .28); display: flex; flex-direction: column; overflow: hidden; }
.search-select-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
.search-select-close { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 15px; }
.search-select-input { margin: 12px 16px 6px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px; outline: none; font-size: 14px; }
.search-select-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.search-select-list { overflow-y: auto; padding: 4px 8px 12px; }
.search-select-item { display: block; width: 100%; text-align: left; border: none; background: none; padding: 9px 10px; border-radius: 7px; font-size: 13px; color: var(--text); cursor: pointer; }
.search-select-item:hover { background: var(--primary-50); color: var(--primary-700); }
.search-select-item.active { background: var(--primary-50); color: var(--primary-700); font-weight: 600; }
.search-select-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 12.5px; }
@media (max-width: 900px) { .readonly-bar { margin: 10px 14px 0; } }

/* ---------------- 通用组件 ---------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap; }
.card-title { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-title .hint { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.card-body { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: Consolas, "Courier New", monospace; }
.right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-0 { margin-bottom: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: 8px; border: 1px solid var(--line-2);
  background: #fff; color: var(--text-2); cursor: pointer; font-size: 13px;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--primary-600); color: var(--primary-700); background: var(--primary-50); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--primary-700); border-color: var(--primary-700); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-accent:hover { background: #d97706; border-color: #d97706; color: #fff; }
.btn-danger { color: var(--danger); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: var(--danger-50); border-color: var(--danger); color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: #f3f4f6; border-color: transparent; color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px 16px 14px; border-top: 1px solid var(--line); }
.topbar-search input { width: 280px; max-width: 28vw; height: 34px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 12px; font-size: 12.5px; background: #fff; }
.topbar-search input:focus { outline: none; border-color: var(--primary-600); box-shadow: 0 0 0 3px rgba(15,118,110,.08); }
@media (max-width: 900px) { .topbar-search { display: none; } }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 15px; padding: 4px 7px; border-radius: 6px; line-height: 1; }
.icon-btn:hover { background: #f3f4f6; color: var(--text); }
.link-btn { border: none; background: none; color: var(--primary); cursor: pointer; padding: 2px 4px; font-size: 12.5px; border-radius: 4px; }
.link-btn:hover { background: var(--primary-50); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: var(--danger-50); }

input[type=text], input[type=number], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 7px;
  outline: none; background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary-600); box-shadow: 0 0 0 3px rgba(13, 148, 136, .12); }
input[readonly], input:disabled { background: #f9fafb; color: var(--muted); }
select { cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.field .req { color: var(--danger); }
.field-help { font-size: 11px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { position: relative; width: 230px; }
.toolbar .search input { padding-left: 30px; }
.toolbar .search::before { content: "🔍"; position: absolute; left: 9px; top: 50%; transform: translateY(-50%); font-size: 12px; opacity: .6; }
.toolbar select { width: auto; min-width: 110px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow: auto; max-width: 100%; border-radius: 0 0 var(--radius) var(--radius); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data thead th {
  position: sticky; top: 0; z-index: 2; background: #f9fafb; color: var(--text-2);
  font-weight: 600; font-size: 12px; text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data tbody td { padding: 10px 12px; border-bottom: 1px solid #f1f3f4; vertical-align: middle; }
table.data tbody tr:hover { background: #fafcfb; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.ops { white-space: nowrap; text-align: right; }
table.data .name { font-weight: 600; color: var(--text); }
table.data .sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
table.data.compact th, table.data.compact td { padding: 7px 9px; font-size: 12.5px; }
.empty { text-align: center; color: var(--muted); padding: 42px 10px !important; font-size: 13px; }
.empty .big { font-size: 30px; display: block; margin-bottom: 8px; opacity: .5; }

.badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--ok-50); color: #15803d; }
.badge-amber { background: var(--warn-50); color: #b45309; }
.badge-red { background: var(--danger-50); color: #b91c1c; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-teal { background: var(--primary-50); color: var(--primary-700); }
.dot-sep { color: #d1d5db; margin: 0 5px; }

/* ---------------- 统计卡 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; right: -18px; top: -22px; width: 74px; height: 74px; border-radius: 50%; background: var(--primary-50); }
.stat .label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 27px; font-weight: 700; margin-top: 7px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat .foot { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 27px; font-weight: 700; margin-top: 7px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat.teal .value { color: var(--primary-700); }
.stat.warn .value { color: var(--warn); }
.stat.red .value { color: var(--danger); }
.stat.amber .value { color: #b45309; }

/* ---------------- 进度条 / 条形 ---------------- */
.bar-row { display: grid; grid-template-columns: 120px 1fr 58px; align-items: center; gap: 10px; padding: 5px 0; font-size: 12.5px; }
.bar-row .bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.bar-track { height: 8px; background: #eef2f1; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #34d399, #0d9488); }
.bar-fill.warn { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.bar-fill.red { background: linear-gradient(90deg, #f87171, #dc2626); }
.bar-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.stack-bar { display: flex; height: 18px; border-radius: 6px; overflow: hidden; background: #f3f4f6; }
.stack-bar span { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; }

/* ---------------- 弹窗 ---------------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); width: 620px; max-width: 100%; animation: slide .18s ease; display: flex; flex-direction: column; max-height: calc(100vh - 80px); }
.modal.wide { width: 1080px; }
.modal.xwide { width: 1240px; }
@keyframes slide { from { transform: translateY(-10px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-head .sub { font-size: 11.5px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: #fcfcfd; border-radius: 0 0 12px 12px; flex: 0 0 auto; }
.confirm-text { font-size: 14px; line-height: 1.7; margin: 4px 0 2px; }
.confirm-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------------- 提示 ---------------- */
#toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow-lg); animation: toastIn .2s ease; max-width: 520px; display: flex; align-items: center; gap: 8px; }
.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }
.toast.info { background: #1e3a5f; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.loading { padding: 60px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.loading::before { content: "⏳"; display: block; font-size: 24px; margin-bottom: 10px; opacity: .7; }
.error-block { padding: 30px; text-align: center; color: var(--danger); background: var(--danger-50); border: 1px solid #fecaca; border-radius: var(--radius); }

/* ---------------- 登录 ---------------- */
.login-view { min-height: 100vh; display: grid; grid-template-columns: 1.18fr .82fr; background: #faf7f2; }
.login-visual {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center;
  padding: 64px 72px; color: #fff;
  background:
    radial-gradient(900px 600px at 82% -10%, rgba(201, 164, 106, .20), transparent 62%),
    radial-gradient(700px 520px at -8% 108%, rgba(201, 164, 106, .12), transparent 58%),
    linear-gradient(150deg, #380b0b 0%, #5f1212 52%, #861b1b 100%);
}
.login-visual::before { content: ""; position: absolute; width: 560px; height: 560px; border: 1px solid rgba(201, 164, 106, .18); border-radius: 50%; right: -190px; top: -210px; }
.login-visual::after { content: ""; position: absolute; width: 380px; height: 380px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 50%; left: -150px; bottom: -170px; }
.login-visual-inner { position: relative; z-index: 1; max-width: 540px; }
.login-brand-logo { height: 78px; width: auto; display: block; margin-bottom: 30px; filter: drop-shadow(0 8px 22px rgba(0, 0, 0, .2)); }
.login-company { font-size: 30px; font-weight: 600; letter-spacing: 1.5px; line-height: 1.45; }
.login-tagline { font-size: 14px; color: rgba(255, 255, 255, .66); margin-top: 10px; letter-spacing: 1px; }
.login-stats { display: flex; gap: 42px; margin-top: 42px; padding-top: 26px; border-top: 1px solid rgba(255, 255, 255, .14); }
.login-stats b { display: block; font-size: 25px; color: #e7d3ab; font-weight: 600; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.login-stats span { display: block; margin-top: 4px; font-size: 12px; color: rgba(255, 255, 255, .55); letter-spacing: .4px; }
.login-cert { margin-top: 26px; font-size: 11.5px; letter-spacing: .8px; color: rgba(255, 255, 255, .42); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px; background: #faf7f2; }
.login-box { width: 100%; max-width: 352px; }
.login-panel-logo { height: 40px; width: auto; display: block; margin-bottom: 26px; }
.login-box h2 { font-size: 26px; font-weight: 600; margin: 0 0 8px; letter-spacing: 1px; color: #241a16; }
.login-box .sub { color: #8a7f74; font-size: 12.5px; margin-bottom: 28px; letter-spacing: .5px; }
.login-box .field { margin-bottom: 16px; }
.login-box label { display: block; font-size: 12px; color: #6b5f54; margin-bottom: 7px; letter-spacing: .5px; }
.login-box input { width: 100%; height: 44px; padding: 0 14px; border: 1px solid #e3dacd; border-radius: 8px; background: #fff; color: #241a16; outline: none; transition: border-color .15s, box-shadow .15s; }
.login-box input:focus { border-color: #8a1c1c; box-shadow: 0 0 0 3px rgba(138, 28, 28, .08); }
.login-submit { width: 100%; height: 46px; margin-top: 8px; border: none; border-radius: 8px; background: #8a1c1c; color: #fff; font-size: 14px; letter-spacing: 4px; cursor: pointer; transition: background .15s; }
.login-submit:hover { background: #741616; }
.login-submit:disabled { opacity: .65; cursor: not-allowed; }
.login-error { background: #fdf2f2; color: #9f1d1d; border: 1px solid #f3d5d5; border-radius: 8px; padding: 10px 12px; font-size: 12.5px; margin-bottom: 16px; }
.login-tip { margin-top: 18px; text-align: center; font-size: 11.5px; color: #9a8f84; letter-spacing: .3px; }
.login-foot { margin-top: 34px; text-align: center; font-size: 10.5px; color: #b3a89c; letter-spacing: .5px; }
@media (max-width: 900px) {
  .login-view { grid-template-columns: 1fr; }
  .login-visual { padding: 40px 26px 34px; align-items: flex-start; }
  .login-visual::before { width: 360px; height: 360px; right: -170px; top: -190px; }
  .login-brand-logo { height: 52px; margin-bottom: 16px; }
  .login-company { font-size: 20px; letter-spacing: 1px; }
  .login-tagline { font-size: 12px; margin-top: 7px; }
  .login-stats { gap: 26px; margin-top: 22px; padding-top: 18px; }
  .login-stats b { font-size: 18px; }
  .login-stats span { font-size: 10.5px; }
  .login-cert { display: none; }
  .login-panel { padding: 30px 24px 44px; align-items: flex-start; }
  .login-panel-logo { display: none; }
  .login-box { max-width: 100%; }
  .login-box h2 { font-size: 22px; }
  .login-box .sub { margin-bottom: 22px; }
  .login-foot { margin-top: 24px; }
}

/* ---------------- 成本卡 ---------------- */
.cost-card { font-size: 13px; }
.cost-card-head { text-align: center; padding-bottom: 14px; border-bottom: 2px solid var(--primary); margin-bottom: 14px; }
.cost-card-head h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: 2px; color: var(--primary-700); }
.cost-card-head .meta { font-size: 12px; color: var(--muted); }
.cost-card table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.cost-card th, .cost-card td { border: 1px solid var(--line-2); padding: 7px 9px; font-size: 12.5px; }
.cost-card th { background: #f0fdfa; color: var(--primary-700); font-weight: 600; }
.cost-card td.num, .cost-card th.num { text-align: right; }
.cost-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
.summary-line { display: flex; justify-content: space-between; padding: 7px 10px; border-bottom: 1px dashed var(--line); font-size: 13px; }
.summary-line b { font-variant-numeric: tabular-nums; }
.summary-line.total { background: var(--primary-50); border-radius: 6px; border-bottom: none; font-weight: 700; color: var(--primary-700); }
.sign-row { display: flex; gap: 40px; margin-top: 22px; font-size: 12px; color: var(--muted); }

/* ---------------- 导入 ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { padding: 9px 16px; cursor: pointer; border: none; background: none; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-700); border-bottom-color: var(--primary); font-weight: 600; }
.dropzone { border: 2px dashed var(--line-2); border-radius: 10px; padding: 30px; text-align: center; color: var(--muted); cursor: pointer; transition: all .15s; background: #fcfcfd; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary-600); background: var(--primary-50); color: var(--primary-700); }
.dropzone .big { font-size: 34px; display: block; margin-bottom: 8px; }
.dropzone b { color: var(--primary-700); }
.preview-ok { color: var(--ok); font-weight: 600; }
.preview-warn { background: var(--warn-50); border: 1px solid #fde68a; border-radius: 8px; padding: 12px 14px; font-size: 12.5px; color: #92400e; max-height: 180px; overflow-y: auto; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { width: 200px; flex-basis: 200px; }
  .main { width: 100%; }
  .page { padding: 16px 14px 40px; }
  .topbar { padding: 0 14px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { flex: 1; width: 100%; }
  .cookie { }
}
.menu-toggle {
  display: none;
  width: 36px; height: 36px; flex: 0 0 36px;
  align-items: center; justify-content: center;
  border: 1px solid var(--line-2); border-radius: 9px;
  background: #fff; color: var(--text); font-size: 19px; line-height: 1;
  cursor: pointer; padding: 0;
}
.menu-toggle:hover { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-600); }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 29; }
.sidebar-backdrop.show { display: block; }
body.nav-open { overflow: hidden; }
@media (max-width: 720px) {
  .sidebar { position: fixed; left: -280px; width: 260px; flex-basis: 260px; transition: left .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-flex; }
}
@media (max-width: 1100px) {
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: #94a3b8 #e2e8f0; }
  .table-wrap::-webkit-scrollbar { height: 10px; }
  .table-wrap::-webkit-scrollbar-track { background: #eef2f7; border-radius: 8px; }
  .table-wrap::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 8px; }
  .table-wrap table.data { min-width: 900px; }
}
@media (max-width: 640px) {
  .topbar { height: 54px; }
  .page-title { font-size: 19px; }
  .page-subtitle { font-size: 12px; }
  .toolbar { gap: 8px; }
  .toolbar .search { width: 100%; min-width: 0; }
  .toolbar .search input { width: 100%; }
  .toolbar select, .toolbar input[type=month], .toolbar input[type=date] { max-width: 100%; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 20px; }
  .card-head { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .card-body { padding: 12px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table.data { min-width: 760px; }
  .modal { width: 96vw !important; max-width: 96vw !important; }
  .modal-body { padding: 12px; max-height: 72vh; }
  .modal-foot { flex-wrap: wrap; gap: 6px; }
  .modal-foot .btn { flex: 1; min-width: 90px; }
  .pager { flex-wrap: wrap; gap: 8px; }
  .summary-line { font-size: 12px; }
  .tabs { overflow-x: auto; }
}


/* ---------------- 仓库目录 ---------------- */
.wh-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.wh-tree-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow: auto; }
.wh-tree-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); padding: 4px 6px 9px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.wh-tree-row { display: flex; align-items: center; gap: 2px; min-height: 30px; border-radius: 7px; }
.wh-tree-row:hover { background: var(--primary-50); }
.wh-tree-row.active { background: #ccfbf1; }
.wh-tree-toggle { width: 20px; height: 26px; border: 0; background: none; color: #64748b; cursor: pointer; font-size: 10px; flex: 0 0 20px; padding: 0; }
.wh-tree-toggle.leaf { visibility: hidden; }
.wh-tree-label { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 5px 3px; cursor: pointer; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wh-tree-label b { font-weight: 600; }
.wh-tree-count { font-size: 10px; color: var(--muted); margin-left: 3px; }
.wh-tree-row.active .wh-tree-label { color: var(--primary-700); font-weight: 600; }
.wh-tree-lock { color: #f59e0b; font-size: 9px; margin-left: 3px; }
.wh-main { min-width: 0; }
.wh-folder-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.wh-folder-chip { border: 1px solid var(--line-2); background: #fff; color: var(--text-2); border-radius: 999px; padding: 6px 11px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.wh-folder-chip span { color: var(--muted); font-size: 11px; margin-left: 3px; }
.wh-folder-chip:hover { border-color: var(--primary-600); color: var(--primary-700); }
.wh-folder-chip.active { background: var(--primary-50); border-color: var(--primary-600); color: var(--primary-700); font-weight: 600; }
@media (max-width: 1024px) {
  .wh-layout { grid-template-columns: 210px minmax(0, 1fr); gap: 10px; }
}
@media (max-width: 720px) {
  .wh-layout { display: block; }
  .wh-tree-panel { position: static; max-height: 210px; margin-bottom: 10px; }
}

/* ---------------- 数字厂区 ---------------- */
.factory-map-wrap { position: relative; overflow: hidden; max-height: 72vh; background: #f8fafc; border-top: 1px solid var(--line); cursor: grab; touch-action: none; }
.factory-map-wrap.dragging { cursor: grabbing; }
.factory-canvas { position: relative; width: 100%; min-width: 0; transform-origin: top left; }
.factory-canvas img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.factory-marker {
  position: absolute; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.88);
  border-radius: 999px; padding: 2px 6px 2px 3px; cursor: pointer;
  box-shadow: 0 2px 7px rgba(15,23,42,.18); white-space: nowrap;
  font-size: 10.5px; color: #0f172a; line-height: 1.25;
}
.factory-marker:hover { z-index: 3; background: #fff; box-shadow: 0 4px 12px rgba(15,23,42,.28); }
.factory-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.factory-label { max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) {
  .factory-marker { font-size: 9.5px; }
  .factory-label { max-width: 90px; }
}

/* ---------------- 打印 ---------------- */
@media print {
  body { background: #fff; }
  #app, #login-view, #toast-root { display: none !important; }
  .sidebar, .topbar, .modal-head, .modal-foot, #toast-root, .no-print { display: none !important; }
  .modal-mask { position: static; background: none; padding: 0; overflow: visible; }
  .modal { box-shadow: none; width: 100%; max-height: none; }
  .modal-body { overflow: visible; padding: 0; }
  .print-area { display: block; }
  .page { padding: 0; }
}

/* ---------------- 主界面 / 首页 ---------------- */
.home-hero {
  background: linear-gradient(115deg, #0f766e 0%, #115e59 55%, #134e4a 100%);
  border-radius: 16px; padding: 28px 30px; color: #fff;
  display: flex; gap: 26px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  box-shadow: 0 10px 28px rgba(15, 118, 110, .18);
}
.home-hero-main { min-width: 300px; flex: 1; }
.home-kicker { font-size: 11px; letter-spacing: 2px; color: #99f6e4; margin-bottom: 8px; }
.home-hero h2 { margin: 0 0 6px; font-size: 25px; font-weight: 700; letter-spacing: .5px; }
.home-hero p { margin: 0; color: #ccfbf1; font-size: 13px; }
.home-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.home-actions .btn-primary { background: #fff; color: #0f766e; border-color: #fff; }
.home-actions .btn-primary:hover { background: #f0fdfa; }
.home-actions .btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.28); color: #fff; }
.home-hero-stats { display: grid; grid-template-columns: repeat(2, minmax(112px, 1fr)); gap: 10px; }
.home-hero-stats > div { background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.12); border-radius: 11px; padding: 11px 14px; min-width: 112px; }
.home-hero-stats b { display: block; font-size: 23px; line-height: 1.2; }
.home-hero-stats span { display: block; font-size: 11px; color: #99f6e4; margin-top: 3px; }
.home-section { margin-top: 22px; }
.home-section-title { font-size: 13px; font-weight: 700; color: #0f172a; margin: 0 0 10px 2px; letter-spacing: .5px; }
.home-section-title::before { content: ''; display: inline-block; width: 3px; height: 13px; background: #0f766e; border-radius: 3px; margin-right: 8px; vertical-align: -2px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 10px; }
.home-card {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 13px 14px; cursor: pointer; transition: transform .14s, box-shadow .14s, border-color .14s;
  color: #0f172a; min-height: 64px;
}
.home-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 23, 42, .08); border-color: #99f6e4; }
.home-card-icon { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; background: #f0fdfa; display: flex; align-items: center; justify-content: center; font-size: 19px; }
.home-card b { display: block; font-size: 13.5px; }
.home-card small { display: block; font-size: 11px; color: #64748b; margin-top: 3px; }
.home-arrow { margin-left: auto; color: #94a3b8; font-size: 20px; line-height: 1; }
.home-todos { margin-top: 16px; }
.home-todo-row { display: flex; align-items: center; gap: 9px; padding: 9px 2px; border-bottom: 1px dashed #e2e8f0; cursor: pointer; }
.home-todo-row:last-child { border-bottom: none; }
.home-todo-dot { width: 7px; height: 7px; border-radius: 50%; background: #0f766e; flex: 0 0 7px; }
.home-todo-dot.urgent { background: #dc2626; }
.home-todo-title { font-size: 13px; color: #0f172a; }
.home-todo-row .muted { margin-left: auto; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) {
  .home-hero { padding: 20px; }
  .home-hero-stats { grid-template-columns: repeat(2, 1fr); width: 100%; }
  .home-grid { grid-template-columns: 1fr; }
}

/* ---------------- 主界面 2.0 ---------------- */
.home-hero {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: 246px; padding: 30px 34px; border-radius: 20px;
  background: linear-gradient(115deg, #0a4a42 0%, #0f766e 48%, #115e59 100%);
  box-shadow: 0 18px 44px rgba(15, 118, 110, .22);
  display: flex; align-items: center; justify-content: space-between; gap: 34px;
}
.home-hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(circle at 14% 12%, rgba(45, 212, 191, .30), transparent 36%),
              radial-gradient(circle at 84% 88%, rgba(20, 184, 166, .18), transparent 40%);
}
.home-hero::after {
  content: ''; position: absolute; right: -90px; top: -120px; width: 430px; height: 430px;
  border: 1px solid rgba(255, 255, 255, .10); border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 38px rgba(255, 255, 255, .035), 0 0 0 82px rgba(255, 255, 255, .022);
}
.home-hero-mark {
  position: absolute; right: 300px; top: 50%; transform: translateY(-50%);
  width: 200px; opacity: .055; filter: brightness(0) invert(1); pointer-events: none; z-index: 0;
}
.home-hero-main { position: relative; z-index: 2; flex: 1; max-width: 820px; }
.home-hero-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 13px; }
.home-brand-pill {
  font-size: 11px; letter-spacing: 1.4px; color: #99f6e4;
  border: 1px solid rgba(153, 246, 228, .28); background: rgba(255, 255, 255, .06);
  padding: 4px 10px; border-radius: 999px;
}
.home-date-pill { font-size: 11px; color: rgba(204, 251, 241, .82); }
.home-hero h2 {
  margin: 0 0 10px; font-size: 31px; line-height: 1.2; font-weight: 700;
  letter-spacing: .5px; color: #fff;
}
.home-hero-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: #ccfbf1; font-size: 13px; }
.home-hero-sub b { color: #fbbf24; font-size: 15px; }
.home-role-pill {
  display: inline-flex; align-items: center; font-size: 11px; color: #d1fae5;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16);
  padding: 3px 9px; border-radius: 999px;
}
.home-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.home-actions .btn { height: 36px; border-radius: 9px; font-size: 12.5px; padding: 0 15px; }
.home-actions .btn-primary { background: #fff; color: #0f766e; border-color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.home-actions .btn-primary:hover { background: #ecfdf5; color: #115e59; }
.home-actions .btn:not(.btn-primary) { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.30); color: #fff; }
.home-actions .btn:not(.btn-primary):hover { background: rgba(255,255,255,.18); }
.home-action-arrow { font-size: 16px; margin-left: 2px; }
.home-hero-stats {
  position: relative; z-index: 2; width: 356px; flex: 0 0 356px;
  background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 16px; padding: 15px 16px; box-shadow: 0 12px 32px rgba(0, 0, 0, .10);
  backdrop-filter: blur(5px); display: block;
}
.home-stats-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 2px 10px; border-bottom: 1px solid rgba(255,255,255,.12); }
.home-stats-head span { color: #ccfbf1; font-size: 12.5px; font-weight: 600; letter-spacing: .5px; }
.home-stats-head small { color: rgba(153, 246, 228, .55); font-size: 8.5px; letter-spacing: 1.2px; }
.home-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.home-stat-cell { display: flex; align-items: center; gap: 9px; background: rgba(255,255,255,.075); border: 1px solid rgba(255,255,255,.06); border-radius: 11px; padding: 10px 11px; }
.home-stat-icon { width: 28px; height: 28px; flex: 0 0 28px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.10); border-radius: 8px; font-size: 14px; }
.home-stat-cell b { display: block; color: #fff; font-size: 21px; line-height: 1.1; }
.home-stat-cell small { display: block; color: #99f6e4; font-size: 10.5px; margin-top: 2px; }
@media (max-width: 980px) {
  .home-hero { flex-direction: column; align-items: stretch; gap: 20px; padding: 24px; }
  .home-hero-stats { width: 100%; flex: none; }
  .home-hero-mark { display: none; }
}
@media (max-width: 720px) {
  .home-hero h2 { font-size: 25px; }
  .home-brand-pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .home-hero-stats { padding: 12px; }
}


