/* user.html -- clean and simple. Served at /user.css (CSP style-src 'self'); the palette, rate lines
   and the picker come from /picker.css, shared with the operator panel (ADR-016). */
* { box-sizing: border-box; }
body { margin: 0; padding: 2.5rem 1rem; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 34rem; margin: 0 auto; }
h1 { font-size: 1.35rem; margin: 0 0 1.25rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem 1.5rem; margin-bottom: 1rem; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0; }
dt { color: var(--muted); } dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95rem; overflow-wrap: anywhere; }
label { display: block; font-weight: 600; margin: 0 0 .4rem; }
dl + label { margin-top: 1rem; }
/* On a narrow phone the max-content label column squeezes the value; stack them. */
@media (max-width: 26rem) { dl { grid-template-columns: 1fr; gap: .1rem 0; } dt { margin-top: .5rem; } }
.hint { color: var(--muted); font-size: .9rem; margin: 0 0 .6rem; }
#model-status:empty, #image-status-line:empty { display: none; }
#model-status, #image-status-line { margin: .35rem 0 0; font-size: .9rem; }
input { width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
button { font: inherit; padding: .5rem .9rem; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#status { min-height: 1.5rem; margin: .75rem 0 0; }
.mem-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.mem-row span { overflow-wrap: anywhere; font-size: .9rem; }
.mem-del { padding: .25rem .6rem; font-size: .85rem; flex: none; }
a { color: var(--accent); }
[hidden] { display: none !important; }
/* ADR-031 B: the moderation workspace. Member settings keep their centred 34rem column; staff
   switch between that and a full-width workspace with three tabs. Wide screens get split views
   (a list beside what you picked); below 56rem everything stacks into one column. */
main { max-width: 76rem; }
.top, #anon, #me { max-width: 34rem; margin-left: auto; margin-right: auto; }
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.top h1 { margin: 0; }
body.staff-view .top { max-width: none; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; } h3 { font-size: .95rem; margin: 1.1rem 0 .4rem; color: var(--muted); font-weight: 600; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.segmented button { border: 0; background: transparent; padding: .4rem .95rem; border-radius: 6px; color: var(--muted); font-weight: 600; }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--accent); color: #fff; }
/* The page switch is secondary to the work tabs: selected is a raised neutral chip, not the accent. */
.segmented.quiet { background: transparent; } .segmented.quiet button { padding: .3rem .8rem; font-size: .9rem; }
.segmented.quiet button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.staff-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; margin-bottom: 1rem; }
.access-line { margin: 0; color: var(--muted); font-size: .92rem; }
.warn { color: var(--err); font-weight: 600; }
.split { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
.split > .card { margin: 0; min-width: 0; }
@media (min-width: 56rem) {
  .split { grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr); }
  .list-pane, .side-pane { position: sticky; top: 1rem; }
  .split.wide-list { grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem); }  /* Channels: the table is the work. */
}
.inline-row { margin-top: 0; flex-wrap: nowrap; } .inline-row input { flex: 1; min-width: 0; }
.list-pane .hint { margin: .5rem 0 0; }
.picks { display: grid; gap: .35rem; margin-top: .75rem; }
.pick { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem .75rem; width: 100%; text-align: left; padding: .55rem .75rem; margin: 0; }
.pick .id, .pick .meta { color: var(--muted); font-size: .85rem; } .pick .meta { grid-column: 1 / -1; }
.pick[aria-current="true"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.detail-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; font-size: .9rem; }
.facts { margin-bottom: 1rem; }
.actions { display: grid; gap: .6rem; margin: .25rem 0; }
.action { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: .2rem .9rem; align-items: baseline; }
.action button { width: 100%; } .action p { margin: 0; color: var(--muted); font-size: .9rem; } .action.off p { color: var(--ink); }
button.danger { border-color: var(--err); color: var(--err); } button:disabled { opacity: .5; cursor: default; }
.result-line { min-height: 1.4rem; margin: .6rem 0 0; font-weight: 600; }
.side-pane .action { grid-template-columns: 1fr; } .side-pane .action button { width: auto; justify-self: start; }
.plain { list-style: none; margin: 0; padding: 0; } .plain li { padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; overflow-wrap: anywhere; }
.plain li:last-child { border-bottom: 0; } .plain time { color: var(--muted); font-size: .85rem; margin-left: .4rem; }
#channel-filter { margin-bottom: .6rem; }
.channels, .feed { width: 100%; border-collapse: collapse; font-size: .92rem; }
.channels th, .feed th { text-align: left; font-weight: 600; color: var(--muted); padding: .4rem .75rem .4rem 0; border-bottom: 1px solid var(--line); }
.channels td, .feed td { padding: .5rem .75rem .5rem 0; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.channels tbody tr { cursor: pointer; } .channels tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.channels tr[aria-selected="true"] td { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.channels td:first-child { padding-left: .5rem; } .channels .category { display: none; color: var(--muted); font-size: .82rem; }
.channels .cat { color: var(--muted); } .channels td { white-space: nowrap; } .channels td:last-child { white-space: normal; }
.channels .state { color: var(--muted); font-size: .85rem; } .channels .state.mine { color: var(--accent); font-weight: 600; }
.feed td:first-child { white-space: nowrap; color: var(--muted); } .feed tr:last-child td { border-bottom: 0; }
.feed .via { display: block; color: var(--muted); font-size: .8rem; } .feed .pending { color: var(--err); }
.feed button.link { font-size: inherit; text-align: left; }
@media (max-width: 40rem) {   /* Phones: tabs fill the width; each feed entry becomes a short labelled block. */
  .staff-bar .segmented { width: 100%; } .staff-bar .segmented button { flex: 1; padding: .45rem .5rem; }
  .feed thead { display: none; } .feed tr { display: block; padding: .5rem 0; border-bottom: 1px solid var(--line); }
  .feed td { display: block; border: 0; padding: .05rem 0; } .feed td::before { content: attr(data-label) ": "; color: var(--muted); }
  .feed td:first-child::before { content: none; }
  .action { grid-template-columns: 1fr; }
  .channels .cat { display: none; } .channels .category { display: block; } .channels td:first-child { white-space: normal; }
}
/* ADR-031 C3: My settings. Phones keep the single column; from 56rem the page shows what matters
   at a glance, a model browser in the wide column, and account, keys and images beside it. */
.desk-only { display: none; }
h2.section { font-size: 1rem; margin: 1.4rem 0 .4rem; } .mem-head h2.section { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; padding: 0 .25rem; border-radius: 4px; background: color-mix(in srgb, var(--muted) 14%, transparent); }
button.danger { border-color: var(--err); color: var(--err); }
.key-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.key-row .when { display: block; color: var(--muted); font-size: .85rem; } .key-row button { padding: .3rem .7rem; font-size: .88rem; flex: none; }
.glance { display: none; }
.mem-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem 1rem; margin-bottom: .75rem; }
#mem-q { max-width: 18rem; }
.mem-cols h3 { margin-top: 1rem; }
@media (min-width: 56rem) {
  .top, #me { max-width: 76rem; }
  .phone-only { display: none !important; } .desk-only { display: block; }
  .glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
  .tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .85rem 1.1rem; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
  .tile .k { color: var(--muted); font-size: .85rem; } .tile strong { font-weight: 600; overflow-wrap: anywhere; } .tile .muted { font-size: .88rem; }
  .settings-grid { display: grid; gap: 1rem; align-items: start; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
                   grid-template-areas: "chat chat" "account image" "memory memory"; }   /* 56-72rem: the browser gets the full width. */
  .settings-grid > .card { margin: 0; min-width: 0; }
  .chat-card { grid-area: chat; } .account-card { grid-area: account; } #imagecard { grid-area: image; } #memcard { grid-area: memory; }
  .account-card dl, #imagecard dl { grid-template-columns: 1fr; gap: .05rem 0; } .account-card dt, #imagecard dt { margin-top: .45rem; }  /* Narrow column: label over value. */
  .chat-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(12rem, 16rem); gap: 1.5rem; align-items: start; }
  #recent-wrap { border-left: 1px solid var(--line); padding-left: 1.25rem; }
  .filters { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
  .filters input[type="search"] { flex: 1 1 14rem; width: auto; }
  .filters select { font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
  .filters .check { display: inline-flex; align-items: center; gap: .35rem; font-weight: 400; margin: 0; }
  .filters .check input { width: auto; }
  .table-wrap { max-height: min(72vh, 46rem); overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin: .75rem 0 .5rem; }
  .models { width: 100%; border-collapse: collapse; font-size: .9rem; }
  .models th { position: sticky; top: 0; z-index: 1; background: var(--card); border-bottom: 1px solid var(--line); padding: 0; text-align: left; }
  .models th:first-child { min-width: 12rem; } .models th button { white-space: nowrap; width: 100%; border: 0; border-radius: 0; background: none; padding: .55rem .45rem; font-weight: 600; color: var(--muted); text-align: inherit; }
  .models th[aria-sort] button { color: var(--ink); }
  .models th[aria-sort="ascending"] button::after { content: " \2191"; } .models th[aria-sort="descending"] button::after { content: " \2193"; }
  .models th.num, .models td.num { text-align: right; } .models td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
  .models td { padding: .45rem .45rem; border-bottom: 1px solid var(--line); vertical-align: top; }
  .models tbody tr { cursor: pointer; } .models tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
  .models tr[aria-selected="true"] td { background: color-mix(in srgb, var(--accent) 14%, transparent); }
  .models tr.pinned td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
  .models .mname { display: block; font-weight: 600; } .models .mid { display: block; color: var(--muted); font-size: .8rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
  .models .tag { display: inline-block; margin: .15rem .3rem 0 0; font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 .45rem; }
  .models .tag.yours { color: var(--accent); border-color: var(--accent); } .models .na { color: var(--muted); }
  .mem-counts { grid-template-columns: repeat(4, max-content max-content); gap: .2rem 1rem; }
  .mem-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
  .mem-cols .list { max-height: 22rem; overflow: auto; }
}
@media (min-width: 72rem) {
  .settings-grid { grid-template-columns: minmax(0, 1fr) minmax(17rem, 21rem); grid-template-areas: "chat account" "chat image" "memory memory"; }
}
/* ADR-031 C2: Content, for named admins. The panel's editors bring their own layout (/editors.css);
   here they sit in cards, and the page's general form rules are scoped back for their controls. */
.help { color: var(--muted); font-size: .9rem; margin: 0 0 .75rem; }
.content-note { max-width: 62rem; }
#content .card { margin-bottom: 1rem; } #content .card > h3:first-child { margin-top: 0; }
#content h3 { color: var(--ink); font-size: 1rem; }
#content label { font-weight: 600; font-size: .92rem; } #content input, #content textarea, #content select { font-weight: 400; }
#content .lore-layout { align-items: start; }
#content [role=group] label, #content label.inline, #content .h-choice label { font-weight: 400; }
#content input[type=radio], #content input[type=checkbox] { width: auto; padding: 0; margin: 0 .35rem 0 0; }
#content input[type=number], #content select { max-width: 16rem; }
#content select[size], #content #lore-bulk-target { max-width: none; }
#content textarea { width: 100%; font: inherit; font-weight: 400; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
#content textarea:focus, #content select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
#content dl { display: grid; } #content dd { font-family: inherit; font-size: .9rem; } #content dt { color: inherit; }
#content #prompts-section, #content #prompt-global-section, #content #prompt-channels-section { max-width: none; }
#content pre { white-space: pre-wrap; overflow-wrap: anywhere; }
#content button { margin: .2rem .4rem .2rem 0; } #content #prompt-save, #content #lore-editor-save { background: var(--accent); border-color: var(--accent); color: #fff; }
.placement { display: grid; gap: 0 1rem; }
@media (min-width: 56rem) {
  .placement { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
@media (min-width: 88rem) {   /* Wide screens: the prompt editor and its history side by side. */
  body.content-view main { max-width: 96rem; }
  #content .editor-with-history { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
  #content .editor-with-history > section h3 { margin-top: 0; }
}
@media (max-width: 40rem) {   /* Phones: the editors' explanations fold (user.js), the face list repeats the selector, the persona box scrolls. */
  #content .tabs { flex-wrap: wrap; } #content .card { padding: 1rem; }
  #content #prompt-faces { display: none; } #content #cp-system-prompt { max-height: 40vh; }
  #content #prompt-list { max-height: 6.5rem; }
}

/* ADR-031 amendment: Content > Turns, Changes and Lore usage. Turns is a master-detail split on wide
   screens: a compact one-line list (when, where, who, icons, outcome) beside the selected turn, each
   sticky and scrolling on its own; a phone shows the list, and a picked turn replaces it with Back. */
.filters-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; margin: 0; }
#content .filters-row label.inline { display: inline-flex; align-items: center; gap: .3rem; margin: 0; font-size: .9rem; }
.turns-split { display: grid; gap: 1rem; align-items: start; }
.turns-split > .card { margin: 0; min-width: 0; }
.turn-list { list-style: none; margin: 0 -.5rem; padding: 0; }
.turn-list li { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr) auto 2.8rem; gap: .45rem; align-items: baseline; padding: .42rem .5rem; border-bottom: 1px solid var(--line); cursor: pointer; font-size: .9rem; }
.turn-list li:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.turn-list li[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.turn-list time { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.turn-list .who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .turn-list .where { font-weight: 600; } .turn-list .trigger { color: var(--muted); }
.turn-list .ics { display: inline-flex; gap: .35rem; white-space: nowrap; }
.ic { font-size: .82rem; color: var(--muted); } .ic.failed, .ic.limited, .ic.lore.drop { color: var(--err); } .ic.lore { color: var(--accent); }
.turn-list .outcome { text-align: right; font-size: .78rem; font-weight: 600; color: var(--muted); } .turn-list .outcome.bad { color: var(--err); }
.turn-list:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pager { align-items: center; } .pager .muted { font-size: .85rem; }
#turn-detail .head, #turn-detail .line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .6rem; min-width: 0; }
#turn-detail .head time { color: var(--muted); font-size: .85rem; } #turn-detail .where { font-weight: 600; } #turn-detail .trigger { color: var(--muted); }
#turn-detail .outcome { margin-left: auto; font-size: .82rem; font-weight: 600; color: var(--muted); } #turn-detail .outcome.bad { color: var(--err); }
#turn-detail .line { margin-top: .35rem; font-size: .9rem; } .tags { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.tg { font-size: .75rem; line-height: 1.5; padding: 0 .5rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--card); overflow-wrap: anywhere; }
.tg.lore { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.tg.bad { color: var(--err); border-color: var(--err); background: color-mix(in srgb, var(--err) 10%, transparent); }
.tg.warn { color: var(--err); border-color: var(--err); }
.turn-body { padding-top: .1rem; } .turn-body .k { color: var(--muted); }
.turn-body .meta { margin: .6rem 0 .4rem; font-size: .9rem; } .turn-body .model { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.toollist { list-style: none; margin: .4rem 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.toollist .tool { padding: .4rem .6rem; border-left: 3px solid var(--line); background: var(--bg); border-radius: 0 6px 6px 0; min-width: 0; }
.toollist .tool.bad { border-left-color: var(--err); }
.toollist .thead { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; } .toollist .tname { font-weight: 600; }
.toollist .tstatus { color: var(--err); font-size: .82rem; font-weight: 600; }
.toollist .tms { margin-left: auto; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }   /* timings line up on the right */
.flag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--err); border: 1px solid var(--err); border-radius: 4px; padding: 0 .3rem; }
.toollist .d { font-size: .85rem; margin-top: .25rem; overflow-wrap: anywhere; } .toollist .d .k { margin-right: .4rem; }
.toollist .thought { white-space: pre-wrap; overflow-wrap: anywhere; margin: .35rem 0 0; padding: .5rem .6rem; background: var(--card); border: 1px solid var(--line); border-radius: 6px; font-family: inherit; font-size: .88rem; line-height: 1.5; }
.toollist .thought.fold:not(.open) { max-height: 7.5em; overflow: hidden; mask-image: linear-gradient(#000 60%, transparent); }   /* a long thought shows a few lines until Show all */
.toollist button.more { margin: .2rem 0 0; font-size: .85rem; }
.lorerow { margin: .35rem 0 0; font-size: .88rem; } .lorerow .k { color: var(--muted); margin-right: .4rem; }
.usage-row { align-items: center; margin-top: 0; } #content .usage-row label { margin: 0; }
.usage-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.modlist { list-style: none; margin: .3rem 0 0; padding: 0; }
.modlist li { display: flex; flex-wrap: wrap; gap: .1rem .5rem; padding: .3rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; overflow-wrap: anywhere; }
.modlist li:last-child { border-bottom: 0; } .modlist .mt { color: var(--muted); flex: 1 1 auto; min-width: 0; }
.modlist .n { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (min-width: 56rem) {
  .turns-split { grid-template-columns: minmax(20rem, 26rem) minmax(0, 1fr); }
  .turn-list-pane { position: sticky; top: 1rem; display: flex; flex-direction: column; max-height: calc(100vh - 2rem); }
  .turn-list { flex: 1 1 auto; min-height: 0; overflow: auto; }
  .turn-detail-pane { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
}
@media (max-width: 56rem) {   /* Phones: one pane at a time. A picked turn replaces the list; Back returns. */
  .turns.detail-open .turns-top, .turns.detail-open .turn-list-pane { display: none; }
  .turns:not(.detail-open) .turn-detail-pane { display: none; }
  #turn-back { margin-bottom: .6rem; }
  .usage-cols { grid-template-columns: 1fr; }
}
