:root {
  --bg: #f7f5f0; --panel: #ffffff; --ink: #1d232b; --muted: #5d6673; --line: #e3ded4;
  --accent: #0f5c63; --accent-ink: #ffffff; --me: #e7f1f0; --twin: #ffffff; --warn: #8a4b0f;
  --radius: 14px; --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11161b; --panel: #181f26; --ink: #e8ecef; --muted: #9aa5b1; --line: #2a333d; --accent: #4fb3b5; --accent-ink: #0b1215; --me: #1d3134; --twin: #181f26; --warn: #e3a35c; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); display: flex; flex-direction: column; min-height: 100dvh; }
button, textarea, input { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; flex: none; }
.actions { display: flex; gap: 6px; flex: none; }
.ghost { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.primary:disabled { opacity: .55; cursor: default; }

main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 16px 16px 8px; }
.welcome { text-align: center; padding: 12vh 4px 0; }
.welcome h1 { font-size: 28px; margin: 0 0 8px; }
.welcome p { color: var(--muted); max-width: 46ch; margin: 0 auto 22px; }
.notice { color: var(--warn) !important; margin-top: 18px !important; }

.personas { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.personas button { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.personas button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.messages { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.msg { padding: 12px 14px; border-radius: var(--radius); max-width: 92%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--me); border-bottom-right-radius: 4px; }
.msg.twin { align-self: flex-start; background: var(--twin); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg .who { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; white-space: normal; }
.msg .status { color: var(--muted); font-style: italic; }
.msg details { margin-top: 8px; font-size: 13.5px; color: var(--muted); white-space: normal; }
.msg details ul { margin: 6px 0 0; padding-left: 18px; }

.rate { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; white-space: normal; }
.rate > button { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 5px 12px; font-size: 14px; cursor: pointer; }
.rate .fix { flex-basis: 100%; display: flex; flex-direction: column; gap: 8px; }
.rate textarea, .rate input { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: 8px 10px; }
.rate .done { color: var(--muted); font-size: 14px; }

.ask { position: sticky; bottom: 0; width: 100%; max-width: 760px; margin: 0 auto; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 75%, transparent); display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.ask textarea { resize: none; max-height: 40vh; border: 1px solid var(--line); border-radius: 18px; padding: 10px 14px; background: var(--panel); min-height: 44px; }
.meta { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--muted); text-align: center; }

/* tabs and sections */
.tabs { position: sticky; top: 57px; z-index: 2; display: flex; gap: 4px; overflow-x: auto; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs button { flex: none; background: none; border: 0; border-radius: 999px; padding: 7px 14px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tabs button[aria-current="page"] { background: var(--me); color: var(--ink); }
.pane h2 { margin: 4px 0 6px; font-size: 22px; }
.pane h3 { margin: 22px 0 8px; font-size: 17px; }
.lead { color: var(--muted); margin: 0 0 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 2px 0 0; display: block; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label, .form fieldset { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; border: 0; margin: 0; padding: 0; min-width: 0; }
.form legend { padding: 0; margin-bottom: 4px; }
.form input, .form select, .form textarea, .filters input, .filters select { font-weight: 400; font-size: 15px; width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: var(--bg); }
.form [hidden] { display: none !important; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; font-weight: 400; }
.checks label { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
.checks input { width: auto; }
.result { margin: 0; font-size: 14px; }
.result.ok { color: var(--accent); }
.result.bad { color: var(--warn); }
.kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin-bottom: 12px; }
.kinds button { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 10px 6px; cursor: pointer; font-size: 13.5px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.kinds button span { font-size: 22px; }
.kinds button[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.lib { list-style: none; padding: 0; margin: 8px 0 24px; display: flex; flex-direction: column; gap: 8px; }
.lib li { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: start; }
.lib .ico { font-size: 20px; line-height: 1.2; }
.lib .t { font-weight: 600; overflow-wrap: anywhere; }
.lib .sub { color: var(--muted); font-size: 13px; }
.lib .pre { grid-column: 2 / -1; color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.lib .act { display: flex; gap: 6px; }
.lib .act button, .lib .act a { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 3px 10px; font-size: 13px; cursor: pointer; color: inherit; text-decoration: none; }
.lib img { grid-column: 2 / -1; max-width: 160px; border-radius: 8px; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); text-transform: uppercase; letter-spacing: .3px; margin-right: 6px; }
.badge.public { color: #2e7d32; border-color: #2e7d32; } .badge.team { color: #1565c0; border-color: #1565c0; } .badge.infra { color: #6a1b9a; border-color: #6a1b9a; }
.badge.family { color: #c2185b; border-color: #c2185b; } .badge.private { color: var(--warn); border-color: var(--warn); }
pre.code { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; overflow-x: auto; font-size: 12.5px; white-space: pre; margin: 6px 0; }
.key { font-family: ui-monospace, Consolas, monospace; background: var(--me); padding: 8px 10px; border-radius: 8px; overflow-wrap: anywhere; display: block; margin: 6px 0; }
.starters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.starters button { border: 1px dashed var(--line); background: none; border-radius: 12px; padding: 8px 12px; cursor: pointer; font-size: 14px; text-align: left; color: var(--muted); }
.guide { line-height: 1.6; }
.guide .steps { counter-reset: s; list-style: none; padding: 0; }
.guide .steps li { counter-increment: s; position: relative; padding-left: 36px; margin-bottom: 10px; }
.guide .steps li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.guide .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.guide .grid div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.guide .grid strong { display: block; margin-bottom: 2px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13.5px; margin: 8px 0 16px; }
.flow span { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
.flow i { color: var(--muted); font-style: normal; }
@media (max-width: 560px) { .row, .filters { grid-template-columns: 1fr; } .tabs { top: 57px; } }
