/* Poppins – MiniFinder's brand font. Hosted here (SIL Open Font License, see fonts/OFL.txt): no requests to Google. */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/poppins-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/poppins-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/poppins-latin-ext-500-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/poppins-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/poppins-latin-ext-600-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/poppins-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/poppins-latin-ext-700-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/poppins-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: italic; font-weight: 400; font-display: swap; src: url('fonts/poppins-latin-ext-400-italic.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: italic; font-weight: 400; font-display: swap; src: url('fonts/poppins-latin-400-italic.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* AI Support Desk – one stylesheet, no build step.
   Colours are tokens; [data-theme="dark"] on <html> switches them. */

:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --surface-3: #F2F4F7;
  --border: #E4E7EC;
  --border-soft: #EEF0F3;
  --border-strong: #D0D5DD;
  --text: #101828;
  --text-2: #344054;
  --text-3: #475467;
  --muted: #5B6474;
  --faint: #98A2B3;
  --primary: #1F5FD1;
  --primary-hover: #1A4FB8;
  --primary-soft: #EEF3FD;
  --primary-text: #1A4FB8;
  --on-primary: #FFFFFF;
  /* Buttons and other actions: almost black in the light theme (MiniFinder look). */
  --action: #16181D;
  --action-hover: #2B2F38;
  --on-action: #FFFFFF;
  --ok-bg: #ECFDF3;   --ok: #067647;   --ok-dot: #12B76A;
  --warn-bg: #FFFAEB; --warn: #93370D; --warn-border: #FEDF89;
  --bad-bg: #FEF3F2;  --bad: #B42318;  --bad-border: #FECDCA;
  --violet-bg: #F4F3FF; --violet: #5925DC;
  --visitor-bg: #F1ECFE; --visitor-text: #2E1A6B; --visitor-border: #D9CCFA; /* the customer's bubble in Live chats */
  --paper: #FFFFFF; --paper-text: #101828;
  --shadow: 0 12px 28px rgba(16, 24, 40, .14);
  --radius: 12px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0C111D;
  --surface: #161B26;
  --surface-2: #1A202C;
  --surface-3: #252B37;
  --border: #2A303C;
  --border-soft: #222833;
  --border-strong: #3A4150;
  --text: #F2F4F7;
  --text-2: #CDD3DD;
  --text-3: #B4BCC8;
  --muted: #98A2B3;
  --faint: #6B7585;
  --primary: #2F6FE0;
  --primary-hover: #4A84EA;
  --primary-soft: #1B2B4B;
  --primary-text: #84ADFF;
  --action: #2F6FE0;
  --action-hover: #4A84EA;
  --ok-bg: #0E2A1C;   --ok: #47CD89;
  --warn-bg: #2E2310; --warn: #FDB022; --warn-border: #5C4513;
  --bad-bg: #2E1416;  --bad: #F97066;  --bad-border: #5C2420;
  --violet-bg: #231E3D; --violet: #BDB4FE;
  --visitor-bg: #2C2350; --visitor-text: #E9E3FF; --visitor-border: #47388A;
  /* Customer mail stays on light "paper": its HTML assumes a white background. */
  --paper: #FFFFFF; --paper-text: #101828;
  --shadow: 0 12px 28px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* "System": the same dark tokens when the computer itself is set to dark. */
@media (prefers-color-scheme: dark) {
[data-theme="system"] {
  --bg: #0C111D;
  --surface: #161B26;
  --surface-2: #1A202C;
  --surface-3: #252B37;
  --border: #2A303C;
  --border-soft: #222833;
  --border-strong: #3A4150;
  --text: #F2F4F7;
  --text-2: #CDD3DD;
  --text-3: #B4BCC8;
  --muted: #98A2B3;
  --faint: #6B7585;
  --primary: #2F6FE0;
  --primary-hover: #4A84EA;
  --primary-soft: #1B2B4B;
  --primary-text: #84ADFF;
  --action: #2F6FE0;
  --action-hover: #4A84EA;
  --ok-bg: #0E2A1C;   --ok: #47CD89;
  --warn-bg: #2E2310; --warn: #FDB022; --warn-border: #5C4513;
  --bad-bg: #2E1416;  --bad: #F97066;  --bad-border: #5C2420;
  --violet-bg: #231E3D; --violet: #BDB4FE;
  --visitor-bg: #2C2350; --visitor-text: #E9E3FF; --visitor-border: #47388A;
  /* Customer mail stays on light "paper": its HTML assumes a white background. */
  --paper: #FFFFFF; --paper-text: #101828;
  --shadow: 0 12px 28px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--action); }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Poppins, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--primary-text); }
a:hover { color: var(--primary-hover); }
h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
h2 { margin: 0; font-size: 16px; font-weight: 600; }
h3 { margin: 0; font-size: 15px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dot { flex: none; display: inline-block; vertical-align: middle; }
.grow { flex-grow: 1; min-width: 0; }

/* ---------- App shell ---------- */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar {
  flex: 1 1 232px; max-width: 100%;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 4px;
}
.main { flex: 999 1 560px; min-width: 0; padding: 28px 32px 48px; }
.container { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
/* Narrow pages (forms, settings, notifications) use the same frame as the wide pages,
   so titles and content always start at the same left edge; only the right edge differs. */
.container.narrow > * { max-width: 860px; }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--primary); color: var(--on-primary); display: flex; align-items: center; justify-content: center; }
.brand-name { display: flex; flex-direction: column; min-width: 0; }
.brand-name strong { font-size: 15px; font-weight: 700; }
.brand-name span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-link {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 8px;
  font-weight: 500; color: var(--text-2); text-decoration: none;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.nav-link .grow { flex-grow: 1; }
.nav-section { padding: 16px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.count { font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 2px 8px; }
.nav-link[aria-current="page"] .count { background: var(--surface); color: var(--primary-text); }
.nav-link[aria-current="page"] .count.bad-count { background: var(--bad); color: #fff; }
.spacer { flex-grow: 1; min-height: 24px; }

/* Dropdown menus built on <details> (no JavaScript needed). */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
/* The panel floats over the page, so an open menu needs no gap under its button (the general
   "details[open] summary" gap made the button taller and pushed its neighbours down). */
.menu[open] > summary { margin-bottom: 0; }
/* …but the department button keeps its own space below it, so the menu items under it do not move when it opens. */
.menu[open] > .switcher { margin-bottom: 12px; }
.menu-panel {
  position: absolute; left: 0; right: 0; z-index: 20; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
  padding: 6px; display: flex; flex-direction: column; gap: 2px; min-width: 260px;
}
.menu-up .menu-panel { top: auto; bottom: calc(100% + 6px); }
.switcher {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 12px; margin-bottom: 12px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text);
}
.switcher .label { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.switcher .value { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher .grow, .usercard .grow { display: flex; flex-direction: column; flex-grow: 1; min-width: 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 10px;
  border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; text-decoration: none;
}
.menu-item:hover { background: var(--surface-3); color: var(--text); }
.menu-item.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.menu-item.danger { color: var(--bad); }
.menu-item .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.menu-sep { height: 1px; margin: 4px 0; background: var(--border); }
.menu-head { padding: 8px 10px; display: flex; flex-direction: column; }
.menu-caption { padding: 6px 10px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.usercard-wrap { border-top: 1px solid var(--border-soft); padding-top: 8px; }
.usercard { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 10px; border-radius: 8px; color: var(--text); }
.usercard:hover { background: var(--surface-3); }
/* The general "details[open] summary" gap must not move the name card when its menu opens. */
.usercard-wrap .menu[open] > summary { margin-bottom: 0; }
.avatar { width: 34px; height: 34px; flex: none; border-radius: 999px; background: var(--primary-soft); color: var(--primary-text); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.segmented { display: flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 8px; margin: 0 6px 6px; }
.segmented form { flex: 1; display: flex; }
.segmented button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px;
  border: 0; border-radius: 6px; background: transparent; color: var(--text-3); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.segmented.icons-only button { padding-left: 0; padding-right: 0; justify-content: center; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }

/* ---------- Building blocks ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head .titles { display: flex; flex-direction: column; gap: 4px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card.pad { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border-soft); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; color: var(--muted); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.stat .k { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.stat .v { font-size: 30px; font-weight: 700; line-height: 1.1; }
a.stat-link { color: var(--text); text-decoration: none; cursor: pointer; transition: border-color .15s; }
a.stat-link:hover { color: var(--text); border-color: var(--border-strong); }
a.stat-link[aria-current="page"] { border-color: var(--faint); }
a.stat-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px 14px; align-items: start; }
.cols { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; }
.cols > .wide { flex: 3 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.cols > .side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text-2);
  font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); color: var(--text); }
.btn.primary { background: var(--action); border-color: var(--action); color: var(--on-action); font-weight: 600; }
.btn.primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
.btn.danger { color: var(--bad); border-color: var(--bad-border); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--action); text-decoration: underline; text-underline-offset: 3px; }
.btn.link:hover { color: var(--action-hover); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-3); }
.chip.blue { background: var(--primary-soft); color: var(--primary-text); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.violet { background: var(--violet-bg); color: var(--violet); }
.ref { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
a.ref-link { text-decoration: none; }
a.ref-link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* Forms */
label.field, .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .hint { font-weight: 400; font-size: 12px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=url], input[type=number], input[type=date], input[type=time], input[type=datetime-local], input[type=month], select, textarea {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
}
textarea { padding: 12px; line-height: 1.5; resize: vertical; min-height: 120px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .nav-link:focus-visible, summary:focus-visible, .menu-item:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
input[readonly] { background: var(--surface-2); color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.check input { width: 18px; height: 18px; accent-color: var(--action); }
.code-input { font-size: 22px; letter-spacing: .3em; text-align: center; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin: 0; display: flex; flex-direction: column; gap: 14px; }
legend { padding: 0 6px; font-weight: 600; }

/* Flash messages */
.flash { padding: 12px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.flash.success { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.flash.error { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-border); }
.flash.info { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--surface-2); font-size: 13px; color: var(--muted); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
/* Yellow info box: explanatory text that should stand out from the form (e.g. Languages → Add a language). */
.info-box { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--warn-border); border-radius: 10px; background: var(--warn-bg); color: var(--text-2); font-size: 13px; line-height: 1.6; }
.info-box > .i { flex: none; margin-top: 2px; color: var(--warn); }
.info-box p { margin: 0; }
.info-box p + p { margin-top: 8px; }

/* Tables */
/* A card that holds a table clips it, so the table's header corners follow the card's rounded corners. */
.card:has(> .table-wrap) { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.t td { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t a.subject { color: var(--text); font-weight: 600; text-decoration: none; }
.t a.subject:hover { color: var(--primary-text); text-decoration: underline; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 8px; }
.tabs a { display: flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 6px; color: var(--text-3); text-decoration: none; font-weight: 500; }
.settings-tabs { align-self: flex-start; margin-bottom: 16px; }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.searchbox { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--muted); }
.searchbox input { border: 0; min-height: 40px; padding: 0; width: 220px; background: transparent; }
.searchbox input:focus-visible { outline: none; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* Ticket thread */
.msg { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.msg-head { display: flex; align-items: center; gap: 12px; }
.msg-head .who { display: flex; flex-direction: column; flex-grow: 1; min-width: 0; }
.msg-body { font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.customer .msg-body { background: var(--paper); color: var(--paper-text); border-radius: 8px; }
[data-theme="dark"] .msg.customer .msg-body { padding: 14px 16px; }
@media (prefers-color-scheme: dark) { [data-theme="system"] .msg.customer .msg-body { padding: 14px 16px; } }
.msg.note { background: var(--warn-bg); border-color: var(--warn-border); }
.msg.system { padding: 0 8px; background: none; border: 0; font-size: 13px; color: var(--muted); flex-direction: row; align-items: center; gap: 8px; }
.msg-meta { display: flex; flex-wrap: wrap; gap: 16px; padding-top: 12px; border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--muted); }
.att { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; color: var(--text-2); text-decoration: none; }
.att:hover { background: var(--surface-3); }
.pending-send { color: var(--warn); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }
.hint-card { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); text-decoration: none; font-size: 13px; }
.hint-card:hover { background: var(--surface-3); }
.reply-tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--border-soft); }
.reply-tabs label { min-height: 40px; display: flex; align-items: center; padding: 0 14px; border-bottom: 2px solid transparent; color: var(--text-3); font-weight: 500; cursor: pointer; }
.reply-tabs input { position: absolute; opacity: 0; pointer-events: none; }
.reply-tabs .tabs-ai { margin: 0 0 6px auto; align-self: center; }
.reply-tabs input:checked + span { color: var(--primary-text); font-weight: 600; }
.reply-tabs label:has(input:checked) { border-bottom-color: var(--primary); }
.reply-tabs input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Lightbox for image attachments */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(12, 17, 29, .85); display: flex; align-items: center; justify-content: center; padding: 24px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); border-radius: 8px; background: #fff; }
.lightbox .bar { position: absolute; top: 16px; right: 16px; display: flex; gap: 8px; }

/* Simple centred layout (sign-in, installer) */
.simple { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 16px; }
.simple-box { width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.simple-box.wide { max-width: 640px; }
.simple-box .card { width: 100%; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.simple-box .heading { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.brand-mark.lg { width: 52px; height: 52px; border-radius: 12px; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; font-size: 12px; color: var(--muted); }
.steps span[aria-current="step"] { color: var(--primary-text); font-weight: 600; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; align-items: center; gap: 10px; }
.checklist .ok { color: var(--ok); }
.checklist .no { color: var(--bad); }
.checklist .opt { color: var(--warn); }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; letter-spacing: .08em; padding: 12px; background: var(--surface-2); border-radius: 8px; text-align: center; word-break: break-all; user-select: all; }
.qr-wrap { display: flex; justify-content: center; }
.qr-wrap .qr { width: 220px; height: 220px; border-radius: 8px; border: 1px solid var(--border); }
details summary { cursor: pointer; color: var(--primary-text); font-weight: 500; }
details[open] summary { margin-bottom: 10px; }
pre.cmd { margin: 0; padding: 12px; background: var(--surface-2); border-radius: 8px; overflow-x: auto; font-size: 13px; }

@media (max-width: 720px) {
  .main { padding: 20px 16px 40px; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .searchbox input { width: 140px; }
}

/* ---------- Phase 2 ---------- */

/* Toasts (feedback after an action) */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 40px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 14px; animation: toast-in .18s ease-out; }
.toast > .i-sm { margin-top: 2px; }
.toast.success > .i-sm { color: var(--ok); }
.toast.info > .i-sm { color: var(--primary-text); }
.toast.error { border-color: var(--bad-border); }
.toast.error > .i-sm { color: var(--bad); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
.toast-x { border: 0; background: none; color: var(--muted); padding: 2px; border-radius: 6px; cursor: pointer; display: flex; }
.toast-x:hover { background: var(--surface-3); color: var(--text); }
.toast-live > .i-sm { color: var(--primary-text); }
.toast-body { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.toast-body .btn { margin-top: 8px; }
.toast-live[role="alert"] { border-color: var(--primary); }
.desk-status { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.desk-status::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.desk-status[data-state="on"]::before { background: var(--ok); }
.desk-status[data-state="blocked"]::before { background: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } .toast.leaving { transition: none; } }

/* Errors next to the field they belong to */
.field-error { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--bad); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }

/* Inline status rows (mail test, system status) */
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.status-line.ok { background: var(--ok-bg); color: var(--ok); }
.status-line.bad { background: var(--bad-bg); color: var(--bad); }
.status-line.warn { background: var(--warn-bg); color: var(--warn); }
.status-line .when { color: var(--muted); font-size: 12px; }
.status-line .fix { flex-basis: 100%; color: var(--text-2); }
.section-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sla-table input { width: 120px; }
.checks { list-style: none; margin: 0; padding: 0; }
.check-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border-soft); }
.check-row:last-child { border-bottom: 0; }
.check-icon { display: flex; width: 24px; height: 24px; border-radius: 999px; align-items: center; justify-content: center; flex: none; }
.check-row.ok .check-icon { background: var(--ok-bg); color: var(--ok); }
.check-row.warn .check-icon { background: var(--warn-bg); color: var(--warn); }
.check-row.bad .check-icon { background: var(--bad-bg); color: var(--bad); }
.check-hint { display: block; margin-top: 4px; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.check-row.bad .check-hint { color: var(--bad); }
fieldset.plain { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
fieldset.plain legend { padding: 0; margin-bottom: 4px; font-weight: 500; color: var(--text-2); }
.reasons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.reasons li { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; }
.quarantine-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 520px; overflow: auto; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rule-list { list-style: none; margin: 0; padding: 0; }
.rule { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border-soft); }
.rule:last-child { border-bottom: 0; }
.rule.off { opacity: .65; }
.rule .grow { display: flex; flex-direction: column; gap: 4px; }
.rule-no { width: 28px; height: 28px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; flex: none; }
.rule-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cond-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.cond-row .field { min-width: 160px; }
.cond-row .field.grow { flex: 1 1 220px; }
/* Editor */
.editor { border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.editor:focus-within { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.editor-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; border-bottom: 1px solid var(--border-soft); }
.ed-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 0; border-radius: 6px; background: none; color: var(--text-2); cursor: pointer; }
.ed-btn:hover, .ed-btn[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.ed-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.editor-area { min-height: 170px; max-height: 60vh; overflow-y: auto; padding: 12px 14px; font-size: 15px; line-height: 1.6; outline: none; overflow-wrap: anywhere; }
.editor-area:empty::before { content: attr(data-placeholder); color: var(--faint); }
.editor-area p { margin: 0 0 8px; }
.field .editor { color: var(--text); font-weight: 400; }
.editor.tall .editor-area { min-height: 380px; max-height: 70vh; }
.editor-area h2, .portal-article-body h2 { margin: 18px 0 8px; font-size: 19px; line-height: 1.3; color: var(--text); }
.editor-area h3, .portal-article-body h3 { margin: 14px 0 6px; font-size: 16px; line-height: 1.35; color: var(--text); }
.editor-area h2:first-child, .editor-area h3:first-child, .portal-article-body h2:first-child, .portal-article-body h3:first-child { margin-top: 0; }
.ed-btn.ed-txt { width: auto; min-width: 34px; padding: 0 8px; font: inherit; font-size: 13px; font-weight: 700; }
.portal-article-body.styled p { margin: 0 0 12px; }
.portal-article-body.styled ul, .portal-article-body.styled ol { margin: 0 0 12px; padding-left: 24px; }
.portal-article-body.styled li { margin-bottom: 4px; }
.portal-article-body.styled blockquote { margin: 0 0 12px; padding-left: 12px; border-left: 3px solid var(--border); }
.portal-article-body.styled a { text-decoration: underline; }
.editor-area ul, .editor-area ol { margin: 0 0 8px; padding-left: 22px; }
.editor-area blockquote { margin: 0 0 8px; padding-left: 12px; border-left: 3px solid var(--border); color: var(--text-3); }
[data-editor-error] { padding: 0 14px 10px; }
.files { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.files input[type=file] { font-size: 13px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; background: var(--surface-3); font-size: 12px; }
/* HTML mail in a sandboxed frame */
.mail-frame { width: 100%; height: 320px; border: 0; border-radius: 8px; background: #fff; display: block; }
.mail-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.plain-version { flex-basis: 100%; }
.plain-version summary { cursor: pointer; color: var(--muted); }
.plain-version .msg-body { margin-top: 8px; padding: 12px; background: var(--surface-2); border-radius: 8px; font-size: 14px; }
.msg-html { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.msg-html p { margin: 0 0 8px; }
.msg-html ul, .msg-html ol { margin: 0 0 8px; padding-left: 22px; }
.risk-note { border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.risk-note.warn { background: var(--warn-bg); color: var(--warn); }
.risk-note.bad { background: var(--bad-bg); color: var(--bad); }
.risk-note summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.risk-note ul { margin: 8px 0 0; padding-left: 24px; }
.chip.tag { background: var(--surface-3); color: var(--text-2); font-weight: 500; }
.block-box summary { display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--bad); }
.block-box form { margin-top: 10px; }
.reply-top { align-items: center; }
.canned-pick select { min-width: 220px; }
.count.warn { background: var(--warn-bg); color: var(--warn); }
/* AI */
.ai-card { border-color: var(--violet-bg); }
.ai-card h2 { display: flex; align-items: center; gap: 8px; color: var(--violet); }
.ai-text { background: var(--surface-2); border-radius: 8px; padding: 12px 14px; font-size: 14px; }
.ai-summary { color: var(--text-3); }
.split-source { padding: 12px 16px; gap: 8px; background: var(--surface-2); }
button[aria-busy="true"] { opacity: .6; cursor: progress; }
.ai-models input { width: 100%; min-width: 90px; }
.ai-models td:nth-child(2) { min-width: 220px; }
.big-number { font-size: 24px; font-weight: 700; }
.budget-bar { width: 100%; height: 10px; accent-color: var(--primary); }
.budget-bar.warn { accent-color: var(--warn); }
.budget-bar.paused { accent-color: var(--bad); }
.cost-cols { padding: 0 0 8px; }
/* The logo block links to the start page but should not look like a link. */
a.brand, a.brand:hover, a.brand:visited { color: var(--text); text-decoration: none; border-radius: 10px; }
a.brand .brand-name strong { color: var(--text); }
a.brand .brand-name span { color: var(--muted); }
a.brand:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.brand-logo { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; flex: none; background: var(--surface); }
.brand-logo.lg { width: 52px; height: 52px; border-radius: 12px; }
.logo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
/* Secrets (API keys, mailbox passwords): masked like a password, but not a "password"
   field, so browsers never fill in the user's own sign-in password here. */
.secret-input { -webkit-text-security: disc; text-security: disc; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .05em; }

/* Sidebar fixed to the screen height on larger screens: logo + department on top,
   links scroll in the middle when needed, account always visible at the bottom. */
.nav-scroll { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; min-height: 0; padding-bottom: 12px; }
@media (min-width: 721px) {
  .sidebar { position: sticky; top: 0; height: 100vh; box-sizing: border-box; align-self: flex-start; flex: 0 0 232px; }
  .app { flex-wrap: nowrap; }
  /* The menu still scrolls (mouse wheel, trackpad, keyboard), but without a visible scrollbar.
     A soft fade at the bottom shows when there are more links below. */
  .nav-scroll { overflow-y: auto; margin: 0 -12px; padding: 0 12px 12px; scrollbar-width: none; }
  .nav-scroll::-webkit-scrollbar { display: none; }
  .nav-scroll.more-below { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); }
  .usercard-wrap { flex: none; }
}
/* Laptop screens with a mouse: slightly tighter links, so the whole menu usually fits. */
@media (min-width: 721px) and (max-height: 1000px) and (pointer: fine) {
  .nav-link { min-height: 38px; }
  .nav-section { padding-top: 12px; }
}

/* ---------- Phone layout (≤ 720 px) ---------- */
.topbar, .bottombar, .reply-bar, .nav-close, .nav-overlay, .composer-top, .dock-bar { display: none; }
.reply-dock { display: flex; flex-direction: column; gap: 16px; }
.dock-body { display: flex; flex-direction: column; gap: 16px; }
/* Computer: the reply area is a dock that stays at the bottom of the screen while the conversation scrolls behind it. */
@media (min-width: 721px) {
  .reply-dock { position: sticky; bottom: 0; z-index: 30; gap: 0; margin: 0 -10px; padding: 10px 10px 12px; background: var(--bg); }
  .reply-dock .dock-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 -6px 18px rgba(16, 24, 40, .08); }
  .dock-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 999px; background: var(--primary-bg, #EEF3FD); color: var(--primary-text); flex: none; }
  .dock-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .dock-text strong { font-size: 14px; }
  .reply-dock .dock-close { display: none; }
  /* position: relative keeps hidden, absolutely positioned inputs inside the scrolling dock; without it they make the page taller. */
  .reply-dock .dock-body { display: none; position: relative; }
  .reply-dock.is-open .dock-body { display: flex; max-height: 66vh; overflow-y: auto; padding-top: 12px; overscroll-behavior: contain; }
  .reply-dock.is-open [data-dock-open] { display: none; }
  .reply-dock.is-open .dock-close { display: inline-flex; }
  .reply-dock .editor-area { min-height: 110px; max-height: 30vh; }
  /* Soft fade above the dock while the conversation scrolls behind it (is-stuck is set by app.js). */
  .reply-dock::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 24px; background: linear-gradient(to bottom, transparent, var(--bg)); pointer-events: none; opacity: 0; transition: opacity .15s; }
  .reply-dock.is-stuck::before { opacity: 1; }
  /* The dock ends at the bottom of the window: no page margin below it; the side column keeps its own space. */
  .page-ticket .main { padding-bottom: 0; }
  .page-ticket .side { padding-bottom: 32px; }
}
.skip { position: absolute; left: -9999px; top: 0; z-index: 200; padding: 10px 14px; background: var(--surface); color: var(--text); border-radius: 8px; }
.skip:focus { left: 12px; top: 12px; }
.scroll-x { scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
.grid2 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.icon-btn { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

@media (max-width: 720px) {
  /* header */
  .topbar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 40; min-height: 64px; padding: calc(env(safe-area-inset-top) + 10px) 8px 10px 12px; box-sizing: border-box; background: var(--surface); border-bottom: 1px solid var(--border); }
  .topbar-brand { display: flex; border-radius: 8px; }
  .topbar .menu.compact .switcher { min-height: 44px; padding: 0 12px; margin-bottom: 0; }
  .topbar > .grow { display: flex; align-items: center; }
  .topbar > .grow > .menu { flex: 1; min-width: 0; }
  .topbar .menu.compact .switcher .label { display: none; }
  .topbar .menu.compact .switcher .value { font-size: 15px; }
  .topbar .menu-panel { width: min(320px, calc(100vw - 24px)); left: auto; right: -52px; }

  /* menu slides in from the left */
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; z-index: 90; width: min(318px, 86vw); height: auto; overflow-y: auto; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 8px 0 28px rgba(16, 24, 40, .18); border-right: 0; border-bottom: 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .sidebar:target, body.nav-open .sidebar { transform: none; }
  .sidebar > .menu:not(.menu-up) { display: none; } /* the department switcher lives in the header */
  .sidebar .brand { padding-right: 48px; }
  .nav-close { display: inline-flex; position: absolute; top: 14px; right: 8px; }
  .nav-overlay { position: fixed; inset: 0; z-index: 85; background: rgba(12, 17, 29, .45); }
  .sidebar:target + .nav-overlay, body.nav-open .nav-overlay { display: block; }
  .nav-scroll { overflow: visible; }
  @media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

  /* bottom bar */
  .bottombar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; padding: 4px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
  .bottombar a { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; border-radius: 10px; }
  .bottombar a[aria-current="page"] { color: var(--primary-text); }
  .bb-plus { width: 44px; height: 44px; margin-top: -6px; border-radius: 999px; background: var(--action); color: var(--on-action); display: flex; align-items: center; justify-content: center; }
  .bb-count { position: absolute; top: 4px; left: 50%; margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 999px; background: var(--warn); color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; }
  .main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .toasts { right: 12px; left: 12px; width: auto; bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* basics: no iPhone zoom on focus, big enough to tap */
  input, select, textarea, .editor-area { font-size: 16px !important; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 40px; }
  .page-head h1, h1 { font-size: 21px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 14px; }
  .stat .v { font-size: 24px; }

  /* ticket list as cards */
  .card-head { padding: 12px; }
  .tabs.scroll-x { flex-wrap: nowrap; overflow-x: auto; width: 100%; }
  .tabs.scroll-x a { flex: none; white-space: nowrap; }
  .searchbox { flex: 1 1 100%; }
  .searchbox input { width: 100%; }
  .t-queue thead { display: none; }
  .t-queue, .t-queue tbody { display: block; }
  .t-queue tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); position: relative; }
  .t-queue td { display: block; padding: 0; border: 0; }
  .t-queue .td-ref { order: 1; flex: 1; }
  .t-queue .td-updated { order: 2; }
  .t-queue .td-subject { order: 3; flex-basis: 100%; }
  .t-queue .td-from { order: 3; flex-basis: 100%; max-width: none; font-size: 13px; color: var(--text-3); }
  .t-queue .td-from .from-sub { display: none; }
  .t-queue .td-chip { order: 4; }
  .t-queue .td-due .muted { display: none; }
  .t-queue .td-assignee { order: 5; flex-basis: 100%; font-size: 13px; }
  .t-queue a.subject { font-size: 15px; }
  .t-queue a.subject::after { content: ""; position: absolute; inset: 0; }
  .t-queue tr:has(a.subject:focus-visible) { outline: 2px solid var(--primary); outline-offset: -2px; }

  /* ticket page */
  .page-ticket .main { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .page-ticket .page-head { flex-wrap: nowrap; align-items: flex-start; }
  .details-toggle { flex: none; }
  .page-ticket .page-head { flex-wrap: wrap; }
  .page-ticket .page-head .titles { flex: 1 1 0; min-width: 0; }
  .page-ticket .working-on { order: 3; flex-basis: 100%; margin-left: 0; }
  .cols { flex-direction: column; }
  .cols > .side { order: -1; }
  body.details-collapsed .cols > .side { display: none; }
  .msg { padding: 14px; }
  .reply-bar { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
  .reply-bar .btn { flex: 1; min-height: 48px; justify-content: center; }
  .reply-bar .btn.primary { flex: 2; }

  /* writing a reply: full screen */
  body.composing { overflow: hidden; }
  body.composing .reply-bar { display: none; }
  body.composing .composer { position: fixed; inset: 0; z-index: 95; margin: 0; border: 0; border-radius: 0; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
  body.composing .composer-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; position: sticky; top: 0; z-index: 2; min-height: 56px; padding: env(safe-area-inset-top) 12px 0; background: var(--surface); border-bottom: 1px solid var(--border); }
  .composer-top .btn.link { justify-self: start; min-height: 44px; }
  .composer .editor-area { min-height: 40vh; }
}
/* Wide tables scroll inside their box instead of widening the page. */
.container > *, .stack > *, .card.pad > * { min-width: 0; }
.table-wrap { max-width: 100%; position: relative; }
@media (max-width: 720px) {
  .hide-phone { display: none !important; }
  .sidebar .nav-scroll { flex: none; }
  .sidebar .usercard-wrap { margin-top: 8px; background: var(--surface); }
}
/* Notifications */
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list a { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border-soft); color: var(--text); text-decoration: none; }
.notif-list li:last-child a { border-bottom: 0; }
.notif-list a:hover { background: var(--surface-2); }
.notif-list .grow { display: flex; flex-direction: column; gap: 2px; }
.notif-dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 999px; flex: none; background: transparent; }
.notif-list li.unread .notif-dot { background: var(--primary); }
.notif-list li.unread .notif-title { font-weight: 600; }
.bell { position: relative; }
.bell-count { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.notif-prefs td, .notif-prefs th { text-align: center; }
.notif-prefs td:first-child, .notif-prefs th:first-child { text-align: left; }
.notif-prefs input { width: 20px; height: 20px; accent-color: var(--action); }
.count.bad-count { background: var(--bad); color: #fff; }
/* The menu's close button is only for the phone slide-in menu. */
.sidebar .nav-close { display: none; }
@media (max-width: 720px) { .sidebar .nav-close { display: inline-flex; } }
/* Sortable column headers */
.t th a.sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; text-decoration: none; min-height: 28px; border-radius: 6px; }
.t th a.sort:hover, .t th a.sort.active { color: var(--text); }
.t th a.sort .sort-idle { opacity: 0; transition: opacity .15s; }
.t th a.sort:hover .sort-idle, .t th a.sort:focus-visible .sort-idle { opacity: .6; }

/* Reply recipients (To / Cc picker) */
.rcpt { display: flex; flex-direction: column; gap: 8px; }
.rcpt-pick { position: relative; }
.rcpt-box { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-height: 44px; padding: 6px 8px 6px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); cursor: pointer; }
.rcpt-box::-webkit-details-marker { display: none; }
.rcpt-pick[open] .rcpt-box, .rcpt-box:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); outline: none; }
.rcpt-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.rcpt-k { font-size: 13px; font-weight: 500; color: var(--muted); min-width: 22px; }
.rcpt-pills { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.rcpt-pill { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 28px; padding: 0 10px; border-radius: 999px; background: var(--surface-3); font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.rcpt-pill small { font-size: 12px; color: var(--muted); }
.rcpt-pill.warn { background: var(--warn-bg); color: var(--warn); }
.rcpt-pill .rcpt-x { margin-right: -6px; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.rcpt-pill .rcpt-x:hover { background: var(--border); color: var(--text); }
.rcpt-more { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.rcpt-menu { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.rcpt-head { padding: 10px 14px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border-soft); }
.rcpt-opt { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border-soft); }
.rcpt-opt > input { width: 18px; height: 18px; flex: none; }
.rcpt-opt.dis { opacity: .55; }
.rcpt-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; font-size: 14px; }
.rcpt-who b { font-weight: 600; overflow-wrap: anywhere; }
.rcpt-who > span { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.rcpt-who .chip { height: 20px; padding: 0 8px; font-size: 11px; background: var(--surface-3); color: var(--text-2); }
.rcpt-seg { display: inline-flex; flex: none; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; }
.rcpt-seg label { position: relative; }
.rcpt-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rcpt-seg span { display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; font-size: 12px; font-weight: 600; color: var(--text-3); cursor: pointer; }
.rcpt-seg input:checked + span { background: var(--action); color: var(--on-action, #FFFFFF); }
.rcpt-seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.rcpt-opt:has(> input:not(:checked)) .rcpt-seg { opacity: .45; }
.rcpt-typed { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 14px 0; }
.rcpt-foot { margin: 0; padding: 8px 14px 12px; }
.rcpt-make { font-size: 13px; }
@media (max-width: 720px) {
  .rcpt-typed { grid-template-columns: 1fr; }
  .rcpt-menu { position: static; margin-top: 6px; box-shadow: none; max-height: none; }
  .rcpt-opt { flex-wrap: wrap; }
}

/* Reports */
.report-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.report-filters .field.inline { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.report-filters .field.inline input, .report-filters .field.inline select { min-height: 40px; width: auto; }
.report-filters input[type=date] { min-width: 150px; }
input[type=date]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .6; }
input[type=date]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
.report-filters .btn { min-height: 40px; }
.report-kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.report-kpis .v { font-size: 26px; }
.delta.good { color: var(--ok); font-weight: 600; }
.delta.bad { color: var(--bad); font-weight: 600; }
.delta.muted { color: var(--muted); }
.legend { display: inline-flex; align-items: center; gap: 6px 8px; font-size: 13px; color: var(--text-3); }
.legend .key { width: 10px; height: 10px; border-radius: 3px; margin-left: 8px; }
.legend .key.new { background: var(--primary); }
.legend .key.solved { background: var(--action); opacity: .75; }
.chart-wrap { padding: 12px 20px 8px; overflow-x: auto; }
svg.chart { display: block; width: 100%; min-width: 760px; height: auto; }
svg.chart .grid { stroke: var(--border-soft); }
svg.chart .tick { font-size: 11px; fill: var(--muted); font-family: inherit; }
svg.chart .b-new { fill: var(--primary); }
svg.chart .b-solved { fill: var(--action); opacity: .75; }
.report-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.pct { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
svg.meter { width: 90px; height: 8px; flex: none; }
svg.meter.wide { width: 100%; height: 10px; }
svg.meter .track { fill: var(--border-soft); }
svg.meter .fill.good { fill: var(--ok); }
svg.meter .fill.warn { fill: var(--warn); }
svg.meter .fill.bad { fill: var(--bad); }
svg.meter .fill.cat { fill: var(--primary); }
.cat-list { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.cat-row { display: grid; grid-template-columns: minmax(120px, 2fr) 3fr 36px; align-items: center; gap: 12px; font-size: 14px; }
.cat-row strong { text-align: right; }
.cat-name { overflow-wrap: anywhere; }
.nowrap { flex-wrap: nowrap; white-space: nowrap; }
table[data-sortable] th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
table[data-sortable] th[aria-sort="ascending"] button::after { content: "▲"; font-size: 9px; }
table[data-sortable] th[aria-sort="descending"] button::after { content: "▼"; font-size: 9px; }
@media (max-width: 1100px) { .report-cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) {
  .report-kpis { grid-template-columns: repeat(2, 1fr); }
  .report-kpis .v { font-size: 22px; }
  .cat-row { grid-template-columns: minmax(100px, 1fr) 1fr 32px; }
}

/* Rule suggestions */
.suggest-card .card-head h2 { display: flex; align-items: center; gap: 8px; }
.suggest-list { list-style: none; margin: 0; padding: 0; }
.suggest-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.suggest-list li:last-child { border-bottom: 0; }
.suggest-list form { margin: 0; }

/* Help */
.nav-sep { height: 1px; background: var(--border-soft); margin: 10px 12px; }
.help-search { max-width: 520px; }
.help-search input { width: 100%; flex: 1; }
.help-group { display: flex; flex-direction: column; gap: 10px; }
.help-group-title { margin: 8px 0 0; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.help-card { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color .15s; }
.help-card:hover { color: var(--text); border-color: var(--border-strong); }
.help-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.help-card .grow { display: flex; flex-direction: column; gap: 4px; }
.help-icon { width: 38px; height: 38px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--surface-3); color: var(--text-2); }
.help-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.help-toc { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; }
.help-toc a { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px; border-radius: 8px; font-size: 14px; color: var(--text-3); text-decoration: none; }
.help-toc a:hover { background: var(--surface-3); color: var(--text); }
.help-toc a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.help-article { max-width: 780px; gap: 18px; }
.help-head { display: flex; align-items: flex-start; gap: 14px; }
.help-head h1 { margin: 0 0 4px; font-size: 24px; }
.help-head p { margin: 0; }
.help-body { font-size: 15px; line-height: 1.65; color: var(--text); }
.help-body h2 { margin: 22px 0 6px; font-size: 17px; }
.help-body p { margin: 0 0 10px; }
.help-body ul, .help-body ol { margin: 0 0 12px; padding-left: 22px; }
.help-body li { margin: 4px 0; }
.help-body code { font-size: 13px; padding: 1px 6px; border-radius: 5px; background: var(--surface-3); }
.help-tip { margin: 14px 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-soft); font-size: 14px; }
.help-pager { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border-soft); }
@media (max-width: 900px) {
  .help-layout { grid-template-columns: minmax(0, 1fr); }
  .help-toc { display: none; }
}

/* Customer portal */
/* The footer sits at the bottom of the window on short pages (and after the content on long ones). */
body.portal { background: var(--bg); display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.portal-wrap { width: 100%; max-width: 1120px; margin: 0 auto; box-sizing: border-box; padding-left: 24px; padding-right: 24px; }
.portal-top { background: var(--surface); border-bottom: 1px solid var(--border); }
.portal-top-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.portal-brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 16px; }
.portal-brand:hover { color: var(--text); }
.portal-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; }
.portal-nav a { color: var(--text-2); text-decoration: none; min-height: 40px; display: inline-flex; align-items: center; }
.portal-nav a:hover { color: var(--text); text-decoration: underline; }
.portal-nav form { margin: 0; }
.portal-who { display: inline-flex; align-items: center; gap: 6px; max-width: 240px; }
.portal-nav .btn { text-decoration: none; }
.portal-nav .btn.primary, .portal-nav .btn.primary:hover { color: #fff; text-decoration: none; }
.portal-nav a.btn:hover { text-decoration: none; }
.portal-menu .menu-panel { right: 0; left: auto; min-width: 200px; z-index: 30; }
.portal-menu form { margin: 0; }
.portal-menu button.menu-item { width: 100%; border: 0; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.portal-nav .menu-item { min-height: 40px; text-decoration: none; }
/* Offer of the browser's language: one line above the header, in the offered language. */
.lang-offer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 14px; padding: 8px 48px 8px 16px; background: #16181D; color: #fff; font-size: 14px; position: relative; }
.lang-offer[hidden] { display: none; }
.lang-offer-btn { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 6px; background: #fff; color: #16181D; font-weight: 600; font-size: 13px; text-decoration: none; }
.lang-offer-btn:hover { color: #16181D; background: #E4E7EC; }
.lang-offer-x { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
.lang-offer-x:hover { background: rgba(255, 255, 255, .14); }
/* The portal is switched off */
.portal-closed { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.closed-box { max-width: 560px; padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.closed-box h1 { margin: 8px 0 0; font-size: 28px; }
.closed-box p { margin: 0; font-size: 16px; line-height: 1.55; color: var(--text-2); }
.closed-langs { margin-top: 10px !important; font-size: 13px !important; color: var(--muted) !important; }
.portal-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-main { display: flex; flex-direction: column; gap: 20px; padding-top: 28px; padding-bottom: 48px; }
.portal-main { flex: 1 0 auto; }
.portal-foot { padding-top: 8px; padding-bottom: 28px; text-align: center; }
.portal-narrow { max-width: 520px; width: 100%; margin: 24px auto 0; }
.portal-narrow h1 { margin: 0; font-size: 22px; }
.portal-titles h1 { margin: 0 0 4px; font-size: 26px; }
.portal-titles p { margin: 0; }
.portal-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.portal-cols > form h2, #reply h2 { margin: 0; font-size: 18px; }
.portal-list { list-style: none; margin: 0; padding: 0; }
.portal-list li { border-bottom: 1px solid var(--border-soft); }
.portal-list a { display: flex; flex-direction: column; gap: 4px; padding: 14px 20px; color: var(--text); text-decoration: none; }
.portal-list a:hover { background: var(--surface-2); color: var(--text); }
.portal-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.portal-note { margin: 0; padding: 12px 20px; }
.portal-thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.portal-msg { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.portal-msg.them { border-left: 3px solid var(--primary); }
.portal-msg-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.portal-msg-body { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.portal-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.portal-files a { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 860px) {
  .portal-cols { grid-template-columns: minmax(0, 1fr); }
  .portal-wrap { padding-left: 16px; padding-right: 16px; }
}

/* ---------- Website chat: Live chats, Visitors now, settings ---------- */
.sdot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; background: var(--faint); flex: none; }
.sdot.on { background: var(--ok-dot); }
.segmented.presence { margin: 0; }
.segmented.presence button { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; }
.chip.strong { font-weight: 700; }
.chip.live { height: 28px; }
.stat.stat-warn { background: var(--warn-bg); border-color: var(--warn-border); }
.stat.stat-warn .k, .stat.stat-warn .v { color: var(--warn); }
.cc { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--border); font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--text-2); }
.card-title { margin: 0; padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--border-soft); }
.card-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.code-block { margin: 0; padding: 14px 16px; border-radius: 10px; background: #101828; color: #E4E7EC; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.topic-row { display: grid; grid-template-columns: minmax(0, 1fr) 180px auto; gap: 10px; align-items: center; }
.topic-row input[type="text"], .topic-row select { min-height: 40px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.pad-sm { padding: 12px; min-width: 240px; }

.chat-desk { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) minmax(230px, 280px); gap: 16px; align-items: start; }
.chat-list ul { list-style: none; margin: 0; padding: 0; max-height: 70vh; overflow-y: auto; }
.chat-row { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); color: var(--text); text-decoration: none; }
.chat-row:hover { background: var(--surface-2); color: var(--text); }
.chat-row.current { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.chat-row-top { display: flex; align-items: center; gap: 8px; }
.chat-row-top strong { flex: 1; min-width: 0; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-time { color: var(--muted); white-space: nowrap; }
.chat-preview { color: var(--muted); overflow-wrap: anywhere; }
.chat-preview b { font-weight: 600; }
.chat-ref { font-variant-numeric: tabular-nums; }
.chat-row.unread .chat-row-top strong { font-weight: 700; color: var(--text); }
.chat-row.unread .chat-preview { color: var(--text); font-weight: 600; }
.chat-row.unread .chat-time { color: var(--bad); font-weight: 600; }
.unread-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box; border-radius: 999px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; line-height: 1; }
.new-dot { width: 8px; height: 8px; flex: none; border-radius: 999px; background: var(--bad); }
.chat-group { padding: 10px 14px 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border-soft); }
.chat-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-right: 16px; border-bottom: 1px solid var(--border-soft); }
.chat-list-head .card-title { border-bottom: 0; }
.chat-list-head [data-unread-total] { display: inline-flex; align-items: center; gap: 6px; }
.chat-list-head [data-unread-total][hidden] { display: none; }
.row-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chat-conv { display: flex; flex-direction: column; min-width: 0; }
.chat-conv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
.chat-conv-head h2 { font-size: 16px; }
.chat-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 16px 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }
.chat-banner.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.chat-banner.ok { background: var(--ok-bg); border-color: var(--ok-bg); color: var(--ok); }
.chat-banner.info { background: var(--primary-soft); border-color: var(--primary-soft); color: var(--primary-text); }
.desk-msgs { list-style: none; margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 12px; max-height: 58vh; overflow-y: auto; }
.dmsg { display: flex; flex-direction: column; gap: 4px; max-width: 80%; }
.dmsg .who { font-size: 11px; font-weight: 600; color: var(--muted); }
.dmsg .text { padding: 10px 12px; border-radius: 4px 12px 12px 12px; background: var(--primary-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.dmsg.agent .text { background: var(--surface-3); }
.dmsg .text.chat-imgs { padding: 0; display: flex; flex-wrap: wrap; gap: 4px; background: none; }
.dmsg .text.chat-imgs img { display: block; max-width: 100%; max-height: 260px; border-radius: 12px; border: 1px solid var(--border); }
.desk-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 16px 16px; }
.desk-tools form { display: inline-flex; margin: 0; padding: 0; }
.desk-note { flex: 1 1 0; min-width: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desk-tools .btn { gap: 6px; color: var(--text-2); }
.desk-image label { cursor: pointer; }
.desk-image label:focus-within { outline: 2px solid var(--action); outline-offset: 2px; }
.dmsg.visitor { align-self: flex-end; align-items: flex-end; }
.dmsg.visitor .text { background: var(--visitor-bg); color: var(--visitor-text); border: 1px solid var(--visitor-border); border-radius: 12px 4px 12px 12px; }
.dmsg.visitor .text a { color: inherit; }
.dmsg.event { align-self: stretch; max-width: none; flex-direction: row; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.dmsg.event::before, .dmsg.event::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.ai-feedback { display: flex; gap: 12px; }
.ai-feedback .btn.link { font-size: 12px; color: var(--muted); }
.ai-feedback .btn.link[aria-pressed="true"] { color: var(--primary-text); font-weight: 600; }
.desk-typing { margin: 0 16px 8px; }
.desk-compose { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 10px; border-top: 1px solid var(--border-soft); }
.desk-compose textarea { flex: 1; min-height: 52px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; resize: vertical; }
.nowrap-row { flex-wrap: nowrap; align-items: flex-end; }
.suggest-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border: 1px dashed var(--primary); border-radius: 10px; background: var(--primary-soft); }
.chat-side { display: flex; flex-direction: column; gap: 16px; }
.chat-side .kv dd { text-align: left; overflow-wrap: anywhere; }

.visitors-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); gap: 16px; align-items: start; }
.visitors-table tr.current td { background: var(--primary-soft); }
.visitors-table td { white-space: nowrap; }
.visitor-side { gap: 16px; }
.page-trail { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.page-trail li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; overflow-wrap: anywhere; }
.page-trail li.now span:last-child { font-weight: 600; }

@media (max-width: 1100px) {
  .chat-desk { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); }
  .chat-side { grid-column: 1 / -1; }
  .visitors-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .chat-desk { grid-template-columns: minmax(0, 1fr); }
  .chat-list ul { max-height: 40vh; }
  .desk-msgs { max-height: none; }
  .dmsg { max-width: 92%; }
  .topic-row { grid-template-columns: minmax(0, 1fr); }
}
.help-snippet { display: block; margin-top: 4px; color: var(--text-2); line-height: 1.5; }
.help-snippet mark, .help-body mark { background: rgba(247, 144, 9, .28); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Foldable Admin group in the menu */
.nav-group > summary { list-style: none; cursor: pointer; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group-head .chev { transition: transform .15s; color: var(--muted); }
.nav-group[open] > .nav-group-head .chev { transform: rotate(180deg); }
.nav-group-head:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.nav-group-items { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 22px; padding-left: 10px; border-left: 1px solid var(--border); }
.nav-link.nav-sub { min-height: 38px; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .nav-group-head .chev { transition: none; } }
.ai-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.ai-source { display: inline-flex; align-items: center; gap: 4px; }

/* Answer library: rate our replies as AI examples */
.msg-rate { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding-top: 8px; border-top: 1px solid var(--border-soft); }
.btn.xs { min-height: 30px; padding: 0 10px; font-size: 12px; gap: 6px; }
.btn.xs.on { background: var(--surface-3); border-color: var(--border-strong); color: var(--text); font-weight: 600; }
.answer-row { display: flex; flex-direction: column; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--border-soft); }
.answer-row .qa { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.answer-row .qa div { font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 9.5em; overflow: hidden; color: var(--text-2); }
.answer-row .qa strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
.answer-row form { margin: 0; }
@media (max-width: 720px) { .answer-row .qa { grid-template-columns: minmax(0, 1fr); } }

/* Knowledge base: add several web pages at once */
.bulk-urls { margin-top: 10px; }
.bulk-urls > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--primary); font-size: 14px; font-weight: 500; list-style: none; }
.bulk-urls > summary::-webkit-details-marker { display: none; }
.bulk-urls[open] > summary { margin-bottom: 10px; }
.bulk-urls textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
/* Fields that hold code (Settings → Custom code) use the same monospace font as the code boxes. */
textarea.code-field { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; tab-size: 2; }

/* Knowledge base → Chat review */
.review-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.chip-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 14px; font-weight: 500; text-decoration: none; }
.chip-link:hover { border-color: var(--faint); color: var(--text); }
.chip-link.active { border-color: var(--primary); color: var(--primary-text); background: var(--primary-soft); }
.review-item { display: flex; flex-direction: column; gap: 12px; }
.review-meta { gap: 10px; flex-wrap: wrap; }
.review-qa { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; margin: 0; }
.review-qa dt { color: var(--muted); font-size: 13px; font-weight: 600; }
.review-qa dd { margin: 0; white-space: normal; overflow-wrap: anywhere; }
.review-ai { padding: 8px 12px; border-radius: 8px; background: var(--surface-3); }
.review-from { margin-bottom: 0; border-left: 3px solid var(--primary); }
@media (max-width: 640px) { .review-qa { grid-template-columns: 1fr; } .review-qa dt { margin-top: 4px; } }

/* Pagination (list footer) */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border-soft); }
.pager-pages { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pg { min-width: 32px; height: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid transparent; color: var(--text-2); font-size: 14px; font-weight: 500; text-decoration: none; }
a.pg:hover { border-color: var(--border); color: var(--text); }
.pg.cur { border-color: var(--border); background: var(--surface-3); color: var(--text); font-weight: 600; }
.pg.off { opacity: .35; }
.pg.gap { min-width: 20px; padding: 0; }
.pager-size label { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.pager-size select { width: auto; min-width: 72px; padding-top: 4px; padding-bottom: 4px; }
.i-sm.flip, .flip { transform: scaleX(-1); }
.card > .pager:first-child { border-top: 0; }

/* Account settings → chat sounds */
.h-sub { font-size: 15px; margin: 16px 0 4px; }
.sound-picks select { min-width: 0; }

/* Portal extras: help articles, company requests, admin pages */
.portal-tab { padding: 0 10px; border-radius: 8px; font-weight: 500; }
.portal-nav a.portal-tab[aria-current="page"] { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; text-decoration: none; }
.portal-head { align-items: flex-end; }
.portal-head .text { color: var(--text); }
.portal-requests { overflow: hidden; }
.portal-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.portal-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.portal-filters .searchbox { min-height: 40px; }
.portal-filters .searchbox input { width: 160px; min-height: 36px; }
.portal-filters select { min-height: 40px; width: auto; }
.portal-members { list-style: none; margin: 0; padding: 0; }
.portal-members li { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--border-soft); }
.portal-members .avatar { width: 32px; height: 32px; font-size: 12px; }
.card.pad.portal-info { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--text-2); }
.portal-cta h2 { margin: 0; font-size: 16px; }
.portal-cta p { margin: 0; color: var(--text-2); }
.portal-cta .btn { align-self: flex-start; }
.portal-cta.tint { background: var(--primary-soft); border-color: transparent; }
.portal-cta .searchbox input { width: 100%; }
.portal-help-link { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.portal-hero { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.portal-hero h1 { margin: 0; font-size: 28px; letter-spacing: -0.01em; }
.portal-hero p { margin: 0; }
.portal-search { display: flex; flex-wrap: wrap; gap: 10px; }
.searchbox.big { flex: 1 1 360px; min-height: 52px; border-radius: 10px; }
.searchbox.big input { width: 100%; font-size: 16px; }
.btn.big { min-height: 52px; padding: 0 22px; font-size: 15px; }
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.help-results, .help-list { list-style: none; margin: 0; padding: 0; }
.help-results li + li, .help-list li + li { border-top: 1px solid var(--border-soft); }
.help-results a { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; color: var(--text); text-decoration: none; }
.help-results a:hover, .help-list a:hover { background: var(--surface-2); color: var(--text); }
.help-results strong { font-size: 15px; }
.help-excerpt { color: var(--text-2); }
.help-results mark, .help-excerpt mark { background: var(--warn-bg); color: inherit; border-radius: 3px; padding: 0 1px; }
.help-list a { display: flex; align-items: flex-start; gap: 10px; padding: 12px 20px; color: var(--text); text-decoration: none; font-size: 14px; }
.help-list .i-sm { margin-top: 2px; color: var(--muted); }
.section-h { margin: 0; font-size: 18px; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.topic-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; }
.topic-card:hover, .topic-card.on { border-color: var(--primary); color: var(--text); }
.topic-card strong { font-size: 15px; }
.portal-article h1 { margin: 0; font-size: 24px; }
.portal-article .eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.portal-article-body { font-size: 15px; line-height: 1.7; color: var(--text-2); overflow-wrap: anywhere; }
.help-feedback { padding-top: 14px; border-top: 1px solid var(--border-soft); }
.help-feedback p { margin: 0; display: flex; align-items: center; gap: 6px; }
.portal-form h1 { margin: 0; font-size: 22px; }
.portal-from { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-text); }
.block { display: block; }
.min0 { min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.between { justify-content: space-between; }
.wide > .row.between p { margin: 0; }
button.icon-btn { border: 0; background: transparent; cursor: pointer; font: inherit; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn.off { opacity: .3; }
.nowrap-row form { margin: 0; display: inline-flex; }
.chip-btn { display: inline-flex; align-items: center; min-height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-3); color: var(--text-3); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.chip-btn.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip-btn:hover { border-color: var(--faint); }
.t tr.dim td { color: var(--muted); }
.t tr.dim strong { font-weight: 500; }
.t tr.selected td { background: var(--primary-soft); }
.t .input-sm { min-height: 36px; padding: 0 10px; font-size: 13px; width: 100%; min-width: 150px; }
.portal-admin-table td { vertical-align: middle; }
.portal-admin-table form { display: none; }
.cols > .side.wide-side { flex: 2 1 420px; }
.form-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; border-bottom: 1px solid var(--border-soft); }
@media (max-width: 720px) {
  .portal-hero { padding: 20px; }
  .portal-hero h1 { font-size: 24px; }
  .portal-filters .searchbox input { width: 120px; }
}
.tabs a .muted { margin-left: 6px; }
.tabs a .count { margin-left: 8px; }
.portal-admin-intro { margin: 0; max-width: 900px; }
.pa-title { min-width: 220px; }
.cols > .co-list { flex: 1 1 380px; min-width: 0; }
.cols > .co-detail { flex: 1.4 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.portal-cta .row { flex-wrap: nowrap; }
.portal-cta .searchbox { min-width: 0; }
/* In the portal the main content comes first on small screens. */
body.portal .cols > .side { order: 0; }

/* "Sound paused": the browser blocks alert sounds until the first click on the page */
.sound-paused { display: flex; align-items: flex-start; gap: 10px; width: 100%; box-sizing: border-box; margin: 0 0 12px; padding: 10px 12px; text-align: left; border: 1px solid var(--warn-border); border-radius: 10px; background: var(--warn-bg); color: var(--warn); font: inherit; cursor: pointer; }
.sound-paused[hidden], .sound-on[hidden] { display: none; }
.sound-paused:hover { filter: brightness(.97); }
.sound-paused .i { margin-top: 1px; }
.sound-paused strong { display: block; font-size: 13px; }
.sound-paused span span { display: block; font-size: 12px; opacity: .9; margin-top: 1px; }
.sound-on { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--ok-bg); color: var(--ok); font-size: 13px; font-weight: 600; }
.sound-paused.strip, .sound-on.strip { display: none; }
@media (max-width: 720px) {
  .sound-paused.side, .sound-on.side { display: none !important; }
  .sound-paused.strip:not([hidden]) { display: flex; width: calc(100% - 24px); margin: 10px 12px 0; align-items: center; }
  .sound-on.strip:not([hidden]) { display: flex; margin: 10px 12px 0; }
}

/* ---------- Who is online (Team & access, Live chats) ---------- */
.pdot { display: inline-block; width: 8px; height: 8px; flex: none; border-radius: 999px; background: #98A2B3; }
.pdot.online { background: #12B76A; }
.pdot.away { background: #F79009; }
.pstate { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.avatar.has-pdot { position: relative; }
.avatar.has-pdot > .pdot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; box-sizing: border-box; border: 2px solid var(--surface); }
.team-user { display: flex; align-items: center; gap: 12px; }
.team-table tr.is-offline .subject, .team-table tr.is-offline .avatar { opacity: .75; }
.team-table td.nowrap { white-space: nowrap; }
.team-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.team-counts { display: flex; align-items: center; gap: 16px; margin: 0; font-size: 14px; flex-wrap: wrap; }
.team-bar .segmented { margin: 0; }
.team-bar .segmented a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); text-decoration: none; }
.team-bar .segmented a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
.dept-online { display: block; font-size: 11px; font-weight: 600; color: var(--ok-text, #067647); }
.dept-online[hidden] { display: none; }
.online-now { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.online-now .avatar { width: 30px; height: 30px; font-size: 11px; }
.online-now[hidden] { display: none; }
.online-now.card { padding: 10px 16px; min-width: 0; }
.online-now-list { display: inline-flex; align-items: center; gap: 6px; }

/* Settings → Desktop alerts */
.pair-code { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 16px 18px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.pair-code .secret { font-size: 26px; font-weight: 600; letter-spacing: .14em; padding: 6px 0; background: none; text-align: left; }
.pdot.bad { background: #D92D20; }
.device-list td { vertical-align: middle; }
.device-list .actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pair-code .pair-help { flex-basis: 100%; margin: 0; }
.user-role { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Collaborators ---------- */
.avatar.xs { width: 26px; height: 26px; font-size: 10px; }
.avatar-stack { display: inline-flex; align-items: center; vertical-align: middle; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -4px; }
.avatar-stack .avatar.owner { background: var(--primary); color: #fff; }
.avatar-stack .avatar.me { background: var(--primary); color: #fff; }
.avatar-stack .avatar.more { background: var(--surface-3); color: var(--text-2); }
.working-on { display: flex; align-items: center; gap: 8px; margin: 0 0 0 auto; }
.page-head .working-on .avatar-stack .avatar { box-shadow: 0 0 0 2px var(--bg); }
.collab-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; padding: 10px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--primary-soft); font-size: 14px; }
.collab-bar.plain { background: var(--surface); }
/* The page puts 24px between sections; -4px makes the space under the bar 20px, the same as between the columns. */
.container > .collab-bar { margin-bottom: -4px; }
.collab-bar form { margin: 0; }
.collab-bar > span { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.collab-box { margin: 16px 0; padding-top: 16px; border-top: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 10px; }
.collab-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.collab-head h3 { margin: 0; font-size: 14px; font-weight: 500; }
.collab-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.collab-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 2px 4px 2px 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 13px; max-width: 100%; }
.collab-chip form { margin: 0; display: flex; }
.collab-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-x { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.chip-x:hover { background: var(--surface-3); color: var(--text); }
.collab-picker { position: relative; margin: 0; }
.collab-search { min-height: 40px; }
.collab-search input { width: 100%; min-width: 0; flex: 1; min-height: 36px; }
.collab-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.collab-options { display: none; list-style: none; margin: 6px 0 0; padding: 4px; max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
.collab-picker:not([data-js]):focus-within .collab-options, .collab-picker.open .collab-options { display: block; }
.collab-picker[data-js] .collab-options { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; }
.collab-option { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.collab-option .collab-name { flex: 1; }
button.collab-option:hover, button.collab-option:focus-visible, .collab-option.active { background: var(--primary-soft); outline: none; }
.collab-option.no-access { color: var(--muted); cursor: not-allowed; }
.collab-option.no-access .avatar { opacity: .55; }
.dept-chip { height: 20px; padding: 0 8px; font-size: 11px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.collab-none { padding: 10px; }
.prop-rest { margin-top: 0; }
.field-note { font-weight: 400; }
.h-small { font-size: 14px; margin-bottom: 6px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
/* @mentions: in saved notes, in the editor and the suggestion list while typing */
.mention { padding: 0 3px; border-radius: 4px; background: var(--primary-soft); color: var(--primary-text); font-weight: 600; white-space: nowrap; }
.editor { position: relative; }
.mention-pop { position: absolute; z-index: 30; min-width: 220px; max-width: 320px; margin: 0; padding: 4px; list-style: none; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 24px rgba(0, 0, 0, .16); }
.mention-pop[hidden] { display: none; }
.mention-pop li { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 10px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.mention-pop li.active, .mention-pop li:hover { background: var(--primary-soft); }
.mention-pop li.none { color: var(--muted); cursor: default; background: none; }
.mention-add { margin: 0 0 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2, var(--surface)); }
.mention-hint { margin: 0 0 8px; }
p.mention-hint[hidden] { display: none; }
/* Live chats: tabs and "Online now" on one line, then the numbers as one slim line of buttons
   that filter the Ongoing list. */
/* The page puts 24px between its parts; these rows sit closer together. */
.chat-topline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin: -8px 0 -12px; }
.chat-topline .chat-tabs { margin: 0; }
.chat-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 6px 8px; margin-bottom: -8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.strip-item { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 10px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; }
.strip-item b { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.strip-item:hover { background: var(--surface-3); color: var(--text); }
.strip-item.warn { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.strip-item.warn b { color: var(--warn); }
.strip-item[aria-pressed="true"]:not([data-show=""]) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.strip-item[aria-pressed="true"]:not([data-show=""]) b { color: var(--primary-text); }
.strip-sep { width: 1px; height: 18px; margin: 0 6px; background: var(--border); }
@media (max-width: 720px) { .strip-sep { display: none; } .chat-strip { gap: 4px; } }

/* Live chats on a computer: the reply box is always in view. The conversation card ends at the
   bottom of the window and the messages scroll inside it. --conv-top (the card's distance from
   the top of the page) is set by chat-desk.js; without JavaScript the old fixed height applies. */
@media (min-width: 901px) and (min-height: 560px) {
  .main:has(.chat-desk[style*="--conv-top"]) { padding-bottom: 24px; }
  .chat-desk[style*="--conv-top"] > .chat-conv { max-height: calc(100vh - var(--conv-top) - 24px); max-height: calc(100dvh - var(--conv-top) - 24px); }
  .chat-desk[style*="--conv-top"] > .chat-conv > * { flex-shrink: 0; }
  /* At least a few messages stay readable; in a very low window the page scrolls instead. */
  .chat-desk[style*="--conv-top"] > .chat-conv > .desk-msgs { flex: 1 1 auto; min-height: 110px; max-height: none; }
}

/* A low window (small laptop): the line under the heading gives its room to the conversation. */
@media (min-width: 901px) and (max-height: 780px) { .main:has(.chat-desk[style*="--conv-top"]) .page-head .titles p { display: none; } }

/* Live chats: Ongoing / History tabs, and the History page (ended chats, read only). */
.chat-tabs { align-self: flex-start; width: fit-content; margin: -8px 0; }
.chat-tabs a { gap: 8px; }
.hist-filters { margin-bottom: -8px; }
.hist-filters .searchbox { flex: 1 1 260px; }
.hist-filters .searchbox input { width: 100%; }
.hist-filters select { min-height: 44px; width: auto; max-width: 100%; }
.chat-history { grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); }
.chat-history .chat-list ul { max-height: none; }
.chat-history .chat-row-top strong { color: var(--text); }
.chat-history .chat-ref { margin-left: auto; }
.chat-history .chip .i-sm { margin-right: 4px; }
.chat-history mark, .chat-history .dmsg .text mark { background: var(--warn-bg); color: inherit; border-radius: 3px; padding: 0 2px; }
.chat-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-bottom: 1px solid var(--border-soft); }
.chat-facts > div { padding: 12px 16px; border-right: 1px solid var(--border-soft); min-width: 0; }
.chat-facts > div:last-child { border-right: 0; }
.chat-facts dt { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.chat-facts dd { margin: 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.hist-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border-soft); background: var(--surface-2); border-radius: 0 0 12px 12px; }
.hist-foot .btn[aria-disabled="true"] { opacity: .45; cursor: default; }
@media (max-width: 1100px) { .chat-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .chat-facts > div:nth-child(2) { border-right: 0; } .chat-facts > div:nth-child(-n+2) { border-bottom: 1px solid var(--border-soft); } }
@media (max-width: 900px) { .chat-history { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) { .hist-filters > label:not(.searchbox), .hist-filters select { flex: 1 1 45%; width: 100%; } }

/* Knowledge base: the two lists (Articles, AI sources) and their forms. */
.kb-filters .searchbox { flex: 1 1 240px; }
.kb-filters .searchbox input { width: 100%; }
.kb-filters select { min-height: 44px; width: auto; max-width: 100%; }
.kb-sub { display: block; margin-top: 2px; overflow-wrap: anywhere; }
.chip.off { color: var(--faint); }
.import-box { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1.5px dashed var(--border-strong); border-radius: 10px; background: var(--surface-2); }
.import-note { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--surface-3); color: var(--text-3); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.source-actions { justify-content: space-between; }
.source-actions form { margin: 0; }
@media (max-width: 720px) { .kb-filters > label:not(.searchbox), .kb-filters select { flex: 1 1 45%; width: 100%; } }

/* Ticket list: channel filter beside the search field. */
.list-tools { flex-wrap: nowrap; gap: 10px; }
.channel-btn { min-height: 44px; gap: 8px; white-space: nowrap; }
.channel-btn.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.channel-menu .menu-panel { left: auto; right: 0; min-width: 220px; }
.channel-menu .menu-item.active .count { background: var(--surface); color: var(--primary-text); }
@media (max-width: 720px) {
  .list-tools { flex-wrap: wrap; width: 100%; }
  .list-tools > form { flex: 1 1 100%; }
  .channel-menu, .channel-btn { width: 100%; }
  .channel-btn { justify-content: space-between; }
}
.who-filter { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 20px; border-bottom: 1px solid var(--border-soft); }
.who-filter a { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); text-decoration: none; font-size: 13px; font-weight: 500; }
.who-filter a[aria-current="page"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); font-weight: 600; }
/* A fixed-size round badge: the number is centred both ways (it used to sit high and to the left). */
.who-filter .count { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-width: 20px; height: 20px; padding: 0 6px; font-size: 11px; line-height: 1; }
.td-collab { white-space: nowrap; }
label.check[hidden] { display: none; }

/* Admin → Languages */
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); text-decoration: none; }
.back-link:hover { color: var(--text); }
.lang-progress { display: flex; flex-wrap: wrap; gap: 6px; }
.lang-progress a { text-decoration: none; }
.lang-table td.right { text-align: right; }
.lang-add { align-items: flex-end; }
.lang-add .field { margin: 0; min-width: 240px; }
.lang-shown { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.lang-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
.lang-tools form.row { flex: 1 1 280px; margin: 0; }
.lang-tools input[type="search"] { flex: 1; min-width: 0; }
.lang-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.lang-texts { table-layout: fixed; }
.lang-texts th:first-child, .lang-texts td:first-child { width: 38%; }
.lang-texts th:last-child, .lang-texts td:last-child { width: 170px; }
.lang-texts td { vertical-align: top; }
.lang-src { overflow-wrap: anywhere; }
.lang-en { display: block; white-space: pre-wrap; }
.lang-keep { display: block; margin-top: 6px; }
.lang-texts textarea { width: 100%; min-height: 40px; resize: vertical; }
.lang-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
td.lang-status { display: table-cell; }
td.lang-status > * { margin: 0 6px 6px 0; }
.inline-error { display: block; color: var(--bad); }
.btn.saved { color: var(--ok, #067647); border-color: currentColor; }
/* Customer portal → Topics */
.topic-add { gap: 10px; align-items: center; }
.topic-add .field { margin: 0; }
.topic-rename { gap: 8px; flex-wrap: nowrap; align-items: center; }
.topic-rename input { min-width: 200px; }
.topic-move { gap: 6px; flex-wrap: nowrap; }
.topic-table form { margin: 0; }
.topic-table td { vertical-align: middle; }
.lang-save { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--border-soft); }
@media (max-width: 760px) {
  .lang-texts, .lang-texts tbody, .lang-texts tr, .lang-texts td { display: block; width: auto !important; }
  .lang-texts thead { display: none; }
  .lang-texts tr { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
  .lang-texts td { padding: 4px 0; border: 0; }
}
.status-line form { display: inline-flex; gap: 6px; margin: 0 0 0 auto; }
.lang-add .check { margin: 0 8px 10px; }
/* Automatic e-mail (receipt, solved notice) in the conversation */
details.msg.system.auto-mail { display: block; }
.auto-mail summary { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.auto-mail .msg-body { margin: 8px 0 4px 24px; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--surface-2); color: var(--text-2); white-space: pre-wrap; }
/* Languages → Your content */
.lang-content-hint { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.lang-src .chip.tag { margin: 0 6px 6px 0; }
.lang-item .btn { margin-top: 8px; }
.lang-item-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.lang-original { max-height: 70vh; overflow: auto; overflow-wrap: anywhere; }
@media (max-width: 900px) { .lang-item-cols { grid-template-columns: minmax(0, 1fr); } }

/* Ticket list: sender in its own column, the subject gets the room, the whole row opens the ticket */
@media (min-width: 721px) {
  .t-queue th, .t-queue td { padding-left: 10px; padding-right: 10px; }
  .t-queue th:first-child, .t-queue td:first-child { padding-left: 16px; }
  .t-queue th:last-child, .t-queue td:last-child { padding-right: 16px; }
  .t-queue td { vertical-align: top; }
  .t-queue .td-subject { width: 100%; min-width: 220px; }
  .t-queue .ai-summary { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 3px; }
  .t-queue .td-from { max-width: 190px; min-width: 120px; }
  .t-queue .from-name, .t-queue .from-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .t-queue .from-sub { margin-top: 2px; }
  .t-queue .td-chip, .t-queue .td-assignee, .t-queue .td-updated, .t-queue .td-ref { white-space: nowrap; }
  .t-queue tr[data-href] { cursor: pointer; }
  .t-queue tbody tr[data-href]:hover td { background: var(--surface-2); }
}
.t-queue .ai-summary { display: block; }

/* Ticket list: number cards with context (one line under the number, 7-day trend line) */
.stat.stat-ctx { flex-direction: row; justify-content: space-between; align-items: stretch; gap: 12px; }
.stat-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stat-line { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.stat-bad { color: var(--bad); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.stat-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--bad); flex: none; }
.stat-trend { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; flex: none; gap: 2px; }
.stat-delta { font-size: 12px; font-weight: 600; white-space: nowrap; }
.stat-cap { font-size: 11px; color: var(--faint); white-space: nowrap; }
.stat-trend.up { color: var(--warn); }
.stat-trend.down { color: var(--ok); }
.stat-trend.flat { color: var(--muted); }
.spark { display: block; }
.spark-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: currentColor; opacity: .1; }
.spark-dot { fill: currentColor; }
@media (max-width: 1100px) {
  /* Not enough room for the line: keep only the arrow and number, in the corner. */
  .stat.stat-ctx { position: relative; }
  .stat-trend { position: absolute; top: 16px; right: 16px; }
  .stat-trend .spark, .stat-trend .stat-cap { display: none; }
}
.help-body h3 { margin: 16px 0 6px; font-size: 15px; }
.help-body table { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: 14px; }
.help-body th, .help-body td { text-align: left; vertical-align: top; padding: 8px 10px; border: 1px solid var(--border); }
.help-body th { background: var(--surface-2); font-size: 13px; }
@media (max-width: 720px) { .help-body table { display: block; overflow-x: auto; } }

/* Two-step code field: grey example, digits grouped 3 + 3 */
.code-input::placeholder { color: var(--faint); opacity: .75; letter-spacing: .3em; }
.code-input { font-variant-numeric: tabular-nums; }

/* Sign-in: forgot password */
.auth-forgot { align-self: center; color: var(--text-2); }
.auth-note { margin: 0; }

/* Knowledge base · Try the chat (test chat, nothing is saved) */
.test-note { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-3); color: var(--text-2); font-size: 14px; line-height: 1.5; }
.test-note strong { color: var(--text); }
.test-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; margin-top: 18px; }
@media (min-width: 1100px) { .test-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.test-col { min-width: 0; padding: 18px; }
.test-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.test-head h2 { margin: 0; font-size: 16px; }
.test-head p { margin: 3px 0 0; }
.test-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; min-width: 0; }
.test-field select, .test-field input { min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; background: var(--surface); color: var(--text); width: 100%; box-sizing: border-box; }
.test-dept { flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
.test-head:has(.test-dept) { align-items: center; }
.test-dept select { width: auto; min-width: 180px; }
.test-frame { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); position: relative; min-height: 580px; }
.test-bar { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; background: var(--surface-3); border-bottom: 1px solid var(--line); }
.test-bar > span { width: 10px; height: 10px; border-radius: 999px; background: var(--line); flex: none; }
.test-bar em { margin-left: 10px; font-size: 12px; font-style: normal; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.test-page { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.test-page i { display: block; height: 9px; background: var(--surface-3); border-radius: 4px; }
.test-page .l1 { height: 18px; width: 40%; }
.test-page .l2 { width: 85%; }
.test-page .l3 { width: 65%; }
.test-window { display: flex; flex-direction: column; width: 100%; max-width: 400px; height: 480px; position: absolute; right: 12px; bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px rgba(16, 24, 40, .12); overflow: hidden; box-sizing: border-box; }
.test-wh { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #16181D; color: #FFFFFF; }
.test-wh > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.test-wh small { font-size: 11px; opacity: .8; }
.test-logo { width: 30px; height: 30px; border-radius: 999px; background: #1F5FD1; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.test-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bub { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bub.ai { align-self: flex-start; background: var(--surface-3); color: var(--text); }
.bub.visitor { align-self: flex-end; background: #F1ECFE; color: #101828; }
.bub.note { align-self: center; max-width: 100%; font-size: 12px; color: var(--muted); border: 1px dashed var(--line); background: transparent; }
.bub.error { align-self: center; max-width: 100%; font-size: 12px; color: #B42318; background: #FEE4E2; }
.test-notice { margin: 0; padding: 6px 14px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); }
.test-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.test-input input { flex: 1; min-width: 0; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13px; background: var(--surface); color: var(--text); }
.test-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 14px 0 0; }
.test-actions .test-field { flex: 1 1 180px; }
.test-empty { padding: 24px 4px; font-size: 14px; }
.test-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.test-col h3 { margin: 14px 0 8px; font-size: 13px; }
.test-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: 13px; }
.test-list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.test-list li:last-child { border-bottom: 0; }
.test-list li.used .name::before { content: "✓ "; color: #067647; }
.test-list .name { min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.test-list .score { flex: none; color: var(--muted); white-space: nowrap; }
.test-missed { margin-top: 12px; padding: 12px 14px; border: 1.5px dashed #F79009; border-radius: 10px; background: #FFFCF5; color: #475467; font-size: 13px; line-height: 1.5; }
.test-missed strong { display: block; color: #101828; margin-bottom: 4px; }
.test-fix { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.test-fix h3 { margin: 0; }
.test-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.test-raw { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 13px; }
.test-raw summary { cursor: pointer; min-height: 36px; display: flex; align-items: center; }
.test-raw pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; color: var(--muted); }

/* ---------- Menu collapsed to icons (computer screens only; users.nav_collapsed, toggled with the tab on the menu's edge) ---------- */
.brand-row { display: flex; align-items: flex-start; gap: 6px; }
.brand-row .brand { flex: 1; min-width: 0; }
.nav-toggle-form { display: none; margin: 0; }
.switch-mini { display: none; }
@media (min-width: 721px) {
  /* Expanded: the toggle is a plain chevron inside the menu, on the "Support Desk" line, right edge lined up with the Department box border below.
     Collapsed: a slim tab just outside the menu's right edge (menu background, border on top, right and bottom). */
  .sidebar { z-index: 30; }
  .brand-row { position: relative; padding-right: 18px; }
  .nav-toggle-form { display: block; position: absolute; top: 4px; right: -6px; margin: 0; }
  .nav-toggle { width: 20px; height: 24px; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
  .nav-toggle:hover { color: var(--text); background: var(--surface-3); }
  .nav-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
  .nav-toggle::before { content: ''; width: 7px; height: 7px; margin-left: 4px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
  [data-nav="mini"] .brand-row { padding-right: 0; }
  [data-nav="mini"] .nav-toggle-form { top: 18px; right: -16px; }
  [data-nav="mini"] .brand-row { position: static; }
  [data-nav="mini"] .nav-toggle { width: 16px; height: 30px; box-sizing: border-box; border: 1px solid var(--border); border-left: 0; border-radius: 0 8px 8px 0; background: var(--surface); }
  [data-nav="mini"] .nav-toggle:hover { background: var(--surface); }
  [data-nav="mini"] .nav-toggle::before { width: 6px; height: 6px; margin-left: -2px; border-width: 0 0 1.8px 1.8px; transform: rotate(-135deg); }

  /* z-index: the sticky menu is its own layer; it must sit above the page so tooltips and side panels show on top. */
  [data-nav="mini"] .sidebar { flex: 0 0 72px; width: 72px; padding: 16px 10px; align-items: center; z-index: 30; }
  [data-nav="mini"] .brand-row { flex-direction: column; align-items: center; gap: 10px; padding-bottom: 14px; }
  [data-nav="mini"] .brand { padding: 0; flex: none; }
  [data-nav="mini"] .brand-name { display: none; }
  [data-nav="mini"] .sidebar > .menu { width: 52px; }
  [data-nav="mini"] .sidebar .switcher { min-height: 44px; padding: 0; justify-content: center; gap: 4px; }
  [data-nav="mini"] .sidebar .switcher .grow, [data-nav="mini"] .sidebar .switcher > .i { display: none; }
  [data-nav="mini"] .sidebar .switch-mini { display: inline; font-size: 11px; font-weight: 700; color: var(--text); }
  [data-nav="mini"] .sidebar .menu-panel { left: calc(100% + 10px); right: auto; top: 0; width: 280px; }
  [data-nav="mini"] .sidebar .menu-up .menu-panel { top: auto; bottom: 0; }
  [data-nav="mini"] .sound-paused.side { width: 48px; padding: 8px 0; justify-content: center; }
  [data-nav="mini"] .sound-paused.side > span, [data-nav="mini"] .sound-on.side { display: none; }
  [data-nav="mini"] .nav-scroll { overflow: visible; margin: 0; padding: 0 0 12px; align-items: center; -webkit-mask-image: none; mask-image: none; }
  [data-nav="mini"] .sidebar .nav-link { position: relative; width: 48px; min-height: 40px; padding: 0; gap: 0; justify-content: center; font-size: 0; }
  [data-nav="mini"] .sidebar .nav-link .count { position: absolute; top: 1px; right: -3px; min-width: 18px; padding: 0 4px; font-size: 10px; line-height: 14px; text-align: center; box-sizing: border-box; border: 2px solid var(--surface); }
  [data-nav="mini"] .sidebar .nav-link .count + .count { display: none; }
  /* The hidden label must not take up room, or it pushes the icon to the left (it is still read by screen readers). */
  [data-nav="mini"] .sidebar .nav-link > .grow { flex: 0 0 0; width: 0; overflow: hidden; }
  [data-nav="mini"] .sidebar .nav-link:not(.nav-sub):hover::after, [data-nav="mini"] .sidebar .nav-link:not(.nav-sub):focus-visible::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
    padding: 5px 9px; border-radius: 6px; background: var(--text); color: var(--surface); font-size: 12px; font-weight: 600; line-height: 1.4;
    white-space: nowrap; z-index: 60; pointer-events: none; box-shadow: var(--shadow);
  }
  [data-nav="mini"] .nav-group[open] > .nav-group-head::after { display: none; }
  [data-nav="mini"] .nav-sep { width: 40px; margin: 8px auto; }
  [data-nav="mini"] .nav-group { position: relative; }
  [data-nav="mini"] .nav-group-head .chev { display: none; }
  [data-nav="mini"] .nav-group[data-current] > .nav-group-head { background: var(--primary-soft); color: var(--primary-text); }
  [data-nav="mini"] .nav-group-items { position: absolute; left: calc(100% + 10px); top: 0; z-index: 55; width: 230px; margin: 0; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
  [data-nav="mini"] .nav-group-items .nav-link.nav-sub { width: auto; justify-content: flex-start; padding: 0 10px; font-size: 14px; }
  [data-nav="mini"] .usercard-wrap { width: 52px; }
  [data-nav="mini"] .usercard { padding: 0; justify-content: center; min-height: 48px; }
  [data-nav="mini"] .usercard .grow, [data-nav="mini"] .usercard > .i { display: none; }
}

/* Settings → AI → Better source search: the source languages as tick boxes */
.search-langs { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.search-langs legend { padding: 0; margin-bottom: 2px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.lang-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.lang-pick { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); font-size: 13px; color: var(--text-2); cursor: pointer; }
.lang-pick input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.lang-pick:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); font-weight: 500; }
.lang-pick:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Try the chat: the words that were searched for */
.test-words { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.word-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.word-chips .word { font-size: 12px; line-height: 1.4; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.word-chips .word.own { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }

/* ---------- Guides (admin) ---------- */
.guide-item { display: flex; align-items: center; gap: 12px; min-width: 0; }
.guide-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.guide-swatch { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 8px; color: #fff; background: #2E62D9; }
.gsw-0 { background: #2E62D9; } .gsw-1 { background: #16A34A; } .gsw-2 { background: #EA580C; } .gsw-3 { background: #7C3AED; }
.gsw-4 { background: #DB2777; } .gsw-5 { background: #0891B2; } .gsw-6 { background: #475467; }
.page-head .titles.guide-head { flex-direction: row; align-items: center; gap: 12px; }
.guide-head h1 { margin: 0; }
.guide-colors { gap: 10px; }
.guide-color { position: relative; display: inline-flex; cursor: pointer; }
.guide-color input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.guide-color .guide-swatch { width: 30px; height: 30px; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--border); }
.guide-color input:checked + .guide-swatch { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.guide-color input:focus-visible + .guide-swatch { outline: 2px solid var(--primary); outline-offset: 3px; }
.guide-langs-intro { margin: 0; padding: 16px 20px 0; }
.guide-lang-table input.input-sm { width: 100%; min-width: 160px; }
.guide-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.guide-products fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.guide-products legend { margin-bottom: 6px; font-weight: 600; }
.guide-addr { flex-wrap: nowrap; gap: 6px; }
.guide-addr input { min-width: 0; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.tree-row:last-child { border-bottom: 0; }
.tree-row.l2 { padding-left: 42px; } .tree-row.l3 { padding-left: 68px; }
.tree-row.chapter > .tree-title > a { font-weight: 600; }
.tree-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.tree-title a { color: var(--text); text-decoration: none; }
.tree-title a:hover { color: var(--primary-text); text-decoration: underline; }
.tree-title a.btn { text-decoration: none; }
.tree-actions { flex: none; gap: 6px; }
.tree-actions form { margin: 0; }
.chip.pf-tag { height: 20px; padding: 0 8px; font-size: 11px; }
.guide-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .guide-cols { grid-template-columns: minmax(0, 1fr); } }
.orig-pane { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.orig-pane h2, .orig-pane h3 { margin: 0; }
.orig-pane .row.between { justify-content: space-between; }
.orig-text { font-size: 14px; }
.guide-uploading { color: var(--muted); }

/* Guide text (editor and portal): pictures, tip boxes, Web / App marks */
.guide-editor .editor-area img, .guide-body img { display: block; max-width: 100%; height: auto; margin: 8px 0; border-radius: 8px; border: 1px solid var(--border-soft); }
.guide-editor .editor-area img.img-s, .guide-body img.img-s { width: 240px; }
.guide-editor .editor-area img.img-m, .guide-body img.img-m { width: 400px; }
.guide-editor .editor-area img.img-l, .guide-body img.img-l { width: 640px; }
.guide-editor .editor-area img { cursor: pointer; }
/* Picture bar: shown under the toolbar while a picture in the text is selected */
.editor-imgbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); background: var(--surface-2); }
.editor-imgbar[hidden] { display: none; }
.editor-imgbar .segmented { margin: 0; }
.editor-imgbar .segmented button { padding: 0 12px; }
.editor-imgbar .field { flex: 1 1 200px; }
.img-frame { position: absolute; z-index: 5; pointer-events: none; border: 2px solid var(--primary); border-radius: 8px; }
.img-frame[hidden] { display: none; }
.img-handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border: 2px solid var(--surface); border-radius: 4px; background: var(--primary); cursor: nwse-resize; pointer-events: auto; touch-action: none; }
.img-size-label { position: absolute; right: 10px; bottom: 10px; padding: 0 8px; border-radius: 999px; background: rgba(16, 24, 40, .8); color: #fff; font-size: 12px; line-height: 22px; }
.editor-source { display: block; width: 100%; min-height: 380px; max-height: 70vh; margin: 0; padding: 12px 14px; border: 0; border-radius: 0; background: var(--surface); color: var(--text); line-height: 1.6; resize: vertical; outline: none; }
.editor-source[hidden] { display: none; }
.editor-source:focus-visible { outline: none; }
.editor-source-note { padding: 8px 14px; border-top: 1px solid var(--border-soft); }
.editor-source-note[hidden] { display: none; }
.editor-bar .ed-btn[disabled] { opacity: .4; cursor: default; }
.guide-editor .editor-area .tip, .guide-body .tip { margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--warn-border); border-radius: 10px; background: var(--warn-bg); color: var(--text-2); }
.guide-editor .editor-area .tip > :last-child, .guide-body .tip > :last-child { margin-bottom: 0; }
.guide-editor .editor-area [data-platform] { position: relative; border-left: 3px solid var(--primary); padding-left: 12px; }
.guide-editor .editor-area [data-platform="app"] { border-left-color: var(--violet); }
.guide-editor .editor-area [data-platform]::after { content: "Web"; position: absolute; top: -2px; right: 0; font-size: 11px; font-weight: 600; line-height: 18px; padding: 0 7px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-text); }
.guide-editor .editor-area [data-platform="app"]::after { content: "App"; background: var(--violet-bg); color: var(--violet); }
html[lang="sv"] .guide-editor .editor-area [data-platform="web"]::after { content: "Webb"; }
.orig-pane .guide-body [data-platform] { border-left: 3px solid var(--primary); padding-left: 12px; }
.orig-pane .guide-body [data-platform="app"] { border-left-color: var(--violet); }
.chip-row a.chip { text-decoration: none; }
.chip-row a.chip:hover { filter: brightness(1.1); }

/* ---------- Guides (customer portal) ---------- */
.guide-filters { gap: 16px; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.guide-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; color: var(--text); text-decoration: none; }
.guide-card:hover { border-color: var(--border-strong); }
.guide-card .chip-row { margin-top: auto; }
.guide-cover { display: flex; align-items: flex-end; gap: 8px; height: 96px; padding: 10px 12px; border-radius: 8px; color: #fff; font-weight: 600; font-size: 13px; }
.guide-swatch.big { width: 44px; height: 44px; border-radius: 10px; }
.guide-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.guide-top .eyebrow { margin: 0; }
.guide-title-row { gap: 14px; flex-wrap: nowrap; }
.guide-title-row h1 { margin: 0; }
.guide-chapter { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.guide-chapter h3 { margin: 0; font-size: 16px; }
.guide-chapter h3 a { color: var(--text); text-decoration: none; }
.guide-chapter ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.guide-chapter a:hover { text-decoration: underline; }
.guide-crumbs { flex-wrap: wrap; gap: 6px; color: var(--muted); }
.portal-guide { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.guide-main { gap: 20px; }
.guide-nav-card > summary { display: none; }
.guide-nav-head { flex-direction: column; align-items: stretch; gap: 10px; }
.guide-nav-head h2 { margin: 0; font-size: 16px; }
.guide-nav-head h2 a { color: var(--text); text-decoration: none; }
.guide-nav-head .searchbox { width: 100%; box-sizing: border-box; min-width: 0; }
.guide-nav-head .searchbox input { width: 100%; min-width: 0; }
.guide-nav { padding: 8px; display: flex; flex-direction: column; }
/* Chapter list: rows fold open and closed with the arrow on the right (like the Ubuntu docs). */
.gn-row { display: flex; align-items: center; gap: 2px; }
.gn-row > a { flex: 1; min-width: 0; display: block; padding: 7px 10px; border-radius: 6px; color: var(--text-2); text-decoration: none; font-size: 14px; }
.gn-row > a:hover { background: var(--surface-2); color: var(--text); }
.gn-row.ch > a { font-weight: 600; color: var(--text); }
.gn-row.l1 > a { padding-left: 24px; }
.gn-row.l2 > a { padding-left: 38px; font-size: 13px; }
.gn-row > a[aria-current] { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.gn-arrow { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.gn-arrow:hover { background: var(--surface-3); color: var(--text); }
.gn-arrow:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.gn-arrow svg { transition: transform .15s; }
.gn-arrow[aria-expanded="true"] svg { transform: rotate(180deg); }
.gn-kids[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .gn-arrow svg { transition: none; } }
.on-page { display: flex; flex-direction: column; gap: 8px; border-left: 2px solid var(--border); padding-left: 12px; font-size: 13px; }
.on-page .eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.on-page a { color: var(--text-3); text-decoration: none; }
.on-page a:hover { color: var(--primary-text); }
.prev-next { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.prev-next a { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; }
.prev-next a:hover { border-color: var(--border-strong); }
.prev-next a.next { text-align: right; grid-column: 2; }
.prev-next a span { font-size: 12px; font-weight: 400; color: var(--muted); }
.tabs.platform-switch { flex-wrap: nowrap; }
.tabs.platform-switch a { min-height: 30px; padding: 0 10px; gap: 6px; font-size: 13px; }
.tabs.platform-switch .lbl { align-self: center; padding: 0 6px 0 4px; font-size: 12px; color: var(--muted); }
.guide-body h2 { scroll-margin-top: 16px; }
.guide-state { max-width: 560px; margin: 32px auto; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.guide-state h1 { margin: 0; font-size: 22px; }
.guide-state p { margin: 0; }
.guide-state-actions { justify-content: center; }
.guide-signin { width: 100%; text-align: left; }
@media (max-width: 1100px) {
  .portal-guide { grid-template-columns: 240px minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .portal-guide { grid-template-columns: minmax(0, 1fr); }
  .guide-nav-card > summary { display: flex; align-items: center; gap: 8px; padding: 12px 16px; font-weight: 600; cursor: pointer; list-style: none; }
  .guide-nav-card > summary::-webkit-details-marker { display: none; }
  .prev-next { grid-template-columns: 1fr; }
  .prev-next a.next { grid-column: auto; }
}
.guide-nav-head .eyebrow, .guide-hero .eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }

/* ---------- Guides: import ---------- */
.import-status h2, .import-status p { margin: 0; }
.import-counts { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.import-counts > div { display: flex; flex-direction: column; gap: 2px; }
.import-counts strong { font-size: 22px; line-height: 1.2; }
.code-block { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.65; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; white-space: pre; overflow-x: auto; color: var(--text-2); max-height: 360px; }
.info-box.ok-box { border-color: transparent; background: var(--ok-bg); }
.info-box.ok-box > .i { color: var(--ok); }
.guide-ai-row { align-items: center; gap: 10px; }
.guide-ai-row form { margin: 0; }
