/* HIGOOD 供应商管理系统 */
:root {
  --background: #ffffff;
  --foreground: #0a0a0a;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --border: #dedede;
  --radius: 8px;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --blue-50: #eff6ff;
  --blue-200: #bfdbfe;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --amber-50: #fffbeb;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;
  --emerald-50: #ecfdf5;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --orange-500: #f97316;
  --orange-700: #c2410c;
  --sky-50: #f0f9ff;
  --red-600: #dc2626;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
img { display: block; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- 布局 ---------- */
.portal { display: flex; flex-direction: column; height: 100vh; background: var(--slate-100); }
.portal-header { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; height: 56px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-logo { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; background: var(--blue-600); color: #fff; font-size: 14px; font-weight: 700; }
.brand-name { font-size: 16px; font-weight: 600; }
.header-user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.header-user .label { color: var(--slate-500); }
.header-user form { margin: 0; }
.portal-body { display: flex; flex: 1; min-height: 0; }
.portal-nav { width: 224px; flex-shrink: 0; overflow-y: auto; padding: 12px; background: #fff; border-right: 1px solid var(--border); }
.nav-item { display: flex; width: 100%; align-items: center; padding: 8px 12px; border-radius: 6px; font-size: 14px; color: var(--slate-700); }
.nav-item:hover { background: var(--slate-50); }
.nav-item.is-active { background: var(--blue-50); color: var(--blue-600); }
.nav-item.is-strong { font-weight: 500; }
.nav-group { margin-top: 4px; }
.nav-group-title { padding: 8px 12px; font-size: 14px; font-weight: 500; color: var(--slate-800); }
.nav-item.is-sub { padding-left: 32px; }
.portal-main { flex: 1; min-width: 0; overflow: auto; }
.portal-footer { flex-shrink: 0; padding: 12px 16px; background: #fff; border-top: 1px solid var(--border); text-align: center; font-size: 12px; color: var(--slate-500); }

/* ---------- 通用控件 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 16px; border-radius: 6px; font-size: 14px; font-weight: 600; white-space: nowrap; transition: background-color .15s, color .15s; }
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue-700); }
.btn-outline { background: var(--background); border: 1px solid var(--border); color: var(--foreground); }
.btn-outline:hover { background: var(--muted); }
.btn-teal { background: var(--teal-600); color: #fff; }
.btn-teal:hover { background: var(--teal-700); }
.btn-amber { background: var(--amber-500); color: #fff; }
.btn-amber:hover { background: var(--amber-600); }
.btn-sm { height: auto; padding: 6px 12px; font-weight: 400; }
.btn-plain { font-weight: 400; }
.btn:disabled, .btn.is-busy { opacity: .6; pointer-events: none; }
.link-btn { color: var(--blue-600); font-size: 14px; }
.link-btn:hover { text-decoration: underline; }
.field { display: grid; gap: 4px; font-size: 12px; color: var(--slate-500); }
.input { height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--background); color: var(--foreground); font-size: 14px; }
.input:focus { outline: 2px solid var(--blue-200); outline-offset: 0; border-color: var(--blue-600); }
.w-28 { width: 112px; }
.w-36 { width: 144px; }
.w-40 { width: 160px; }
.range-sep { padding-bottom: 8px; font-size: 14px; color: var(--slate-400); }
.text-muted { color: var(--muted-foreground); }
.feedback { padding: 8px 12px; border: 1px solid var(--blue-200); border-radius: 6px; background: var(--blue-50); color: var(--blue-800); font-size: 14px; }

/* ---------- 标准列表 ---------- */
.list-page { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.list-header { display: flex; min-height: 36px; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.page-title { font-size: 20px; line-height: 28px; font-weight: 600; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.filter-fields { display: flex; flex: 1; min-width: 0; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filter-actions { display: flex; flex-shrink: 0; align-items: center; gap: 8px; }
.table-card { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.table-card-header { display: flex; min-height: 44px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.table-card-header h2 { font-size: 16px; font-weight: 600; }
.table-scroll { max-width: 100%; overflow-x: auto; }
.data-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.data-table thead { background: var(--muted); border-bottom: 1px solid var(--border); }
.data-table th { height: 40px; padding: 0 12px; font-size: 12px; font-weight: 500; color: var(--muted-foreground); text-align: left; vertical-align: middle; white-space: nowrap; }
.data-table td { padding: 8px 12px; font-size: 14px; text-align: left; vertical-align: middle; }
.data-table tbody tr { border-bottom: 1px solid var(--border); }
.data-table tbody tr:last-child { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--muted); }
.data-table .is-frozen { position: sticky; left: 0; z-index: 10; background: var(--background); box-shadow: 6px 0 8px -8px rgba(15, 23, 42, .75); }
.data-table th.is-frozen { z-index: 20; }
.data-table .is-action { position: sticky; right: 0; z-index: 20; background: var(--background); border-left: 1px solid var(--border); }
.data-table th.is-action { z-index: 30; }
.data-table .empty-cell { height: 96px; text-align: center; color: var(--muted-foreground); }
.table-card-footer { padding: 12px 16px; border-top: 1px solid var(--border); }
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.pagination-summary { font-size: 12px; color: var(--muted-foreground); }
.pagination-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pagination-controls select { height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--background); font-size: 12px; }
.page-btn { display: inline-flex; align-items: center; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.page-btn:hover { background: var(--muted); }
.page-btn.is-disabled { cursor: not-allowed; opacity: .6; pointer-events: none; }
.pagination-current { font-size: 12px; color: var(--muted-foreground); }

/* ---------- 采购单单元格 ---------- */
.order-no { font-weight: 500; }
.order-supplier { margin-top: 2px; font-size: 12px; line-height: 16px; color: var(--slate-500); overflow-wrap: anywhere; }
.role-badge { padding: 2px 8px; border-radius: 9999px; background: var(--blue-50); color: var(--blue-700); font-size: 12px; }
.fabric-cell { display: flex; align-items: center; gap: 12px; }
.fabric-thumb { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; flex-shrink: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 4px; background: var(--slate-50); }
.fabric-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fabric-thumb .thumb-text { padding: 0 4px; font-size: 10px; line-height: 16px; text-align: center; color: var(--slate-400); }
.fabric-thumb .thumb-error { color: var(--red-600); }
.fabric-meta { min-width: 0; }
.fabric-name { font-weight: 500; overflow-wrap: anywhere; }
.fabric-spu { font-size: 12px; color: var(--slate-500); }
.stack-lines { display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 20px; color: var(--slate-700); }
.stack-lines .label { color: var(--slate-500); }
.status-pill { display: inline-block; padding: 2px 8px; border-radius: 9999px; font-size: 12px; }
.status-pending { background: var(--amber-50); color: var(--amber-700); }
.status-purchasing { background: var(--blue-50); color: var(--blue-700); }
.status-done { background: var(--emerald-50); color: var(--emerald-700); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- 弹窗 ---------- */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .45); }
.overlay-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; }
.overlay-rolls { z-index: 40; }
.overlay-import { z-index: 50; }
.overlay-preview { z-index: 70; background: rgba(0, 0, 0, .7); }
.modal { position: relative; display: flex; flex-direction: column; width: 100%; overflow: hidden; border-radius: var(--radius); background: #fff; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1); }
.modal-import { max-width: 672px; max-height: 90vh; }
.modal-rolls { max-width: 1200px; max-height: 92vh; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 18px; line-height: 28px; font-weight: 600; }
.modal-close { padding: 4px 8px; border-radius: 6px; font-size: 20px; line-height: 1; color: var(--slate-500); }
.modal-close:hover { background: var(--slate-100); }
.modal-body { overflow-y: auto; padding: 16px 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--border); }
.modal-footer .btn { height: auto; padding: 8px 16px; font-weight: 400; }
.notice-error { margin-top: 12px; font-size: 14px; color: var(--orange-700); }
.notice-error.is-success { color: var(--emerald-700); }

.import-card { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); }
.import-card h3 { padding-left: 8px; border-left: 4px solid var(--blue-600); font-size: 14px; font-weight: 500; }
.import-tip { margin-top: 12px; padding: 12px; border-radius: 6px; background: var(--sky-50); font-size: 14px; line-height: 24px; color: var(--slate-600); }
.import-grid { display: grid; grid-template-columns: 96px 1fr; align-items: center; row-gap: 16px; margin-top: 16px; font-size: 14px; }
.import-grid .label { color: var(--slate-500); }
.import-order-no { color: var(--blue-600); }
.import-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.import-modes label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.import-modes .hint { color: var(--slate-400); }
.import-file { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.file-picker { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 6px; background: var(--blue-600); color: #fff; cursor: pointer; }
.file-picker:hover { background: var(--blue-700); }
.file-picker.is-disabled { opacity: .6; pointer-events: none; }

.rolls-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 12px; }
.rolls-filters .btn { font-weight: 400; }
.rolls-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.rolls-actions .btn { height: auto; padding: 6px 12px; font-weight: 400; }
.rolls-summary { margin-left: 8px; font-size: 14px; color: var(--slate-600); }
.rolls-table-wrap { margin-top: 12px; overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; }
.rolls-table { width: 100%; min-width: 1400px; border-collapse: collapse; font-size: 12px; }
.rolls-table thead { background: var(--slate-50); }
.rolls-table th { padding: 8px; font-weight: 500; text-align: left; white-space: nowrap; }
.rolls-table td { padding: 8px; border-top: 1px solid var(--border); white-space: nowrap; }
.rolls-table .code { color: var(--blue-600); }
.rolls-table .warn { color: var(--orange-500); }
.rolls-table .ok { color: var(--emerald-600); }
.rolls-table .placeholder-cell { padding: 24px 12px; color: var(--slate-500); white-space: normal; }
.rolls-count { margin-top: 12px; font-size: 12px; color: var(--slate-500); }

.preview-close { position: absolute; top: 16px; right: 16px; z-index: 1; padding: 6px 12px; border-radius: 6px; background: #fff; font-size: 14px; }
.preview-image { position: relative; max-width: 100%; max-height: 85vh; object-fit: contain; }

/* ---------- 账号管理 ---------- */
.account-page { padding: 16px; }
.account-list { max-width: 576px; margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.account-list > div { display: grid; grid-template-columns: 128px 1fr; gap: 12px; padding: 12px 16px; font-size: 14px; }
.account-list > div + div { border-top: 1px solid var(--border); }
.account-list dt { color: var(--slate-500); }

/* ---------- 登录 ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: #d2d6de; }
.login-box { width: 400px; max-width: 100%; padding: 20px; border-radius: 5px; background: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, .1); color: #333; }
.login-box h1 { margin: 0 0 20px; text-align: center; font-size: 24px; font-weight: 500; }
.login-box .login-desc { margin: 0 0 20px; text-align: center; }
.login-box input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #e6e6e6; border-radius: 2px; font-size: 14px; }
.login-box input:focus { outline: 1px solid #1e9fff; border-color: #1e9fff; }
.login-row { margin-bottom: 15px; }
.login-pass { position: relative; }
.login-pass input { padding-right: 40px; }
.login-toggle { position: absolute; top: 50%; right: 8px; padding: 6px; line-height: 0; color: #666; transform: translateY(-50%); }
.login-submit { width: 100%; height: 38px; margin-top: 8px; border: 1px solid #d2d2d2; border-radius: 2px; background: #fff; color: #555; font-size: 14px; }
.login-submit:hover { border-color: #009688; color: #333; }
.login-submit:disabled { opacity: .6; }
.login-error { margin: 0 0 12px; font-size: 13px; color: var(--orange-700); }
.login-error:empty { display: none; }
.login-hint { margin: 16px 0 0; text-align: center; font-size: 13px; color: #888; }
