@font-face { font-family: DM; src: url('/fonts/dm/dm-sans-latin-400-normal.woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: DM; src: url('/fonts/dm/dm-sans-latin-600-normal.woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Space; src: url('/fonts/space/space-grotesk-latin-600-normal.woff2'); font-weight: 600; font-display: swap; }
:root { font-family: DM, sans-serif; color: #20342e; background: #e9efec; --paper: #fbfcfa; --surface: #f1f5f2; --line: #d7e1db; --muted: #64796e; --ink: #20342e; --accent: #186e55; --accent-light: #dceee5; --warm: #dc8e6a; }
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
img { display: block; width: 19px; height: 19px; }
.workspace { display: grid; grid-template-columns: 260px minmax(0, 1fr); height: 100dvh; max-width: 1800px; margin: auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); background: var(--paper); }
.sidebar { display: flex; flex-direction: column; min-height: 0; background: #ecf2ee; border-right: 1px solid var(--line); }
.sidebar-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 14px 12px; }
.brand { display: flex; align-items: center; gap: 9px; font: 600 18px Space, sans-serif; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; background: var(--accent); color: #fff; font: 600 24px Space, sans-serif; border-radius: 6px; letter-spacing: 0; white-space: nowrap; }
.brand-mark span { color: #f3ba9a; }
.brand-mark.small { width: 36px; height: 36px; font-size: 17px; }
.icon-button { border: 0; background: transparent; color: var(--ink); width: 42px; height: 42px; border-radius: 6px; display: grid; place-items: center; flex: none; }
.icon-button:hover { background: #deebe2; }
.danger-icon:hover { background: #f8e3df; }
.section-heading { display: flex; justify-content: space-between; padding: 4px 17px 8px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .08em; }
.topic-list { flex: 1; overflow-y: auto; padding: 0 8px; }
.topic-item { width: 100%; min-height: 44px; display: grid; grid-template-columns: 32px 1fr; gap: 8px; align-items: center; border: 0; border-radius: 6px; padding: 6px 8px; background: transparent; text-align: left; color: var(--ink); }
.topic-item:hover { background: #e0ebe4; }
.topic-item.active { background: var(--accent-light); }
.topic-initial { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 5px; color: #fff; font: 600 14px Space, sans-serif; background: #859d8e; }
.topic-item.active .topic-initial { background: var(--accent); }
.topic-info { overflow: hidden; }
.topic-name { display: block; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-bottom { display: flex; align-items: center; gap: 7px; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.sidebar-bottom button { margin-left: auto; }
.connection-dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; }
.conversation { min-height: 0; display: flex; flex-direction: column; position: relative; background-color: var(--paper); background-image: radial-gradient(#dae6df 0.6px, transparent 0.6px); background-size: 22px 22px; }
.conversation-header { z-index: 1; display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 8px 20px; background: var(--paper); border-bottom: 1px solid var(--line); }
.header-titles { flex: 1; min-width: 0; }
.header-titles h2 { font: 600 17px Space, sans-serif; margin: 0 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-titles span { font-size: 11px; color: var(--muted); }
.back { display: none; }
.empty-state { display: flex; flex: 1; flex-direction: column; justify-content: center; align-items: flex-start; padding: 48px clamp(30px, 10vw, 130px); }
.empty-glyph { display: grid; place-items: center; width: 86px; height: 86px; border: 1px solid var(--line); border-radius: 8px; font: 600 34px Space, sans-serif; color: var(--accent); background: var(--paper); }
.empty-state h2 { font: 600 30px Space, sans-serif; margin: 25px 0 6px; }
.empty-state p { margin: 0 0 24px; color: var(--muted); line-height: 1.5; max-width: 320px; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 45px; padding: 0 18px; border-radius: 5px; border: 0; color: #fff; background: var(--accent); font-weight: 600; }
.primary:hover, .send-button:hover { background: #0d5942; }
.primary img, .send-button img { filter: brightness(0) invert(1); }
.messages { flex: 1; overflow-y: auto; padding: 16px clamp(12px, 3vw, 40px); }
.message-stack { max-width: 960px; margin: auto; display: flex; flex-direction: column; gap: 10px; min-height: 100%; justify-content: flex-end; }
.message { max-width: min(88%, 780px); align-self: flex-start; }
.message.owner { align-self: flex-end; }
.message-label { font-size: 10px; font-weight: 600; color: var(--muted); margin: 0 0 3px 4px; }
.message.owner .message-label { text-align: right; margin-right: 4px; }
.bubble { padding: 8px 12px; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-text.formatted { white-space: normal; }
.message-text.formatted > :first-child { margin-top: 0; }
.message-text.formatted > :last-child { margin-bottom: 0; }
.message-text.formatted p, .message-text.formatted ul, .message-text.formatted ol, .message-text.formatted blockquote, .message-text.formatted pre { margin-block: 9px; }
.message-text.formatted ul, .message-text.formatted ol { padding-left: 24px; }
.message-text.formatted blockquote { margin-left: 0; padding-left: 12px; border-left: 3px solid #b9cdc0; color: var(--muted); }
.message-text.formatted code { padding: 1px 4px; border-radius: 3px; background: var(--surface); font: 13px/1.5 ui-monospace, monospace; }
.message-text.formatted pre { overflow-x: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); white-space: pre; }
.message-text.formatted pre code { padding: 0; background: transparent; }
.message-text.formatted a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.message-text.formatted table { display: block; width: max-content; max-width: 100%; overflow-x: auto; border-collapse: collapse; white-space: nowrap; }
.message-text.formatted th, .message-text.formatted td { padding: 7px 10px; border: 1px solid var(--line); text-align: left; }
.message-text.formatted th { background: var(--surface); font-weight: 600; }
.message.owner .bubble { background: var(--accent-light); border-color: #c5e4d2; }
.processing .bubble { min-width: 49px; min-height: 39px; display: flex; align-items: center; justify-content: center; gap: 2px; }
.processing-dots span { display: inline-block; font-weight: 600; animation: processing-dot 1.2s ease-in-out infinite; }
.processing-dots span:nth-child(2) { animation-delay: .15s; }
.processing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes processing-dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .processing-dots span { animation: none; opacity: 1; } }
.message-time { color: var(--muted); font-size: 11px; margin: 5px 4px 0; }
.message.owner .message-time { text-align: right; }
.message-file { display: flex; gap: 9px; align-items: center; margin-top: 8px; padding: 8px 10px; background: rgba(255,255,255,.65); border: 1px solid var(--line); border-radius: 4px; text-decoration: none; color: var(--accent); font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.message-image { display: block; width: auto; height: auto; max-width: 100%; max-height: 320px; object-fit: contain; border-radius: 3px; margin-top: 8px; }
.compose { padding: 10px clamp(12px, 3vw, 40px) 12px; background: var(--paper); border-top: 1px solid var(--line); }
.compose-row, .attachment-preview { max-width: 960px; margin: auto; }
.compose-row { display: flex; align-items: flex-end; gap: 8px; padding: 7px; border: 1px solid #bdcfc4; border-radius: 7px; background: #fff; }
.compose-row:focus-within { border-color: var(--accent); }
.attach-button { cursor: pointer; margin-bottom: 1px; }
.compose textarea { resize: none; max-height: calc(11.2em + 18px); min-height: 42px; flex: 1; padding: 10px 4px; border: 0; outline: 0; background: transparent; line-height: 1.4; overflow-y: hidden; }
.compose textarea:focus-visible { outline: 0; }
.send-button { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border: 0; border-radius: 5px; background: var(--accent); }
.attachment-preview { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 5px 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 5px; font-size: 13px; }
.attachment-preview span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.error { min-height: 0; margin: 5px 0 0; color: #a64433; font-size: 13px; }
.error:empty { display: none; }
.login-shell { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background-color: #e9efec; background-image: radial-gradient(#cfdbd3 1px, transparent 1px); background-size: 24px 24px; }
.login-panel { width: min(100%, 390px); padding: 36px; background: var(--paper); border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 20px 60px #243d2d12; }
.kicker { color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: .1em; margin: 30px 0 2px; }
.login-panel h1 { font: 600 37px Space, sans-serif; margin: 0; }
.login-subtitle { color: var(--muted); margin: 5px 0 35px; }
.login-panel label, .topic-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.login-panel input, .topic-form input { width: 100%; height: 46px; border: 1px solid #b9cdc0; border-radius: 5px; padding: 0 12px; background: #fff; }
.login-submit { width: 100%; margin-top: 15px; }
dialog { width: min(420px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 7px; padding: 0; background: var(--paper); color: var(--ink); box-shadow: 0 25px 70px #20342e33; }
dialog::backdrop { background: #142e24a0; }
.settings { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--paper); --muted: #50665b; }
.settings-scroll { overflow-y: auto; padding: 28px 32px 48px; }
.settings-scroll > * { max-width: 780px; margin-left: auto; margin-right: auto; }
.settings h3 { margin: 0 0 8px; font: 600 24px Space, sans-serif; }
.settings p { font-size: 14px; line-height: 1.6; max-width: 70ch; }
.settings-intro p { color: var(--muted); margin: 0 0 24px; }
.settings-section { padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.account-settings > p { color: var(--muted); margin: 0 0 18px; }
.password-form { max-width: 560px; }
.password-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.password-fields label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; }
.password-fields label:first-child { grid-column: 1 / -1; }
.password-fields input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #b9cdc0; border-radius: 5px; background: #fff; }
.field-hint { margin: 7px 0 0; color: var(--muted); font-size: 12px !important; }
.password-form .secondary { margin-top: 12px; }
.connection-facts { display: grid; gap: 12px; padding: 18px 0; border-block: 1px solid var(--line); margin-bottom: 24px; }
.connection-facts > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; font-size: 13px; }
.connection-facts dt { color: var(--muted); }
.connection-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.setup-options { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 20px 32px; margin-block: 24px; }
.setup-options > div { flex: 1; min-width: min(240px, 100%); }
.setup-options label, .setup-options legend { font-size: 13px; font-weight: 600; }
.setup-options input:not([type=radio]) { display: block; width: 100%; height: 42px; margin-top: 8px; padding: 0 12px; border: 1px solid #b9cdc0; border-radius: 5px; background: #fff; }
.setup-options p { font-size: 12px; margin: 6px 0 0; color: var(--muted); }
.shell-picker { border: 0; padding: 0; margin: 0; }
.shell-picker legend { margin-bottom: 10px; }
.shell-picker label { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding-right: 12px; }
.shell-picker input { accent-color: var(--accent); }
.setup-steps > details { border-top: 1px solid var(--line); }
.setup-steps > details:last-child { border-bottom: 1px solid var(--line); }
.settings summary { cursor: pointer; font-weight: 600; line-height: 1.5; padding: 18px 0; }
.settings summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.step-content { padding: 0 0 22px; }
.step-content > p:first-child { margin-top: 0; }
.command-block { display: flex; align-items: flex-start; gap: 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); padding: 6px; margin: 12px 0; min-width: 0; }
.command-block pre { flex: 1; min-width: 0; margin: 0; padding: 9px; white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: auto; font-size: 12px; line-height: 1.7; }
.command-block code { font-family: ui-monospace, monospace; }
.settings .setup-note { color: var(--muted); font-size: 13px; }
.secondary { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; padding: 8px 14px; border: 1px solid #b9cdc0; border-radius: 5px; background: transparent; color: var(--ink); font-weight: 600; font-size: 13px; }
.secondary:hover { background: var(--surface); }
.danger { display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 45px; margin-top: 22px; padding: 0 18px; border: 0; border-radius: 5px; background: #a64433; color: #fff; font-weight: 600; }
.danger:hover { background: #873426; }
.danger img { filter: brightness(0) invert(1); }
.delete-warning { margin: 0 0 22px; color: var(--muted); line-height: 1.55; }
.verification-detail { padding: 12px 0; color: var(--muted); }
.verification-detail[data-state=confirmed] { color: #12553e; font-weight: 600; }
.verification-detail[data-state=timed_out] { color: #9a382b; }
.settings-feedback { color: #12553e; overflow-wrap: anywhere; }
.settings-feedback:empty { display: none; }
.troubleshooting { margin-top: 24px; }
.troubleshooting dt { font-size: 14px; font-weight: 600; margin-top: 18px; }
.troubleshooting dd { font-size: 13px; color: var(--muted); margin: 6px 0 0; line-height: 1.6; max-width: 70ch; }
.sidebar-bottom #settings-open { margin-left: auto; }
.sidebar-bottom #logout { margin-left: 0; }
.settings .primary, .settings .secondary { max-width: 100%; white-space: normal; }
@media (max-width: 700px) {
  .settings { height: 100dvh; }
  .workspace.settings-open .sidebar, .workspace.settings-open .conversation { display: none; }
  .settings-scroll { padding: 22px 18px 36px; }
  .settings h3 { font-size: 21px; }
  .connection-facts > div { grid-template-columns: 1fr; gap: 4px; }
  .setup-options { gap: 16px; }
  .password-fields { grid-template-columns: 1fr; }
  .password-fields label:first-child { grid-column: auto; }
}
.topic-form { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.dialog-heading h2 { font: 600 22px Space, sans-serif; margin: 0; }
.topic-form .primary { width: 100%; margin-top: 22px; }
@media (max-width: 700px) {
  .workspace { display: block; }
  .sidebar { height: 100dvh; }
  .conversation { height: 100dvh; }
  .workspace:not(.chat-open) .conversation { display: none; }
  .workspace.chat-open .sidebar { display: none; }
  .back { display: grid; }
  .conversation-header { min-height: 56px; padding: 6px 10px; gap: 4px; }
  .messages { padding: 12px; }
  .compose { padding: 8px 10px 10px; }
  .message { max-width: 92%; }
}