/* APEC Estimate Tool — green-white theme */

body {
  background: #ffffff;
  margin: 0;
}

/* ---------- Header ---------- */
.apec-header {
  background: linear-gradient(135deg, #1b7f4d 0%, #21ba45 100%);
  color: #ffffff;
  padding: 16px 24px;
}
.apec-header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
}
.apec-header-inner > i.icon {
  font-size: 2em;
  margin: 0;
}
/* APEC mark in the header bar. The logo artwork is dark green on white, so
   it sits on its own white plate rather than directly on the green gradient. */
.apec-logo {
  height: 44px;
  width: auto;
  display: block;
  background: #ffffff;
  padding: 5px 10px;
  border-radius: 4px;
  flex: 0 0 auto;
}
@media print {
  .apec-logo { background: none; padding: 0; }
}
.apec-title {
  font-size: 1.4em;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.apec-subtitle {
  font-size: 0.85em;
  opacity: 0.9;
}

/* ---------- Layout ---------- */
.apec-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 24px 40px;
}

.apec-tabs.ui.secondary.pointing.menu .active.item {
  border-color: #21ba45;
  color: #1b7f4d;
  font-weight: 700;
}
.apec-tabs.ui.secondary.pointing.menu .item:hover {
  color: #1b7f4d;
}

.apec-toolbar {
  margin: 14px 0 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.apec-status {
  color: #1b7f4d;
  font-size: 0.9em;
  margin-left: 8px;
}

.apec-section-header.ui.header {
  color: #1b7f4d;
  margin: 16px 0 8px;
}
.apec-units-note {
  font-size: 0.72em;
  font-weight: 400;
  color: #8a8a8a;
  margin-left: 10px;
}

/* ---------- Handsontable green-white theme ---------- */
.hot-input .handsontable th,
.hot-output .handsontable th {
  background: #e2efda;   /* pale green — matches the sheet unit rows */
  color: #333333;
  font-weight: 600;
}
.hot-output .handsontable th {
  background: #a9d18e;   /* header green — matches the sheet header rows */
  color: #1a3311;
  font-weight: 700;
}
/* No overflow clipping here: it creates a block formatting context whose
   height depends on the table, while Handsontable sizes itself from the
   container — the circular dependency collapses the grid to ~0px and also
   clips the dropdown editors. */
.hot-input, .hot-output {
  margin-bottom: 8px;
  border: 1px solid #d4e6cc;
}
.hot-output .handsontable td {
  background: #fbfefb;
}

/* Dropdown (autocomplete) cells: green arrow + list highlight */
.handsontable .htAutocompleteArrow {
  color: #21ba45;
}
.handsontable .autocompleteEditor .htCore td.current,
.handsontable .autocompleteEditor .htCore tr:hover td {
  background: #e2efda;
}

/* ---------- Totals ---------- */
.apec-totals {
  margin: 14px 0 6px;
}
.apec-totals .ui.statistics {
  margin: 0;
}
.apec-totals .ui.statistic .value {
  color: #1b7f4d !important;
  font-size: 1.5em !important;
}
.apec-totals .ui.statistic .label {
  color: #666;
  font-size: 0.8em;
  text-transform: none;
}

/* ---------- Footer ---------- */
.apec-footer {
  border-top: 1px solid #e0eeda;
  color: #999;
  font-size: 0.8em;
  text-align: center;
  padding: 14px;
  margin-top: 24px;
  background: #fafdf9;
}

/* ---------- CFRP reference drawings ---------- */
.apec-figure {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  border: 1px solid #d4e6cc;
  background: #fafdf9;
  border-radius: 4px;
  padding: 12px 14px;
  margin-bottom: 4px;
}
.apec-figure img {
  flex: 1 1 460px;
  min-width: 0;
  max-width: 100%;
  max-height: 260px;
  object-fit: contain;
  object-position: left top;
  background: #ffffff;
  border: 1px solid #e0eeda;
  border-radius: 3px;
  padding: 6px;
  cursor: zoom-in;
}
.apec-legend {
  flex: 1 1 320px;
  min-width: 0;
  font-size: 0.85em;
  color: #444;
}
.apec-legend-title {
  color: #1b7f4d;
  font-weight: 700;
  margin-bottom: 6px;
}
.apec-legend ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.65;
}
.apec-legend code {
  background: #e2efda;
  color: #1a3311;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.92em;
}
.apec-legend-note {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e0eeda;
  color: #767676;
  font-size: 0.94em;
  line-height: 1.5;
}

/* Lightbox: white plate behind the line drawing so it stays readable */
.apec-figure-modal .image.content {
  background: #ffffff;
  border-radius: 4px;
  padding: 14px;
}
.apec-figure-modal .image.content img {
  width: 100%;
  height: auto;
}

@media print {
  .apec-figure { break-inside: avoid; }
}

/* ---------- Engine (how a row was computed) ---------- */
.apec-engine-modal > .header i.icon {
  color: #1b7f4d;
}
.apec-engine-member {
  margin-bottom: 22px;
}
.apec-engine-member:last-child {
  margin-bottom: 0;
}
.apec-engine-mark {
  color: #1b7f4d;
  font-weight: 700;
  font-size: 1.05em;
  border-bottom: 2px solid #a9d18e;
  padding-bottom: 4px;
  margin-bottom: 8px;
}
.apec-engine-given {
  font-size: 0.86em;
  color: #666;
  margin-bottom: 8px;
}
.apec-engine-given b {
  color: #1b7f4d;
  margin-right: 4px;
}
.apec-engine-given span {
  display: inline-block;
  background: #f0f7ec;
  border: 1px solid #e0eeda;
  border-radius: 3px;
  padding: 1px 7px;
  margin: 2px 4px 2px 0;
  white-space: nowrap;
}
.apec-engine-note {
  color: #9f3a38;
  font-size: 0.88em;
  margin-bottom: 8px;
}
.apec-engine-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88em;
}
.apec-engine-table th,
.apec-engine-table td {
  border: 1px solid #e0eeda;
  padding: 4px 9px;
  text-align: left;
  vertical-align: top;
}
.apec-engine-table th {
  background: #e2efda;
  color: #1a3311;
  font-weight: 600;
}
.apec-engine-table tbody tr:nth-child(even) {
  background: #fafdf9;
}
.apec-engine-table td.sym {
  font-weight: 700;
  color: #1b7f4d;
  white-space: nowrap;
}
.apec-engine-table td.sub,
.apec-engine-table td.res {
  font-variant-numeric: tabular-nums;
}
.apec-engine-table td.res {
  font-weight: 600;
  white-space: nowrap;
}
