:root {
  --bg: #0b0e14;
  --panel: #131824;
  --panel2: #1a2130;
  --text: #e8ecf4;
  --muted: #8b95a7;
  --accent: #4f8cff;
  --accent2: #7c5cff;
  --ok: #34c98e;
  --warn: #ffb020;
  --err: #ff5c6c;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1060px; margin: 0 auto; padding: 0 20px; }

/* header */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; border-bottom: 1px solid #1f2635;
}
.logo { font-size: 20px; font-weight: 800; letter-spacing: .3px; }
.logo span { color: var(--accent); }
.header nav a { margin-left: 18px; color: var(--muted); font-size: 14px; }
.header nav a:hover { color: var(--text); text-decoration: none; }

/* hero */
.hero { text-align: center; padding: 84px 0 56px; }
.hero .badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: rgba(79,140,255,.12); color: var(--accent);
  font-size: 13px; font-weight: 600; margin-bottom: 22px;
}
.hero h1 { font-size: 46px; line-height: 1.15; letter-spacing: -1px; margin-bottom: 18px; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.sub { color: var(--muted); font-size: 18px; max-width: 620px; margin: 0 auto 34px; }
.btn {
  display: inline-block; border: none; cursor: pointer; border-radius: 12px;
  padding: 14px 30px; font-size: 16px; font-weight: 700; color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(79,140,255,.35); text-decoration: none; }
.btn.secondary { background: var(--panel2); color: var(--text); border: 1px solid #2a3347; }
.btn.small { padding: 9px 16px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }

/* steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding: 34px 0 10px; }
.step {
  background: var(--panel); border: 1px solid #20293c; border-radius: var(--radius);
  padding: 26px 22px;
}
.step .num {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: rgba(79,140,255,.14); color: var(--accent); font-weight: 800; margin-bottom: 14px;
}
.step h3 { font-size: 17px; margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 14px; }

/* pricing */
.pricing { text-align: center; padding: 64px 0 30px; }
.pricing h2 { font-size: 30px; margin-bottom: 26px; }
.price-card {
  display: inline-block; background: var(--panel); border: 1px solid #26304a;
  border-radius: 20px; padding: 36px 48px; min-width: 320px;
}
.price-card .amount { font-size: 52px; font-weight: 800; }
.price-card .per { color: var(--muted); margin-bottom: 22px; }
.price-card ul { list-style: none; text-align: left; margin: 0 auto 26px; max-width: 280px; }
.price-card li { padding: 6px 0 6px 28px; position: relative; color: var(--muted); font-size: 14px; }
.price-card li::before { content: '✓'; position: absolute; left: 4px; color: var(--ok); font-weight: 700; }

.footer { color: var(--muted); font-size: 13px; text-align: center; padding: 44px 0 30px; border-top: 1px solid #1f2635; margin-top: 40px; }

/* auth */
.auth-box {
  max-width: 400px; margin: 60px auto; background: var(--panel);
  border: 1px solid #20293c; border-radius: var(--radius); padding: 34px 30px;
}
.auth-box h2 { margin-bottom: 6px; }
.auth-box .hint { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid #2a3347;
  background: var(--panel2); color: var(--text); font-size: 15px; outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.form-error { color: var(--err); font-size: 14px; margin: 8px 0; min-height: 20px; }
.auth-switch { margin-top: 18px; font-size: 14px; color: var(--muted); text-align: center; }

/* dashboard */
.dash { display: grid; grid-template-columns: 230px 1fr; gap: 24px; padding: 30px 0 60px; }
.side { background: var(--panel); border: 1px solid #20293c; border-radius: var(--radius); padding: 14px; height: fit-content; position: sticky; top: 20px; }
.side a {
  display: block; padding: 10px 14px; border-radius: 10px; color: var(--muted);
  font-size: 14px; margin-bottom: 2px;
}
.side a:hover { background: var(--panel2); text-decoration: none; color: var(--text); }
.side a.active { background: rgba(79,140,255,.14); color: var(--accent); font-weight: 600; }
.card {
  background: var(--panel); border: 1px solid #20293c; border-radius: var(--radius);
  padding: 26px 26px; margin-bottom: 20px;
}
.card h3 { font-size: 18px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.pill.ok { background: rgba(52,201,142,.15); color: var(--ok); }
.pill.warn { background: rgba(255,176,32,.15); color: var(--warn); }
.card p.desc { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.status-list { list-style: none; margin: 6px 0 0; }
.status-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #1c2436; font-size: 14px; }
.status-list li:last-child { border-bottom: none; }

/* chat */
.chat { border: 1px solid #2a3347; border-radius: 12px; background: var(--panel2); padding: 16px; height: 380px; overflow-y: auto; margin-bottom: 14px; }
.msg { margin-bottom: 12px; max-width: 85%; padding: 10px 14px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; }
.msg.user { background: rgba(79,140,255,.16); margin-left: auto; border-bottom-right-radius: 4px; }
.msg.assistant { background: #232c40; border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 10px; }
.chat-input input { flex: 1; padding: 12px 14px; border-radius: 10px; border: 1px solid #2a3347; background: var(--panel2); color: var(--text); font-size: 15px; outline: none; }
textarea.template-area { width: 100%; min-height: 140px; padding: 12px 14px; border-radius: 10px; border: 1px solid #2a3347; background: var(--panel2); color: var(--text); font-size: 14px; outline: none; font-family: inherit; }

/* digests */
.digest-item { border: 1px solid #232c40; border-radius: 12px; padding: 18px; margin-bottom: 14px; background: var(--panel2); }
.digest-item h4 { font-size: 16px; margin-bottom: 6px; }
.digest-item .meta { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.digest-item .body { font-size: 14px; white-space: pre-wrap; }
.digest-item .body b { color: var(--text); }
.digest-item details { margin-top: 8px; font-size: 13px; }
.digest-item summary { cursor: pointer; color: var(--accent); }

/* archive */
.hist-bar { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav b { min-width: 130px; text-align: center; font-size: 15px; }
.month-nav .btn { padding: 8px 14px; line-height: 1; }
.hist-dates { display: flex; align-items: center; gap: 6px; }
.hist-dates .dash { color: var(--muted); }
.hist-dates input { padding: 9px 10px; border-radius: 10px; border: 1px solid #2a3347; background: var(--panel2); color: var(--text); font-size: 13px; outline: none; color-scheme: dark; }
#q { flex: 1; min-width: 200px; padding: 10px 14px; border-radius: 10px; border: 1px solid #2a3347; background: var(--panel2); color: var(--text); font-size: 14px; outline: none; }
#expandall { font-size: 13px; color: var(--accent); }
.accept-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); margin: 4px 0 14px; cursor: pointer; }
.accept-row input { margin-top: 2px; }
.accept-row a { color: var(--accent); }
.footer a { color: var(--accent); text-decoration: none; }
.hist-day { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 18px 0 10px; }
.digest-head { cursor: pointer; user-select: none; }
.digest-head:hover h4 { color: var(--accent); }
.digest-item .body[hidden] { display: none; }
.digest-act { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px dashed #2a3347; }
.regen-out { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--panel2); border: 1px solid #2a3347; }
.regen-out[hidden] { display: none; }

/* триал-бар над контентом кабинета */
.trialbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 18px; margin-bottom: 16px; border-radius: 12px; border: 1px solid var(--accent); background: rgba(124,108,255,.10); font-size: 14px; }
.trialbar.warn { border-color: #e05656; background: rgba(224,86,86,.10); }
.dash-main { min-width: 0; flex: 1; }

/* подгрузка старых записей из Fathom */
.cloud-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; border: 1px solid #232c40; border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; background: var(--panel2); }
.cloud-item .cloud-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cloud-item .cloud-meta b { font-size: 14px; }
.cloud-item .cloud-meta .desc { font-size: 12px; margin: 0; }
.cloud-item .btn { flex-shrink: 0; }

/* onboarding */
.onboard { border-color: var(--accent); }
.onboard-steps { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.onboard-step { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--panel2); border: 1px solid #2a3347; text-decoration: none; transition: border-color .15s; }
.onboard-step:hover { border-color: var(--accent); }
.onboard-step.done { opacity: .55; }
.onboard-step .os-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.onboard-step.done .os-num { background: var(--ok); }
.onboard-step .os-label { font-size: 14.5px; font-weight: 600; color: var(--text); }
.onboard-step .os-hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.onboard h3 { position: relative; padding-right: 30px; }
.onboard-close { position: absolute; right: 0; top: 0; background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 6px; }
.onboard-close:hover { color: var(--text); }
a.pill.warn { text-decoration: none; cursor: pointer; }

/* dashboard header + stats */
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.dash-head h2 { font-size: 24px; }
.dash-sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel2); border: 1px solid #2a3347; border-radius: 14px; padding: 16px 18px; }
.stat-num { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* trial progress */
.trial-box { margin: 4px 0 12px; }
.trial-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); margin-bottom: 8px; }
.progress { height: 8px; border-radius: 99px; background: #2a3347; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width .3s; }

/* last digest */
.last-digest { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ld-title { font-size: 16px; font-weight: 600; }
.ld-date { font-size: 13px; color: var(--muted); margin-top: 3px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid #2a3347; padding: 12px 22px;
  border-radius: 12px; font-size: 14px; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
.toast.err { border-color: var(--err); color: var(--err); }
.toast.ok { border-color: var(--ok); color: var(--ok); }

@media (max-width: 800px) {
  .steps { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
  .dash { grid-template-columns: 1fr; }
  .side { position: static; display: flex; overflow-x: auto; }
  .side a { white-space: nowrap; }
}

/* format presets */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 16px 0 4px; }
.preset-btn { text-align: left; background: var(--panel2); border: 1px solid #2a3347; border-radius: 12px; padding: 11px 13px; cursor: pointer; transition: border-color .15s, background .15s; font-family: inherit; }
.preset-btn:hover { border-color: var(--accent); background: rgba(79,140,255,.08); }
.preset-btn .p-emoji { font-size: 19px; }
.preset-btn .p-name { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); margin-top: 3px; }
.preset-btn .p-tag { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.preset-btn.current { border-color: var(--ok); }
