/* 客户门户专用样式 —— 复用 style.css 的变量与基础组件，这里只补门户特有部分。
   设计原则：客户看到的是「进度 + 轨迹」，信息密度比内部看板低，字号和留白更宽松。 */

.portal-body { background: var(--bg); }

/* [hidden] 兜底 —— 必须放在最前面、且用 !important。
   原因：浏览器自带的 `[hidden] { display: none }` 属于「UA 样式表」，
   优先级低于任何作者样式。像 .pt-login { display: flex }、.pt-drawer { display: flex }
   这类规则会直接把它压掉，导致 JS 里 el.hidden = true 完全不起作用
   （表现就是「登录后登录卡片还盖在上面」「抽屉关了但挡住点击」）。
   用 [hidden] + !important 保证 hidden 属性在任何组件上都真正生效。 */
[hidden] { display: none !important; }

/* ══════════════════════════════ 登录 ══════════════════════════════ */

.pt-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 15% -10%, #e3eefc 0%, transparent 60%),
    radial-gradient(900px 480px at 90% 110%, #e7f4ee 0%, transparent 62%),
    var(--bg);
}

.pt-login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 30px 32px 24px;
}

.pt-login-brand { text-align: center; margin-bottom: 18px; }
.pt-login-brand h1 { margin: 12px 0 6px; font-size: 20px; letter-spacing: -.3px; }
.pt-login-brand p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.pt-logo {
  width: 48px; height: 48px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), #3f92e8);
  color: #fff; font-weight: 800; font-size: 16px; letter-spacing: .5px;
  box-shadow: 0 6px 18px rgba(29, 111, 212, .28);
}
.pt-logo.sm { width: 36px; height: 36px; border-radius: 10px; font-size: 13px; margin: 0; }

.pt-langs { display: flex; justify-content: flex-end; margin: 0 0 12px; }

.pt-login-card input[type=text], .pt-login-card input[type=password] {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface-2); transition: border-color .15s, background .15s;
}
.pt-login-card input:focus { outline: none; border-color: var(--primary); background: #fff; }

.pt-btn { width: 100%; padding: 11px; margin-top: 8px; font-size: 14px; }

.pt-msg { min-height: 20px; margin: 8px 0 0; font-size: 12.5px; }
.pt-msg.err { color: var(--danger); }
.pt-msg.ok { color: var(--success); }

.pt-login-foot {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--muted);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.pt-login-foot a { color: var(--primary); text-decoration: none; white-space: nowrap; }
.pt-login-foot a:hover { text-decoration: underline; }

/* ══════════════════════════════ 主体布局 ══════════════════════════════ */

.pt-app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.pt-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.2px;
  margin: 22px 0 12px;
  padding-left: 10px;
  border-left: 3px solid var(--primary);
  line-height: 1.25;
}
.pt-section-title:first-of-type { margin-top: 4px; }

.pt-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 0 14px;
  background: linear-gradient(var(--bg) 78%, rgba(241, 244, 247, 0));
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.pt-top-brand { display: flex; align-items: center; gap: 12px; }
.pt-top-brand h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.pt-top-brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.pt-top .spacer { flex: 1; }
.pt-langs-inline { display: inline-flex; align-items: center; }

/* ── 统计卡 ── */
.pt-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.pt-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.pt-stat .k { font-size: 11.5px; color: var(--muted); letter-spacing: .2px; }
.pt-stat .v { font-size: 24px; font-weight: 700; margin-top: 4px; line-height: 1.15; }
/* 金额卡：数字可能很长（含币种符号、千分位、多币种相加），字号收一档更整齐 */
.pt-stat .v.sm { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-stat.accent .v { color: var(--primary); }
.pt-stat.ok .v { color: var(--success); }
/* 待支付：用暖色提醒（已支付沿用 .ok 绿） */
.pt-stat.pending { border-left: 3px solid #e8a33d; }
.pt-stat.pending .v { color: #c07b16; }

/* ── 筛选栏 ── */
.pt-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.pt-toolbar .spacer { flex: 1; }

.pt-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pt-tab {
  padding: 6px 13px; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.pt-tab:hover { border-color: var(--primary); color: var(--primary-dark); }
.pt-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pt-tab .n { opacity: .72; margin-left: 5px; font-weight: 500; }

.pt-search {
  min-width: 220px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface);
}
.pt-search:focus { outline: none; border-color: var(--primary); }

/* ── 订单卡片 ── */
.pt-list { display: flex; flex-direction: column; gap: 12px; }

.pt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.pt-card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 22px rgba(29, 111, 212, .12);
  transform: translateY(-1px);
}

.pt-card-top { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.pt-card-top .spacer { flex: 1; }
/* 卡面首行：客户名 + 品牌名 + 采购单号/发票号 */
.pt-prod {
  font-size: 15px; font-weight: 650; letter-spacing: -.1px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pt-cust { line-height: 1.35; }
.pt-brand {
  font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pt-doc {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-size: 12px; font-weight: 650; color: var(--primary);
  background: var(--primary-soft); padding: 2px 8px; border-radius: 6px;
  max-width: 100%; overflow: hidden;
}
.pt-doc em {
  font-style: normal; font-size: 10.5px; font-weight: 500;
  color: var(--muted); white-space: nowrap;
}
/* 抽屉里的完整品名：多规格时用顿号连成一大串，允许换行完整显示 */
.pt-prod-full { white-space: pre-wrap; line-height: 1.5; word-break: break-word; }
.pt-id {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  margin-top: 3px; letter-spacing: .2px;
}

.pt-stage-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 650;
  background: var(--primary-soft); color: var(--primary-dark);
  white-space: nowrap;
}
.pt-stage-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pt-stage-pill.done { background: var(--success-soft); color: var(--success); }

/* 进度条 */
.pt-progress { margin: 14px 0 10px; }
.pt-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.pt-bar > i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #46a0f0);
  transition: width .4s ease;
}
.pt-progress.done .pt-bar > i { background: linear-gradient(90deg, var(--success), #35b36c); }

.pt-steps {
  display: flex; gap: 4px; margin-top: 9px;
  font-size: 11px; color: var(--muted);
  flex-wrap: wrap;
}
.pt-step { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.pt-step::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--border-strong); flex: none;
}
.pt-step.reached { color: var(--text-2); }
.pt-step.reached::before { background: var(--primary); }
.pt-step.current { color: var(--primary-dark); font-weight: 650; }
.pt-step.current::before { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.pt-step + .pt-step { margin-left: 2px; }

/* 卡片底部信息 */
.pt-card-meta {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-top: 12px; margin-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px; color: var(--text-2);
}
.pt-card-meta .kv { display: inline-flex; align-items: baseline; gap: 5px; }
.pt-card-meta .kv b { font-weight: 600; color: var(--text); }
.pt-card-meta .spacer { flex: 1; }

.pt-track-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
}
.pt-track-chip.live { background: var(--primary-soft); color: var(--primary-dark); }
.pt-track-chip.none { background: var(--surface-3); color: var(--muted); }

.pt-latest {
  margin-top: 10px; padding: 9px 12px;
  background: var(--surface-2); border-left: 3px solid var(--primary);
  border-radius: 0 7px 7px 0;
  font-size: 12px; color: var(--text-2);
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.pt-latest .t { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ── 空态 ── */
.pt-empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.pt-empty-icon { font-size: 40px; margin-bottom: 10px; }
.pt-empty h3 { margin: 0 0 6px; color: var(--text-2); font-size: 15px; }
.pt-empty p { margin: 0; font-size: 13px; }

.pt-foot {
  margin-top: 28px; padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--muted); text-align: center;
}

/* ══════════════════════════════ 详情抽屉 ══════════════════════════════ */

.pt-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(16, 32, 48, .38);
  backdrop-filter: blur(2px);
}

.pt-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(640px, 100vw);
  background: var(--bg);
  box-shadow: -12px 0 44px rgba(16, 32, 48, .2);
  display: flex; flex-direction: column;
  animation: pt-slide .22s ease;
}
@keyframes pt-slide { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }

.pt-drawer-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 22px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.pt-drawer-head .spacer { flex: 1; }
.pt-drawer-head h2 { margin: 0; font-size: 16px; letter-spacing: -.2px; }
.pt-drawer-head p { margin: 3px 0 0; font-size: 12px; color: var(--muted); font-family: var(--mono); }

.pt-drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }

.pt-sec { margin-bottom: 20px; }
.pt-sec-title {
  font-size: 12px; font-weight: 700; color: var(--muted);
  letter-spacing: .6px; text-transform: uppercase;
  margin: 0 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.pt-sec-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.pt-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}

.pt-def {
  display: grid; grid-template-columns: 92px 1fr; gap: 8px 14px;
  font-size: 13px;
}
.pt-def dt { color: var(--muted); font-size: 12.5px; }
.pt-def dd { margin: 0; color: var(--text); word-break: break-word; }

/* 阶段步骤条（竖版） */
.pt-flow { display: flex; flex-direction: column; }
.pt-flow-item { display: flex; gap: 12px; }
.pt-flow-rail { display: flex; flex-direction: column; align-items: center; flex: none; width: 18px; }
.pt-flow-dot {
  width: 11px; height: 11px; border-radius: 50%; margin-top: 3px;
  background: var(--surface); border: 2px solid var(--border-strong); flex: none;
}
.pt-flow-line { width: 2px; flex: 1; background: var(--border); min-height: 18px; }
.pt-flow-item:last-child .pt-flow-line { display: none; }
.pt-flow-item.reached .pt-flow-dot { background: var(--primary); border-color: var(--primary); }
.pt-flow-item.reached .pt-flow-line { background: var(--primary); }
.pt-flow-item.current .pt-flow-dot { box-shadow: 0 0 0 4px var(--primary-soft); }
.pt-flow-item.done .pt-flow-dot { background: var(--success); border-color: var(--success); }
.pt-flow-item.done .pt-flow-line { background: var(--success); }
.pt-flow-text { padding-bottom: 14px; }
.pt-flow-label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.pt-flow-item.reached .pt-flow-label { color: var(--text); }
.pt-flow-item.current .pt-flow-label { color: var(--primary-dark); }
.pt-flow-hint { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* 轨迹时间线 */
.pt-tl { display: flex; flex-direction: column; }
.pt-tl-item { display: flex; gap: 12px; }
.pt-tl-rail { display: flex; flex-direction: column; align-items: center; flex: none; width: 16px; }
.pt-tl-dot {
  width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex: none;
  background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.pt-tl-item.k-delivered .pt-tl-dot { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.pt-tl-item.k-exception .pt-tl-dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.pt-tl-item.k-pickup .pt-tl-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.pt-tl-item.k-info .pt-tl-dot { background: var(--muted); box-shadow: 0 0 0 3px var(--surface-3); }
.pt-tl-line { width: 2px; flex: 1; background: var(--border); min-height: 16px; }
.pt-tl-item:last-child .pt-tl-line { display: none; }
.pt-tl-text { padding-bottom: 16px; min-width: 0; }
.pt-tl-desc { font-size: 13.5px; font-weight: 600; color: var(--text); }
.pt-tl-item.k-exception .pt-tl-desc { color: var(--danger); }
.pt-tl-item.k-delivered .pt-tl-desc { color: var(--success); }
.pt-tl-meta {
  font-size: 11.5px; color: var(--muted); margin-top: 2px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.pt-tl-meta .loc { color: var(--text-2); }
.pt-tl-src {
  font-size: 10.5px; padding: 1px 6px; border-radius: 4px;
  background: var(--surface-3); color: var(--muted);
}

.pt-no-track {
  padding: 18px; text-align: center;
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  font-size: 12.5px; color: var(--muted); line-height: 1.6;
}

.pt-track-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.pt-track-head .spacer { flex: 1; }
.pt-copy {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--surface-3); padding: 3px 9px; border-radius: 6px;
  cursor: pointer; border: 1px solid transparent;
}
.pt-copy:hover { border-color: var(--primary); color: var(--primary-dark); }
.pt-ext { font-size: 12px; color: var(--primary); text-decoration: none; white-space: nowrap; }
.pt-ext:hover { text-decoration: underline; }

.pt-stale {
  font-size: 11px; color: var(--warn);
  background: var(--warn-soft); padding: 2px 8px; border-radius: 999px;
}

/* ══════════════════════════════ 单据与稿件 ══════════════════════════════ */

.pt-files {
  margin: 18px 0 6px; padding: 18px 20px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.pt-files-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.pt-files-head h2 { margin: 0; font-size: 15px; letter-spacing: -.2px; }
.pt-files-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }

.pt-cat-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 12px; }
.pt-cat-tab {
  border: 1px solid var(--border-strong); background: var(--surface-2);
  border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer;
  color: var(--text-2); display: inline-flex; align-items: center; gap: 6px;
}
.pt-cat-tab.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.pt-cat-tab .n {
  font-family: var(--mono); font-size: 11px; background: var(--surface-3);
  border-radius: 999px; padding: 1px 6px; color: var(--muted);
}
.pt-cat-tab.active .n { background: #fff; color: var(--primary-dark); }

.pt-file-drop {
  border: 1.5px dashed var(--border-strong); border-radius: 12px;
  padding: 20px; text-align: center; color: var(--muted);
  background: var(--surface-2); transition: border-color .15s, background .15s;
}
.pt-file-drop.over { border-color: var(--primary); background: var(--primary-soft); }
.pt-file-drop-icon {
  width: 34px; height: 34px; line-height: 32px; margin: 0 auto 8px;
  border-radius: 50%; background: var(--surface-3); font-size: 16px; color: var(--primary);
}
.pt-file-drop p { margin: 0; font-size: 13px; }
.pt-file-drop-tip { margin-top: 6px !important; font-size: 11.5px !important; color: var(--muted); }

.pt-file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.pt-file-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2);
}
.pt-file-ico {
  width: 34px; height: 34px; flex: none; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; background: var(--muted);
}
.pt-file-ico.c-po { background: #2563eb; }
.pt-file-ico.c-invoice { background: #16a34a; }
.pt-file-ico.c-contract { background: #7c3aed; }
.pt-file-ico.c-artwork { background: #ea580c; }
.pt-file-ico.c-other { background: #64748b; }
.pt-file-main { flex: 1; min-width: 0; }
.pt-file-name {
  font-size: 13.5px; font-weight: 600; word-break: break-all;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pt-file-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.pt-file-note { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.pt-file-acts { display: flex; gap: 6px; flex: none; }
.pt-file-tag {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2); font-weight: 500;
}
.pt-file-tag.order { background: var(--primary-soft); color: var(--primary-dark); }
.pt-file-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 14px 0 4px; }

/* 上传进度条 */
.pt-upload-queue { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.pt-up-item { font-size: 12.5px; color: var(--text-2); }
.pt-up-bar { height: 4px; border-radius: 999px; background: var(--surface-3); margin-top: 5px; overflow: hidden; }
.pt-up-bar > i { display: block; height: 100%; background: var(--primary); width: 0; transition: width .2s; }

/* 上传弹窗 */
.pt-modal {
  position: fixed; z-index: 60; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(460px, calc(100vw - 32px)); background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .18); display: flex; flex-direction: column;
}
.pt-modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.pt-modal-head h3 { margin: 0; font-size: 15px; }
.pt-modal-head .spacer, .pt-modal-head > div.spacer { flex: 1; }
.pt-modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.pt-modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--border);
}
.pt-up-file {
  margin: 0; font-size: 13px; font-weight: 600; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; word-break: break-all;
}
.pt-modal select, .pt-modal input[type=text] {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--surface); font-size: 13px;
}

/* ══════════════════════════════ 响应式 ══════════════════════════════ */

@media (max-width: 640px) {
  .pt-app { padding: 0 14px 30px; }
  .pt-top { gap: 8px; }
  .pt-top-brand h1 { font-size: 15px; }
  .pt-login-card { padding: 24px 20px 20px; }
  .pt-def { grid-template-columns: 1fr; gap: 2px 0; }
  .pt-def dt { margin-top: 8px; }
  .pt-search { min-width: 0; flex: 1; }
  .pt-toolbar { gap: 8px; }
  .pt-files { padding: 14px 14px 16px; }
  .pt-file-row { flex-wrap: wrap; }
  .pt-file-acts { width: 100%; justify-content: flex-end; }
}
