/* ============================================================
   Mcloud 在线设计系统 - 全局样式
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f4f6f9; color: #1a2634; line-height: 1.6;
}
a { color: #1e6fd9; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 640px; }

/* ---------- 头部 ---------- */
.site-header {
  background: #0e2a47; color: #fff; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.site-header * { color: #fff !important; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.logo { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.logo span { color: #ffffff; font-weight: 400; font-size: 15px; }
.nav a { color: #ffffff; margin: 0 12px; font-size: 15px; padding: 6px 4px; font-weight: 500; }
.nav a:hover { color: #e0e7ff; text-decoration: none; }
.nav a.active { color: #ffffff; border-bottom: 2px solid #7cc0ff; }
.auth-area { display: flex; align-items: center; gap: 8px; }
.user-name { color: #ffffff; font-size: 14px; margin-right: 6px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; border: none; cursor: pointer; font-size: 15px;
  padding: 9px 18px; border-radius: 6px; transition: all .2s;
  font-family: inherit; text-align: center;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.primary { background: #1e6fd9; color: #fff; }
.btn.primary:hover { background: #185bb0; }
.btn.ghost { background: transparent; color: #1a2634; border: 1px solid #ccd4dd; }
.btn.ghost:hover { border-color: #1e6fd9; color: #1e6fd9; }
.btn.light { background: #fff; color: #0e2a47; }
.btn.lg { padding: 13px 30px; font-size: 17px; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.xsm { padding: 3px 8px; font-size: 12px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- 卡片/区块 ---------- */
.card { background: #fff; border-radius: 10px; padding: 22px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.feature { text-align: center; }
.feature .feat-icon { font-size: 40px; margin-bottom: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 24px; }
.section-title { text-align: center; margin: 40px 0 10px; font-size: 24px; }
.page-title { margin: 30px 0 20px; font-size: 24px; }
.mt { margin-top: 18px; }
.mb { margin-bottom: 14px; }
.muted { color: #8a94a1; }
.center { text-align: center; }
.small { font-size: 13px; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, #0e2a47, #1d4e8f); color: #fff;
  padding: 70px 0; text-align: center;
}
.hero h1 { font-size: 38px; line-height: 1.3; margin-bottom: 18px; }
.hero .sub { font-size: 17px; color: #c9dcf2; max-width: 700px; margin: 0 auto 30px; }
.hero-cta { display: flex; gap: 16px; justify-content: center; }
.hero-cta .btn.ghost { border-color: #7cc0ff; color: #fff; }
.hero-cta .btn.ghost:hover { background: rgba(255,255,255,.1); }

/* ---------- CTA 带 ---------- */
.cta-band {
  background: #1d4e8f; color: #fff; text-align: center; padding: 50px 20px; margin-top: 40px;
}
.cta-band h2 { margin-bottom: 12px; }
.cta-band p { color: #c9dcf2; margin-bottom: 20px; }

/* ---------- 页脚 ---------- */
.site-footer { background: #0e2a47; color: #9fb3c8; text-align: center; padding: 24px 0; margin-top: 40px; }
.site-footer .muted { color: #6d8399; }

/* ---------- 认证页 ---------- */
.auth-body { background: linear-gradient(135deg, #f7f9fc, #e8eef6); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-wrap { width: 100%; max-width: 400px; }
.auth-card { background: #fff; border-radius: 14px; padding: 30px 26px; width: 100%; max-width: 350px; box-shadow: 0 6px 24px rgba(15,42,74,.10); border: 1px solid #e4e9f0; }
.auth-card h1 { font-size: 22px; text-align: center; color: #0f2a4a; margin-bottom: 4px; font-weight: 800; }
.auth-sub { text-align: center; color: #6b7a90; margin-bottom: 22px; font-size: 14px; }
.auth-card label { display: block; font-size: 14px; margin: 14px 0 5px; color: #1a2634; font-weight: 500; }
.auth-card label .req { color: #dc2626; }
.auth-card label .opt { color: #9ca3af; font-weight: 400; }
.auth-card input { width: 100%; padding: 11px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 15px; box-sizing: border-box; color: #16233a; background: #fff; }
.auth-card input:focus { outline: none; border-color: #1e6fd9; box-shadow: 0 0 0 3px rgba(30,111,217,.12); }
.auth-card .btn.primary { width: 100%; margin-top: 18px; padding: 12px; font-size: 16px; }
.auth-link { text-align: center; margin-top: 18px; font-size: 14px; color: #334155; }
.auth-link a { color: #1e6fd9; font-weight: 600; }
.auth-foot { text-align: center; color: #6b7a90; font-size: 12px; margin-top: 20px; }
.auth-err { color: #dc2626; font-size: 13px; margin-top: 12px; min-height: 18px; text-align: center; }
.auth-card .err { color: #dc2626; font-size: 13px; margin-top: 10px; min-height: 18px; text-align: center; }
.req { color: #e53935; font-size: 12px; }
.opt { color: #999; font-size: 12px; }
.err { color: #e53935; font-size: 13px; min-height: 18px; margin-top: 6px; }

/* ---------- 表单字段 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; color: #444; margin-bottom: 5px; }
.field input[type=text], .field input[type=number] { width: 100%; padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  padding: 7px 14px; border: 1px solid #ccd4dd; background: #fff; border-radius: 6px;
  cursor: pointer; font-size: 14px; color: #444; transition: all .15s;
}
.seg button.on { background: #1e6fd9; color: #fff; border-color: #1e6fd9; }
.seg.small button { padding: 5px 10px; font-size: 13px; }

.mini-row { display: flex; gap: 6px; margin-bottom: 6px; }
.mini-row input { flex: 1; padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; min-width: 0; }
select { padding: 7px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; width: 100%; margin-bottom: 6px; }
textarea { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; font-family: inherit; }

/* ---------- 列表 ---------- */
.cable-list { margin-top: 10px; }
.list-row { display: flex; align-items: center; justify-content: space-between; background: #f7f9fc; padding: 7px 10px; border-radius: 6px; margin-bottom: 5px; font-size: 14px; }
.list-row span { flex: 1; }
.empty { text-align: center; color: #99a; padding: 30px 10px; }
.empty.small { padding: 16px; font-size: 13px; }

/* ---------- 布局 ---------- */
.design-layout { display: grid; grid-template-columns: 380px 1fr; gap: 20px; margin: 24px auto; align-items: start; }
.panel-left h2, .panel-right h2 { font-size: 17px; margin-bottom: 12px; color: #0e2a47; border-bottom: 2px solid #eef2f7; padding-bottom: 8px; }
.panel-left h2:not(:first-child) { margin-top: 22px; }

/* ---------- 结果区 ---------- */
#resultArea h3 { font-size: 15px; margin: 16px 0 8px; color: #0e2a47; }
.result-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 6px; }
.summary-item { background: #f0f6ff; border-radius: 8px; padding: 10px; text-align: center; }
.summary-item span { display: block; font-size: 12px; color: #7a8ca0; }
.summary-item b { font-size: 15px; color: #0e2a47; }
.bom-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bom-table th, .bom-table td { border: 1px solid #e3e8ef; padding: 6px 8px; text-align: center; }
.bom-table th { background: #f0f6ff; color: #0e2a47; }
.export-actions { display: flex; gap: 10px; }

/* ---------- 历史方案 ---------- */
.project-list { display: flex; flex-direction: column; gap: 12px; }
.project-card { display: flex; justify-content: space-between; align-items: center; background: #fff; border-radius: 10px; padding: 16px 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.proj-title { font-size: 16px; font-weight: 600; color: #0e2a47; }
.proj-meta { color: #666; font-size: 13px; margin-top: 4px; }
.proj-date { color: #99a; font-size: 12px; margin-top: 3px; }
.proj-actions { display: flex; gap: 8px; }

.notice { background: #fff7e6; border: 1px solid #ffcc80; border-radius: 8px; padding: 14px; margin-top: 16px; color: #8a6d3b; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1a2634; color: #fff; padding: 12px 24px; border-radius: 8px; z-index: 999;
  opacity: 0; transition: all .3s; box-shadow: 0 4px 15px rgba(0,0,0,.3); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .design-layout { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; gap: 8px; }
  .hero h1 { font-size: 28px; }
}

/* ---------- 模态框 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; padding: 26px 28px; max-width: 460px; width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,.25); max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 19px; margin: 0 0 6px; color: #0f172a; }
.modal-sub { font-size: 13px; color: #475569; margin: 0 0 18px; }
.modal-field { margin-bottom: 16px; }
.modal-field label { display: block; font-size: 13px; color: #334155; margin-bottom: 6px; font-weight: 500; }
.modal-field .req { color: #dc2626; }
.modal-field select, .modal-field input[type=number] {
  width: 100%; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px; box-sizing: border-box; color: #0f172a;
}
.modal-actions { margin-top: 18px; }
.query-result { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px; margin-top: 6px; }
.query-result .best { font-size: 15px; color: #166534; }
.query-result ul { margin: 4px 0 0; }
.query-box { margin: 4px 0 12px; }
.modal-field .mini-row-gap { display: flex; gap: 8px; }

/* ---------- 孔位利用 ---------- */
.hole-status { margin-top: 8px; }
.progress { background: #e8eef6; border-radius: 8px; height: 12px; overflow: hidden; margin-bottom: 10px; }
.progress .bar { background: linear-gradient(90deg, #1e6fd9, #3b82f6); height: 100%; border-radius: 8px; }
.hole-status .notice { background: #fffbe8; border: 1px solid #f0e2a8; color: #6b5a1e; border-radius: 8px; padding: 12px 14px; font-size: 13px; line-height: 1.7; }
.seg button small { display: block; font-size: 10px; opacity: .75; font-weight: 400; }
.seg button { line-height: 1.2; padding: 7px 8px; }
#frameHint { margin-top: 6px; }
.frame-tool { margin-top: 10px; border-top: 1px solid #eef1f5; padding-top: 10px; }
.mini-row .inline-label { margin: 0 4px 0 8px; color: #55657d; font-size: 13px; align-self: center; }
.check-label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check-label input[type=checkbox] { width: 16px; height: 16px; accent-color: #1e6fd9; }

/* ---------- 图纸预览 ---------- */
.preview-box { margin-top: 12px; }
.preview-scroll { border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px; background: #f8fafc; margin-top: 8px; }
.preview-scroll svg { max-width: 100%; border-radius: 4px; }

/* ---------- 历史方案卡片（带缩略图） ---------- */
.project-card.has-thumb { display: grid; grid-template-columns: 110px 1fr auto; gap: 14px; align-items: center; }
.proj-thumb img { width: 110px; height: 88px; object-fit: contain; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; padding: 4px; }
.proj-thumb.empty-t { width: 110px; height: 88px; display: flex; align-items: center; justify-content: center; border: 1px dashed #cbd5e1; border-radius: 8px; color: #94a3b8; font-size: 12px; background: #f8fafc; }
@media (max-width: 600px) { .project-card.has-thumb { grid-template-columns: 1fr; } .proj-thumb img { width: 100%; height: auto; } }
