:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: rgba(15, 28, 48, 0.88);
  --panel-strong: #102039;
  --text: #edf5ff;
  --muted: #91a4bd;
  --line: rgba(145, 164, 189, 0.22);
  --primary: #42d392;
  --primary-dark: #13a96a;
  --danger: #ff6b6b;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(66, 211, 146, 0.18), transparent 28rem),
    radial-gradient(circle at 86% 10%, rgba(80, 149, 255, 0.2), transparent 24rem),
    linear-gradient(135deg, #050b14 0%, var(--bg) 54%, #0d1729 100%);
}

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

button {
  border: 0;
  border-radius: 12px;
  padding: 0.78rem 1rem;
  cursor: pointer;
  color: var(--text);
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.82rem 0.9rem;
  color: var(--text);
  background: rgba(4, 11, 21, 0.68);
  outline: none;
}

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

input:focus,
textarea:focus {
  border-color: rgba(66, 211, 146, 0.8);
  box-shadow: 0 0 0 4px rgba(66, 211, 146, 0.12);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0.85rem;
  font-size: clamp(2.25rem, 4.8vw, 4.6rem);
  letter-spacing: -0.075em;
  line-height: 0.96;
}

h2 {
  margin-bottom: 1.1rem;
  font-size: 1.1rem;
}

h3 {
  margin: 0 0 0.8rem;
  font-size: 0.95rem;
}

.shell {
  width: min(1320px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.eyebrow {
  margin-bottom: 1rem;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.subtle {
  color: var(--muted);
}

.small {
  font-size: 0.88rem;
}

.panel,
.status-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel {
  padding: 1.35rem;
}

.status-card {
  min-width: 220px;
  padding: 1rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.narrow {
  max-width: 440px;
}

.stack {
  display: grid;
  gap: 1rem;
}

.stack label {
  display: grid;
  gap: 0.45rem;
}

.panel-head,
.actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.panel-head {
  justify-content: space-between;
}

.panel-head h2 {
  margin-bottom: 0;
}

.actions {
  flex-wrap: wrap;
}

.panel-intro {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

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

.config-panel .stack {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.config-panel .stack > label:nth-of-type(4),
.config-panel .stack > .toggle,
.config-panel .actions,
.config-panel #tokenMask {
  grid-column: 1 / -1;
}

.account-panel {
  padding: 1.5rem;
}

.account-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px minmax(260px, 0.8fr) auto;
  align-items: end;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.account-form label {
  display: grid;
  gap: 0.45rem;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.account-options {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.1rem;
  background: rgba(255, 255, 255, 0.035);
}

.account-options .toggle {
  margin-top: 0.85rem;
}

.option-grid label {
  display: grid;
  gap: 0.45rem;
}

.primary {
  color: #04120d;
  background: linear-gradient(135deg, var(--primary), #9fffc7);
  font-weight: 800;
}

.secondary {
  background: rgba(66, 211, 146, 0.14);
  border: 1px solid rgba(66, 211, 146, 0.26);
}

.ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.toggle {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.toggle input {
  width: auto;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  color: #04120d;
  background: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
}

.badge.off {
  color: var(--text);
  background: rgba(255, 255, 255, 0.11);
}

.account-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.7rem;
  margin-top: 1.1rem;
}

.account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem;
  background: rgba(255, 255, 255, 0.045);
}

.account-item button {
  padding: 0.45rem 0.65rem;
  background: rgba(255, 255, 255, 0.08);
}

.account-actions {
  display: inline-flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.account-summary {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 0.5rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 10px;
  background: #91a4bd;
  box-shadow: 0 0 0 4px rgba(145, 164, 189, 0.12);
}

.status-dot.ok {
  background: #42d392;
  box-shadow: 0 0 0 4px rgba(66, 211, 146, 0.14);
}

.status-dot.error {
  background: #ff6b6b;
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.14);
}

.account-item [data-delete] {
  color: #ffd7d7;
  background: rgba(255, 107, 107, 0.14);
}

.logs {
  display: grid;
  gap: 0.6rem;
  max-height: 360px;
  overflow: auto;
}

.log-item,
.message {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.045);
}

.log-item.error,
.message.error {
  border-color: rgba(255, 107, 107, 0.45);
}

.message {
  margin-bottom: 1rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 1rem, 1120px);
    padding: 1rem 0;
  }

  .hero,
  .workspace,
  .config-panel .stack,
  .account-form,
  .option-grid {
    grid-template-columns: 1fr;
  }

  .status-card {
    min-width: 0;
  }

  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .actions button {
    width: 100%;
  }
}
