.portico-app {
  display: grid;
  gap: 22px;
  color: var(--calc-ink);
  padding-bottom: 88px !important;
}

.portico-hero h1 {
  max-width: 980px;
}

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

.portico-steps button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  border: 1px solid var(--calc-border);
  border-radius: 6px;
  background: #fff;
  color: #30445b;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.portico-steps button span {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
  border: 1px solid #b9c8d8;
  border-radius: 4px;
  color: #1f2933;
  background: #f6f9fc;
}

.portico-steps button strong {
  min-width: 0;
  font-size: 0.92rem;
}

.portico-steps button.is-active,
.portico-steps button:hover {
  border-color: var(--calc-primary);
  color: var(--calc-blue-dark);
  box-shadow: 0 10px 22px rgba(18, 32, 51, 0.08);
}

.portico-steps button.is-active span {
  border-color: var(--calc-blue);
  background: var(--calc-blue);
  color: #fff;
}

.portico-quick-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--calc-border);
  border-radius: 8px;
  background: #fff;
}

.portico-quick-status {
  color: var(--calc-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.portico-toolbar button {
  border: 1px solid var(--calc-border);
  border-radius: 8px;
  background: #fff;
  color: var(--calc-ink);
  font-weight: 850;
}

.portico-toolbar button.is-active {
  border-color: var(--calc-primary);
  background: #e9f3ff;
  color: var(--calc-primary);
}

.portico-toolbar button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.portico-toolbar .portico-toolbar-edit:not(:disabled) {
  border-color: var(--calc-blue);
  background: var(--calc-blue);
  color: #fff;
}

.portico-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.portico-bottom-nav {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 35%);
}

.portico-bottom-nav #porticoPrevStepBtn {
  justify-self: start;
}

.portico-bottom-nav #porticoNextStepBtn {
  justify-self: center;
}

.portico-bottom-nav #porticoResetBtn {
  justify-self: end;
}

.portico-main,
.portico-results {
  min-width: 0;
}

.portico-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border: 1px solid var(--calc-border);
  border-radius: 8px 8px 0 0;
  background: #fffaf0;
}

.portico-toolbar button {
  flex: 0 0 42px;
  width: 42px;
  height: 38px;
}

.portico-toolbar .portico-name-toggle {
  flex-basis: auto;
  width: auto;
  min-width: 54px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.portico-toolbar-select {
  min-height: 38px;
  max-width: min(360px, 100%);
  padding: 6px 10px;
  border: 1px solid var(--calc-border);
  border-radius: 8px;
  background: #fff;
  color: var(--calc-ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
}

.portico-toolbar-spacer {
  flex: 1 1 160px;
}

.portico-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 74px;
  font-weight: 850;
  white-space: nowrap;
}

.portico-canvas-wrap {
  border: 1px solid var(--calc-border);
  border-top: 0;
  background: #fffaf0;
}

#porticoCanvas {
  display: block;
  width: 100%;
  min-height: 660px;
  background:
    linear-gradient(90deg, rgba(216, 154, 0, 0.08) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(216, 154, 0, 0.06) 0 1px, transparent 1px 100%),
    #fff;
  background-size: 28px 28px, 28px 28px, auto;
}

.portico-status,
.portico-messages {
  padding: 10px 12px;
  border: 1px solid var(--calc-border);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #fff;
  color: var(--calc-muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.portico-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#selectionPanel {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  min-width: 0;
}

#selectionPanel strong {
  color: var(--calc-blue-dark);
  font-weight: 950;
}

.portico-status-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.portico-status-actions select {
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--calc-border);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-weight: 800;
}

.portico-status-actions select:disabled {
  color: #8a9aad;
  background: #eef4fa;
}

.portico-panel,
.portico-data-strip,
.portico-results {
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--calc-border);
  border-radius: 8px;
  background: #fff;
}

.portico-panel h2,
.portico-results h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 900;
}

.portico-panel p {
  margin: 0;
  color: var(--calc-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.portico-data-strip {
  display: grid;
  gap: 12px;
}

.portico-data-strip details {
  border: 1px solid var(--calc-border);
  border-radius: 8px;
  background: #fffaf0;
}

.portico-data-strip summary {
  padding: 12px 14px;
  color: var(--calc-blue-dark);
  font-weight: 900;
  cursor: pointer;
}

.portico-data-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 12px;
  padding: 0 12px 12px;
}

.portico-selection-empty {
  color: var(--calc-muted);
  font-weight: 750;
}

.portico-field,
.portico-section-form,
.portico-grid-2 {
  display: grid;
  gap: 8px;
}

.portico-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portico-field label {
  margin-bottom: -4px;
  font-size: 0.78rem;
  color: #30445b;
  font-weight: 850;
}

.portico-field input,
.portico-field select,
.portico-section-form input,
.portico-section-form select,
.portico-results select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--calc-border);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}

.portico-user-defined {
  padding: 10px;
  border: 1px dashed #b9c8d8;
  border-radius: 8px;
  background: #fffaf0;
}

.portico-material-properties {
  padding: 10px;
  border: 1px solid #d5e0eb;
  border-radius: 8px;
  background: #fffaf0;
}

.portico-support-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, auto)) minmax(150px, 1fr);
  gap: 10px 14px;
  align-items: end;
  padding: 10px;
  border: 1px solid #d5e0eb;
  border-radius: 8px;
  background: #fffaf0;
}

.portico-support-editor strong {
  grid-column: 1 / -1;
  color: #30445b;
  font-size: 0.82rem;
  font-weight: 900;
}

.portico-section-builder {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.portico-section-types {
  display: grid;
  gap: 6px;
}

.portico-section-types button {
  min-height: 36px;
  padding: 7px 8px;
  border: 1px solid #c9d7e6;
  border-radius: 7px;
  background: #fff;
  color: #27384f;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.portico-section-types button.is-active,
.portico-section-types button:hover {
  border-color: var(--calc-blue);
  background: #e9f3ff;
  color: var(--calc-blue-dark);
}

.portico-section-builder-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.portico-section-properties {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.portico-section-properties span {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #d5e0eb;
  border-radius: 7px;
  background: #fff;
  color: #27384f;
  font-size: 0.82rem;
  font-weight: 850;
}

.portico-section-properties strong {
  display: block;
  color: #64758a;
  font-size: 0.72rem;
  font-weight: 900;
}

.portico-modal-hint {
  margin: 0;
  color: var(--calc-muted);
  font-size: 0.86rem;
  font-weight: 750;
}

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

.portico-table-wrap {
  overflow-x: auto;
}

.portico-table-wrap table {
  width: 100%;
  min-width: 320px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.portico-table-wrap th,
.portico-table-wrap td {
  padding: 7px 8px;
  border-bottom: 1px solid #d5e0eb;
  text-align: left;
  vertical-align: top;
}

.portico-table-wrap th {
  background: #eef4fa;
  font-weight: 900;
}

.portico-table-wrap td {
  font-weight: 700;
}

.portico-results {
  margin-top: 16px;
}

.portico-results-head,
.portico-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.portico-results-head {
  grid-template-columns: 1fr;
  margin-bottom: 12px;
}

.portico-node {
  fill: #d89a00;
  stroke: #fff;
  stroke-width: 2;
  cursor: grab;
}

.portico-node.is-selected,
.portico-member.is-selected {
  stroke: #e97817;
  stroke-width: 4;
}

.portico-member {
  stroke: #27384f;
  stroke-width: 4;
  stroke-linecap: round;
  cursor: pointer;
}

.portico-release {
  fill: #fff;
  stroke: #27384f;
  stroke-width: 2.4;
  cursor: pointer;
}

.portico-load {
  stroke: #e97817;
  stroke-width: 2.4;
  fill: none;
}

#porticoCanvas [data-type="memberLoad"],
#porticoCanvas [data-type="nodeLoad"] {
  cursor: pointer;
  pointer-events: all;
}

.portico-load-hit {
  stroke: transparent;
  stroke-width: 24;
  stroke-linecap: round;
  fill: none;
  pointer-events: stroke;
}

.portico-support {
  fill: none;
  stroke: #169b62;
  stroke-width: 2.2;
}

.portico-support-rotation {
  fill: #fff;
  stroke: #169b62;
  stroke-width: 2.2;
}

.portico-support-hatch {
  stroke: #169b62;
  stroke-width: 1.5;
}

.portico-diagram {
  fill: none;
  stroke: #e97817;
  stroke-width: 2;
}

.portico-diagram-fill {
  fill: rgba(233, 120, 23, 0.16);
  stroke: none;
}

.portico-diagram-probe {
  stroke: #b42318;
  stroke-width: 1.8;
  stroke-dasharray: 5 4;
  pointer-events: none;
}

.portico-diagram-probe-point {
  fill: #fff;
  stroke: #b42318;
  stroke-width: 2;
  pointer-events: none;
}

.portico-displacement-probe {
  stroke: #d89a00;
  stroke-width: 1.8;
  stroke-dasharray: 5 4;
  pointer-events: none;
}

.portico-displacement-probe-point {
  fill: #fff;
  stroke: #d89a00;
  stroke-width: 2;
  pointer-events: none;
}

.portico-deformed {
  fill: none;
  stroke: #d89a00;
  stroke-width: 2.4;
  stroke-dasharray: 8 5;
}

.portico-selection-window {
  fill: rgba(216, 154, 0, 0.12);
  stroke: #d89a00;
  stroke-width: 1.6;
  stroke-dasharray: 6 4;
  pointer-events: none;
}

.portico-reaction {
  stroke-width: 2.4;
  stroke-linecap: round;
}

.portico-modal[hidden] {
  display: none;
}

.portico-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.portico-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 31, 46, 0.48);
}

.portico-modal-card {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--calc-border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(17, 31, 46, 0.2);
}

.portico-modal-head,
.portico-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.portico-modal-head {
  margin-bottom: 14px;
}

.portico-modal-head h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 950;
}

#editModalBody {
  display: grid;
  gap: 10px;
}

.portico-modal-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

@media (max-width: 1100px) {
  .portico-workspace,
  .portico-data-grid,
  .portico-result-grid {
    grid-template-columns: 1fr;
  }

  .portico-steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .portico-section-builder,
  .portico-section-properties,
  .portico-support-editor {
    grid-template-columns: 1fr;
  }

  .portico-section-types {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portico-results-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .portico-toolbar {
    grid-template-columns: repeat(5, 42px);
    overflow-x: auto;
  }

  .portico-status {
    align-items: stretch;
    flex-direction: column;
  }

  .portico-status-actions {
    width: 100%;
  }

  .portico-status-actions select,
  .portico-status-actions .btn {
    flex: 1 1 0;
  }

  .portico-bottom-nav {
    grid-template-columns: 1fr;
  }

  .portico-bottom-nav .btn {
    justify-self: stretch !important;
  }
}
