/* ===================== TANK Designer styles ===================== */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1d2733;
  --muted: #5b6b7b;
  --line: #d7dee6;
  --accent: #1565c0;
  --accent-2: #0d47a1;
  --ok: #1b7f3b;
  --bad: #c62828;
  --warn: #b26a00;
  --chip: #e8f0fb;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "Noto Sans", "Microsoft YaHei", "Hiragino Sans", "Malgun Gothic", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}
a { color: var(--accent); }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  background: linear-gradient(90deg, #0d47a1, #1565c0);
  color: #fff; padding: 10px 16px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.brand .logo { font-size: 20px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lang-wrap { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #e8f0fb; }
.lang-wrap select {
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 6px; font-size: 13px;
}
.btn {
  display: inline-block; text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 7px 12px; border-radius: 6px; border: 1px solid transparent; white-space: nowrap;
}
.btn-home { background: #fff; color: var(--accent-2); }
.btn-mail { background: #ffb300; color: #2a1a00; }
.btn:hover { filter: brightness(0.96); }

.tagline { text-align: center; color: var(--muted); margin: 10px 12px 4px; font-size: 13px; }

/* Layout */
.layout {
  display: grid; grid-template-columns: 360px 1fr; gap: 16px;
  max-width: 1280px; margin: 0 auto; padding: 12px 16px 24px;
}
@media (max-width: 880px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px;
}
.inputs h2, .results h2 { font-size: 15px; margin: 2px 0 12px; }

.unit-toggle {
  display: flex; gap: 16px; margin-bottom: 12px; padding: 8px 10px;
  background: var(--chip); border-radius: 8px; font-size: 13px;
}
.unit-toggle label { cursor: pointer; }

fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 14px; padding: 8px 12px 12px; }
legend { font-weight: 600; color: var(--accent-2); padding: 0 6px; font-size: 13px; }

.field { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.field label { flex: 1 1 160px; font-size: 12.5px; color: var(--muted); }
.field input, .field select {
  flex: 1 1 120px; max-width: 180px; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 6px; font-size: 13px; background: #fff; color: var(--ink);
}
.field .unit { flex: 0 0 auto; color: var(--muted); font-size: 12px; min-width: 26px; }
.mini { flex: 0 0 auto; padding: 4px 8px; font-size: 12px; border: 1px solid var(--line);
  background: var(--chip); border-radius: 6px; cursor: pointer; }

/* Results */
.card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.card h3 { margin: 0 0 8px; font-size: 13.5px; color: var(--accent-2); }

table.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
table.kv td { padding: 4px 6px; border-bottom: 1px solid #eef2f6; vertical-align: top; }
table.kv td:first-child { color: var(--muted); width: 55%; }
table.kv td:last-child { font-weight: 600; text-align: right; }

table.mto { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.mto th, table.mto td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.mto th { background: var(--chip); color: var(--accent-2); font-weight: 600; }
table.mto td.num, table.mto th.num { text-align: right; }
.mto-total { font-weight: 700; margin: 8px 0; font-size: 13px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.grid th, table.grid td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: center; }
table.grid th { background: var(--chip); color: var(--accent-2); font-weight: 600; }
.pass { color: var(--ok); font-weight: 700; }
.fail { color: var(--bad); font-weight: 700; }
.warn { color: var(--warn); font-weight: 700; }
.tag-req { color: var(--accent); }
.import-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.import-row .hint { font-size: 12px; }
.tag-min { color: var(--warn); }
.val-ok { background: #e7f4ea; border: 1px solid var(--ok); color: #14532d; border-radius: 8px; padding: 10px 12px; }
.fea-list { margin: 8px 0 0 0; padding-left: 18px; }
.fea-list li { margin-bottom: 4px; }

.diagram-card svg { width: 100%; max-width: 420px; height: auto; display: block; margin: 0 auto; }
.dim-line { stroke: #607d8b; stroke-width: 1; }
.dim-text { fill: #37474f; font-size: 11px; }
.tank-shell { fill: #e3edf7; stroke: #1565c0; stroke-width: 2; }
.tank-course { fill: none; stroke: #1565c0; stroke-width: 1; }
.tank-roof { fill: #fbe9c7; stroke: #b26a00; stroke-width: 2; }
.tank-bottom { fill: #cfd8dc; stroke: #455a64; stroke-width: 2; }
.tank-annular { fill: #b0bec5; stroke: #455a64; stroke-width: 1.5; }
.tank-bolt { fill: #d84315; stroke: #d84315; stroke-width: 1.8; }
.tank-girder { fill: none; stroke: #6a1b9a; stroke-width: 1.8; stroke-dasharray: 5 3; }
.field-note { flex: 1 1 100%; font-size: 11.5px; color: var(--muted); margin: 2px 0 0; line-height: 1.35; }

.ref { margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: #fbfdff; }
.ref summary { cursor: pointer; font-weight: 600; color: var(--accent-2); }
.ref ul { margin: 8px 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
.ref .disclaimer { font-size: 12px; color: var(--warn); margin: 6px 0 0; }
.disclaimer { font-size: 12px; color: var(--warn); }

.foot { text-align: center; color: var(--muted); font-size: 11.5px; padding: 8px 16px 24px; max-width: 1280px; margin: 0 auto; }

/* Diagram note */
.diagram-note { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* Export bar */
.export-bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.export-bar .mini { font-size: 12px; padding: 6px 10px; }

/* Print / PDF layout */
@media print {
  .topbar, .inputs, .export-bar, .ref, .foot, .tagline { display: none !important; }
  .layout { grid-template-columns: 1fr; max-width: 100%; padding: 0; }
  .panel { border: none; box-shadow: none; padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
  body { background: #fff; }
}

/* Input validation banner (②) */
.validation-box { margin: 10px 0 4px; font-size: 13px; }
.validation-box .val-err,
.validation-box .val-warn { border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.validation-box .val-err { background: #fdecea; border: 1px solid var(--bad); color: #7f1d1d; }
.validation-box .val-warn { background: #fff4e0; border: 1px solid var(--warn); color: #7a4a00; }
.validation-box ul { margin: 6px 0 0; padding-left: 18px; }
.validation-box li { margin: 2px 0; }

/* ⑥ visualization captions */
.viz-cap { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.viz-legend { font-size: 11px; color: var(--muted); margin-top: 6px; }
