* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  min-height: 100vh;
  background: #e4f6ef;
  color: #0f3b3c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 16px;
}
   
.container {
  width: 100%;
  max-width: 1400px;
  background: #f8fffd;
  border-radius: 20px;
  box-shadow: 0 18px 45px rgba(15, 90, 70, 0.15);
  padding: 24px 24px 28px;
  border: 1px solid rgba(33, 120, 102, 0.15);
}

@media (min-width: 640px) {
  .container {
    padding: 28px 32px 32px;
  }
}

h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0b6f5d;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.82rem;
  color: #3c7d71;
  margin-bottom: 18px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.badge {
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(13, 110, 95, 0.2);
  color: #0f5e55;
  background: rgba(190, 239, 227, 0.7);
}

.card {
  background: #f0fbf7;
  border-radius: 16px;
  border: 1px solid rgba(22, 122, 105, 0.18);
  padding: 14px;
  margin-bottom: 14px;
}

@media (min-width: 768px) {
  .card {
    padding: 18px;
  }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 6px;
}

.card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f5a52;
}

.card-description {
  font-size: 0.76rem;
  color: #3a7c70;
}

.info-tip {
  font-size: 0.74rem;
  color: #1d7f72;
  margin-top: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 0.8rem;
}

thead {
  background: #d2f1ea;
}

th,
td {
  border-bottom: 1px solid rgba(35, 130, 116, 0.15);
  padding: 6px 6px;
  text-align: right;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  font-weight: 600;
  color: #0b5c50;
  font-size: 0.78rem;
}

.calibration-table {
  margin-top: 0;
  border: 1px solid rgba(8, 119, 102, 0.25);
  border-radius: 14px;
  overflow: hidden;
  background: #eefdf8;
}

.calibration-table thead {
  background: #9de0d3;
}

.calibration-table th,
.calibration-table td {
  padding: 8px 6px;
  text-align: center;
  border: 1px solid rgba(31, 129, 114, 0.18);
}

.calibration-table th {
  letter-spacing: 0.02em;
  text-transform: none;
  font-size: 0.75rem;
  color: #074f46;
}

.calibration-table td:first-child {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.calibration-table .level-conc {
  font-weight: 600;
  color: #008c78;
}

.calibration-table .btn {
  margin: 0 auto;
}

/* Column width adjustments */
.calibration-table th:nth-child(2),
.calibration-table td:nth-child(2) {
  /* Stock Source column - wider */
  min-width: 150px;
  width: 20%;
}

.calibration-table th:nth-child(3),
.calibration-table td:nth-child(3) {
  /* ml Taken column - narrower */
  min-width: 80px;
  width: 8%;
}

.calibration-table th:nth-child(4),
.calibration-table td:nth-child(4) {
  /* Dilution column - narrower */
  min-width: 80px;
  width: 8%;
}

/* Ensure inputs and selects respect column widths */
.calibration-table td:nth-child(2) select,
.calibration-table td:nth-child(2) input {
  width: 100%;
  min-width: 120px;
}

.calibration-table td:nth-child(3) input,
.calibration-table td:nth-child(4) input {
  width: 100%;
  min-width: 60px;
  max-width: 100px;
}

.stock-table-wrapper {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 8px;
}

.stock-table-wrapper::-webkit-scrollbar {
  height: 6px;
}

.stock-table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(13, 94, 82, 0.25);
  border-radius: 999px;
}

.stock-table {
  border: 1px solid rgba(9, 122, 103, 0.25);
  width: 100%;
  background: #f1fcf8;
  border-collapse: collapse;
}

.stock-table thead {
  background: linear-gradient(135deg, #0f8f78, #11a093);
}

.stock-table th {
  font-size: 0.75rem;
  white-space: nowrap;
  color: #f6fffd;
  font-weight: 600;
  padding: 10px 8px;
  text-align: left;
  border: 1px solid rgba(10, 112, 96, 0.3);
}

.stock-table th:first-child {
  text-align: left;
}

.stock-table td {
  padding: 8px;
  vertical-align: middle;
  border: 1px solid rgba(10, 112, 96, 0.2);
  text-align: left;
  background: #f8fffd;
}

.stock-table tbody tr:hover {
  background: rgba(15, 143, 125, 0.05);
}

.stock-table tbody tr:nth-child(even) {
  background: #f5fffb;
}

.stock-table tbody tr:nth-child(even):hover {
  background: rgba(15, 143, 125, 0.08);
}

.stock-table input,
.stock-table select {
  text-align: left;
  width: 100%;
  min-width: 80px;
}

.stock-table input[type="text"] {
  font-weight: 600;
  color: #0b5c50;
}

.stock-table input[type="text"]:focus {
  border-color: #0f9e87;
  box-shadow: 0 0 0 1px rgba(15, 158, 135, 0.35);
}

.stock-table .stock-conc {
  background: rgba(15, 143, 125, 0.08);
  font-size: 0.8rem;
  text-align: center;
  font-weight: 600;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 5px 8px;
  border-radius: 10px;
  border: 1px solid rgba(10, 112, 96, 0.4);
  background: #f5fffb;
  color: #0e564b;
  font-size: 0.8rem;
  outline: none;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
  border-color: #0f9e87;
  box-shadow: 0 0 0 1px rgba(15, 158, 135, 0.35);
}

.card input,
.card select {
  background: #f5fffb !important;
  color: #0e564b !important;
  border-color: rgba(10, 112, 96, 0.4) !important;
}

/* Remove spinner arrows from number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}

.btn {
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid transparent;
  background: #0f9a86;
  color: #f3fffc;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn.secondary {
  background: transparent;
  border-color: rgba(15, 154, 134, 0.35);
  color: #0d6f61;
}

.btn.danger {
  background: #d14949;
  border-color: #c13d3d;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 120, 100, 0.25);
  filter: brightness(1.03);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
  filter: brightness(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.print-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

@media (min-width: 640px) {
  .results-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

.stat-card {
  padding: 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(178, 238, 226, 0.6), rgba(241, 255, 251, 0.9));
  border: 1px solid rgba(12, 118, 102, 0.25);
}

.stat-label {
  font-size: 0.72rem;
  color: #2d7368;
  margin-bottom: 2px;
}

.stat-value {
  font-size: 0.94rem;
  font-weight: 600;
  color: #0b5c50;
  word-break: break-all;
}

.stat-subtext {
  margin-top: 2px;
  font-size: 0.7rem;
  color: #2d7368;
}

.unit {
  font-size: 0.7rem;
  color: #408072;
}

.footer-note {
  margin-top: 12px;
  font-size: 0.7rem;
  color: #438476;
  text-align: right;
}

.error {
  font-size: 0.75rem;
  color: #c14949;
  margin-top: 6px;
}

#linearityChart {
  max-height: 500px;
  min-height: 450px;
}

.no-print {
  /* placeholder for print control */
}

@media print {
  body {
    background: #fff;
    padding: 0;
  }

  .container {
    max-width: 100%;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0;
    background: #fff;
  }

  .card {
    page-break-inside: avoid;
    break-inside: avoid;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
  }

  .no-print {
    display: none !important;
  }
  
  .hide-lod-loq-print #lod-loq-section,
  .hide-lod-loq-print #lod-loq-note {
    display: none !important;
  }
}

