/* 出海非洲库存与收支管理系统 · 移动端优先样式
   仓库现场以手机为主、强光下作业，因此采用高对比浅色基调；
   同时在系统设为深色时自动适配，兼顾夜间与国内办公场景。 */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --border: #dfe3e9;
  --text: #1b1f26;
  --text-2: #5c6673;
  --text-3: #8b95a3;
  --brand: #2f5d8a;
  --brand-soft: #e7eefa;
  --ok: #1f7a4d;
  --ok-soft: #e5f4ec;
  --warn: #9a6412;
  --warn-soft: #fdf2e0;
  --danger: #b3352f;
  --danger-soft: #fbeaea;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1c1f25;
    --surface-2: #23272e;
    --border: #30353d;
    --text: #e8eaee;
    --text-2: #a3abb8;
    --text-3: #78818f;
    --brand: #85b7eb;
    --brand-soft: #1e2c3d;
    --ok: #86d3a8;
    --ok-soft: #1b2c23;
    --warn: #e0b062;
    --warn-soft: #2e2718;
    --danger: #f09595;
    --danger-soft: #2f1f1f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Noto Sans", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: none; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.topbar .brand { font-weight: 600; font-size: 15px; flex: 1; }
.topbar .who { font-size: 12px; color: var(--text-2); text-align: right; line-height: 1.3; }
.topbar .who b { display: block; color: var(--text); font-weight: 500; font-size: 13px; }

/* ---------------- 导航 ---------------- */
.nav {
  display: flex; gap: 6px; overflow-x: auto; padding: 10px 14px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: none; padding: 7px 13px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 13px; white-space: nowrap;
}
.nav a.on { background: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .nav a.on { color: #0d1117; } }

/* ---------------- 布局 ---------------- */
.wrap { padding: 14px; max-width: 1200px; margin: 0 auto; }
.page-head { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 18px; margin: 0; font-weight: 600; }
.page-head .sub { font-size: 12px; color: var(--text-3); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 14px;
}
.card > h2 { font-size: 14px; margin: 0 0 12px; font-weight: 600; }

.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.kpi .k { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.kpi .v { font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.kpi .v small { font-size: 12px; font-weight: 400; color: var(--text-2); margin-left: 3px; }

/* ---------------- 表格 ---------------- */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; }
th { font-size: 12px; color: var(--text-3); font-weight: 500; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--text-3); font-size: 13px; padding: 18px 4px; }

/* ---------------- 徽标 ---------------- */
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 5px; background: var(--surface-2); color: var(--text-2); }
.tag.consign { background: var(--brand-soft); color: var(--brand); }
.tag.self { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------------- 表单 ---------------- */
label { display: block; font-size: 12px; color: var(--text-2); margin: 0 0 5px; }
input, select, textarea, button {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { min-height: 62px; resize: vertical; }
.field { margin-bottom: 12px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.btn {
  display: inline-block; padding: 10px 16px; border-radius: 8px; cursor: pointer;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  font-size: 14px; text-align: center;
}
@media (prefers-color-scheme: dark) { .btn { color: #0d1117; } }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ---------------- 提示 ---------------- */
.notice { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; font-size: 13px; }
.notice.err { background: var(--danger-soft); color: var(--danger); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.info { background: var(--brand-soft); color: var(--brand); }

.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.bar > * { min-width: 0; }
.bar .field { margin: 0; flex: 1 1 140px; }

.muted { color: var(--text-3); font-size: 12px; }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* ---------------- 登录页 ---------------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 26px 22px; }
.login-box h1 { font-size: 19px; margin: 0 0 4px; font-weight: 600; }
.login-box .sub { font-size: 12.5px; color: var(--text-3); margin: 0 0 22px; line-height: 1.6; }

.line-rows input, .line-rows select { font-size: 13px; padding: 7px 8px; }
.line-rows td { padding: 4px 5px; white-space: nowrap; }
