:root {
  --ink: #102535;
  --ink-2: #2f4a60;
  --muted: #6d8192;
  --muted-2: #8ca0b1;
  --line: #d7e2ea;
  --line-soft: #e8eff4;
  --bg: #edf2f5;
  --panel: #ffffff;
  --navy: #0b2233;
  --navy-2: #123a4c;
  --teal: #0b7671;
  --teal-2: #12a49a;
  --teal-soft: #e6f5f2;
  --amber: #a76312;
  --amber-soft: #fdf3e2;
  --red: #b03830;
  --red-soft: #fbecea;
  --blue: #2c608a;
  --blue-soft: #eaf2f8;
  --shadow-sm: 0 1px 2px rgba(16, 37, 53, 0.05);
  --shadow: 0 12px 36px rgba(16, 37, 53, 0.12);
  --mono: "Consolas", "SFMono-Regular", "Cascadia Mono", monospace;
  --sans: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 8% -10%, rgba(18, 164, 154, 0.12), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(44, 96, 138, 0.10), transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding-left: 18px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* ---------------- top bar ---------------- */
#app { min-height: 100vh; }
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background:
    radial-gradient(600px 160px at 18% 0%, rgba(18, 164, 154, 0.20), transparent 70%),
    linear-gradient(100deg, #0a2030, #0e2d3e 55%, #0b2636);
  color: #e8f2f5;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 280px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #16b3a8, #0b6e69);
  color: #fff; font-weight: 800; letter-spacing: 0.5px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 6px 18px rgba(0,0,0,0.22);
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 0.2px; }
.preview-badge { font-size: 8px; font-weight: 700; color: #fff; background: var(--teal); border-radius: 3px; padding: 2px 4px; vertical-align: 2px; margin-left: 4px; letter-spacing: 0; }
.brand-name span { color: #78d8cf; font-weight: 500; }
.brand-sub { font-size: 11px; color: #93abb8; margin-top: 1px; letter-spacing: 0.3px; }
.top-status { display: flex; align-items: center; gap: 9px; font-size: 12px; color: #b8cbd5; margin-left: auto; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #35d0a5; box-shadow: 0 0 0 4px rgba(53, 208, 165, 0.12); }
.top-divider { width: 1px; height: 16px; background: rgba(255,255,255,0.14); margin: 0 5px; }
.top-actions { display: flex; gap: 8px; }
.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
  background: transparent;
  white-space: nowrap;
}
.btn.ghost { border-color: rgba(255,255,255,0.18); color: #d7e6ec; }
.btn.ghost:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.30); }
.btn.primary { background: #13a096; color: #fff; box-shadow: 0 4px 14px rgba(19,160,150,0.30); }
.btn.primary:hover { background: #0f8b82; }
.btn.dark { background: var(--navy); color: #fff; }
.btn.dark:hover { background: #163b4f; }
.btn.outline { border-color: var(--line); background: #fff; color: var(--ink-2); }
.btn.outline:hover { border-color: #b8c9d5; background: #f8fbfc; }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------------- layout ---------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(380px, 0.82fr) minmax(520px, 1.18fr);
  gap: 16px;
  padding: 16px 20px 20px;
  max-width: 1760px;
  margin: 0 auto;
  height: calc(100vh - 72px);
  min-height: 0;
}
.chat-panel, .workbench {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-head, .wb-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fbfdfe, #fff);
  flex: none;
}
.chat-head h1, .wb-head h2 { font-size: 16px; letter-spacing: 0.2px; }
.chat-head p, .wb-head p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.chat-mode {
  font-size: 11px; color: var(--teal); background: var(--teal-soft);
  border: 1px solid #c8e9e4; border-radius: 999px; padding: 4px 9px;
  display: flex; align-items: center; gap: 6px; white-space: nowrap; margin-top: 2px;
}
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--teal-2); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------------- chat ---------------- */
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 4px;
  scroll-behavior: smooth;
  background:
    linear-gradient(180deg, rgba(241, 247, 249, 0.55), transparent 120px);
}
.chat-log::-webkit-scrollbar, .wb-body::-webkit-scrollbar, .quick-replies::-webkit-scrollbar { width: 8px; height: 8px; }
.chat-log::-webkit-scrollbar-thumb, .wb-body::-webkit-scrollbar-thumb, .quick-replies::-webkit-scrollbar-thumb { background: #c8d6df; border-radius: 8px; }
.msg { display: flex; gap: 9px; margin-bottom: 16px; animation: rise 0.22s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.msg.user { justify-content: flex-end; }
.avatar {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(145deg, #e1f4f1, #c9e9e4);
  color: var(--teal); font-weight: 800; font-size: 11px;
  display: grid; place-items: center; border: 1px solid #bfe1dc;
  margin-top: 2px;
}
.bubble {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 4px 13px 13px 13px;
  background: #f7fafb;
  border: 1px solid #e2ebf0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.65;
  box-shadow: 0 1px 1px rgba(16,37,53,0.02);
}
.msg.user .bubble {
  background: linear-gradient(145deg, #0f4e4e, #0c3d44);
  border: 0;
  color: #eaf7f6;
  border-radius: 13px 4px 13px 13px;
  max-width: 84%;
}
.bubble p + p { margin-top: 7px; }
.bubble strong { color: var(--ink); font-weight: 700; }
.msg.user .bubble strong { color: #fff; }
.bubble ul { margin-top: 6px; padding-left: 17px; }
.bubble li + li { margin-top: 3px; }
.bubble .tiny { font-size: 11.5px; color: var(--muted); margin-top: 7px; }
.msg.user .bubble .tiny { color: #a9cfcb; }
.bubble.wide { max-width: 94%; }
.note-line {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 8px 10px; margin-top: 9px;
  background: var(--amber-soft); border: 1px solid #ecd7b6; border-radius: 8px;
  color: #70450f; font-size: 12px;
}
.msg.user .note-line { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.14); color: #eaf7f6; }

.chat-bottom { flex: none; border-top: 1px solid var(--line-soft); background: #fff; }
.quick-replies {
  display: flex; flex-wrap: wrap; gap: 7px;
  padding: 10px 18px 4px;
  max-height: 104px; overflow-y: auto;
}
.chip {
  border: 1px solid #cbdce5;
  background: #fbfdfe;
  color: #31556c;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  transition: all 0.13s ease;
  white-space: nowrap;
}
.chip:hover { border-color: var(--teal-2); color: var(--teal); background: #f1fbf9; }
.chip.strong { background: var(--teal); color: #fff; border-color: var(--teal); }
.chip.strong:hover { background: #0a655f; color: #fff; }
.chip.ghost { background: transparent; color: var(--muted); border-style: dashed; }
.chip .k { font-size: 10px; opacity: 0.7; margin-right: 3px; }
.composer {
  display: flex; align-items: flex-end; gap: 8px;
  margin: 8px 18px 0;
  border: 1px solid #cddce5;
  border-radius: 11px;
  background: #fbfdfe;
  padding: 7px 7px 7px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer:focus-within { border-color: #7fc8c1; box-shadow: 0 0 0 3px rgba(18,164,154,0.10); }
.composer textarea {
  flex: 1; border: 0; outline: 0; resize: none; background: transparent;
  min-height: 26px; max-height: 120px; padding: 4px 0; font-size: 13px; line-height: 1.55;
}
.composer textarea::placeholder { color: #9aacb9; }
.send {
  width: 32px; height: 32px; border: 0; border-radius: 9px; flex: none;
  background: var(--teal); color: #fff; font-size: 17px; font-weight: 700;
  display: grid; place-items: center; transition: background 0.15s;
}
.send:hover { background: #0a655f; }
.composer-hint { font-size: 10.5px; color: #9aacb9; padding: 6px 18px 10px; }

/* ---------------- workbench ---------------- */
.wb-head { align-items: center; }
.completeness { display: flex; align-items: center; gap: 9px; flex: none; }
.ring {
  --p: 0;
  width: 44px; height: 44px; border-radius: 50%;
  background: conic-gradient(var(--teal-2) calc(var(--p) * 1%), #e4edf2 0);
  display: grid; place-items: center; position: relative;
}
.ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
.ring span { position: relative; font-size: 10px; font-weight: 800; color: var(--teal); }
.ring-label { font-size: 10.5px; color: var(--muted); line-height: 1.3; }

.summary-strip {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1.2fr 1.35fr;
  border-bottom: 1px solid var(--line-soft);
  background: #fbfdfe;
  flex: none;
}
.sum-item { padding: 10px 14px; border-right: 1px solid var(--line-soft); min-width: 0; }
.sum-item:last-child { border-right: 0; }
.sum-item .k { display: block; font-size: 9.5px; color: var(--muted-2); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 3px; }
.sum-item .v { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-item .v.pending { color: #a7b6c1; font-weight: 500; }
.sum-item .sub { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-item .v .lock { font-size: 9px; color: var(--amber); background: var(--amber-soft); border-radius: 4px; padding: 1px 4px; margin-left: 4px; vertical-align: 1px; }

.tabs {
  display: flex; gap: 2px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  flex: none;
  overflow-x: auto;
}
.tabs button {
  border: 0; background: transparent; color: var(--muted);
  padding: 11px 11px 9px; font-size: 12.5px; font-weight: 600;
  border-bottom: 2px solid transparent; white-space: nowrap;
  display: flex; align-items: center; gap: 5px;
}
.tabs button:hover { color: var(--ink-2); }
.tabs button.active { color: var(--teal); border-bottom-color: var(--teal); }
.tabs button span:empty { display: none; }
.tab-badge {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: #edf3f7; color: #648096; font-size: 9.5px; display: inline-grid; place-items: center;
}
.tab-badge.hot { background: var(--red-soft); color: var(--red); }
.tab-badge.warn { background: var(--amber-soft); color: var(--amber); }

.wb-body { flex: 1; overflow-y: auto; padding: 16px 18px 26px; background: #fcfdfe; }

/* ---------------- generic cards ---------------- */
.card {
  background: #fff; border: 1px solid var(--line);
  border-radius: 11px; padding: 15px 16px; margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.card.tight { padding: 12px 14px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h3 { font-size: 13.5px; letter-spacing: 0.1px; }
.card-head p { font-size: 11px; color: var(--muted); margin-top: 2px; }
.card-head .right { font-size: 11px; color: var(--muted); white-space: nowrap; }
.section-label { font-size: 10px; letter-spacing: 1.1px; text-transform: uppercase; color: var(--muted-2); font-weight: 700; margin: 2px 0 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------------- badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 5px;
  font-size: 10.5px; font-weight: 700; line-height: 1.5;
  background: #eef3f7; color: #4d687c; border: 1px solid transparent;
  white-space: nowrap;
}
.badge.teal { background: var(--teal-soft); color: var(--teal); border-color: #c5e8e2; }
.badge.amber { background: var(--amber-soft); color: var(--amber); border-color: #ecd2a9; }
.badge.red { background: var(--red-soft); color: var(--red); border-color: #f0c8c3; }
.badge.blue { background: var(--blue-soft); color: var(--blue); border-color: #c9dded; }
.badge.dark { background: rgba(255,255,255,0.12); color: #d7e8ee; border-color: rgba(255,255,255,0.14); }
.rating {
  width: 23px; height: 23px; border-radius: 6px;
  display: inline-grid; place-items: center; font-weight: 800; font-size: 11px;
}
.rating.r-a { background: #dff4ee; color: #087064; border: 1px solid #b6e4da; }
.rating.r-b { background: #fdf0db; color: #95600f; border: 1px solid #ecd2a9; }
.rating.r-c { background: #fbe9e7; color: #a23b33; border: 1px solid #f0c8c3; }
.rating.r-q { background: #eef2f5; color: #6f8493; border: 1px solid #d9e3ea; }
.type-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal-2); display: inline-block; }

/* ---------------- empty state ---------------- */
.empty-hero {
  border: 1px dashed #c9d9e2; border-radius: 12px; padding: 18px;
  background: linear-gradient(160deg, #f9fcfd, #f4f9fa);
  margin-bottom: 12px;
}
.empty-hero h3 { font-size: 16px; margin-bottom: 4px; }
.empty-hero p { color: var(--muted); font-size: 12px; max-width: 620px; }
.path {
  display: flex; align-items: stretch; gap: 6px; margin: 14px 0 4px; flex-wrap: wrap;
}
.path-step {
  flex: 1; min-width: 100px; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 9px; position: relative;
}
.path-step .n { font-family: var(--mono); font-size: 9px; color: var(--teal); font-weight: 700; }
.path-step strong { display: block; font-size: 11px; margin: 1px 0; }
.path-step span { font-size: 10px; color: var(--muted); line-height: 1.35; display: block; }
.path-arrow { display: grid; place-items: center; color: #a9bcc8; font-size: 12px; flex: none; }

.scenario-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.scenario {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  background: #fff; text-align: left; transition: all 0.14s ease;
}
.scenario:hover { border-color: #8accc5; box-shadow: 0 4px 14px rgba(11,118,113,0.09); transform: translateY(-1px); }
.scenario .tag { font-size: 9.5px; color: var(--teal); font-weight: 700; letter-spacing: 0.4px; }
.scenario strong { display: block; font-size: 12.5px; margin: 2px 0 3px; }
.scenario span { font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.scenario .go { float: right; color: var(--teal); font-weight: 800; }

/* ---------------- conclusion ---------------- */
.verdict {
  position: relative; overflow: hidden;
  border-radius: 13px; padding: 17px 18px;
  background:
    radial-gradient(420px 180px at 100% -20%, rgba(40, 205, 190, 0.20), transparent 65%),
    linear-gradient(135deg, #0b2537, #113f4c 75%, #0f4a50);
  color: #eaf5f6; margin-bottom: 12px;
  box-shadow: 0 10px 28px rgba(11, 34, 51, 0.18);
}
.verdict::after {
  content: ""; position: absolute; right: -40px; bottom: -70px;
  width: 200px; height: 200px; border-radius: 50%;
  border: 1px solid rgba(120, 216, 207, 0.16);
}
.verdict-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; position: relative; z-index: 1; }
.verdict-model { font-family: var(--mono); font-size: 29px; font-weight: 700; letter-spacing: 0.5px; margin: 7px 0 1px; position: relative; z-index: 1; }
.verdict-sub { font-size: 11.5px; color: #a9c6cf; position: relative; z-index: 1; }
.verdict-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-top: 14px; position: relative; z-index: 1;
}
.verdict-grid .v {
  background: rgba(255,255,255,0.065); border: 1px solid rgba(255,255,255,0.10);
  border-radius: 7px; padding: 7px 8px;
}
.verdict-grid .k { font-size: 9px; color: #91b4be; letter-spacing: 0.4px; text-transform: uppercase; }
.verdict-grid .val { font-family: var(--mono); font-size: 13px; font-weight: 700; color: #f1fbfb; margin-top: 1px; }
.verdict .score {
  margin-left: auto; font-family: var(--mono); font-size: 12px;
  background: rgba(53, 208, 165, 0.14); border: 1px solid rgba(53, 208, 165, 0.35);
  color: #83e3cd; padding: 3px 8px; border-radius: 999px;
}
.approval {
  border: 1px solid #e6c48f; background: linear-gradient(180deg, #fdf6e8, #fdf3e2);
  border-radius: 10px; padding: 11px 13px; margin-bottom: 12px;
}
.approval strong { color: #7c4a0c; font-size: 12.5px; }
.approval p { color: #7e5a2a; font-size: 11.5px; margin: 3px 0 8px; }
.approval .row { justify-content: flex-start; }

.reason-list { counter-reset: reason; list-style: none; padding: 0; margin: 0; }
.reason-list li {
  counter-increment: reason; position: relative; padding-left: 25px;
  font-size: 12px; color: var(--ink-2); margin-bottom: 8px; line-height: 1.6;
}
.reason-list li::before {
  content: counter(reason); position: absolute; left: 0; top: 1px;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--teal-soft); color: var(--teal);
  font-size: 9.5px; font-weight: 800; display: grid; place-items: center;
}
.reason-list li:last-child { margin-bottom: 0; }

.parts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.part {
  border: 1px solid var(--line-soft); border-radius: 7px; padding: 7px 9px; background: #fbfdfe;
}
.part .k { font-size: 9.5px; color: var(--muted); }
.part .v { font-size: 11.5px; font-weight: 650; color: var(--ink-2); margin-top: 1px; }

.alt-card {
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px;
  background: #fbfdfe; margin-bottom: 7px;
}
.alt-card:last-child { margin-bottom: 0; }
.alt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.alt-head .label { font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: 0.3px; }
.alt-model { font-family: var(--mono); font-weight: 700; font-size: 14px; margin: 3px 0 1px; }
.alt-meta { font-size: 10.5px; color: var(--muted); }
.alt-note { font-size: 10.5px; color: #7d5d32; background: var(--amber-soft); border-radius: 5px; padding: 5px 7px; margin-top: 6px; }
.alt-note.neutral { color: var(--muted); background: #f1f5f8; }

/* ---------------- ladder ---------------- */
.ladder { position: relative; }
.ladder-step {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 9px;
  padding: 9px 0; border-bottom: 1px dashed var(--line-soft);
  align-items: start;
}
.ladder-step:last-child { border-bottom: 0; }
.step-no {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  background: #eef3f7; color: #7890a1; border: 1px solid #dce6ed;
}
.ladder-step.matched .step-no { background: var(--teal); color: #fff; border-color: var(--teal); }
.ladder-step.available .step-no { background: var(--blue-soft); color: var(--blue); border-color: #bfd6e7; }
.ladder-step.locked .step-no { background: #f2f6f8; color: #9aacb8; border-color: #dfe8ee; }
.ladder-step.none .step-no { background: #f7f9fa; color: #a3b3be; border-color: #e1e9ef; }
.step-body strong { display: block; font-size: 12px; }
.step-body p { font-size: 10.5px; color: var(--muted); line-height: 1.55; margin-top: 1px; }
.step-state { font-size: 9.5px; font-weight: 700; padding: 2px 6px; border-radius: 4px; white-space: nowrap; margin-top: 1px; }
.matched .step-state { color: var(--teal); background: var(--teal-soft); }
.available .step-state { color: var(--blue); background: var(--blue-soft); }
.locked .step-state { color: #8297a5; background: #f1f5f8; }
.none .step-state { color: #97a8b4; background: #f6f9fa; }
.ladder-step.matched { background: linear-gradient(90deg, rgba(230,245,242,0.55), transparent 70%); }

/* ---------------- metrics / hydraulic ---------------- */
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.metric {
  border: 1px solid var(--line-soft); border-radius: 8px; background: #f9fcfd;
  padding: 9px 10px;
}
.metric .k { font-size: 9.5px; color: var(--muted); }
.metric .v { font-family: var(--mono); font-size: 18px; font-weight: 700; letter-spacing: -0.3px; margin-top: 1px; }
.metric .v small { font-size: 10px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.metric .s { font-size: 9.5px; color: var(--muted-2); margin-top: 1px; }
.metric.highlight { background: var(--teal-soft); border-color: #c3e6e1; }
.metric.highlight .v { color: var(--teal); }

.formula {
  font-family: var(--mono); font-size: 10.5px; color: #46697f;
  background: #f2f7fa; border: 1px dashed #d5e2ea; border-radius: 6px;
  padding: 7px 9px; line-height: 1.7;
}
.trim-visual { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.trim-bar { flex: 1; height: 9px; background: #e8eff4; border-radius: 999px; position: relative; overflow: hidden; }
.trim-bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #14a39a, #6fd1c7); border-radius: 999px; }
.trim-label { font-family: var(--mono); font-size: 12px; font-weight: 700; white-space: nowrap; }
.npsh-track { height: 12px; border-radius: 999px; background: linear-gradient(90deg, #f3d9d5, #f8ecd8 22%, #dff3ea 62%, #cbeee7); position: relative; margin: 12px 0 7px; }
.npsh-marker { position: absolute; top: -3px; width: 3px; height: 18px; background: #173a4d; border-radius: 2px; }
.npsh-marker.alt { background: var(--teal-2); }
.npsh-marker::after { content: attr(data-label); position: absolute; top: 19px; left: 50%; transform: translateX(-50%); font-size: 9px; color: var(--muted); white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 10px; color: var(--muted); }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 3px; }

/* ---------------- table ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 8px; }
table.matrix { width: 100%; border-collapse: collapse; font-size: 11.5px; min-width: 540px; }
table.matrix th {
  text-align: left; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); background: #f6fafb; padding: 8px 9px; border-bottom: 1px solid var(--line);
  font-weight: 700; white-space: nowrap;
}
table.matrix td { padding: 8px 9px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.matrix tr:last-child td { border-bottom: 0; }
table.matrix tr.recommended td { background: #f0faf8; }
table.matrix tr.recommended td:first-child { box-shadow: inset 3px 0 0 var(--teal); }
.mat-name { font-weight: 650; white-space: nowrap; }
.mat-name span { display: block; font-size: 9.5px; color: var(--muted-2); font-weight: 400; }
.mat-note { color: var(--muted); line-height: 1.5; min-width: 180px; }
.window { font-family: var(--mono); font-size: 10px; color: #526f82; white-space: nowrap; }
.matrix-caption { font-size: 10.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

.elastomer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.elastomer {
  border: 1px solid var(--line-soft); border-radius: 7px; padding: 7px 8px;
  background: #fbfdfe;
}
.elastomer .top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.elastomer .nm { font-size: 10.5px; font-weight: 700; }
.elastomer .t { font-size: 9.5px; color: var(--muted); margin-top: 2px; }

/* ---------------- risks ---------------- */
.risk {
  border: 1px solid var(--line); border-left: 4px solid #9fb3c1;
  border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: #fff;
}
.risk.high { border-left-color: var(--red); background: linear-gradient(90deg, #fdf7f6, #fff 45%); }
.risk.medium { border-left-color: #cf9138; background: linear-gradient(90deg, #fdfaf3, #fff 45%); }
.risk.low { border-left-color: #6f9fbe; background: linear-gradient(90deg, #f7fbfd, #fff 45%); }
.risk-head { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.risk-head strong { font-size: 12px; }
.risk p { font-size: 11px; color: var(--muted); line-height: 1.55; }
.risk .action { font-size: 10.5px; color: var(--ink-2); margin-top: 5px; padding-top: 5px; border-top: 1px dashed #e4edf2; }
.risk .action b { color: var(--teal); font-weight: 700; }
.risk-level { font-size: 9px; font-weight: 800; letter-spacing: 0.4px; padding: 2px 5px; border-radius: 4px; }
.risk.high .risk-level { background: var(--red-soft); color: var(--red); }
.risk.medium .risk-level { background: var(--amber-soft); color: var(--amber); }
.risk.low .risk-level { background: var(--blue-soft); color: var(--blue); }

/* ---------------- sources ---------------- */
.source-list { display: flex; flex-direction: column; gap: 7px; }
.source-item {
  border: 1px solid var(--line-soft); border-radius: 8px; padding: 9px 10px;
  background: #fbfdfe;
}
.source-item .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.source-item .nm { font-size: 11.5px; font-weight: 650; }
.source-item .nm a { color: var(--ink-2); }
.source-item .nm a:hover { color: var(--teal); }
.source-item .meta { font-size: 9.5px; color: var(--muted); margin-top: 2px; }
.source-item .note { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.disclaimer {
  border: 1px solid #ecd2a9; background: #fdf8ee; color: #715121;
  border-radius: 8px; padding: 10px 11px; font-size: 10.5px; line-height: 1.6;
}
.data-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.data-cell { border: 1px solid var(--line-soft); border-radius: 7px; padding: 7px 9px; background: #fbfdfe; }
.data-cell .k { font-size: 9px; color: var(--muted-2); letter-spacing: 0.4px; text-transform: uppercase; }
.data-cell .v { font-size: 11.5px; font-weight: 650; margin-top: 1px; }

/* ---------------- modal ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(9, 26, 38, 0.52);
  backdrop-filter: blur(2px); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade 0.15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 14px; width: 720px; max-width: 100%;
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.28); overflow: hidden;
  animation: modal-in 0.18s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }
.modal.wide { width: 880px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { font-size: 15px; }
.modal-head p { font-size: 11px; color: var(--muted); margin-top: 2px; }
.icon-btn { border: 0; background: #f2f6f8; color: #68808f; width: 28px; height: 28px; border-radius: 7px; font-size: 17px; line-height: 1; }
.icon-btn:hover { background: #e6edf2; color: var(--ink); }
.modal-body { padding: 15px 18px; overflow-y: auto; }
.modal-foot { padding: 11px 18px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 8px; background: #fbfdfe; }
.modal-note { background: #f4f9fb; border: 1px solid #dce9ef; border-radius: 8px; padding: 9px 11px; font-size: 11px; color: #4f6d80; line-height: 1.6; margin-bottom: 11px; }
.modal-note.warn { background: var(--amber-soft); border-color: #ecd2a9; color: #715121; }
.seg { display: flex; gap: 3px; background: #f1f6f8; border-radius: 8px; padding: 3px; margin-bottom: 11px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 6px; padding: 6px 8px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.seg button.active { background: #fff; color: var(--teal); box-shadow: var(--shadow-sm); }
textarea.catalog-input {
  width: 100%; min-height: 150px; resize: vertical;
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px;
  font-family: var(--mono); font-size: 11px; line-height: 1.65; background: #fbfdfe; outline: 0;
}
textarea.catalog-input:focus { border-color: #8accc5; box-shadow: 0 0 0 3px rgba(18,164,154,0.10); }
.import-result { margin-top: 12px; }
.import-row { display: grid; grid-template-columns: 22px 1.15fr 0.95fr 1.05fr 1.15fr 72px 48px; gap: 7px; align-items: center; padding: 7px 8px; border-bottom: 1px solid var(--line-soft); font-size: 10.5px; }
.import-row.head { background: #f6fafb; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: 0.4px; border-radius: 6px 6px 0 0; }
.import-row .mono { font-size: 10.5px; font-weight: 700; }
.import-row .issue { color: var(--red); font-size: 9.5px; }
.import-row .ok { color: var(--teal); font-size: 9.5px; }
.origin-select { width: 100%; max-width: 72px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink-2); font-size: 10px; padding: 3px 2px; outline: 0; }
.origin-select:focus { border-color: #8accc5; box-shadow: 0 0 0 2px rgba(18,164,154,0.10); }
.conf-bar { height: 4px; background: #e7eff4; border-radius: 99px; overflow: hidden; margin-top: 3px; }
.conf-bar span { display: block; height: 100%; background: var(--teal-2); }
.file-drop {
  border: 1px dashed #bcd2de; border-radius: 10px; padding: 26px 18px; text-align: center;
  background: #f9fcfd; color: var(--muted); font-size: 12px;
}
.file-drop strong { color: var(--ink-2); display: block; margin-bottom: 3px; }
.file-drop input { display: none; }
.check-steps { display: flex; flex-direction: column; gap: 7px; margin: 11px 0; }
.check-step { display: flex; gap: 8px; align-items: flex-start; font-size: 11px; color: var(--muted); }
.check-step .dot { width: 16px; height: 16px; border-radius: 50%; background: #eef3f7; border: 1px solid #dce6ed; display: grid; place-items: center; font-size: 9px; color: #8ba0ae; flex: none; }
.check-step.done .dot { background: var(--teal); border-color: var(--teal); color: #fff; }
.check-step.done { color: var(--ink-2); }
.check-step b { color: var(--ink); }
.diff-box { border: 1px solid #ecd2a9; background: #fdf8ee; border-radius: 8px; padding: 9px 11px; font-size: 10.5px; color: #715121; line-height: 1.6; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  background: #0d2a3b; color: #eaf5f6; padding: 9px 15px; border-radius: 8px;
  font-size: 12px; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: all 0.2s ease; z-index: 200; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #7d2823; }

/* ---------------- print ---------------- */
.print-report { display: none; }
@media print {
  @page { size: A4; margin: 14mm 13mm; }
  body { background: #fff !important; font-size: 10.5pt; }
  #app, #modalRoot, #toast { display: none !important; }
  .print-report { display: block !important; color: #111; }
  .print-report h1 { font-size: 20pt; margin-bottom: 2mm; }
  .print-report h2 { font-size: 12.5pt; margin: 5mm 0 2mm; border-bottom: 1px solid #bbb; padding-bottom: 1mm; }
  .print-report .pr-head { display: flex; justify-content: space-between; border-bottom: 2px solid #123a4c; padding-bottom: 3mm; margin-bottom: 4mm; }
  .print-report .pr-meta { font-size: 9pt; color: #555; text-align: right; }
  .print-report table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  .print-report th, .print-report td { border: 1px solid #ccc; padding: 2mm 2.5mm; text-align: left; vertical-align: top; }
  .print-report th { background: #f0f4f6; }
  .print-report .pr-rec { background: #f2f8f7; border: 1px solid #b9dcd7; padding: 3mm; margin-bottom: 2mm; }
  .print-report .pr-rec .model { font-family: var(--mono); font-size: 18pt; font-weight: 700; }
  .print-report .pr-kv { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 2mm 5mm; margin: 2mm 0; }
  .print-report .pr-kv div { font-size: 9.5pt; }
  .print-report .pr-kv b { display: inline-block; min-width: 22mm; color: #333; }
  .print-report ul { margin: 1mm 0; padding-left: 5mm; }
  .print-report li { margin-bottom: 1.2mm; }
  .print-report .pr-sign { display: flex; gap: 10mm; margin-top: 10mm; font-size: 9.5pt; }
  .print-report .pr-sign div { flex: 1; border-top: 1px solid #999; padding-top: 2mm; }
  .print-report .pr-foot { margin-top: 6mm; font-size: 8pt; color: #666; border-top: 1px solid #ccc; padding-top: 2mm; }
}

/* ---------------- product library ---------------- */
[hidden] { display: none !important; }
.library-root {
  position: fixed; inset: 0; z-index: 70;
  background:
    radial-gradient(1100px 450px at 5% -10%, rgba(18,164,154,0.12), transparent 55%),
    var(--bg);
  display: flex; flex-direction: column; overflow: hidden;
}
.lib-topbar {
  height: 64px; flex: none; display: flex; align-items: center; gap: 18px;
  padding: 0 18px; color: #e8f2f5;
  background: linear-gradient(100deg, #0a2030, #0e2d3e 55%, #0b2636);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.lib-top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.lib-count { font-size: 11px; color: #9fb7c3; }
.lib-layout {
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: 200px minmax(280px, 340px) minmax(560px, 1fr);
  gap: 12px; padding: 12px 14px 14px;
}
.lib-filters, .lib-content, .lib-detail {
  background: #fff; border: 1px solid var(--line); border-radius: 11px;
  box-shadow: var(--shadow-sm); min-height: 0; overflow: hidden;
}
.lib-filters { padding: 14px; overflow-y: auto; }
.lib-search { display: block; margin-bottom: 14px; }
.lib-search span { display: block; font-size: 9px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted-2); margin-bottom: 4px; }
.lib-search input {
  width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px;
  font-size: 12px; outline: 0; background: #fbfdfe;
}
.lib-search input:focus { border-color: #8accc5; box-shadow: 0 0 0 3px rgba(18,164,154,0.09); }
.lib-check { display: flex; align-items: center; gap: 5px; margin: -4px 0 12px; font-size: 10px; color: var(--muted); }
.lib-delete { color: #b23b32 !important; border-color: #e3b9b3 !important; }
.unit-switch { border: 1px solid var(--line); background: #f7fbfc; color: var(--teal); border-radius: 3px; font-size: 8px; padding: 1px 4px; margin-left: 3px; cursor: pointer; }
.unit-switch:hover { border-color: #8accc5; background: #eaf8f5; }
.unit-switch-mark { font-size: 8px; opacity: 0.7; margin-left: 1px; }
.admin-panel { background: #fbf7ef; border: 1px solid #e8dcc4; border-radius: 8px; padding: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 9px 0; font-size: 11px; color: var(--muted); }
.field input { height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; font-size: 13px; background: #fff; outline: 0; }
.field input:focus { border-color: #8accc5; box-shadow: 0 0 0 3px rgba(18,164,154,0.09); }
#adminAuthError:empty { display: none; }
.admin-panel .st { color: #8b6b2f; }
.admin-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.admin-fields label { display: flex; flex-direction: column; gap: 3px; font-size: 9px; color: var(--muted); }
.admin-fields label span { color: var(--muted-2); }
.admin-fields input { height: 28px; border: 1px solid #d8cbb3; border-radius: 5px; padding: 0 6px; font-size: 11px; background: #fff; }
.admin-curve-head { display: flex; justify-content: space-between; gap: 8px; margin: 10px 0 5px; font-size: 9px; color: var(--muted); }
.admin-curve-head b { color: #8b6b2f; font-weight: 600; }
.admin-curve-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.admin-curve-table th { text-align: left; color: var(--muted-2); font-weight: 500; padding: 2px 3px; }
.admin-curve-table td { padding: 2px 3px; }
.admin-curve-table input { width: 100%; height: 25px; border: 1px solid #d8cbb3; border-radius: 4px; padding: 0 5px; font-size: 10px; background: #fff; }
.admin-del { border: 0; background: transparent; color: #b23b32; cursor: pointer; font-size: 14px; }
.admin-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.lib-filter-group { margin-bottom: 14px; }
.lib-filter-group .gl { font-size: 9.5px; font-weight: 800; color: var(--muted-2); letter-spacing: 0.6px; margin-bottom: 5px; }
.lib-filter-group .opts { display: flex; flex-wrap: wrap; gap: 5px; }
.lib-filter-group button {
  border: 1px solid var(--line-soft); background: #fbfdfe; color: var(--muted);
  border-radius: 5px; font-size: 10px; padding: 4px 7px;
}
.lib-filter-group button.active { background: var(--teal-soft); border-color: #bfe3de; color: var(--teal); font-weight: 700; }
.lib-side-note { border-top: 1px dashed var(--line); padding-top: 10px; font-size: 10px; color: var(--muted); line-height: 1.6; }
.lib-content { display: flex; flex-direction: column; }
.lib-list-head {
  flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 13px 14px 10px; border-bottom: 1px solid var(--line-soft);
}
.lib-list-head h2 { font-size: 14px; }
.lib-list-head p { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.lib-list { flex: 1; overflow-y: auto; padding: 5px 6px; }
.series-strip {
  flex: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
  padding: 9px 10px; border-bottom: 1px solid var(--line-soft); background: #fbfdfe;
  max-height: 270px; overflow-y: auto;
}
.series-card { min-width: 0; border: 1px solid var(--line-soft); border-radius: 7px; padding: 6px 8px; background: #fff; text-align: left; }
.series-card:hover { border-color: #9fd4cd; background: #f7fcfb; }
.series-card .sc { font-family: var(--mono); font-size: 11px; font-weight: 700; }
.series-card .sn { font-size: 9.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.series-card .ss { font-size: 8.5px; margin-top: 3px; color: var(--amber); }
.series-card.ready .ss { color: var(--teal); }
.series-card .opt { font-size: 8px; color: var(--muted); margin-left: 3px; }
.lib-empty { padding: 40px 16px; text-align: center; color: var(--muted); font-size: 12px; }
.lib-row {
  width: 100%; text-align: left; border: 1px solid transparent; background: transparent;
  border-radius: 7px; padding: 7px 8px; margin-bottom: 2px; display: block;
}
.lib-row:hover { background: #f7fbfc; border-color: var(--line-soft); }
.lib-row.active { background: #eff9f7; border-color: #bce4de; }
.lib-row-top { display: flex; align-items: center; gap: 6px; }
.lib-row-model { font-family: var(--mono); font-weight: 700; font-size: 12px; }
.lib-row-top .badge { font-size: 8.5px; padding: 0 4px; }
.lib-row-sub { display: flex; align-items: center; gap: 5px; margin-top: 2px; font-size: 9.5px; color: var(--muted); flex-wrap: wrap; }
.lib-row-sub .sep { color: #c7d5de; }
.lib-row-meta { font-size: 9px; color: var(--muted-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-detail { overflow-y: auto; padding: 18px 20px; }
.lib-detail-empty { height: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 11.5px; line-height: 1.7; }
.lib-detail h2 { font-family: var(--mono); font-size: 22px; letter-spacing: 0.2px; margin: 7px 0 2px; }
.lib-detail .sub { font-size: 10.5px; color: var(--muted); }
.lib-detail .badges { display: flex; flex-wrap: wrap; gap: 5px; }
.lib-section { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 11px; }
.lib-section .st { font-size: 9.5px; color: var(--muted-2); letter-spacing: 0.8px; text-transform: uppercase; font-weight: 800; margin-bottom: 7px; }
.curve-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.curve-toolbar .curve-hint { font-size: 9px; color: var(--muted); margin-left: auto; }
.curve-wrap { position: relative; height: 300px; border: 1px solid var(--line-soft); border-radius: 7px; background: #fff; overflow: hidden; cursor: crosshair; }
.curve-wrap:active { cursor: crosshair; }
.curve-wrap canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.curve-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 132px; padding: 5px 7px; border-radius: 5px; background: rgba(24,38,48,0.94); color: #fff; font-size: 10px; line-height: 1.45; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.curve-tip strong { font-size: 11px; color: #fff; }
.curve-tip span { color: #c9d6de; }
.result-curve-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 9px; font-size: 10px; color: var(--muted); }
.result-curve-stats strong { color: var(--ink-2); font-weight: 700; }
.result-curve-wrap { height: 280px; }
.curve-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 5px; font-size: 9px; color: var(--muted); }
.lib-series { margin-top: 10px; border: 1px solid #d7e7ee; border-radius: 8px; background: #f8fcfd; padding: 8px 9px; }
.lib-series summary { cursor: pointer; font-size: 10.5px; font-weight: 700; color: #315c72; }
.lib-series-body { margin-top: 7px; }
.kvline { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--muted); padding: 2px 0; }
.kvline b { color: var(--ink-2); font-weight: 650; text-align: right; }
.lib-series-desc { margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 6px; display: flex; flex-direction: column; gap: 2px; font-size: 9.5px; color: var(--muted); line-height: 1.45; }
.lib-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.lib-kv div { border: 1px solid var(--line-soft); border-radius: 6px; padding: 6px 8px; background: #fbfdfe; min-width: 0; }
.lib-kv .k { font-size: 9px; color: var(--muted); }
.lib-kv .v { font-size: 11px; font-weight: 650; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-doc {
  border: 1px solid #cfe2ea; background: #f7fbfd; border-radius: 8px; padding: 9px 10px;
}
.lib-doc .nm { font-size: 11.5px; font-weight: 650; word-break: break-all; }
.lib-doc .meta { font-size: 9.5px; color: var(--muted); margin-top: 2px; }
.lib-doc .row { margin-top: 7px; }
.lib-doc-missing { border: 1px dashed var(--line); border-radius: 8px; padding: 9px 10px; font-size: 10.5px; color: var(--muted); background: #fbfdfe; }
.lib-warning { background: var(--amber-soft); border: 1px solid #ecd2a9; color: #70450f; border-radius: 6px; padding: 7px 8px; font-size: 10px; line-height: 1.55; margin-top: 7px; }
.lib-detail-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 11px; }
.doc-preview { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-bottom: 11px; background: #f4f7f9; }
.doc-preview-head { display: flex; align-items: center; gap: 8px; padding: 7px 9px; background: #f7fafb; border-bottom: 1px solid var(--line-soft); font-size: 10.5px; }
.doc-preview-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-preview iframe { width: 100%; height: 280px; border: 0; display: block; background: #fff; }
.doc-preview .hint { padding: 7px 9px; font-size: 10px; color: var(--muted); line-height: 1.5; border-top: 1px solid var(--line-soft); background: #fbfdfe; }
.wizard { display: flex; gap: 5px; margin-bottom: 11px; flex-wrap: wrap; }
.wizard span { font-size: 9.5px; color: var(--muted); background: #f2f7f9; border: 1px solid var(--line-soft); border-radius: 999px; padding: 3px 7px; }
.wizard span.on { color: var(--teal); background: var(--teal-soft); border-color: #bfe3de; font-weight: 700; }

@media (max-width: 1180px) {
  .lib-layout { grid-template-columns: 180px minmax(250px, 300px) minmax(440px, 1fr); }
}
@media (max-width: 900px) {
  .lib-layout { grid-template-columns: 1fr; overflow-y: auto; }
  .lib-filters, .lib-content, .lib-detail { max-height: none; }
  .lib-detail { min-height: 320px; }
  .lib-topbar { height: auto; padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
  .lib-top-actions { width: 100%; justify-content: flex-end; }
  .lib-count { margin-right: auto; }
  .series-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: 120px; }
  .lib-content { max-height: 410px; }
  .lib-list { flex: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; max-height: 270px; }
  .lib-row { margin-bottom: 0; padding: 6px 7px; }
  .lib-row-model { font-size: 11px; }
  .lib-row-sub { font-size: 9px; gap: 3px; }
  .lib-row-meta { font-size: 8.5px; }
}

/* ---------------- responsive ---------------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .chat-panel { height: 62vh; min-height: 460px; }
  .workbench { min-height: 620px; }
  .top-status { display: none; }
}
@media (max-width: 760px) {
  .topbar { height: auto; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .brand { min-width: 0; flex: 1; }
  .brand-sub { display: none; }
  .top-actions { width: 100%; justify-content: flex-end; }
  .layout { padding: 10px; gap: 10px; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .sum-item:nth-child(2) { border-right: 0; }
  .sum-item:nth-child(3), .sum-item:nth-child(4) { border-top: 1px solid var(--line-soft); }
  .wb-body { padding: 12px; }
  .verdict-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .parts-grid { grid-template-columns: 1fr 1fr; }
  .elastomer-grid { grid-template-columns: 1fr 1fr; }
  .scenario-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .chat-panel { height: 70vh; }
  .quick-replies { max-height: 120px; }
  .tabs { padding: 0 6px; }
  .tabs button { padding: 10px 7px; font-size: 11px; gap: 3px; }
  .modal { max-height: 92vh; }
  .import-row { grid-template-columns: 18px 1.15fr 1fr 1fr 66px; }
  .import-row .hide-mobile { display: none; }
  .import-row > span:nth-child(7) { display: none; }
}

/* ---------------- admin login page ---------------- */
.admin-login-page { min-height: 100vh; margin: 0; background: radial-gradient(900px 500px at 10% -10%, rgba(18,164,154,0.16), transparent 55%), linear-gradient(145deg,#071a26,#0c2a3a 60%,#0a2230); color: #e8f2f5; display: grid; place-items: center; padding: 28px 16px; }
.admin-login-shell { width: min(980px, 100%); display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 34px; align-items: center; }
.admin-login-brand { display: flex; gap: 16px; align-items: flex-start; }
.admin-login-brand .brand-mark { width: 54px; height: 54px; border-radius: 14px; flex: none; }
.admin-login-kicker { font-size: 11px; letter-spacing: 1.2px; color: #8fc9c4; text-transform: uppercase; }
.admin-login-brand h1 { font-size: 34px; margin: 8px 0 10px; letter-spacing: 0.2px; }
.admin-login-brand p { font-size: 13px; line-height: 1.8; color: #a9c2cd; max-width: 380px; }
.admin-login-card { background: #fff; color: var(--ink); border-radius: 14px; padding: 26px; box-shadow: 0 24px 60px rgba(0,0,0,0.28); }
.admin-login-title { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.admin-login-note { font-size: 11px; color: var(--muted); line-height: 1.6; margin: 0 0 12px; }
.admin-login-error { min-height: 18px; color: #b23b32; font-size: 11px; margin: 4px 0 8px; }
.admin-login-submit { width: 100%; height: 38px; margin-top: 4px; }
.admin-login-back { display: block; text-align: center; margin-top: 12px; font-size: 11px; color: var(--teal); text-decoration: none; }
.admin-login-foot { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 9.5px; line-height: 1.6; color: var(--muted-2); }
@media (max-width: 760px) { .admin-login-shell { grid-template-columns: 1fr; gap: 20px; } .admin-login-brand h1 { font-size: 26px; } }
