:root {
  --bg: #0f1412;
  --bg-2: #161c19;
  --panel: #1a221e;
  --line: #2a3830;
  --text: #e7efe9;
  --muted: #8fa398;
  --accent: #3dba7a;
  --accent-dim: #2a8f5c;
  --danger: #e06b6b;
  --warn: #d4a24c;
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(61, 186, 122, 0.18), transparent 60%),
    radial-gradient(700px 400px at 90% 0%, rgba(80, 140, 120, 0.12), transparent 55%),
    linear-gradient(rgba(42, 56, 48, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 56, 48, 0.35) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  mask-image: linear-gradient(to bottom, black 0%, black 70%, transparent 100%);
  z-index: 0;
}

.top, .layout, .foot {
  position: relative;
  z-index: 1;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  background: rgba(15, 20, 18, 0.7);
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.brand .mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background:
    linear-gradient(145deg, var(--accent), #1f6b45 55%, #143528);
  box-shadow: 0 0 0 1px rgba(61, 186, 122, 0.35);
}

.brand strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand p {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.status {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
}

.status.ok { color: var(--accent); border-color: rgba(61, 186, 122, 0.35); }
.status.bad { color: var(--danger); border-color: rgba(224, 107, 107, 0.4); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  gap: 1.25rem;
  padding: 1.5rem 1.75rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.panel {
  background: linear-gradient(180deg, rgba(26, 34, 30, 0.95), rgba(22, 28, 25, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem 1.4rem;
}

.compose h1 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.lead {
  margin: 0 0 1.25rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 48ch;
}

.lead.small {
  font-size: 0.88rem;
  margin-bottom: 0.85rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.95rem;
  font-size: 0.86rem;
  font-weight: 500;
  color: #c5d4cb;
}

.hint {
  font-weight: 400;
  color: var(--muted);
}

input, textarea {
  font: inherit;
  color: var(--text);
  background: #101612;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  resize: vertical;
  min-height: 220px;
  line-height: 1.55;
  font-size: 0.95rem;
}

input:focus, textarea:focus {
  border-color: rgba(61, 186, 122, 0.55);
  box-shadow: 0 0 0 3px rgba(61, 186, 122, 0.12);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.meta {
  color: var(--muted);
  font-size: 0.82rem;
  font-family: var(--mono);
}

button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1.1rem;
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  color: #06140d;
  transition: transform 0.12s, filter 0.12s, opacity 0.12s;
}

button:hover { filter: brightness(1.05); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: wait; }

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

button.ghost:hover {
  border-color: rgba(61, 186, 122, 0.45);
  filter: none;
}

button.tiny {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
}

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(224, 107, 107, 0.35);
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.keys h2, .try h2, .docs h2 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
}

.docs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.docs-head h2 { margin: 0; }

.doc-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 360px;
  overflow: auto;
}

.doc {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.8rem;
  background: #121815;
}

.doc header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
}

.doc strong {
  font-size: 0.92rem;
}

.doc .preview {
  margin: 0.45rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.doc .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--mono);
}

.empty {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.25rem 0;
}

.toast {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  font-size: 0.88rem;
  border: 1px solid var(--line);
  background: #121815;
}

.toast.ok {
  border-color: rgba(61, 186, 122, 0.4);
  color: #b7ebcf;
}

.toast.err {
  border-color: rgba(224, 107, 107, 0.45);
  color: #f0b4b4;
}

.code {
  margin: 0.85rem 0 0;
  padding: 0.75rem;
  border-radius: 10px;
  background: #0c100e;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
  color: #c8d9ce;
}

.foot {
  text-align: center;
  padding: 0 1rem 2rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.foot code {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: #b7cfc2;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .top {
    padding: 1rem;
  }
}

.top-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-chip {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wrap {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100% - 2rem));
}

.login-card {
  padding: 1.6rem 1.5rem 1.5rem;
}

.login-brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  margin-bottom: 1.4rem;
}

.login-brand strong {
  display: block;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.login-brand p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.login-card button[type="submit"] {
  width: 100%;
  margin-top: 0.25rem;
}

.login-error {
  margin: 0.85rem 0 0;
  color: #f0b4b4;
  font-size: 0.88rem;
}
