:root {
  --bg: #f6f7fb; --card: #ffffff; --ink: #171a26; --muted: #6b7183;
  --brand: #4f46e5; --brand-2: #7c3aed; --ok: #059669; --warn: #b45309; --err: #dc2626; --line: #e5e7f0;
  --radius: 14px; --shadow: 0 8px 28px rgba(23, 26, 38, .07);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 16px/1.55 -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }

/* header */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; gap: 18px; height: 60px; }
.logo { font-weight: 800; font-size: 20px; color: var(--ink); letter-spacing: -.3px; white-space: nowrap; }
.logo span { color: var(--brand); }
.tabs { display: flex; gap: 4px; }
.tabs a { color: var(--muted); padding: 7px 12px; border-radius: 8px; font-size: 14.5px; white-space: nowrap; }
.tabs a.on { color: var(--brand); background: #eef0ff; font-weight: 600; }
.top nav { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: 15px; }
.top nav a { color: var(--muted); }

/* buttons */
.btn {
  display: inline-block; border: 1px solid var(--line); cursor: pointer; border-radius: 10px;
  padding: 11px 20px; font-size: 15px; font-weight: 600; text-decoration: none !important;
  background: var(--card); color: var(--ink);
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border: 0; }
.btn.primary:hover { opacity: .92; color: #fff; }
.btn.small { padding: 7px 13px; font-size: 13.5px; }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); }
.btn.social { width: 100%; margin: 5px 0; text-align: center; }
.btn:disabled { opacity: .5; cursor: default; }

/* forms */
label.fl { display: block; font-size: 13.5px; font-weight: 600; color: var(--muted); margin: 14px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=date], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  padding: 11px 13px; font: inherit; color: var(--ink); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); }
textarea { resize: vertical; min-height: 80px; }
.check { display: flex; gap: 8px; align-items: center; margin: 12px 0 0; font-size: 14.5px; cursor: pointer; }
.check input { width: auto; }
.or-divider { text-align: center; color: var(--muted); font-size: 13px; margin: 14px 0 4px; }

/* segments */
.segment { display: flex; flex-wrap: wrap; gap: 4px; background: #eef0f8; border-radius: 11px; padding: 4px; margin-top: 4px; }
.segment button { flex: 1 1 auto; min-width: 76px; border: 0; background: none; padding: 9px 8px; border-radius: 8px; cursor: pointer; font: 600 14px/1 inherit; color: var(--muted); white-space: nowrap; }
.segment button.on { background: #fff; color: var(--brand); box-shadow: 0 2px 8px rgba(23,26,38,.08); }
.char-row { display: grid; grid-template-columns: 1fr 1.3fr 34px; gap: 6px; margin-bottom: 6px; }
.char-row .c-del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; }
.char-row .c-del:hover { color: var(--err); }

/* photos */
.ph-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ph { position: relative; width: 74px; height: 74px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-del { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border: 0; border-radius: 6px; background: rgba(23,26,38,.65); color: #fff; cursor: pointer; font-size: 11px; line-height: 1; }

/* cards / grids */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.banner { background: #fef3c7; border: 1px solid #fde68a; color: var(--warn); padding: 11px 16px; border-radius: 12px; font-size: 14.5px; }
.app-grid { display: grid; grid-template-columns: 400px 1fr; gap: 20px; align-items: start; }
.counter { font-size: 13.5px; background: #eef0ff; color: var(--brand); padding: 4px 12px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.ava { width: 28px; height: 28px; border-radius: 50%; vertical-align: -8px; margin-right: 4px; }
.req { background: #f6f7fb; border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14.5px; white-space: pre-wrap; }

/* result */
.result h3 { font-size: 14px; color: var(--muted); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
.ttl-row { display: flex; gap: 10px; align-items: flex-start; background: #f6f7fb; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.ttl-row .txt { flex: 1; font-weight: 600; }
.copy { border: 0; background: none; color: var(--brand); cursor: pointer; font-size: 13px; font-weight: 600; padding: 2px 4px; }
.copy:hover { text-decoration: underline; }
.desc { white-space: pre-wrap; background: #f6f7fb; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { background: #eef0ff; color: var(--brand); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
.notes { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 10px 14px; font-size: 14px; color: var(--warn); margin-top: 14px; }
table.mini { width: 100%; border-collapse: collapse; font-size: 14px; }
table.mini td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.mini td:first-child { color: var(--muted); width: 45%; }

.msg { border-radius: 10px; padding: 11px 14px; font-size: 14.5px; margin: 12px 0 0; display: none; }
.msg.err { background: #fee2e2; color: var(--err); display: block; }
.msg.ok { background: #d1fae5; color: var(--ok); display: block; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: r 1s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes r { to { transform: rotate(360deg); } }

/* badges */
.badge { display: inline-block; background: #eef0ff; color: var(--brand); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.badge.mini { padding: 2px 8px; font-size: 11px; }
.badge.s-byok_ok { background: #d1fae5; color: var(--ok); }
.badge.s-failed { background: #fee2e2; color: var(--err); }
.badge.s-inv-pending { background: #fef3c7; color: var(--warn); }
.badge.s-inv-confirmed { background: #d1fae5; color: var(--ok); }
.badge.s-inv-rejected { background: #fee2e2; color: var(--err); }

/* history */
details.hist { border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-bottom: 8px; padding: 10px 14px; }
details.hist summary { cursor: pointer; font-size: 14.5px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
details.hist summary .d { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
details.hist .body { padding: 10px 4px 4px; }

/* pricing */
.price { text-align: center; position: relative; }
.price.hot { border: 2px solid var(--brand); }
.price .tag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 12px; white-space: nowrap; }
.price h3 { margin: 6px 0 2px; font-size: 19px; }
.price .cost { font-size: 32px; font-weight: 800; margin: 8px 0 2px; }
.price .cost small { font-size: 15px; font-weight: 500; color: var(--muted); }
.price ul { list-style: none; padding: 0; margin: 14px 0 18px; text-align: left; font-size: 14px; color: var(--muted); }
.price li { padding: 4px 0 4px 24px; position: relative; }
.price li::before { content: '✓'; position: absolute; left: 2px; color: var(--ok); font-weight: 700; }

/* чек-лист, БЗ */
.cl-item { padding: 7px 0; font-size: 15px; color: var(--ink); border-bottom: 1px dashed var(--line); }
.cl-item.done { color: var(--ok); text-decoration: line-through; }
.kb-item { cursor: pointer; padding: 16px 18px; }
.kb-item:hover { border-color: var(--brand); }
.kb-body { line-height: 1.7; font-size: 15px; }
.kb-body h3 { color: var(--brand); }
.kb-body li { margin: 3px 0; }

/* наставник */
#chat-fab { position: fixed; right: 20px; bottom: 20px; width: 54px; height: 54px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-size: 24px; cursor: pointer; box-shadow: 0 8px 24px rgba(79,70,229,.4); z-index: 40; }
#chatw { position: fixed; right: 20px; bottom: 84px; width: 360px; max-width: calc(100vw - 32px); height: 460px; max-height: 70vh; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 48px rgba(23,26,38,.18); display: flex; flex-direction: column; z-index: 40; }
.chat-head { padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.chat-head button { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; }
#chat-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; }
.chat-msg.ai { background: #f1f2f8; align-self: flex-start; }
.chat-msg.me { background: #eef0ff; color: var(--brand); align-self: flex-end; }
.chat-input { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); }

/* модалки, тур, тосты */
#tour, #upsell { position: fixed; inset: 0; background: rgba(23,26,38,.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: #fff; border-radius: 16px; padding: 26px; max-width: 460px; width: 100%; box-shadow: 0 24px 64px rgba(23,26,38,.3); }
.dots { display: flex; gap: 6px; margin-bottom: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dot.on { background: var(--brand); width: 22px; border-radius: 5px; }
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: up .2s ease; }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }

/* admin */
table.adm { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; border-radius: 12px; overflow: hidden; }
.adm th, .adm td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.adm th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.stat-card { text-align: center; }
.stat-card .v { font-size: 30px; font-weight: 800; }
.stat-card .l { color: var(--muted); font-size: 13.5px; }
.set-form label.fl { margin-top: 10px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 16px; padding: 14px 16px 18px; background: var(--card); }
legend { font-weight: 700; font-size: 15px; padding: 0 6px; }

footer { border-top: 1px solid var(--line); background: var(--card); margin-top: 40px; }
footer .wrap { display: flex; gap: 18px; padding: 22px 20px; color: var(--muted); font-size: 13.5px; flex-wrap: wrap; }

/* hero (лендинг) */
.hero { text-align: center; padding: 72px 20px 48px; }
.hero h1 { font-size: 42px; line-height: 1.15; margin: 0 0 18px; letter-spacing: -1px; }
.hero h1 em { font-style: normal; background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 19px; color: var(--muted); max-width: 640px; margin: 0 auto 30px; }
.hero .hero-note { font-size: 13.5px !important; margin-top: 14px !important; }
.step .num { width: 34px; height: 34px; border-radius: 10px; background: #eef0ff; color: var(--brand); font-weight: 800; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.step h3 { margin: 0 0 6px; font-size: 17px; }
.step p { margin: 0; color: var(--muted); font-size: 14.5px; }
.sec { padding: 42px 0; }
.sec h2 { font-size: 30px; margin: 0 0 8px; letter-spacing: -.5px; }
.sec .sub { color: var(--muted); margin: 0 0 28px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq p { color: var(--muted); margin: 10px 0 2px; }

@media (max-width: 860px) {
  .grid3, .grid2, .app-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 30px; }
  .top .wrap { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .top nav { margin-left: auto; }
}
@media (max-width: 375px) {
  .wrap { padding: 0 12px; }
  .hero h1 { font-size: 25px; }
  .price .cost { font-size: 27px; }
  .char-row { grid-template-columns: 1fr 1.2fr 28px; }
  .ttl-row { flex-wrap: wrap; }
}
