* { box-sizing: border-box; }
:root {
  font-family: "Inter", "DejaVu Sans", sans-serif;
  --black: #000;
  --white: #fff;
  --blue: #001155;
  --charcoal: #2c2c2c;
  --gray: #5c5c5c;

  --ink: var(--black);
  --muted: var(--gray);
  --surface: var(--white);
  --brand: var(--blue);
  --line: var(--gray);
  --focus: var(--blue);
  color-scheme: light;
  color: var(--ink);
  background: var(--surface);
  accent-color: var(--brand);
}
body { margin: 0; }
a { color: var(--brand); }
::selection { color: var(--white); background: var(--blue); }
::placeholder { color: var(--muted); opacity: 1; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; }
button, select, input, textarea { border: 1px solid var(--muted); border-radius: .45rem; }
button { cursor: pointer; background: var(--surface); color: var(--brand); padding: .5rem .78rem; font-size: .86rem; }
button:enabled:hover { text-decoration: underline; }
button:disabled { color: var(--muted); background: var(--surface); border-style: dashed; cursor: default; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.primary, .primary:hover { background: var(--brand); color: var(--white); border-color: var(--brand); }
.primary:hover { background: var(--black); }
h1, h2, p { margin: 0; }
h1 { font: normal clamp(1.9rem, 3vw, 2.8rem)/1.12 "Iowan Old Style", Georgia, serif; letter-spacing: -.035em; }
h2 { font-size: .94rem; }
p { line-height: 1.55; }
.brand { display: flex; align-items: center; gap: .65rem; font: 1.38rem Georgia, serif; letter-spacing: -.025em; }
.mark { flex: none; width: 1.45em; height: 1.33em; color: var(--brand); fill: currentColor; }
header { height: 4.2rem; background: var(--brand); color: var(--white); border-bottom: 1px solid var(--black); padding: 0 1.6rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.account, .section-head, .composer-foot, .file-path, .file-actions, .tabs, .dialog-actions { display: flex; align-items: center; gap: .6rem; }
.account, .muted, .composer-foot span, aside p, .welcome p { color: var(--muted); font-size: .85rem; }
header .mark { color: var(--white); }
header .account { color: var(--white); gap: clamp(.85rem, 2vw, 1.5rem); min-width: 0; }
.account #identity { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account a { white-space: nowrap; }
header a { color: var(--white); font-size: .9rem; }
.account-page { max-width: 38rem; margin: 2rem auto; padding: 0 1.25rem 2rem; }
.account-page h1 { font: 2.25rem Georgia, serif; margin-bottom: .4rem; }
.account-page section { border-top: 1px solid var(--line); padding-block: 1.3rem; }
.account-page h2 { font-size: 1.1rem; margin: 0 0 .85rem; }
.account-page form { display: grid; gap: .75rem; }
.account-page form button { justify-self: start; }
.account-page [role=status]:empty, #delete-account p:empty, #private-projects:empty { display: none; }
#delete-account p, #private-projects { margin: .85rem 0; overflow-wrap: anywhere; }
header button { border-color: transparent; }
header :focus-visible { outline-color: var(--white); }
.layout {
  --left-width: clamp(12rem, var(--left-preference, 17%), 36%);
  --right-width: clamp(12rem, var(--right-preference, 17%), 36%);
  position: relative; display: grid;
  grid-template-columns: var(--left-width) minmax(0, 1fr) var(--right-width);
  height: calc(100dvh - 4.2rem);
}
.layout:has(> aside[hidden]) { --right-width: 0px; }
.column-divider { position: absolute; z-index: 1; inset-block: 0; width: 10px; cursor: col-resize; touch-action: none; }
.column-divider[data-side=left] { left: var(--left-width); transform: translateX(-50%); }
.column-divider[data-side=right] { right: var(--right-width); transform: translateX(50%); }
.column-divider::after { content: ""; position: absolute; inset: 0 3px; }
.column-divider:is(:hover, :focus-visible, :active)::after { background: var(--focus); }
.column-divider:focus-visible { outline: none; }
aside[hidden] + .column-divider { display: none; }
/* Text and controls on the dark sidebars. */
.layout > :is(nav, aside) {
  color-scheme: dark;
  --ink: var(--white);
  --muted: var(--white);
  --brand: var(--white);
  --surface: var(--charcoal);
  --focus: var(--white);
  color: var(--ink);
  background: var(--charcoal);
}
nav { display: flex; flex-direction: column; padding: 1.35rem 1rem; border-right: 1px solid var(--line); overflow: auto; }
.section-head, .composer-foot { justify-content: space-between; }
.section-head { margin-bottom: .55rem; }
.section-head h2, #files-panel > label { font-size: .8rem; font-weight: 650; color: var(--muted); }
.add { width: 1.8rem; height: 1.8rem; padding: 0; font-size: 1.25rem; background: transparent; }
select, input { padding: .63rem; background: var(--surface); color: inherit; max-width: 100%; }
select, form label input, #dialog-input { width: 100%; }
.chat-title { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.project-picker, .chat-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(2, 1.75rem); align-items: center; gap: .2rem; min-width: 0; }
#chat-name { font-size: clamp(1.6rem, 2.5vw, 2.3rem); }
.project-picker select, .chat-link, #report-open { min-width: 0; color-scheme: light; background: var(--white); color: var(--blue); }
#project-hint { margin: .55rem 0 0; line-height: 1.45; }
.chat-title button { flex: none; padding: .3rem .5rem; }
#chat-nav { margin-top: 2.1rem; }
#chat-list { display: grid; gap: .2rem; }
.chat-link { text-align: left; border-color: transparent; overflow-wrap: anywhere; }
.chat-link[aria-current=true] { border-color: var(--white); box-shadow: inset 0 0 0 6px currentColor; font-weight: 700; }
.project-picker button, .chat-rename { padding: .35rem .45rem; border-color: transparent; background: transparent; }
.project-picker button:hover, .chat-rename:hover { background: var(--gray); }
#conversation { min-width: 0; min-height: 0; }
#chat-view { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.chat-head { padding: 1.75rem clamp(1.1rem, 3vw, 3.1rem) 1.2rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#browser-view { display: inline-block; margin-top: .5rem; color: var(--brand); font-size: .85rem; }
#schedules { font-size: .85rem; margin-top: .55rem; }
#schedules summary { cursor: pointer; color: var(--brand); width: fit-content; }
#schedule-list { max-height: 22vh; overflow: auto; }
.schedule { padding-block: .55rem; border-top: 1px solid var(--line); }
.schedule button { margin-top: .3rem; }
.chat-head .muted { margin-bottom: .4rem; }
.chat-column { min-width: 0; padding-inline: clamp(1.1rem, 3vw, 3.1rem); scrollbar-gutter: stable; }
#timeline { overflow: auto; padding-block: 1.5rem; }
.composer-row { overflow: hidden; }
#messages, #composer { width: 100%; max-width: 56rem; margin-inline: auto; }
.welcome { max-width: 37rem; margin: min(14vh, 7rem) auto 0; padding: 1.5rem; }
.welcome p { margin-top: .8rem; }
.welcome button { margin-top: 1.2rem; }
.empty { font-size: .9rem; color: var(--muted); }
.message { margin-bottom: 1.45rem; line-height: 1.55; overflow-wrap: anywhere; }
.message .sender, .message .observation-note { font-weight: 650; color: var(--charcoal); font-size: .8rem; }
.message .sender { margin-bottom: .35rem; }
.message .sender time { display: inline-block; margin-inline-start: .65rem; font-size: .75rem; font-weight: 400; color: var(--muted); }
.message .body { white-space: pre-wrap; }
.markdown { min-width: 0; overflow-x: auto; }
.markdown > * { margin: 0; }
.markdown > * + * { margin-top: .7rem; }
.markdown :is(h1,h2,h3,h4,h5,h6) { line-height: 1.4; font-family: inherit; font-size: 1.1em; font-weight: 650; }
.markdown :is(ul,ol) { padding-left: 1.5rem; }
.markdown table { border-collapse: collapse; }
.markdown th, .markdown td { padding: .25rem .55rem; border: 1px solid var(--line); text-align: left; }
.markdown pre { overflow-x: auto; border: 1px solid var(--line); padding: .6rem; border-radius: .3rem; }
.markdown blockquote { border-left: .2rem solid var(--line); padding-left: .7rem; }
.message a, .file-row a { color: var(--brand); }
.message.user { background: var(--charcoal); color: var(--white); width: fit-content; max-width: 88%; padding: .75rem 1rem; margin-left: auto; border-radius: .8rem .8rem .15rem .8rem; }
.message.user .sender { color: inherit; }
.status { font-size: .8rem; color: var(--muted); margin-top: .35rem; }
.problem { color: var(--ink); font-weight: 600; }
#composer { padding-block: .5rem 1.25rem; }
textarea { padding: .85rem; width: 100%; min-height: 4.8rem; max-height: 18rem; resize: vertical; background: var(--surface); color: inherit; }
.model-settings { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .45rem; }
.model-settings label { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted); }
.model-settings select { width: auto; padding: .3rem .45rem; color: var(--brand); cursor: pointer; }
.composer-foot { margin-top: .4rem; }
aside { border-left: 1px solid var(--line); padding: 1.25rem; overflow: auto; }
.tabs { flex-wrap: wrap; border-bottom: 1px solid var(--line); gap: 1.25rem; margin-bottom: 1.4rem; }
.tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: .5rem 0 .7rem; border-radius: 0; }
.tabs button[aria-pressed=true] { border-bottom-color: var(--brand); font-weight: bold; }
.file-path { flex-wrap: wrap; gap: .2rem .4rem; margin: 1rem 0 .65rem; font-size: .85rem; overflow-wrap: anywhere; }
.file-path button { padding: .15rem 0; background: transparent; border: none; text-decoration: underline; }
.file-path [aria-current] { font-weight: 650; }
.file-row { display: flex; gap: .3rem; align-items: center; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.file-row a, .file-name { overflow-wrap: anywhere; font-size: .85rem; }
.file-name { border: 0; background: transparent; padding: .2rem 0; text-align: left; }
.file-name::before { content: ""; display: inline-block; width: 1rem; height: .8rem; margin-right: .45rem;
  background: var(--muted); clip-path: polygon(0 0,40% 0,51% 20%,100% 20%,100% 100%,0 100%); }
.remove { border: 0; background: transparent; padding: .3rem; color: var(--muted); font-size: 1rem; }
.entry-actions { display: inline-flex; flex: none; }
.empty { padding: 1rem 0; }
.file-actions { flex-wrap: wrap; margin-top: 1rem; }
#move-file { margin-top: .4rem; overflow-wrap: anywhere; }
#move-entries { max-height: 40vh; overflow-y: auto; }
#move-error { margin-top: .7rem; }
#delete-warning, #delete-error { margin-top: .7rem; overflow-wrap: anywhere; }
.danger { color: var(--white); background: var(--black); border-color: var(--black); font-weight: 650; }
#members { list-style: none; padding: 0; font-size: .9rem; overflow-wrap: anywhere; }
#members li { padding: .6rem 0; border-bottom: 1px solid var(--line); }
#pending-invites h3 { margin: 1.2rem 0 .4rem; font-size: .9rem; }
#pending-invites ul { padding: 0; list-style: none; }
#pending-invites li { margin-bottom: .65rem; overflow-wrap: anywhere; font-size: .9rem; }
.member-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.member-actions button { padding: .3rem .5rem; }
#team-panel p { margin: .65rem 0; }
#auth { min-height: 100dvh; display: grid; place-items: center; background: var(--white); padding: 1rem; }
.auth-card, dialog { background: var(--surface); border: 1px solid var(--line); border-radius: .9rem; padding: clamp(1.5rem, 4vw, 3rem); width: min(100%, 27rem); }
.auth-card h1 { margin: 2.6rem 0 1.5rem; }
#auth-form { display: grid; gap: 1.15rem; }
#link-form, #new-passwords { display: grid; gap: 1rem; }
#new-passwords { margin: 0; padding: 0; border: 0; }
.auth-card .text-button { display: block; }
.auth-card p:not(:empty) { margin-top: .8rem; }
form label, #dialog-label { font-size: .9rem; }
form label input, #dialog-input { margin-top: .35rem; }
.project-types { min-width: 0; border: 0; padding: 0; margin: 0; }
#dialog-form .project-types { margin-top: 1.1rem; }
.project-types legend { padding: 0; font-size: .9rem; }
.project-types label { display: flex; align-items: flex-start; gap: .55rem; margin-top: .65rem; cursor: pointer; }
.project-types input { flex: none; width: auto; margin: .2rem 0 0; }
.project-types span { color: var(--muted); line-height: 1.4; }
.project-types strong { display: block; color: var(--ink); }
.text-button { border: 0; padding: .6rem 0; background: transparent; text-decoration: underline; margin-top: .7rem; }
dialog { color: var(--ink); border: 2px solid var(--charcoal); box-shadow: .25rem .25rem var(--charcoal); }
dialog::backdrop { background: transparent; }
dialog h2 { font: 1.6rem Georgia, serif; margin-bottom: 1rem; }
.dialog-actions { justify-content: flex-end; margin-top: 1.2rem; }
#report-open { align-self: flex-start; grid-column: 1 / -1; justify-self: start; margin-top: .8rem; border-color: transparent; font-weight: 600; }
#report-form textarea { margin: .35rem 0 .65rem; }
#report-chat-label { display: flex; align-items: center; gap: .45rem; margin-bottom: .6rem; }
#report-chat { width: auto; margin: 0; }
#report-error:not(:empty) { margin-top: .65rem; }
#team-warning { overflow-wrap: anywhere; }
#team-schedules label { display: block; margin-top: .8rem; overflow-wrap: anywhere; }
#team-schedules select { margin-top: .3rem; }
#notice { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); width: max-content; max-width: 92%; border: 1px solid var(--white); border-radius: .5rem; padding: .65rem .9rem; background: var(--charcoal); color: var(--white); display: flex; align-items: center; gap: .7rem; z-index: 2; }
#notice-close { color: inherit; outline-color: var(--white); background: transparent; border: 0; font-size: 1.15rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media(max-width: 850px) {
 .layout { grid-template-columns: var(--left-width) minmax(0,1fr); height: auto; }
 .column-divider[data-side=right] { display: none; }
 nav { grid-row: 1 / 3; }
 #chat-view { height: min(75dvh, 48rem); min-height: 24rem; }
 aside { grid-column: 2; border-left: 0; border-top: 1px solid var(--line); }
}
@media(max-width: 580px) {
 header { padding: 0 .85rem; height: 3.65rem; }
 .brand { font-size: 1.12rem; }
 .account span { display: none; }
 .layout { display: block; }
 .column-divider { display: none; }
 nav { padding: .6rem .9rem; border-right: 0; border-bottom: 1px solid var(--line); }
 .section-head { margin: 0; }
 nav, #chat-nav { display: grid; grid-template-columns: 6rem minmax(0,1fr); align-items: center; gap: .6rem; }
 #project-hint { grid-column: 1 / -1; margin: 0; }
 #chat-nav { margin: 0; grid-column: 1 / -1; }
 #chat-list { display: flex; overflow: auto; }
 .chat-row { flex: 0 0 100%; }
 .chat-link { overflow: hidden; text-overflow: ellipsis; }
 #chat-list button { white-space: nowrap; }
 #chat-view { height: 66dvh; }
 .chat-head { padding: .75rem 1rem; }
}


#quota { margin-top: auto; padding-top: 1.25rem; font-size: .8rem; color: var(--muted); }
.quota-heading { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
#quota-percent { color: var(--brand); font-variant-numeric: tabular-nums; }
#quota-bar { display: block; width: 100%; height: .45rem; border: 0; border-radius: 1rem;
  overflow: hidden; appearance: none; background: var(--line); margin: .45rem 0; }
#quota-bar::-webkit-progress-bar { background: var(--line); }
#quota-bar::-webkit-progress-value { background: var(--brand); }
#quota-bar::-moz-progress-bar { background: var(--brand); }
#quota-state { margin-top: .25rem; }
@media (max-width: 580px) {
  #quota { grid-column: 1 / -1; padding-top: .4rem; width: 100%; }
}

.outgoing-mail { padding: .55rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.outgoing-mail summary { cursor: pointer; }
.outgoing-mail .mail-body { white-space: pre-wrap; margin-top: .5rem; color: var(--ink); }
.outgoing-mail .problem { color: inherit; font-weight: 600; }
