
  :root {
    --bg: #f5f7f5; --card: #fff; --border: #e3e8e3; --text: #1f2937; --muted: #6b7280;
    --primary: #15803d; --primary-light: #dcfce7; --primary-dark: #166534;
    --green: #16a34a; --green-light: #dcfce7;
    --red: #dc2626; --red-light: #fee2e2;
    --amber: #d97706; --amber-light: #fef3c7;
    --teal: #0d9488; --teal-light: #ccfbf1;
    --blue: #2563eb; --blue-light: #dbeafe;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
  .container { max-width: 1440px; margin: 0 auto; padding: 24px 24px 60px; }

  header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
  h1 { font-size: 22px; font-weight: 600; }
  h1 .sub { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 8px; }
  .header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
  .btn { border: 1px solid var(--border); background: var(--card); color: var(--text); padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: all .15s; }
  .btn:hover { border-color: var(--primary); color: var(--primary); }
  .btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
  .btn-primary:hover { background: var(--primary-dark); color: #fff; }
  .btn-sm { padding: 4px 12px; font-size: 12px; }

  .storage-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-radius: 10px; padding: 9px 14px; margin-bottom: 14px; font-size: 13px; }
  .storage-bar.ok { background: var(--green-light); color: #166534; border: 1px solid #bbf7d0; }
  .storage-bar.warn { background: var(--amber-light); color: #92400e; border: 1px solid #fde68a; }
  .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
  .dot.g { background: var(--green); } .dot.a { background: var(--amber); }

  .nav { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 4px; margin-bottom: 14px; width: fit-content; flex-wrap: wrap; }
  .nav .tab { padding: 8px 15px; border-radius: 7px; cursor: pointer; font-size: 14px; color: var(--muted); border: none; background: transparent; }
  .nav .tab.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }

  .global-filter { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
  .global-filter label { color: var(--muted); font-size: 13px; }
  input, select, textarea { border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: inherit; background: var(--card); color: var(--text); outline: none; }
  input:focus, select:focus { border-color: var(--primary); }

  .view { display: none; }
  .view.show { display: block; }
  .page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
  .page-head h2 { font-size: 17px; font-weight: 600; }

  .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 16px; }
  .stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
  .stat-card .label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
  .stat-card .value { font-size: 20px; font-weight: 600; }
  .stat-card .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
  .c-green { color: var(--green); } .c-red { color: var(--red); } .c-blue { color: var(--blue); }
  .c-amber { color: var(--amber); } .c-teal { color: var(--teal); } .c-primary { color: var(--primary); }

  .chart-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
  .chart-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
  .legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); align-items: center; }
  .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }

  .table-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
  .table-scroll { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; min-width: 720px; }
  th { text-align: left; padding: 10px 12px; background: #f9fafb; color: var(--muted); font-size: 12px; font-weight: 500; border-bottom: 1px solid var(--border); white-space: nowrap; }
  td { padding: 10px 12px; border-bottom: 1px solid #f1f3f5; font-size: 13px; white-space: nowrap; }
  tr:last-child td { border-bottom: none; }
  tbody tr:hover td { background: #f9fafb; }
  tfoot td { background: #f8faf8; font-weight: 600; font-size: 12.5px; border-top: 1px solid var(--border); }
  .tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
  .tag-ok { background: var(--green-light); color: var(--green); }
  .tag-low { background: var(--amber-light); color: var(--amber); }
  .tag-neg { background: var(--red-light); color: var(--red); }
  .tag-info { background: var(--blue-light); color: var(--blue); }
  .tag-raw { background: var(--teal-light); color: var(--teal); }
  .row-actions { display: flex; gap: 2px; }
  .row-actions button { border: none; background: transparent; cursor: pointer; font-size: 13px; color: var(--muted); padding: 4px 6px; border-radius: 6px; white-space: nowrap; }
  .row-actions button:hover { background: var(--primary-light); color: var(--primary); }
  .row-actions button.del:hover { background: var(--red-light); color: var(--red); }
  .empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 13px; }
  .amount-in { color: var(--green); font-weight: 600; }
  .amount-out { color: var(--red); font-weight: 600; }
  .detail-row td { background: #f9fafb; font-size: 12px; color: #4b5563; line-height: 1.9; white-space: normal; }
  .fifo-item { display: inline-block; margin-right: 16px; }
  .fifo-item .b { color: var(--primary); font-weight: 600; }

  .form-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 24px; max-width: 960px; }
  .form-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 10px; }
  .form-head h3 { font-size: 16px; font-weight: 600; }
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
  .form-item { display: flex; flex-direction: column; gap: 5px; }
  .form-item.full { grid-column: 1 / -1; }
  .form-item label { font-size: 12px; color: var(--muted); }
  .form-item .hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
  .form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
  .zone-title { grid-column: 1 / -1; font-size: 12px; color: var(--primary-dark); background: var(--primary-light); border-radius: 6px; padding: 5px 10px; }

  .calc-panel { background: #f8faf8; border: 1px dashed #cbd5cb; border-radius: 10px; padding: 14px 16px; margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 14px; }
  .calc-item .k { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
  .calc-item .v { font-size: 16px; font-weight: 600; }
  .calc-item.big .v { font-size: 24px; color: var(--primary); }
  .calc-note { grid-column: 1 / -1; font-size: 12px; color: var(--muted); line-height: 1.8; }
  .warn-text { color: var(--red); font-weight: 600; }

  .formula { font-size: 13px; line-height: 2.1; }
  .formula code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-family: Consolas, monospace; font-size: 12px; }
  .settings-block { margin-bottom: 18px; }
  .settings-block h3 { font-size: 15px; margin-bottom: 10px; }
  .divider { height: 1px; background: var(--border); margin: 18px 0; }

  #toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 9px 20px; border-radius: 8px; font-size: 13px; display: none; z-index: 20; }
  @media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .container { padding: 16px 12px 40px; }
  }

/* ==================== 站点化新增样式：登录 / 弹层 / 云端状态 ==================== */
.storage-bar.err { background: var(--red-light); color: #991b1b; border: 1px solid #fecaca; }
.dot.r { background: var(--red); }

.mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 999; padding: 16px; }
.login-card { background: var(--card); border-radius: 16px; padding: 34px 32px 26px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(15, 23, 42, .22); }
.login-card h2 { font-size: 19px; font-weight: 600; margin-bottom: 6px; }
.login-hint { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.login-card input { width: 100%; padding: 11px 13px; font-size: 14px; margin-bottom: 10px; }
.login-card .btn-primary { width: 100%; padding: 11px; font-size: 14px; margin-top: 6px; }
.login-err { color: var(--red); font-size: 12.5px; min-height: 18px; margin: 2px 0 6px; }
.login-foot { color: var(--muted); font-size: 12px; text-align: center; margin-top: 16px; }

.modal-card { background: var(--card); border-radius: 14px; padding: 22px 24px 18px; width: 100%; max-width: 470px; box-shadow: 0 20px 50px rgba(15, 23, 42, .22); }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.modal-msg { font-size: 13.5px; line-height: 1.7; white-space: pre-line; color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.modal-form { display: flex; flex-direction: column; gap: 8px; }
.modal-form input { padding: 9px 12px; font-size: 13.5px; }

.backup-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.backup-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: #fafbfa; }

@media (max-width: 720px) {
  .container { padding: 14px 12px 40px; }
  h1 { font-size: 18px; }
  h1 .sub { display: none; }
  .nav { width: 100%; overflow-x: auto; }
  .stat-card .value { font-size: 17px; }
}
