:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #202420;
  --muted: #667064;
  --line: #d9ded6;
  --terminal: #151713;
  --terminal-ink: #d7f8cb;
  --accent: #20724f;
  --accent-strong: #135f40;
  --warning: #a76805;
  --danger: #a83232;
  --shadow: 0 18px 40px rgba(22, 30, 18, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(32, 114, 79, 0.08), transparent 280px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 18px;
}

.eyebrow,
.meta,
label {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  margin-top: 4px;
  font-size: 1.9rem;
  line-height: 1.15;
}

h2 {
  font-size: 1rem;
  line-height: 1.3;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
}

.badge.ok {
  border-color: rgba(32, 114, 79, 0.25);
  color: var(--accent-strong);
}

.badge.warn {
  border-color: rgba(167, 104, 5, 0.28);
  color: var(--warning);
}

.badge.error {
  border-color: rgba(168, 50, 50, 0.28);
  color: var(--danger);
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto 36px;
}

.layout.locked {
  grid-template-columns: minmax(280px, 360px);
  justify-content: center;
}

.layout.locked .viewer {
  display: none;
}

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

.auth-panel {
  align-self: start;
  padding: 18px;
}

.password-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

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

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fbfcfa;
  color: var(--ink);
}

input:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(32, 114, 79, 0.22);
  outline-offset: 2px;
}

button {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
}

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

button.secondary {
  border-color: var(--line);
  background: #f8faf7;
  color: var(--ink);
}

button.secondary:hover {
  background: #eef2ec;
}

.viewer {
  min-width: 0;
  overflow: hidden;
}

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

.viewer-head h2 {
  margin-bottom: 6px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.terminal {
  min-height: 560px;
  max-height: 70vh;
  margin: 0;
  overflow: auto;
  padding: 18px;
  background: var(--terminal);
  color: var(--terminal-ink);
  font-family:
    "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

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

  .viewer-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    width: 100%;
    justify-content: stretch;
  }

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

  .terminal {
    min-height: 420px;
  }
}
