/* The support desk (web/desk.html): a list of conversations and one chat, side by side on a wide screen, one at a time on a phone. */
:root { --ink: #173b36; --muted: #6b7f7b; --line: #e4e9e6; --bg: #f6f4ef; --card: #fff; --accent: #d9472b; --me: #173b36; --green: #2f8a5b; --gold: #e2b13c; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.4 -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.login { display: grid; place-items: center; height: 100%; padding: 24px; }
.login-box { width: min(340px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login .tg { padding: 12px; border-radius: 11px; border: 0; background: #2aabee; color: #fff; font-weight: 600; }
.login .linkish { background: none; border: 0; color: var(--muted); font-size: 13.5px; padding: 4px; }
.waiting { text-align: center; color: var(--muted); }
.waiting p { margin: 4px 0; }
.waiting .code { font-size: 34px; letter-spacing: 6px; font-weight: 700; color: var(--ink); }
.waiting a { color: #2aabee; font-weight: 600; text-decoration: none; }
.login h1 { margin: 0 0 4px; font-size: 22px; }
.login input { font: inherit; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); }
.login button { padding: 11px; border-radius: 11px; border: 0; background: var(--ink); color: #fff; font-weight: 600; }
.error { color: var(--accent); margin: 0; font-size: 13.5px; }

.app { display: grid; grid-template-columns: 360px minmax(0, 1fr); height: 100%; }
.list { border-right: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; min-height: 0; }
.top { padding: 14px 16px 10px; display: flex; align-items: center; gap: 8px; }
.top h1 { font-size: 20px; margin: 0; flex: 1; }
.regions { display: flex; gap: 5px; }
.region { font-size: 11.5px; border: 1px solid var(--line); border-radius: 20px; padding: 2px 9px; color: var(--muted); white-space: nowrap; }
.region.down { color: var(--accent); border-color: #f2c4b8; }
.search { margin: 0 16px 10px; padding: 9px 12px; border-radius: 10px; background: var(--bg); border: 0; font: inherit; }
.tabs { display: flex; gap: 6px; padding: 0 16px 10px; overflow-x: auto; }
.tab { font-size: 13px; padding: 5px 11px; border-radius: 20px; background: var(--bg); border: 0; white-space: nowrap; }
.tab.on { background: var(--ink); color: #fff; }
.tab b { font-weight: 600; margin-left: 3px; opacity: .75; }
.rows { overflow: auto; flex: 1; }
.empty { padding: 30px 16px; color: var(--muted); text-align: center; }
.row { display: flex; gap: 11px; padding: 11px 16px; border-top: 1px solid var(--line); align-items: flex-start; cursor: pointer; }
.row:hover { background: #f8faf9; }
.row.sel { background: #eef3f1; }
.av { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 600; position: relative; }
.av.pro::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--gold); }
.rmain { flex: 1; min-width: 0; }
.rhead { display: flex; gap: 6px; align-items: baseline; }
.name { font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.prev { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.meta { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.chip.rep { background: #fdeee9; color: var(--accent); }
.chip.pro { background: #fbf3dc; color: #9a7417; }
.chip.ok { color: var(--green); }
.chip.drafted { background: #e8eff8; color: #35628f; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: none; }

.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; height: 100%; }
.placeholder { margin: auto; color: var(--muted); }
.chead { background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; gap: 11px; align-items: center; }
.back { font-size: 24px; border: 0; background: none; padding: 0 4px; display: none; }
.who { flex: 1; min-width: 0; }
.who .name { display: block; }
.who small { color: var(--muted); font-size: 12.5px; }
.btn { font-size: 13px; border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: 6px 11px; white-space: nowrap; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.facts { background: var(--card); border-bottom: 1px solid var(--line); padding: 8px 16px; display: flex; gap: 6px; overflow-x: auto; }
.msgs { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.day { align-self: center; font-size: 12px; color: var(--muted); background: #ebe8e0; padding: 2px 10px; border-radius: 10px; margin: 6px 0; }
.b { max-width: min(85%, 640px); padding: 8px 11px; border-radius: 14px; font-size: 14.5px; box-shadow: 0 1px 1px rgba(0, 0, 0, .04); white-space: pre-wrap; overflow-wrap: anywhere; }
.b.them { background: var(--card); align-self: flex-start; border-bottom-left-radius: 4px; }
.b.me { background: var(--me); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.b.me.failed { background: #8a3a2a; }
.b .t { display: block; text-align: right; font-size: 11px; opacity: .6; margin-top: 3px; white-space: normal; }
.b .subj { display: block; font-weight: 600; margin-bottom: 4px; }
.b .tr { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed #d6ddda; font-size: 13px; color: var(--muted); }
.b .att { display: inline-block; margin-top: 6px; font-size: 12.5px; background: rgba(0, 0, 0, .06); border-radius: 7px; padding: 3px 8px; margin-right: 4px; white-space: normal; }
.b.me .att { background: rgba(255, 255, 255, .14); }
.report { align-self: flex-start; max-width: min(85%, 640px); background: #fff7f4; border: 1px solid #f6d5ca; border-radius: 12px; padding: 8px 11px; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.report.feedback { background: #f4f8f6; border-color: #d3e3dc; }
.report b { color: var(--accent); }
.report.feedback b { color: var(--green); }
.report .t { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.report .tr { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed #e8cfc6; color: var(--muted); }
.draft { align-self: flex-end; max-width: min(85%, 640px); border: 1.5px dashed #9bb0c7; background: #f3f7fb; border-radius: 14px; padding: 8px 11px; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.draft .who-d { display: block; font-size: 12px; color: #35628f; margin-bottom: 4px; white-space: normal; }
.draft .note { display: block; font-size: 12.5px; color: var(--muted); margin-top: 6px; white-space: normal; }
.draft .acts { display: flex; gap: 6px; margin-top: 8px; justify-content: flex-end; white-space: normal; }
.kb { display: flex; flex-direction: column; gap: 4px; margin-top: 7px; white-space: normal; }
.kb span { background: rgba(255, 255, 255, .16); border-radius: 8px; padding: 5px 8px; text-align: center; font-size: 12.5px; }
.draft .kb span { background: #e2eaf3; }
.quick { display: flex; gap: 6px; padding: 8px 12px 0; overflow-x: auto; background: var(--card); border-top: 1px solid var(--line); }
.q { white-space: nowrap; font-size: 12.5px; padding: 5px 10px; border-radius: 16px; border: 1px solid var(--line); background: var(--bg); }
.q.on { background: #e8eff8; border-color: #b8cbe0; }
.attached { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 12px 0; background: var(--card); }
.attached .chip { font-size: 12px; padding: 3px 8px; background: #e8eff8; color: #35628f; }
.attached .chip button { border: 0; background: none; padding: 0 0 0 4px; color: inherit; }
.compose { display: flex; gap: 8px; padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); background: var(--card); align-items: flex-end; }
.compose textarea { flex: 1; font: inherit; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; resize: none; min-height: 42px; max-height: 40vh; }
.send { width: 42px; height: 42px; border-radius: 50%; background: var(--ink); color: #fff; border: 0; font-size: 18px; flex: none; }
.send:disabled { opacity: .4; }
.nochannel { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 12px; font-size: 14px; z-index: 10; max-width: 90vw; }
.toast.bad { background: var(--accent); }

@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .chat { display: none; }
  body.inchat .list { display: none; }
  body.inchat .chat { display: flex; }
  .back { display: block; }
  .hide-m { display: none; }
}
