/* HelpMeBaby agent workspace, styled to the v2 UI template (helpmebaby-pkg/design/HelpMeBaby-UI-Template.html).
   Inter (SIL OFL 1.1, see fonts/LICENSE-Inter-OFL.txt) is served from this server, as the template bundles it. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2"); }
:root {
  --rail: #13202B; --rail-ink: #C9D4DD; --rail-muted: #9FB0BE; --rail-on: #22384A; --rail-av: #2E4E66;
  --ink: #1B2430; --ink-2: #33404F; --muted: #5B6676; --bg: #F6F7F9; --panel: #FFFFFF; --soft: #F9FAFB;
  --line: #E3E7EC; --line-2: #EEF1F4; --field: #D5DCE3; --link: #1F5470; --link-hi: #163E54; --sel: #EAF2F7;
  --primary: #1F5470; --primary-line: #C9D9E4; --send: #B04E0C;
  --ai-bg: #F5F2FC; --ai-line: #DDD3F3; --ai-ink: #4B2F86; --ai-av: #5B3E96; --ai-chip: #E6DDF7;
  --note-bg: #FFF8E6; --note-line: #F0DFAE; --note-ink: #6B4E00; --note-chip: #F7E7B9;
  --ok: #2B6338; --ok-bg: #E4F2E8; --err: #9B1C1C; --err-bg: #FDECEC;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--link); } a:hover { color: var(--link-hi); }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.empty { margin: 0; padding: 24px 16px; color: var(--muted); }

/* the shell: rail 230 | list 340 | ticket | details 300 (template .hd-shell) */
.shell { display: grid; grid-template-columns: 230px 340px minmax(0, 1fr) 300px; height: 100vh; }
.shell.admin { grid-template-columns: 230px minmax(0, 1fr); }
.shell > * { min-height: 0; }

/* rail */
.rail { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; gap: 24px; padding: 20px 12px;
  overflow: auto; }
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; }
.rail-brand img { flex: none; }
.rail-brand span { display: flex; flex-direction: column; gap: 2px; }
.rail-brand b { font-size: 15px; font-weight: 600; color: #FFFFFF; }
.rail-brand small { font-size: 12px; color: var(--rail-muted); }
.rg { display: flex; flex-direction: column; gap: 4px; }
.rg h2 { margin: 0 8px 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--rail-muted); }
.rv, .rl { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px;
  border-radius: 8px; color: var(--rail-ink); text-decoration: none; font-size: 14px; }
.rv:hover, .rl:hover { color: #FFFFFF; background: rgba(255,255,255,.05); }
.rv.on, .rl.on { background: var(--rail-on); color: #FFFFFF; font-weight: 500; }
.rv .count { font-size: 12px; color: var(--rail-muted); }
.rv.on .count { color: var(--rail-ink); }
.ai-state { display: flex; align-items: center; gap: 8px; margin: -2px 10px 4px; font-size: 12px; color: var(--rail-muted);
  text-decoration: none; }
.ai-state .dot { width: 8px; height: 8px; border-radius: 50%; background: #9FB0BE; flex: none; }
.ai-state[data-agent-status=shadow] .dot { background: #B9A6EA; }
.ai-state[data-agent-status=active] .dot { background: #6FCF97; }
.ai-state[data-agent-status=paused] .dot { background: #F28B82; }
.rail-me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--rail-on); }
.rail-me .av { width: 32px; height: 32px; border-radius: 50%; background: var(--rail-av); color: #FFFFFF; display: flex;
  align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex: none; }
.rail-me .who { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.rail-me .who b { font-size: 14px; font-weight: 400; color: #FFFFFF; }
.rail-me .who small { font-size: 12px; color: var(--rail-muted); }
button.link { background: none; border: 0; padding: 0; color: var(--rail-muted); font: inherit; font-size: 12px; cursor: pointer; }
button.link:hover { color: #FFFFFF; }

/* pills */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.st-open { background: #E2EDF4; color: #1F5470; } .st-pending { background: #ECE6F7; color: #553A8F; }
.st-on_hold, .st-new { background: #FCEFD8; color: #7A4A00; } .st-solved { background: #E4F2E8; color: #2B6338; }
.st-closed { background: var(--line-2); color: var(--muted); }
.tier-ai { background: #EEE9FA; color: var(--ai-ink); } .tier-human { background: #E2EDF4; color: #1F5470; }
.tier-tier1 { background: var(--line-2); color: var(--ink-2); }
.ag-shadow { background: #EEE9FA; color: var(--ai-ink); } .ag-active { background: var(--ok-bg); color: var(--ok); }
.ag-paused { background: var(--err-bg); color: var(--err); } .ag-draft { background: var(--line-2); color: var(--ink-2); }
.tag { font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--line-2); color: var(--muted); }

/* list pane */
.list { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.list-head { padding: 20px 16px 12px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--line); }
.lh { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.lh h1 { margin: 0; font-size: 16px; font-weight: 600; }
.lh span { font-size: 13px; color: var(--muted); }
.list-search { display: flex; gap: 8px; }
.list-search input { flex: 1; min-width: 0; }
.list-search select { width: 118px; }
input, select, textarea { min-height: 40px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; font: inherit;
  font-size: 14px; color: var(--ink); background: #FFFFFF; }
input[type=search] { background: var(--soft); }
textarea { padding: 12px; line-height: 1.5; resize: vertical; width: 100%; }
.list-link { font-size: 13px; font-weight: 500; }
.rows { flex: 1; overflow: auto; display: flex; flex-direction: column; }
.row { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-bottom: 1px solid var(--line-2);
  color: var(--ink); text-decoration: none; background: #FFFFFF; }
.row:hover { background: #F4F8FB; color: var(--ink); }
.row.cur { background: var(--sel); }
.r1 { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.r1 b { font-weight: 600; } .r1 span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.r2 { font-size: 14px; font-weight: 500; line-height: 1.35; }
.row.cur .r2 { font-weight: 600; }
.r3 { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r4 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

/* ticket pane */
.tmain { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.empty-main { align-items: center; justify-content: center; }
.th { padding: 18px 24px 14px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap;
  align-items: flex-start; justify-content: space-between; gap: 12px; }
.th-l { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.th-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.th-title h2 { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.3; }
.th-title .pill { padding: 2px 10px; }
.th p { margin: 0; font-size: 13px; }
.convo { flex: 1; overflow: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 12px; align-items: flex-start; }
.av { flex: none; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; background: #E2EDF4; color: #1F5470; }
.av.big { width: 40px; height: 40px; font-size: 14px; }
.av.sm { display: inline-flex; width: 24px; height: 24px; font-size: 10px; vertical-align: middle; }
.bubble { flex: 1; min-width: 0; background: #FFFFFF; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.mh { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.mh b { font-weight: 600; } .mh .muted { font-size: 12px; }
.chip { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.msg .body { margin: 0; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.src { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.m-agent .bubble { background: #F3F7FA; border-color: #D9E5EE; } .m-agent .av { background: #1F5470; color: #FFFFFF; }
.m-ai .bubble { background: var(--ai-bg); border-color: var(--ai-line); } .m-ai .av, .m-note .av { background: var(--ai-av); color: #FFFFFF; }
.m-ai .chip { background: var(--ai-chip); color: var(--ai-ink); }
.m-note .bubble { background: var(--note-bg); border-color: var(--note-line); } .m-note .chip { background: var(--note-chip); color: var(--note-ink); }
.m-note[data-kind=internal_note] .av { background: #1F5470; }
.m-tier1 .av { background: var(--line-2); color: var(--ink-2); } .m-tier1 .chip { background: var(--line-2); color: var(--ink-2); }
.handoff { border: 1px solid var(--ai-line); background: var(--ai-bg); border-radius: 10px; padding: 14px 16px; display: flex;
  flex-direction: column; gap: 6px; }
.handoff .h-t { font-size: 12px; font-weight: 600; color: var(--ai-ink); }
.handoff p { margin: 0; line-height: 1.55; }
.shadow-draft { border-style: dashed; }
.shadow-draft a { font-size: 13px; }
.working { margin: 0 0 0 44px; padding: 10px 14px; border: 1px dashed #CDBFEF; border-radius: 10px; background: #FBFAFE;
  font-size: 13px; color: var(--ai-ink); }
.approval { margin-left: 44px; border: 1px solid var(--note-line); background: var(--note-bg); border-radius: 10px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px; }
.approval p { margin: 0; } .ap-a { font-size: 15px; font-weight: 600; }
.ap-chip { align-self: flex-start; font-size: 11px; font-weight: 600; color: var(--note-ink); background: var(--note-chip);
  padding: 2px 8px; border-radius: 999px; }

/* composer */
.composer { border-top: 1px solid var(--line); background: #FFFFFF; padding: 16px 24px 20px; display: flex; flex-direction: column;
  gap: 12px; }
.composer:has(input[value=internal_note]:checked) { background: var(--note-bg); }
.modes { display: flex; gap: 6px; }
.mode input { position: absolute; opacity: 0; pointer-events: none; }
.mode span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--primary-line);
  border-radius: 8px; background: #FFFFFF; color: var(--primary); font-size: 13px; font-weight: 500; cursor: pointer; }
.mode input:checked + span { background: var(--primary); border-color: var(--primary); color: #FFFFFF; }
.mode input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.c-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.c-foot .grow { flex: 1; }
.submit-as select { width: 148px; padding: 0 8px; color: var(--ink-2); }
.c-foot > .btn:not(.send) { padding: 0 12px; }
.for-note { display: none; }
.composer:has(input[value=internal_note]:checked) .for-note { display: inline; }
.composer:has(input[value=internal_note]:checked) .for-public { display: none; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--field);
  border-radius: 8px; background: #FFFFFF; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ai { border-color: var(--ai-line); background: var(--ai-bg); color: var(--ai-ink); }
.btn.outline { border-color: var(--primary-line); color: var(--primary); font-weight: 500; }
.btn.primary { border: 0; background: var(--primary); color: #FFFFFF; font-weight: 600; padding: 0 16px; }
.btn.send { border: 0; background: var(--send); color: #FFFFFF; font-weight: 600; padding: 0 18px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }

/* details pane */
.tside { background: var(--panel); border-left: 1px solid var(--line); overflow: auto; padding: 20px; display: flex;
  flex-direction: column; gap: 20px; }
.req { display: flex; gap: 12px; align-items: center; }
.req div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.req b { font-size: 15px; font-weight: 600; } .req .muted { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.card h3, .fields h3, .history h3 { margin: 0; font-size: 13px; font-weight: 600; }
.ai-card { border-color: var(--ai-line); background: var(--ai-bg); }
.ai-card h3, .ai-card > a { color: var(--ai-ink); }
.ai-card > a { font-size: 13px; font-weight: 500; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.kv span:first-child { color: var(--muted); } .kv span:last-child { text-align: right; }
.fields { display: flex; flex-direction: column; gap: 12px; }
.fd { display: flex; flex-direction: column; gap: 4px; }
.fd > span, .fd > label { font-size: 12px; color: var(--muted); }
.fd select { width: 100%; }
.ro { min-height: 40px; display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--soft); font-size: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tagpill { padding: 4px 10px; border-radius: 999px; background: var(--line-2); font-size: 12px; color: var(--ink-2); }
.history { display: flex; flex-direction: column; gap: 8px; }
ol.events { list-style: none; margin: 0; padding: 0; }
.ev { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.ev-t { font-size: 11px; color: var(--muted); }

/* flashes */
.flash { padding: 10px 14px; border-radius: 10px; border: 1px solid #BFDCC8; background: var(--ok-bg); color: var(--ok); font-size: 13px; }
.flash.err { border-color: #F3C2C2; background: var(--err-bg); color: var(--err); }

/* admin pages */
.content { display: flex; flex-direction: column; min-width: 0; overflow: auto; }
.ch { padding: 20px 24px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.ch h1 { margin: 0; font-size: 18px; font-weight: 600; }
.ch p { margin: 4px 0 0; font-size: 13px; }
.cb { padding: 24px; display: flex; flex-direction: column; gap: 14px; max-width: 1180px; }
.cb h2 { margin: 12px 0 0; font-size: 15px; font-weight: 600; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; }
.grid th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--soft); }
.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.grid tr:last-child td { border-bottom: 0; }
.snippet { color: var(--muted); font-size: 12px; margin-top: 2px; }
.s-active, .s-ready, .s-completed, .s-ok, .s-approved, .s-healthy, .s-pass { background: var(--ok-bg); color: var(--ok); }
.s-queued, .s-pending, .s-draft, .s-syncing, .s-to-grade { background: #ECE6F7; color: #553A8F; }
.s-failed, .s-error, .s-blocked, .s-rejected, .s-offline, .s-retired, .s-fail { background: var(--err-bg); color: var(--err); }
.form { max-width: 640px; background: var(--panel); }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form input, .form select { width: 100%; }
.form .btn { align-self: flex-start; }
.agent { max-width: 760px; }
.agent h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.statrow { display: flex; flex-wrap: wrap; gap: 12px; }
.statrow .card { background: var(--panel); min-width: 140px; gap: 4px; }
.empty-state h3 { font-size: 15px; }
.empty-state p { margin: 0; color: var(--muted); line-height: 1.55; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; }

/* sign-in and sign-up: the card after Seraverra's login card (logo row, heading, one line, labelled fields,
   Show password, one error box, a full-width button, the switch line) */
body.center { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { width: min(420px, 100%); background: var(--panel); gap: 14px; padding: 28px; }   /* the 404/500 card */
.login h1 { margin: 0; font-size: 18px; font-weight: 600; }
.login p { margin: 0; font-size: 13px; line-height: 1.5; }
.login-wrap { width: min(420px, 100%); }
.login-card { background: var(--panel); gap: 14px; padding: 32px 28px 24px; border-radius: 14px;
  box-shadow: 0 1px 2px rgba(19, 32, 43, .05), 0 8px 24px rgba(19, 32, 43, .06); }
.login-card .brandrow { display: flex; justify-content: center; margin-bottom: 4px; }
.login-card .brandrow img { width: 220px; max-width: 70%; height: auto; }
.login-card h1 { margin: 0; font-size: 22px; font-weight: 600; text-align: center; }
.login-card .sub { margin: -6px 0 6px; font-size: 14px; color: var(--muted); text-align: center; }
.login-card form { display: flex; flex-direction: column; gap: 6px; }
.login-card .field-label { margin-top: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.login-card input[type=text], .login-card input[type=email], .login-card input[type=password] { width: 100%;
  min-height: 44px; }
.login-card .show-pw { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--ink-2);
  cursor: pointer; }
.login-card .show-pw input { min-height: 0; width: 16px; height: 16px; margin: 0; }
.login-card .auth-error { margin-top: 8px; padding: 10px 12px; border: 1px solid #F3C2C2; border-radius: 8px;
  background: var(--err-bg); color: var(--err); font-size: 13px; line-height: 1.45; }
.login-card .auth-error[hidden] { display: none; }
.login-card .btn.send { width: 100%; min-height: 44px; margin-top: 12px; font-size: 15px; }
.login-card .switch { margin: 6px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.login-card .text-link { font-weight: 500; }

/* the template's breakpoints */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 210px 300px minmax(0, 1fr); }
  .tside { display: none; }
  .shell.admin { grid-template-columns: 210px minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .shell, .shell.admin { grid-template-columns: minmax(0, 1fr); height: auto; }
  .rail { gap: 12px; }
  .rg { flex-direction: row; flex-wrap: wrap; }
  .rg h2 { width: 100%; margin-bottom: 0; }
  .rv, .rl { min-height: 34px; background: rgba(255,255,255,.05); }
  .list { max-height: 420px; }
  .tmain { min-height: 680px; }
  .tside { display: flex; border-left: 0; border-top: 1px solid var(--line); }
  .cb { padding: 16px; }
  table.grid { display: block; overflow-x: auto; }
  .convo, .composer, .th { padding-left: 16px; padding-right: 16px; }
}

/* Draft with AI (use case 6): the AI's draft sits in the reply box, unsent, marked until the person sends it */
.ai-draft-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--ai-line);
  border-radius: 8px; background: var(--ai-bg); color: var(--ai-ink); font-size: 13px; line-height: 1.5; }
.ai-draft-note .chip { background: var(--ai-chip); color: var(--ai-ink); flex: none; }
.ai-draft-note a { color: var(--ai-ink); font-weight: 500; }
textarea.ai-drafted { border-color: var(--ai-line); background: #FCFBFF; box-shadow: inset 3px 0 0 var(--ai-av); }
.btn.ai.draft-btn:hover { background: #EEE9FA; }
/* Settings > Voice: the line's settings beside its phrases; stacked on a phone */
.voice-line { margin-bottom: 28px; }
.voice-grid { display: grid; grid-template-columns: minmax(260px, 320px) 1fr; gap: 20px; align-items: start; }
.voice-phrases { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.voice-phrases td { overflow-wrap: anywhere; }
@media (max-width: 760px) { .voice-grid { grid-template-columns: 1fr; } }
/* The agent window (port-remy-window): the rail's unread badge and the thread. */
.rl .unread { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--send); color: #FFFFFF; font-size: 12px; line-height: 20px; text-align: center; }
.aw-thread { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.aw-msg { max-width: 720px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.aw-msg.aw-agent { align-self: flex-start; background: var(--ai-bg); border-color: var(--ai-line); }
.aw-msg.aw-person { align-self: flex-end; }
.aw-h { margin: 0 0 4px; font-size: 13px; }
.aw-msg .body { margin: 0; white-space: pre-wrap; }

/* Live chat (port-p2p-chat): the rail badge, the ticket's live bar, the waiting list */
.live-badge[hidden] { display: none; }
.live-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px;
  padding: 12px 14px; border: 1px solid var(--line, #d9dde3); border-radius: 10px; background: #f4f8fb; }
.live-bar p { margin: 0; }
.live-bar.on { border-color: #2f8a4c; background: #eef7f1; }
.live-bar.held { background: #fff8e6; border-color: #f0dfae; }
.live-bar { flex-wrap: wrap; }
.live-bar p { flex: 1 1 260px; }
.live-bar .btnrow { margin: 0; flex: none; }
.live-hand { display: flex; gap: 8px; align-items: center; }
.live-hand select { max-width: 180px; }
.live-h { margin: 18px 0 8px; font-size: 16px; }
.live-last { margin: 4px 0 0; color: var(--muted, #5b6676); max-width: 52ch; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
@media (max-width: 640px) { .live-bar { flex-direction: column; align-items: flex-start; } }

/* The central ringing console (port-console-ring): top bar, switchboard roster (a lamp per chat), chat pane, details.
   The ring's look follows the owner's template: amber lamp = waiting, pulsing = ringing, red = waited too long. */
.console { --cn-wait: #E59A00; --cn-wait-soft: #FFF2D2; --cn-ok: #2E9E5B; --cn-idle: #9AA6B2; --cn-late: #C2462B;
  display: flex; flex-direction: column; min-height: 0; height: 100vh; background: var(--bg); }
.cn-soundbar { display: block; width: 100%; border: 0; border-bottom: 1px solid var(--cn-wait); background: var(--cn-wait-soft);
  color: var(--ink); padding: 8px 16px; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.cn-soundbar[hidden], .cn-conn[hidden], .cn-settings[hidden] { display: none; }
.cn-conn { padding: 6px 16px; background: var(--err-bg); color: var(--err); font-weight: 600; }
.cn-lead { display: flex; gap: 10px; align-items: center; padding: 8px 16px; background: var(--err-bg); color: var(--err);
  border-bottom: 1px solid var(--line); font-weight: 600; }
.cn-top { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 10px 16px; background: var(--panel);
  border-bottom: 1px solid var(--line); }
.cn-top h1 { margin: 0 8px 0 0; font-size: 18px; }
.cn-counter b { font-variant-numeric: tabular-nums; }
.cn-top input[type=search] { margin-left: auto; min-width: 160px; height: 34px; padding: 0 10px; border: 1px solid var(--field); border-radius: 8px; }
.cn-btn { min-height: 34px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; background: var(--panel);
  color: var(--ink); font: inherit; cursor: pointer; }
.cn-btn[aria-pressed=true] { border-color: var(--primary-line); background: var(--sel); color: var(--primary); }
.cn-btn:disabled { opacity: .55; cursor: not-allowed; }
.cn-settings { padding: 10px 16px; background: var(--soft); border-bottom: 1px solid var(--line); }
.cn-settings fieldset { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; border: 0; margin: 0; padding: 0; }
.cn-settings legend { font-weight: 600; margin-bottom: 6px; }
.cn-settings input[type=number] { width: 72px; }
.cn-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr) 280px; }
.console.cn-hide-details .cn-body { grid-template-columns: 330px minmax(0, 1fr); }
.console.cn-hide-details .cn-details { display: none; }
.cn-roster { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); }
.cn-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); }
.cn-tab { flex: 1; min-height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit;
  font-size: 13px; cursor: pointer; }
.cn-tab.on { background: var(--sel); color: var(--primary); font-weight: 600; }
.cn-list { position: relative; flex: 1; min-height: 0; overflow-y: auto; }
.cn-spacer { width: 1px; }
.cn-row { position: absolute; left: 0; right: 0; top: 0; height: 64px; display: grid; grid-template-columns: 22px 38px minmax(0, 1fr) auto;
  gap: 8px; align-items: center; padding: 0 10px; border: 0; border-bottom: 1px solid var(--line-2); background: var(--panel);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer; isolation: isolate; }
.cn-row:hover { background: var(--soft); }
.cn-row.is-selected { background: var(--sel); }
.cn-row.is-ringing::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--cn-wait); opacity: .14;
  animation: cn-glow 1.6s ease-in-out infinite; pointer-events: none; }
@keyframes cn-glow { 50% { opacity: .03; } }
.cn-lamp { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--cn-ok); justify-self: center; }
.cn-row.is-other .cn-lamp { border-color: var(--cn-idle); }
.cn-row.is-waiting .cn-lamp { background: var(--cn-wait); border-color: var(--cn-wait); }
.cn-row.is-late .cn-lamp { background: var(--cn-late); border-color: var(--cn-late); }
.cn-row.is-ringing .cn-lamp { animation: cn-lamp 1.2s ease-out infinite; }
@keyframes cn-lamp { 0% { box-shadow: 0 0 0 0 rgba(229, 154, 0, .75); } 100% { box-shadow: 0 0 0 10px rgba(229, 154, 0, 0); } }
.cn-av { position: relative; width: 34px; height: 34px; border-radius: 50%; background: var(--rail-av); color: #FFFFFF;
  display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.cn-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--panel); }
.cn-dot.online { background: var(--cn-ok); }
.cn-dot.offline { background: var(--panel); box-shadow: inset 0 0 0 2px var(--cn-idle); }
.cn-rtext { min-width: 0; display: flex; flex-direction: column; }
.cn-rname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cn-rprev { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cn-row.has-draft .cn-rprev { color: var(--note-ink); }
.cn-rmeta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums; }
.cn-rbadge { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--send); color: #FFFFFF; line-height: 20px; text-align: center; }
.cn-rbadge[hidden] { display: none; }
.cn-row.is-waiting .cn-rwait { color: #8A5A00; font-weight: 600; }
.cn-row.is-late .cn-rwait { color: var(--cn-late); font-weight: 700; }
.cn-chat { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.cn-empty { margin: auto; color: var(--muted); }
.cn-empty[hidden], .cn-head[hidden], .cn-compose[hidden], .cn-note[hidden], .cn-typing[hidden], .cn-pill[hidden] { display: none; }
.cn-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.cn-back { display: none; }
.cn-who { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.cn-who small { color: var(--muted); }
.cn-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cn-actions select { height: 34px; max-width: 160px; }
.cn-thread { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.cn-msg { max-width: 72%; display: flex; flex-direction: column; }
.cn-msg.visitor { align-self: flex-start; }
.cn-msg.person, .cn-msg.ai { align-self: flex-end; align-items: flex-end; }
.cn-from { font-size: 11px; color: var(--muted); }
.cn-bubble { padding: 8px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.cn-msg.person .cn-bubble { background: var(--sel); border-color: var(--primary-line); }
.cn-msg.ai .cn-bubble { background: var(--ai-bg); border-color: var(--ai-line); }
.cn-msg.failed .cn-bubble { border-color: var(--err); }
.cn-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--muted); }
.cn-tick.failed { color: var(--err); font-weight: 600; }
.cn-tick.seen { color: var(--ok); }
.cn-retry { border: 0; background: none; color: var(--link); text-decoration: underline; font: inherit; cursor: pointer; padding: 0; }
.cn-loading, .cn-older { align-self: center; color: var(--muted); font-size: 12px; margin: 0; }
.cn-pill { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); border: 0; border-radius: 16px; padding: 6px 14px;
  background: var(--primary); color: #FFFFFF; font: inherit; font-size: 13px; cursor: pointer; }
.cn-typing { margin: 0; padding: 0 16px 6px; color: var(--muted); font-size: 12px; font-style: italic; }
.cn-compose { display: flex; gap: 8px; padding: 10px 16px; background: var(--panel); border-top: 1px solid var(--line); }
.cn-compose textarea { flex: 1; resize: none; padding: 8px 10px; border: 1px solid var(--field); border-radius: 8px; font: inherit; }
.cn-compose .send { border: 0; border-radius: 8px; background: var(--send); color: #FFFFFF; font: inherit; font-weight: 600; padding: 0 18px; cursor: pointer; }
.cn-details { min-height: 0; overflow-y: auto; padding: 12px 14px; background: var(--panel); border-left: 1px solid var(--line); }
.cn-details h2 { margin: 0 0 8px; font-size: 15px; }
.cn-details h3 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
.cn-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; margin: 0; font-size: 13px; }
.cn-kv dt { color: var(--muted); }
.cn-kv dd { margin: 0; overflow-wrap: anywhere; }
.cn-earlier { margin: 0; padding-left: 18px; font-size: 13px; }
.cn-notebody { margin: 0 0 6px; padding: 6px 8px; background: var(--note-bg); border: 1px solid var(--note-line); border-radius: 6px; font-size: 13px; white-space: pre-wrap; }
.cn-note { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; font-size: 13px; }
.cn-note textarea { resize: vertical; padding: 6px 8px; border: 1px solid var(--field); border-radius: 6px; font: inherit; }
.cn-note .cn-btn { align-self: flex-start; }
@media (max-width: 1180px) { .cn-body { grid-template-columns: 290px minmax(0, 1fr); } .cn-details { display: none; } }
/* a phone: the roster and the chat are two screens, with a back button between them */
@media (max-width: 760px) {
  .console { height: auto; min-height: 100vh; }
  .cn-body { display: block; }
  .cn-roster { height: 70vh; }
  .console.chat-open .cn-roster { display: none; }
  .cn-chat { height: 80vh; }
  .console:not(.chat-open) .cn-chat { display: none; }
  .cn-back { display: inline-block; }
  .cn-top input[type=search] { margin-left: 0; flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { .cn-row.is-ringing::before, .cn-row.is-ringing .cn-lamp { animation: none; } }

/* port-app-audit-fix: row status buttons, the danger button, the customer card, the ticket's tags box, the checkbox label */
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.btnrow.tight { gap: 4px; flex-wrap: nowrap; }
.btn.danger { border: 0; background: var(--err); color: #FFFFFF; font-weight: 600; }
.cust h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.fields .tags + input { margin-top: 6px; }
.form label:has(> input[type=checkbox]) { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.req a { color: inherit; }
.form label > input[type=checkbox] { width: auto; }
