:root {
  --bg: #0f1419;
  --surface: #171d25;
  --surface-2: #1f2731;
  --border: #2d3744;
  --text: #edf2f7;
  --muted: #9aa8b8;
  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --success: #3ecf8e;
  --danger: #ff6b6b;
  --warning: #f6c445;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(79, 140, 255, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(124, 92, 255, 0.16), transparent 24%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.1;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 58ch;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.layout {
  display: grid;
  gap: 20px;
}

.card {
  background: rgba(23, 29, 37, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.card h2,
.status-card h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.card-header p,
.status-card .status-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.status-value {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.status-card.ok .status-value { color: var(--success); }
.status-card.warn .status-value { color: var(--warning); }
.status-card.error .status-value { color: var(--danger); }

.guidance-form,
.form-row {
  display: grid;
  gap: 8px;
}

.guidance-form {
  gap: 16px;
}

label {
  font-size: 0.92rem;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 84px;
}

.button {
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

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

.button.primary {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.button.secondary {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.scope-row {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.scope-row legend {
  padding: 0;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--text);
}

.scope-row label,
.checkbox-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--muted);
}

.scope-row label {
  gap: 8px;
  font-weight: 500;
}

.checkbox-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--muted);
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.result-box,
.prompt-preview pre,
#telegram-preview {
  margin-top: 16px;
  background: #0b1015;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #d7e0ea;
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

.prompt-preview {
  margin-top: 18px;
}

.prompt-preview summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}

.ideas-list {
  display: grid;
  gap: 14px;
}

.idea-card {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 16px;
  padding: 16px;
}

.idea-card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.idea-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill.high { background: rgba(255, 107, 107, 0.16); color: #ff9b9b; }
.pill.medium { background: rgba(246, 196, 69, 0.16); color: #ffd978; }
.pill.low { background: rgba(62, 207, 142, 0.16); color: #7de9b2; }

.idea-card p {
  margin: 0 0 8px;
  color: var(--muted);
}

.idea-card ul {
  margin: 0;
  padding-left: 18px;
  color: #d7e0ea;
}

.inline-status {
  margin-top: 14px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #10161d;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  max-width: 360px;
}

.toast.ok { border-color: rgba(62, 207, 142, 0.45); }
.toast.error { border-color: rgba(255, 107, 107, 0.45); }

.api-key-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 24px;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.api-key-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.api-key-dialog input {
  width: 100%;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

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

  .header,
  .card-header {
    flex-direction: column;
  }
}
