:root {
  color-scheme: light;
  font-family: "Inter", "Segoe UI", sans-serif;
  --ink: #1b2523;
  --muted: #52615d;
  --line: #d8e0da;
  --surface: #fff;
  --base: #f1f4ef;
  --accent: #135d48;
  --accent-hover: #0e4939;
  --tint: #e7f3eb;
  --viewport: 100dvh;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf4ef;
  --muted: #b1c1b8;
  --line: #394943;
  --surface: #222e29;
  --base: #18231e;
  --accent: #8dddbb;
  --accent-hover: #ade8ce;
  --tint: #30463b;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--base); color: var(--ink); }
button, input, textarea { font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:disabled { opacity: .55; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: 3px; }
p, h1, h2 { margin: 0; }
.shell { max-width: 1160px; padding: 0 32px 28px; margin: auto; min-height: var(--viewport); }
.topbar { height: 79px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
a.button { display: inline-flex; align-items: center; text-decoration: none; }
.identity { display: flex; align-items: center; gap: 12px; }
.identity strong, .identity span { display: block; }
.identity strong { font-size: 16px; }
.identity div span { color: var(--muted); font-size: 12px; margin-top: 3px; }
.mark { display: grid !important; place-items: center; width: 39px; height: 39px; border-radius: 11px; background: var(--accent); color: var(--surface); font-size: 21px; font-weight: 750; }
.workspace { display: grid; grid-template-columns: 230px minmax(0, 1fr); height: calc(var(--viewport) - 107px); min-height: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.rail { display: flex; flex-direction: column; border-right: 1px solid var(--line); padding: 26px 16px 18px; background: var(--base); }
.rail h2 { font-size: 13px; margin: 0 10px 14px; color: var(--muted); }
.rail-current, .rail-link { display: block; width: 100%; border: 0; border-radius: 8px; padding: 10px 12px; text-align: left; font-size: 14px; background: transparent; color: var(--ink); }
.rail-current { background: var(--tint); color: var(--accent); font-weight: 700; }
.rail-link { margin-top: 4px; }
.rail-link:hover { background: var(--tint); }
.demo-note { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.55; color: var(--muted); }
.demo-note strong { color: var(--ink); }
.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 16px 24px; }
h1 { font-size: 17px; }
.chat-head p { color: var(--muted); margin-top: 4px; font-size: 12px; }
.feed { flex: 1; overflow: auto; padding: 24px; overscroll-behavior: contain; }
.welcome { max-width: 565px; margin: clamp(20px, 9vh, 104px) auto 22px; }
.welcome h2 { font-size: clamp(27px, 5vw, 45px); line-height: 1.08; letter-spacing: -.045em; }
.welcome p { max-width: 440px; font-size: 15px; color: var(--muted); line-height: 1.6; margin-top: 12px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.suggestions button, .button { border-radius: 9px; min-height: 42px; padding: 9px 13px; font-size: 13px; font-weight: 650; }
.outline, .suggestions button { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.outline:hover, .suggestions button:hover { background: var(--tint); }
.primary { background: var(--accent); border: 1px solid var(--accent); color: var(--surface); }
.primary:hover { background: var(--accent-hover); }
.composer { border-top: 1px solid var(--line); padding: 11px 24px 14px; }
.compose-line { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.compose-line:focus-within { border-color: var(--accent); }
.compose-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 8px 8px; }
.compose-actions > .primary { min-height: 44px; margin-left: auto; }
.media-tools, .recording-actions { display: flex; align-items: center; gap: 8px; }
.media-tools[hidden], .recording-actions[hidden] { display: none; }
.attachment-picker { position: relative; }
.tool-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.tool-button[hidden] { display: none; }
.tool-button:not(:disabled):hover, .tool-button[aria-expanded="true"] { background: var(--tint); color: var(--accent); }
.clip-icon { width: 9px; height: 19px; border: 2px solid currentColor; border-radius: 7px; transform: rotate(35deg); position: relative; }
.clip-icon::after { content: ""; position: absolute; top: 2px; bottom: 2px; left: 2px; border-left: 1px solid currentColor; }
.voice-tool { border-radius: 50%; background: var(--tint); color: var(--accent); }
.mic-icon { position: relative; width: 14px; height: 13px; margin-top: 2px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 8px 8px; }
.mic-icon::before { content: ""; position: absolute; width: 6px; height: 12px; top: -6px; left: 2px; border-radius: 5px; background: currentColor; }
.mic-icon::after { content: ""; position: absolute; width: 2px; height: 4px; bottom: -5px; left: 4px; background: currentColor; }
.stop-icon { display: none; width: 13px; height: 13px; border-radius: 2px; background: currentColor; }
.voice-tool[data-recording] { color: var(--surface); background: var(--ink); }
.voice-tool[data-recording] .mic-icon { display: none; }
.voice-tool[data-recording] .stop-icon { display: block; }
.recording-actions span { color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; }
.recording-actions button { min-height: 44px; padding: 0 3px; border: 0; background: transparent; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.attachment-options { position: absolute; z-index: 2; bottom: calc(100% + 8px); left: 0; width: min(236px, calc(100vw - 54px)); padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 5px 18px rgb(12 33 25 / 12%); }
.attachment-options button { display: block; width: 100%; min-height: 44px; padding: 8px; border: 0; border-radius: 5px; text-align: left; background: transparent; color: var(--ink); font-size: 14px; }
.attachment-options button[hidden] { display: none; }
.attachment-options button:hover, .attachment-options button:focus-visible { background: var(--tint); }
.attachment-options p { margin: 3px 8px 7px; color: var(--muted); font-size: 12px; line-height: 1.4; }
textarea { min-width: 0; width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); padding: 10px 12px; line-height: 1.4; }
.compose-line textarea { display: block; min-height: 46px; max-height: 120px; border: 0; padding: 12px; border-radius: 13px 13px 0 0; }
.compose-line textarea:focus-visible { outline-offset: -3px; }
#status, #ticket-status { color: var(--muted); font-size: 12px; line-height: 1.4; }
#status:not(:empty) { margin-bottom: 8px; }
.message { width: fit-content; max-width: min(100%, 620px); padding: 12px 15px; border-radius: 12px; margin-bottom: 13px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.from-user { margin-left: auto; background: var(--tint); white-space: pre-wrap; }
.from-support { border: 1px solid var(--line); background: var(--surface); }
.message-label { color: var(--accent); font-size: 12px; font-weight: 750; margin-bottom: 5px; }
.message-text { white-space: pre-wrap; }
.sources { padding: 9px 0 0 17px; margin: 10px 0 0; border-top: 1px solid var(--line); font-size: 12px; }
.sources li + li { margin-top: 5px; }
.receipt { background: var(--tint); border: 1px solid var(--line); padding: 12px; border-radius: 9px; font-size: 14px; }
dialog { width: min(560px, calc(100% - 24px)); max-height: calc(var(--viewport) - 24px); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
dialog::backdrop { background: rgb(10 23 18 / 48%); }
.ticket-form { display: grid; gap: 10px; }
.ticket-form header { display: flex; gap: 10px; justify-content: space-between; align-items: start; margin-bottom: 7px; }
.ticket-form h2 { font-size: 18px; margin-bottom: 4px; }
.ticket-form header p, .ticket-form label { font-size: 13px; color: var(--muted); }
.ticket-form > .primary { justify-self: start; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.knowledge-workspace { display: grid; grid-template-columns: minmax(235px, 32%) minmax(0, 1fr); min-height: 70vh; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.knowledge-nav { padding: 23px 20px; background: var(--base); border-right: 1px solid var(--line); }
.knowledge-filter { display: flex; gap: 6px; margin: 14px 0 10px; }
.knowledge-filter input { min-width: 0; width: 100%; padding: 8px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; }
.knowledge-list { list-style: none; padding: 0; margin: 12px 0 0; max-height: 60vh; overflow: auto; }
.knowledge-list a { display: block; padding: 9px; color: var(--ink); border-radius: 8px; text-decoration: none; font-size: 14px; overflow-wrap: anywhere; }
.knowledge-list a:hover, .knowledge-list a[aria-current] { background: var(--tint); color: var(--accent); }
.knowledge-list a:focus-visible { outline-offset: -2px; }
.knowledge-list small, .document-version { color: var(--muted); font-size: 12px; }
.knowledge-list small { display: block; margin-top: 3px; }
.knowledge-document { min-width: 0; padding: 28px; overflow-wrap: anywhere; }
.document-head { display: flex; gap: 14px; justify-content: space-between; align-items: start; margin-bottom: 22px; }
.document-head h2 { font-size: clamp(20px, 3vw, 29px); margin-bottom: 6px; }
.document-head .button { flex-shrink: 0; }
.document-section { padding: 16px 0; border-top: 1px solid var(--line); }
.document-section h3 { font-size: 15px; margin: 0 0 9px; }
.document-section p { white-space: pre-wrap; font-size: 15px; line-height: 1.65; }
@media (max-width: 720px) {
  .shell { padding: 0 max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .topbar { height: 62px; }
  .workspace { grid-template-columns: 1fr; height: calc(var(--viewport) - 72px); min-height: 260px; border-radius: 12px; }
  .rail { display: none; }
  .chat-head, .feed, .composer { padding-left: 13px; padding-right: 13px; }
  .chat-head { padding-top: 10px; padding-bottom: 10px; }
  .welcome { margin-top: 24px; }
  .compose-actions { flex-wrap: wrap; }
  .identity { gap: 8px; }
  .identity strong { font-size: 14px; }
  .mark { width: 32px; height: 32px; border-radius: 8px; font-size: 17px; }
  .button { padding-left: 9px; padding-right: 9px; }
  .topbar .button { font-size: 12px; }
  .topbar-actions { gap: 4px; }
  .topbar-actions .button { text-align: center; }
  .knowledge-workspace { grid-template-columns: 1fr; }
  .knowledge-nav { border-right: 0; border-bottom: 1px solid var(--line); padding: 15px; }
  .knowledge-list { max-height: 40vh; }
  .knowledge-document { padding: 18px 15px; scroll-margin-top: 8px; }
  .document-head { flex-wrap: wrap; }
}
