:root {
  --ink: #14171c;
  --paper: #f6f6f4;
  --white: #fff;
  --green: #1f7a5a;
  --green-deep: #144f3b;
  --mint: #e6f2eb;
  --line: #e6e6e2;
  --line-2: #d2d2cc;
  --mut: #6b6b66;
  --red: #c4302b;
  --amber: #a35d00;
  --amber-bg: #fdf3e2;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--green); }
h1 { font-family: var(--display); font-size: 28px; line-height: 1.1; letter-spacing: -0.035em; margin: 0 0 6px; font-weight: 600; }
h2 { font-family: var(--display); font-size: 17px; letter-spacing: -0.02em; margin: 0 0 12px; font-weight: 600; }
p { margin: 0 0 12px; }
.mut { color: var(--mut); }
.small { font-size: 13.5px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--green) 50%, transparent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .box { width: 100%; max-width: 400px; }
.auth .logo { display: inline-block; margin-bottom: 28px; }
.auth h1 { margin-bottom: 20px; }
.auth .alt { margin-top: 18px; color: var(--mut); }
.auth .lang-row { margin-top: 30px; font-size: 14px; }

.logo { font-family: var(--display); font-weight: 600; font-size: 21px; letter-spacing: -0.04em; color: var(--ink); text-decoration: none; line-height: 1; }
.logo span { color: inherit; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--white); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { padding: 0 8px; }
.site-pick { width: 100%; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 9px; color: var(--ink); text-decoration: none; font-size: 15px; }
.nav a:hover { background: var(--paper); }
.nav a.on { background: var(--ink); color: #fff; font-weight: 500; }
.nav .badge { background: var(--green); color: #fff; border-radius: 999px; font-size: 12px; padding: 0 7px; font-weight: 500; }
.side .foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); padding-top: 12px; }
.side .foot .who { font-size: 13px; color: var(--mut); padding: 4px 10px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { padding: 32px 36px 80px; max-width: 1080px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.head p { margin: 0; }

@media (max-width: 860px) {
  h1 { font-size: 24px; }
  .shell { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .side { min-width: 0; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; gap: 10px; }
  .side .top-row { display: flex; align-items: center; gap: 12px; }
  .side .top-row .site-pick { flex: 1; min-width: 0; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  .nav a { white-space: nowrap; padding: 7px 11px; }
  .side .foot { display: none; }
  main { padding: 22px 16px 64px; }
}
@media (min-width: 861px) { .side .top-row { display: flex; flex-direction: column; gap: 18px; align-items: stretch; } .side .menu-only { display: none; } }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 500; font-size: 14.5px; line-height: 1; padding: 11px 16px; border-radius: 8px; border: 0; cursor: pointer; background: var(--ink); color: #fff; text-decoration: none; white-space: nowrap; transition: background .15s; }
.btn:hover { background: #000; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.sec { background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.sec:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.btn.ghost { background: transparent; color: var(--mut); padding-left: 8px; padding-right: 8px; }
.btn.ghost:hover { color: var(--ink); }
.btn.danger { background: var(--white); color: var(--red); box-shadow: inset 0 0 0 1px #e8c4c2; }
.btn.danger:hover { background: #fdf0ef; }
.btn.sm { padding: 8px 12px; font-size: 13.5px; border-radius: 7px; }
.btn.wide { width: 100%; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack > * + * { margin-top: 14px; }

label.f { display: block; }
label.f > span { display: block; font-weight: 500; font-size: 14px; margin-bottom: 5px; }
label.f > small { display: block; color: var(--mut); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input:not([type]), select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--white);
  border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: none; }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
textarea.facts { min-height: 460px; font-size: 14.5px; font-family: var(--mono); line-height: 1.55; }
input[type=color] { width: 54px; height: 42px; padding: 3px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; cursor: pointer; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--green); flex: none; }
.check b { display: block; font-weight: 500; }
.check small { display: block; color: var(--mut); font-size: 13.5px; }
.err { color: var(--red); font-size: 14px; min-height: 0; }
.err:empty { display: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- panels ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.card + .card, form + .card { margin-top: 16px; }
.card.flat { background: transparent; }
.note { background: var(--amber-bg); border: 1px solid #f1d9ad; color: #5d3a00; border-radius: 12px; padding: 12px 14px; font-size: 14.5px; }
.note.ok { background: var(--mint); border-color: #c4e2d2; color: var(--green-deep); }
.empty { text-align: center; padding: 48px 20px; color: var(--mut); }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat b { display: block; font-family: var(--display); font-size: 30px; letter-spacing: -0.04em; line-height: 1; font-weight: 600; }
.stat span { font-size: 13px; color: var(--mut); display: block; margin-top: 6px; }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr 1fr; } }

.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.todo li:first-child { border-top: 0; padding-top: 0; }
.todo .tick { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); flex: none; display: grid; place-items: center; font-size: 13px; color: #fff; }
.todo .done .tick { background: var(--green); border-color: var(--green); }
.todo .txt { flex: 1; }
.todo .done .txt { color: var(--mut); }

/* tables / lists */
.list { background: var(--white); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 14px 18px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.item:first-child { border-top: 0; }
a.item:hover { background: #fbfaf7; }
.item .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .m { font-size: 13.5px; color: var(--mut); grid-column: 1 / -1; display: flex; gap: 6px 14px; flex-wrap: wrap; }
.item .d { font-size: 13.5px; color: var(--mut); white-space: nowrap; }
.tag { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 500; padding: 1px 8px; border-radius: 999px; background: var(--paper); color: var(--mut); border: 1px solid var(--line); }
.tag.green { background: var(--mint); color: var(--green-deep); border-color: #c4e2d2; }
.tag.amber { background: var(--amber-bg); color: var(--amber); border-color: #f1d9ad; }
.tag.red { background: #fdf0ef; color: var(--red); border-color: #efc9c6; }

.tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { font: inherit; font-size: 14.5px; border: 1px solid var(--line-2); background: var(--white); color: var(--ink); border-radius: 999px; padding: 6px 13px; cursor: pointer; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

table.t { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.t th { text-align: left; font-weight: 500; color: var(--mut); font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; }

/* questions */
.q { padding: 18px; border-top: 1px solid var(--line); }
.q:first-child { border-top: 0; }
.q .qt { font-weight: 500; font-size: 16px; margin-bottom: 4px; }
.q .meta { font-size: 13.5px; color: var(--mut); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.q blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--line-2); color: #3a4048; font-size: 14.5px; background: var(--paper); border-radius: 0 8px 8px 0; }
.q .ans { background: var(--mint); border: 1px solid #c4e2d2; border-radius: 10px; padding: 10px 12px; margin-top: 8px; }
.q form { margin-top: 10px; }
.q textarea { min-height: 76px; }

/* transcript */
.tr { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 78%; padding: 10px 13px; border-radius: 14px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--white); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.team { align-self: flex-start; background: var(--mint); border: 1px solid #c4e2d2; border-bottom-left-radius: 4px; }
.msg .who { display: block; font-size: 12px; font-weight: 500; color: var(--mut); margin-bottom: 2px; white-space: normal; }
.msg.user .who { color: #aab0b8; }

/* wizard */
.wiz { max-width: 720px; }
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 28px; flex-wrap: wrap; counter-reset: s; }
.steps li { counter-increment: s; display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--mut); padding-right: 10px; }
.steps li::before { content: counter(s); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 500; border: 1.5px solid var(--line-2); }
.steps li.on { color: var(--ink); font-weight: 500; }
.steps li.on::before { background: var(--ink); color: #fff; border-color: var(--ink); }
.steps li.done::before { content: "✓"; background: var(--green); border-color: var(--green); color: #fff; }
.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 14px 0 10px; }
.bar i { display: block; height: 100%; background: var(--green); width: 0; transition: width .3s; }
.bar.indet i { width: 35%; animation: slide 1.3s infinite ease-in-out; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.pages { list-style: none; margin: 10px 0 0; padding: 0; max-height: 260px; overflow-y: auto; font-size: 13.5px; }
.pages li { display: flex; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.pages li span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice { display: block; border: 1px solid var(--line-2); border-radius: 10px; padding: 14px 16px; cursor: pointer; background: var(--white); }
.choice + .choice { margin-top: 10px; }
.choice:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.choice .check { pointer-events: none; }
.choice .more { margin-top: 12px; pointer-events: auto; }

.code { display: flex; gap: 12px; align-items: center; background: #060607; color: rgba(244,244,240,.8); border-radius: 10px; padding: 14px 16px; }
.code code { flex: 1; min-width: 0; font: 13.5px/1.5 var(--mono); overflow-x: auto; white-space: nowrap; }
.code .btn { background: #fff; color: var(--ink); }
.preview { height: 560px; max-width: 400px; margin-top: 16px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--red); }

.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; vertical-align: -3px; }
@keyframes rot { to { transform: rotate(360deg); } }
.loading { padding: 60px 0; text-align: center; color: var(--mut); }
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0s !important; transition: none !important; } }
