.spot-workspace {
  min-width: 0;
  --spot-border: #e3e8e5;
  --spot-soft: #f6f8f7;
  --spot-ink: #26352f;
}

.spot-workspace h1 {
  font-size: 24px;
}

.spot-workspace h2 {
  margin: 0;
  color: var(--spot-ink);
  font-size: 17px;
}

.spot-workspace h3 {
  font-size: 15px;
}

.spot-workspace .page-heading {
  margin-bottom: 18px;
}

.spot-account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--spot-border);
}

.spot-account-row img {
  width: 22px;
  height: 22px;
  flex: none;
}

.spot-account-row select,
.spot-record-toolbar select,
.spot-record-toolbar input,
.spot-workspace .form-field input,
.spot-workspace .form-field select {
  height: 38px;
  border: 1px solid #d8dfdb;
  border-radius: 5px;
  background: #fff;
  color: var(--spot-ink);
  font: inherit;
}

.spot-account-row select {
  width: min(340px, 42vw);
  min-width: 220px;
  padding: 0 34px 0 10px;
}

#spot-environment,
#spot-running {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 4px;
  background: #f0f3f1;
  color: #56645d;
  font-size: 11px;
  white-space: nowrap;
}

#spot-running {
  background: var(--green-bg);
  color: var(--green);
}

#spot-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 3px solid #d99b47;
  background: var(--amber-bg);
  color: #82530f;
  font-size: 12px;
  line-height: 1.6;
}

#spot-status:empty {
  display: none;
}

.spot-balances {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 22px 0;
  border-bottom: 1px solid var(--spot-border);
}

.spot-balances > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  padding: 0 20px;
  border-right: 1px solid var(--spot-border);
  overflow-wrap: anywhere;
}

.spot-balances > div:first-child {
  padding-left: 0;
}

.spot-balances > div:last-child {
  padding-right: 0;
  border-right: 0;
}

.spot-balances span,
.spot-balances small {
  color: var(--muted);
}

.spot-balances span {
  font-size: 11px;
  font-weight: 600;
}

.spot-balances strong {
  color: var(--spot-ink);
  font: 600 18px/1.35 ui-monospace, SFMono-Regular, monospace;
}

.spot-balances small {
  font-size: 10px;
}

.spot-runtime {
  padding: 10px 0;
  border-bottom: 1px solid var(--spot-border);
}

.spot-runtime summary,
.spot-admin summary {
  cursor: pointer;
  color: #496057;
  font-weight: 600;
}

.spot-runtime summary {
  padding: 7px 0;
  font-size: 12px;
}

.spot-runtime form {
  padding: 14px 0 8px;
}

.spot-layout {
  display: grid;
  grid-template-columns: minmax(380px, 420px) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  padding: 30px 0 34px;
}

.spot-input,
.spot-records {
  min-width: 0;
}

.spot-input {
  padding-right: 31px;
  border-right: 1px solid var(--spot-border);
}

.spot-input > h2 {
  margin-bottom: 18px;
}

.spot-input > .form-field {
  margin-bottom: 10px;
}

.spot-input form > button {
  width: 100%;
  margin-top: 4px;
}

.spot-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}

.spot-fields input,
.spot-fields select {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
}

.spot-fields .form-field {
  min-width: 0;
  margin: 0;
}

.spot-workspace .form-field input,
.spot-workspace .form-field select {
  margin-top: 6px;
  padding: 0 10px;
}

.spot-workspace input:focus,
.spot-workspace select:focus {
  border-color: #78a891;
  outline: 3px solid #dcece4;
  outline-offset: 0;
}

.spot-workspace [hidden] {
  display: none !important;
}

.spot-record-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  margin-bottom: 14px;
}

.spot-record-toolbar h2 {
  min-width: 110px;
}

.spot-record-toolbar select,
.spot-record-toolbar input {
  min-width: 0;
  max-width: 180px;
  padding: 0 28px 0 9px;
  font-size: 12px;
}

.spot-record-toolbar input {
  width: 150px;
  padding-right: 9px;
}

#spot-record-data,
#spot-detail {
  min-width: 0;
}

.spot-records .customer-table-scroll {
  border: 1px solid var(--spot-border);
  border-radius: 5px;
  background: #fff;
  scrollbar-width: thin;
}

.spot-records .customer-table {
  min-width: 640px;
  font-size: 12px;
}

.spot-records .customer-table th {
  padding: 11px 10px;
  background: var(--spot-soft);
}

.spot-records .customer-table td {
  padding: 13px 10px;
  vertical-align: top;
  white-space: nowrap;
}

.spot-workspace td small {
  display: block;
  max-width: 190px;
  margin-top: 4px;
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
}

.spot-records td .icon-btn + .icon-btn {
  margin-left: 2px;
}

.spot-records .spot-balance-row > td {
  padding: 0 10px 14px;
  white-space: normal;
}

.spot-balance-audit {
  padding: 12px;
  border-left: 3px solid #78a891;
  background: #f6f8f7;
}

.spot-balance-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--spot-ink);
  font-size: 11px;
}

.spot-balance-heading span {
  color: var(--muted);
  font-weight: 400;
}

.spot-balance-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
}

.spot-balance-audit table {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
  font: 11px/1.45 ui-monospace, SFMono-Regular, monospace;
}

.spot-records .spot-balance-audit th,
.spot-records .spot-balance-audit td {
  padding: 6px 8px;
  border-bottom: 1px solid #dde4e0;
  background: transparent;
  text-align: right;
  white-space: nowrap;
}

.spot-records .spot-balance-audit th:first-child {
  text-align: left;
}

.spot-records .spot-balance-audit tbody tr:last-child th,
.spot-records .spot-balance-audit tbody tr:last-child td {
  border-bottom: 0;
}

#spot-detail {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--spot-border);
  overflow-wrap: anywhere;
}

#spot-detail:empty {
  display: none;
}

#spot-detail h3 {
  line-height: 1.5;
}

#spot-next {
  margin-top: 12px;
}

.spot-fields.spot-field-groups {
  display: block;
}

.spot-leg {
  min-width: 0;
  margin: 0 0 20px;
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid var(--spot-border);
}

.spot-leg:first-child {
  padding-top: 4px;
  border-top: 0;
}

.spot-leg legend {
  padding: 0 0 12px;
  color: var(--spot-ink);
  font-size: 14px;
  font-weight: 650;
}

.spot-leg details {
  margin-top: 10px;
}

.spot-leg summary {
  padding: 7px 0;
  color: #5d6d65;
  cursor: pointer;
  font-size: 12px;
}

.spot-leg details .spot-fields {
  margin-top: 10px;
}

.spot-operation-help {
  min-height: 38px;
  margin: -2px 0 16px;
  padding: 10px 12px;
  border-left: 2px solid #b9ccc2;
  background: var(--spot-soft);
  color: #64716b;
  font-size: 11px;
  line-height: 1.55;
}

.spot-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
  color: #44564a;
  font-size: 12px;
  font-weight: 600;
}

.spot-required {
  flex: none;
  padding: 1px 5px;
  border-radius: 3px;
  background: #fff1f2;
  color: #9b3d47;
  font-size: 10px;
  font-weight: 500;
}

.spot-field-help {
  display: block;
  min-height: 32px;
  margin-top: 6px;
  color: #748079;
  font-size: 10px;
  line-height: 1.5;
}

.spot-mode {
  margin: 0 0 14px;
}

.spot-mode > span {
  display: block;
  margin-bottom: 7px;
  color: #44564a;
  font-size: 12px;
  font-weight: 600;
}

.spot-mode .segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  width: 100%;
  margin: 0;
}

.spot-mode .segmented button {
  min-width: 0;
  padding: 7px 8px;
  line-height: 1.25;
  white-space: normal;
}

.spot-mode .segmented button[aria-pressed="true"] {
  background: #fff;
  color: var(--green);
  box-shadow: 0 1px 3px #16281d12;
}

.spot-leg > details .spot-required {
  display: none;
}

.spot-leg > details[open] .spot-required {
  display: inline;
}

.spot-admin {
  padding: 26px 0 8px;
  border-top: 1px solid var(--spot-border);
}

.spot-admin > h2 {
  margin-bottom: 18px;
}

.spot-admin details {
  margin-top: 0;
  border-bottom: 1px solid var(--spot-border);
}

.spot-admin summary {
  padding: 17px 0;
  font-size: 12px;
}

.spot-admin details > form,
.spot-admin details > div {
  padding: 2px 0 20px;
}

#spot-switches,
#spot-grant-scopes {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
}

#spot-switches {
  margin-bottom: 8px;
}

#spot-grant-scopes {
  grid-column: 1 / -1;
}

.spot-preview {
  display: grid;
  gap: 10px;
  max-height: 50vh;
  overflow: auto;
}

.spot-preview > div {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(0, 2fr);
  gap: 12px;
}

.spot-preview dt {
  color: var(--muted);
}

.spot-preview dd {
  margin: 0;
  overflow-wrap: anywhere;
}

#spot-query-original[hidden] {
  display: none !important;
}

.spot-workspace .icon-btn {
  flex-shrink: 0;
}

@media (max-width: 1240px) {
  .spot-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
  }

  .spot-input {
    padding: 0 0 30px;
    border-right: 0;
    border-bottom: 1px solid var(--spot-border);
  }

  .spot-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .spot-fields.spot-field-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 24px;
  }

  .spot-fields.spot-field-groups > .spot-mode,
  .spot-fields.spot-field-groups > .spot-leg:first-of-type {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .spot-fields,
  .spot-fields.spot-field-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .spot-workspace h1 {
    font-size: 22px;
  }

  .spot-account-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 9px 10px;
  }

  .spot-account-row select {
    width: 100%;
    min-width: 0;
  }

  #spot-environment,
  #spot-running {
    grid-column: 1 / -1;
    justify-self: start;
  }

  #spot-running {
    margin-top: -5px;
  }

  .spot-balances {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 8px 0;
  }

  .spot-balances > div {
    padding: 14px 10px;
    border-bottom: 1px solid var(--spot-border);
  }

  .spot-balances > div:nth-child(2n) {
    padding-right: 0;
    border-right: 0;
  }

  .spot-balances > div:nth-child(2n + 1) {
    padding-left: 0;
  }

  .spot-balances > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .spot-layout {
    gap: 26px;
    padding: 26px 0;
  }

  .spot-input {
    padding-bottom: 26px;
  }

  .spot-fields,
  .spot-fields.spot-field-groups {
    grid-template-columns: minmax(0, 1fr);
  }

  .spot-fields.spot-field-groups > .spot-mode,
  .spot-fields.spot-field-groups > .spot-leg:first-of-type {
    grid-column: auto;
  }

  .spot-record-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .spot-record-toolbar h2 {
    grid-column: 1;
  }

  .spot-record-toolbar .icon-btn {
    grid-column: 2;
    grid-row: 1;
  }

  .spot-record-toolbar select,
  .spot-record-toolbar input {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
  }

  .spot-operation-help,
  .spot-field-help {
    min-height: 0;
  }

  .spot-preview > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  #spot-switches {
    flex-direction: column;
  }
}
