:root {
  color-scheme: light;
  font-family: "Instrument Sans", "Microsoft YaHei", system-ui, sans-serif;
  background: #f7f7f2;
  color: #202921;
  --muted: #536556;
  --border: #d7ded2;
  --green: #224734;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button, textarea, select, input[type="password"] {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: inherit;
}
button { min-height: 39px; padding: .5rem .8rem; }
button:disabled { cursor: wait; opacity: .6; }
.primary { background: var(--green); border-color: var(--green); color: #fff; }
:focus-visible { outline: 2px solid #4c8662; outline-offset: 2px; }
.identity { display: flex; align-items: center; gap: .65rem; font-weight: 700; }
.mark {
  display: grid; place-items: center; width: 34px; aspect-ratio: 1;
  border: 1px solid #93ab99; border-radius: 8px; color: var(--green);
}
#login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card {
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  width: min(100%, 420px); padding: 2rem;
}
.login-card form { display: grid; gap: .7rem; }
input[type="password"] { padding: .65rem; min-height: 44px; }
h1 { font-size: clamp(1.35rem, 2.8vw, 2.1rem); margin: .8rem 0; }
h2 { font-size: .94rem; margin: 0; }
#portal { display: grid; grid-template-columns: 235px minmax(0, 1fr); min-height: 100vh; }
aside { background: #edf0e7; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
aside nav { display: grid; gap: .25rem; flex: 1; align-content: start; }
.plain { border-color: transparent; background: transparent; text-align: left; }
.plain:hover, [aria-current="true"] { background: #dce7dc; }
.history-item { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
#conversation { display: flex; flex-direction: column; width: min(100%, 1000px); margin: 0 auto; padding: 1rem clamp(1rem, 4vw, 3rem); }
header { display: flex; align-items: center; justify-content: space-between; gap: .4rem; border-bottom: 1px solid var(--border); }
#status, .muted { color: var(--muted); font-size: .88rem; }
#messages { display: grid; align-content: start; gap: .9rem; padding: 1rem 0; flex: 1; }
article { border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 1rem; }
article.user { background: #eaf1e7; }
article p { white-space: pre-wrap; overflow-wrap: anywhere; margin: .45rem 0 0; line-height: 1.55; }
#downloads { padding: .9rem 0; }
#files { padding-left: 1.4rem; margin: .45rem 0; overflow-wrap: anywhere; }
a { color: var(--green); }
#composer { display: grid; gap: .55rem; background: #fff; border: 1px solid var(--border); padding: 1rem; border-radius: 12px; }
textarea { width: 100%; padding: .75rem; resize: vertical; }
.controls { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem 1rem; font-size: .88rem; }
.controls label { display: flex; align-items: center; gap: .3rem; }
.controls select { padding: .35rem; }
.file-picker { flex-wrap: wrap; }
.file-picker input { width: min(13rem, 100%); }
#send { margin-left: auto; }
.error { color: #a3292a; }
.error:empty { display: none; }
#attachments-list { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 670px) {
  #portal { grid-template-columns: minmax(0, 1fr); }
  aside { display: grid; grid-template-columns: 1fr auto; }
  aside nav { grid-column: 1 / -1; max-height: 7rem; overflow: auto; }
  aside form { grid-column: 1 / -1; }
  header { flex-wrap: wrap; }
}
