:root {
  color-scheme: light;
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
  color: #172c27;
  background: #f4f7f5;
  --ink: #172c27;
  --muted: #4e635b;
  --line: #d8e3dc;
  --green: #16604a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.top {
  background: #fff;
  border-bottom: 1px solid var(--line);
  min-height: 68px;
  padding: .65rem clamp(1rem, 3vw, 1.65rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { font: 700 2rem Georgia, serif; letter-spacing: -.05em; }
.account, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.account { color: var(--muted); font-size: .875rem; }
main { max-width: 1080px; margin: 2.75rem auto; width: calc(100% - 2rem); }
.app-shell:has(.workspace-nav:not([hidden])) {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: calc(100dvh - 68px);
}
.workspace-nav {
  padding: 1.4rem .85rem;
  background: #fff;
  border-right: 1px solid var(--line);
}
.workspace-nav a {
  display: block;
  padding: .62rem .8rem;
  border-radius: .5rem;
  text-decoration: none;
  color: var(--muted);
}
.workspace-nav a + a { margin-top: .25rem; }
.workspace-nav a:hover { background: #f4f7f5; }
.workspace-nav a[aria-current] {
  background: #e5f1eb;
  color: var(--green);
  font-weight: 650;
}
.workspace-nav a:focus-visible, .button-link:focus-visible {
  outline: 3px solid #369a7a;
  outline-offset: 2px;
}
h1, h2, h3, p { margin: 0; }
h1 { font: 500 clamp(1.8rem, 5vw, 3rem)/1.1 Georgia, serif; }
h2 { font-size: 1.26rem; }
.heading, .toolbar, .dialog-head, .fact-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.eyebrow { color: var(--green); font-weight: 650; margin-bottom: .45rem; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; margin: 1.6rem 0; }
.metrics button { text-align: left; padding: 1rem; min-height: 96px; }
.metrics strong { display: block; font-size: 1.55rem; color: var(--green); }
.memory, .owner-panel, .sign-in, dialog { background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.owner-panel { margin-bottom: 1rem; }
#activity-list { margin: 0; padding: 0; list-style: none; max-height: 21rem; overflow: auto; }
#activity-list li { border-top: 1px solid var(--line); padding: .75rem 1.2rem; }
#activity-list li button { margin-left: .55rem; text-decoration: underline; }
#activity-notice { margin: 0 1.2rem .75rem; }
#activity-notice:empty { display: none; }
.toolbar, .fact, #facts > p { padding: 1rem 1.2rem; }
.fact, #facts > p { border-top: 1px solid var(--line); }
.fact-top { align-items: flex-start; }
.fact-title { font-weight: 650; text-align: left; text-decoration: underline; text-underline-offset: .19em; }
.fact-title, .fact-statement { white-space: pre-wrap; overflow-wrap: anywhere; }
.quiet { padding: 0; border: 0; background: transparent; color: var(--green); }
.fact p { overflow-wrap: anywhere; }
.meta, .muted { font-size: .875rem; color: var(--muted); }
.meta { margin-top: .35rem; }
.status {
  padding: .2rem .55rem;
  border-radius: .4rem;
  font-size: .875rem;
  white-space: nowrap;
  background: #e7efeb;
}
.status.pending { background: #fff0d4; color: #664610; }
.status.rejected, .overdue { color: #9c2f29; background: #fceae8; }
.overdue { border-radius: .25rem; padding: 0 .25rem; }
button, input, select, textarea {
  font: inherit;
  color: inherit;
  border: 1px solid #b0c4b9;
  background: #fff;
  border-radius: .5rem;
  padding: .52rem .68rem;
}
button { cursor: pointer; }
button:hover { background: #edf4ef; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #369a7a;
  outline-offset: 2px;
}
.primary { background: var(--green); color: #fff; border-color: var(--green); }
.primary:hover { background: #104c3a; }
.button-link {
  display: inline-block;
  padding: .52rem .68rem;
  border: 1px solid #b0c4b9;
  border-radius: .5rem;
  color: var(--green);
  background: #fff;
}
.button-link:hover { background: #edf4ef; }
.integrations { max-width: 740px; }
.integrations > p { margin-top: .65rem; color: var(--muted); }
.integration-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-top: 1.35rem;
  padding: clamp(1rem, 4vw, 1.4rem);
}
.integration-card header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1rem;
}
.integration-card > p { margin-top: .55rem; }
.integration-card .button-link { margin-top: 1rem; }
#copy-assistant-setup, #show-assistant-setup { margin-top: .75rem; }
#show-assistant-setup summary { cursor: pointer; }
#assistant-setup-message { width: 100%; margin-top: .5rem; resize: vertical; }
#assistant-setup-notice:empty { display: none; }
.assistant-drive { border-top: 1px solid var(--line); margin-top: 1.2rem; padding-top: 1.1rem; }
.assistant-drive h3 { font-size: 1rem; }
.assistant-drive p { margin: .35rem 0 .7rem; color: var(--muted); }
.assistant-drive details, #verify-drive, #disconnect-drive { margin-top: 1rem; }
.assistant-drive h4 { margin: 0; }
.assistant-drive summary { width: fit-content; cursor: pointer; font-weight: 650; }
#drive-start-form { display: grid; gap: .45rem; margin-top: .6rem; }
#drive-start-form button { justify-self: start; }
.drive-copy { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .65rem; }
.drive-copy input { flex: 1 1 12rem; min-width: 0; }
#drive-setup-notice:empty { display: none; }
.drive { max-width: 740px; }
.drive > p, .drive > button { margin-top: 1rem; }
.drive form {
  display: grid;
  gap: .55rem;
  margin-top: 1.2rem;
  padding: clamp(1rem, 4vw, 1.6rem);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.drive h2 { overflow-wrap: anywhere; }
.drive textarea { width: 100%; resize: vertical; }
.drive form button { justify-self: start; }
.danger { color: #9c2f29; }
#filters { display: flex; flex-wrap: wrap; gap: .5rem; }
#topic-filter { max-width: 12rem; }
#category-settings { padding: .6rem 1.2rem; }
#category-form { display: grid; gap: .4rem; max-width: 25rem; margin-top: .5rem; }
#category-form button { justify-self: start; }
.sign-in { padding: clamp(1.15rem, 4vw, 2rem); max-width: 540px; margin: 4rem auto 0; }
.sign-in p { color: var(--muted); margin-top: .8rem; }
.sign-in form, #capture-form { display: grid; gap: .55rem; margin-top: 1rem; }
.sign-in button, #capture-form button { justify-self: start; }
.sign-in .button-link { margin-top: 1rem; }
.organization-list { display: grid; gap: .5rem; margin-top: 1rem; }
.organization-list button { text-align: left; width: 100%; }
.sign-in details { margin-top: 1rem; }
.sign-in summary { cursor: pointer; }
.account button:focus-visible { outline-offset: 4px; }
.notice { margin-top: .8rem; color: #8f2b23; }
.notice:empty { display: none; }
dialog { max-width: 650px; width: calc(100% - 2rem); padding: 1.3rem; max-height: 88vh; color: var(--ink); }
dialog::backdrop { background: #132c25a6; }
dialog .actions, dialog h3, .revision { margin-top: 1rem; }
.revision { border-top: 1px solid var(--line); padding-top: .75rem; overflow-wrap: anywhere; }
.queue-actions { margin-top: .65rem; }
#work-chat { margin-top: 1.4rem; border: 1px solid var(--line); border-radius: .75rem; padding: .85rem; }
#work-chat summary { cursor: pointer; font-weight: 650; }
#work-messages { display: grid; gap: .5rem; max-height: 18rem; overflow: auto; margin: .65rem 0; }
#work-chat-form { display: flex; align-items: stretch; gap: .5rem; }
#work-message { flex: 1; min-width: 0; }
.capture-context { display: grid; gap: .5rem; padding-top: .6rem; }
#capture-context summary { cursor: pointer; }

.chat { max-width: 740px; margin: 0 auto; }
.chat .heading { margin-bottom: clamp(2rem, 8vh, 5rem); }
.chat h1 { margin-bottom: 1.1rem; }
#conversation { display: grid; gap: .75rem; overflow-wrap: anywhere; }
#conversation:not(:empty) { margin-bottom: 1rem; }
.question-message, .answer-message {
  padding: .8rem 1rem;
  border-radius: .75rem;
  background: #fff;
  border: 1px solid var(--line);
}
.question-message { justify-self: end; background: #e5f1eb; max-width: 90%; }
.answer-message { max-width: 100%; }
.answer-message article + article { border-top: 1px solid var(--line); margin-top: .65rem; padding-top: .65rem; }
#chat-form { display: flex; gap: .5rem; }
#question { flex: 1; min-width: 0; min-height: 52px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#memory-panel {
  position: fixed;
  z-index: 2;
  top: 0;
  right: 0;
  width: min(100%, 600px);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 35px #172c271c;
  background: #f4f7f5;
}
.drawer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 1rem 1.25rem;
}
.drawer-body { overflow: auto; padding: 1rem 1.25rem; }
#memory-panel .toolbar { flex-wrap: wrap; }

@media (max-width: 640px) {
  .app-shell:has(.workspace-nav:not([hidden])) { display: block; }
  .workspace-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: .5rem .65rem;
  }
  .workspace-nav a + a { margin-top: 0; }
  main { margin-top: 1.5rem; }
  .heading, .toolbar { align-items: flex-start; flex-direction: column; }
  .metrics { gap: .4rem; }
  .metrics button { padding: .55rem; font-size: .875rem; overflow-wrap: anywhere; }
  #filters input { width: 100%; }
  .fact-top { display: block; }
  .fact-top .status { display: inline-block; margin-top: .4rem; }
  .chat .heading { flex-direction: row; align-items: center; gap: .5rem; }
  .chat .heading button { flex-shrink: 0; }
}
