:root {
  color-scheme: light;
  font-family: system-ui, "Segoe UI", sans-serif;
  color: #23322a;
  background: #f5f4ed;
  font-size: 16px;
  --ink: #23322a;
  --muted: #4f6257;
  --line: #d7dfd4;
  --paper: #fffefa;
  --green: #2e5947;
  --pale: #e8eee4;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.16; }
h2 { font-size: 1.05rem; }
a { color: #24543d; text-underline-offset: .15em; overflow-wrap: anywhere; }
button, input, textarea, select { font: inherit; }
button, .file-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .5rem .85rem; border: 1px solid var(--line); border-radius: .7rem;
  background: var(--paper); color: var(--ink); cursor: pointer;
}
button:hover, .file-button:hover { background: #e5eee4; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible,
.compose-row:focus-within .file-button:has(+ input:focus-visible) {
  outline: 3px solid #347a62; outline-offset: 3px;
}
.primary { background: var(--green); color: #fff; border-color: var(--green); font-weight: 650; }
.primary:hover { background: #224b39; }
button:disabled { cursor: wait; opacity: .7; }
.quiet { border-color: transparent; background: transparent; color: var(--green); font-weight: 650; }
.welcome { min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem; }
.welcome-card { max-width: 31rem; width: 100%; padding: 2rem; border: 1px solid var(--line);
  border-radius: 1.25rem; background: var(--paper); display: grid; justify-items: start; gap: .9rem; }
.welcome-card p { color: var(--muted); line-height: 1.6; }
.workspace { display: grid; grid-template-columns: minmax(13rem, 17rem) minmax(0, 1fr) minmax(13rem, 18rem);
  min-height: 100dvh; max-width: 105rem; margin: auto; }
.navigation, .resources, .conversation { min-width: 0; }
.navigation { padding: clamp(.85rem, 2vw, 1.55rem); display: flex; flex-direction: column; gap: .55rem;
  border-right: 1px solid var(--line); background: #ecf0e7; }
.brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; font-size: 1.28rem; font-weight: 750; }
.brand img { border-radius: .8rem; }
.navigation-heading, .section-heading, .dialog-header, .member-line {
  display: flex; align-items: center; justify-content: space-between; gap: .65rem;
}
#groups { display: grid; align-content: start; gap: .45rem; }
.group-button { width: 100%; text-align: left; justify-content: space-between; gap: .45rem;
  border-color: transparent; background: transparent; overflow-wrap: anywhere; }
.group-button[aria-current="true"] { background: #dbe8d9; border-color: #bacdb9; font-weight: 700; }
.unread { padding: .12rem .45rem; border-radius: 1rem; background: var(--green); color: #fff; font-size: .88rem; }
.account { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .55rem;
  margin-top: auto; padding-top: 1rem; color: var(--muted); }
.conversation { display: flex; flex-direction: column; height: 100dvh; background: var(--paper); }
.conversation-header { display: flex; align-items: center; gap: clamp(.5rem, 2vw, 1rem);
  min-height: 6rem; padding: .85rem clamp(.8rem, 2.4vw, 1.8rem); border-bottom: 1px solid var(--line); }
.conversation-header div { min-width: 0; overflow-wrap: anywhere; }
.conversation-header p { color: var(--muted); margin-top: .25rem; }
.conversation-header #manage { margin-left: auto; }
.group-logo { flex: 0 0 2.75rem; aspect-ratio: 1; display: grid; place-items: center; border-radius: .75rem;
  color: #fff; background: var(--green); font-weight: 750; overflow: hidden; }
.group-logo img { width: 100%; height: 100%; object-fit: cover; }
.feed { flex: 1; overflow: auto; padding: 1.25rem clamp(.75rem, 3.3vw, 2.25rem); }
.messages { padding: 0; margin: 0; list-style: none; display: grid; gap: 1.1rem; }
.message { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; }
.message.mine { align-items: flex-end; }
.message-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem; font-size: .9rem; color: var(--muted); }
.bubble { max-width: min(41rem, 93%); padding: .65rem .85rem; border-radius: .8rem .8rem .8rem .2rem;
  border: 1px solid var(--line); background: #f2f4ee; overflow-wrap: anywhere; }
.mine .bubble { border-radius: .8rem .8rem .2rem .8rem; background: #e5eee1; }
.message-body { white-space: pre-wrap; line-height: 1.55; }
.message-file { display: block; margin-top: .4rem; }
.message-file img { display: block; max-width: 100%; max-height: 16rem; margin-bottom: .35rem; border-radius: .35rem; }
.quote { padding: .35rem .55rem; margin-bottom: .4rem; border-left: 3px solid #53856c; background: #e1ebe0; color: #354c3e; }
.message-actions { display: flex; flex-wrap: wrap; gap: .15rem; }
.message-actions button { padding: .2rem .55rem; background: transparent; border-color: transparent; font-size: .9rem; }
.message-actions button:hover { background: var(--pale); }
#older { margin-bottom: 1rem; }
.compose { padding: .65rem clamp(.75rem, 2vw, 1.5rem) 1rem; border-top: 1px solid var(--line); }
.compose-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: .55rem; }
textarea, input:not([type="file"]), select {
  width: 100%; min-width: 0; padding: .6rem .7rem; border: 1px solid #aebdaf; border-radius: .6rem;
  background: #fff; color: var(--ink);
}
.compose-row textarea { min-height: 48px; resize: vertical; }
#file { width: 1px; height: 1px; position: absolute; clip-path: inset(50%); }
.file-name { display: block; margin-top: .5rem; color: var(--muted); overflow-wrap: anywhere; }
.reply { display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  margin-bottom: .5rem; padding-left: .65rem; border-left: 3px solid #53856c; }
.chat-status, .archive-note { padding: .6rem 1rem; color: #7a3d24; }
.chat-status:empty, .dialog-status:empty { display: none; }
.resources { padding: 1.35rem clamp(.85rem, 2vw, 1.4rem); display: flex; flex-direction: column; gap: 1.5rem;
  border-left: 1px solid var(--line); background: #f5f5ee; overflow-wrap: anywhere; }
.resources h2 { margin-bottom: .55rem; }
.resources p { line-height: 1.5; }
.pinned-item, .link-item { padding: .7rem 0; border-top: 1px solid var(--line); }
.link-item { display: flex; align-items: center; gap: .25rem; justify-content: space-between; }
.empty-text { color: var(--muted); }
.empty { padding: 2rem; }
.empty p { margin-top: 1rem; }
dialog { width: min(37rem, calc(100vw - 1.5rem)); max-height: 90dvh; border: 1px solid var(--line);
  border-radius: 1.05rem; padding: 1rem; background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #223b2f80; }
.dialog-header { margin-bottom: .6rem; }
.dialog-header h2 { font-size: 1.3rem; }
#dialog-body { display: grid; gap: 1rem; }
#dialog-body section, .dialog-form { display: grid; gap: .65rem; }
label > input, label > select { margin-top: .25rem; }
.dialog-status { margin-top: .75rem; color: #7a3d24; }
.member-line { border-top: 1px solid var(--line); padding: .35rem 0; flex-wrap: wrap; }
.member-line span { margin-right: auto; }
@media (max-width: 68rem) {
  .workspace { grid-template-columns: minmax(11rem, 13rem) minmax(0, 1fr); }
  .navigation { grid-row: span 2; }
  .conversation { height: calc(100dvh - 9rem); min-height: 29rem; }
  .resources { grid-column: 2; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 0; }
}
@media (max-width: 48rem) {
  .workspace { display: block; }
  .navigation { display: grid; grid-template-columns: 1fr auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin-bottom: 0; }
  .brand img { width: 38px; height: 38px; }
  .navigation-heading { grid-column: 1 / -1; grid-row: 2; }
  #groups { display: flex; overflow: auto; grid-column: 1 / -1; }
  .group-button { flex: 0 0 auto; width: auto; max-width: 13rem; }
  .account { grid-column: 2; grid-row: 1; margin: 0; padding: 0; justify-content: end; }
  #account-name { display: none; }
  .conversation { height: min(38rem, calc(100dvh - 10.3rem)); min-height: 25rem; }
  .conversation-header { min-height: 4.5rem; }
  .conversation-header #manage { padding-inline: .35rem; font-size: .91rem; }
  .resources { padding: .9rem; }
}
@media (max-width: 25rem) {
  .compose-row { grid-template-columns: minmax(0, 1fr) 1.45fr; }
  .compose-row textarea { grid-row: 1; grid-column: 1 / -1; }
  .resources { grid-template-columns: 1fr; }
  .conversation-header p { font-size: .88rem; }
}
