/* ============================================================
   style.css — EngTool Laser Cutting Parameter Database
   Industrial blue/steel theme, responsive, print-friendly.
   ============================================================ */
:root {
  --navy-900: #0b1f3a;
  --navy-800: #12294d;
  --navy-700: #1b3a6b;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --amber-500: #f59e0b;
  --amber-400: #fbbf24;
  --steel-50: #f5f7fa;
  --steel-100: #e8edf3;
  --steel-200: #d3dce8;
  --steel-500: #64748b;
  --steel-700: #334155;
  --ink: #1e293b;
  --ok: #16a34a;
  --red: #dc2626;
  --shadow: 0 1px 3px rgba(15, 23, 42, .12), 0 4px 14px rgba(15, 23, 42, .08);
  --radius: 10px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Noto Sans KR", "Noto Sans JP",
          Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, #eef2f7 0%, #f7f9fc 240px);
  line-height: 1.55;
}
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- header ---------- */
#site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 100%);
  color: #fff;
}
.brand a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--amber-500), var(--amber-400));
  color: var(--navy-900);
  font-size: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
}
.btn-outline-light {
  border-color: rgba(255, 255, 255, .5);
  color: #fff;
  background: rgba(255, 255, 255, .06);
}
.btn-outline-light:hover {
  background: rgba(255, 255, 255, .16);
  border-color: #fff;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
  background: var(--steel-100);
  color: var(--steel-700);
  border-color: var(--steel-200);
}
.btn-ghost:hover { background: var(--steel-200); }
.lang-label {
  color: rgba(255, 255, 255, .85);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lang-select {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .4);
  background: var(--navy-800);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.mainnav {
  display: flex;
  gap: 2px;
  background: var(--navy-800);
  padding: 0 14px;
}
.mainnav a {
  color: rgba(255, 255, 255, .82);
  padding: 9px 14px;
  font-size: 13.5px;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  text-decoration: none;
}
.mainnav a:hover { color: #fff; background: rgba(255, 255, 255, .07); text-decoration: none; }
.mainnav a.active {
  color: #fff;
  border-bottom-color: var(--amber-400);
  background: rgba(255, 255, 255, .08);
  font-weight: 600;
}

/* ---------- dropdown menu (Windows style) ---------- */
.menu-group { position: relative; }
.menu-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255, 255, 255, .82);
  font-family: inherit;
  font-size: 13.5px;
  padding: 9px 14px;
  white-space: nowrap;
  cursor: pointer;
}
.menu-btn:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.menu-group.active .menu-btn {
  color: #fff;
  border-bottom-color: var(--amber-400);
  background: rgba(255, 255, 255, .08);
  font-weight: 600;
}
.menu-caret { font-size: 10px; opacity: .75; transition: transform .15s ease; }
.menu-group.open .menu-caret { transform: rotate(180deg); }
.menu-drop {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 230px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--steel-200);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, .2);
  display: none;
  z-index: 60;
}
.menu-group:last-child .menu-drop { left: auto; right: 0; }
.menu-group.open .menu-drop { display: block; column-count: 2; column-gap: 4px; }
.menu-drop a {
  display: block;
  padding: 8px 12px;
  border-bottom: none;
  border-radius: 6px;
  color: var(--steel-700);
  font-size: 13px;
  white-space: nowrap;
  break-inside: avoid;
}
.menu-drop a:hover { background: var(--blue-100); color: var(--blue-600); text-decoration: none; }
.menu-drop a.active { background: var(--blue-100); color: var(--blue-600); font-weight: 600; }
@media (hover: hover) {
  .menu-group:hover .menu-drop { display: block; }
}
@media (max-width: 720px) {
  .menu-group.open .menu-drop { column-count: 1; min-width: 200px; }
  .menu-btn { padding: 9px 10px; font-size: 13px; }
}

/* ---------- layout ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 18px 20px 40px; }
.page-head { margin: 6px 0 18px; }
.page-head h1 {
  margin: 0 0 6px;
  font-size: 26px;
  color: var(--navy-800);
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-head h1 .ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  color: #fff;
  font-size: 20px;
  box-shadow: var(--shadow);
}
.page-desc { color: var(--steel-500); font-size: 14.5px; max-width: 900px; margin: 0; }
.crumbs { font-size: 12.5px; color: var(--steel-500); margin-bottom: 10px; }
.crumbs a { color: var(--blue-600); }

/* ---------- tip banner ---------- */
.tip-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fff8e6;
  border: 1px solid #f3dfa8;
  border-left: 4px solid var(--amber-500);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 0 0 18px;
  font-size: 13.5px;
  color: #6b5317;
}
.tip-banner b { display: block; margin-bottom: 2px; color: #8a6d1f; }

/* ---------- filters ---------- */
.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  background: #fff;
  border: 1px solid var(--steel-200);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.f-item { display: flex; flex-direction: column; gap: 4px; }
.f-item.grow { flex: 1 1 220px; }
.f-item label {
  font-size: 12px;
  font-weight: 600;
  color: var(--steel-700);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.f-item input, .f-item select {
  padding: 8px 10px;
  border: 1px solid var(--steel-200);
  border-radius: 8px;
  font-size: 13.5px;
  background: #fff;
  color: var(--ink);
  min-width: 120px;
}
.f-item input:focus, .f-item select:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}
.f-item .btn { margin-top: 16px; }

/* ---------- table cards ---------- */
.table-card {
  background: #fff;
  border: 1px solid var(--steel-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 22px;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border-bottom: 1px solid var(--steel-200);
}
.card-head h2 {
  margin: 0;
  font-size: 15.5px;
  color: var(--navy-800);
  font-weight: 700;
  word-break: break-word;
}
.card-head .count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--blue-600);
  background: var(--blue-100);
  border-radius: 999px;
  padding: 3px 12px;
  white-space: nowrap;
}
.badge {
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 11px;
  white-space: nowrap;
}
.badge.cut { background: #dcfce7; color: #15803d; }
.badge.pierce { background: #ffe4e6; color: #be123c; }
.badge.matrix { background: #ede9fe; color: #6d28d9; }

.tbl-wrap {
  overflow-x: auto;
  max-height: 560px;
  overflow-y: auto;
  position: relative;
}
.data-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 640px;
}
.data-tbl thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--navy-800);
  color: #fff;
  font-weight: 600;
  font-size: 12.5px;
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 2px solid var(--navy-700);
}
.data-tbl td {
  padding: 7px 10px;
  border-bottom: 1px solid #eef1f5;
  white-space: nowrap;
  vertical-align: top;
}
.data-tbl tbody tr:nth-child(even) { background: #f8fafc; }
.data-tbl tbody tr:hover { background: #eff6ff; }
.data-tbl td.c-mat { font-weight: 600; color: var(--navy-800); }
.data-tbl td.c-hl { font-weight: 700; color: var(--blue-600); }
.td-copy { width: 34px; text-align: center; }
.btn-copy {
  border: 1px solid var(--steel-200);
  background: #fff;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 13px;
  color: var(--steel-500);
  cursor: pointer;
}
.btn-copy:hover { background: var(--blue-100); color: var(--blue-600); border-color: var(--blue-500); }

/* export buttons */
.btn-export {
  border: 1px solid var(--steel-200);
  background: #fff;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 14px;
  line-height: 1.2;
  color: var(--blue-600);
  cursor: pointer;
  margin-left: 8px;
}
.btn-export:hover { background: var(--blue-100); border-color: var(--blue-500); }

/* export toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  background: var(--navy-800);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* matrix tables */
.matrix-tbl td, .matrix-tbl th { white-space: normal; min-width: 90px; }
.matrix-tbl thead th { white-space: nowrap; }

/* ---------- legend ---------- */
.legend {
  font-size: 12.5px;
  color: var(--steel-500);
  background: #fbfcfe;
  border: 1px dashed var(--steel-200);
  border-radius: 8px;
  padding: 7px 12px;
  margin-bottom: 18px;
}
.legend b { color: var(--steel-700); margin-right: 6px; }

/* ---------- empty ---------- */
.empty {
  background: #fff;
  border: 1px dashed var(--steel-200);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--steel-500);
  font-size: 15px;
}

/* ---------- lookup ---------- */
.lookup {
  background: linear-gradient(135deg, #fdfbf3, #fef9ec);
  border: 1px solid #f0e2b8;
  border-left: 4px solid var(--amber-500);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.lookup-head { display: flex; align-items: center; gap: 8px; }
.lookup-head h3 { margin: 0; font-size: 16px; color: var(--navy-800); }
.lookup-icon { font-size: 18px; }
.lookup-hint { margin: 6px 0 12px; font-size: 12.5px; color: var(--steel-500); }
.lookup-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.lookup-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--steel-700);
}
.lookup-controls select, .lookup-controls input {
  padding: 8px 10px;
  border: 1px solid var(--steel-200);
  border-radius: 8px;
  font-size: 13.5px;
  min-width: 150px;
}
.lookup-controls input:focus, .lookup-controls select:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}
.lk-result-card {
  margin-top: 14px;
  background: #fff;
  border: 1px solid var(--steel-200);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.lk-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 8px;
}
.lk-from { margin: 4px 0 10px; font-size: 13px; color: var(--steel-700); font-weight: 600; }
.lk-tbl { border-collapse: collapse; font-size: 13.5px; }
.lk-tbl th {
  text-align: left;
  padding: 5px 14px 5px 0;
  color: var(--steel-500);
  font-weight: 600;
  white-space: nowrap;
}
.lk-tbl td { padding: 5px 10px; font-weight: 600; color: var(--navy-800); }
.lk-tbl .lk-mat td { font-size: 15px; color: var(--blue-600); }
.lk-none { color: var(--red); font-size: 13.5px; margin-top: 10px; }

/* ---------- home ---------- */
.hero {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 60%, var(--blue-600) 130%);
  color: #fff;
  border-radius: 14px;
  padding: 34px 30px;
  margin-bottom: 26px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 191, 36, .28), transparent 65%);
}
.hero h1 { margin: 0 0 8px; font-size: 30px; }
.hero p { margin: 0; max-width: 760px; opacity: .92; font-size: 14.5px; }
.hero-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn { font-size: 14px; padding: 9px 18px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}
.stat {
  background: #fff;
  border: 1px solid var(--steel-200);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat .num { font-size: 26px; font-weight: 800; color: var(--blue-600); }
.stat .lab { font-size: 12.5px; color: var(--steel-500); margin-top: 2px; }

.section-title {
  font-size: 18px;
  color: var(--navy-800);
  margin: 26px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--steel-200); }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 16px;
}
.card {
  background: #fff;
  border: 1px solid var(--steel-200);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .15s ease, box-shadow .15s ease;
  color: var(--ink);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .15);
  text-decoration: none;
}
.card .c-ic {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
}
.card h3 { margin: 4px 0 0; font-size: 16px; color: var(--navy-800); }
.card p { margin: 0; font-size: 13px; color: var(--steel-500); line-height: 1.5; }
.card .c-meta {
  font-size: 12px;
  color: var(--blue-600);
  font-weight: 600;
  margin-top: auto;
  display: flex;
  justify-content: space-between;
}
.howto {
  background: #fff;
  border: 1px solid var(--steel-200);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  counter-reset: step;
}
.howto ol { margin: 0; padding-left: 0; list-style: none; }
.howto li {
  counter-increment: step;
  position: relative;
  padding: 8px 0 8px 44px;
  font-size: 14px;
  color: var(--steel-700);
}
.howto li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue-100);
  color: var(--blue-600);
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- footer ---------- */
#site-footer {
  background: var(--navy-900);
  color: rgba(255, 255, 255, .75);
  margin-top: 30px;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px;
  text-align: center;
  font-size: 13px;
}
.footer-inner p { margin: 6px 0; }
.footer-disc { color: var(--amber-400); }
.footer-links a { color: rgba(255, 255, 255, .8); }

/* ---------- back-to-top ---------- */
.gotop {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--navy-800);
  color: #fff;
  border: none;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 40;
  display: none;
}
.gotop.show { display: block; }
.gotop:hover { background: var(--navy-700); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .topbar { padding: 10px 12px; }
  .brand-text { font-size: 14px; }
  .page-head h1 { font-size: 21px; }
  .hero { padding: 24px 18px; }
  .hero h1 { font-size: 23px; }
  .filters { padding: 12px; }
  .f-item, .f-item.grow { flex: 1 1 100%; }
}

/* ---------- print ---------- */
@media print {
  #site-header, .filters, .lookup, .gotop, .tip-banner, .crumbs, .btn-copy, .td-copy, .btn-export { display: none !important; }
  body { background: #fff; }
  .wrap { padding: 0; max-width: none; }
  .table-card { box-shadow: none; break-inside: avoid; }
  .tbl-wrap { max-height: none; overflow: visible; }
  .data-tbl thead th { position: static; background: var(--navy-800); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .data-tbl td, .data-tbl th { white-space: normal; }
  body.dark .table-card, body.dark .card-head, body.dark .stat, body.dark .card,
  body.dark .filters, body.dark .calc-card, body.dark .res-item { background: #fff !important; }
  body.dark .card-head h2, body.dark .res-item .res-num, body.dark .res-item .res-lab { color: var(--navy-800) !important; }
}

/* ---------- favorites page ---------- */
.fav-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.fav-count { font-size: 13px; font-weight: 600; color: var(--steel-500); }
.fav-actions { display: inline-flex; gap: 8px; margin-left: auto; }
.fav-actions .btn { padding: 5px 10px; font-size: 12.5px; }

/* ---------- favorite stars in tables ---------- */
.th-fav, .td-fav { width: 34px; text-align: center; }
.btn-fav {
  background: none;
  border: none;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  color: var(--steel-200);
  padding: 2px 4px;
  transition: color .12s ease;
}
.btn-fav:hover { color: var(--amber-400); }
.btn-fav.on { color: var(--amber-500); }

/* search highlight */
mark { background: #fff380; color: inherit; padding: 0 2px; border-radius: 2px; }
body.dark mark { background: #7c6a10; color: #fff; }

/* ---------- mobile filter collapse ---------- */
.filters-wrap { position: relative; }
.filters-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--steel-200);
  background: #fff;
  color: var(--steel-700);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
@media (max-width: 720px) {
  .filters-toggle { display: inline-flex; }
  .filters { display: none; margin-bottom: 12px; }
  .filters-wrap.open .filters { display: flex; }
}

/* ---------- calculator ---------- */
.calc-card {
  background: #fff;
  border: 1px solid var(--steel-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 20px;
}
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.calc-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--steel-700);
}
.calc-grid input, .calc-grid select {
  padding: 8px 10px;
  border: 1px solid var(--steel-200);
  border-radius: 8px;
  font-size: 13.5px;
  background: #fff;
  color: var(--ink);
  min-width: 120px;
}
.calc-grid input:focus, .calc-grid select:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}
/* density input with its unit selector on one row */
.calc-grid label.dens-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}
.calc-grid label.dens-row span { grid-column: 1 / -1; }
.calc-grid label.dens-row input { min-width: 0; }
.calc-grid label.dens-row select { min-width: 0; }
.calc-actions { margin-top: 14px; }
.res-title { margin: 0 0 8px; font-size: 15.5px; color: var(--navy-800); }
.calc-source { margin: 0 0 10px; font-size: 12.5px; color: var(--steel-500); }
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.res-item {
  background: #f8fafc;
  border: 1px solid var(--steel-200);
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
}
.res-item .res-num { font-size: 21px; font-weight: 800; color: var(--blue-600); }
.res-item .res-lab { font-size: 12px; color: var(--steel-500); margin-top: 2px; }
.res-item.total {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  border-color: transparent;
}
.res-item.total .res-num { color: #fff; }
.res-item.total .res-lab { color: rgba(255, 255, 255, .9); }

/* ---------- home: recently viewed ---------- */
.recents { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.recents b { font-size: 13px; color: var(--steel-700); }
.recent-chip {
  background: #fff;
  border: 1px solid var(--steel-200);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12.5px;
  color: var(--blue-600);
  font-weight: 600;
  text-decoration: none;
}
.recent-chip:hover { border-color: var(--blue-500); text-decoration: none; }

/* ---------- dark mode ---------- */
body.dark {
  --ink: #e6ebf2;
  --steel-500: #94a3b8;
  --steel-700: #cbd5e1;
  --steel-200: #2b3b55;
  --steel-100: #22314a;
  --steel-50: #1a2740;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 4px 14px rgba(0, 0, 0, .4);
  background: linear-gradient(180deg, #0d1626 0%, #0a1120 240px);
  color: var(--ink);
}
body.dark a { color: #7ea6f7; }
body.dark .page-head h1,
body.dark .section-title,
body.dark .card h3,
body.dark .lookup-head h3,
body.dark .card-head h2,
body.dark .res-title,
body.dark .howto li,
body.dark .lk-tbl td { color: var(--ink); }
body.dark .filters,
body.dark .table-card,
body.dark .stat,
body.dark .card,
body.dark .howto,
body.dark .empty,
body.dark .legend,
body.dark .lk-result-card,
body.dark .calc-card,
body.dark .recent-chip,
body.dark .filters-toggle { background: #101a2e; border-color: var(--steel-200); }
body.dark .card-head {
  background: linear-gradient(180deg, #14203a, #101a2e);
  border-bottom-color: var(--steel-200);
}
body.dark .f-item input, body.dark .f-item select,
body.dark .lookup-controls select, body.dark .lookup-controls input,
body.dark .calc-grid input, body.dark .calc-grid select {
  background: #0b1322;
  color: var(--ink);
  border-color: var(--steel-200);
}
body.dark .btn-ghost {
  background: var(--steel-100);
  color: var(--steel-700);
  border-color: var(--steel-200);
}
body.dark .btn-ghost:hover { background: var(--steel-200); }
body.dark .data-tbl td { border-bottom-color: #1c2a44; }
body.dark .data-tbl tbody tr:nth-child(even) { background: #0f1a2e; }
body.dark .data-tbl tbody tr:hover { background: #16263f; }
body.dark .data-tbl td.c-mat { color: var(--ink); }
body.dark .res-item { background: #0f1a2e; }
body.dark .menu-drop { background: #101a2e; border-color: var(--steel-200); }
body.dark .menu-drop a { color: var(--ink); }
body.dark .menu-drop a:hover { background: #16263f; color: #fff; }
body.dark .menu-drop a.active { background: #1b3a6b; color: #fff; }
body.dark .lookup {
  background: linear-gradient(135deg, #1d2433, #1a2231);
  border-color: #3a445c;
}
body.dark .tip-banner {
  background: #241f0d;
  border-color: #4a3f16;
  color: #e2c98a;
}
body.dark .tip-banner b { color: #f0d38a; }

/* ============================================================
   v2 additions — range filters, table actions, converter,
   process card, compare, quote, favorites enhancements
   ============================================================ */
.range-pair { display: inline-flex; align-items: center; gap: 4px; }
.range-pair input { width: 74px; }
.range-pair i { font-style: normal; color: var(--steel-500); }

/* ---------- table action columns ---------- */
.th-cmp, .th-fav, .th-copy, .th-card { width: 34px; text-align: center; }
.td-cmp, .td-fav, .td-copy, .td-card { text-align: center; white-space: nowrap; }
.btn-cmp, .btn-fav, .btn-copy, .btn-card {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
  color: var(--steel-500);
  border-radius: 6px;
}
.btn-cmp:hover, .btn-fav:hover, .btn-copy:hover, .btn-card:hover { background: var(--steel-100); }
.btn-cmp.on { color: var(--ok); }
.btn-fav.on { color: var(--amber-500); }

/* ---------- inline link button ---------- */
.btn-link {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--blue-600);
  font-size: 13px;
  padding: 2px 6px;
  text-decoration: none;
  border-radius: 6px;
}
.btn-link:hover { background: var(--steel-100); text-decoration: none; }
body.dark .btn-link { color: #7ea6f7; }
body.dark .btn-link:hover { background: var(--steel-200); }

/* ---------- shared toolbar for tool pages ---------- */
.card-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
}
.card-toolbar .btn { margin: 0; }

/* ---------- unit converter ---------- */
.conv-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.conv-tab {
  background: var(--steel-100);
  border: 1px solid var(--steel-200);
  color: var(--steel-700);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.conv-tab:hover { border-color: var(--blue-500); }
.conv-tab.active { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.conv-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
}
.conv-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--steel-700); }
.conv-grid select, .conv-grid input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--steel-200);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
}
.conv-grid input[readonly] { background: var(--steel-50); font-weight: 700; }
.conv-swap { align-self: end; padding: 8px 12px; }
.conv-note { margin-top: 10px; font-size: 12.5px; color: var(--steel-500); }

/* ---------- process card ---------- */
.proc-card { max-width: 170mm; }
.proc-head { border-bottom: 2px solid var(--navy-800); padding-bottom: 10px; margin-bottom: 12px; }
.proc-brand { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--steel-500); margin-bottom: 4px; }
.proc-title { font-size: 20px; font-weight: 700; color: var(--navy-800); }
.proc-model { font-size: 14px; color: var(--blue-600); margin-top: 2px; }
.proc-group { display: inline-block; font-size: 12px; background: var(--blue-100); color: var(--blue-600); border-radius: 999px; padding: 2px 10px; margin-top: 6px; }
.proc-tbl { width: 100%; border-collapse: collapse; }
.proc-tbl th { text-align: left; width: 42%; font-weight: 600; color: var(--steel-700); }
.proc-tbl th, .proc-tbl td { border-bottom: 1px solid var(--steel-100); padding: 7px 10px; font-size: 14px; }
.proc-tbl td { font-size: 15px; font-weight: 600; }
.proc-foot { margin-top: 12px; font-size: 12px; color: var(--steel-500); }

/* ---------- compare ---------- */
.cmp-wrap { overflow-x: auto; }
.cmp-tbl th, .cmp-tbl td { white-space: nowrap; }
.cmp-param { text-align: left; font-weight: 600; color: var(--steel-700); }
.cmp-item { vertical-align: top; }
.cmp-title { font-size: 14px; font-weight: 700; color: var(--navy-800); }
.cmp-model { font-size: 12px; color: var(--blue-600); margin-top: 2px; }
.cmp-actions { display: flex; gap: 2px; justify-content: center; margin-top: 4px; }
.cmp-diff { background: #fef3c7 !important; color: #92400e !important; font-weight: 600; }
body.dark .cmp-diff { background: #3a2f0d !important; color: #f5d78a !important; }

/* ---------- quote ---------- */
.quote-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.quote-settings label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--steel-700);
}
.quote-settings input, .quote-settings select {
  padding: 8px 10px;
  border: 1px solid var(--steel-200);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}
.qt-tbl { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.qt-tbl th { text-align: left; font-size: 12.5px; color: var(--steel-700); padding: 6px 8px; border-bottom: 2px solid var(--steel-200); }
.qt-tbl td { padding: 6px 8px; border-bottom: 1px solid var(--steel-100); }
.qt-tbl select, .qt-tbl input {
  width: 100%;
  min-width: 70px;
  padding: 7px 8px;
  border: 1px solid var(--steel-200);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}
.qt-res th, .qt-res td { padding: 7px 10px; text-align: right; }
.qt-res th:first-child, .qt-res td:first-child, .qt-res th:nth-child(2), .qt-res td:nth-child(2) { text-align: left; }
.qt-total td { font-weight: 700; background: var(--blue-100); border-top: 2px solid var(--blue-600); }

/* ---------- favorites enhancements ---------- */
.fav-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.fav-count { font-size: 13px; font-weight: 600; color: var(--steel-500); }
.fav-group-sel { padding: 7px 10px; border: 1px solid var(--steel-200); border-radius: 8px; font-size: 13px; background: #fff; color: var(--ink); }
.fav-group-chip {
  display: inline-block;
  font-size: 11.5px;
  background: var(--steel-100);
  color: var(--steel-700);
  border-radius: 999px;
  padding: 2px 10px;
  margin-left: 6px;
  vertical-align: middle;
}
.fav-edit {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px dashed var(--steel-200);
  background: var(--steel-50);
}
.fav-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--steel-700); }
.fav-edit input {
  padding: 7px 10px;
  border: 1px solid var(--steel-200);
  border-radius: 8px;
  font-size: 13.5px;
  min-width: 140px;
  background: #fff;
  color: var(--ink);
}

/* ---------- dark mode for v2 ---------- */
body.dark .conv-tab { background: var(--steel-100); border-color: var(--steel-200); color: var(--steel-700); }
body.dark .conv-tab.active { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
body.dark .conv-grid select, body.dark .conv-grid input,
body.dark .quote-settings input, body.dark .quote-settings select,
body.dark .qt-tbl select, body.dark .qt-tbl input,
body.dark .fav-group-sel, body.dark .fav-edit input {
  background: #0b1322;
  color: var(--ink);
  border-color: var(--steel-200);
}
body.dark .conv-grid input[readonly] { background: var(--steel-100); }
body.dark .conv-grid label, body.dark .quote-settings label,
body.dark .qt-tbl th, body.dark .fav-edit label { color: var(--steel-700); }
body.dark .proc-title, body.dark .cmp-title { color: var(--ink); }
body.dark .proc-group { background: #14203a; color: #7ea6f7; }
body.dark .proc-tbl th { color: var(--steel-700); }
body.dark .proc-tbl th, body.dark .proc-tbl td, body.dark .qt-tbl td { border-bottom-color: #1c2a44; }
body.dark .qt-total td { background: #14203a; border-top-color: var(--blue-600); }
body.dark .fav-edit { background: #0f1a2e; border-top-color: var(--steel-200); }
body.dark .fav-group-chip { background: var(--steel-100); color: var(--steel-700); }
body.dark .btn-cmp:hover, body.dark .btn-fav:hover, body.dark .btn-copy:hover,
body.dark .btn-card:hover, body.dark .btn-link:hover { background: var(--steel-200); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .conv-grid { grid-template-columns: 1fr; }
  .conv-swap { justify-self: center; transform: rotate(90deg); }
  .range-pair input { width: 62px; }
  .qt-tbl { min-width: 560px; }
  .fav-edit input { min-width: 110px; }
}

/* ---------- export column picker modal ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(11, 20, 34, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, .35);
  width: min(680px, 96vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--steel-200);
  font-size: 15px;
  color: var(--navy-800);
}
.modal-x {
  border: none;
  background: var(--steel-100);
  color: var(--steel-700);
  width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
}
.modal-x:hover { background: var(--steel-200); }
.modal-body { padding: 12px 16px; overflow-y: auto; }
.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--steel-200);
  background: var(--steel-50);
}
.modal-spacer { flex: 1; }
.col-opt-sec { margin-bottom: 12px; }
.col-opt-sec-t {
  font-size: 12px;
  font-weight: 700;
  color: var(--steel-500);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 7px;
}
.col-opt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 12px;
}
.col-opt {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.col-opt:hover { background: var(--steel-100); }
.col-opt input { accent-color: var(--blue-600); width: 15px; height: 15px; flex: none; }

/* ---------- speed-thickness charts ---------- */
.chart-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.chart-controls label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--steel-700);
}
.chart-controls select {
  padding: 8px 10px;
  border: 1px solid var(--steel-200);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  min-width: 170px;
}
.chart-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  min-height: 26px;
}
.lg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--steel-200);
  border-radius: 999px;
  background: #fff;
  font-size: 12.5px;
  color: var(--ink);
}
.lg-item i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  flex: none;
}
.chart-box {
  background: #fff;
  border: 1px solid var(--steel-200);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow);
}
.chart-box canvas { display: block; max-width: 100%; }
.chart-note { margin-top: 10px; }
.chart-note .empty { padding: 16px; }

/* ---------- nesting aid ---------- */
.nest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.nest-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--steel-700);
}
.nest-grid input {
  padding: 8px 10px;
  border: 1px solid var(--steel-200);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}
.nest-meta {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--steel-500);
  border-top: 1px dashed var(--steel-200);
  padding-top: 8px;
}
.nest-sketch { margin-top: 12px; overflow-x: auto; }
.nest-sketch svg { max-width: 100%; height: auto; display: block; }

/* ---------- dark mode for v3 modules ---------- */
body.dark .modal-box { background: #0f1a2e; }
body.dark .modal-head { color: var(--ink); border-bottom-color: #1c2a44; }
body.dark .modal-x { background: var(--steel-100); color: var(--steel-700); }
body.dark .modal-foot { background: #0b1322; border-top-color: #1c2a44; }
body.dark .col-opt { color: var(--ink); }
body.dark .col-opt:hover { background: #14203a; }
body.dark .col-opt-sec-t { color: var(--steel-500); }
body.dark .chart-controls select,
body.dark .nest-grid input {
  background: #0b1322;
  color: var(--ink);
  border-color: #1c2a44;
}
body.dark .chart-controls label, body.dark .nest-grid label { color: var(--steel-700); }
body.dark .chart-box { background: #0f1a2e; border-color: #1c2a44; }
body.dark .lg-item { background: #0f1a2e; border-color: #1c2a44; color: var(--ink); }
body.dark .nest-meta { color: var(--steel-500); border-top-color: #1c2a44; }
body.dark .nest-sketch svg rect[fill="#eef2f7"] { fill: #0f1a2e; }
body.dark .nest-sketch svg rect[stroke="#94a3b8"] { stroke: #334155; }

/* ---------- material weight calculator ---------- */
.weight-note { margin: 10px 0 0; font-size: 12px; color: var(--steel-500); }
.res-num small { font-size: 12px; font-weight: 600; }
body.dark .weight-note { color: var(--steel-500); }

/* ---------- responsive for v3 modules ---------- */
@media (max-width: 720px) {
  .chart-controls select { min-width: 120px; }
  .chart-box canvas { width: 100% !important; height: auto !important; }
  .col-opt-grid { grid-template-columns: 1fr 1fr; }
}

