/* 受控图纸检索 —— 浅色工业风样式 */
:root {
  --brand: #1f4e79;
  --brand-2: #2f6fb3;
  --brand-soft: #e8f0f9;
  --bg: #f2f5f9;
  --card: #ffffff;
  --line: #e2e8f0;
  --line-2: #eef2f7;
  --text: #1c2635;
  --muted: #6b7c93;
  --ok: #0f766e;
  --warn: #b45309;
  --danger: #be123c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 56, .06), 0 6px 18px rgba(16, 32, 56, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.62 "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.hdr {
  background: linear-gradient(100deg, #1f4e79 0%, #2f6fb3 100%);
  color: #fff;
  padding: 16px 0 14px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(19, 45, 76, .18);
}
.hdr-in {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
.hdr-l { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; flex: 1; }
.hdr-t { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.hdr-s { font-size: 13px; color: rgba(255, 255, 255, .82); }
.hdr .spacer { flex: 1; }
.hdr-r { margin-left: auto; align-self: center; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }

/* ---------- 返回主页 ---------- */
.home-link {
  align-self: center; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  color: #fff; text-decoration: none;
  font-size: 13px; font-weight: 600; letter-spacing: .3px;
  padding: 7px 14px; border-radius: 8px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .3);
  transition: background .15s ease, transform .15s ease;
}
.home-link:hover { background: rgba(255, 255, 255, .3); }
.home-link:active { transform: translateY(1px); }
.home-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 520px) { .home-link { font-size: 12px; padding: 6px 11px; } }

/* ---------- 语言切换（中文 / English / Deutsch） ---------- */
.langs {
  margin-left: auto; align-self: center; flex-shrink: 0;
  display: flex; gap: 4px; padding: 3px;
  background: rgba(255, 255, 255, .14); border-radius: 8px;
}
.langs button {
  border: 0; background: transparent; color: rgba(255, 255, 255, .82);
  font-family: inherit; font-size: 13px; line-height: 1.5;
  padding: 4px 12px; border-radius: 6px; cursor: pointer;
  transition: background .15s, color .15s;
}
.langs button:hover { color: #fff; background: rgba(255, 255, 255, .14); }
.langs button.on { background: #fff; color: var(--brand); font-weight: 600; }

/* ---------- 主体 ---------- */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 20px 40px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

/* ---------- 搜索区 ---------- */
.srow { display: flex; gap: 10px; align-items: center; }
#q, .pw {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  font-size: 15px;
  color: var(--text);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#q:focus, .pw:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(47, 111, 179, .14);
  background: #fff;
}
.hint { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
/* 飞书直链模式：查看图纸为 <a> 链接，保持与 button 相同外观 */
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; line-height: 1; }
.btn:hover { border-color: #c3d2e4; background: #f7fafd; }
.btn.pri {
  background: var(--brand-2);
  border-color: var(--brand-2);
  color: #fff;
  font-weight: 600;
}
.btn.pri:hover { background: #2a63a2; border-color: #2a63a2; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.ghost { color: var(--muted); }
.btn.light { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .38); color: #fff; }
.btn.light:hover { background: rgba(255, 255, 255, .24); }

/* ---------- 形状筛选 ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 4px 13px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: #c3d2e4; color: var(--text); }
.chip.on {
  background: var(--brand-soft);
  border-color: #b9d1ea;
  color: var(--brand);
  font-weight: 600;
}
.chip .n { opacity: .62; margin-left: 5px; font-size: 12px; }

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 12px;
  flex-wrap: wrap;
}
.views { display: flex; gap: 6px; background: #e9eef5; padding: 4px; border-radius: 9px; }
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  padding: 6px 16px;
  border-radius: 7px;
  cursor: pointer;
}
.tab.on { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 32, 56, .1); }
.stat { font-size: 13px; color: var(--muted); }
.stat b { color: var(--brand); font-size: 15px; }

/* ---------- 结果卡片 ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand-2);
  border-radius: 8px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 18px;
  align-items: center;
  box-shadow: 0 1px 2px rgba(16, 32, 56, .04);
  transition: box-shadow .15s, border-color .15s;
}
.card:hover { box-shadow: var(--shadow); }
.card.shape-E { border-left-color: #7c3aed; }
.card.shape-F { border-left-color: #0f766e; }
.card.shape-L { border-left-color: #b45309; }
.card.shape-C { border-left-color: #be123c; }
.card.shape-Z { border-left-color: #94a3b8; }
.c-num { font-size: 15.5px; font-weight: 700; letter-spacing: .3px; color: #16283f; }
.c-num .rev {
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: var(--brand-2);
  border-radius: 4px;
  padding: 1px 7px;
  margin-left: 8px;
  vertical-align: 2px;
}
.c-desc { font-size: 13px; color: #48586e; margin-top: 3px; }
.c-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tg {
  font-size: 12px;
  color: #43566e;
  background: #f1f5f9;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 1px 8px;
}
.tg.shape { color: #fff; border: 0; font-weight: 600; }
.tg.shape.shape-R { background: #2563eb; }
.tg.shape.shape-E { background: #7c3aed; }
.tg.shape.shape-F { background: #0f766e; }
.tg.shape.shape-L { background: #b45309; }
.tg.shape.shape-C { background: #be123c; }
.tg.shape.shape-Z { background: #64748b; }
.tg.dim { color: var(--muted); background: #fff; }
.tg.lkt { color: #92400e; background: #fef3c7; border-color: #fcd34d; font-weight: 600; }

/* ---------- 受限图纸密码门 ---------- */
.lkbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 18, 24, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.lkbox.hidden { display: none; }
.lk-card {
  background: #fff; border-radius: 12px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .35);
  padding: 22px 22px 18px; width: 100%; max-width: 360px;
}
.lk-t { font-size: 15.5px; font-weight: 700; color: #1e293b; margin-bottom: 12px; }
.lk-i {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--line-2); border-radius: 8px;
  font: inherit; padding: 9px 12px; outline: none;
}
.lk-i:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.lk-err { color: #b91c1c; font-size: 12.5px; margin-top: 8px; }
.lk-err.hidden { display: none; }
.lk-ok { width: 100%; margin-top: 14px; justify-content: center; }

.c-act { display: flex; gap: 8px; align-items: center; }
.c-more {
  border: 0; background: transparent; color: var(--muted);
  font-size: 12.5px; cursor: pointer; padding: 4px 2px;
}
.c-more:hover { color: var(--brand); }
.c-detail {
  grid-column: 1 / -1;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px 18px;
  font-size: 13px;
}
.c-detail .k { color: var(--muted); margin-right: 6px; }
.c-detail .full { grid-column: 1 / -1; }

mark { background: #fff2ac; color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---------- 目录树 ---------- */
.tree { display: flex; flex-direction: column; gap: 8px; }
details.g1, details.g2 {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
details.g1 > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  background: #f6f9fd;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
details.g1 > summary::-webkit-details-marker { display: none; }
details.g1 > summary::before {
  content: "▸";
  color: var(--brand-2);
  font-size: 13px;
  transition: transform .15s;
}
details.g1[open] > summary::before { transform: rotate(90deg); }
details.g1 > summary .t1 { font-size: 15.5px; font-weight: 700; color: var(--brand); }
details.g1 > summary .d1 { font-size: 12.5px; color: var(--muted); flex: 1; min-width: 220px; }
details.g1 > summary .c1 { font-size: 12.5px; color: var(--muted); }
details.g1 > div { padding: 10px 12px 12px 14px; display: flex; flex-direction: column; gap: 6px; }

details.g2 > summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 14px;
  background: #fbfcfe;
  border-top: 1px solid var(--line-2);
  font-size: 14px;
  font-weight: 600;
  color: #33465e;
  display: flex;
  gap: 10px;
  align-items: center;
}
details.g2 > summary::-webkit-details-marker { display: none; }
details.g2 > summary::before { content: "▸"; color: #9fb4cc; font-size: 12px; transition: transform .15s; }
details.g2[open] > summary::before { transform: rotate(90deg); }
details.g2 > summary .c2 { font-size: 12px; font-weight: 400; color: var(--muted); }
details.g2 .rows { padding: 8px 12px 12px 16px; display: flex; flex-direction: column; gap: 6px; }
details.g2 .rows .card { box-shadow: none; border-left-width: 2px; }

.empty {
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.ftr {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 34px;
  font-size: 12.5px;
  color: #93a2b6;
  text-align: center;
}

/* ---------- 管理台 ---------- */
.gate {
  position: fixed;
  inset: 0;
  background: linear-gradient(140deg, #1f4e79 0%, #2f6fb3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.gate-box {
  width: 340px;
  background: #fff;
  border-radius: 12px;
  padding: 26px 26px 22px;
  box-shadow: 0 18px 50px rgba(9, 26, 48, .3);
}
.gate-t { font-size: 17px; font-weight: 700; color: var(--brand); }
.gate-s { font-size: 13px; color: var(--muted); margin: 6px 0 16px; }
.gate-box .pw { width: 100%; height: 42px; }
.gate-box .btn { width: 100%; margin-top: 12px; height: 42px; }
.gate-err { color: var(--danger); font-size: 12.5px; margin-top: 10px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.kpi .v { font-size: 24px; font-weight: 700; color: var(--brand); line-height: 1.2; }
.kpi .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.warn .v { color: var(--warn); }

.sec { margin-top: 22px; }
.sec > h2 {
  font-size: 15px;
  color: var(--brand);
  margin: 0 0 10px;
  padding-left: 10px;
  border-left: 3px solid var(--brand-2);
}
.sec .note { font-size: 12.5px; color: var(--muted); margin: -4px 0 10px 13px; }

.tbl { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line-2); padding: 8px 10px; text-align: left; vertical-align: top; }
.tbl th { background: #f6f9fd; color: #33465e; font-weight: 600; white-space: nowrap; }
.tbl tr:hover td { background: #fafcff; }
.tbl td.mono { font-family: Consolas, "Courier New", monospace; letter-spacing: .2px; }
.tbl .wrapcell { max-width: 560px; word-break: break-word; }
.tblbox { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.tblbox .tbl th { position: sticky; top: 0; z-index: 1; }

.bars { display: flex; flex-direction: column; gap: 7px; }
.bar { display: grid; grid-template-columns: 110px 1fr 46px; gap: 10px; align-items: center; font-size: 13px; }
.bar .bl { color: #43566e; }
.bar .bt { height: 12px; background: #eef2f7; border-radius: 6px; overflow: hidden; }
.bar .bt i { display: block; height: 100%; background: linear-gradient(90deg, #2f6fb3, #5b9bda); border-radius: 6px; }
.bar .bv { text-align: right; color: var(--muted); }
.bar.warn .bt i { background: linear-gradient(90deg, #b45309, #e08b2b); }

.tips { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; font-size: 13px; color: #43566e; }
.tips li { margin: 4px 0; }
.tips code { background: #f1f5f9; border-radius: 4px; padding: 1px 6px; font-family: Consolas, monospace; font-size: 12.5px; }

@media (max-width: 720px) {
  .card { grid-template-columns: 1fr; }
  .c-act { justify-content: flex-start; }
  .hdr-t { font-size: 17px; }
  .hdr-in { flex-wrap: wrap; gap: 8px; }
  .langs { margin-left: 0; }
  .langs button { padding: 4px 9px; font-size: 12px; }
}

/* ---------- 内置图纸查看器 ---------- */
.lb {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(15, 18, 24, .92);
  display: flex; flex-direction: column;
}
.lb.hidden { display: none; }
.lb-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, .06);
  color: #e8ecf2; font-size: 14px;
}
.lb-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-tools { display: flex; gap: 6px; flex-shrink: 0; }
.lb-btn {
  border: 1px solid rgba(255, 255, 255, .25); background: transparent; color: #e8ecf2;
  border-radius: 6px; padding: 5px 12px; font-size: 13px; cursor: pointer; line-height: 1.4;
}
.lb-btn:hover { background: rgba(255, 255, 255, .12); }
.lb-x { border-color: rgba(255, 255, 255, .4); }
.lb-pct { min-width: 84px; }
.lb-body {
  flex: 1; overflow: auto; text-align: center;
  cursor: grab; user-select: none;
}
.lb-body.dragging { cursor: grabbing; }
.lb-img { margin: 12px auto; display: block; max-width: none; box-shadow: 0 4px 30px rgba(0, 0, 0, .5); }
