:root {
  --primary: #1a6feb;
  --primary-dark: #1254b8;
  --accent: #f5a623;
  --bg: #f2f5f9;
  --card: #ffffff;
  --text: #1c2733;
  --text-soft: #5b6b7c;
  --border: #dde4ec;
  --ok: #17a26b;
  --warn: #d9822b;
  --danger: #d64545;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(16, 42, 67, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, "PingFang SC",
    "Microsoft YaHei", "Noto Sans", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Top bar ---------- */
.topbar {
  background: linear-gradient(90deg, #0f3d7a 0%, var(--primary) 55%, #1a86d8 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brand { font-size: 19px; font-weight: 700; letter-spacing: 0.3px; white-space: nowrap; }
.brand small { display: block; font-size: 11px; font-weight: 400; opacity: 0.85; }
.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 6px 13px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}
.btn:hover { background: rgba(255, 255, 255, 0.25); text-decoration: none; }
.btn.solid { background: var(--accent); border-color: var(--accent); color: #3a2a05; font-weight: 600; }
.btn.solid:hover { background: #ffb94a; }

.lang-select {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  border-radius: 20px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  max-width: 170px;
}
.lang-select option { color: #1c2733; background: #fff; }

/* ---------- Sub nav ---------- */
.subnav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(16, 42, 67, 0.05);
}
.subnav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 6px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.subnav a {
  display: inline-block;
  padding: 7px 13px;
  border-radius: 18px;
  font-size: 13.5px;
  color: var(--text-soft);
  transition: all 0.15s;
}
.subnav a:hover { background: #eef3fa; color: var(--primary); text-decoration: none; }
.subnav a.active { background: var(--primary); color: #fff; }

/* ---------- Layout ---------- */
.container { max-width: 1280px; margin: 0 auto; padding: 22px 18px 60px; }
.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0 0 6px; font-size: 26px; }
.page-head p { margin: 0; color: var(--text-soft); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 20px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 18px;
  border-left: 4px solid var(--primary);
  padding-left: 10px;
}

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.toolbar label { font-size: 13.5px; color: var(--text-soft); }
select, input[type="text"], input[type="search"] {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  max-width: 100%;
}
select:focus, input:focus { outline: 2px solid rgba(26, 111, 235, 0.25); border-color: var(--primary); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  background: #fff;
}
table.data th {
  background: #eef3fa;
  color: var(--text);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
table.data td {
  padding: 9px 12px;
  border-bottom: 1px solid #eef1f5;
  vertical-align: top;
}
table.data tr:nth-child(even) td { background: #f8fafc; }
table.data tr:hover td { background: #eef6ff; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.empty, .muted { color: var(--text-soft); }
.group-row td {
  background: #dfe9f7 !important;
  font-weight: 700;
  color: #0f3d7a;
}

.tag {
  display: inline-block;
  background: #e8f1fd;
  color: var(--primary-dark);
  border-radius: 12px;
  padding: 2px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.unit-tag {
  display: inline-block;
  background: #eef1f5;
  color: var(--text-soft);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  white-space: nowrap;
}

code.g-ex {
  font-family: Consolas, Menlo, Monaco, "Courier New", monospace;
  font-size: 12.5px;
  background: #f4f6f8;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}

table.data.compact th, table.data.compact td { padding: 6px 10px; font-size: 12.5px; }

/* ---------- Home cards ---------- */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.feature-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 4px solid var(--primary);
}
.feature-card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(16, 42, 67, 0.14); }
.feature-card .icon { font-size: 30px; }
.feature-card h3 { margin: 0; font-size: 17px; }
.feature-card p { margin: 0; color: var(--text-soft); font-size: 13.5px; flex: 1; }
.feature-card a.more { align-self: flex-start; font-weight: 600; font-size: 13.5px; }

/* ---------- Misc ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-soft);
  border-radius: 20px;
  padding: 7px 15px;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.panel { display: none; }
.panel.active { display: block; }

.hint {
  background: #fff8e6;
  border: 1px solid #f3dfae;
  color: #7a5b12;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.eq-p { white-space: nowrap; font-size: 12.5px; }
.eq-p b { color: var(--text); font-weight: 600; }

.note-list {
  padding-left: 20px;
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.7;
  margin-bottom: 20px;
}
.note-list li { margin-bottom: 4px; }

footer.footer {
  text-align: center;
  color: var(--text-soft);
  font-size: 12.5px;
  padding: 18px 10px 30px;
}
footer.footer a { color: var(--text-soft); }

@media (max-width: 640px) {
  .brand { font-size: 16px; }
  .top-actions { margin-left: 0; width: 100%; justify-content: flex-start; }
  .page-head h1 { font-size: 21px; }
}

/* ---------- Generated G-code block ---------- */
pre.code {
  background: #0f1b2a;
  color: #d7e3f4;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: "Consolas", "Menlo", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
  margin: 0 0 12px;
}
pre.code .cm { color: #6b87a8; }

