/* Polish layer: the shared states (loading, empty, error), global search, in-app support and the help centre.
   Uses the tokens from ui.css. Loaded last in app.html, and on its own (after ui.css) by help.html. */

/* ---------- loading placeholders */
@keyframes sk-shine { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
.sk { display: block; border-radius: 8px; max-width: 100%; background: linear-gradient(90deg, #ececE8 25%, #f6f6f3 45%, #ececE8 65%); background-size: 220% 100%; animation: sk-shine 1.3s ease-in-out infinite; }
.sk-dot { width: 36px; height: 36px; border-radius: 11px; flex: none; }
.sk-col { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 0; }
.sk-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.sk-row:last-child { border-bottom: 0; }
.sk-card { display: flex; flex-direction: column; gap: 12px; }
.sk-card .sk-row { gap: 14px; }
.sk-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.sk-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.skel { animation: sk-in .18s ease-out; }
@keyframes sk-in { from { opacity: 0; } to { opacity: 1; } }
#view.is-loading > :not(.skel) { display: none !important; }
@media (prefers-reduced-motion: reduce) { .sk, .skel { animation: none; } }
@media (max-width: 760px) { .sk-grid { grid-template-columns: 1fr; } }

/* ---------- the one empty state and the one error state */
.ui-empty { text-align: center; padding: 36px 20px 32px; display: flex; flex-direction: column; align-items: center; color: var(--muted); }
.ui-empty .tile { margin: 0 0 12px; }
.ui-empty h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.ui-empty p { margin: 6px 0 0; max-width: 420px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.ui-empty-act { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.ui-empty.sm { padding: 24px 12px 22px; }
.ui-empty.dashed { border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--subtle); }
.tile.ui-tone-bad { background: var(--bad-soft); color: var(--bad); box-shadow: inset 0 0 0 1px #f4cfcb; }
.tile.ui-tone-ok { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1px #c9eadb; }
.tile.ui-tone-plain { background: var(--subtle); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.card > .ui-empty:only-child { padding-top: 22px; padding-bottom: 18px; }

/* ---------- search field in the menu */
.side-search { display: flex; align-items: center; gap: 8px; width: calc(100% - 4px); margin: 0 2px 12px; height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--panel); color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; box-shadow: 0 1px 1px rgba(21,23,28,.03); }
.side-search:hover { border-color: #cfd0cb; color: var(--ink-2); }
.side-search:focus-visible { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.side-search span { flex: 1; }
.side-search kbd, .cmd-foot kbd { font: 600 10.5px/1 Inter, system-ui, sans-serif; color: var(--muted); background: var(--subtle); border: 1px solid var(--line-2); border-radius: 5px; padding: 3px 5px; }

/* ---------- command box (Ctrl/Cmd+K) */
.cmd-bg { position: fixed; inset: 0; z-index: 150; background: rgba(21,23,28,.38); backdrop-filter: blur(2px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.cmd { width: 100%; max-width: 620px; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; max-height: min(70vh, 560px); animation: pop .14s ease-out; }
.cmd-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmd-in input { flex: 1; min-width: 0; border: 0 !important; box-shadow: none !important; outline: none; padding: 0; min-height: 28px; font-size: 16px; background: transparent; }
.cmd-list { overflow-y: auto; padding: 6px 8px 8px; flex: 1; }
.cmd-group { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 12px 10px 6px; }
.cmd-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer; color: var(--ink); text-decoration: none !important; }
.cmd-item .tile { width: 30px; height: 30px; border-radius: 9px; }
.cmd-item .t { font-weight: 550; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-item .s { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-item .grow { min-width: 0; }
.cmd-item .go { color: var(--faint); opacity: 0; }
.cmd-item[aria-selected="true"] { background: var(--brand-soft); }
.cmd-item[aria-selected="true"] .go { opacity: 1; }
.cmd-note { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.cmd-foot { display: flex; gap: 16px; align-items: center; padding: 9px 16px; border-top: 1px solid var(--line); background: var(--subtle); color: var(--muted); font-size: 12px; }
.cmd-foot span { display: inline-flex; align-items: center; gap: 5px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- "Message us" */
.msg-fab { position: fixed; right: 22px; bottom: 22px; z-index: 44; display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px 0 13px; border-radius: 999px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; box-shadow: 0 6px 20px rgba(22,33,62,.22); transition: transform .12s, box-shadow .12s; }
.msg-fab:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(22,33,62,.26); }
.msg-fab:focus-visible { outline: none; box-shadow: var(--ring), 0 6px 20px rgba(22,33,62,.22); }
.msg-fab .dot { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--brand-2, #5AA9F6); color: #10213f; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
@media (max-width: 880px) { .msg-fab { bottom: 84px; right: 14px; } }
@media print { .msg-fab { display: none !important; } }
.sp-sla { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); background: var(--brand-soft); border: 1px solid var(--brand-tint); border-radius: 10px; padding: 9px 12px; margin: 0 0 16px; }
.sp-sla .ico { color: var(--brand); }
.sp-topics { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-topics label { cursor: pointer; }
.sp-topics input { position: absolute; opacity: 0; pointer-events: none; }
.sp-topics span { display: inline-flex; align-items: center; height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: 13px; font-weight: 550; color: var(--ink-2); }
.sp-topics input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.sp-topics input:focus-visible + span { box-shadow: var(--ring); }
.sp-form textarea { width: 100%; min-height: 130px; }
.sp-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.sp-file input[type=file] { font-size: 13px; max-width: 100%; }
.sp-suggest { border: 1px solid var(--brand-tint); background: var(--brand-soft); border-radius: 14px; padding: 16px 18px; margin: 4px 0 16px; }
.sp-suggest-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--brand); margin-bottom: 8px; }
.sp-suggest h3 { margin: 0 0 6px; font-size: 15px; }
.sp-suggest p { margin: 0 0 8px; font-size: 14px; color: var(--ink); }
.sp-suggest ol { margin: 0 0 8px; padding-left: 20px; font-size: 14px; color: var(--ink); }
.sp-suggest ol li { margin: 3px 0; }
.sp-suggest .row { margin-top: 12px; gap: 8px; flex-wrap: wrap; }
.sp-list { padding: 4px 18px; }
.sp-list .list-row:last-child { border-bottom: 0; }
.sp-list .list-row .ico:last-child { color: var(--faint); }
.sp-clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-thread { display: flex; flex-direction: column; gap: 12px; margin: 0 0 18px; }
.sp-msg { max-width: 82%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); font-size: 14px; }
.sp-msg.me { align-self: flex-end; background: var(--brand-soft); border-color: var(--brand-tint); }
.sp-msg.them { align-self: flex-start; }
.sp-msg-h { display: flex; justify-content: space-between; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.sp-msg-h b { color: var(--ink-2); font-weight: 600; }
.sp-msg-b { white-space: pre-wrap; overflow-wrap: anywhere; }
.sp-shot { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; }
.sp-msg img { display: block; max-width: 260px; max-height: 180px; border-radius: 10px; border: 1px solid var(--line); margin-top: 8px; }
.sp-wrap { max-width: 780px; }
.sp-settings .field { margin-bottom: 12px; }
.sp-queue-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.sp-queue-h h2 { margin: 0; font-size: 16px; }

/* ---------- help centre */
.hc-wrap { max-width: 860px; }
.hc-search { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-2); border-radius: 14px; padding: 4px 14px; background: #fff; box-shadow: var(--shadow); }
.hc-search:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.hc-search input { border: 0 !important; box-shadow: none !important; outline: none; flex: 1; min-width: 0; font-size: 15.5px; padding: 10px 0; background: transparent; }
.hc-search .ico { color: var(--faint); }
.hc-results { margin-top: 14px; }
.hc-cat { margin: 26px 0 10px; font-size: 16px; }
.hc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hc-art { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); text-decoration: none !important; box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s; }
.hc-art:hover, .hc-art:focus-visible { border-color: var(--brand-line); box-shadow: var(--shadow-md); outline: none; }
.hc-art b { display: block; font-weight: 600; font-size: 14.5px; }
.hc-art small { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 2px; }
.hc-art .tile { width: 34px; height: 34px; border-radius: 10px; }
.hc-help { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 26px; }
.hc-help .grow { min-width: 220px; }
.hc-body { max-width: 760px; }
.hc-body h3 { font-size: 16px; margin: 22px 0 8px; }
.hc-body h4 { font-size: 14px; margin: 20px 0 8px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.hc-body p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
.hc-body ul, .hc-body ol { margin: 0 0 14px; padding-left: 22px; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
.hc-body li { margin: 4px 0; }
.hc-body .hc-owner { font-size: 11px; font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: 99px; padding: 2px 8px; }
.hc-body .hc-co { border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; font-size: 14px; background: var(--brand-soft); border: 1px solid var(--brand-tint); color: var(--ink-2); }
.hc-body .hc-co.warn { background: var(--warn-soft); border-color: #f3e1bd; color: #6b4106; }
.hc-body .hc-co.ok { background: var(--ok-soft); border-color: #c9eadb; color: #0b5a3e; }
.hc-body .hc-co b.t { display: block; margin-bottom: 2px; color: inherit; }
.hc-body .hc-qa > div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.hc-body .hc-qa > div:last-child { border-bottom: 0; }
.hc-body .hc-qa .q { font-weight: 600; color: var(--ink); margin: 0 0 2px; }
.hc-body .hc-qa .a { margin: 0; }
.hc-body table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 0 0 14px; }
.hc-body th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.hc-body td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
.hc-body .hc-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0 0 14px; }
.hc-body .hc-split > div { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--subtle); }
.hc-body .hc-split h4 { margin-top: 0; }
.hc-body .hc-ex { border-left: 3px solid var(--brand-tint); padding: 4px 0 4px 14px; margin: 0 0 14px; font-size: 14px; }
.hc-body .hc-ex .who { font-weight: 600; color: var(--ink); }
.hc-body .hc-ex p { margin: 0 0 6px; }
.hc-body pre { background: var(--subtle); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; overflow-x: auto; margin: 0 0 14px; }
.hc-body .table-wrap { margin: 0 0 14px; }
.hc-body .table-wrap table { margin: 0; }
.hc-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
@media (max-width: 760px) { .hc-grid, .hc-body .hc-split { grid-template-columns: 1fr; } }
.ui-empty { gap: 0; }
.sp-list .pill, .sp-item .pill { text-transform: none; white-space: nowrap; }
