:root {
  --ink: #171a1f;
  --ink-soft: #343942;
  --paper: #f3f6f8;
  --surface: #ffffff;
  --line: #dbe1e6;
  --muted: #69727d;
  --cobalt: #3157d5;
  --cobalt-soft: #e8edff;
  --signal: #ff6a35;
  --signal-soft: #fff0e9;
  --success: #148564;
  --danger: #c03b3b;
  --shadow: 0 20px 55px rgba(29, 39, 51, .10);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(49, 87, 213, .28); outline-offset: 2px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
[hidden] { display: none !important; }
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 14% 14%, rgba(49, 87, 213, .12), transparent 34%),
    radial-gradient(circle at 86% 82%, rgba(255, 106, 53, .12), transparent 30%),
    var(--paper);
}
.auth-panel {
  width: min(430px, 100%);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.auth-panel h1 { margin: 8px 0 9px; font: 800 38px/1 "Bahnschrift Condensed", "Microsoft YaHei UI", sans-serif; }
.auth-panel > p { margin: 0 0 25px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.auth-form { display: grid; gap: 15px; }
.auth-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.auth-form .button { width: 100%; margin-top: 3px; }
.signed-user { align-self: center; padding: 0 5px; color: var(--muted); font: 700 12px Consolas, monospace; }
.target-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 24px 22px;
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
}
.brand-mark {
  font: 800 24px/1 "Bahnschrift Condensed", "Arial Narrow", sans-serif;
  letter-spacing: .08em;
}
.brand-mark span { margin-left: 7px; color: var(--signal); font-size: 13px; vertical-align: 4px; }
.target-copy { margin-top: 55px; }
.eyebrow { display: block; color: var(--muted); font: 700 11px/1.4 Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; }
.target-rail .eyebrow { color: #9ca6b3; }
.target-copy strong { display: inline-block; margin-top: 8px; font: 800 76px/.9 "Bahnschrift Condensed", sans-serif; }
.target-denominator { color: #9ca6b3; font: 600 20px/1 Consolas, monospace; }
.signal-meter {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px 7px;
  align-content: start;
}
.signal-meter i { height: 5px; background: #3b4048; border-radius: 1px; transition: background .25s, transform .25s; }
.signal-meter i.on { background: var(--signal); transform: scaleX(1.08); }
.rail-note { margin-top: auto; color: #aab2bc; font-size: 12px; line-height: 1.7; }

main { min-width: 0; padding: 36px 42px 48px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.topbar h1 { margin: 5px 0 6px; font: 800 clamp(34px, 4vw, 58px)/.98 "Bahnschrift Condensed", "Microsoft YaHei UI", sans-serif; letter-spacing: -.025em; }
.topbar p { margin: 0; color: var(--muted); font-size: 14px; }
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.button {
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}
.button-primary { background: var(--ink); color: #fff; }
.button-primary:hover { background: var(--signal); }
.button-quiet { background: var(--surface); border-color: var(--line); }
.button-quiet:hover { border-color: #aab4be; background: #fdfefe; }

.pulse-strip {
  margin: 34px 0 22px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: var(--surface);
}
.pulse-strip article { min-height: 104px; padding: 18px 20px; border-right: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; align-content: space-between; }
.pulse-strip article:last-child { border-right: 0; }
.pulse-strip span, .pulse-strip small { color: var(--muted); font-size: 12px; }
.pulse-strip strong { grid-row: span 2; font: 800 42px/1 "Bahnschrift Condensed", sans-serif; }
.pulse-strip .pulse-alert strong { color: var(--signal); }

.workbench { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.filters { padding: 16px 18px; display: flex; align-items: flex-end; gap: 12px; border-bottom: 1px solid var(--line); }
.filters label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.filters .search-box { flex: 1; min-width: 240px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}
input:focus, select:focus, textarea:focus { border-color: var(--cobalt); outline: none; box-shadow: 0 0 0 3px rgba(49, 87, 213, .12); }
textarea { resize: vertical; min-height: 76px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1320px; }
th { padding: 12px 16px; color: var(--muted); background: #f8fafb; border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; letter-spacing: .04em; }
td { padding: 16px; border-bottom: 1px solid #e8ecef; vertical-align: top; font-size: 13px; }
tr[data-id] { cursor: pointer; }
tr[data-id]:hover td { background: #fafcfd; }
.company-cell { min-width: 210px; }
.company-cell strong { display: block; font-size: 14px; }
.company-cell a, .source-link { color: var(--cobalt); text-decoration: none; font-size: 11px; }
.company-cell code { display: block; margin-top: 8px; color: #89929c; font: 11px Consolas, monospace; }
.evidence-cell { max-width: 330px; color: var(--ink-soft); line-height: 1.55; }
.evidence-cell .weak { color: #9aa2ab; }
.procurement-cell { min-width: 290px; max-width: 380px; color: var(--ink-soft); line-height: 1.5; }
.procurement-cell strong { display: block; color: var(--ink); font-size: 13px; }
.procurement-cell .weak { color: #9aa2ab; }
.procurement-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.procurement-meta span { padding: 3px 6px; border-radius: 4px; background: #f0f3f5; color: var(--muted); font-size: 10px; }
.inline-details { margin-top: 9px; padding: 0; border: 0; background: transparent; color: var(--cobalt); cursor: pointer; font-size: 11px; font-weight: 700; }
.inline-details:hover { text-decoration: underline; }
.next-cell { min-width: 190px; }
.next-cell time { display: block; margin-top: 5px; color: var(--signal); font: 11px Consolas, monospace; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-candidate { background: #eef1f3; color: #65707b; }
.status-valid { background: var(--cobalt-soft); color: var(--cobalt); }
.status-qualified { background: #e4f6ef; color: var(--success); }
.status-opportunity { background: var(--signal-soft); color: #c44a1f; }
.status-won { background: #dff4ea; color: #0b7255; }
.status-lost, .status-disqualified { background: #f5e9e9; color: var(--danger); }
.report-pill { color: var(--muted); font: 11px Consolas, monospace; }
.report-pill.sent { color: var(--success); font-weight: 800; }
.empty-state { padding: 64px 24px; text-align: center; color: var(--muted); }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { color: var(--ink); margin-bottom: 7px; }

dialog { width: min(850px, calc(100vw - 30px)); max-height: calc(100vh - 30px); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 30px 90px rgba(20, 29, 39, .28); overflow: auto; }
dialog::backdrop { background: rgba(20, 25, 32, .58); backdrop-filter: blur(4px); }
#leadForm { padding: 25px; }
.password-dialog { width: min(520px, calc(100vw - 30px)); }
#passwordForm { padding: 25px; }
.password-help { margin: -6px 0 20px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.password-policy { margin-top: 13px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.dialog-head h2 { margin: 4px 0 0; font: 800 34px/1 "Bahnschrift Condensed", sans-serif; }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #eef1f3; color: var(--ink); font-size: 24px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.span-2 { grid-column: span 2; }
.form-divider { margin-top: 7px; padding: 13px 0 2px; border-top: 1px solid var(--line); color: var(--ink); font: 800 12px Consolas, monospace; letter-spacing: .08em; }
.check-row { display: flex !important; grid-template-columns: none !important; flex-direction: row; align-items: center; gap: 9px !important; }
.check-row input { width: auto; }
.form-error { min-height: 20px; margin-top: 13px; color: var(--danger); font-size: 12px; }
.dialog-actions { display: flex; align-items: center; gap: 10px; padding-top: 10px; }
.dialog-spacer { flex: 1; }
.toast { position: fixed; right: 28px; bottom: 28px; z-index: 20; transform: translateY(22px); opacity: 0; pointer-events: none; padding: 13px 16px; border-radius: 7px; background: var(--ink); color: #fff; font-size: 13px; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .target-rail { position: static; height: auto; min-height: 0; display: grid; grid-template-columns: auto 1fr; gap: 14px 24px; }
  .target-copy { margin: 0; text-align: right; }
  .target-copy strong { font-size: 48px; }
  .signal-meter { grid-column: 1 / -1; grid-template-columns: repeat(20, 1fr); margin-top: 4px; }
  .rail-note { grid-column: 1 / -1; margin-top: 2px; }
  main { padding: 28px 18px 36px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .pulse-strip { grid-template-columns: 1fr 1fr; }
  .pulse-strip article:nth-child(2) { border-right: 0; }
  .pulse-strip article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 620px) {
  .filters { align-items: stretch; flex-direction: column; }
  .filters .search-box { min-width: 0; width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .pulse-strip { grid-template-columns: 1fr; }
  .pulse-strip article { border-right: 0; border-bottom: 1px solid var(--line); }
  .pulse-strip article:last-child { border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
