:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4f;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --ok: #22c55e;
  --err: #ef4444;
  --warn: #f59e0b;
  --radius: 10px;
  --font: system-ui, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(ellipse at top, #1a2744 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.5;
}

.page {
  max-width: 620px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 650;
}

.header--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.btn--small {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.btn--block {
  width: 100%;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-page {
  width: 100%;
  max-width: 400px;
  padding: 1.5rem;
}

.login-card {
  margin-top: 0;
}

.login-title {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  font-weight: 650;
  text-align: center;
}

.login-subtitle {
  margin: 0 0 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-form {
  margin: 0;
}

.login-form .field:last-of-type {
  margin-bottom: 1.25rem;
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.password-wrap input {
  flex: 1;
  padding-right: 4.25rem;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.password-toggle {
  flex-shrink: 0;
  padding: 0 0.85rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.password-toggle:hover {
  color: var(--text);
  background: var(--bg);
}

.password-wrap input:focus {
  box-shadow: none;
}

.password-wrap:focus-within input {
  border-color: var(--accent);
}

.password-wrap:focus-within .password-toggle {
  border-color: var(--accent);
}

.password-wrap:focus-within {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  border-radius: 8px;
}

.login-error {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.88rem;
  color: var(--err);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 6px;
}

.login-error.hidden {
  display: none;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.subtitle code {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #a8c4f0;
}

.card {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.field span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input:not([type="checkbox"]):not([type="radio"]),
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="number"],
textarea,
select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.85rem;
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text);
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  appearance: none;
  -webkit-appearance: none;
}

.field input:not([type="checkbox"]):not([type="radio"])::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

/* Browser autofill on dark theme */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  box-shadow: 0 0 0 1000px var(--bg) inset;
  border: 1px solid var(--border);
  transition: background-color 99999s ease-out;
}

.field input:focus,
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

textarea {
  resize: vertical;
  min-height: 4rem;
  font-family: var(--mono);
  font-size: 0.95rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 0.5rem;
}

.field--grow {
  flex: 1;
  min-width: 140px;
  margin-bottom: 0;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  accent-color: var(--accent);
}

.actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.btn {
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  flex: 1;
  color: #fff;
  background: var(--accent);
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn--secondary {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--bg);
}

.card--result.hidden {
  display: none;
}

.result-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 650;
}

.result-title.ok {
  color: var(--ok);
}

.result-title.err {
  color: var(--err);
}

.result-title.warn {
  color: var(--warn);
}

.result-dl {
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.result-row dt {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.result-row dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.88rem;
  word-break: break-all;
}

.result-meta {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.command-fieldset {
  margin: 0 0 1rem;
  padding: 0;
  border: none;
}

.field-label,
.command-fieldset legend {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0;
  margin-bottom: 0.5rem;
}

.radio-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.radio-item {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.65rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.radio-item:has(input:checked) {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
}

.radio-item input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.radio-item__body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.radio-item__label {
  font-weight: 600;
  font-size: 0.95rem;
}

.radio-item__cmd {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #a8c4f0;
}

.radio-item__desc {
  font-size: 0.8rem;
  color: var(--muted);
}

.field--custom {
  margin-top: 0.75rem;
}

.field--custom input[type="text"] {
  font-family: var(--mono);
  font-size: 0.95rem;
}

.field--custom.hidden {
  display: none;
}

.selected-preview {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.selected-preview code {
  font-family: var(--mono);
  color: var(--text);
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.card--history.hidden {
  display: none;
}

.history-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 650;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border-radius: 6px;
  border-left: 3px solid var(--border);
  font-size: 0.85rem;
}

.history-item--ok {
  border-left-color: var(--ok);
}

.history-item--err {
  border-left-color: var(--err);
}

.history-item__time {
  font-size: 0.75rem;
  color: var(--muted);
}

.history-item__main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: baseline;
}

.history-item__main code {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #a8c4f0;
}

.history-item__meta {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  word-break: break-all;
}
