/* Margin calculator. Shared --ink/--muted/--line/--paper/--white/--blue tokens keep dark mode in step with the site. */
.mg-page{max-width:1240px}
.mg-heading h1{font-size:clamp(28px,4vw,42px);line-height:1.25;margin:8px 0 12px}
.mg-workbench{border:1px solid var(--line);border-radius:18px;background:var(--white);box-shadow:0 14px 42px rgba(23,42,71,.06);padding:16px 18px;display:grid;gap:14px;min-width:0}
.mg-hint{margin:0;font-size:14px;color:var(--muted)}
.mg-fields{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}
.mg-field{display:grid;gap:6px;font-size:13px;color:var(--muted);min-width:0;border:1px solid var(--line);border-radius:12px;padding:10px;background:var(--paper)}
.mg-field.is-input{border-color:var(--blue);background:var(--blue-soft,#edf2ff)}
.mg-field.is-result input{font-weight:700}
.mg-label{display:flex;justify-content:space-between;gap:6px;font-weight:600;color:var(--ink)}
.mg-tag{font-style:normal;font-weight:500;font-size:12px;color:var(--muted)}.mg-field.is-input .mg-tag{color:var(--blue)}
.mg-input{display:flex;align-items:center;border:1px solid var(--line);border-radius:10px;background:var(--white);min-width:0}
.mg-input input{border:0;background:transparent;min-height:42px;padding:6px 10px;font:inherit;font-size:18px;color:var(--ink);width:100%;min-width:0;font-variant-numeric:tabular-nums}
.mg-input input:focus-visible{outline:0}.mg-input:focus-within{outline:3px solid #789cff;outline-offset:2px}
.mg-input i{font-style:normal;padding:0 10px 0 0;color:var(--muted)}
.mg-presets,.mg-tools{display:flex;flex-wrap:wrap;gap:8px;align-items:center;font-size:13px;color:var(--muted)}
.mg-sep{width:1px;height:22px;background:var(--line);margin:0 4px}
.mg-workbench button{min-height:36px;border:1px solid var(--line);border-radius:10px;padding:5px 12px;font:inherit;font-size:14px;background:var(--white);color:var(--ink);cursor:pointer}
.mg-digits select{min-height:36px;border:1px solid var(--line);border-radius:10px;padding:4px 8px;font:inherit;font-size:14px;background:var(--white);color:var(--ink)}
.mg-tools{margin-left:auto}
.mg-form{display:grid;gap:12px}
.mg-result{border:1px solid var(--line);border-radius:14px;padding:12px 14px;display:grid;gap:8px;background:var(--paper)}
.mg-summary{margin:0;font-size:18px;font-weight:700;color:var(--ink);font-variant-numeric:tabular-nums}
.mg-note{margin:0;font-size:14px;color:#9a5b00}.mg-note:empty{display:none}
.mg-error{margin:0;font-size:14px;color:#b42318}
.mg-bar{display:flex;height:12px;border-radius:999px;overflow:hidden;background:var(--line)}
.mg-bar span{display:block;height:100%;transition:width .2s}#mg-bar-cost{background:#94a3b8}#mg-bar-profit{background:#16a34a}
.mg-tables{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.mg-table-wrap{overflow-x:auto;min-width:0}
.mg-table{width:100%;border-collapse:collapse;font-size:14px;font-variant-numeric:tabular-nums}
.mg-table caption{text-align:left;font-weight:700;color:var(--ink);padding:0 0 6px}
.mg-table th,.mg-table td{border-bottom:1px solid var(--line);padding:6px 8px;text-align:right}.mg-table th:first-child{text-align:left}
.mg-table thead th{color:var(--muted);font-weight:600}
.mg-no-cost .mg-table td:last-child,.mg-no-cost .mg-table thead th:last-child{color:var(--muted)}
.mg-guide .mg-table-wrap{max-width:420px}
html[data-xunl-theme="dark"] .mg-note{color:#ffd98a}html[data-xunl-theme="dark"] .mg-error{color:#ffb4a8}
@media(max-width:900px){.mg-fields{grid-template-columns:repeat(2,minmax(0,1fr))}.mg-tables{grid-template-columns:1fr}.mg-tools{margin-left:0}}
@media(max-width:420px){.mg-fields{grid-template-columns:1fr}}
