:root {
  font: 16px/1.55 system-ui, sans-serif;
  color: #292821;
  background: #f5f4f0;
  --muted: #55544d;
  --line: #deddd5;
  --accent: #203878;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: .15em; }
button, input, textarea { font: inherit; }
button, .button {
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: .48rem .8rem;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 650;
  text-decoration: none;
}
button:disabled { opacity: .62; cursor: default; }
.secondary { background: white; color: var(--accent); border-color: var(--line); }
button:hover:not(:disabled), .button:hover { filter: brightness(.94); }
:focus-visible { outline: 3px solid #216497; outline-offset: 3px; }
input, textarea { width: 100%; border: 1px solid #aaa99b; background: white; border-radius: 8px; padding: .55rem .7rem; color: inherit; }
label { display: grid; gap: .35rem; font-weight: 650; font-size: .875rem; }
h1, h2, h3 { line-height: 1.2; }
h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.75rem); letter-spacing: -.045em; }
h2 { font-size: 1.25rem; }
.muted, small { color: var(--muted); }
.error { color: #963331; }
.preserve { white-space: pre-wrap; overflow-wrap: anywhere; }
.top {
  min-height: 68px;
  padding: .8rem clamp(1rem, 3vw, 2.4rem);
  background: #ffffff;
  color: #2e2714;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
}
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: inherit; font-size: 1.2rem; font-weight: 750; }
.brand img { display: block; width: 116px; height: auto; }
.brand small { color: #55544d; font-weight: 500; margin-left: .35rem; padding-left: .85rem; border-left: 1px solid var(--line); }
.account { display: flex; align-items: center; gap: .75rem; font-size: .875rem; }
.workspace { display: grid; grid-template-columns: 220px minmax(0, 1fr) minmax(320px, 27vw); min-height: calc(100dvh - 68px); }
nav { background: #efeee8; padding: 1.7rem .85rem; border-right: 1px solid var(--line); }
.nav-label { padding: 0 .65rem .45rem; font-size: .875rem; font-weight: 750; color: var(--muted); }
.notes-label { margin-top: 1.8rem; }
nav a { display: block; padding: .55rem .65rem; border-radius: 8px; color: inherit; text-decoration: none; font-size: .94rem; }
nav a:hover, nav a[aria-current] { background: #e5ebf8; color: #203878; }
nav a[aria-current] { font-weight: 750; }
.content { padding: clamp(1.1rem, 3vw, 2.75rem); min-width: 0; overflow-wrap: anywhere; }
.breadcrumb { font-size: .875rem; font-weight: 650; color: var(--muted); margin-bottom: .6rem; }
.page-header { display: flex; align-items: flex-start; flex-wrap: wrap; gap: .85rem; justify-content: space-between; margin-bottom: 1.6rem; }
.page-header p { margin: .5rem 0 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(215px, 100%), 1fr)); gap: .85rem; margin: 1.25rem 0; }
.tile, .note, details, .empty, .intro { padding: 1rem; border: 1px solid var(--line); background: white; border-radius: 12px; }
.tile { color: inherit; text-decoration: none; }
.tile:hover { border-color: var(--accent); }
.tile strong, .tile span { display: block; }
.tile span { color: var(--muted); margin-top: .3rem; font-size: .9rem; }
summary { cursor: pointer; font-weight: 650; }
.note { margin-bottom: .8rem; }
.note h2 { margin: .4rem 0; }
.table-wrap { overflow: auto; }
table { width: 100%; background: white; border-collapse: collapse; font-size: .875rem; }
th, td { padding: .6rem; border: 1px solid var(--line); text-align: left; vertical-align: top; min-width: 105px; }
th { background: #efeee8; }
.files { list-style: none; margin: 1rem 0; padding: 0; }
.files li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.chat { background: white; border-left: 1px solid var(--line); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; position: sticky; top: 0; height: calc(100dvh - 68px); min-width: 0; }
.chat-head { display: grid; grid-template-columns: 1fr auto; padding: 1rem; border-bottom: 1px solid var(--line); }
.chat-head h2, .chat-head p { margin: 0; }
.chat-head p { color: var(--muted); grid-row: 2; font-size: .875rem; }
.chat-head button { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.messages { overflow: auto; padding: 1rem; background: #f9f8f5; overflow-wrap: anywhere; }
.intro p { color: var(--muted); margin: .35rem 0 .75rem; }
.suggestion { display: block; text-align: left; background: #eef2fa; border-color: #e5ebf8; color: #203878; margin-top: .45rem; }
.bubble { padding: .75rem; border-radius: 10px; margin: 0 0 .7rem; }
.user { background: #e5ebf8; margin-left: 1.4rem; white-space: pre-wrap; }
.answer { border: 1px solid var(--line); background: white; }
.answer p { margin: .4rem 0 .75rem; }
.citations { padding-left: 1.4rem; font-size: .875rem; overflow-wrap: anywhere; }
.chat-form { border-top: 1px solid var(--line); padding: .85rem 1rem; display: grid; gap: .4rem; }
.chat-form button { justify-self: end; }
.chat-form small { font-size: .8rem; }
textarea { resize: vertical; max-height: 25vh; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(ellipse at 12% 0%, #e6ecf9, #f5f4f0 60%); }
.login-card { width: min(410px, 100%); background: white; border: 1px solid var(--line); border-radius: 16px; padding: clamp(1.25rem, 5vw, 2.3rem); box-shadow: 0 16px 55px #2e271418; }
.login .brand { margin-bottom: 1.25rem; }
.login form { display: grid; gap: .95rem; margin-top: 1.4rem; }
@media (max-width: 1100px) { .workspace { grid-template-columns: 175px minmax(0, 1fr) 310px; } }
@media (max-width: 820px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  nav { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem; padding: .6rem 1rem; border-right: 0; }
  .nav-label { padding: .3rem; }
  .notes-label { display: none; }
  .chat { position: static; height: 600px; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 520px) { .brand small { display: none; } }
