:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #172026;
  --muted: #65717a;
  --line: #d8e0e5;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warn: #a15c00;
  --bad: #b42318;
  --good: #16803c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  border-color: #9fb0ba;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-strong);
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.hidden {
  display: none !important;
}

.authGate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.authBox {
  width: min(100%, 420px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.authBox h1 {
  margin-bottom: 6px;
}

.authBox > p {
  color: var(--muted);
  margin-bottom: 18px;
}

.authBox button {
  width: 100%;
}

.authStatus {
  margin: 14px 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
  color: var(--muted);
  padding: 10px;
  white-space: pre-wrap;
}

.topbar,
.panel,
.logPanel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
}

.topbar p,
.hint {
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.good {
  background: var(--good);
}

.dot.bad {
  background: var(--bad);
}

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

.panel {
  padding: 18px;
}

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

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

label {
  color: var(--muted);
  font-size: 13px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 110px;
}

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

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 14px;
}

.segmented button {
  border: 0;
  border-radius: 0;
}

.segmented .active {
  background: #e7f4f1;
  color: var(--accent-strong);
  font-weight: 650;
}

.modeNotes {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  border: 1px solid #cfe0dd;
  border-radius: 6px;
  background: #f2faf8;
  color: #314047;
  padding: 12px;
}

.modeNotes p {
  margin: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.actions button {
  flex: 1 1 138px;
}

.output,
.log {
  background: #111820;
  color: #e8f2f5;
  border-radius: 6px;
  padding: 12px;
  overflow: auto;
  min-height: 120px;
}

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

.metrics div,
.task {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px;
}

.metrics span,
.task span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

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

.tasks {
  display: grid;
  gap: 10px;
}

.task strong {
  display: block;
  margin-bottom: 8px;
}

.task code {
  overflow-wrap: anywhere;
}

.successBox {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
  border: 1px solid #b7ddc3;
  border-radius: 6px;
  background: #eefaf2;
  padding: 10px;
}

.successBox strong {
  color: var(--good);
  margin-bottom: 0;
}

.logPanel {
  margin-top: 16px;
  padding: 18px;
}

.logPanel h2 {
  margin-bottom: 10px;
}

.log {
  min-height: 150px;
  max-height: 280px;
}

.hidden {
  display: none;
}

@media (max-width: 820px) {
  .app {
    padding: 14px;
  }

  .topbar,
  .layout,
  .grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }
}
