/* Công cụ tính – Sổ tay tính toán cơ khí */
.sotay { --ink: #1f4e79; --ink-soft: #3d6a95; --paper: #f5f7f9; --sheet: #ffffff; --line: #d5dde6; --line-strong: #a9b7c6; --text: #17222d; --muted: #5b6876;
  --in-bg: #fff2cc; --in-line: #e5c86a; --res-bg: #e2efda; --res-line: #a9cf94; --ok: #2f7d32; --ok-bg: #e3f2e1; --bad: #b3261e; --bad-bg: #fbe4e2; --warn: #9a6400; --warn-bg: #fdf0d5; --focus: #2b7de9;
  --f-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif; --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color: var(--text); font-size: 14px; line-height: 1.5; margin: 0 0 24px; }
.sotay *, .sotay *::before, .sotay *::after { box-sizing: border-box; }
.sotay [hidden] { display: none !important; }
.sotay table, .sotay th, .sotay td { border: 0; margin: 0; }
.sotay table { margin: 0; table-layout: auto; }
.sotay input, .sotay select { min-height: 0; height: auto; box-shadow: none; line-height: 1.4; }
.sotay button { text-transform: none; letter-spacing: 0; font-weight: 400; line-height: 1.4; }
.sotay .sotay-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.sotay .sotay-code { font: 600 13px/1 var(--f-mono); background: var(--ink); color: #fff; padding: 5px 9px; border-radius: 4px; }
.sotay .sotay-desc { font-size: 15px; margin: 0 0 4px; color: var(--text); }
.sotay .btn { background: var(--sheet); color: var(--text); }
.sotay .btn.on { background: var(--ink); color: #fff; }
.sotay .fxbtn { background: none; color: var(--muted); }
.sotay .fxbtn:hover, .sotay .fxbtn.on { background: var(--paper); color: var(--ink); }
.sotay .toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.sotay .btn { border: 1px solid var(--line-strong); background: var(--sheet); padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.sotay .btn:hover { border-color: var(--ink); color: var(--ink); }
.sotay .btn.on { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.sotay .legend { margin-left: auto; display: flex; gap: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.sotay .legend i { display: inline-block; width: 14px; height: 10px; border: 1px solid var(--line-strong); vertical-align: -1px; margin-right: 4px; }
.sotay .legend .y { background: var(--in-bg); border-color: var(--in-line); }
.sotay .legend .g { background: var(--res-bg); border-color: var(--res-line); }
.sotay .toast { font-size: 12.5px; color: var(--ok); }
.sotay .cols { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.sotay .sheetwrap { background: var(--sheet); border: 1px solid var(--line); min-width: 0; overflow-x: auto; }
.sotay table.ws { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.sotay table.ws th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); background: var(--paper); white-space: nowrap; }
.sotay table.ws td { padding: 5px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sotay tr.sec td { background: var(--ink); color: var(--sheet); font: 600 14px/1.2 var(--f-display); letter-spacing: .05em; text-transform: uppercase; padding: 7px 10px; }
.sotay td.n { width: 34px; color: var(--muted); font: 12px var(--f-mono); text-align: right; }
.sotay td.lbl { min-width: 180px; }
.sotay td.sym { font: italic 500 13px var(--f-mono); color: var(--ink-soft); white-space: nowrap; }
.sotay td.val { width: 200px; font: 500 13.5px var(--f-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.sotay td.unit { width: 64px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.sotay td.fx { width: 34px; text-align: center; }
.sotay tr.key td { background: var(--res-bg); }
.sotay tr.key td.lbl { font-weight: 600; }
.sotay tr.key td.val { font-weight: 700; }
.sotay tr.inrow td.val { background: var(--in-bg); padding: 2px 4px; }
.sotay tr.inrow td.val input, .sotay tr.inrow td.val select { width: 100%; border: 1px solid var(--in-line); background: var(--sheet); padding: 4px 8px; border-radius: 3px; font: 500 13.5px var(--f-mono); text-align: right; }
.sotay tr.inrow td.val select { text-align: left; font-family: var(--f-body); font-size: 13px; }
.sotay tr.inrow td.val input.bad { border-color: var(--bad); background: var(--bad-bg); }
.sotay tr.inrow.changed td.n { color: var(--ink); font-weight: 700; }
.sotay tr.note td { padding: 0 10px 7px; border-bottom: 1px solid var(--line); }
.sotay tr.has-note td { border-bottom: 0; }
.sotay .notes { font-size: 12.5px; color: var(--muted); }
.sotay .notes .ex { display: block; font: 11.5px/1.45 var(--f-mono); color: var(--ink-soft); margin-top: 2px; word-break: break-word; }
.sotay .fxbtn { border: 0; background: none; cursor: pointer; color: var(--muted); font: italic 600 13px var(--f-mono); padding: 2px 6px; border-radius: 3px; }
.sotay .fxbtn:hover, .sotay .fxbtn.on { background: var(--paper); color: var(--ink); }
.sotay .chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font: 700 11.5px/1.5 var(--f-body); letter-spacing: .03em; white-space: nowrap; }
.sotay .chip.ok { background: var(--ok-bg); color: var(--ok); }
.sotay .chip.bad { background: var(--bad-bg); color: var(--bad); }
.sotay .chip.warn { background: var(--warn-bg); color: var(--warn); }
.sotay .err { color: var(--bad); cursor: help; }
.sotay table.grid { border-collapse: collapse; font: 12.5px var(--f-mono); margin: 6px 10px 12px; }
.sotay table.grid td { border: 1px solid var(--line); padding: 0; text-align: right; }
.sotay table.grid td.h { background: var(--paper); font: 600 11px var(--f-body); color: var(--muted); padding: 5px 6px; text-align: center; }
.sotay table.grid td.c { padding: 4px 6px; min-width: 64px; }
.sotay table.grid td.i { background: var(--in-bg); }
.sotay table.grid td.i input { width: 76px; border: 0; background: transparent; padding: 4px 6px; text-align: right; font: inherit; }
.sotay /* cột phải */
.aside { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 12px); display: flex; flex-direction: column; gap: 14px; }
.sotay .panel { background: var(--sheet); border: 1px solid var(--line); }
.sotay .panel > h3 { margin: 0; padding: 8px 12px; font: 600 13px/1.2 var(--f-display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.sotay .fig { padding: 8px; background: #fff; }
.sotay .fig img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.sotay .verdict { padding: 12px; display: flex; gap: 10px; align-items: center; font-weight: 600; }
.sotay .verdict.ok { background: var(--ok-bg); color: var(--ok); }
.sotay .verdict.bad { background: var(--bad-bg); color: var(--bad); }
.sotay .verdict big { font: 600 28px/1 var(--f-display); }
.sotay .krs { list-style: none; margin: 0; padding: 4px 0; }
.sotay .krs li { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 6px 12px; border-bottom: 1px dashed var(--line); font-size: 13px; }
.sotay .krs li:last-child { border-bottom: 0; }
.sotay .krs li span { color: var(--muted); min-width: 0; }
.sotay .krs li span i { font: italic 500 12px var(--f-mono); color: var(--ink-soft); }
.sotay .krs li b { font: 600 13.5px var(--f-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.sotay .krs li b small { font: 400 11.5px var(--f-body); color: var(--muted); margin-left: 3px; }
.sotay .lightbox { position: fixed; inset: 0; background: rgba(10, 16, 22, .82); display: grid; place-items: center; padding: 20px; z-index: 50; cursor: zoom-out; }
.sotay .lightbox img { max-width: min(1100px, 100%); max-height: 100%; background: #fff; padding: 10px; }
@media (max-width: 1100px) { .sotay .cols { grid-template-columns: 1fr; } .sotay .aside { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } }
@media (max-width: 600px) {
  .sotay table.ws th:nth-child(1), .sotay table.ws th:nth-child(3), .sotay table.ws th:nth-child(6), .sotay td.n, .sotay td.sym, .sotay td.fx { display: none; }
  .sotay td.lbl { min-width: 0; padding-right: 4px; } .sotay td.lbl .lsym { display: inline; }
  .sotay td.val { width: 118px; } .sotay td.unit { width: auto; padding-left: 4px; } .sotay .legend { margin-left: 0; }
}
.sotay td.lbl .lsym { display: none; font: italic 500 12px var(--f-mono); color: var(--ink-soft); }
@media (max-width: 600px) { .sotay td.lbl .lsym { display: inline; } }
.sotay .gridwrap { overflow-x: auto; border-bottom: 1px solid var(--line); }
.lightbox { position: fixed; inset: 0; background: rgba(10, 16, 22, .82); display: grid; place-items: center; padding: 20px; z-index: 99999; cursor: zoom-out; }
.lightbox img { max-width: min(1100px, 100%); max-height: 100%; background: #fff; padding: 10px; }

/* ===== Nội dung trang (khối WordPress) – dùng chung cho mọi trang ===== */
:root { --st-ink: #1f4e79; --st-ink-2: #163a5c; --st-paper: #f5f7f9; --st-line: #d5dde6; --st-muted: #5b6876; --st-in: #fff2cc; --st-in-line: #e5c86a; --st-res: #e2efda; --st-res-line: #a9cf94; }

/* Trang chủ: khối mở đầu */
.sotay-hero { background: linear-gradient(135deg, #163a5c 0%, #1f4e79 55%, #2e6aa1 100%); color: #fff; padding: clamp(40px, 7vw, 88px) 20px; margin-bottom: 0; position: relative; overflow: hidden; }
.sotay-hero::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 32px 32px; pointer-events: none; }
.sotay-hero > * { position: relative; z-index: 1; margin-left: auto !important; margin-right: auto !important; text-align: center; }
.sotay-hero .wp-block-buttons { justify-content: center; gap: 12px; }
.sotay-hero h1, .sotay-hero h2, .sotay-hero p { color: #fff; }
.sotay-hero h1 { font-size: clamp(30px, 4.6vw, 52px); line-height: 1.12; margin-bottom: 14px; }
.sotay-hero .sotay-lead { font-size: clamp(16px, 1.6vw, 19px); opacity: .92; max-width: 760px; }
.sotay-hero .wp-block-button__link { background: #fff2cc; color: #17222d; font-weight: 600; border-radius: 6px; padding: 12px 22px; }
.sotay-hero .wp-block-button.is-style-outline > .wp-block-button__link, .sotay-hero .is-style-outline .wp-block-button__link:not(.has-background) { background: transparent !important; color: #fff !important; border: 2px solid rgba(255,255,255,.75) !important; }
.sotay-hero .wp-block-button__link:hover { filter: brightness(1.05); }

.sotay-stats { list-style: none; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 40px; padding: 26px 20px !important; margin-top: 0 !important; margin-bottom: 0 !important; border-bottom: 1px solid var(--st-line); }
.sotay-stats li { font-size: 14px; color: var(--st-muted); margin: 0; }
.sotay-stats li strong { display: block; font-size: 34px; line-height: 1.1; color: var(--st-ink); font-variant-numeric: tabular-nums; }

.entry-content > .sotay-section, .sotay-section { margin-top: 36px !important; margin-bottom: 0 !important; padding-left: 20px; padding-right: 20px; }
.entry-content > .sotay-section > * { margin-left: auto !important; margin-right: auto !important; }
.sotay-section > h2 { font-size: clamp(24px, 2.6vw, 32px); margin-bottom: 6px; }
.sotay-section > p.sotay-sub { color: var(--st-muted); margin-top: 0; }

/* Thẻ liên kết (danh sách bài toán, nhóm) */
ul.sotay-cards { list-style: none; padding: 0 !important; margin-top: 16px !important; margin-bottom: 28px !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
ul.sotay-cards li { margin: 0; background: #fff; border: 1px solid var(--st-line); border-radius: 8px; padding: 14px 16px; font-size: 13.5px; line-height: 1.45; color: var(--st-muted); transition: border-color .15s, box-shadow .15s; position: relative; }
ul.sotay-cards li:hover { border-color: var(--st-ink); box-shadow: 0 4px 14px rgba(31,78,121,.12); }
ul.sotay-cards li a { color: #17222d; font-weight: 600; font-size: 15px; text-decoration: none !important; display: block; margin-bottom: 4px; }
ul.sotay-cards li a:hover { color: var(--st-ink); }
ul.sotay-cards li a::after { content: ""; position: absolute; inset: 0; }
ul.sotay-cards li code, ul.sotay-cards li .sotay-badge { font: 600 11.5px/1 ui-monospace, Consolas, monospace; color: var(--st-ink); background: #e8eef5; padding: 3px 6px; border-radius: 4px; margin-right: 6px; }
ul.sotay-cards.sotay-big { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
ul.sotay-cards.sotay-big li { padding: 20px; border-top: 4px solid var(--st-ink); }
ul.sotay-cards.sotay-big li a { font-size: 18px; margin-bottom: 6px; }

ol.sotay-steps { list-style: none; counter-reset: st; padding: 0 !important; margin-top: 16px !important; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
ol.sotay-steps li { counter-increment: st; background: var(--st-paper); border-radius: 8px; padding: 18px 18px 18px 64px; position: relative; margin: 0; }
ol.sotay-steps li::before { content: counter(st); position: absolute; left: 18px; top: 16px; width: 32px; height: 32px; border-radius: 50%; background: var(--st-ink); color: #fff; font-weight: 700; display: grid; place-items: center; }

.sotay-cta { background: var(--st-paper); border-top: 1px solid var(--st-line); padding-top: 36px !important; padding-bottom: 40px !important; margin-top: 48px !important; }

/* Bài giải thích */
p.sotay-ct { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 15px; background: #fff; border: 1px solid var(--st-line); border-left: 4px solid var(--st-ink); padding: 10px 16px; overflow-x: auto; }
.sotay-callout { border-radius: 6px; padding: 14px 18px !important; margin: 18px 0 !important; border: 1px solid var(--st-line); background: #fff; }
.sotay-callout > p:first-child strong { text-transform: uppercase; letter-spacing: .06em; font-size: 12.5px; }
.sotay-callout.imagine { background: var(--st-in); border-color: var(--st-in-line); }
.sotay-callout.result { background: var(--st-res); border-color: var(--st-res-line); }
.sotay-callout.remember { border-left: 4px solid var(--st-ink); }
.sotay-callout p { margin: 4px 0; }
.entry-content .wp-block-table { overflow-x: auto; }
.entry-content .wp-block-table table { font-size: 14px; }
.entry-content .wp-block-table th { background: var(--st-paper); }
.entry-content .wp-block-table td strong { font-family: ui-monospace, Consolas, monospace; }
.sotay-explain-title { border-top: 3px solid var(--st-ink); padding-top: 18px; margin-top: 40px !important; }
.sotay-intoc { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 !important; list-style: none; }
.sotay-intoc li { margin: 0; }
.sotay-intoc li a { display: inline-block; font-size: 13px; padding: 4px 12px; border: 1px solid var(--st-line); border-radius: 999px; text-decoration: none; }
.sotay-pn { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 36px !important; }

.entry-content > .sotay-hero { margin-top: 0 !important; margin-bottom: 0 !important; }
.sotay-section > h2 { margin-top: 0; }
