:root {
  --navy-950: #0b1c2d;
  --navy-900: #102a46;
  --navy-800: #173f6c;
  --blue-700: #245b96;
  --blue-600: #2d6dad;
  --blue-100: #eaf2fb;
  --teal-700: #147a75;
  --teal-100: #e8f7f4;
  --amber-700: #a65f11;
  --amber-100: #fff5e5;
  --violet-700: #7253a6;
  --violet-100: #f3eefb;
  --green-700: #18734a;
  --green-100: #e8f7ef;
  --red-700: #b13d3d;
  --red-100: #fcecec;
  --ink: #17212b;
  --muted: #607080;
  --line: #dce3ea;
  --line-strong: #c9d3dd;
  --surface: #ffffff;
  --surface-alt: #f5f7fa;
  --page: #edf1f5;
  --shadow-sm: 0 1px 2px rgba(13, 31, 49, 0.05), 0 4px 18px rgba(13, 31, 49, 0.04);
  --shadow-md: 0 16px 40px rgba(13, 31, 49, 0.12);
  --sidebar-width: 310px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(45, 109, 173, 0.22);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.noscript {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1000;
  padding: 12px;
  background: var(--red-700);
  color: #fff;
  text-align: center;
  font-weight: 700;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  background: var(--navy-950);
  color: #fff;
  box-shadow: 2px 0 18px rgba(8, 22, 36, 0.15);
}

.brand {
  display: flex;
  min-height: 86px;
  align-items: center;
  gap: 13px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 12px;
  background: linear-gradient(145deg, #2d6dad, #1c4f83);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.04em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.brand-mark.small {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 11px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 19px;
  letter-spacing: -0.02em;
}

.brand span {
  margin-top: 1px;
  color: #9fb1c3;
  font-size: 12px;
}

.close-sidebar {
  display: none;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.sidebar-scroll {
  overflow-y: auto;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.side-section {
  padding: 25px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.side-section h2 {
  margin: 3px 0 17px;
  font-size: 17px;
}

.section-kicker,
.eyebrow {
  color: #7f9ebb;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--blue-600);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field > span,
.segmented-field legend {
  color: inherit;
  font-size: 12px;
  font-weight: 650;
}

.field small {
  color: var(--muted);
  font-size: 0.9em;
  font-weight: 500;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  transition: border-color 0.16s, box-shadow 0.16s;
}

input:hover,
select:hover {
  border-color: #9cafc0;
}

.sidebar input,
.sidebar select {
  border-color: #34506a;
  background: #132e48;
  color: #fff;
}

.sidebar input::placeholder {
  color: #7890a7;
}

.sidebar .field > span {
  color: #c1ceda;
}

.sidebar .field small {
  color: #8fa4b8;
}

.side-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.material-description {
  min-height: 34px;
  margin: 2px 0 15px;
  color: #9fb1c3;
  font-size: 11px;
  line-height: 1.45;
}

.side-warning {
  display: flex;
  gap: 9px;
  padding: 11px;
  border: 1px solid rgba(231, 168, 71, 0.22);
  border-radius: 8px;
  background: rgba(231, 168, 71, 0.08);
  color: #e5c895;
  font-size: 11px;
  line-height: 1.42;
}

.side-warning > span {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #c99c53;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}

.side-warning p {
  margin: 0;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 14px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #91a6ba;
  font-size: 11px;
}

.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3bc883;
  box-shadow: 0 0 0 3px rgba(59, 200, 131, 0.13);
}

.mobile-bar {
  display: none;
}

.main-shell {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 0 38px 36px;
}

.hero {
  display: flex;
  min-height: 188px;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  margin: 0 -38px;
  padding: 34px 48px;
  overflow: hidden;
  border-bottom: 1px solid #dae2ea;
  background:
    radial-gradient(circle at 80% 0%, rgba(45, 109, 173, 0.12), transparent 37%),
    linear-gradient(115deg, #fff 0%, #f9fbfd 60%, #eef4f9 100%);
}

.hero h1 {
  max-width: 680px;
  margin: 7px 0 8px;
  color: var(--navy-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 3.4vw, 48px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.hero h1 span {
  color: var(--blue-700);
}

.hero p {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.unit-ribbon {
  display: grid;
  min-width: 292px;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-sm);
}

.unit-ribbon div {
  padding: 12px 16px;
}

.unit-ribbon div:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.unit-ribbon div:nth-child(-n + 2) {
  border-bottom: 1px solid var(--line);
}

.unit-ribbon strong,
.unit-ribbon span {
  display: block;
}

.unit-ribbon strong {
  color: var(--navy-800);
  font-size: 16px;
}

.unit-ribbon span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  margin: 0 -38px 25px;
  padding: 0 32px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 10px rgba(13, 31, 49, 0.04);
  backdrop-filter: blur(10px);
}

.tab-button {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #657585;
  padding: 4px 16px 1px;
  font-size: 13px;
  font-weight: 650;
}

.tab-button > span {
  color: #9aa8b5;
  font-size: 9px;
  letter-spacing: 0.07em;
}

.tab-button:hover {
  color: var(--navy-800);
}

.tab-button.active {
  border-bottom-color: var(--blue-600);
  color: var(--navy-800);
}

.tab-button.active > span {
  color: var(--blue-600);
}

.count-badge {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 10px;
}

.tab-panel {
  max-width: 1240px;
  min-height: 560px;
  margin: 0 auto;
  animation: panel-in 0.24s ease-out;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-heading,
.submodule-heading,
.chart-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.section-heading {
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 4px 0 0;
  color: var(--navy-950);
  font-size: 25px;
  letter-spacing: -0.025em;
}

.version-chip,
.formula-chip {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.formula-chip {
  border-color: #c9dceb;
  background: var(--blue-100);
  color: var(--blue-700);
  font-family: Georgia, serif;
  font-size: 13px;
}

.violet-chip {
  border-color: #ddd0ee;
  background: var(--violet-100);
  color: var(--violet-700);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
}

.module-card {
  position: relative;
  min-height: 196px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 3px solid var(--blue-600);
  border-radius: 10px;
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.module-card.teal { border-top-color: var(--teal-700); }
.module-card.amber { border-top-color: var(--amber-700); }
.module-card.violet { border-top-color: var(--violet-700); }

.module-number {
  position: absolute;
  top: 15px;
  right: 16px;
  color: #a8b4bf;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.module-icon,
.card-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 9px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-family: Georgia, serif;
  font-size: 17px;
  font-weight: 700;
}

.teal .module-icon { background: var(--teal-100); color: var(--teal-700); }
.amber .module-icon { background: var(--amber-100); color: var(--amber-700); }
.violet .module-icon { background: var(--violet-100); color: var(--violet-700); }

.module-card h3 {
  margin: 17px 0 1px;
  font-size: 16px;
}

.module-card > strong {
  color: var(--blue-700);
  font-family: Georgia, serif;
  font-size: 15px;
}

.module-card.teal > strong { color: var(--teal-700); }
.module-card.amber > strong { color: var(--amber-700); }
.module-card.violet > strong { color: var(--violet-700); }

.module-card p {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.content-grid {
  display: grid;
  gap: 14px;
}

.summary-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 15px;
}

.info-card {
  display: flex;
  min-height: 182px;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.info-card h3 {
  margin: 2px 0 7px;
  font-size: 16px;
}

.info-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.warning-card {
  border-color: #eadfc9;
  background: #fffdf8;
}

.warning-card .card-icon {
  background: var(--amber-100);
  color: var(--amber-700);
  font-family: inherit;
}

.formula-icon {
  font-size: 21px;
}

.formula-box {
  display: flex;
  max-width: 390px;
  align-items: center;
  gap: 12px;
  margin-top: 13px;
  border-left: 3px solid var(--blue-600);
  background: var(--surface-alt);
  padding: 10px 14px;
  color: var(--navy-800);
  font-family: Georgia, serif;
  font-size: 13px;
}

.fraction {
  display: grid;
  text-align: center;
}

.fraction b,
.fraction i {
  padding: 0 6px;
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
}

.fraction b {
  border-bottom: 1px solid #71879a;
}

.small-note {
  padding-left: 10px;
  border-left: 2px solid #dfcda9;
  font-size: 11px !important;
}

.calculation-grid {
  grid-template-columns: minmax(290px, 0.82fr) minmax(390px, 1.18fr);
  align-items: stretch;
}

.calc-card,
.result-card,
.chart-card,
.result-strip {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.calc-card {
  padding: 22px;
}

.calc-card h3 {
  margin: 0 0 17px;
  color: var(--navy-900);
  font-size: 16px;
}

.segmented-field {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.segmented-field legend {
  grid-column: 1 / -1;
  margin-bottom: 6px;
}

.segmented-field label input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.segmented-field label span {
  display: block;
  border: 1px solid var(--line-strong);
  padding: 9px;
  background: #fff;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 650;
}

.segmented-field label:first-of-type span {
  border-radius: 8px 0 0 8px;
}

.segmented-field label:last-of-type span {
  margin-left: -1px;
  border-radius: 0 8px 8px 0;
}

.segmented-field input:checked + span {
  position: relative;
  z-index: 1;
  border-color: var(--blue-600);
  background: var(--blue-100);
  color: var(--blue-700);
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 750;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}

.primary-button {
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--blue-700);
  background: var(--blue-700);
  color: #fff;
  box-shadow: 0 5px 15px rgba(36, 91, 150, 0.18);
}

.primary-button span {
  font-size: 16px;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.primary-button:hover {
  background: var(--navy-800);
}

.amber-button {
  border-color: var(--amber-700);
  background: var(--amber-700);
  box-shadow: 0 5px 15px rgba(166, 95, 17, 0.16);
}

.violet-button {
  border-color: var(--violet-700);
  background: var(--violet-700);
  box-shadow: 0 5px 15px rgba(114, 83, 166, 0.16);
}

.secondary-button,
.danger-button {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--navy-800);
}

.danger-button {
  border-color: #ebc4c4;
  color: var(--red-700);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none !important;
}

.result-card {
  display: flex;
  min-height: 378px;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
}

.empty-result {
  align-items: center;
  color: var(--muted);
  text-align: center;
}

.empty-result h3 {
  margin: 11px 0 4px;
  color: #435362;
  font-size: 15px;
}

.empty-result p {
  margin: 0;
  font-size: 12px;
}

.empty-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-100);
  color: var(--blue-700);
  font-family: Georgia, serif;
  font-size: 23px;
}

.amber-empty {
  background: var(--amber-100);
  color: var(--amber-700);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.metric {
  min-height: 106px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-alt);
  padding: 14px;
}

.metric span,
.metric strong,
.metric small {
  display: block;
}

.metric span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.metric strong {
  margin: 9px 0 1px;
  color: var(--navy-900);
  font-size: clamp(18px, 2vw, 25px);
  letter-spacing: -0.03em;
}

.metric small {
  color: #8493a1;
  font-size: 10px;
}

.status-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 14px;
  border: 1px solid #afd8c2;
  border-radius: 9px;
  background: var(--green-100);
  padding: 12px 14px;
  color: var(--green-700);
}

.status-box.bad {
  border-color: #e5bcbc;
  background: var(--red-100);
  color: var(--red-700);
}

.status-box strong {
  font-size: 12px;
}

.status-box span {
  font-size: 12px;
  font-weight: 700;
}

.result-caption {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.error-box,
.global-message {
  border: 1px solid #e5bcbc;
  border-radius: 8px;
  background: var(--red-100);
  padding: 12px 14px;
  color: var(--red-700);
  font-size: 12px;
  font-weight: 650;
}

.global-message {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: 390px;
  border-color: #afd8c2;
  background: var(--green-100);
  color: var(--green-700);
  box-shadow: var(--shadow-md);
}

.submodule {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line-strong);
}

.submodule-heading {
  margin-bottom: 13px;
}

.submodule-heading h3 {
  margin: 3px 0 0;
  color: var(--navy-900);
  font-size: 18px;
}

.horizontal-form {
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 16px;
}

.horizontal-form .field,
.mohr-form .field {
  margin: 0;
}

.horizontal-form .secondary-button {
  margin-bottom: 0;
}

.result-strip {
  min-height: 80px;
  margin-top: 10px;
  padding: 15px;
}

.result-strip .metrics-grid {
  grid-template-columns: repeat(3, 1fr);
}

.result-strip .metric {
  min-height: 78px;
  padding: 10px 12px;
}

.result-strip .metric strong {
  margin-top: 5px;
  font-size: 18px;
}

.result-strip.empty-result {
  display: flex;
  justify-content: center;
}

.bearing-form {
  grid-template-columns: repeat(3, 1fr) auto;
}

.field-help {
  margin: -7px 0 11px;
  color: var(--muted);
  font-size: 10px;
}

.mohr-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr) minmax(180px, 0.7fr);
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
  padding: 16px;
}

.mohr-form .primary-button {
  margin: 0;
}

.four-metrics {
  grid-template-columns: repeat(4, 1fr);
}

.muted-metrics {
  opacity: 0.7;
}

#mohr-check .status-box {
  margin-bottom: 12px;
}

.chart-card {
  margin-top: 12px;
  padding: 18px;
}

.chart-heading {
  align-items: center;
}

.chart-heading h3 {
  margin: 0 0 2px;
  font-size: 15px;
}

.chart-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.circle-key,
.point-key {
  display: inline-block;
  width: 16px;
  height: 3px;
  margin-left: 8px;
  background: var(--violet-700);
}

.point-key {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber-700);
}

#mohr-canvas {
  display: block;
  width: 100%;
  height: 390px;
  margin-top: 12px;
  border-radius: 7px;
  background: #fcfdfe;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 15px;
}

.history-empty {
  display: grid;
  min-height: 350px;
  place-items: center;
  align-content: center;
  border: 1px dashed #bfcbd5;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.5);
  text-align: center;
}

.history-empty h3 {
  margin: 13px 0 3px;
  font-size: 15px;
}

.history-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 11px;
}

.table-wrap th,
.table-wrap td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.table-wrap th {
  position: sticky;
  top: 0;
  background: var(--navy-900);
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.03em;
}

.table-wrap tbody tr:nth-child(even) {
  background: var(--surface-alt);
}

.table-wrap tbody tr:hover {
  background: var(--blue-100);
}

footer {
  display: flex;
  max-width: 1240px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 42px auto 0;
  padding-top: 17px;
  border-top: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 10px;
}

footer p {
  margin: 0;
}

.print-report {
  display: none;
}

@media (max-width: 1180px) {
  .module-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .module-card {
    min-height: 170px;
  }

  .hero {
    align-items: flex-start;
  }

  .unit-ribbon {
    min-width: 240px;
  }

  .horizontal-form {
    grid-template-columns: repeat(2, 1fr);
  }

  .horizontal-form button {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    height: 56px;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
  }

  .icon-button {
    display: grid;
    width: 34px;
    height: 34px;
    place-content: center;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .icon-button span {
    width: 15px;
    height: 2px;
    background: var(--navy-800);
  }

  .mobile-brand {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 9px;
    color: var(--navy-900);
    text-decoration: none;
    font-weight: 750;
  }

  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.23s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .close-sidebar {
    display: block;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 19;
    background: rgba(6, 17, 29, 0.48);
  }

  .main-shell {
    margin-left: 0;
    padding-right: 22px;
    padding-left: 22px;
  }

  .hero {
    min-height: 0;
    margin: 0 -22px;
    padding: 31px 27px;
  }

  .unit-ribbon {
    display: none;
  }

  .tabs {
    top: 56px;
    margin-right: -22px;
    margin-left: -22px;
    padding: 0 12px;
  }

  .tab-button {
    min-height: 52px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .calculation-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .result-card {
    min-height: 280px;
  }

  .mohr-form {
    grid-template-columns: repeat(3, 1fr);
  }

  .mohr-form button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .main-shell {
    padding-right: 14px;
    padding-left: 14px;
  }

  .hero {
    margin: 0 -14px;
    padding: 27px 18px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .tabs {
    margin-right: -14px;
    margin-left: -14px;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }

  .module-card {
    min-height: 154px;
  }

  .section-heading,
  .submodule-heading,
  .chart-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .section-heading h2 {
    font-size: 22px;
  }

  .metrics-grid,
  .four-metrics,
  .result-strip .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .horizontal-form,
  .bearing-form,
  .mohr-form {
    grid-template-columns: 1fr;
  }

  .horizontal-form button,
  .mohr-form button {
    grid-column: auto;
  }

  .status-box {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  #mohr-canvas {
    height: 300px;
  }

  .chart-legend {
    flex-wrap: wrap;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 15mm;
  }

  body {
    background: #fff;
    color: #111;
    font-family: Arial, sans-serif;
    font-size: 10pt;
  }

  .sidebar,
  .mobile-bar,
  .main-shell,
  .sidebar-backdrop,
  .noscript {
    display: none !important;
  }

  .print-report {
    display: block !important;
  }

  .print-report h1 {
    margin: 0;
    color: #173f6c;
    font-size: 23pt;
  }

  .print-report h2 {
    margin: 7mm 0 3mm;
    border-bottom: 1px solid #8fa4b8;
    padding-bottom: 2mm;
    color: #173f6c;
    font-size: 14pt;
  }

  .print-report h3 {
    margin: 5mm 0 2mm;
    color: #173f6c;
    font-size: 11pt;
  }

  .print-subtitle {
    margin: 1mm 0 6mm;
    color: #555;
  }

  .print-report table {
    width: 100%;
    margin-bottom: 4mm;
    border-collapse: collapse;
    page-break-inside: avoid;
  }

  .print-report th,
  .print-report td {
    border: 1px solid #aab5bf;
    padding: 2mm;
    vertical-align: top;
    text-align: left;
  }

  .print-report th {
    width: 34%;
    background: #eef2f5;
  }

  .print-warning {
    margin-top: 8mm;
    border: 1px solid #d7c39c;
    background: #fff9ec;
    padding: 3mm;
    page-break-inside: avoid;
  }
}
