:root {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #111827;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  background: radial-gradient(circle at 10% -10%, #1e293b 0%, var(--bg) 45%);
  color: var(--text);
}

.layout {
  max-width: 980px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.panel {
  border: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.9);
  border-radius: 14px;
  padding: 1rem;
}

.header {
  display: grid;
  gap: 0.5rem;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.hidden {
  display: none;
}

h1,
h2,
h3 {
  margin: 0 0 0.5rem;
}

.subtitle,
.meta {
  margin: 0;
  color: var(--muted);
}

.actions,
.pairing-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.task-toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}

.auth-grid {
  display: grid;
  grid-template-columns: 180px minmax(220px, 1fr) auto auto auto;
  gap: 0.5rem;
  align-items: end;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.inline-field {
  display: grid;
  gap: 0.25rem;
  margin: 0;
}

.inline-field.checkbox {
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0b1220;
  padding: 0.55rem 0.7rem;
}

.inline-field span {
  color: var(--muted);
  font-size: 0.9rem;
}

.inline-field.credential {
  min-width: 0;
}

.inline-field.checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
}

input,
textarea,
select,
button {
  font: inherit;
  color: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0b1220;
  padding: 0.55rem 0.7rem;
}

label {
  display: block;
  margin: 0.6rem 0 0.3rem;
  color: var(--muted);
}

button {
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: #052e16;
  font-weight: 700;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

button.danger {
  background: var(--danger);
  color: #fff;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cards {
  display: grid;
  gap: 0.6rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem;
  background: #0b1220;
}

.card .title {
  font-weight: 700;
}

.card.selected {
  border-color: var(--accent);
}

.card .detail {
  color: var(--muted);
  font-size: 0.9rem;
}

.card .detail.error {
  color: var(--danger);
}

.card .row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.json {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #020617;
  padding: 0.75rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.88rem;
}

details {
  margin-top: 0.6rem;
}

summary {
  cursor: pointer;
  color: var(--muted);
}

code {
  font-family: "IBM Plex Mono", monospace;
}

.warnings {
  border-color: var(--warn);
}

.task-actions {
  display: grid;
  gap: 0.5rem;
}

.task-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.task-policy-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

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

.success {
  color: #4ade80;
}

.warning {
  color: var(--warn);
}

@media (max-width: 860px) {
  .auth-grid {
    grid-template-columns: 1fr 1fr;
  }

  .settings-grid,
  .task-policy-grid {
    grid-template-columns: 1fr;
  }
}
