:root {
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  color: #172f2a;
  background: #eaf2ed;
  color-scheme: light;
  --ink: #172f2a;
  --muted: #526960;
  --green: #245c4b;
  --green-dark: #184437;
  --line: #e0ebe5;
  --white: #fff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 290px; }
button, input, select, textarea { font: inherit; }
button, .button {
  background: #f3f8f5; color: var(--green-dark); border: 1px solid var(--line); border-radius: 12px;
  padding: .65rem .9rem; cursor: pointer; font-size: .86rem; font-weight: bold; text-decoration: none;
  display: inline-flex; gap: .45rem; align-items: center; justify-content: center;
}
button:hover, .button:hover { background: #e9f2ec; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .timeline:focus-visible { outline: 2px solid #347a62; outline-offset: 3px; }
button:disabled { opacity: .55; cursor: wait; }
button.primary, .button.primary { background: var(--green); color: white; border-color: var(--green); }
button.primary:hover, .button.primary:hover { background: var(--green-dark); }
h1, h2, p { margin: 0; }
.page { min-height: 100dvh; display: grid; place-items: center; padding: 28px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: bold; font-size: 1.15rem; width: fit-content; }
.logo { display: inline-block; flex: none; width: 40px; height: 40px; border-radius: 13px; background: var(--green); position: relative; }
.logo::before { content: ''; position: absolute; width: 21px; height: 15px; right: 9px; top: 11px; border: 1.5px solid #f5fff9; border-radius: 6px 6px 6px 3px; }
.logo::after { content: ''; position: absolute; width: 4px; height: 4px; top: 17px; right: 13px; border-radius: 50%; background: #dcf4e7; box-shadow: -6px 0 #dcf4e7, -12px 0 #dcf4e7; }
.welcome, .shell { width: min(1180px, 100%); background: white; border-radius: 26px; border: 1px solid #dfece4; overflow: hidden; box-shadow: 0 16px 70px #1d493016; }
.welcome { display: grid; grid-template-columns: 1fr 1fr; min-height: 555px; }
.welcome-copy { padding: clamp(32px, 6vw, 88px); display: grid; align-content: center; gap: 36px; }
.welcome-copy h1 { font-size: clamp(2.2rem, 5vw, 4.65rem); line-height: 1.3; letter-spacing: -.055em; }
.welcome-copy h1 span { color: #39795f; }
.welcome-copy p { margin-top: 12px; color: var(--muted); line-height: 1.9; }
.login .notice { font-size: .86rem; margin-top: 0; }
.login .button + .notice { margin-top: 10px; }
.demo .row { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.welcome-art { position: relative; overflow: hidden; isolation: isolate; background: radial-gradient(ellipse at 45% 45%, #e0f3e5, #b8d7c6); display: grid; place-items: center; min-height: 260px; }
.art-orbit { width: min(76%, 440px); aspect-ratio: 1; position: absolute; border: 1px solid #f4fff8c4; border-radius: 50%; }
.orbit-inner { width: min(57%, 340px); }
.art-card { display: flex; gap: 13px; position: absolute; width: min(61%, 295px); padding: 19px; border-radius: 23px 23px 6px 23px; align-items: center; box-shadow: 0 22px 65px #245c4b31; }
.art-first { transform: translate(12%, -36%) rotate(-12deg); background: #ffffffed; }
.art-second { transform: translate(-13%, 46%) rotate(9deg); background: #265e4e; border-radius: 23px 23px 23px 6px; }
.art-card i { flex: 0 0 38px; height: 38px; background: #d3ebdc; border-radius: 15px; }
.art-card div { flex: 1; display: grid; gap: 8px; }
.art-card b { height: 7px; border-radius: 10px; background: #cde1d6; }
.art-card b + b { width: 68%; }
.art-second i, .art-second b { background: #7bad97; }
.art-sparkle { position: absolute; font-size: 46px; color: #fff; top: 22%; left: 23%; }
.art-sparkle.small { inset: auto 17% 23% auto; font-size: 32px; }
.shell { height: min(850px, calc(100dvh - 56px)); display: grid; grid-template-columns: minmax(270px, 330px) minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; border-inline-end: 1px solid var(--line); min-height: 0; }
.sidebar-header, .thread-header { display: flex; align-items: center; gap: 10px; padding: 18px 22px; min-height: 76px; background: white; border-bottom: 1px solid var(--line); }
.sidebar-header { justify-content: space-between; }
.sidebar-body { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 20px 14px 14px; gap: 13px; }
.list-heading { display: flex; align-items: center; justify-content: space-between; padding-inline: 5px; }
.list-heading h1 { font-size: 1.25rem; }
.search { display: flex; gap: 10px; align-items: center; background: #f3f7f4; border: 1px solid var(--line); border-radius: 12px; padding: 0 13px; }
.search input { width: 100%; padding: 12px 0; background: none; border: 0; font-size: .85rem; color: var(--ink); }
.search-icon { width: 12px; height: 12px; flex: none; border: 1.5px solid #638374; border-radius: 50%; position: relative; }
.search-icon::after { content: ''; width: 5px; border-top: 1.5px solid #638374; position: absolute; bottom: -2px; left: -3px; transform: rotate(45deg); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs button { background: none; border: 0; padding: 8px 10px; font-size: .75rem; }
.tabs button[aria-pressed=true] { background: #dceee4; }
.chat-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.chat-list p { color: var(--muted); text-align: center; font-size: .83rem; line-height: 1.7; padding: 24px 12px; }
.chat-item { width: 100%; border-color: transparent; background: white; min-width: 0; justify-content: flex-start; text-align: start; padding: 10px 8px; gap: 10px; }
.chat-item[aria-current=true] { background: #e5f2e9; border-color: #daede1; }
.chat-summary { flex: 1; display: grid; min-width: 0; gap: 7px; }
.chat-summary strong, .chat-preview { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-preview, time { font-size: .73rem; font-weight: normal; color: var(--muted); }
.avatar { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 15px; padding: 0; background: #dcefe5; color: #285d4f; font-size: .98rem; font-weight: bold; }
.avatar[data-kind=channel] { background: #f2e9d8; color: #73532c; }
.avatar[data-kind=group] { background: #e7e5f4; color: #564279; }
.join-button { margin-top: auto; }
.thread { min-height: 0; display: grid; background: radial-gradient(circle, #94b5a146 1px, transparent 1px) 0 0 / 19px 19px, #f3f8f4; }
.empty-thread { display: grid; align-content: center; justify-items: center; text-align: center; gap: 13px; padding: 24px; }
.empty-icon { width: 82px; height: 82px; display: grid; place-items: center; background: #e2efe6; border: 1px solid #d7e9de; border-radius: 27px; }
.empty-thread h2, .thread-name h2 { font-size: 1.13rem; }
.empty-thread p, .thread-name p { color: var(--muted); font-size: .84rem; line-height: 1.7; }
.active-thread { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; }
.thread-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.timeline { display: flex; flex-direction: column; min-height: 0; overflow: auto; padding: 18px clamp(15px, 4vw, 45px); }
.older { display: flex; flex: none; margin: 0 auto 15px; }
.no-messages { text-align: center; color: var(--muted); padding: 20px; font-size: .86rem; }
.messages { display: flex; flex: none; flex-direction: column; gap: 11px; margin-block-start: auto; }
.date-marker { align-self: center; background: #e2efe6; padding: 5px 12px; border-radius: 25px; color: var(--muted); font-size: .72rem; }
.message { background: white; border: 1px solid var(--line); border-radius: 16px 6px 16px 16px; max-width: min(86%, 560px); min-width: 90px; align-self: flex-start; padding: 9px 13px; overflow-wrap: anywhere; }
.message.own { align-self: flex-end; background: #dff0e5; border-color: #d3e8da; border-radius: 6px 16px 16px 16px; }
.message .sender { display: block; color: var(--green-dark); font-size: .74rem; font-weight: bold; margin-bottom: 4px; }
.message-body { white-space: pre-wrap; line-height: 1.8; font-size: .9rem; }
.message.deleted .message-body { color: var(--muted); font-style: italic; }
blockquote { border-inline-start: 2px solid #548a70; background: #b7d4c43b; border-radius: 5px; margin: 3px 0 6px; padding: 7px; white-space: pre-wrap; font-size: .75rem; }
.message footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.message-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.message-actions button { background: none; padding: 2px 3px; border: 0; font-size: .69rem; }
.composer, .read-only { padding: 13px clamp(15px, 4vw, 45px); border-top: 1px solid var(--line); background: white; }
.compose-controls { display: flex; align-items: stretch; gap: 9px; }
textarea, .dialog-content input, .dialog-content select { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 11px; color: var(--ink); background: #f7faf8; }
textarea { flex: 1; resize: vertical; min-height: 45px; max-height: 180px; line-height: 1.5; }
.read-only { text-align: center; color: var(--muted); line-height: 1.6; font-size: .85rem; }
.message-context { display: flex; justify-content: space-between; align-items: center; padding-bottom: 7px; color: var(--muted); font-size: .8rem; }
.message-context span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { padding: 5px 9px; font-size: 1.15rem; line-height: 1; }
.back { display: none; }
dialog { width: min(430px, calc(100% - 24px)); color: var(--ink); border: 1px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: 0 20px 70px #0f271c38; }
dialog::backdrop { background: #112b236b; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.dialog-heading h2 { font-size: 1.13rem; }
.dialog-content { display: grid; gap: 12px; }
.dialog-content label { display: grid; gap: 7px; font-size: .86rem; }
.dialog-content p { line-height: 1.8; font-size: .86rem; }
#dialog-actions { margin-top: 17px; }
.form-error { margin-top: 10px; line-height: 1.6; font-size: .83rem; color: #902c38; }
.toast { z-index: 3; position: fixed; bottom: 20px; inset-inline-start: 20px; max-width: calc(100% - 40px); border-radius: 12px; padding: 12px 17px; background: var(--green-dark); color: white; font-size: .85rem; line-height: 1.65; }
@media (max-width: 740px) {
  .page { padding: 0; align-items: stretch; }
  .welcome, .shell { width: 100%; border: 0; border-radius: 0; }
  .welcome { grid-template-columns: 1fr; grid-template-rows: auto minmax(250px, 1fr); }
  .welcome-copy { padding: 30px 24px; gap: 24px; }
  .shell { height: 100dvh; grid-template-columns: minmax(0, 1fr); }
  .shell .thread, .shell.has-thread .sidebar { display: none; }
  .shell.has-thread .thread { display: grid; }
  .back { display: inline-flex; }
  .thread-header, .sidebar-header { padding: 12px; min-height: 64px; }
  .thread-header button { padding: 7px; }
}
