/* owlhost admin panel. Same dark, monochrome language as the client area (tokens in base.css).
   Status is shown by shape (diamonds), never by colour. */

body.admin { flex-direction: row; min-height: 100vh; }
.admin a { text-decoration: none; }
.admin .mono { font-family: var(--font-mono); }
.admin .muted { color: var(--text-muted); }
.admin .dim { color: var(--text-dim); }

/* ---------- shell ---------- */
.side {
  position: sticky; top: 0; align-self: flex-start; height: 100vh; width: 248px; flex: none;
  display: flex; flex-direction: column; gap: 24px; padding: 22px 16px 18px;
  background: #0b0b0d; border-right: 1px solid var(--line-1); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.brand-owl { width: 38px; height: 30px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 500; font-size: 18px; letter-spacing: -.01em; }
.brand-tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; color: var(--text-muted); display: block; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 10px;
  font-size: 14px; color: var(--text-prose); border-radius: 3px; transition: background .2s, color .2s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.nav .pip { width: 6px; height: 6px; flex: none; background: transparent; border: 1px solid var(--line-5); transform: rotate(45deg); }
.nav a[aria-current="page"] .pip { background: var(--text); border-color: var(--text); }
.nav .count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; padding: 1px 7px; border: 1px solid var(--line-5); border-radius: 99px; color: var(--text); }
.nav-sep { height: 1px; background: var(--line-1); margin: 8px 6px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.api-state { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 3px; font-size: 12px; }
.api-state b { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.api-state small { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px; }
.me-text { display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; min-width: 0; }
.me-text small { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; color: var(--text-muted); }
.me form { margin-left: auto; flex-shrink: 0; }
.link-btn { background: none; border: 0; padding: 4px; color: var(--text-muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--text); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px var(--gutter-app); border-bottom: 1px solid var(--line-1); }
.crumbs { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); min-width: 0; }
.crumbs a { color: var(--text-muted); } .crumbs a:hover { color: var(--text); }
.crumbs .sep { width: 1px; height: 12px; background: var(--line-4); transform: rotate(20deg); }
.top-tools { display: flex; align-items: center; gap: 12px; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-3); border-radius: 3px; padding: 0 12px; min-height: 40px; }
.search input { background: none; border: 0; outline: 0; width: 220px; font-size: 14px; }
.search:focus-within { border-color: var(--text); }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px var(--gutter-app); border-bottom: 1px solid var(--line-4); background: var(--surface-2); font-size: 14px; }
.content { flex: 1; padding: 28px var(--gutter-app) 40px; display: flex; flex-direction: column; gap: 24px; max-width: 1280px; width: 100%; }
.foot { display: flex; justify-content: space-between; gap: 12px; padding: 16px var(--gutter-app); border-top: 1px solid var(--line-1); font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }

/* ---------- page heads, panels ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 6px 0 0; font-family: var(--font-display); font-weight: 500; font-size: clamp(26px, 3vw, 34px); letter-spacing: -.02em; }
.page-head p { margin: 6px 0 0; color: var(--text-muted); font-size: 14.5px; max-width: 60ch; }
.panel { border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface); display: flex; flex-direction: column; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.panel-head h2 { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 18px; }
.panel-body { padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.panel-foot { display: flex; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line-1); font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.counter { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border: 1px solid var(--line-2); border-radius: 4px; transition: background .2s, border-color .2s; }
.counter.is-hot { border-color: var(--line-4); }
.counter:hover { background: var(--surface-2); }
.counter small { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.counter b { font-family: var(--font-display); font-weight: 500; font-size: 34px; line-height: 1; }
.counter span { font-size: 13px; color: var(--text-muted); }

/* rows: a list line with a link look */
.rows { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--line-1); min-width: 0; transition: background .2s; }
.item:first-child { border-top: 0; }
a.item:hover { background: var(--surface-2); }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item-title { font-size: 14.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sub { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-end { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.item-kind { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); min-width: 84px; }
.empty { padding: 28px 20px; color: var(--text-muted); font-size: 14px; }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 400; padding: 10px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.table td { padding: 12px 14px; border-top: 1px solid var(--line-1); vertical-align: middle; }
.table tr:first-child td { border-top: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table a.row-link { color: var(--text); }
.table-wrap { overflow-x: auto; }

/* chips, pills, filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border: 1px solid var(--line-4); border-radius: 99px; font-size: 13px; color: var(--text-prose); background: transparent; transition: border-color .2s, background .2s, color .2s; }
.chip:hover { border-color: var(--text-muted); }
.chip[aria-pressed="true"], .chip.is-on { background: var(--text); color: var(--bg); border-color: var(--text); }
.pill { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.pill.is-dim { color: var(--text-dim); }
.tag.is-solid { background: var(--text); color: var(--bg); border-color: var(--text); }
.bar-meter { width: 72px; height: 4px; background: var(--line-2); border-radius: 2px; overflow: hidden; display: inline-block; vertical-align: middle; }
.bar-meter i { display: block; height: 100%; background: var(--text-dim); width: var(--w, 0%); }
.bar-meter.is-high i { background: var(--text); }

/* key / value */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
.kv dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); padding-top: 2px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form label.label { display: block; margin-bottom: 8px; }
.form .hint { font-size: 12.5px; color: var(--text-muted); margin: 6px 0 0; }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
textarea.field { resize: vertical; min-height: 110px; line-height: 1.5; }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.field-sm { min-height: 40px; padding: 0 12px; font-size: 14px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.btn-danger:hover { background: var(--text); color: var(--bg); }
.btn.is-armed { background: var(--text); color: var(--bg); border-color: var(--text); }
.seg { display: inline-flex; border: 1px solid var(--line-4); border-radius: 3px; overflow: hidden; }
.seg button { background: none; border: 0; border-right: 1px solid var(--line-4); padding: 0 14px; min-height: 36px; font-size: 13px; color: var(--text-muted); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

/* audience picker (news, maintenance) */
.picker { display: flex; flex-direction: column; gap: 10px; }
.picker .hint { margin: 0; }
.picked { display: flex; flex-wrap: wrap; gap: 8px; }
.token { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 6px 0 12px; border: 1px solid var(--line-5); border-radius: 99px; font-size: 13px; }
.token small { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em; color: var(--text-muted); }
.token button { background: none; border: 0; color: var(--text-muted); width: 24px; height: 24px; border-radius: 50%; }
.token button:hover { color: var(--text); background: var(--surface-2); }
.suggest { position: relative; }
.suggest-list { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); background: #0d0d0f; border: 1px solid var(--line-4); border-radius: 3px; max-height: 260px; overflow: auto; }
.suggest-list button { display: flex; justify-content: space-between; gap: 12px; width: 100%; background: none; border: 0; text-align: left; padding: 10px 14px; font-size: 14px; border-top: 1px solid var(--line-1); }
.suggest-list button:first-child { border-top: 0; }
.suggest-list button:hover { background: var(--surface-2); }
.suggest-list small { color: var(--text-muted); }

/* requests board */
.board { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.col-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px; font-size: 13px; }
.col-head b { font-weight: 500; }
.col-head small { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface); transition: background .2s, border-color .2s; }
.card.is-us { border-color: var(--line-5); }
.card:hover { background: var(--surface-2); }
.card-title { font-size: 15px; color: var(--text); }
.card-sub { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.col-empty { padding: 14px; border: 1px dashed var(--line-2); border-radius: 4px; font-size: 12.5px; color: var(--text-dim); }

/* step switch on a request */
.steps { display: flex; flex-wrap: wrap; gap: 8px; }
.steps button { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line-3); border-radius: 3px; background: transparent; font-size: 13.5px; color: var(--text-muted); }
.steps button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.steps button.is-past { color: var(--text); background: var(--surface-2); }

/* kpis and charts */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 4px; display: flex; flex-direction: column; gap: 6px; }
.kpi small { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.kpi b { font-family: var(--font-display); font-weight: 500; font-size: 24px; }
.kpi span { font-size: 12.5px; color: var(--text-muted); }
.chart { width: 100%; height: 120px; display: block; }
.chart polyline { fill: none; stroke: var(--text); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart .grid { stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart text { fill: var(--text-dim); font-family: var(--font-mono); font-size: 9px; }
.days { display: flex; gap: 2px; height: 22px; }
.days i { flex: 1; background: var(--line-5); border-radius: 1px; }
.days i.is-low { background: var(--text-muted); }
.days i.is-none { background: var(--line-1); }
.hexrow { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 4px; }
.hexrow i { width: 22px; height: 24px; background: var(--line-5); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.hexrow i.is-slow { background: var(--text-muted); }
.hexrow i.is-down { background: var(--text); }
.hexrow i.is-none { background: var(--line-1); }

/* chat */
.chat { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; border: 1px solid var(--line-2); border-radius: 4px; min-height: 560px; background: var(--surface); }
.chat-list { border-right: 1px solid var(--line-2); display: flex; flex-direction: column; min-width: 0; }
.chat-list .filters { padding: 14px; border-bottom: 1px solid var(--line-1); }
.thread-link { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-1); border-left: 2px solid transparent; }
.thread-link.is-open { background: var(--surface-2); border-left-color: var(--text); }
.thread-link:hover { background: var(--surface-2); }
.thread-link .item-title { font-weight: 400; }
.thread-link.is-unread .item-title { font-weight: 500; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-1); flex-wrap: wrap; }
.chat-flow { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 12px; overflow: auto; max-height: 56vh; }
.bubble { max-width: 76%; display: flex; flex-direction: column; gap: 4px; }
.bubble.is-admin { align-self: flex-end; align-items: flex-end; }
.bubble small { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); }
.bubble p { margin: 0; padding: 10px 14px; border: 1px solid var(--line-3); border-radius: 4px; font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.is-admin p { background: var(--text); color: var(--bg); border-color: var(--text); }
.bubble.is-system p { border-style: dashed; color: var(--text-muted); font-size: 13px; }
.chat-reply { padding: 16px 20px; border-top: 1px solid var(--line-1); display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 960px) { .chat { grid-template-columns: 1fr; } .chat-list { border-right: 0; border-bottom: 1px solid var(--line-2); max-height: 280px; overflow: auto; } }

/* misc */
.copybox { display: flex; gap: 10px; align-items: flex-start; }
.code { flex: 1; margin: 0; padding: 14px 16px; background: #08080a; border: 1px solid var(--line-3); border-radius: 3px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; overflow: auto; white-space: pre; }
.note { padding: 12px 14px; border: 1px solid var(--line-3); border-left: 2px solid var(--text); border-radius: 3px; font-size: 14px; line-height: 1.5; }
.timeline { list-style: none; margin: 0; padding: 0 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.timeline li { display: flex; gap: 14px; font-size: 14px; }
.timeline time { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); min-width: 84px; padding-top: 2px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: 360px; padding: 12px 16px; background: var(--text); color: var(--bg); border-radius: 3px; font-size: 14px; }
.toast.is-error { background: #0d0d0f; color: var(--text); border: 1px solid var(--text); }
.qr-grid { width: 176px; height: 176px; padding: 10px; background: var(--text); display: grid; grid-template-columns: repeat(var(--n, 29), minmax(0, 1fr)); }
.qr-grid span.is-on { background: var(--bg); }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-family: var(--font-mono); font-size: 14px; }
.codes span.is-used { color: var(--text-dim); text-decoration: line-through; }

/* sign-in pages (no sidebar) */
body.admin-plain { flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 20px; }
.plain-card { width: min(440px, 100%); display: flex; flex-direction: column; gap: 18px; padding: 28px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface); }
.plain-card h1 { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 28px; letter-spacing: -.02em; }
.plain-owl { width: 120px; }

@media (max-width: 860px) {
  body.admin { flex-direction: column; }
  .side { position: static; width: 100%; height: auto; flex-direction: column; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .top { flex-wrap: wrap; }
  .search input { width: 140px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) { .counter, .card, .chip, .nav a { transition: none; } }
.plain-foot { margin: 0; font-size: 11px; }
.brand-owl-plain { margin-bottom: 4px; }

/* small helpers (the CSP forbids style="..." in the templates) */
.admin .m0 { margin: 0; }
.admin .small { font-size: 14px; }
.admin .smaller { font-size: 13px; }
.admin .pre { white-space: pre-wrap; }
.admin .stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.admin .contents { display: contents; }
.admin .self-center { align-self: center; }
.admin .p0 { padding: 0; }
.admin .w-260 { max-width: 260px; }
.admin .steps-list { padding-left: 20px; line-height: 1.7; }
.admin .cols-1-2 { grid-template-columns: 1fr 2fr; }
@media (max-width: 1100px) { .admin .cols-1-2 { grid-template-columns: 1fr; } }
.admin .copybox { display: flex; gap: 10px; align-items: flex-start; }

tr[data-href] { cursor: pointer; }
.panel-dashed { border-style: dashed; }
.chat-tools { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.seg-wrap { flex-wrap: wrap; }
.seg-wrap button { border-bottom: 1px solid var(--line-4); }

textarea.field { min-height: 88px; max-height: 420px; }

/* Inbox: fixed height, the list and the conversation scroll inside */
.chat { height: clamp(520px, calc(100vh - 230px), 760px); min-height: 0; grid-template-rows: minmax(0, 1fr); }
.chat-list { min-height: 0; overflow-y: auto; }
.chat-main { min-height: 0; overflow: hidden; }
.chat-flow { flex: 1 1 0; min-height: 0; max-height: none; overflow-y: auto; }
@media (max-width: 960px) {
  .chat { height: auto; grid-template-rows: none; }
  .chat-list { height: 240px; max-height: none; }
  .chat-main { height: 70vh; min-height: 460px; }
}
.notes-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Inbox: a wider list, three lines per conversation */
.chat { grid-template-columns: minmax(340px, 460px) 1fr; }
.thread-link { align-items: flex-start; }
.thread-link .diamond { margin-top: 7px; }
.thread-sub { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; color: var(--text-prose); }
.thread-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-link .item-end { padding-top: 2px; }
@media (max-width: 960px) { .chat { grid-template-columns: 1fr; } }

.panel-head-right { display: flex; align-items: baseline; gap: 14px; }

.chat-search { padding: 14px 14px 0; }
.chat-search .field { width: 100%; }

/* the log */
.log-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-row { display: grid; grid-template-columns: 92px 1fr; gap: 16px; padding: 13px 20px; border-top: 1px solid var(--line-1); }
.log-row:first-child { border-top: 0; }
.log-time { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--text-muted); }
.log-time .mono { font-size: 11px; color: var(--text-dim); }
.log-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.log-line { font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.log-who { display: inline-flex; align-items: baseline; gap: 8px; margin-right: 4px; }
.log-who b { font-weight: 500; }
.log-who small { box-sizing: border-box; width: 62px; text-align: center; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em; padding: 1px 0; border: 1px solid var(--line-5); border-radius: 99px; color: var(--text-muted); }
.log-who.is-admin small { background: var(--text); color: var(--bg); border-color: var(--text); }
.log-ctx { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip-link { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); border-bottom: 1px dotted var(--line-5); }
.chip-link:hover { color: var(--text); }
.panel-foot a { color: var(--text); }
.panel-head-link { font-family: var(--font-mono); font-size: 12px; }
@media (max-width: 640px) { .log-row { grid-template-columns: 1fr; gap: 4px; } .log-time { flex-direction: row; gap: 8px; } }

/* log rows: one line - who and what on the left, the context on the right (wraps below on a narrow screen) */
.log-row { align-items: center; }
.log-main { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 20px; }
.log-line { flex: 1 1 320px; min-width: 0; }
.log-ctx { flex: 0 1 auto; justify-content: flex-end; white-space: nowrap; }
.log-ctx .tag { margin: 0; }
@media (max-width: 900px) { .log-ctx { white-space: normal; justify-content: flex-start; } }

.pill.is-dim .diamond, .api-state .diamond.is-outline { border-color: var(--text-dim); }
.api-state b { gap: 10px; }


/* Overview only: the boxes of a row are the same height, a shorter one has its footer at the bottom */
.overview-grid { align-items: stretch; }
.overview-grid > .panel > .panel-foot { margin-top: auto; }

/* Overview only: a short list of the log, one tidy line of text (two at most) per entry */
.log-row.is-short { grid-template-columns: 74px 1fr; gap: 12px; padding: 11px 20px; align-items: center; }
.log-row.is-short .log-main { display: block; }
.log-row.is-short .log-line { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; overflow: hidden; }
.log-with { margin-left: 8px; color: var(--text-dim); font-size: 12.5px; }

/* Your account: the boxes of a row are the same height, the buttons sit at the bottom */
.account-grid { align-items: stretch; }
.account-grid > .panel > .panel-body:not(.scan) { flex: 1; }
.account-grid > .panel > .panel-body:not(.scan) .form-actions { margin-top: auto; }
.item-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.item-title .tag { margin-left: 6px; vertical-align: 1px; }
.panel-body.scan { border-top: 1px solid var(--line-1); padding-top: 16px; }

/* the small password question */
.pw-dialog { width: min(420px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-4); border-radius: 4px; background: var(--surface); color: var(--text); }
.pw-dialog::backdrop { background: rgba(0, 0, 0, .7); }
.pw-form { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.pw-question { margin: 0; font-size: 15px; line-height: 1.5; }
.pw-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* Logs: the filter */
.log-filters { display: flex; flex-direction: column; gap: 14px; margin: 0 0 16px; padding: 16px 18px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface); }
.log-filters-top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.log-filters-top .filters { margin: 0; }
.log-chips { display: flex; flex-wrap: wrap; gap: 12px 24px; flex: 1 1 100%; }
.log-order { width: 170px; }
.log-search { flex: 1 1 240px; min-width: 0; }
.log-filters-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
@media (max-width: 760px) { .log-filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.log-filters-grid .label { display: block; margin-bottom: 6px; }
.log-filters-grid .field { width: 100%; }
.log-filters-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line-1); }
.log-filters-foot .filters { margin: 0; }
.head-end { display: flex; align-items: center; gap: 14px; }

.counter b i { font-style: normal; font-size: 20px; color: var(--text-muted); margin-left: 2px; }

/* a form box that has no head: the same room at the top as everywhere else */
.panel-body.panel-body-full { padding-top: 20px; }

/* the generated ids: small, mono, quiet */
.id-chip { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); letter-spacing: .02em; }
.chip-link .id-chip { margin-left: 4px; }
.log-combo .suggest-list { z-index: 20; }
.log-combo .field { width: 100%; }

/* clients of a new service: the chosen ones sit in the same row as the search, inside one field */
.token-field { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 10px; cursor: text; }
.token-field:focus-within { border-color: var(--text); }
.token-field .picked { display: contents; }
.token-field .token { min-height: 30px; }
.token-field input { flex: 1 1 140px; min-width: 120px; min-height: 32px; background: none; border: 0; outline: none; color: var(--text); font: inherit; font-size: 15px; padding: 0 4px; }
.token-field input::placeholder { color: var(--text-dim); }

/* log rows as a table: time | role | name | id | what | context. Every column starts at the same place in every row. */
.log-row:not(.is-short) { grid-template-columns: 68px 66px minmax(70px, 140px) 76px minmax(0, 1fr) auto; gap: 12px; }
.log-row:not(.is-short) .log-main, .log-row:not(.is-short) .log-line, .log-row:not(.is-short) .log-who { display: contents; }
.log-row:not(.is-short) .log-who small { justify-self: start; }
.log-row:not(.is-short) .log-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-row:not(.is-short) .log-text { min-width: 0; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.5; }
.log-row:not(.is-short) .log-ctx { justify-self: end; }
@media (max-width: 760px) {
  .log-row:not(.is-short) { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
  .log-row:not(.is-short) .log-time { flex-direction: row; gap: 8px; flex-basis: 100%; }
  .log-row:not(.is-short) .log-text { flex-basis: 100%; }
}

/* the context chips may wrap on their own, and a narrow box puts them under the text instead of beside it */
.log-row:not(.is-short) .log-ctx { max-width: 380px; white-space: normal; }
.log-row:not(.is-short) .log-ctx > * { white-space: nowrap; }
.chip-link .id-chip { margin-left: 8px; }
.log-list-narrow .log-row:not(.is-short) { grid-template-columns: 68px 66px minmax(70px, 130px) 74px minmax(0, 1fr); row-gap: 4px; }
.log-list-narrow .log-row:not(.is-short) .log-ctx { grid-column: 5; justify-self: start; max-width: none; }
.log-list-narrow .log-row:not(.is-short) .log-ctx:empty { display: none; }

/* the right edge: the kind and the "open" link have their own columns; the client / service / id chips sit under the text in one line */
.log-row:not(.is-short) { grid-template-columns: 68px 66px minmax(70px, 140px) 76px minmax(0, 1fr) 100px 52px; row-gap: 6px; }
.log-row:not(.is-short) .log-kind, .log-row:not(.is-short) .log-open { justify-self: end; }
.log-row:not(.is-short) .log-ctx { grid-column: 5 / -1; justify-self: start; justify-content: flex-start; max-width: none; gap: 6px 16px; }
.log-row:not(.is-short) .log-ctx:empty { display: none; }
.log-list-narrow .log-row:not(.is-short) { grid-template-columns: 68px 66px minmax(70px, 130px) 74px minmax(0, 1fr); }
@media (max-width: 760px) { .log-row:not(.is-short) .log-ctx, .log-row:not(.is-short) .log-kind, .log-row:not(.is-short) .log-open { flex-basis: auto; justify-self: auto; } .log-row:not(.is-short) .log-ctx { flex-basis: 100%; } }

/* log rows, final: every row is one line of the same height. The context column shows one chip, the kind is the link. */
.tag-link { transition: background .2s, color .2s; }
.tag-link:hover { background: var(--surface-2); color: var(--text); }
.log-row:not(.is-short) { grid-template-columns: 68px 66px minmax(70px, 140px) 76px minmax(0, 1fr) 210px 110px; row-gap: 0; }
.log-row:not(.is-short) .log-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-row:not(.is-short) .log-ctx { display: block; grid-column: auto; justify-self: stretch; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-row:not(.is-short) .log-ctx:empty { display: block; }
.log-row:not(.is-short) .log-ctx > * { display: inline; }
.log-row:not(.is-short) .log-kind { justify-self: end; }
/* the narrow box (a client's page): the text may wrap, the chip goes under it */
.log-list-narrow .log-row:not(.is-short) { grid-template-columns: 68px 66px minmax(70px, 130px) 74px minmax(0, 1fr); row-gap: 4px; }
.log-list-narrow .log-row:not(.is-short) .log-text { white-space: normal; }
.log-list-narrow .log-row:not(.is-short) .log-ctx { grid-column: 5; }
.log-list-narrow .log-row:not(.is-short) .log-ctx:empty { display: none; }
@media (max-width: 760px) { .log-row:not(.is-short) .log-ctx { flex-basis: 100%; } .log-row:not(.is-short) .log-text { white-space: normal; flex-basis: 100%; } }
.log-row:not(.is-short) { grid-template-columns: 68px 66px minmax(70px, 120px) 72px minmax(0, 1fr) 190px 100px; }
.log-list-narrow .log-row:not(.is-short) { grid-template-columns: 68px 66px minmax(70px, 130px) 74px minmax(0, 1fr); row-gap: 0; }
.log-list-narrow .log-row:not(.is-short) .log-ctx { display: none; }

/* log rows: the clickable things (client, service, request ...) side by side in one column, the kind at the end as a plain label */
.log-row:not(.is-short) { grid-template-columns: 68px 66px minmax(70px, 120px) 72px minmax(0, 1fr) 300px 96px; }
.log-row:not(.is-short) .log-ctx > * { display: inline-block; vertical-align: baseline; margin-right: 14px; max-width: 100%; }
.log-row:not(.is-short) .log-ctx > *:last-child { margin-right: 0; }
.chip-link.is-off { border-bottom-color: transparent; }
.log-list-narrow .log-row:not(.is-short) { grid-template-columns: 68px 66px minmax(70px, 130px) 74px minmax(0, 1fr); }
.log-row:not(.is-short) { grid-template-columns: 68px 66px minmax(70px, 120px) 72px minmax(0, 1fr) minmax(200px, 24%) 92px; }
.log-list-narrow .log-row:not(.is-short) { grid-template-columns: 68px 66px minmax(70px, 130px) 74px minmax(0, 1fr); }

/* the "Being set up" box: a line between the head and the records, dashed like the box's own border */
.panel-dashed .panel-head + .rows { border-top: 1px dashed var(--line-2); margin-top: 4px; }
