/* =========================================================
   低压配电计算工具 — 页面样式
   ========================================================= */

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

/* ---------- 顶栏 ---------- */
.tool-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.tool-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 74px;
}

.tool-top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.tool-top-nav a {
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 14.5px;
  color: var(--text);
  transition: color 0.2s ease, background 0.2s ease;
}

.tool-top-nav a:hover {
  color: var(--brand);
  background: rgba(27, 107, 255, 0.06);
}

.tool-top-nav a.active {
  color: var(--brand);
  font-weight: 600;
  background: rgba(27, 107, 255, 0.08);
}

.tool-header .header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tool-header .header-mail {
  font-size: 14px;
  color: var(--muted);
}

/* ---------- 顶部横幅 ---------- */
.tool-hero {
  background:
    radial-gradient(900px 320px at 12% 0%, rgba(27, 107, 255, 0.12), transparent 65%),
    radial-gradient(700px 300px at 88% 10%, rgba(0, 194, 212, 0.14), transparent 60%),
    linear-gradient(180deg, #f3f8ff 0%, #f8fbff 70%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}

.tool-hero-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 44px 0 38px;
}

.tool-hero-inner .eyebrow {
  color: var(--brand);
}

.tool-hero h1 {
  margin: 12px 0 10px;
  font-size: clamp(28px, 3.2vw, 38px);
  letter-spacing: -0.5px;
}

.tool-hero-desc {
  max-width: 640px;
  font-size: 15.5px;
  color: var(--text);
}

.book-card {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.book-card > div:first-child {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.book-card span {
  font-size: 12.5px;
  color: var(--muted);
}

.book-card strong {
  font-size: 26px;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.book-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.book-actions .export-btn {
  color: #4ade80 !important;
  font-weight: 600;
}

.book-actions .export-btn:hover,
.book-actions .export-btn:focus,
.book-actions .export-btn:active {
  color: #86efac !important;
  font-weight: 600;
}

/* ---------- 主布局 ---------- */
.tool-layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 28px 0 72px;
}

.tool-sidebar {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.project-card h3 {
  font-size: 14.5px;
  margin-bottom: 10px;
}

.project-card .el-input,
.project-card .el-textarea {
  margin-bottom: 8px;
}

.project-tip {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.tool-menu {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
  box-shadow: var(--shadow-sm);
}

.tool-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  transition: background 0.18s ease, color 0.18s ease;
  font-family: inherit;
}

.tool-menu-item:hover {
  background: #f4f8ff;
}

.tool-menu-item.active {
  background: linear-gradient(96deg, rgba(27, 107, 255, 0.12), rgba(0, 194, 212, 0.08));
  color: var(--ink);
}

.tool-ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  background: #eef4ff;
  color: var(--brand);
}

.tool-menu-item.active .tool-ico {
  background: var(--gradient);
  color: #fff;
}

.tool-menu-text {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
  min-width: 0;
}

.tool-menu-text strong {
  font-size: 14px;
  font-weight: 600;
}

.tool-menu-text em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
}

.side-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.side-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
}

.side-action:hover {
  border-color: rgba(27, 107, 255, 0.35);
  color: var(--brand);
}

.side-action b {
  color: var(--brand);
}

/* ---------- 面板 ---------- */
.tool-main {
  min-width: 0;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px 28px 28px;
  box-shadow: var(--shadow-sm);
  animation: panelIn 0.28s ease;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-kicker {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--brand-2);
}

.panel-head h2 {
  margin: 6px 0 6px;
  font-size: 23px;
}

.panel-head p {
  max-width: 640px;
  font-size: 13.5px;
  color: var(--muted);
}

.panel-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  padding-top: 4px;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
  margin-top: 20px;
}

.form-card,
.result-card {
  border-radius: 16px;
  padding: 18px 18px 14px;
}

.form-card {
  border: 1px solid var(--line);
  background: #fdfefe;
}

.result-card {
  border: 1px solid rgba(27, 107, 255, 0.16);
  background:
    radial-gradient(420px 200px at 100% 0%, rgba(0, 194, 212, 0.1), transparent 70%),
    linear-gradient(160deg, #f7fbff, #f6fdfe);
}

.form-card h3,
.result-card h3 {
  font-size: 14.5px;
  margin-bottom: 14px;
}

.field {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 156px 46px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.field label {
  font-size: 13px;
  color: var(--text);
}

.field .el-select,
.field .el-input-number {
  width: 100%;
}

.field .unit {
  font-size: 12px;
  color: var(--muted);
  text-align: left;
}

.result-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(27, 107, 255, 0.16);
  font-size: 13.5px;
  color: var(--text);
}

.result-list li:last-child {
  border-bottom: 0;
}

.result-list strong {
  font-size: 15px;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.result-list strong.key {
  font-size: 21px;
  color: var(--brand);
}

.result-list em {
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.verdict {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.verdict.pass {
  background: #eaf7f0;
  color: #157347;
}

.verdict.fail {
  background: #fdeeee;
  color: #b02a37;
}

.hint {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.disclaimer {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------- 规范检索 ---------- */
.std-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  padding-top: 4px;
}

.std-input {
  width: 250px;
}

.std-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.std-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 16px 14px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.std-item:hover {
  border-color: rgba(27, 107, 255, 0.32);
  box-shadow: 0 10px 26px rgba(18, 38, 68, 0.07);
}

.std-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.std-code {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 7px;
  background: #eef4ff;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.fav-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c2cddd;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.fav-btn:hover {
  background: #f4f8ff;
  color: var(--brand);
}

.fav-btn.on {
  color: #f5a623;
}

.std-item h3 {
  margin: 10px 0 6px;
  font-size: 15.5px;
}

.std-item > p {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  min-height: 42px;
}

.std-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.std-tags span {
  padding: 2px 8px;
  border-radius: 6px;
  background: #f4f7fb;
  color: var(--muted);
  font-size: 11.5px;
}

.std-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--muted);
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 26px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: #f8fafd;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

/* ---------- 模板弹窗 ---------- */
.tpl-save {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.tpl-save p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.tpl-save-row {
  display: flex;
  gap: 10px;
}

.tpl-list {
  max-height: 320px;
  overflow: auto;
  margin-top: 10px;
}

.tpl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 4px;
  border-bottom: 1px dashed var(--line);
}

.tpl-item div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tpl-item strong {
  font-size: 14px;
  color: var(--ink);
}

.tpl-item em {
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
}

.tpl-actions {
  display: flex;
  gap: 4px;
}

/* ---------- 页脚 ---------- */
.tool-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 22px 0;
}

.tool-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}

.tool-footer .filings {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tool-footer .sep {
  color: #cbd6e4;
}

.tool-disclaimer {
  flex: 1 1 100%;
  font-size: 12px;
  line-height: 1.8;
  color: #96a4b8;
}

.tool-footer a {
  color: var(--brand);
}

.tool-footnote {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
}

/* ---------- 打印（计算书） ---------- */
.print-area {
  display: none;
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }

  body {
    background: #fff;
  }

  .tool-header,
  .tool-footer,
  .app-shell {
    display: none !important;
  }

  .print-area {
    display: block;
    color: #1a1a1a;
    font-size: 12px;
    line-height: 1.6;
  }

  .print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    padding-bottom: 10px;
    margin-bottom: 16px;
    border-bottom: 2px solid #1b6bff;
  }

  .print-header strong {
    display: block;
    font-size: 17px;
  }

  .print-header span {
    font-size: 13px;
    color: #444;
  }

  .print-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 11.5px;
  }

  .print-entry {
    page-break-inside: avoid;
    margin-bottom: 18px;
  }

  .print-entry h3 {
    margin: 0 0 4px;
    font-size: 14px;
  }

  .print-time {
    font-size: 11px;
    color: #666;
    margin-bottom: 6px;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0 10px;
    font-size: 11.5px;
  }

  .print-table th,
  .print-table td {
    border: 1px solid #c8d3e2;
    padding: 5px 8px;
    text-align: left;
  }

  .print-table th {
    background: #f2f6fc;
    font-weight: 600;
  }

  .print-table td:last-child {
    width: 42%;
  }

  .print-note {
    font-size: 11px;
    color: #444;
    margin: 4px 0;
  }

  .print-foot {
    margin-top: 22px;
    padding-top: 10px;
    border-top: 1px solid #c8d3e2;
    font-size: 10.5px;
    color: #666;
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .tool-layout {
    grid-template-columns: 1fr;
  }

  .tool-sidebar {
    position: static;
  }

  .tool-menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tool-hero-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .book-card {
    align-self: stretch;
    justify-content: space-between;
  }

  .calc-grid {
    grid-template-columns: 1fr;
  }

  .std-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .tool-top-nav {
    display: none;
  }

  .panel {
    padding: 20px 18px 22px;
  }

  .panel-head {
    flex-direction: column;
    gap: 12px;
  }

  .panel-actions {
    width: 100%;
  }

  .panel-actions .el-button {
    flex: 1;
  }

  .std-tools {
    width: 100%;
    flex-wrap: wrap;
  }

  .std-input {
    width: 100%;
  }

  .field {
    grid-template-columns: minmax(96px, 1fr) 128px 38px;
    gap: 8px;
  }

  .tool-hero-inner {
    padding: 32px 0 28px;
  }

  .tool-header .header-mail {
    display: none;
  }
}
