:root {
    --bg: #f6f8fb;
    --panel: #ffffff;
    --panel2: #f2f5f9;
    --text: #111827;
    --muted: #6b7280;
    --border: #d6dee8;
    --btn: #ffffff;
    --btnHover: #eef3fb;
    --danger: #ffe8e8;
  }
  * { box-sizing: border-box; }
  html, body { height: 100%; margin: 0; padding: 0; }
  body {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
    background: var(--bg);
    color: var(--text);
  }
.hidden { display: none !important; }
.label { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; line-height: 1.4; }
.legend-list { list-style: disc; }
.legend-list li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 10px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid transparent;
}
.legend-axial-comp { background: #ef4444; border: 1px solid #fca5a5; box-shadow: 0 0 0 1px #fff; }
.legend-axial-ten  { background: #0ea5e9; border: 1px solid #bae6fd; box-shadow: 0 0 0 1px #fff; }
.legend-moment-pos { background: #8b5cf6; border: 1px solid #ddd6fe; box-shadow: 0 0 0 1px #fff; }
.legend-moment-neg { background: #f97316; border: 1px solid #fed7aa; box-shadow: 0 0 0 1px #fff; }
.legend-label { color: #111827; font-size: 11px; }
.legend-text { font-size: 11px; font-weight: 600; }
.legend-moment-pos-text { color: #6b21a8; }
.legend-moment-neg-text { color: #c2410c; }
.legend-axial-comp-text { color: #16a34a; }
.legend-axial-ten-text { color: #0ea5e9; }
.legend-shear-pos-text { color: #fcd34d; }  
.legend-shear-neg-text { color: #fda4af; }  
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; }
  .select, input[type="checkbox"] {
    accent-color: #6aa6ff;
  }
  .select {
    width: 140px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel2);
    color: var(--text);
  }
  .btncol { display: flex; flex-direction: column; gap: 8px; }
  .btn {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--btn);
    color: var(--text);
    cursor: pointer;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
  }
  .btn:hover { background: var(--btnHover); }
.btn.active { outline: 2px solid #4b89ff; }
.btn.danger { background: var(--danger); }
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  width: 95vw;
  max-width: 1280px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
  position: relative;
}
.modal-card-narrow {
  width: 520px;
  max-width: 95vw;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.modal-field .select,
.modal-field input {
  width: 100%;
}
.radio-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #111827;
}
.radio input {
  width: auto;
}
.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}
.chart-block {
  margin-top: 14px;
}
.chart-canvas {
  width: 100%;
  height: 160px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}
.chart-marker {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 1;
}
.chart-tooltip {
  position: absolute;
  padding: 6px 8px;
  font-size: 12px;
  background: rgba(31, 41, 55, 0.9);
  color: #fff;
  border-radius: 6px;
  pointer-events: none;
  transform: translate(-50%, -110%);
  white-space: nowrap;
  z-index: 2;
}
