:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --ink: #1b1f23;
  --muted: #69717d;
  --line: #d8dde3;
  --brand: #116a72;
  --brand-strong: #0a4f55;
  --accent: #d86f45;
  --danger: #b3261e;
  --ok: #1d7f48;
  --shadow: 0 18px 42px rgba(30, 42, 58, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--brand-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary {
  background: #e7ecef;
  color: var(--ink);
}

.secondary:hover {
  background: #d9e2e6;
}

.icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  background: #eef2f4;
  color: var(--ink);
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

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

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

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
}

h2 {
  font-size: 22px;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 12px;
  color: var(--muted);
  background: #f9fafb;
  font-size: 14px;
  font-weight: 700;
}

.status-pill.ok {
  border-color: rgba(29, 127, 72, 0.25);
  color: var(--ok);
  background: rgba(29, 127, 72, 0.08);
}

.login-panel {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 420px);
  gap: 24px;
  padding: 24px;
}

.login-panel p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.login-form {
  align-self: end;
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.inline-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input {
  min-height: 40px;
  padding: 0 12px;
}

textarea {
  min-height: 560px;
  resize: vertical;
  padding: 16px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.65;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(17, 106, 114, 0.14);
}

.workspace {
  padding: 20px;
}

.is-hidden {
  display: none !important;
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
}

.editor-pane,
.side-pane {
  min-width: 0;
}

.side-pane {
  display: grid;
  align-content: start;
  gap: 14px;
}

.summary,
.hint,
.validation,
.runs {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
}

.summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.summary-value {
  color: var(--accent);
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
}

.summary-label {
  color: var(--muted);
  font-weight: 700;
}

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

.hint code {
  display: block;
  overflow-wrap: anywhere;
  border-radius: 6px;
  background: #eef2f4;
  padding: 8px;
  color: #27313b;
  font-size: 13px;
}

.runs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.runs-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.validation-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.validation-item {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.validation-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.validation-item strong {
  overflow-wrap: anywhere;
  color: var(--ink);
}

.validation-item.error strong {
  color: var(--danger);
}

.validation-item.ok strong {
  color: var(--ok);
}

.validation-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.run-item {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.run-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.run-item a {
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
}

.run-meta {
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100% - 36px));
  border-radius: 8px;
  background: #1f2933;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transform: translateY(140%);
  transition: transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
}

.toast.error {
  background: var(--danger);
}

@media (max-width: 820px) {
  .topbar,
  .editor-header,
  .login-panel {
    display: grid;
  }

  .login-panel,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    justify-content: stretch;
  }

  .toolbar button {
    flex: 1 1 140px;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
  }

  .topbar,
  .login-panel,
  .workspace {
    padding: 14px;
  }

  .inline-control {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 430px;
  }
}
