:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f6f8;
  color: #1f2933;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: #1f5f8b;
  color: white;
  cursor: pointer;
  padding: 9px 13px;
  white-space: nowrap;
}

button:hover {
  background: #184c70;
}

button.ghost {
  background: #e8edf2;
  color: #293845;
}

button.ghost:hover {
  background: #dce4eb;
}

.shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  font-weight: 700;
}

h2 {
  font-size: 17px;
  font-weight: 650;
}

h3 {
  color: #667485;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 8px;
  text-transform: uppercase;
}

#status,
.muted {
  color: #667485;
  font-size: 13px;
  margin-top: 4px;
}

.panel {
  background: white;
  border: 1px solid #dce3ea;
  border-radius: 8px;
  padding: 16px;
}

.narrow {
  width: min(420px, 100%);
}

label {
  display: grid;
  gap: 8px;
  color: #526171;
  margin-top: 16px;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfcfd;
  color: #1f2933;
}

input:focus,
textarea:focus {
  border-color: #1f5f8b;
  outline: 2px solid #d8e8f3;
}

textarea {
  min-height: 156px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  line-height: 1.5;
}

.error {
  min-height: 22px;
  color: #b42318;
  margin-top: 12px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metrics article {
  background: #21313f;
  color: white;
  border-radius: 8px;
  padding: 16px;
}

.metrics span {
  display: block;
  color: #b9c5cf;
  font-size: 13px;
}

.metrics strong {
  display: block;
  font-size: 30px;
  margin-top: 4px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.createPanel {
  margin-bottom: 12px;
}

.createGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

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

.createGrid label {
  margin-top: 0;
}

.createGrid input {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  line-height: 1.4;
}

.inputAction {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.outputBox:empty {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: 12px;
}

.panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.catalogGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-height: 300px;
}

.catalogGrid.appCatalogGrid {
  grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1.1fr);
}

.list {
  display: grid;
  align-content: start;
  gap: 6px;
  max-height: 430px;
  overflow: auto;
}

.listItem {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 2px;
  background: #f4f7fa;
  color: #263642;
  padding: 10px;
  text-align: left;
}

.listItem:hover {
  background: #e9f1f7;
}

.listItem.active {
  background: #dcecf7;
  box-shadow: inset 3px 0 0 #1f5f8b;
}

.listItem span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.listItem small {
  color: #667485;
  font-size: 12px;
}

.tableWrap {
  overflow: auto;
  max-height: 460px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid #edf1f4;
  padding: 9px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f8fafc;
  color: #667485;
  font-weight: 650;
  position: sticky;
  top: 0;
}

td {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #e8edf2;
  color: #293845;
  min-height: 24px;
  padding: 2px 8px;
}

.emptyState {
  align-items: center;
  color: #667485;
  display: flex;
  justify-content: center;
  min-height: 160px;
  text-align: center;
}

pre {
  overflow: auto;
  max-height: 320px;
  border-radius: 8px;
  background: #16202a;
  color: #dce8f5;
  margin: 12px 0 0;
  padding: 14px;
}

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

@media (max-width: 780px) {
  .shell {
    width: min(100vw - 20px, 1440px);
    padding-top: 16px;
  }

  .metrics,
  .createGrid,
  .createGrid.twoFields,
  .catalogGrid {
    grid-template-columns: 1fr;
  }

  .catalogGrid.appCatalogGrid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panelHeader {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal[hidden] {
  display: none;
}

.modalOverlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.modalContent {
  position: relative;
  background: white;
  border-radius: 10px;
  padding: 24px;
  max-width: 560px;
  width: calc(100% - 32px);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1;
}

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

.modalHeader h3 {
  margin: 0;
  text-transform: none;
  font-size: 17px;
  color: #1f2933;
}

.modalContent pre {
  max-height: 60vh;
  margin: 0;
  font-size: 12px;
}