:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --muted-2: #86868b;
  --line: #e5e5ea;
  --line-2: #f0f0f2;
  --blue: #0071e3;
  --blue-dark: #0062c4;
  --blue-soft: #e8f2ff;
  --green: #34c759;
  --green-soft: #eaf8ee;
  --orange: #ff9500;
  --orange-soft: #fff4e5;
  --red: #ff3b30;
  --red-soft: #ffeceb;
  --purple: #af52de;
  --purple-soft: #f6edfb;
  --teal: #30b0c7;
  --teal-soft: #e9f7f9;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .035);
  --shadow: 0 8px 30px rgba(0, 0, 0, .06);
  --shadow-lg: 0 30px 90px rgba(0, 0, 0, .22);
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: "SF Mono", "Cascadia Code", Consolas, monospace; font-size: .94em; }
::selection { background: rgba(0, 113, 227, .18); }

/* ---------- login ---------- */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #f5f5f7;
}
.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(800px 500px at 8% 6%, rgba(0, 113, 227, .10), transparent 62%),
    radial-gradient(760px 500px at 96% 94%, rgba(255, 149, 0, .08), transparent 62%),
    radial-gradient(600px 400px at 55% 45%, rgba(175, 82, 222, .05), transparent 65%),
    linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 100%);
}
.login-bg::after { display: none; }
.login-card {
  position: relative;
  width: 430px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border-radius: 24px;
  padding: 34px 32px 24px;
  border: 1px solid rgba(0, 0, 0, .06);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .12);
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.brand-mark {
  width: 52px; height: 52px; border-radius: 14px;
  background: #1d1d1f; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 600; flex: 0 0 auto;
  box-shadow: none;
}
.brand-mark.small { width: 38px; height: 38px; font-size: 19px; border-radius: 11px; }
.login-brand h1 { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -.5px; }
.login-brand p { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: .1px; }
.login-form label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.login-form input {
  width: 100%; margin-top: 6px; height: 44px; border: 1px solid transparent;
  border-radius: 12px; padding: 0 13px; outline: none; background: #f5f5f7;
  color: var(--text); font-size: 14px; transition: .15s ease;
}
.login-form input:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(0, 113, 227, .12); }
.form-error { color: var(--red); font-size: 12px; min-height: 18px; margin-top: 10px; }
.login-hint { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.hint-title { font-size: 12px; color: var(--muted); margin-bottom: 9px; }
.hint-grid { display: grid; grid-template-columns: 54px 1fr; gap: 6px 9px; align-items: center; font-size: 12px; color: var(--muted); }
.hint-grid code { background: #f5f5f7; border-radius: 6px; padding: 3px 7px; color: var(--text); font-size: 11.5px; }
.login-foot { margin-top: 18px; text-align: center; font-size: 11px; color: var(--muted-2); }

/* ---------- shell ---------- */
.app-view { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 232px;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid rgba(0, 0, 0, .07);
  color: var(--text);
  display: flex; flex-direction: column;
  padding: 18px 12px 14px; z-index: 20;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand-word { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; min-width: 0; }
.brand-word strong { font-size: 14px; font-weight: 650; letter-spacing: -.25px; color: var(--text); }
.brand-word span { font-size: 11.5px; font-weight: 500; color: var(--muted-2); letter-spacing: .1px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  border: 0; background: transparent; color: var(--muted);
  padding: 9px 11px; border-radius: 10px; text-align: left;
  font-size: 13.5px; transition: .15s ease; position: relative;
}
.nav-item svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  flex: 0 0 auto; color: #8e8e93;
}
.nav-item:hover { color: var(--text); background: #f0f0f2; }
.nav-item.active { color: var(--text); background: #e8e8ed; font-weight: 500; }
.nav-item.active svg { color: var(--blue); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 8px 2px; }
.user-line { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #e8e8ed; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500; flex: 0 0 auto;
}
.user-line strong { display: block; color: var(--text); font-size: 12.5px; font-weight: 500; }
.user-line span { display: block; color: var(--muted-2); font-size: 11px; margin-top: 2px; }
.logout-btn {
  width: 100%; border: 1px solid var(--line); background: transparent;
  color: var(--muted); border-radius: 9px; padding: 7px 10px; font-size: 12px;
}
.logout-btn:hover { color: var(--text); background: #f5f5f7; }

.main { margin-left: 232px; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 30px; background: rgba(245, 245, 247, .82);
  border-bottom: 1px solid rgba(0, 0, 0, .06);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.topbar h1 { margin: 0 0 3px; font-size: 26px; font-weight: 600; letter-spacing: -.7px; }
.topbar p { margin: 0; color: var(--muted); font-size: 12.5px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.today {
  font-size: 12px; color: var(--muted); background: rgba(255, 255, 255, .7);
  border: 1px solid var(--line); border-radius: 980px; padding: 6px 11px;
}
.view { padding: 26px 30px 48px; max-width: 1520px; }

/* ---------- common ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 17px 20px; border-bottom: 1px solid var(--line-2);
}
.card-head h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.25px; }
.card-head .sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.card-body { padding: 18px 20px; }
.card-body.tight { padding: 0; }
.section-gap { margin-top: 18px; }

.btn {
  border: 1px solid #d2d2d7; border-radius: 10px; padding: 8px 14px;
  background: #fff; color: var(--text); font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px; transition: .15s ease;
  white-space: nowrap; line-height: 1.2;
}
.btn:hover { background: #f5f5f7; border-color: #c7c7cc; text-decoration: none; }
.btn.primary {
  background: var(--blue); color: #fff; border-color: var(--blue);
  border-radius: 980px; box-shadow: none; font-weight: 500;
}
.btn.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #ffd2cf; background: #fff; }
.btn.danger:hover { background: var(--red-soft); }
.btn.success { background: var(--green); color: #fff; border-color: var(--green); border-radius: 980px; font-weight: 500; }
.btn.success:hover { background: #2fb350; border-color: #2fb350; }
.btn.small { padding: 5px 9px; font-size: 11.5px; border-radius: 8px; }
.btn.block { width: 100%; justify-content: center; height: 44px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-row { display: flex; gap: 7px; flex-wrap: wrap; }

.input, .select, .textarea {
  height: 36px; border: 1px solid transparent; border-radius: 10px;
  background: #f5f5f7; padding: 0 11px; color: var(--text);
  outline: none; font-size: 13px; transition: .15s ease;
}
.textarea { height: auto; padding: 9px 11px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  background: #fff; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, .12);
}
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field .input, .field .select, .field .textarea { width: 100%; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.callout { border-radius: 12px; padding: 12px 14px; font-size: 12.5px; line-height: 1.6; border: 1px solid var(--line); }
.callout.info { background: var(--blue-soft); color: #0058b0; border-color: #d6e9ff; }
.callout.warn { background: var(--orange-soft); color: #9a5b00; border-color: #ffe2b8; }
.callout.danger { background: var(--red-soft); color: #b42318; border-color: #ffd2cf; }
.callout.success { background: var(--green-soft); color: #1d7a35; border-color: #c9efd4; }

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: none; position: relative; overflow: hidden;
}
.stat-card::before {
  content: ""; position: absolute; top: 19px; right: 19px;
  width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
.stat-card::after { display: none; }
.stat-card.blue { color: var(--blue); }
.stat-card.green { color: var(--green); }
.stat-card.amber { color: var(--orange); }
.stat-card.red { color: var(--red); }
.stat-card.teal { color: var(--teal); }
.stat-card.purple { color: var(--purple); }
.stat-label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 30px; font-weight: 600; margin-top: 8px; letter-spacing: -.9px; color: var(--text); }
.stat-card .stat-value { color: var(--text); }
.stat-foot { font-size: 11.5px; color: var(--muted-2); margin-top: 6px; }

/* ---------- table ---------- */
.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; min-width: 880px; }
table.data th, table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
table.data th {
  color: var(--muted-2); font-size: 11px; font-weight: 500; letter-spacing: .25px;
  background: rgba(251, 251, 253, .92); position: sticky; top: 0; z-index: 2; white-space: nowrap;
  backdrop-filter: blur(8px);
}
table.data tr:hover td { background: #fbfbfd; }
table.data td { font-size: 13px; }
table.data td.actions { white-space: nowrap; }
table.data .sub { display: block; color: var(--muted-2); font-size: 11px; margin-top: 2px; }
.age { display: inline-block; margin-left: 4px; font-size: 10.5px; color: var(--muted-2); }
.age.warn { color: #b25a00; }
.age.late { color: #b42318; font-weight: 600; }
table.data .strong { font-weight: 500; color: var(--text); }
.empty { padding: 38px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty .big { font-size: 30px; opacity: .3; margin-bottom: 8px; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 7px; padding: 3px 8px; font-size: 11px; font-weight: 500;
  white-space: nowrap; line-height: 1.4;
}
.chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip.gray { background: #f0f0f2; color: #6e6e73; }
.chip.blue { background: var(--blue-soft); color: #0066cc; }
.chip.purple { background: var(--purple-soft); color: #8e3fb8; }
.chip.amber { background: var(--orange-soft); color: #a86200; }
.chip.orange { background: #fff0e2; color: #b25a00; }
.chip.teal { background: var(--teal-soft); color: #1b7e8f; }
.chip.green { background: var(--green-soft); color: #1d7a35; }
.chip.red { background: var(--red-soft); color: #b42318; }

/* ---------- product / detail ---------- */
.product-cell { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.product-thumb {
  width: 38px; height: 38px; border-radius: 10px; object-fit: cover;
  background: #f5f5f7; border: 1px solid var(--line); flex: 0 0 auto;
}
.product-thumb.placeholder { display: flex; align-items: center; justify-content: center; color: #b0b0b5; font-size: 14px; }
.product-name { font-weight: 500; color: var(--text); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-sku { color: var(--muted-2); font-size: 11px; margin-top: 2px; }
.meta-line { color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.meta-line b { color: var(--text); font-weight: 500; }

/* ---------- batches ---------- */
.batch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.batch-card {
  border: 1px solid var(--line); border-radius: 16px; background: #fff;
  padding: 16px; box-shadow: none; transition: .15s ease;
}
.batch-card:hover { border-color: #d2d2d7; box-shadow: 0 8px 24px rgba(0, 0, 0, .045); }
.batch-card .batch-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.batch-no { font-weight: 600; font-size: 13.5px; letter-spacing: -.15px; }
.batch-meta { color: var(--muted); font-size: 11.5px; line-height: 1.7; }
.progress { height: 6px; border-radius: 99px; background: #e8e8ed; overflow: hidden; margin: 11px 0 7px; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--blue); }
.batch-actions { display: flex; gap: 6px; margin-top: 11px; }
.print-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--line-2);
}
.print-bar .select { height: 32px; font-size: 12px; }

/* ---------- scan ---------- */
.scan-card {
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm);
}
.scan-title { font-size: 17px; font-weight: 600; color: var(--text); margin: 0 0 5px; letter-spacing: -.2px; }
.scan-sub { color: var(--muted); font-size: 12px; margin: 0 0 16px; }
.scan-row { display: flex; gap: 10px; width: 100%; }
.scan-row .input { flex: 1 1 auto; min-width: 0; }
.scan-input {
  flex: 1; height: 52px; font-size: 18px; letter-spacing: .5px;
  border: 1px solid transparent; background: #f5f5f7; color: var(--text);
  border-radius: 14px; padding: 0 16px; outline: none; transition: .15s ease;
}
.scan-input::placeholder { color: var(--muted-2); letter-spacing: 0; font-size: 13px; }
.scan-input:focus { background: #fff; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, .12); }
.scan-btn {
  height: 52px; padding: 0 24px; background: var(--blue); color: #fff;
  border: 0; border-radius: 980px; font-weight: 500; font-size: 14px;
}
.scan-btn:hover { background: var(--blue-dark); }
.scan-result { margin-top: 16px; }

/* ---------- order detail ---------- */
.detail-grid { display: grid; grid-template-columns: 1.35fr .75fr; gap: 16px; }
.detail-list { display: grid; grid-template-columns: 92px 1fr; gap: 8px 10px; font-size: 12.5px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; color: var(--text); }
.timeline { border-left: 2px solid var(--line); margin-left: 5px; padding-left: 14px; }
.timeline-item { position: relative; padding-bottom: 12px; font-size: 12px; color: var(--muted); }
.timeline-item::before {
  content: ""; position: absolute; left: -20px; top: 4px;
  width: 8px; height: 8px; border-radius: 50%; background: #d2d2d7;
}
.timeline-item.done::before { background: var(--blue); }
.timeline-item b { color: var(--text); }

/* ---------- modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .32);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 20px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.modal {
  width: 560px; max-width: 94vw; max-height: 90vh; overflow: auto;
  background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg);
  animation: pop .18s ease;
}
.modal.wide { width: 780px; }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.2px; }
.modal-close { border: 0; background: #f5f5f7; border-radius: 50%; width: 28px; height: 28px; font-size: 18px; line-height: 1; color: var(--muted); }
.modal-close:hover { background: #e8e8ed; color: var(--text); }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-2); background: #fbfbfd; border-radius: 0 0 20px 20px; }

/* ---------- toast ---------- */
.toast-root { position: fixed; right: 22px; top: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 230px; max-width: 380px; padding: 11px 14px; border-radius: 12px;
  color: #fff; background: rgba(29, 29, 31, .94);
  backdrop-filter: blur(12px); box-shadow: 0 12px 34px rgba(0, 0, 0, .18);
  font-size: 12.5px; animation: slide .18s ease;
}
.toast.success { background: rgba(36, 138, 61, .96); }
.toast.error { background: rgba(196, 43, 35, .96); }
.toast.warn { background: rgba(176, 101, 0, .96); }
@keyframes slide { from { transform: translateX(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- import ---------- */
.dropzone {
  border: 1.5px dashed #d2d2d7; border-radius: 14px; padding: 28px 18px;
  text-align: center; background: #fbfbfd; transition: .15s ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--blue); background: var(--blue-soft); }
.dropzone .dz-icon { font-size: 30px; color: #b0b0b5; }
.dropzone .dz-title { font-weight: 600; margin: 8px 0 4px; }
.dropzone .dz-sub { color: var(--muted); font-size: 12px; }
.file-name { margin-top: 9px; font-size: 12px; color: var(--blue); font-weight: 500; }

/* ---------- misc ---------- */
.pill-tabs { display: inline-flex; background: #e8e8ed; border-radius: 10px; padding: 3px; gap: 2px; }
.pill-tabs button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 12px; }
.pill-tabs button.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); font-weight: 500; }
.split { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kv { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.kv b { color: var(--text); font-weight: 500; }
.checkbox { width: 16px; height: 16px; accent-color: var(--blue); }
.code-box {
  background: #1d1d1f; color: #f5f5f7; border-radius: 10px; padding: 10px 12px;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 12px; letter-spacing: .4px; word-break: break-all;
}
.link-btn { border: 0; background: transparent; color: var(--blue); padding: 0; font-size: 12px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- client portal ---------- */
.portal-view { min-height: 100vh; background: var(--bg); }
.portal-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: rgba(255, 255, 255, .82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.portal-brand { display: flex; align-items: center; gap: 10px; }
.portal-brand .brand-word strong { font-size: 14px; }
.portal-brand .brand-word span { color: var(--muted-2); font-size: 10.5px; }
.portal-user { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--muted); }
.portal-main { max-width: 1180px; margin: 0 auto; padding: 30px 28px 60px; }
.portal-hero {
  display: grid; grid-template-columns: 1fr 280px; gap: 18px; align-items: stretch;
  margin-bottom: 18px;
}
.portal-hero h1 { margin: 4px 0 6px; font-size: 30px; letter-spacing: -.8px; }
.portal-hero p { margin: 0; color: var(--muted); font-size: 13px; }
.portal-balance {
  background: #1d1d1f; color: #fff; border-radius: 20px; padding: 20px 22px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .16);
}
.portal-balance span { display: block; color: #a1a1a6; font-size: 12px; }
.portal-balance b { display: block; font-size: 30px; letter-spacing: -1px; margin: 6px 0 4px; }
.portal-balance small { color: #a1a1a6; font-size: 10.5px; line-height: 1.4; }
.portal-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
  margin-bottom: 18px;
}
.portal-stats > div {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px;
}
.portal-stats span { display: block; color: var(--muted); font-size: 12px; }
.portal-stats b { display: block; color: var(--text); font-size: 24px; margin-top: 5px; letter-spacing: -.5px; }
.portal-tabs { display: flex; gap: 4px; padding: 12px 16px 0; border-bottom: 1px solid var(--line-2); }
.portal-tabs button {
  border: 0; background: transparent; padding: 8px 12px 10px; color: var(--muted);
  font-size: 13px; border-bottom: 2px solid transparent;
}
.portal-tabs button.active { color: var(--text); font-weight: 500; border-bottom-color: var(--blue); }
.portal-filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--line-2);
}
.portal-filters .select { height: 32px; font-size: 12px; }
.portal-content { padding: 4px 0 6px; }
.portal-note {
  padding: 12px 18px 16px; color: var(--muted); font-size: 11.5px; line-height: 1.65;
  border-top: 1px solid var(--line-2);
}

@media (max-width: 1000px) {
  .portal-hero { grid-template-columns: 1fr; }
  .portal-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-height: 760px) {
  .sidebar-brand { padding-bottom: 12px; }
  .nav-item { padding: 8px 11px; }
}
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .batch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .main { margin-left: 0; }
  .app-view { display: block; }
  .nav { flex-direction: row; overflow: auto; }
  .nav-item { width: auto; white-space: nowrap; }
  .sidebar-foot { display: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view { padding: 18px; }
}

/* ---------- 客户后台左侧栏 ---------- */
.portal-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
}
.portal-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--line);
}
.portal-sidebar .portal-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 26px;
}
.portal-sidebar .brand-word strong { font-size: 13.5px; }
.portal-sidebar .brand-word span { color: var(--muted-2); font-size: 11px; }
.portal-nav { display: grid; gap: 4px; }
.portal-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.portal-nav-item:hover { background: #f0f0f3; color: var(--text); }
.portal-nav-item.active { background: #e8e8ed; color: var(--text); font-weight: 600; }
.portal-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ff3b30;
  color: #fff;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
}
.portal-badge.hidden { display: none; }
.portal-sidefoot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line-2);
}
.portal-sidefoot .portal-user { display: flex; align-items: center; gap: 10px; padding: 0 8px 12px; }
.portal-sidefoot .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: #e8e8ed; color: var(--muted); font-size: 13px;
}
.portal-sidefoot .portal-user strong { display: block; font-size: 12px; }
.portal-sidefoot .portal-user span { display: block; color: var(--muted-2); font-size: 10px; }
.portal-sidefoot .btn.block { width: 100%; }
.portal-shell .portal-main { margin: 0; max-width: none; padding: 0; min-width: 0; }
.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 30px 18px;
  border-bottom: 1px solid var(--line-2);
}
.portal-topbar h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.03em; }
.portal-topbar p { margin: 0; color: var(--muted-2); font-size: 12px; }
.portal-actions { display: flex; gap: 8px; }
.portal-body { max-width: 1180px; margin: 0 auto; padding: 22px 30px 60px; }
.portal-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid #cfe2ff;
  border-radius: 14px;
  background: #eef5ff;
  color: #0b57a4;
  font-size: 13px;
}
.portal-alert.hidden { display: none; }
.portal-body .portal-hero { margin-top: 0; }
@media (max-width: 900px) {
  .portal-shell { grid-template-columns: 1fr; }
  .portal-sidebar { position: static; height: auto; }
  .portal-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-body, .portal-topbar { padding-left: 18px; padding-right: 18px; }
}

/* ---------- 订单大盘 ---------- */
button.stat-card { text-align: left; cursor: pointer; font: inherit; }
.board-card.active { outline: 2px solid var(--blue); outline-offset: 1px; }

.thumb-empty { width: 42px; height: 42px; border-radius: 9px; background: #f0f1f4; color: #9aa1aa; display: grid; place-items: center; font-size: 10px; flex: 0 0 auto; }
.draft-box { margin-top: 6px; padding: 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #fafafa; font-size: 11px; line-height: 1.6; white-space: pre-wrap; max-height: 190px; overflow: auto; }

.product-cell img { width: 42px; height: 42px; border-radius: 9px; object-fit: cover; background: #f0f1f4; flex: 0 0 auto; }

.cat-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-height: 24px; }
.cat-chip { display: inline-flex; align-items: center; gap: 5px; background: #e8f0ff; color: #1d4ed8; border-radius: 999px; padding: 4px 8px 4px 10px; font-size: 11px; }
.cat-chip button { border: 0; background: transparent; color: #1d4ed8; font-size: 14px; line-height: 1; cursor: pointer; padding: 0 2px; }
.sf-cat-readonly { display: inline-flex; align-items: center; width: 210px; color: #6b7280; background: #f5f6f8; border-style: dashed; }
