:root {
  --ink: #111a1d;
  --muted: #607075;
  --line: #d6ddde;
  --paper: #f4f6f5;
  --white: #fff;
  --accent: #e5481d;
  --teal: #08766d;
  --dark: #0d1719;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Arial, Helvetica, sans-serif; }
body.embedded .topbar, body.embedded .intro { display: none; }
body.embedded .page-shell { max-width: none; padding: 0; }
button, input, select { font: inherit; }
.topbar { height: 72px; padding: 0 max(24px, calc((100% - 1320px) / 2)); display: flex; align-items: center; justify-content: space-between; background: var(--white); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; color: #fff; background: var(--accent); font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { margin-top: 2px; color: #738084; font-size: 8px; }
.prototype-label { padding: 7px 10px; border: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.page-shell { max-width: 1320px; margin: 0 auto; padding: 52px 24px 72px; }
.intro { max-width: 760px; margin-bottom: 34px; }
.eyebrow { margin: 0 0 12px; color: var(--teal); font-size: 12px; font-weight: 800; }
.eyebrow::before { content: ""; display: inline-block; width: 20px; height: 2px; margin: 0 10px 3px 0; background: var(--accent); }
h1 { margin: 0 0 14px; font-size: 46px; line-height: 1.05; }
.intro > p:last-child { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.55; }
.calculator { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 720px; background: var(--white); border: 1px solid var(--line); }
.profile-panel { padding: 26px 18px; border-right: 1px solid var(--line); background: #eef1f0; }
.profile-panel h2 { margin: 0 8px 18px; font-size: 17px; }
.aside-step { margin: 0 8px 6px; color: var(--accent); font-size: 10px; font-weight: 800; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.profile-button { width: 100%; min-height: 78px; padding: 9px 7px; display: grid; justify-items: center; align-content: center; gap: 6px; border: 1px solid transparent; background: transparent; color: var(--ink); font-size: 13px; line-height: 1.2; text-align: center; cursor: pointer; }
.profile-button:hover { border-color: #b7c3c3; background: #fff; }
.profile-button.active { border-color: var(--teal); background: #fff; box-shadow: inset 0 -3px var(--teal); }
.profile-icon { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 30px; color: var(--teal); font-weight: 800; border: 2px solid currentColor; }
.profile-icon.round { border-radius: 50%; }
.profile-icon.hex { clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%); background: var(--teal); border: 0; }
.profile-icon.sheet { height: 18px; transform: skew(-18deg); }
.profile-icon.tube { border-width: 5px; border-radius: 50%; }
.profile-icon.profile-tube { border-width: 5px; }
.profile-icon.angle, .profile-icon.channel, .profile-icon.tee, .profile-icon.ibeam { position: relative; border: 0; }
.profile-icon.angle::before { content: ""; width: 24px; height: 24px; border-left: 5px solid var(--teal); border-bottom: 5px solid var(--teal); }
.profile-icon.channel::before { content: ""; width: 20px; height: 24px; border-left: 5px solid var(--teal); border-top: 5px solid var(--teal); border-bottom: 5px solid var(--teal); }
.profile-icon.tee::before { content: ""; width: 24px; height: 24px; background: linear-gradient(var(--teal),var(--teal)) top/24px 5px no-repeat,linear-gradient(var(--teal),var(--teal)) center/5px 24px no-repeat; }
.profile-icon.ibeam::before { content: ""; width: 24px; height: 26px; background: linear-gradient(var(--teal),var(--teal)) top/24px 5px no-repeat,linear-gradient(var(--teal),var(--teal)) center/5px 26px no-repeat,linear-gradient(var(--teal),var(--teal)) bottom/24px 5px no-repeat; }
.workspace { min-width: 0; }
.mode-switch { display: flex; border-bottom: 1px solid var(--line); }
.mode-button { min-height: 58px; padding: 0 26px; border: 0; border-right: 1px solid var(--line); background: #fafbfa; color: var(--muted); font-size: 15px; font-weight: 700; cursor: pointer; }
.mode-button.active { color: var(--ink); background: #fff; box-shadow: inset 0 -3px var(--accent); }
.form-layout { display: grid; grid-template-columns: minmax(420px, 1fr) 360px; }
form { padding: 34px; }
.section-heading { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; }
.section-heading h2 { margin: 0 0 4px; font-size: 20px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.step { padding-top: 2px; color: var(--accent); font-size: 12px; font-weight: 800; }
.dimensions-heading { margin-top: 34px; }
.field-row { display: grid; gap: 14px; }
.two-columns { grid-template-columns: 1fr 1fr; }
.material-fields { grid-template-columns: minmax(180px, .8fr) minmax(260px, 1.35fr); }
.dimensions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: grid; gap: 8px; color: #425155; font-size: 12px; line-height: 1.3; font-weight: 800; text-transform: uppercase; }
input, select { width: 100%; height: 48px; padding: 0 13px; border: 1px solid #bcc7c8; border-radius: 0; background: #fff; color: var(--ink); font-size: 15px; outline: none; }
input:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(8,118,109,.12); }
.input-with-unit { display: grid; grid-template-columns: 1fr auto; align-items: center; border: 1px solid #bcc7c8; background: #fff; }
.input-with-unit:focus-within { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(8,118,109,.12); }
.input-with-unit input { border: 0; box-shadow: none; }
.input-with-unit span { min-width: 45px; padding: 0 10px; color: var(--muted); font-size: 13px; font-weight: 400; text-align: right; text-transform: none; }
.common-fields { margin-top: 14px; }
.price-details { margin-top: 20px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.price-details summary { color: var(--teal); font-size: 13px; font-weight: 800; cursor: pointer; }
.price-details[open] summary { margin-bottom: 16px; }
.form-error { min-height: 18px; margin: 14px 0 0; color: #b52d17; font-size: 12px; }
.form-actions { display: flex; gap: 10px; }
.calculate-button, .reset-button { min-height: 46px; padding: 0 22px; border: 1px solid var(--accent); font-weight: 800; cursor: pointer; }
.calculate-button { color: #fff; background: var(--accent); }
.calculate-button:hover { background: #c93814; }
.reset-button { color: var(--ink); background: #fff; border-color: #aebabb; }
.result-panel { padding: 30px; background: var(--dark); color: #fff; }
.profile-visual { height: 150px; display: grid; place-items: center; }
.visual-shape { width: 110px; height: 110px; border: 18px solid #8b9b9d; background: transparent; }
.visual-shape.round { border-radius: 50%; background: #8b9b9d; border: 0; }
.visual-shape.square { background: #8b9b9d; border: 0; }
.visual-shape.sheet { width: 150px; height: 70px; border: 0; background: #8b9b9d; transform: skew(-18deg); }
.visual-shape.hex { border: 0; background: #8b9b9d; clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%); }
.visual-shape.tube { border-radius: 50%; }
.visual-shape.profile-tube { border-radius: 5px; }
.visual-shape.angle, .visual-shape.channel, .visual-shape.tee, .visual-shape.ibeam { position: relative; border: 0; }
.visual-shape.angle::before { content: ""; width: 82px; height: 82px; border-left: 18px solid #8b9b9d; border-bottom: 18px solid #8b9b9d; }
.visual-shape.channel::before { content: ""; width: 72px; height: 86px; border-left: 18px solid #8b9b9d; border-top: 18px solid #8b9b9d; border-bottom: 18px solid #8b9b9d; }
.visual-shape.tee::before { content: ""; width: 100px; height: 100px; background: linear-gradient(#8b9b9d,#8b9b9d) top/100px 18px no-repeat,linear-gradient(#8b9b9d,#8b9b9d) center/18px 100px no-repeat; }
.visual-shape.ibeam::before { content: ""; width: 100px; height: 106px; background: linear-gradient(#8b9b9d,#8b9b9d) top/100px 18px no-repeat,linear-gradient(#8b9b9d,#8b9b9d) center/18px 106px no-repeat,linear-gradient(#8b9b9d,#8b9b9d) bottom/100px 18px no-repeat; }
.result-caption { margin: 8px 0; color: #c1cbcc; font-size: 13px; text-transform: uppercase; }
.result-value { display: block; min-height: 62px; font-size: 42px; font-weight: 800; }
.result-value small { color: #aab6b7; font-size: 16px; }
.result-metrics { margin-top: 20px; border-top: 1px solid #2b383a; }
.result-metrics > div { padding: 13px 0; display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px solid #2b383a; }
.result-metrics span { color: #bdc8c9; font-size: 13px; }
.result-metrics strong { font-size: 14px; text-align: right; }
.formula-block { margin-top: 22px; padding: 15px; background: #152326; border-left: 3px solid var(--accent); }
.formula-block summary { color: #fff; font-size: 12px; font-weight: 800; cursor: pointer; }
.formula-block code { display: block; margin-top: 12px; color: #fff; font-family: Consolas, monospace; font-size: 13px; }
.formula-block p { margin: 10px 0 0; color: #aeb9ba; font-size: 11px; line-height: 1.45; }
.formula-block .density-detail { color: #7f9092; }
.accuracy-note { margin-top: 18px; }
.accuracy-note strong { font-size: 12px; color: #f3b7a8; }
.accuracy-note p { margin: 5px 0 0; color: #9eaaac; font-size: 11px; line-height: 1.45; }
.result-actions { display: grid; gap: 9px; margin-top: 24px; }
.result-action { min-height: 46px; padding: 10px 14px; display: grid; place-items: center; border: 1px solid #718082; background: transparent; color: #fff; font-size: 13px; line-height: 1.3; font-weight: 500; text-align: center; text-decoration: none; cursor: pointer; }
.result-action.primary { border-color: var(--accent); background: var(--accent); }
.result-action:hover { border-color: #fff; }
@media (max-width: 980px) {
  .calculator { grid-template-columns: 1fr; }
  .profile-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .profile-grid { grid-template-columns: repeat(4, 1fr); }
  .profile-button { display: grid; justify-items: center; text-align: center; font-size: 11px; }
  .form-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { height: 64px; padding: 0 16px; }
  .prototype-label { display: none; }
  .page-shell { padding: 34px 14px 50px; }
  h1 { font-size: 34px; }
  .profile-grid { grid-template-columns: repeat(2, 1fr); }
  .mode-button { flex: 1; padding: 0 10px; font-size: 12px; }
  form, .result-panel { padding: 24px 18px; }
  .two-columns, .dimensions, .material-fields { grid-template-columns: 1fr; }
}

@media(max-width:640px){.calculator,.form-layout,.two-columns,.dimensions,.material-fields{grid-template-columns:minmax(0,1fr)}form,label,input,select,.section-heading>div{min-width:0}input,select{font-size:16px}.form-actions{flex-wrap:wrap}h2,.formula-block code{overflow-wrap:anywhere}}
