:root {
  --orange: #ff6a00;
  --orange-strong: #ef4d00;
  --orange-soft: #fff2e9;
  --ink: #172033;
  --muted: #6e7786;
  --line: #e7e9ee;
  --surface: #ffffff;
  --canvas: #f5f6f8;
  --green: #1e9b63;
  --blue: #2878f0;
  --amber: #c47b00;
  --red: #d63d3d;
  --shadow: 0 8px 26px rgba(31, 42, 64, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }

html, body, #app { min-height: 100%; margin: 0; }

body { background: var(--canvas); }

button, input, select { font: inherit; }

button { cursor: pointer; }

button:disabled { cursor: not-allowed; opacity: 0.5; }

.login-screen {
  align-items: center;
  background:
    radial-gradient(circle at 14% 17%, rgba(255, 113, 23, 0.18), transparent 32rem),
    radial-gradient(circle at 90% 80%, rgba(255, 157, 36, 0.14), transparent 28rem),
    #fbfbfc;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(231, 233, 238, 0.9);
  border-radius: 22px;
  box-shadow: 0 22px 60px rgba(35, 42, 58, 0.12);
  max-width: 440px;
  padding: 38px;
  width: 100%;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(135deg, #ff7b19, #f04e18);
  border-radius: 12px;
  color: #fff;
  display: inline-flex;
  font-size: 22px;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  letter-spacing: -1px;
  width: 56px;
}

.brand-copy strong { display: block; font-size: 17px; letter-spacing: 0.01em; }
.brand-copy span { color: var(--muted); display: block; font-size: 12px; margin-top: 2px; }

.login-card h1 { font-size: 27px; letter-spacing: -0.03em; margin: 32px 0 8px; }
.login-card > p { color: var(--muted); font-size: 14px; line-height: 1.7; margin: 0 0 28px; }

.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { color: #384152; font-size: 13px; font-weight: 650; }
.field small { color: var(--muted); font-size: 12px; line-height: 1.5; }

input, select {
  background: #fff;
  border: 1px solid #d9dde5;
  border-radius: 10px;
  color: var(--ink);
  min-height: 42px;
  outline: none;
  padding: 0 12px;
  transition: border-color .16s, box-shadow .16s;
  width: 100%;
}

input:focus, select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 106, 0, .12);
}

.login-note {
  align-items: flex-start;
  background: var(--orange-soft);
  border-radius: 10px;
  color: #90500d;
  display: flex;
  font-size: 12px;
  gap: 8px;
  line-height: 1.55;
  margin-top: 18px;
  padding: 11px 12px;
}

.app-shell { min-height: 100vh; }

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 68px;
  justify-content: space-between;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .brand-mark { border-radius: 9px; font-size: 18px; height: 34px; width: 46px; }
.topbar .brand-copy strong { font-size: 15px; }

.topbar-right, .user-chip, .runtime-control { align-items: center; display: flex; gap: 12px; }

.runtime-control {
  background: #f7f8fa;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 5px 4px 11px;
}

.runtime-control button {
  background: #fff;
  border: 1px solid #dfe3e9;
  border-radius: 999px;
  color: #3a4454;
  font-size: 12px;
  padding: 5px 9px;
}

.runtime-control[data-mode="demo"] { background: #fff8e9; color: #9b6504; }
.runtime-control[data-mode="live"] { background: #edf8f2; color: #14754a; }

.user-avatar {
  align-items: center;
  background: #eaf1ff;
  border-radius: 50%;
  color: #2965ce;
  display: flex;
  font-size: 12px;
  font-weight: 750;
  height: 30px;
  justify-content: center;
  width: 30px;
}
.user-chip span { font-size: 13px; font-weight: 600; }

.text-button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  padding: 6px;
}
.text-button:hover { color: var(--orange-strong); }

.workspace { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 68px); }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
}

.side-heading {
  color: #384152;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .01em;
  margin: 2px 7px 12px;
}

.create-card {
  background: linear-gradient(145deg, #fff9f4, #fff);
  border: 1px solid #fde1cd;
  border-radius: 14px;
  margin-bottom: 24px;
  padding: 15px;
}

.create-card p { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 0 0 12px; }
.create-card .field { margin-bottom: 12px; }

.primary-button, .secondary-button, .danger-button {
  align-items: center;
  border-radius: 9px;
  border: 1px solid transparent;
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  gap: 7px;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  transition: transform .15s, background .15s, border-color .15s;
}

.primary-button { background: var(--orange); color: #fff; width: 100%; }
.primary-button:hover:not(:disabled) { background: var(--orange-strong); transform: translateY(-1px); }
.secondary-button { background: #fff; border-color: #dce1e8; color: #354052; }
.secondary-button:hover:not(:disabled) { background: #f7f8fa; border-color: #cbd2dd; }
.danger-button { background: #fff3f3; border-color: #f4d2d2; color: var(--red); }

.task-nav { display: grid; gap: 6px; }
.task-nav-header { align-items: center; display: flex; justify-content: space-between; margin: 0 7px 8px; }
.task-nav-header .side-heading { margin: 0; }
.task-count { color: var(--muted); font-size: 12px; }

.task-nav-item {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  display: grid;
  gap: 5px;
  padding: 10px 11px;
  text-align: left;
  width: 100%;
}
.task-nav-item:hover { background: #f8f9fb; }
.task-nav-item.active { background: var(--orange-soft); border-color: #ffdfc7; }
.task-nav-item-top { align-items: center; display: flex; gap: 8px; justify-content: space-between; }
.task-nav-item strong { color: #30394a; font-size: 12px; max-width: 164px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-nav-item small { color: #8a93a1; font-size: 11px; }

.status-dot { border-radius: 50%; display: inline-block; height: 7px; width: 7px; }
.status-dot.waiting, .status-dot.quoting { background: #ef9b19; }
.status-dot.running { background: var(--blue); }
.status-dot.done { background: var(--green); }
.status-dot.failed { background: var(--red); }

.content { padding: 28px clamp(20px, 3vw, 46px) 56px; }
.content-inner { margin: 0 auto; max-width: 1260px; }

.page-title-row { align-items: flex-start; display: flex; gap: 18px; justify-content: space-between; margin-bottom: 24px; }
.page-title-row h1 { font-size: 24px; letter-spacing: -.025em; margin: 0 0 7px; }
.page-title-row p { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0; }
.title-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.panel-header { align-items: center; border-bottom: 1px solid #eef0f3; display: flex; gap: 10px; justify-content: space-between; padding: 17px 19px; }
.panel-header h2 { font-size: 15px; letter-spacing: -.01em; margin: 0; }
.panel-body { padding: 19px; }

.empty-state {
  align-items: center;
  background: var(--surface);
  border: 1px dashed #d9dee7;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 360px;
  padding: 32px;
  text-align: center;
}
.empty-icon { align-items: center; background: var(--orange-soft); border-radius: 50%; color: var(--orange); display: flex; font-size: 25px; height: 64px; justify-content: center; width: 64px; }
.empty-state h1 { font-size: 19px; margin: 17px 0 8px; }
.empty-state p { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0; max-width: 390px; }

.status-badge { align-items: center; border-radius: 999px; display: inline-flex; font-size: 12px; font-weight: 700; gap: 6px; padding: 5px 9px; white-space: nowrap; }
.status-badge.waiting { background: #fff7e8; color: #a56900; }
.status-badge.running { background: #edf4ff; color: #2167c8; }
.status-badge.done { background: #eaf8f1; color: #177a4d; }
.status-badge.failed { background: #fff1f1; color: #bd3838; }

.task-summary { display: grid; gap: 12px; grid-template-columns: 106px minmax(0, 1fr); }
.image-placeholder, .offer-image {
  align-items: center;
  background: linear-gradient(135deg, #f4f5f6, #e8eaee);
  border-radius: 11px;
  color: #7d8796;
  display: flex;
  font-size: 12px;
  justify-content: center;
  overflow: hidden;
}
.image-placeholder { height: 106px; width: 106px; }
.image-placeholder img, .offer-image img { height: 100%; object-fit: cover; width: 100%; }
.task-meta { min-width: 0; }
.task-meta h3 { font-size: 15px; margin: 1px 0 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta dl { display: grid; gap: 7px; margin: 0; }
.task-meta dl div { display: grid; gap: 8px; grid-template-columns: 72px minmax(0, 1fr); }
.task-meta dt { color: #88919f; font-size: 12px; }
.task-meta dd { color: #455062; font-size: 12px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.flow { display: grid; gap: 0; grid-template-columns: repeat(5, minmax(120px, 1fr)); padding: 7px 0; }
.flow-step { min-width: 0; position: relative; text-align: center; }
.flow-step:not(:last-child)::after { background: #e1e5eb; content: ""; height: 2px; left: calc(50% + 18px); position: absolute; right: calc(-50% + 18px); top: 14px; }
.flow-step.active:not(:last-child)::after, .flow-step.complete:not(:last-child)::after { background: #ffb47f; }
.step-marker { align-items: center; background: #eef0f3; border-radius: 50%; color: #8e97a4; display: flex; font-size: 12px; font-weight: 700; height: 30px; justify-content: center; margin: 0 auto 8px; position: relative; width: 30px; z-index: 1; }
.flow-step.active .step-marker { background: var(--orange); color: #fff; box-shadow: 0 0 0 5px var(--orange-soft); }
.flow-step.complete .step-marker { background: #54b785; color: #fff; }
.flow-step b { color: #5d6674; display: block; font-size: 12px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-step.active b { color: var(--orange-strong); }

.notice {
  align-items: flex-start;
  border-radius: 10px;
  display: flex;
  font-size: 13px;
  gap: 10px;
  line-height: 1.55;
  padding: 12px 13px;
}
.notice.info { background: #f0f6ff; color: #285d9e; }
.notice.warning { background: #fff7e8; color: #99640e; }
.notice.error { background: #fff2f2; color: #af3535; }
.notice.success { background: #eef9f3; color: #197c4c; }
.notice strong { font-size: 13px; }

.login-card-task { align-items: center; display: flex; gap: 18px; justify-content: space-between; }
.login-card-task p { color: var(--muted); font-size: 13px; line-height: 1.55; margin: 5px 0 0; }
.login-card-task .primary-button { min-width: 148px; width: auto; }
.tiny-label { color: #798392; font-size: 12px; font-weight: 650; }

.candidate-grid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); }
.candidate-card { border: 1px solid #e5e8ed; border-radius: 13px; min-width: 0; overflow: hidden; transition: box-shadow .15s, border-color .15s; }
.candidate-card:hover { border-color: #f7c49f; box-shadow: 0 7px 16px rgba(36, 46, 65, .07); }
.candidate-card.selected { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(255, 106, 0, .12); }
.candidate-top { display: grid; gap: 12px; grid-template-columns: 80px minmax(0, 1fr); padding: 14px; }
.offer-image { height: 80px; width: 80px; }
.candidate-top h3 { -webkit-box-orient: vertical; -webkit-line-clamp: 2; display: -webkit-box; font-size: 13px; line-height: 1.45; margin: 0 0 7px; overflow: hidden; }
.candidate-top h3 a { color: #2d3748; text-decoration: none; }
.candidate-top h3 a:hover { color: var(--orange-strong); }
.supplier { color: #798392; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.candidate-stats { display: grid; gap: 6px; grid-template-columns: repeat(3, 1fr); margin-top: 9px; }
.candidate-stats span { color: #798392; font-size: 11px; }
.candidate-stats strong { color: #3a4555; display: block; font-size: 12px; font-weight: 700; margin-top: 2px; }
.candidate-stats strong.price { color: var(--orange-strong); font-size: 15px; }
.quote-area { background: #fafbfc; border-top: 1px solid #edf0f3; padding: 13px 14px; }
.quote-row { align-items: end; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr) 74px auto; }
.quote-row .field { gap: 4px; margin: 0; }
.quote-row .field label { color: #7d8795; font-size: 11px; }
.quote-row input, .quote-row select { min-height: 34px; padding: 0 8px; }
.quote-button { min-height: 34px; padding: 0 10px; white-space: nowrap; }
.quote-result { align-items: center; display: flex; gap: 7px; justify-content: space-between; margin-top: 11px; }
.quote-result .freight { color: #3c4859; font-size: 12px; }
.quote-result .freight strong { color: var(--orange-strong); font-size: 15px; margin-left: 4px; }
.quote-detail { color: #84909f; font-size: 11px; margin-top: 5px; }
.quote-pending { color: #9a6505; font-size: 12px; }
.quote-unavailable { color: #a64747; font-size: 12px; }

.events { display: grid; gap: 0; }
.event { border-left: 2px solid #e4e8ed; display: grid; gap: 3px; margin-left: 6px; padding: 0 0 14px 14px; position: relative; }
.event::before { background: #aeb7c3; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #dbe0e7; content: ""; height: 7px; left: -5px; position: absolute; top: 2px; width: 7px; }
.event:last-child { border-color: transparent; padding-bottom: 0; }
.event b { color: #536071; font-size: 12px; }
.event span { color: #8a94a2; font-size: 11px; }

.api-hint { color: #8993a1; font-size: 11px; line-height: 1.55; margin: 10px 0 0; }
.api-hint code { background: #f1f3f6; border-radius: 4px; color: #596475; padding: 1px 4px; }

.toast-stack { bottom: 22px; display: grid; gap: 9px; position: fixed; right: 22px; width: min(360px, calc(100vw - 44px)); z-index: 50; }
.toast { animation: enter .2s ease-out; background: #273140; border-radius: 10px; box-shadow: 0 8px 24px rgba(17, 25, 38, .24); color: #fff; font-size: 13px; line-height: 1.5; padding: 11px 13px; }
.toast.error { background: #a33a3a; }
.toast.success { background: #1f8053; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.viewer-page { align-items: center; background: #171b23; color: #fff; display: flex; justify-content: center; min-height: 100vh; padding: 24px; }
.viewer-card { background: #fff; border-radius: 18px; box-shadow: 0 18px 55px rgba(0,0,0,.28); color: var(--ink); max-width: 620px; overflow: hidden; width: 100%; }
.viewer-head { align-items: center; background: #fff7f1; border-bottom: 1px solid #fee2d0; display: flex; gap: 10px; padding: 18px 22px; }
.viewer-body { padding: 30px; text-align: center; }
.viewer-body h1 { font-size: 21px; margin: 0 0 9px; }
.viewer-body p { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0 auto 24px; max-width: 430px; }
.fake-qr { background-color: #fff; background-image: linear-gradient(90deg, #1b1f25 10%, transparent 10%, transparent 50%, #1b1f25 50%, #1b1f25 60%, transparent 60%), linear-gradient(#1b1f25 10%, transparent 10%, transparent 50%, #1b1f25 50%, #1b1f25 60%, transparent 60%); background-size: 12px 12px; border: 10px solid #fff; box-shadow: 0 0 0 1px #e1e5ea; height: 184px; margin: 0 auto 24px; width: 184px; }
.viewer-safety { background: #f6f7f9; border-radius: 10px; color: #667181; font-size: 12px; line-height: 1.5; margin: 20px auto 0; max-width: 460px; padding: 10px; }

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar { border-bottom: 1px solid var(--line); border-right: 0; }
  .task-nav { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .create-card { max-width: 620px; }
  .flow { grid-template-columns: repeat(5, 1fr); overflow-x: auto; }
  .flow-step { min-width: 112px; }
}

@media (max-width: 620px) {
  .topbar { height: auto; min-height: 64px; padding: 12px 15px; }
  .topbar-right { gap: 7px; }
  .runtime-control { display: none; }
  .user-chip span, .topbar .brand-copy span { display: none; }
  .workspace { min-height: calc(100vh - 64px); }
  .content { padding: 22px 15px 45px; }
  .page-title-row, .login-card-task { align-items: stretch; flex-direction: column; }
  .title-actions { justify-content: flex-start; }
  .login-card-task .primary-button { width: 100%; }
  .task-summary { grid-template-columns: 78px minmax(0, 1fr); }
  .image-placeholder { height: 78px; width: 78px; }
  .candidate-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 23px; }
}
