:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --panel: #ffffff;
  --line: #d7dee6;
  --text: #1d2733;
  --muted: #667587;
  --accent: #176f7d;
  --accent-dark: #105461;
  --danger: #9b2d20;
  --console-bg: #111820;
  --console-text: #d9f0e1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

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

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

h1,
h2,
p {
  margin: 0;
}

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

h2 {
  font-size: 17px;
}

p,
span {
  color: var(--muted);
}

.status-pill {
  min-width: 120px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  text-align: center;
  font-weight: 600;
}

.status-pill[data-state="ok"] {
  color: #0b6c3a;
}

.status-pill[data-state="bad"] {
  color: var(--danger);
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(280px, 0.9fr);
  gap: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.controls {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

input,
select,
button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.button-row,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button,
.result-actions a {
  padding: 8px 13px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
}

button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  border-color: #bdc8d3;
  background: #cdd6df;
  cursor: not-allowed;
}

#cancelBtn {
  border-color: var(--danger);
  background: var(--danger);
}

#clearBtn {
  border-color: var(--line);
  background: #edf2f5;
  color: var(--text);
}

.summary {
  display: grid;
  align-content: start;
  gap: 16px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.summary-grid div {
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  overflow: hidden;
}

.summary-grid span,
.summary-grid strong {
  display: block;
}

.summary-grid strong {
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.result-actions a {
  border: 1px solid var(--accent);
  color: var(--accent-dark);
}

.result-actions a[aria-disabled="true"] {
  border-color: var(--line);
  color: var(--muted);
  pointer-events: none;
}

.console-panel {
  margin-top: 16px;
  padding: 0;
  overflow: hidden;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.console-header label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.console-header input {
  width: 16px;
  min-height: 16px;
}

#console {
  height: min(46vh, 520px);
  min-height: 280px;
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  background: var(--console-bg);
  color: var(--console-text);
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 20px, 720px);
    padding: 14px 0;
  }

  .toolbar,
  .layout,
  .field-row,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    display: grid;
  }
}
