.graphing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 316px;
  gap: 0;
  height: 100%;
  min-height: 0;
}

.graph-workspace,
.graph-editor-panel {
  min-height: 0;
}

.graph-workspace {
  background: #f8f7f6;
  overflow: hidden;
}

.graph-surface {
  position: relative;
  height: 100%;
  min-height: 0;
}

.graph-canvas {
  width: 100%;
  height: 100%;
  min-height: 100%;
  display: block;
  background: #f8f7f6;
}

.graph-overlay {
  position: absolute;
  display: flex;
  pointer-events: none;
}

.graph-surface-tools {
  top: 12px;
  right: 12px;
}

.graph-tool-cluster,
.graph-zoom-controls {
  display: flex;
  gap: 1px;
  padding: 0;
  border-radius: 4px;
  overflow: hidden;
  pointer-events: auto;
  background: #2f3034;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.graph-zoom-controls {
  right: 12px;
  bottom: 12px;
  flex-direction: column;
}

.graph-surface-button {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2f3034;
  color: #ffffff;
  border: 0;
  font-size: 1.35rem;
}

.graph-surface-button:hover,
.graph-surface-button:focus-visible {
  background: #3a3c40;
}

.graph-editor-panel {
  display: flex;
  flex-direction: column;
  background: #202126;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.graph-expression-list {
  padding: 0;
}

.graph-expression-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: stretch;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: #2d2e33;
}

.graph-expression-row.active {
  background: #34353b;
}

.graph-expression-row.invalid {
  box-shadow: inset 3px 0 0 #e81123;
}

.graph-expression-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  background: var(--graph-expression-color);
  color: #ffffff;
  font-size: 1.05rem;
  font-style: italic;
}

.graph-expression-badge sub {
  font-size: 0.65rem;
  line-height: 1;
}

.graph-expression-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f4f4f5;
  box-shadow: none;
}

.graph-expression-input::placeholder {
  color: #b3b4b8;
}

.graph-status {
  padding: 0 12px;
  color: #9ea1ab;
  font-size: 0.82rem;
  min-height: 0;
  max-height: 0;
  overflow: hidden;
}

.graph-status.visible {
  padding: 10px 12px 8px;
  min-height: 2.3rem;
  max-height: 4rem;
}

.graph-keypad-shell {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.graph-keypad-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  padding: 0 0 1px;
  background: rgba(255, 255, 255, 0.04);
}

.graph-keypad-group {
  min-height: 30px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: #202126;
  color: #f4f4f5;
  font-size: 0.82rem;
}

.graph-keypad-caret {
  color: #a1a3aa;
  font-size: 0.7rem;
}

.graph-keypad-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  padding: 1px 0 0;
  background: rgba(255, 255, 255, 0.04);
}

.graph-keypad-grid .calc-button {
  min-height: 0;
  height: 48px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.graph-keypad-grid .calc-button.equals {
  color: #102131;
}

@media (max-width: 1023px) {
  .graphing-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
}

@media (max-width: 767px) {
  .graphing-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .graphing-layout.mobile-view-graph .graph-editor-panel {
    display: none;
  }

  .graphing-layout.mobile-view-editor .graph-workspace {
    display: none;
  }

  .graph-editor-panel {
    border-left: 0;
  }

  .graph-expression-row {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .graph-expression-input {
    height: 40px;
  }

  .graph-keypad-grid .calc-button {
    height: 44px;
    font-size: 0.95rem;
  }

  .graph-surface-tools {
    top: 8px;
    right: 8px;
  }

  .graph-zoom-controls {
    right: 8px;
    bottom: 8px;
  }
}
