* { box-sizing: border-box; margin: 0; }

/* --- Integrations grid (Viktor-style) --- */
.int-label { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.int-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--card);
  display: flex; align-items: center; gap: 14px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.int-card:hover { border-color: var(--rust); box-shadow: 0 2px 10px rgba(26, 22, 18, 0.05); }
.int-card.is-connected { cursor: default; }
.int-card.is-connected:hover { border-color: var(--line); box-shadow: none; }
.int-img { width: 36px; height: 36px; border-radius: 8px; flex: none; object-fit: contain; background: #fff; }
.int-img-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-warm); color: var(--ink-mid); font-weight: 600; font-size: 16px;
}
.int-name { font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.int-connected { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--success); margin-top: 2px; }
.int-connected .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }

:root {
  --bg: #f7f3ee;
  --bg-warm: #efe9e0;
  --bg-dark: #1e1a17;
  --card: #fffdf9;
  --ink: #1a1612;
  --ink-mid: #4a4540;
  --muted: #8a837a;
  --line: rgba(26, 22, 18, 0.1);
  --rust: #c04f28;
  --rust-dark: #a8401e;
  --rust-light: #e87a52;
  --rust-pale: #f5ddd5;
  --rust-dim: rgba(192, 79, 40, 0.12);
  --success: #2e8c46;
  --warn: #b07714;
  --danger: #a8401e;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

body {
  font-family: 'Epilogue', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

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

.shell { max-width: 1080px; margin: 0 auto; padding: 24px; }

.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.brand .dot { color: var(--rust); }

/* --- Landing --- */
.hero { display: flex; gap: 48px; align-items: center; min-height: 85vh; flex-wrap: wrap; }
.hero-copy { flex: 1 1 380px; }
.hero-copy h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 44px;
  line-height: 1.12;
  margin-bottom: 16px;
}
.hero-copy .kicker {
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--rust); font-weight: 600; margin-bottom: 14px;
}
.hero-copy p { color: var(--ink-mid); max-width: 48ch; margin-bottom: 10px; font-size: 16px; }
.hero-copy ul { color: var(--ink-mid); margin: 16px 0 0 18px; }
.hero-copy li { margin-bottom: 7px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px;
  box-shadow: 0 1px 2px rgba(26, 22, 18, 0.04);
}
.auth-card { flex: 0 1 400px; }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tabs button {
  flex: 1; padding: 9px; border: 1px solid var(--line); background: transparent;
  border-radius: 8px; font-size: 14px; cursor: pointer; color: var(--muted);
  font-family: inherit;
}
.tabs button.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

label { display: block; font-size: 13px; color: var(--ink-mid); margin: 12px 0 4px; font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; background: #fff; font-family: inherit; color: var(--ink);
}
input::placeholder { color: var(--muted); }
input:focus { outline: 2px solid var(--rust); outline-offset: -1px; border-color: transparent; }

.btn {
  display: inline-block; width: 100%; margin-top: 18px; padding: 12px; border: 0;
  border-radius: 8px; background: var(--rust); color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn:hover { background: var(--rust-dark); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.secondary {
  background: transparent; color: var(--danger); border: 1px solid var(--line);
  width: auto; padding: 8px 14px; font-size: 13px; font-weight: 500;
}
.btn.secondary:hover { background: var(--rust-dim); }

.error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }
.fineprint { font-size: 12px; color: var(--muted); margin-top: 14px; }

/* --- Dashboard --- */
header.bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 24px;
}
.bar .who { font-size: 13px; color: var(--muted); }
.bar button {
  background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 12px; cursor: pointer; font-size: 13px; font-family: inherit; color: var(--ink-mid);
}

.grid { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
@media (max-width: 880px) { .grid { grid-template-columns: 1fr; } }

.card h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; margin-bottom: 14px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500;
  padding: 4px 12px; border-radius: 999px; background: var(--bg-warm); color: var(--muted);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.working { color: var(--warn); background: #f5ecdc; }
.pill.working .dot { animation: pulse 1.2s ease-in-out infinite; }
.pill.ready { color: var(--success); background: #e6f0e6; }
.pill.error, .pill.terminated { color: var(--danger); background: var(--rust-pale); }
@keyframes pulse { 50% { opacity: 0.3; } }

.steps { list-style: none; margin: 18px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.steps .tick {
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex: none;
}
.steps li.done { color: var(--ink); }
.steps li.done .tick { background: var(--success); border-color: var(--success); color: #fff; }
.steps li.current { color: var(--ink); font-weight: 500; }
.steps li.current .tick {
  border-color: var(--line); border-top-color: var(--rust);
  color: transparent; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.kv { font-size: 13px; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.kv div { display: flex; justify-content: space-between; padding: 3px 0; }
.kv dt { color: var(--muted); }
.kv dd { font-family: var(--mono); font-size: 12px; color: var(--ink-mid); }

.log {
  margin-top: 16px; background: var(--bg-dark); color: #cfc4b8; border-radius: 10px;
  padding: 12px 14px; font-family: var(--mono); font-size: 11.5px; line-height: 1.7;
  max-height: 220px; overflow-y: auto;
}
.log .ts { color: #877d71; margin-right: 8px; }

/* --- Chat --- */
.chat { display: flex; flex-direction: column; height: 640px; }
.chat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.chat-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 12px; font-size: 14.5px; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--rust); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--bg-warm); border-bottom-left-radius: 4px; }
.msg.typing { color: var(--muted); font-style: italic; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); font-size: 14px; max-width: 40ch; }

.composer { display: flex; gap: 10px; margin-top: 14px; }
.composer input { flex: 1; }
.composer button {
  padding: 0 20px; border: 0; border-radius: 8px; background: var(--ink); color: var(--bg);
  font-size: 14px; cursor: pointer; font-family: inherit; font-weight: 500;
}
.composer button:disabled { opacity: 0.5; cursor: default; }

.suggestions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.suggestions button {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; color: var(--ink-mid); cursor: pointer; font-family: inherit;
}
.suggestions button:hover { border-color: var(--rust); color: var(--rust); }

.banner { font-size: 13px; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.banner.info { background: var(--rust-dim); color: var(--rust-dark); }
.banner.danger { background: var(--rust-pale); color: var(--danger); }
.hidden { display: none !important; }

/* --- Split landing (Viktor-style) --- */
.split { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } .split-left { min-height: 42vh; } }

.split-left {
  position: relative; padding: 40px; display: flex; flex-direction: column;
  background:
    radial-gradient(120% 75% at 50% -10%, #eaa17c 0%, #c04f28 34%, #7a2f18 66%, #2a1a12 100%);
  color: #fbf3ec;
}
.split-left .brand { color: #fbf3ec; }
.split-left .brand .dot { color: #f5d9c8; }

.quote-card {
  margin: auto; max-width: 420px; width: 100%;
  background: rgba(255, 253, 249, 0.92);
  border-radius: 18px; padding: 28px;
  box-shadow: 0 20px 60px rgba(42, 26, 18, 0.35);
}
.quote-card p { font-family: var(--serif); font-size: 22px; line-height: 1.32; color: var(--ink); margin-bottom: 22px; }
.quote-card .attr { display: flex; align-items: center; gap: 12px; }
.quote-card .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--rust); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 700; }
.quote-card .attr-name { font-size: 14px; font-weight: 500; color: var(--ink); }
.quote-card .attr-role { font-size: 12.5px; color: var(--muted); }

.dots { display: flex; gap: 7px; justify-content: center; margin-top: 22px; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(251, 243, 236, 0.4); }
.dots span.on { background: #fbf3ec; width: 22px; border-radius: 4px; }

.worksrow { text-align: center; }
.worksrow .lbl { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.7; margin-bottom: 12px; }
.worksrow .names { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; font-family: var(--serif); font-size: 19px; font-weight: 600; opacity: 0.92; }

.split-right { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.auth-col { width: 100%; max-width: 400px; }
.auth-col h1 { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.15; text-align: center; margin-bottom: 24px; }

.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 13px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font-family: inherit; font-size: 15px; font-weight: 500; color: var(--ink);
  cursor: pointer; text-decoration: none;
}
.oauth-btn:hover { border-color: var(--rust); }
.oauth-btn svg { width: 20px; height: 20px; flex: none; }

.muted-link { display: block; text-align: center; color: var(--muted); font-size: 13.5px; margin: 8px 0; }
.trustline { text-align: center; font-size: 12.5px; color: var(--muted); margin: 18px 0; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
details.email-fold summary { list-style: none; cursor: pointer; text-align: center; color: var(--rust); font-size: 13.5px; }
details.email-fold summary::-webkit-details-marker { display: none; }
details.email-fold[open] summary { margin-bottom: 12px; }
