:root {
  color-scheme: light;
  --ink: #12141a;
  --muted: #5c6370;
  --line: #e6e8ee;
  --bg: #f6f7f9;
  --card: #ffffff;
  --brand: #0c0e12;
  --accent: #3dff8a;
  --danger: #9b2c2c;
  --danger-bg: #fdf2f2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--ink); }

.auth-shell {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(360px, 0.95fr);
  min-height: 100vh;
}

.brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px 72px;
  background:
    radial-gradient(900px 420px at 0% 100%, rgba(61, 255, 138, 0.16), transparent 60%),
    var(--brand);
  color: #f5f7fb;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: #06210f;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand h1 {
  margin: 48px 0 16px;
  max-width: 520px;
  font-size: clamp(2.4rem, 4vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.brand .lead {
  max-width: 460px;
  margin: 0;
  color: #c5cad3;
  font-size: 1.05rem;
  line-height: 1.6;
}

.points {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
  display: grid;
  gap: 22px;
}

.points li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 14px;
  align-items: start;
}

.points strong { display: block; margin-bottom: 4px; }
.points span { color: #b7bec8; line-height: 1.45; font-size: 0.95rem; }

.icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(61, 255, 138, 0.12);
  color: var(--accent);
  display: grid;
  place-items: center;
}

.panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--card);
}

.card { width: min(420px, 100%); }

.card h2 {
  margin: 0 0 8px;
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}

.card .intro {
  margin: 0 0 28px;
  color: var(--muted);
  line-height: 1.5;
}

label {
  display: block;
  margin: 16px 0 8px;
  font-size: 0.92rem;
  font-weight: 600;
}

input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d9dde5;
  border-radius: 10px;
  background: #fff;
  font: inherit;
}

input:focus {
  outline: 2px solid rgba(18, 20, 26, 0.15);
  border-color: #b7bec8;
}

button {
  width: 100%;
  margin-top: 22px;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.switch {
  margin: 22px 0 0;
  color: var(--muted);
  text-align: center;
}

.switch a { font-weight: 650; }

.form-error {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger);
}

.field-error {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 0.88rem;
}

.page {
  width: min(640px, calc(100% - 32px));
  margin: 48px auto;
  padding: 28px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.page h1 { margin-top: 0; letter-spacing: -0.03em; }
.page p { line-height: 1.5; color: var(--muted); }
.page strong { color: var(--ink); }
.page > form:last-child button { width: auto; background: transparent; color: var(--ink); border: 1px solid var(--line); }

.companies { list-style: none; margin: 24px 0; padding: 0; display: grid; gap: 12px; }
.companies li { padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.companies a { font-weight: 650; }
.status {
  margin-left: 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.status-ready { color: #0d7a3f; }
.status-failed { color: var(--danger); }
.hint { margin: 8px 0 0; font-size: 0.88rem; }
.company-form button { width: 100%; }

.app {
  --ink: #101828;
  --muted: #667085;
  --line: #eaecf0;
  --bg: #f5f6f8;
  --card: #ffffff;
  --accent: #175cd3;
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.side {
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.app .mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #101828;
  color: #fff;
  font-size: 12px;
}

.nav-item {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

.nav-item.is-active { background: #f2f4f7; }

.side-foot { margin-top: auto; padding: 12px 8px 4px; }
.side-email { margin: 0; font-size: 13px; font-weight: 500; word-break: break-all; }
.side-plan { margin: 2px 0 8px; color: var(--muted); font-size: 12px; text-transform: capitalize; }
.side form { margin: 0; }

.workspace { padding: 22px 28px 40px; }

.workspace-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.workspace h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.btn {
  width: auto;
  margin: 0;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: #101828;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.btn-quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat {
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.panel-block { margin-top: 16px; }

.panel-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.panel-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.empty { margin: 14px 0 0; color: var(--muted); font-size: 13px; }

.db-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.db-box {
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.db-box-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.db-box h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: #f2f4f7;
  color: #344054;
}

.pill-ready { background: #ecfdf3; color: #067647; }
.pill-creating { background: #fffaeb; color: #b54708; }
.pill-failed { background: #fef3f2; color: #b42318; }

.db-meta, .db-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.db-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.db-error {
  margin: 8px 0 0;
  color: #b42318;
  font-size: 12px;
}

.app dialog {
  width: min(400px, calc(100% - 32px));
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  color: var(--ink);
}

.app dialog::backdrop { background: rgba(16, 24, 40, 0.4); }
.app dialog h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.app dialog .intro { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.app dialog label { margin: 12px 0 6px; font-size: 12px; }
.app dialog input { padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.app dialog .hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.app .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.app .dialog-actions .btn { margin: 0; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .side-foot { margin-top: 12px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .workspace { padding: 16px; }
}

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .brand { padding: 32px 24px 28px; }
  .brand h1 { margin-top: 28px; font-size: 2.2rem; }
  .points { display: none; }
  .panel { padding: 28px 20px 48px; }
}
