/* PLM 工作台视觉：与工具台浅色风格一致的现代化企业应用界面 */
:root {
  --p: #4f46e5; --p-dark: #4338ca; --p-light: #eef2ff;
  --bg: #f5f7fb; --card: #fff; --line: #e7ebf3;
  --txt: #1e293b; --muted: #64748b;
  --green: #059669; --amber: #d97706; --red: #dc2626; --blue: #2563eb;
}
body { background: var(--bg); color: var(--txt); }
#app { max-width: 1320px; }
#view { max-width: none; padding: 16px 18px 48px; }
.topbar { position: sticky; top: 0; z-index: 20; }

.plm-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.plm-identity { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--card); padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.plm-identity label { font-size: 12px; color: var(--muted); }
.plm-identity input { width: 170px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; outline: none; }
.plm-identity input:focus { border-color: var(--p); box-shadow: 0 0 0 3px var(--p-light); }
.plm-hint { font-size: 12px; color: var(--muted); line-height: 1.6; }

.plm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.stat-card .k { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.stat-card .v { font-size: 25px; font-weight: 700; letter-spacing: -.5px; }
.stat-card .v small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 4px; }

.plm-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.plm-tab { flex: 0 0 auto; padding: 10px 16px; font-size: 14px; color: var(--muted); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.plm-tab:hover { color: var(--p); }
.plm-tab.on { color: var(--p); font-weight: 600; border-bottom-color: var(--p); }

.plm-panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: 0 1px 3px rgba(15,23,42,.04); min-height: 320px; }
.plm-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.plm-toolbar .grow { flex: 1; }
.plm-title { font-size: 16px; font-weight: 700; margin: 0 8px 0 0; }
.plm-desc { font-size: 12px; color: var(--muted); margin: -6px 0 14px; line-height: 1.7; }
.plm-desc code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }

.pbtn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 14px; font-size: 13px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--txt); cursor: pointer; text-decoration: none; transition: .15s; }
.pbtn:hover { border-color: var(--p); color: var(--p); }
.pbtn.primary { background: var(--p); border-color: var(--p); color: #fff; }
.pbtn.primary:hover { background: var(--p-dark); color: #fff; }
.pbtn.danger { color: var(--red); border-color: #fecaca; }
.pbtn.danger:hover { background: #fef2f2; }
.pbtn.ghost { background: var(--p-light); border-color: transparent; color: var(--p-dark); }
.pbtn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.pbtn:disabled { opacity: .45; cursor: not-allowed; }
.pbtn.mini-input { padding: 7px 10px; }

.plm-input, .plm-select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; outline: none; background: #fff; }
.plm-input:focus, .plm-select:focus { border-color: var(--p); box-shadow: 0 0 0 3px var(--p-light); }

.plm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.plm-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; background: #f8fafc; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.plm-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.plm-table tr:last-child td { border-bottom: none; }
.plm-table tbody tr:hover { background: #fafbff; }
.plm-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.plm-table .acts { white-space: nowrap; text-align: right; }
.plm-table .link { color: var(--p); cursor: pointer; text-decoration: none; font-weight: 600; }
.plm-table .link:hover { text-decoration: underline; }
.plm-scroll { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 9px; font-size: 11px; border-radius: 999px; background: #f1f5f9; color: var(--muted); white-space: nowrap; }
.b-green { background: #d1fae5; color: var(--green); }
.b-amber { background: #fef3c7; color: var(--amber); }
.b-red { background: #fee2e2; color: var(--red); }
.b-blue { background: #dbeafe; color: var(--blue); }
.b-purple { background: #ede9fe; color: var(--p-dark); }

.progress { display: inline-flex; align-items: center; gap: 8px; min-width: 110px; }
.progress > i { display: block; flex: 1; height: 6px; border-radius: 99px; background: #e9edf5; overflow: hidden; font-style: normal; }
.progress > i > b { display: block; height: 100%; background: var(--p); border-radius: 99px; }
.progress > span { font-size: 12px; color: var(--muted); width: 34px; text-align: right; }

.plm-empty { text-align: center; padding: 48px 12px; color: var(--muted); font-size: 13px; }
.plm-empty .big { font-size: 30px; display: block; margin-bottom: 10px; opacity: .6; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kv-row { background: #f8fafc; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; }
.kv-row .k { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.kv-row .v { font-size: 14px; font-weight: 600; word-break: break-all; }

.timeline { border-left: 2px solid var(--p-light); margin-left: 8px; padding-left: 16px; }
.tl-item { position: relative; padding-bottom: 14px; font-size: 13px; }
.tl-item::before { content: ''; position: absolute; left: -22px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--p); box-shadow: 0 0 0 3px var(--p-light); }
.tl-item .t { color: var(--muted); font-size: 11px; margin-top: 3px; }

.plm-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 14px; overflow-y: auto; }
.plm-dialog { background: #fff; width: min(680px, 100%); border-radius: 16px; box-shadow: 0 20px 50px rgba(15,23,42,.25); overflow: hidden; }
.plm-dialog.wide { width: min(880px, 100%); }
.plm-dialog > header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 700; }
.plm-dialog > header .x { cursor: pointer; font-size: 22px; line-height: 1; color: var(--muted); border: none; background: none; }
.plm-body { padding: 18px 20px; max-height: 68vh; overflow-y: auto; }
.plm-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fbfcff; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.fi { display: flex; flex-direction: column; gap: 5px; }
.fi.wide { grid-column: 1 / -1; }
.fi label { font-size: 12px; color: var(--muted); font-weight: 600; }
.fi input, .fi select, .fi textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; outline: none; font-family: inherit; box-sizing: border-box; }
.fi input:focus, .fi select:focus, .fi textarea:focus { border-color: var(--p); box-shadow: 0 0 0 3px var(--p-light); }
.fi textarea { min-height: 76px; resize: vertical; }
.fi .tip { font-size: 11px; color: var(--muted); line-height: 1.5; }
.fi input[type=file] { padding: 7px; }

.plm-note { background: var(--p-light); border-left: 3px solid var(--p); border-radius: 6px; padding: 10px 12px; font-size: 12px; color: var(--p-dark); line-height: 1.7; margin-bottom: 14px; }
.plm-section-title { font-size: 13px; font-weight: 700; margin: 18px 0 10px; padding-left: 8px; border-left: 3px solid var(--p); }
.plm-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.plm-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.plm-mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

@media (max-width: 640px) {
  #view { padding: 12px 10px 36px; }
  .plm-panel { padding: 12px; }
  .plm-stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
