:root {
  --ink: #1c2b29;
  --muted: #5b6b68;
  --paper: #eef2f0;
  --card: #fffcf7;
  --line: #d9d2c5;
  --teal: #1f4d4a;
  --teal-2: #2f6f6a;
  --gold: #c4a35a;
  --danger: #9b3a32;
  --ok: #2e6b45;
  --warn: #a06b12;
  --proc: #2563eb;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
.hidden { display: none !important; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--teal);
  color: #f7f3ea;
}
.brand { display: flex; gap: 14px; align-items: center; }
.mark { border: 1px solid #d7c48a; color: #f0e2b8; padding: 6px 10px; font-size: 11px; }
.top h1 { margin: 0; font-size: 20px; }
.top p { margin: 2px 0 0; opacity: 0.85; font-size: 13px; }
nav button, .btn {
  border: 1px solid #d7c48a;
  background: transparent;
  color: #f7f3ea;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
nav button.active { background: var(--gold); color: #1b1b1b; }
.btn { background: #fff; color: var(--teal); border-color: var(--line); }
.btn.primary { background: var(--gold); color: #1b1b1b; border-color: #b0893a; }
.btn.large { padding: 12px 24px; font-size: 16px; }
main { max-width: 1480px; margin: 0 auto; padding: 20px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 6px 20px rgba(31, 77, 74, 0.06);
}
.upload-hero { max-width: 680px; margin: 40px auto; text-align: center; }
.upload-hero h2 { font-size: 24px; color: var(--teal); margin-bottom: 8px; }
.lead { color: var(--muted); line-height: 1.5; }
.dropzone {
  border: 2px dashed #b7c4c1;
  border-radius: 12px;
  padding: 40px 20px;
  margin: 24px 0;
  background: #f8fbf9;
}
.dropzone.drag { border-color: var(--teal); background: #eaf3f1; }
.dz-icon {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--teal);
  border: 2px solid var(--teal);
  display: inline-block;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.drop-title { font-size: 18px; margin: 0 0 8px; }
.hint { color: var(--muted); font-size: 13px; }
.hint.sub { margin: 0 0 8px; }
.file-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: left;
  margin: 20px 0;
}
.file-info-grid span { display: block; font-size: 12px; color: var(--muted); }
.error { color: var(--danger); margin-top: 12px; }

.dashboard {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  gap: 16px;
  min-height: calc(100vh - 120px);
}
.panel h3 { margin: 0 0 12px; font-size: 15px; color: var(--teal); }
.section-title { margin-top: 20px; }
.progress-big { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.bar { height: 8px; background: #e5e0d6; border-radius: 99px; overflow: hidden; }
.bar.lg { height: 12px; margin-bottom: 16px; }
.bar div { height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold)); width: 0; transition: width 0.4s; }
.stat-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #eee; font-size: 13px; }
.phase-tag {
  margin-top: 12px;
  display: inline-block;
  padding: 4px 10px;
  background: #e8f0ef;
  border-radius: 6px;
  font-size: 12px;
}

.worker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}
.worker-slot {
  border: 1px solid #dbeafe;
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px;
  min-height: 88px;
  font-size: 12px;
}
.worker-slot.active {
  background: #eff6ff;
  cursor: pointer;
  animation: pulse 1.8s infinite;
}
.worker-slot.active:hover { border-color: var(--teal); }
.worker-slot.idle {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  border-style: dashed;
}
.worker-slot-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.worker-num { font-weight: 700; color: var(--teal); }
.worker-phase { color: var(--muted); font-size: 11px; }
.worker-title { font-size: 12px; line-height: 1.35; margin-bottom: 6px; max-height: 2.7em; overflow: hidden; }
.worker-status { font-size: 11px; color: var(--proc); }
.worker-status.muted { color: var(--muted); }
@keyframes pulse { 50% { opacity: 0.75; } }

.detail-root { font-size: 14px; line-height: 1.45; max-height: 42vh; overflow-y: auto; }
.detail-head h4 { margin: 4px 0 8px; }
.kp-row { display: flex; gap: 20px; margin: 12px 0; font-size: 13px; flex-wrap: wrap; }
.detail-block { margin: 14px 0; padding-top: 10px; border-top: 1px solid #eee; }
.detail-block h5 { margin: 0 0 6px; font-size: 13px; color: var(--teal); }
.detail-block ul { margin: 0; padding-left: 18px; }
.detail-block p { margin: 4px 0; }
.r-val { font-weight: 600; font-size: 16px; }
.status-pill {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  background: #eef6f4;
  border-radius: 6px;
  font-size: 12px;
}
.processing-hint { color: var(--proc); font-weight: 500; }

.attention-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px solid #f0e6c8;
}
.attention-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.attention-item {
  text-align: left;
  border: 1px solid #f0d9a8;
  background: #fffbf0;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 12px;
}
.attention-item span { display: block; }
.attention-item small { color: var(--muted); }

.pub-list { max-height: calc(100vh - 260px); overflow-y: auto; }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}
.pub-item {
  display: flex;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 1px solid #eee;
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 12px;
}
.pub-item.selected { border-color: var(--teal); background: #f0f7f6; }
.pub-item.pending { opacity: 0.65; cursor: default; }
.pub-item.processing { border-color: #93c5fd; }
.pub-item.attention { border-color: var(--warn); }
.pub-item.error { border-color: var(--danger); }
.pub-icon { font-size: 16px; flex-shrink: 0; }
.pub-body strong { color: var(--teal); }
.filter-select { font-size: 12px; padding: 4px 8px; border-radius: 6px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.finish-card { max-width: 760px; margin: 40px auto; text-align: center; }
.finish-progress { margin: 16px 0 24px; }
.finish-progress p { margin: 8px 0 0; font-weight: 600; color: var(--teal); }
.finish-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 24px 0;
}
.finish-kpi span { display: block; font-size: 12px; color: var(--muted); }
.finish-kpi strong { font-size: 22px; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.finish-manual-dist { margin-top: 24px; text-align: left; }
.finish-manual-dist h3 { font-size: 15px; margin: 0 0 8px; color: var(--teal); }
.mini-table { width: 100%; max-width: 520px; margin: 0 auto; font-size: 13px; }
.manual-reason { border-left: 3px solid var(--warn); padding-left: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid #eee; padding: 8px; text-align: left; vertical-align: top; }
.reason { max-width: 360px; }
@media (max-width: 1100px) {
  .dashboard { grid-template-columns: 1fr; }
  .worker-grid { grid-template-columns: 1fr; }
  .finish-grid { grid-template-columns: repeat(2, 1fr); }
}
