/* Sentify Home: a thin, local-only UI layer over november /style.css.
   Shared stylesheet owns all brand colors, nebula animation, themes, typography and cards. */
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden], .scrim[hidden] { display: none !important; }
.main { min-height: 0; }
.side { min-height: 0; }
.side-bottom { flex: none; }
.brand { min-width: 0; }
.brand>span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chats { min-height: 40px; }
.chat-item { padding: 0 4px 0 12px; min-width: 0; }
.chat-item .open { cursor: pointer; color: inherit; font: inherit; font-size: 14px; }
.chat-item .open:focus-visible { outline-offset: -3px; }
.grow {
  border: 1px solid var(--float-line);
  border-radius: 16px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--float-solid) 85%, transparent);
  box-shadow: 0 10px 26px -25px var(--glow);
}
.grow-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.grow-top b { font-size: 13.5px; font-weight: 600; }
.grow-top span { font: 600 19px var(--sans); color: var(--amber); font-variant-numeric: tabular-nums; }
.grow .bar { height: 6px; margin: 8px 0; background: var(--soft); border-radius: 50px; overflow: hidden; }
.grow .bar i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#7f63ff,#4e7dff); transition: width .4s var(--ease); }
.grow p { color: var(--muted); font-size: 12.5px; line-height: 1.45; margin: 0 0 10px; }
.grow .set-btn { display: block; width: 100%; text-align: center; font-weight: 600; font-size: 12.5px; padding: 8px; }
.status { display: flex; align-items: center; gap: 8px; padding: 4px 10px; font-size: 12.5px; color: var(--muted); }
.status>i { display:block; flex:none; width: 8px; height: 8px; border-radius: 50%; background:var(--muted); }
.status[data-state="on"]>i { background:#3fbe82; box-shadow:0 0 0 3px color-mix(in srgb,#3fbe82 20%,transparent); }
.status[data-state="off"]>i { background:var(--danger); }
.status>span { flex: 1; }
#scroll.thread { min-height: 0; position:relative; }
#hello.empty { margin: 0 auto; max-width: 740px; min-height: 100%; }
#hello.empty .orb-hero { flex:none; }
#hello.empty .hello { color:var(--amber); }
#hello.empty h1 { margin: 0; }
#hello.empty .lead { margin: 0; }
#hello[hidden] { display:none; }
#thread.messages { width: 100%; min-height: 0; }
#thread.messages:empty { display:none; }
.thread:has(.setup:not([hidden])) #hello.empty { min-height: auto; padding-top: 34px; padding-bottom: 12px; }
.thread:has(.setup:not([hidden])) #hello.empty .orb-hero { --s: 64px; width: 64px; height: 64px; margin-bottom: 4px; }
.thread:has(.setup:not([hidden])) #hello.empty .orb.lg { --s: 64px; }
.thread:has(.setup:not([hidden])) #hello.empty h1 { font-size: 25px; }
.thread:has(.setup:not([hidden])) #hello.empty .lead { font-size: 13px; }
#thread .msg.bot>.who { pointer-events:none; }
#thread .msg.bot>div:last-child { min-width: 0; }
#thread .msg.bot .tools { display:flex; align-items:center; gap: 2px; margin-top: 7px; }
#thread .msg.bot .tools button.on { color:var(--amber); }
#thread .msg.bot .tools button.on svg { fill:currentColor; fill-opacity:.2; }
#thread .msg.bot .tools .meta { color:var(--muted); font-size: 12px; margin-left: 6px; font-variant-numeric: tabular-nums; }
#thread .msg.bot .body { min-width:0; overflow-wrap:anywhere; }
#thread .msg.bot .body p:first-child { margin-top:0; }
#thread .msg.bot .body .err { color:var(--danger); }
#thread .msg.bot .body pre .bar-code {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:7px 12px; border-bottom:1px solid rgba(255,255,255,.12);
  color:#bdb6d9; font:12px var(--mono);
}
#thread .msg.bot .body pre { padding:0; margin:8px 0 16px; border-radius:15px; }
#thread .msg.bot .body pre code { display:block; overflow-x:auto; padding:12px 16px; white-space:pre; color:#ece8ff; }
#thread .msg.bot .body pre .bar-code button { background:none; color:inherit; border:0; font:inherit; padding:4px 7px; border-radius:7px; }
#thread .msg.bot .body pre .bar-code button:hover { color:#fff; background:rgba(255,255,255,.09); }
#thread .msg.bot .body .math-block { display:block; max-width:100%; overflow-x:auto; padding:8px 2px; margin:8px 0 16px; text-align:center; }
#thread .msg.bot .body .math-inline { display:inline-block; max-width:100%; vertical-align:middle; }
#thread .msg.bot .body math { font-size:1.16em; color:inherit; }
#thread .msg.bot .body .math-block math { font-size:1.3em; }
#thread .msg.bot .body .math-fallback { white-space:pre-wrap; font-family:var(--mono); }
#thread .msg.bot .body .math-block .math-fallback { display:block; text-align:left; }
#thread .msg.user .body { white-space:pre-wrap; }
#thread .msg { max-width:100%; }
#thread .msg.user { animation:rise .28s var(--ease) both; }
#thread .msg.bot.live .orb::before { animation-duration:2.2s,3s; }
.composer { width:100%; }
.composer .box { width:100%; max-width:780px; margin:0 auto; }
.composer textarea { display:block; width:100%; min-height:32px; max-height:220px; background:none; border:0; outline:0; resize:none; padding:6px 0; line-height:1.5; }
.composer .row { display:flex; align-items:center; justify-content:space-between; margin-top:6px; gap:8px; }
.composer-note { color:var(--muted); font-size:12px; padding-left:2px; }
.composer .hint { margin:6px auto 0; font-size:11.5px; }
.composer .send.stop svg { stroke:none; fill:currentColor; }
.composer .send:active:not(:disabled) { transform:scale(.92); }

/* First-run Ollama setup is still available when the model is offline. */
.setup {
  width:min(740px,calc(100% - 32px)); margin:8px auto 28px;
  background:var(--float); border:1px solid var(--float-line); border-radius:20px;
  box-shadow:var(--tw-shadow); padding:22px 24px; line-height:1.55;
  -webkit-backdrop-filter:blur(14px); backdrop-filter:blur(14px);
}
.setup h3 { margin:0 0 10px; font-size:19px; font-weight:600; }
.setup p { margin:0 0 12px; color:var(--muted); }
.setup ol { margin:0; padding-left:24px; display:grid; gap:10px; }
.setup li p { margin:2px 0 6px; font-size:14px; }
.setup .cmd {
  display:flex; align-items:center; gap:8px; margin:8px 0; padding:8px 8px 8px 12px;
  border:1px solid var(--line); border-radius:10px; background:var(--panel); overflow-x:auto;
}
.setup .cmd code { flex:1; min-width:0; white-space:nowrap; font:12px/1.5 var(--mono); }
.setup .cmd button { flex:none; background:var(--soft); border-radius:8px; border:0; padding:6px 9px; font-size:12px; }
.setup .again { color:var(--amber); font-size:13px; font-weight:600; border:1px solid var(--line); border-radius:10px; padding:8px 12px; margin-top:10px; }
.setup .again:hover { background:var(--amber-soft); }
@media(max-width:600px) { .setup { padding:18px 16px; } }

/* Native dialog, visually identical to november settings while retaining local-only controls. */
.sheet {
  width:min(560px,calc(100vw - 24px)); max-height:min(88dvh,820px);
  padding:0; border:1px solid var(--float-line); border-radius:24px;
  background:var(--float-solid); color:var(--ink); box-shadow:0 28px 75px -24px rgba(18,10,50,.55);
  overflow:auto; scrollbar-width:thin;
}
.sheet::backdrop { background:rgba(14,10,32,.42); backdrop-filter:blur(6px); }
.sheet>form { padding:22px 24px; }
.sheet-head { display:flex; justify-content:space-between; align-items:center; margin:0 0 12px; }
.sheet h2 { margin:0; font:600 21px var(--display); letter-spacing:-.025em; }
.sheet .set-group { padding:14px 0; }
.sheet .set-group h3 { margin:0 0 2px; }
.sheet .set-row { margin:0; }
.sheet .set-row>span { flex:0 0 auto; }
.sheet .set-row select, .sheet .set-row input { max-width:290px; }
.sheet .set-note { color:var(--muted); margin:0; }
.sheet .prompt-label { display:flex; flex-direction:column; gap:8px; font-size:14px; }
.sheet .prompt-label textarea, .sheet #fix-text {
  width:100%; resize:vertical; line-height:1.55; min-height:110px;
  padding:11px 13px; background:var(--panel); color:var(--ink);
  border:1px solid var(--line); border-radius:12px; outline:none;
}
.sheet .prompt-label textarea:focus, .sheet #fix-text:focus { border-color:var(--amber); box-shadow:0 0 0 3px var(--amber-soft); }
.sheet .set-row:has(.temp-range) { display:grid; grid-template-columns:1fr auto; }
.sheet .temp-range { max-width:none!important; grid-column:1/-1; width:100%; accent-color:var(--amber); }
.sheet .actions { display:flex; align-items:center; justify-content:space-between; gap:10px; padding-top:18px; border-top:1px solid var(--line); }
.sheet .actions button { border:1px solid var(--line); background:var(--panel); color:var(--ink); padding:9px 15px; border-radius:11px; font-weight:600; }
.sheet .actions .primary { margin-left:auto; background:var(--amber); color:var(--on-amber); border-color:transparent; }
.sheet .actions .danger { color:var(--danger); border:0; background:none; }
.sheet .muted { color:var(--muted); margin:8px 0 16px; font-size:14px; }
#fix .actions { margin-top:15px; }
#fix #fix-text { min-height:170px; }
.toast {
  position:fixed; z-index:50; left:50%; bottom:100px; max-width:calc(100vw - 32px);
  transform:translate(-50%,12px); opacity:0; pointer-events:none;
  border:1px solid var(--float-line); border-radius:12px; padding:9px 16px;
  background:var(--float-solid); color:var(--ink); box-shadow:var(--tw-shadow);
  transition:transform .2s,opacity .2s; font-size:13px;
}
.toast.show { opacity:1; transform:translate(-50%,0); }
@media(max-width:820px) {
  #hello.empty { padding:20px 16px; }
  #thread.messages { padding:8px 14px 24px; }
  .side { padding-bottom:calc(12px + env(safe-area-inset-bottom)); }
  .composer-note { font-size:11px; }
  .sheet>form { padding:18px 17px; }
  .sheet .set-row:has(select), .sheet .set-row:has(input:not([type="range"])) { flex-direction:column; align-items:stretch; }
  .sheet .set-row select, .sheet .set-row input { max-width:none; width:100%; }
  .grow { padding:10px 12px; }
}
@media(max-height:650px) {
  .side-bottom { max-height:46dvh; overflow:auto; }
  .thread:has(.setup:not([hidden])) #hello.empty .orb-hero { display:none; }
}
@media(prefers-reduced-motion:reduce) {
  .grow .bar i, .toast { transition:none; }
}

/* An isolated retry is not a verified correction. Keep the limitation visible. */
.msg .review-note { color:var(--muted); font-size:12px; margin:2px 0 10px; }

/* Sentify Mentor: quiet explanatory panel, not a replacement for the original reply. */
.mentor-panel { margin:14px 0 8px; padding:12px 14px; border:1px solid var(--line); border-radius:14px;
  background:var(--panel); font-size:13px; line-height:1.55; }
.mentor-panel strong { font-weight:600; }
.mentor-panel p { margin:7px 0; }
.mentor-panel small { display:block; color:var(--muted); margin-top:9px; }
.mentor-answer { border-top:1px solid var(--line); margin-top:11px; padding-top:11px; }
.mentor-answer>div { margin-top:8px; }
.mentor-answer pre { max-width:100%; overflow-x:auto; }
.mentor-panel details { margin-top:8px; }
.mentor-toggle { display:flex; align-items:center; gap:10px; padding:9px 0; line-height:1.4; font-size:14px; }
.mentor-toggle input { flex:0 0 auto; width:17px; height:17px; accent-color:var(--amber); }
.mentor-settings .set-note { margin:2px 0 10px; line-height:1.5; }

/* exam and growth */
.grow .set-btn + .set-btn { margin-top:6px; }
#exam h3 { font-size:12.5px; font-weight:600; color:var(--muted); margin:18px 0 8px; }
.exam-run { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-top:12px; }
.exam-run span { color:var(--muted); font-size:13.5px; font-variant-numeric:tabular-nums; }
#exam-plot svg { display:block; width:100%; height:auto; overflow:visible; stroke:none; fill:none; }
#exam-plot text { stroke:none; }
#exam-plot .grid { stroke:var(--line); stroke-width:1; }
#exam-plot .axis { fill:var(--muted); font:11px var(--sans); font-variant-numeric:tabular-nums; }
#exam-plot .line { fill:none; stroke:var(--amber); stroke-width:2; stroke-linejoin:round; stroke-linecap:round; }
#exam-plot .dot { fill:var(--amber); stroke:var(--panel); stroke-width:2; }
#exam-plot .hit { fill:transparent; stroke:none; cursor:default; outline:none; }
#exam-plot .hit:hover + .dot, #exam-plot .hit:focus + .dot { r:6.5; }
#exam-plot .val { fill:var(--ink); font:600 12px var(--sans); font-variant-numeric:tabular-nums; }
.exam-tip { min-height:18px; margin:4px 0 0; color:var(--ink2,var(--ink)); font-size:12.5px; font-variant-numeric:tabular-nums; }
.exam-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px; }
.exam-list li { display:grid; grid-template-columns:1fr auto; gap:2px 12px; padding:9px 12px; border:1px solid var(--line); border-radius:12px; font-size:13.5px; }
.exam-list small { grid-column:1 / -1; color:var(--muted); line-height:1.4; }
.exam-list details { grid-column:1 / -1; font-size:13px; } .exam-list details pre { white-space:pre-wrap; margin:6px 0 0; font:12.5px/1.5 var(--mono, monospace); max-height:240px; overflow:auto; }
.exam-mark { font-weight:600; white-space:nowrap; }
.exam-table { width:100%; border-collapse:collapse; font-size:13px; font-variant-numeric:tabular-nums; }
.exam-table th { text-align:left; font-weight:600; color:var(--muted); padding:6px 8px 6px 0; }
.exam-table td { padding:6px 8px 6px 0; border-top:1px solid var(--line); }
#exam-clear { margin-top:10px; }
.exam-run .primary { border:0; background:var(--amber); color:var(--on-amber); padding:9px 16px; border-radius:11px; font:inherit; font-weight:600; cursor:pointer; }

/* tables in answers; quiet text buttons inside the mentor note */
.msg .table-wrap { overflow-x:auto; margin:10px 0; }
.msg .table-wrap table { border-collapse:collapse; font-size:14px; font-variant-numeric:tabular-nums; }
.msg .table-wrap th, .msg .table-wrap td { padding:7px 12px; border:1px solid var(--line); text-align:left; vertical-align:top; }
.msg .table-wrap th { font-weight:600; background:var(--soft); }
.mentor-panel button.link { border:0; background:none; padding:0; font:inherit; color:var(--amber); text-decoration:underline; text-underline-offset:2px; cursor:pointer; }

/* phones: every field at 16px or more, so iOS does not zoom in when it is tapped */
@media (max-width:760px){input,textarea,select{font-size:max(16px,1em)}}

/* the conversation list is a drawer on a computer too (as on the main page): the round button at the top left opens it */
#close-side{display:grid}
