/* Page foundation */
body.ssh-key-page {
  color-scheme: light;
  --ssh-background: #f4f6f8;
  --ssh-surface: #ffffff;
  --ssh-surface-subtle: #f6f8fa;
  --ssh-border: #d0d7de;
  --ssh-text: #1f2328;
  --ssh-muted: #57606a;
  --ssh-accent: #0969da;
  --ssh-accent-hover: #0757b5;
  --ssh-success: #1a7f37;
  --ssh-warning: #9a6700;
  --ssh-danger: #cf222e;
  --ssh-notice-text: #0550ae;
  --ssh-notice-background: #ddf4ff;
  --ssh-notice-border: #b6e3ff;
  --ssh-focus-ring: rgba(9, 105, 218, .28);
  --ssh-button-hover-border: #8c959f;
  --ssh-radius: 12px;
  --ssh-control-radius: 8px;
  --ssh-control-height: 40px;
  --ssh-panel-gap: 16px;
  --ssh-field-grid-gap: 14px;
  --ssh-content-width: 1180px;
  --ssh-panel-shadow: 0 14px 36px rgba(31, 35, 40, .08);
  --ssh-monospace: "Cascadia Code", Consolas, monospace;
  margin: 0;
  min-height: 100vh;
  color: var(--ssh-text);
  background: var(--ssh-background);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.ssh-tool,
.ssh-tool * {
  box-sizing: border-box;
}

.ssh-tool {
  width: min(var(--ssh-content-width), calc(100% - 40px));
  margin-inline: auto;
  padding: 40px 0;
}

/* Header and navigation */
.ssh-header {
  margin-bottom: 18px;
}

.ssh-header h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.2rem);
}

.ssh-header p,
.ssh-panel-heading__content p {
  margin: 8px 0 0;
  color: var(--ssh-muted);
  line-height: 1.7;
}

.ssh-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--ssh-muted);
  font-size: .9rem;
}

.ssh-tool a {
  color: var(--ssh-accent);
  font-weight: 700;
  text-decoration: none;
}

.ssh-tool a:hover,
.ssh-tool a:focus-visible {
  text-decoration: underline;
}

/* Panels and headings */
.ssh-notice,
.ssh-panel {
  margin-bottom: var(--ssh-panel-gap);
  border: 1px solid var(--ssh-border);
  border-radius: var(--ssh-radius);
}

.ssh-notice {
  padding: 12px 14px;
  border-color: var(--ssh-notice-border);
  color: var(--ssh-notice-text);
  background: var(--ssh-notice-background);
  line-height: 1.65;
}

.ssh-panel {
  padding: 18px;
  background: var(--ssh-surface);
  box-shadow: var(--ssh-panel-shadow);
}

.ssh-panel h2,
.ssh-panel h3 {
  margin: 0 0 14px;
}

.ssh-panel h2 {
  font-size: 1.1rem;
}

.ssh-panel h3 {
  font-size: 1rem;
}

.ssh-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.ssh-panel-heading__content h2,
.ssh-panel-heading__content p {
  margin-bottom: 0;
}

.ssh-panel-heading__status {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid var(--ssh-border);
  border-radius: 999px;
  background: var(--ssh-surface-subtle);
  font-size: .82rem;
  font-weight: 700;
}

/* Settings and controls */
.ssh-settings-grid,
.ssh-summary,
.ssh-about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ssh-settings-grid {
  gap: var(--ssh-field-grid-gap);
}

.ssh-field {
  display: grid;
  gap: 6px;
  color: var(--ssh-muted);
  font-weight: 700;
}

.ssh-field--disabled {
  opacity: .58;
}

.ssh-tool input,
.ssh-tool select,
.ssh-tool .ssh-button,
.ssh-output {
  border: 1px solid var(--ssh-border);
  border-radius: var(--ssh-control-radius);
  color: var(--ssh-text);
  background: var(--ssh-surface);
  font: inherit;
}

.ssh-tool input,
.ssh-tool select {
  width: 100%;
  min-height: var(--ssh-control-height);
  padding: 7px 10px;
}

.ssh-tool .ssh-button {
  min-height: var(--ssh-control-height);
  padding: 7px 14px;
  background: var(--ssh-surface-subtle);
  font-weight: 700;
  cursor: pointer;
}

.ssh-tool .ssh-button:hover:not(:disabled) {
  border-color: var(--ssh-button-hover-border);
}

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

.ssh-tool .ssh-button--primary:hover:not(:disabled) {
  background: var(--ssh-accent-hover);
}

.ssh-tool .ssh-button--danger {
  color: var(--ssh-danger);
}

.ssh-tool .ssh-button:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.ssh-tool input:focus-visible,
.ssh-tool select:focus-visible,
.ssh-tool .ssh-button:focus-visible,
.ssh-output:focus-visible {
  outline: 3px solid var(--ssh-focus-ring);
  outline-offset: 2px;
}

.ssh-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
}

.ssh-actions--end {
  justify-content: flex-end;
}

/* Feedback and generated key output */
.ssh-message {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--ssh-muted);
  font-size: .9rem;
  line-height: 1.55;
}

.ssh-message--success,
.ssh-verified-badge {
  color: var(--ssh-success);
}

.ssh-message--warning {
  color: var(--ssh-warning);
}

.ssh-message--error,
.ssh-status-value--error {
  color: var(--ssh-danger);
}

.ssh-summary {
  gap: 10px;
  margin: 0 0 16px;
}

.ssh-summary div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--ssh-border);
  border-radius: var(--ssh-control-radius);
  background: var(--ssh-surface-subtle);
}

.ssh-summary dt {
  color: var(--ssh-muted);
  font-size: .78rem;
}

.ssh-summary dd {
  margin: 4px 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.ssh-output {
  width: 100%;
  padding: 12px;
  resize: none;
  font: 13px/1.6 var(--ssh-monospace);
}

.ssh-output--public {
  height: 104px;
}

.ssh-output--private {
  height: 320px;
}

.ssh-private-wrap {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--ssh-border);
}

/* Supporting information */
.ssh-info-list,
.ssh-about ul,
.ssh-about ol {
  margin: 0;
  padding-left: 1.4rem;
  line-height: 1.8;
}

.ssh-about-grid {
  gap: 24px;
  margin-top: 18px;
}

.ssh-tool code {
  padding: .1em .3em;
  border-radius: 4px;
  background: var(--ssh-surface-subtle);
  font-family: var(--ssh-monospace);
}

/* Responsive layout */
@media (max-width: 760px) {
  .ssh-tool {
    width: min(100% - 24px, var(--ssh-content-width));
    padding: 24px 0;
  }

  .ssh-settings-grid,
  .ssh-summary,
  .ssh-about-grid {
    grid-template-columns: 1fr;
  }

  .ssh-panel-heading {
    display: grid;
  }

  .ssh-actions .ssh-button {
    flex: 1 1 180px;
  }
}
