/* Concrete Mix Design (CMD) - Material Design Stylesheet */
:root {
  --app-scale: 1;
  --primary: #3F51B5;
  --primary-dark: #303F9F;
  --primary-light: #C5CAE9;
  --accent: #FF4081;
  --bg-color: #f0f2f5;
  --card-bg: #ffffff;
  --text-main: #212121;
  --text-secondary: #616161;
  --border-color: #e0e0e0;
  --danger: #d32f2f;
  --warning: #f57c00;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 3px 6px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.15), 0 3px 6px rgba(0, 0, 0, 0.10);
  --radius: 10px;
  --transition: all 0.25s ease;

  /* Responsive & relative typography per device */
  --font-base: calc(clamp(13px, 0.85vw + 10px, 15px) * var(--app-scale));
  --font-equation: calc(clamp(12px, 1.05vw + 8.5px, 15px) * var(--app-scale));
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: #2b303c;
  color: var(--text-main);
  font-size: var(--font-base);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 0;
  overflow-x: hidden;
}

.portfolio-link {
  display: block;
  padding: 12px 20px;
  color: var(--primary-dark);
  background: #ffffff;
  font-size: 14px;
  text-decoration: underline;
}

.portfolio-link:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: -3px;
}

/* Standalone visitor counter footer (added by ../../js/visitor-counter.js):
   keeps the label readable on the dark page backdrop */
body>.visitor-counter-footer {
  color: #c7cee8;
}

/* Device-Adaptive Frame Container */
.app-frame {
  width: 100%;
  max-width: clamp(480px, 60vw, 680px);
  min-height: 100vh;
  background-color: var(--bg-color);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transition: max-width 0.25s ease;
}

.app-frame.doe-view-active {
  max-width: min(920px, 98vw);
}

@media (min-width: 600px) {
  body {
    padding: 16px 0;
  }

  .app-frame {
    min-height: calc(100vh - 32px);
    border-radius: 16px;
    height: auto;
  }
}

/* Screens */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  width: 100%;
}

.screen.active {
  display: flex;
}

/* Screen 1: Welcome / Splash */
#screen1 {
  background-color: #ffffff;
  align-items: center;
  justify-content: space-between;
  padding: 30px 20px;
  min-height: 100vh;
  text-align: center;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 20px;
  width: 100%;
}

.splash-mixer {
  height: 110px;
  object-fit: contain;
  animation: float 3s ease-in-out infinite;
}

.splash-front {
  width: 95%;
  max-width: 360px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.splash-logo {
  height: 90px;
  object-fit: contain;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

/* App Bar / Top Navigation */
.app-bar {
  background-color: var(--primary);
  color: #ffffff;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.menu-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 12px;
  transition: var(--transition);
}

.menu-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.app-title {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.3px;
  flex: 1;
}

.app-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn {
  background: transparent;
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Scrollable Container */
.scroll-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 80px;
  /* space for bottom nav */
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.08);
  z-index: 90;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  gap: 4px;
  transition: var(--transition);
}

.nav-item img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.nav-item:hover,
.nav-item:active {
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

/* Cards */
.card {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
  border-bottom: 2px solid #e8eaf6;
  padding-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Form Groups & Inputs */
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.form-row label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  flex: 1;
}

.form-row .input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  background-color: #fafafa;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(63, 81, 181, 0.2);
}

.unit-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.form-help {
  font-size: 12px;
  color: #757575;
  margin-top: -6px;
  margin-bottom: 10px;
  font-style: italic;
}

/* Segmented Button Controls (Modern, Student-Friendly) */
.form-group-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 8px;
  margin-bottom: 6px;
}

.segmented-control {
  display: flex;
  background-color: #ebeef5;
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
  margin-bottom: 12px;
  width: 100%;
}

.segment-btn {
  flex: 1;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  line-height: 1.3;
}

.segment-btn:hover {
  color: var(--primary-dark);
}

.segment-btn.active {
  background-color: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

.btn-pdf {
  background: linear-gradient(135deg, #d32f2f, #c2185b) !important;
  color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  font-weight: 600 !important;
  box-shadow: 0 3px 6px rgba(211, 47, 47, 0.3) !important;
}

.btn-pdf:hover {
  background: linear-gradient(135deg, #b71c1c, #ad1457) !important;
}

/* Switch Toggles */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  margin-bottom: 8px;
}

.switch-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

input:checked+.slider {
  background-color: var(--primary);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 24px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.btn-primary:hover,
.btn-primary:active {
  background-color: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: #e0e0e0;
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: #d5d5d5;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
}

.btn-outline:hover {
  background-color: #e8eaf6;
}

/* Side Menu Drawer */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  left: -300px;
  width: 280px;
  height: 100%;
  background-color: #ffffff;
  z-index: 201;
  box-shadow: var(--shadow-lg);
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.drawer.active {
  left: 0;
}

.drawer-header {
  height: 160px;
  background-size: cover;
  background-position: center;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #ffffff;
  position: relative;
}

.drawer-header::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.7));
  z-index: 1;
}

.drawer-header-content {
  position: relative;
  z-index: 2;
}

.drawer-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid white;
  margin-bottom: 8px;
  object-fit: cover;
  background-color: white;
}

.drawer-title {
  font-size: 16px;
  font-weight: 700;
}

.drawer-subtitle {
  font-size: 12px;
  opacity: 0.9;
}

.drawer-menu {
  list-style: none;
  padding: 12px 0;
  overflow-y: auto;
}

.drawer-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  gap: 16px;
  transition: var(--transition);
}

.drawer-item:hover,
.drawer-item:active {
  background-color: #f0f0f0;
  color: var(--primary);
}

.drawer-item img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.drawer-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 10px 16px;
}

.drawer-scale-container {
  padding: 8px 18px 14px 18px;
}

.drawer-scale-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.scale-buttons {
  display: flex;
  gap: 8px;
}

.scale-btn {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.scale-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.scale-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

/* Results Screen Views */
.results-header-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.results-header-card .card-title {
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}

.results-volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.results-volume-row input {
  width: 80px;
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  color: var(--primary-dark);
}

.results-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.metric-badge {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.metric-label {
  font-size: 12px;
  opacity: 0.85;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 18px;
  font-weight: bold;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
}

.results-table th,
.results-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

.results-table th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.results-table td:last-child {
  text-align: right;
  font-weight: 700;
  color: var(--primary-dark);
}

/* Step By Step Solution View */
.solution-section {
  margin-bottom: 20px;
}

.step-header {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin: 16px 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 2px solid #e8eaf6;
}

.step-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: #333333;
  white-space: normal;
  margin-bottom: 12px;
}

.canvas-container {
  width: 100%;
  max-width: min(calc(500px * var(--app-scale)), 96%);
  background: #ffffff;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  margin: calc(14px * var(--app-scale)) auto;
  overflow: hidden;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chart-canvas {
  width: 100%;
  height: auto;
  display: block;
}

.reference-img {
  display: block;
  margin: calc(14px * var(--app-scale)) auto;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  box-sizing: border-box;
}

#Img_Defevtive {
  width: min(calc(250px * var(--app-scale)), 82%);
  max-width: calc(250px * var(--app-scale));
  padding: calc(6px * var(--app-scale));
}

#Img_SD {
  width: min(calc(370px * var(--app-scale)), 92%);
  max-width: calc(370px * var(--app-scale));
  padding: calc(6px * var(--app-scale));
}

.author-box {
  text-align: center;
  margin: calc(24px * var(--app-scale)) auto calc(16px * var(--app-scale)) auto;
  max-width: calc(500px * var(--app-scale));
  padding: calc(12px * var(--app-scale)) calc(16px * var(--app-scale));
  background: #e8eaf6;
  border-radius: 8px;
  border: 1px solid #c5cae9;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.author-box .author-label {
  font-size: calc(12px * var(--app-scale));
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary);
  font-weight: 700;
}

.author-box .author-name {
  font-size: calc(15px * var(--app-scale));
  font-weight: 700;
  color: #1a237e;
}

.author-box .author-cred {
  font-size: calc(13px * var(--app-scale));
  font-weight: 600;
  color: #3949ab;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background-color: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 380px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.2s ease-out;
}

@keyframes popIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
}

.modal-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 20px;
  max-height: 350px;
  overflow-y: auto;
}

.modal-list {
  list-style: none;
}

.modal-list-item {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  font-size: 13.5px;
  transition: var(--transition);
}

.modal-list-item:hover {
  background-color: #f5f5f5;
  color: var(--primary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ================= OFFICIAL DOE MIX DESIGN FORM (HTML TEMPLATE) ================= */
.doe-form-view {
  background-color: #525659;
  padding: 16px 8px;
  min-height: 100vh;
}

.doe-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 820px;
  margin: 0 auto 14px auto;
  padding: 0 4px;
}

.doe-page {
  background: #ffffff;
  width: 100%;
  max-width: 820px;
  margin: 0 auto 20px auto;
  padding: 24px 28px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  color: #111111;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 11.5px;
  line-height: 1.35;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

.doe-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-35deg);
  transform-origin: center center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: rgba(0, 0, 0, 0.14);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  z-index: 5;
  text-align: center;
  line-height: 1.35;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

.doe-wm-name {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.doe-wm-cred {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.doe-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  padding-bottom: 4px;
  border-bottom: 2px solid #000000;
}

.doe-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #000000;
  margin: 0;
}

.doe-job-title-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12.5px;
}

.doe-job-label {
  font-weight: 600;
}

.doe-job-val {
  font-weight: 700;
  color: #002594;
  border-bottom: 1.5px dotted #555555;
  padding: 0 6px 1px 6px;
  min-width: 140px;
  display: inline-block;
}

.doe-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
  font-size: 11px;
}

.doe-table thead th {
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
  padding: 4px 6px;
  font-weight: 700;
  text-align: left;
  vertical-align: bottom;
  background: transparent;
}

.doe-table tbody td {
  padding: 3.5px 6px;
  vertical-align: middle;
  border-bottom: 1px dotted #e0e0e0;
}

.doe-stage-start td {
  border-top: 1px solid #000000;
}

.doe-stage-num {
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  vertical-align: middle !important;
  border-right: 1px solid #dddddd;
  background: #fafafa;
  width: 32px;
}

.doe-curly-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.doe-curly-bracket {
  font-size: 26px;
  font-weight: 200;
  line-height: 0.9;
  color: #222222;
  user-select: none;
}

.doe-curly-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doe-line-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.doe-unit {
  color: #444444;
  font-size: 10.5px;
}

.doe-val {
  color: #002594;
  font-weight: 600;
  font-size: 11.5px;
}

.doe-val-bold {
  color: #002594;
  font-weight: 700;
  font-size: 12px;
}

.doe-choice {
  display: inline-block;
  font-weight: 500;
  color: #222222;
}

.doe-strike {
  text-decoration: line-through;
  text-decoration-color: #d32f2f;
  text-decoration-thickness: 1.8px;
  color: #777777;
}

.doe-pfa-ref {
  color: #002594;
  font-weight: 700;
  font-style: italic;
  font-size: 11.5px;
}

.doe-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.8px solid #002594;
  border-radius: 50%;
  padding: 1px 7px;
  color: #002594;
  font-weight: 700;
}

.doe-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #000000;
  background: #ffffff;
  min-width: 62px;
  height: 22px;
  padding: 0 4px;
  box-sizing: border-box;
}

.doe-flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.doe-flex-end {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}

.doe-lower-val-box {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  margin-left: auto;
}

.doe-formula {
  white-space: nowrap;
  margin-right: 6px;
}

.doe-quantities-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  margin-bottom: 12px;
  font-size: 11px;
}

.doe-quantities-table th,
.doe-quantities-table td {
  border: 1px solid #555555;
  padding: 4px 6px;
  text-align: center;
}

.doe-quantities-table thead th {
  background: #f5f5f5;
  font-weight: 700;
}

.doe-quantities-table td:first-child {
  text-align: left;
  font-weight: 500;
}

.doe-val-cell {
  color: #002594;
  font-weight: 700;
  font-size: 11.5px;
}

.doe-center-arrow {
  text-align: center;
  font-weight: 600;
  color: #333333;
}

.doe-arrow {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.doe-notes {
  font-size: 9.5px;
  line-height: 1.4;
  color: #444444;
  border-top: 1px solid #000000;
  padding-top: 6px;
  margin-top: 8px;
}

.doe-notes p {
  margin-bottom: 3px;
}

/* Print Friendly Styles */
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm 10mm;
  }

  body {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .app-frame {
    max-width: 100% !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }

  .app-bar,
  .bottom-nav,
  .drawer,
  .drawer-overlay,
  .modal-overlay,
  .no-print {
    display: none !important;
  }

  .doe-form-view {
    background: transparent !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .doe-page {
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 10px 14px !important;
    max-width: 100% !important;
    page-break-after: always;
  }

  .doe-page:last-child {
    page-break-after: auto;
  }

  .scroll-content {
    overflow: visible !important;
    padding: 0 !important;
  }

  .chart-canvas {
    max-width: 100% !important;
    page-break-inside: avoid;
  }
}

/* Mathematical Formula Typesetting */
.step-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-main);
  margin: 8px 0;
}

.step-text p {
  margin: 6px 0;
}

.math-block {
  background: #f8f9fa;
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  padding: calc(10px * var(--app-scale)) calc(14px * var(--app-scale));
  margin: calc(10px * var(--app-scale)) 0;
  overflow-x: auto;
  font-size: var(--font-equation);
  line-height: 1.45;
  white-space: normal;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.katex-display {
  margin: 0.25em 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0;
  white-space: normal;
}

.katex {
  font-size: calc(1.02em * var(--app-scale));
  white-space: normal;
}