:root {
  --green-900: #0b3d2c;
  --green-800: #0f4d38;
  --green-700: #14664a;
  --green-600: #1a7a58;
  --green-100: #e2efe7;
  --green-50: #eef6f1;
  --ink: #1e2b24;
  --muted: #6c7b72;
  --line: #dfe7e1;
  --bg: #f5f7f5;
  --amber: #b9721c;
  --amber-bg: #fdf3e3;
  --red: #b3402f;
  --red-bg: #fbeae7;
  --blue: #2b5f8f;
  --blue-bg: #e9f1f8;
  --teal: #1c6f6a;
  --teal-bg: #e4f2f1;
  --radius: 10px;
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green-700); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1100px 500px at 10% -10%, rgba(26, 122, 88, 0.28), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(11, 61, 44, 0.35), transparent 55%),
    linear-gradient(145deg, #0a2e22 0%, #0f4d38 55%, #123f30 100%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 38px 36px 30px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-logo {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(150deg, var(--green-600), var(--green-800));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; letter-spacing: 1px;
}
.login-card h1 { font-size: 21px; color: var(--green-900); }
.login-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 26px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.login-field input {
  width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 8px;
  padding: 0 14px; background: #fbfcfb; outline: none; font-size: 15.5px;
}
.login-field input:focus { border-color: var(--green-600); background: #fff; box-shadow: 0 0 0 3px rgba(26, 122, 88, 0.12); }
.login-btn {
  width: 100%; height: 48px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--green-700); color: #fff; font-size: 16px; font-weight: 600;
  margin-top: 6px; letter-spacing: 2px;
}
.login-btn:hover { background: var(--green-600); }
.login-btn:disabled { opacity: 0.6; cursor: default; }
.login-error { color: var(--red); font-size: 13.5px; min-height: 22px; margin-top: 10px; }
.login-foot { margin-top: 18px; color: #93a29a; font-size: 12.5px; text-align: center; line-height: 1.7; }

/* ---------- 主框架 ---------- */
.App { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: linear-gradient(180deg, #0c3a2b, #0f4d38 60%, #0c3a2b);
  color: #d9e8e0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 22px 20px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.brand-name { color: #fff; font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.brand-sub { color: #9dbfae; font-size: 12px; margin-top: 3px; letter-spacing: 0.5px; }
.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 14px; border-radius: 7px; cursor: pointer; margin-bottom: 3px;
  color: #cfe3d9; font-size: 15px; border-left: 3px solid transparent; user-select: none;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, 0.12); color: #fff; border-left-color: #7fd0a8; font-weight: 600; }
.nav-badge {
  background: #e0a44a; color: #3a2506; font-size: 11.5px; font-weight: 700;
  border-radius: 10px; padding: 1px 7px; min-width: 20px; text-align: center;
}
.sidebar-foot { padding: 14px 20px 18px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 12px; color: #8fb3a2; }
.sidebar-foot b { color: #cfe3d9; font-weight: 600; }
.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 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 18px; font-weight: 600; color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13.5px; }
.topbar-user { color: var(--ink); font-weight: 500; }
.content { padding: 22px 24px 40px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* ---------- 通用 ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-title { font-size: 16px; font-weight: 600; color: var(--ink); }
.card-title small { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.green { color: var(--green-700); }
.red { color: var(--red); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 29px; font-weight: 700; color: var(--green-800); margin: 4px 0 2px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 12px; color: var(--muted); }
.stat-value .unit { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 3px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; font-size: 14px; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: #f3f6f3; }
.btn-primary { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-600); border-color: var(--green-600); }
.btn-danger { background: #fff; border-color: #e4b7ae; color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 6px; }
.btn-link { border: 0; background: transparent; color: var(--green-700); padding: 2px 4px; height: auto; cursor: pointer; font-size: 13.5px; }
.btn-link:hover { text-decoration: underline; background: transparent; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

input.input, select.input, textarea.input {
  height: 38px; border: 1px solid var(--line); border-radius: 7px; padding: 0 11px;
  background: #fbfcfb; outline: none; min-width: 0;
}
textarea.input { height: auto; padding: 9px 11px; line-height: 1.6; resize: vertical; }
input.input:focus, select.input:focus, textarea.input:focus {
  border-color: var(--green-600); background: #fff; box-shadow: 0 0 0 3px rgba(26, 122, 88, 0.1);
}
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field .input { width: 100%; }
.field .hint { font-size: 12px; color: #93a29a; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
.table th {
  background: #f3f6f3; color: #5d6d64; font-weight: 600; font-size: 13px;
  text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid #edf1ee; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcfb; }
.table .addr { max-width: 320px; }
.table .num { font-variant-numeric: tabular-nums; }
.table-empty { padding: 40px 20px; text-align: center; color: #93a29a; font-size: 14px; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 20px; font-size: 12px; line-height: 20px; white-space: nowrap; }
.badge-pending { background: var(--amber-bg); color: var(--amber); }
.badge-accepted { background: var(--blue-bg); color: var(--blue); }
.badge-delivering { background: var(--teal-bg); color: var(--teal); }
.badge-delivered { background: var(--green-50); color: var(--green-700); }
.badge-completed { background: var(--green-100); color: var(--green-800); }
.badge-cancelled { background: #eef0ee; color: #7d8a82; }
.badge-approved { background: var(--green-100); color: var(--green-800); }
.badge-rejected { background: var(--red-bg); color: var(--red); }
.badge-suspended { background: #eef0ee; color: #7d8a82; }

/* ---------- 筛选 ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filter-item { display: flex; flex-direction: column; gap: 5px; }
.filter-item label { font-size: 12.5px; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 9px 16px; cursor: pointer; font-size: 14.5px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; user-select: none;
}
.tab:hover { color: var(--green-700); }
.tab.active { color: var(--green-800); border-bottom-color: var(--green-700); font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 13px; color: var(--muted); gap: 12px; flex-wrap: wrap; }
.pager .btn { height: 32px; padding: 0 12px; font-size: 13px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(10, 26, 19, 0.5); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 640px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28); animation: pop 0.14s ease-out;
}
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 17px; font-weight: 600; }
.modal-close { border: 0; background: transparent; font-size: 22px; line-height: 1; color: #93a29a; cursor: pointer; padding: 0 4px; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.info-list { display: grid; grid-template-columns: 96px 1fr; gap: 9px 14px; font-size: 14px; margin-bottom: 18px; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; word-break: break-all; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ---------- 公告 / 设置 ---------- */
.notice-item { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; }
.notice-item h4 { font-size: 15px; margin-bottom: 4px; }
.notice-item .meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.notice-item .content { font-size: 13.5px; color: #3c4a42; white-space: pre-wrap; }
.product-row { display: grid; grid-template-columns: 80px 1fr 110px 80px 100px; gap: 10px; align-items: center; margin-bottom: 10px; }
.product-row-v11 { grid-template-columns: 78px 1.25fr 1fr 92px 72px 68px; }
.product-price { font-size: 14.5px; font-weight: 700; color: var(--green-800); text-align: right; padding-right: 6px; white-space: nowrap; }
.switch-line { display: flex; align-items: center; gap: 8px; height: 38px; font-size: 14px; color: var(--ink); }
.switch-line input { width: 16px; height: 16px; accent-color: var(--green-700); }
.env-note { background: var(--green-50); border: 1px solid #cfe4d8; border-radius: 8px; padding: 12px 14px; font-size: 13px; color: #33513f; line-height: 1.75; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: #173c2d; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; z-index: 300; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); max-width: 80vw;
}
.toast.error { background: #8f2f22; }
.loading { padding: 50px; text-align: center; color: var(--muted); }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .App { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; }
  .nav { display: flex; overflow-x: auto; padding: 8px; }
  .nav-item { white-space: nowrap; margin-bottom: 0; border-left: 0; border-bottom: 3px solid transparent; }
  .nav-item.active { border-left: 0; border-bottom-color: #7fd0a8; }
  .brand, .sidebar-foot { display: none; }
  .content { padding: 16px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .product-row { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 14px; height: 56px; }
}

.badge-founding {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  background: #fff4df;
  color: #9a5b00;
  border: 1px solid #f0d3a0;
  font-size: 11px;
  font-weight: 600;
}
