:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f9;
  color: #17202a;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0 28px;
  border-bottom: 1px solid #d9dee7;
}

.eyebrow {
  margin: 0 0 4px;
  color: #4f6580;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.15rem;
}

.intro {
  max-width: 720px;
  margin-bottom: 0;
  color: #536273;
}

.status-card {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  background: #ffffff;
  color: #4a5665;
  font-size: 0.92rem;
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background: #a8b1bd;
}

.status-dot.ok {
  background: #16845b;
}

.status-dot.error {
  background: #b42318;
}

.query-panel,
.result-panel {
  margin-top: 24px;
}

.query-panel {
  padding: 20px;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  background: #ffffff;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

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

input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #b9c2ce;
  border-radius: 6px;
  background: #ffffff;
  color: #17202a;
}

input:focus {
  border-color: #1f6f8b;
  box-shadow: 0 0 0 3px rgba(31, 111, 139, 0.16);
  outline: none;
}

button {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid #185f78;
  border-radius: 6px;
  background: #1f6f8b;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: #185f78;
}

button:disabled {
  border-color: #8da0af;
  background: #8da0af;
  cursor: wait;
}

.result-panel {
  min-height: 260px;
  padding: 20px;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  background: #ffffff;
}

.empty-state,
.error-state {
  padding: 40px 16px;
  color: #647386;
  text-align: center;
}

.error-state {
  color: #8f1f14;
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

#summary {
  margin-bottom: 0;
  color: #4d5b68;
}

.metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.metrics span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef3f6;
  color: #304353;
  font-size: 0.85rem;
  font-weight: 700;
}

.metrics #truncated {
  background: #fff1e6;
  color: #8a4a0f;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #d9dee7;
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e9ef;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #eef3f6;
  color: #263847;
  font-size: 0.84rem;
  font-weight: 800;
}

td {
  color: #24313f;
  font-size: 0.92rem;
}

tr:last-child td {
  border-bottom: 0;
}

details {
  margin-top: 16px;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

pre {
  overflow-x: auto;
  padding: 12px;
  border-radius: 8px;
  background: #17202a;
  color: #eef3f6;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding: 18px 0;
  }

  .app-header,
  .result-header {
    display: block;
  }

  .status-card {
    margin-top: 16px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }

  .metrics {
    justify-content: flex-start;
    margin-top: 14px;
  }
}
