/*
 * The base stylesheet of a tenant's public sites (#1751): the service desk,
 * the files site and the knowledge base. One file, served by each site from
 * its own origin at /static/site/site.css, after the fonts and the design
 * tokens (/static/theme/tokens.css) and before the site's own few rules.
 *
 * The classes are the CloudBM design system's public-site components
 * (components/bundle.css: site header and footer, request list, message,
 * attachments, file list, article tree, article, field, button, status pill,
 * notice), with the page frame the Tenant Public Sites canvas draws around
 * them. Every colour, radius and family is a token; nothing here names a
 * colour of its own (web/theme's tests hold it to that).
 *
 * The tenant's colour is only the tokens --action, --action-hover, --focus,
 * --tint and --tint-line; until #1753 they hold CloudBM's defaults.
 */

/* ---------------------------------------------------------------- Page */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; background: var(--surface-alt); color: var(--text); font-family: var(--font-sans); font-size: 16px; line-height: 1.6; }
a { color: var(--action); text-underline-offset: 3px; }
input, select, textarea, button { font-family: inherit; }
.cbm-main { flex-grow: 1; display: flex; flex-direction: column; gap: 24px; width: min(var(--content-max), 100% - 32px); margin: 0 auto; padding: 36px 0 56px; }
@media (max-width: 640px) { .cbm-main { gap: 16px; width: auto; margin: 0; padding: 20px 16px 32px; } }
.cbm-muted { color: var(--text-muted); font-size: 14px; line-height: 22px; }
.cbm-inline { display: inline; margin: 0; }

/* ---------------------------------------------------------------- Header, footer */
.cbm-site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.cbm-site-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: min(var(--content-max), 100% - 32px); height: var(--header-height); margin: 0 auto; }
.cbm-site-brand { display: flex; align-items: center; gap: 16px; min-width: 0; color: var(--text); text-decoration: none; }
.cbm-site-logo { display: block; width: auto; height: 34px; }
.cbm-site-tenant { font-size: 21px; line-height: 28px; font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.cbm-site-divider { flex-shrink: 0; width: 1px; height: 24px; background: var(--line); }
.cbm-site-name { color: var(--text-muted); font-size: 15px; line-height: 20px; font-weight: 600; white-space: nowrap; }
.cbm-site-nav { display: flex; align-self: stretch; align-items: center; gap: 28px; }
.cbm-site-nav a { padding: 22px 0 20px; border-bottom: 2px solid transparent; color: var(--text-muted); font-size: 15px; line-height: 28px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.cbm-site-nav a:hover { color: var(--text); }
.cbm-site-nav a[aria-current="page"], .cbm-site-tabs a[aria-current="page"] { border-bottom-color: var(--action); color: var(--text); font-weight: 600; }
.cbm-site-reader { color: var(--text-muted); font-size: 15px; }
.cbm-site-nav-sep { width: 1px; height: 20px; background: var(--line); }
.cbm-site-account { display: none; }
.cbm-site-account a, .cbm-site-account .cbm-link-btn, .cbm-site-nav .cbm-link-btn { color: var(--text-muted); font-size: 15px; font-weight: 500; text-decoration: none; }
.cbm-site-tabs { display: none; padding: 0 16px; border-top: 1px solid var(--line); }
.cbm-site-tabs a { flex-grow: 1; padding: 12px 0 10px; border-bottom: 2px solid transparent; color: var(--text-muted); font-size: 15px; line-height: 22px; font-weight: 500; text-align: center; text-decoration: none; }
.cbm-site-nav a:focus-visible, .cbm-site-tabs a:focus-visible, .cbm-site-brand:focus-visible, .cbm-link-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 640px) {
  .cbm-site-header-inner { gap: 12px; width: auto; height: 60px; padding: 0 16px; }
  .cbm-site-brand { gap: 10px; }
  .cbm-site-logo { height: 26px; }
  .cbm-site-tenant { font-size: 18px; line-height: 24px; }
  .cbm-site-divider { height: 20px; }
  .cbm-site-name { font-size: 14px; }
  .cbm-site-nav { display: none; }
  .cbm-site-account { display: flex; align-items: center; gap: 12px; }
  .cbm-site-tabs { display: flex; }
}
.cbm-site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.cbm-site-footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; width: min(var(--content-max), 100% - 32px); margin: 0 auto; padding: 24px 0; color: var(--text-muted); font-size: 13px; line-height: 20px; }
.cbm-site-footer a { color: inherit; }
@media (max-width: 640px) { .cbm-site-footer-inner { width: auto; padding: 20px 16px; } }

/* ---------------------------------------------------------------- Card */
.cbm-card { display: flex; flex-direction: column; gap: 16px; padding: var(--space-7); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); }
.cbm-card > h1, .cbm-card > h2, .cbm-card > p, .cbm-card > ul, .cbm-card > form, .cbm-card-head > * { margin: 0; }
.cbm-card > h1, .cbm-card-head > h1, .cbm-card-intro > h1 { font-size: 26px; line-height: 1.25; font-weight: 700; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.cbm-card > h2, .cbm-card-head > h2, .cbm-card-intro > h2 { font-size: 18px; line-height: 1.3; font-weight: 700; }
.cbm-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.cbm-card-intro { display: flex; flex-direction: column; gap: 6px; }
.cbm-card-intro > * { margin: 0; }
.cbm-card-intro > p { color: var(--text-muted); font-size: 15px; line-height: 24px; }
.cbm-card-tight { gap: 10px; }
@media (max-width: 640px) {
  .cbm-card { padding: var(--space-5); }
  .cbm-card > h1, .cbm-card-head > h1, .cbm-card-intro > h1 { font-size: 22px; }
}

/* ---------------------------------------------------------------- Buttons and links */
.cbm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--control-min); padding: 0 20px; border: 1px solid transparent; border-radius: var(--radius-md); background: var(--action); color: var(--on-action); font-family: var(--font-sans); font-size: 15px; line-height: 20px; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; }
.cbm-btn:hover { background: var(--action-hover); }
.cbm-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cbm-btn-secondary { padding: 0 18px; border-color: var(--line); background: var(--surface); color: var(--action); }
.cbm-btn-secondary:hover { background: var(--surface-alt); }
.cbm-btn-block { width: 100%; }
.cbm-link { color: var(--action); font-weight: 600; text-underline-offset: 3px; }
.cbm-link-btn { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; text-underline-offset: 3px; }
.cbm-link-btn:hover { text-decoration: underline; }
.cbm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin: 0; }
.cbm-actions > p, .cbm-actions > form { margin: 0; }

/* ---------------------------------------------------------------- Forms */
.cbm-form { display: flex; flex-direction: column; gap: 22px; max-width: 680px; }
.cbm-form > .cbm-btn { align-self: flex-start; }
@media (max-width: 640px) { .cbm-form > .cbm-btn { align-self: stretch; } }
.cbm-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; margin: 0; }
.cbm-label { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text); }
.cbm-input, .cbm-select, .cbm-textarea { width: 100%; min-height: var(--control-min); padding: 10px 14px; border: 1px solid var(--input-border); border-radius: var(--radius-md); background: var(--surface); color: var(--text); font-family: var(--font-sans); font-size: 16px; line-height: 22px; }
.cbm-textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.cbm-input:focus-visible, .cbm-select:focus-visible, .cbm-textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.cbm-input-row { display: flex; gap: 8px; }
.cbm-input-row .cbm-input { flex-grow: 1; }
.cbm-hint { margin: 0; font-size: 13px; line-height: 20px; color: var(--text-muted); }
.cbm-field-error { margin: 0; font-size: 14px; line-height: 22px; color: var(--danger); }
.cbm-fieldset { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; padding: 0; border: 0; }
.cbm-fieldset legend { margin-bottom: 8px; padding: 0; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text); }
.cbm-choice { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 15px; line-height: 22px; color: var(--text); cursor: pointer; }
.cbm-choice input { flex-shrink: 0; width: 18px; height: 18px; margin: 0; accent-color: var(--action); }
.cbm-choice input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cbm-filebox { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px dashed var(--input-border); border-radius: var(--radius-md); background: var(--surface-alt); color: var(--text-muted); font-size: 14px; }
.cbm-filebox input { max-width: 100%; font: inherit; color: inherit; }
.cbm-divided { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin: 8px 0 0; padding-top: 20px; border-top: 1px solid var(--line); }
.cbm-divided > p { max-width: 560px; margin: 0; }

/* ---------------------------------------------------------------- Notices, pills, tags */
.cbm-notice { margin: 0; padding: 12px 16px; border-radius: var(--radius-md); background: var(--tint); color: var(--text); font-size: 15px; line-height: 24px; }
.cbm-notice-success { background: var(--done-bg); color: var(--done); font-weight: 600; }
.cbm-notice-warning { background: var(--waiting-bg); color: var(--waiting); }
.cbm-notice-error, .cbm-notice-danger { background: var(--danger-bg); color: var(--danger); }
.cbm-notice a { color: inherit; font-weight: 600; }
.cbm-pill { display: inline-block; margin: 0; padding: 3px 12px; border-radius: var(--radius-pill); background: var(--tint); color: var(--action); font-size: 13px; line-height: 20px; font-weight: 600; white-space: nowrap; }
.cbm-pill-waiting { background: var(--waiting-bg); color: var(--waiting); }
.cbm-pill-done { background: var(--done-bg); color: var(--done); }
.cbm-tag { display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: var(--radius-sm); background: var(--waiting-bg); color: var(--waiting); font-size: 13px; line-height: 20px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; vertical-align: 1px; }

/* ---------------------------------------------------------------- Requests and the conversation */
.cbm-requests { margin: 0; padding: 0; list-style: none; }
.cbm-requests li + li { border-top: 1px solid var(--line); }
.cbm-request { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 4px; color: var(--text); text-decoration: none; }
.cbm-request:hover .cbm-request-subject { text-decoration: underline; text-underline-offset: 3px; }
.cbm-request:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.cbm-ref { margin: 0; color: var(--text-muted); font-family: var(--font-mono); font-size: 14px; line-height: 20px; }
.cbm-request-subject { font-weight: 600; overflow-wrap: anywhere; }
.cbm-request-yours { color: var(--text-muted); font-size: 14px; font-weight: 400; }
@media (max-width: 640px) {
  .cbm-request { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 14px 0; }
  .cbm-request .cbm-ref { font-size: 13px; }
  .cbm-request-subject { grid-column: 1 / -1; grid-row: 2; font-size: 15px; line-height: 1.45; }
}
.cbm-thread { display: flex; flex-direction: column; gap: 16px; }
.cbm-message { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-item); background: var(--surface); color: var(--text); }
.cbm-message-business { border-color: var(--tint-line); background: var(--tint); }
.cbm-message-meta { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 22px; }
.cbm-message-author { color: var(--text); font-weight: 600; }
.cbm-message-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cbm-attachments { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; font-size: 14px; line-height: 22px; list-style: none; }
.cbm-attachments li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text-muted); overflow-wrap: anywhere; }
.cbm-attachments svg { flex-shrink: 0; }
.cbm-attachments a { color: var(--action); font-weight: 600; }

/* ---------------------------------------------------------------- Lists of files, libraries and results */
.cbm-files { margin: 0; padding: 0; list-style: none; }
.cbm-files li { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; }
.cbm-files li + li { border-top: 1px solid var(--line); }
.cbm-file { display: flex; align-items: center; gap: 14px; min-width: 0; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.cbm-file svg { flex-shrink: 0; color: var(--text-muted); }
a.cbm-file { font-weight: 600; }
a.cbm-file:hover span { text-decoration: underline; text-underline-offset: 3px; }
.cbm-file-pending { color: var(--text-muted); font-size: 14px; }
.cbm-file-kind { color: var(--text-muted); font-size: 14px; font-weight: 400; }
.cbm-results { margin: 0; padding: 0; list-style: none; }
.cbm-results > li { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; }
.cbm-results > li + li { border-top: 1px solid var(--line); }
.cbm-results > li > * { margin: 0; }
.cbm-results a { font-size: 16px; font-weight: 700; }
.cbm-results summary { cursor: pointer; font-size: 16px; font-weight: 700; }
.cbm-results details > p { margin: 8px 0 0; }

/* ---------------------------------------------------------------- Knowledge base */
.cbm-tree-card { display: flex; flex-direction: column; gap: 12px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.cbm-tree-card > * { margin: 0; }
.cbm-tree-title { font-size: 16px; line-height: 24px; font-weight: 700; }
.cbm-tree-title a { color: var(--text); text-decoration: none; }
.cbm-tree, .cbm-tree ul { margin: 0; padding: 0; list-style: none; }
.cbm-tree li { margin: 6px 0; }
.cbm-tree a { color: var(--text); font-size: 15px; line-height: 22px; text-decoration: none; overflow-wrap: anywhere; }
.cbm-tree a:hover { text-decoration: underline; text-underline-offset: 3px; }
.cbm-tree > li > a { font-weight: 600; }
.cbm-tree ul { margin: 6px 0 6px 6px; padding-left: 14px; border-left: 1px solid var(--line); }
.cbm-tree a[aria-current="page"] { color: var(--action); font-weight: 700; }
.cbm-tree a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cbm-article { display: flex; flex-direction: column; gap: 18px; min-width: 0; padding: 40px 48px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); overflow-wrap: anywhere; }
.cbm-article h1 { margin: 0; font-size: 30px; line-height: 1.25; font-weight: 700; letter-spacing: -0.015em; text-wrap: balance; }
.cbm-article h2 { margin: 12px 0 0; font-size: 20px; line-height: 28px; font-weight: 700; }
.cbm-article h3 { margin: 8px 0 0; font-size: 17px; line-height: 26px; font-weight: 700; }
.cbm-article p, .cbm-article ol, .cbm-article ul, .cbm-article blockquote { margin: 0; max-width: 640px; font-size: 17px; line-height: 1.7; }
.cbm-article ol, .cbm-article ul { display: flex; flex-direction: column; gap: 6px; padding-left: 22px; }
.cbm-article blockquote { padding: 14px 18px; border-radius: var(--radius-item); background: var(--tint); font-size: 15px; line-height: 1.6; }
.cbm-article img { max-width: 100%; height: auto; }
.cbm-article pre, .cbm-article code { font-family: var(--font-mono); white-space: pre-wrap; }
.cbm-translations { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--text-muted); font-size: 13px; }
.cbm-article .cbm-translations ul { display: flex; flex-direction: row; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.cbm-lang { display: inline-block; padding: 2px 10px; border: 1px solid var(--line); border-radius: var(--radius-pill); color: var(--action); font-size: 13px; line-height: 20px; font-weight: 600; text-decoration: none; text-transform: uppercase; }
.cbm-lang:hover { border-color: var(--action); }
@media (max-width: 640px) { .cbm-article { padding: 24px 20px; } .cbm-article h1 { font-size: 24px; } }
