/* Knowledge dashboard — layout on top of astra.css (Astra design system).
   Colours, type, chamfers and components come from astra.css; this file only places them:
   the rail, the query console, the two-pane library, the health board, the editor drawer. */

:root {
  --rail-w: 248px;
  --top-h: 56px;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  background: var(--void);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
a {
  color: var(--astra-bright);
  text-underline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
code,
kbd {
  font-family: var(--font-mono);
}
kbd {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  color: var(--ink-subtle);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
[hidden],
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip {
  position: absolute;
  left: 8px;
  top: -40px;
  z-index: 50;
  padding: 8px 12px;
  background: var(--astra);
  color: var(--on-astra);
}
.skip:focus {
  top: 8px;
}
.ico {
  display: inline-grid;
  place-items: center;
  flex: none;
}
.ico svg {
  display: block;
}
.as-btn .ico svg {
  width: 16px;
  height: 16px;
}
.as-btn-sm .ico svg {
  width: 14px;
  height: 14px;
}
.as-btn kbd {
  border-color: currentColor;
  color: inherit;
  opacity: 0.75;
}
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink-subtle);
  font-variant-numeric: tabular-nums;
}
.as-panel-body > p + p {
  margin-top: var(--space-2);
}

/* Project identity dot: square, like every Astra status dot. */
.pdot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--c, var(--ink-subtle));
}

/* ===== Boot and login ===== */
.boot,
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--space-4);
  padding: var(--space-6);
  color: var(--ink-muted);
}
.boot p {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
}
.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: var(--space-4);
  padding: var(--space-8);
}
.login-card .as-field {
  min-width: 0;
}
.login-card .as-btn {
  width: 100%;
}
.login-title {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 36px;
  font-weight: 600;
  color: var(--ink);
}
.login-lead {
  color: var(--ink-muted);
  font-size: 15px;
}
.login-foot {
  font-size: 12px;
  color: var(--ink-subtle);
}
.login-error {
  color: var(--danger);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--astra-bright);
}
.brand-word {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}

/* ===== Shell ===== */
.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-6) var(--space-4) var(--space-4);
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
}
.rail .brand {
  padding: 0 var(--space-2);
}
.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rail-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 38px;
  padding: 0 var(--space-3);
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 140ms ease, background-color 140ms ease;
}
.rail-nav a:hover {
  color: var(--ink);
  background: var(--surface-raised);
}
.rail-nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--astra-soft);
  border-left-color: var(--astra-bright);
}
.rail-nav a[aria-current="page"] .ico {
  color: var(--astra-bright);
}
.rail-nav .n,
.rail-nav kbd {
  margin-left: auto;
}
.rail-nav .n {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-subtle);
}
.rail-nav .n.is-warn {
  color: var(--warning);
}
.rail-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 0;
}
.rail-section .as-label-text {
  padding: 0 var(--space-3);
}
.rail-projects {
  list-style: none;
  margin: 0;
  padding: 0;
}
.rail-projects button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 32px;
  padding: 4px var(--space-3);
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.rail-projects button:hover {
  background: var(--surface-raised);
}
.rail-projects button span:nth-child(2) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-projects .mono {
  font-size: 11px;
}
.rail-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}
.rail-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.rail-status .as-core-svg {
  filter: none;
}
.rail-status-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-muted);
}
.rail-status-text b {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
.rail-tools {
  display: flex;
  justify-content: space-between;
}

.main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--top-h);
  padding: 0 var(--space-6);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.menu-btn {
  display: none;
}
.top-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.top-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.top-search {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 32px;
  padding: 0 var(--space-2) 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--ink-subtle);
  font-size: 13px;
  cursor: pointer;
}
.top-search:hover {
  border-color: var(--astra);
  color: var(--ink);
}
.page {
  flex: 1;
  min-height: 0;
  outline: none;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--space-8) var(--space-8);
}
.page-pad {
  padding: var(--space-8) var(--space-8) var(--space-10);
}

/* ===== Consultar: thread + sources ===== */
.consult {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  height: calc(100vh - var(--top-h));
}
.consult-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.thread {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-8) var(--space-8) var(--space-4);
}
.compose {
  padding: 0 var(--space-8) var(--space-6);
}
.as-composer textarea {
  min-height: 24px;
}
.compose-scope {
  height: 24px;
  max-width: 220px;
  padding: 0 var(--space-6) 0 var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface-raised);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
}
.welcome {
  margin: auto 0;
  display: grid;
  justify-items: center;
  gap: var(--space-4);
  padding: var(--space-8) 0;
  text-align: center;
}
.welcome h2 {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 44px;
  font-weight: 600;
  color: var(--ink);
}
.welcome p {
  max-width: 520px;
  color: var(--ink-muted);
}
.suggest {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  max-width: 640px;
}
.suggest button {
  height: 30px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface-raised);
  color: var(--ink-muted);
  font-size: 13px;
  cursor: pointer;
}
.suggest button:hover {
  border-color: var(--astra);
  background: var(--astra-soft);
  color: var(--ink);
}
.as-msg-body .quote {
  margin: var(--space-3) 0;
  padding: var(--space-3) var(--space-4);
  border-left: 2px solid var(--astra);
  background: var(--surface-raised);
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 22px;
}
.as-msg-body .also {
  margin-top: var(--space-2);
  font-size: 14px;
  color: var(--ink-muted);
}
.as-msg-body .warn-line {
  color: var(--warning);
}
.as-msg-body a {
  color: var(--ink);
  text-decoration-color: var(--astra);
}
.consult-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 0;
  padding: var(--space-4);
  border-left: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
}
.sources {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.as-source {
  cursor: pointer;
}
.as-source:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.as-source-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.as-source .flag {
  color: var(--warning);
}
.side-empty {
  padding: var(--space-6) var(--space-2);
  color: var(--ink-subtle);
  font-size: 13px;
  text-align: center;
}
.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.metrics .as-metric {
  min-width: 0;
  padding: var(--space-3);
}
.metrics .as-metric-value {
  font-size: 24px;
  line-height: 28px;
}
.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.recent-list li {
  border-bottom: 1px solid var(--line);
}
.recent-list button {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-1);
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.recent-list button:hover {
  background: var(--surface-raised);
}
.recent-list b {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Memórias: list + reader ===== */
.library {
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  height: calc(100vh - var(--top-h));
}
.lib-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.lib-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  padding: var(--space-4);
  border-bottom: 1px solid var(--line);
}
.lib-filters .as-input-wrap {
  grid-column: 1 / -1;
}
.lib-filters select {
  height: 32px;
  min-width: 0;
  padding: 0 var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 13px;
}
.lib-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--line);
}
.lib-count a {
  font-family: var(--font-mono);
  font-size: 11px;
}
.lib-items {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
}
.lib-items li {
  border-bottom: 1px solid var(--line);
}
.lib-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 0;
  border-left: 2px solid transparent;
  background: none;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.lib-item:hover {
  background: var(--surface-raised);
}
.lib-item[aria-current="true"] {
  border-left-color: var(--astra-bright);
  background: var(--astra-soft);
}
.lib-item b {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}
.lib-item p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-muted);
}
.lib-item .meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.lib-item .meta .mono {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-item.is-faded b,
.lib-item.is-faded p {
  color: var(--ink-subtle);
}
.lib-more {
  padding: var(--space-3) var(--space-4);
}
.lib-more .as-btn {
  width: 100%;
}
.reader {
  min-width: 0;
  overflow-y: auto;
  padding: var(--space-8);
}
.reader-empty {
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--space-3);
  color: var(--ink-subtle);
  text-align: center;
}
.reader-inner {
  max-width: 820px;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.reader-back {
  display: none;
}
.reader-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.reader-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.reader-head h2 {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 36px;
  font-weight: 600;
  color: var(--ink);
}
.reader-summary {
  font-size: 16px;
  line-height: 26px;
  color: var(--ink-muted);
}
.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.reader-notice {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--warning);
  background: var(--warning-soft);
  color: var(--ink);
  font-size: 14px;
}
.reader-notice .ico {
  color: var(--warning);
  margin-top: 3px;
}
.reader-notice.is-info {
  border-color: var(--astra);
  background: var(--astra-soft);
}
.reader-notice.is-info .ico {
  color: var(--astra-bright);
}
.reader-content {
  font-size: 15px;
  line-height: 26px;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.reader-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
}
.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-4);
  margin: 0;
  font-size: 13px;
}
.facts dt {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.facts dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.links-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.links-list li + li {
  border-top: 1px dashed var(--line);
}
.links-list button {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 40px;
  padding: var(--space-2) 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.links-list button:hover b {
  color: var(--astra-bright);
}
.links-list b {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ===== Saúde ===== */
.health {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.health-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
}
.health-metrics .as-metric {
  min-width: 0;
}
.health-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: var(--space-6);
  align-items: start;
}
.health-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.queue-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.queue-tools .as-tabs {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}
.queue-tools select {
  height: 32px;
  padding: 0 var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 13px;
}
.queue {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.issue {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--line);
  background: var(--surface-raised);
}
.issue-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.issue-titles {
  font-size: 14px;
  font-weight: 600;
}
.issue-titles button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--astra);
  text-underline-offset: 3px;
  cursor: pointer;
}
.issue-msg,
.issue-fix {
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-muted);
}
.issue-fix b {
  color: var(--ink);
  font-weight: 600;
}
.issue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}
.state-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.state-row:last-child {
  border-bottom: 0;
}
.state-row span:first-child {
  color: var(--ink-muted);
}
.log {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  font-size: 13px;
  line-height: 20px;
}
.log li {
  padding: 4px 0 4px var(--space-3);
  border-left: 1px solid var(--line-strong);
  color: var(--ink-muted);
}
.log li.is-bad {
  border-left-color: var(--warning);
  color: var(--ink);
}
.panel-note {
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-muted);
}
.panel-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}


/* ===== Editor drawer ===== */
.drawer-back,
.palette-back {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgb(4 7 13 / 0.66);
}
.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(620px, 100%);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: drawer-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes drawer-in {
  from {
    transform: translateX(32px);
    opacity: 0;
  }
}
.drawer-head,
.drawer-foot {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: 0 var(--space-4) 0 var(--space-6);
  border-bottom: 1px solid var(--line);
}
.drawer-head .as-panel-meta {
  margin-left: auto;
}
.drawer-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  padding: var(--space-3) var(--space-6);
}
.drawer-error {
  flex: 1;
  color: var(--danger);
  font-size: 13px;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  gap: var(--space-4);
  padding: var(--space-6);
}
.drawer-body .as-field {
  min-width: 0;
}
.drawer-body .full {
  grid-column: 1 / -1;
}
.field-select,
.field-area {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--ink);
}
.field-select {
  height: 40px;
  padding: 0 var(--space-3);
}
.field-area {
  min-height: 260px;
  padding: var(--space-3);
  resize: vertical;
  font-size: 14px;
  line-height: 22px;
}
.field-area.is-code {
  min-height: 90px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.field-select:focus,
.field-area:focus {
  outline: none;
  border-color: var(--astra);
  box-shadow: var(--glow-sm);
}
[aria-invalid="true"] {
  border-color: var(--danger) !important;
}
.type-pick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}
.type-pick label {
  display: grid;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line-strong);
  background: var(--surface-raised);
  cursor: pointer;
}
.type-pick input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.type-pick b {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.type-pick small {
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-muted);
}
.type-pick label:has(input:checked) {
  border-color: var(--astra);
  background: var(--astra-soft);
}
.type-pick label:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.range-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.range-row input {
  flex: 1;
  accent-color: var(--astra);
}
.range-row output {
  min-width: 36px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
}
details.advanced summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
details.advanced[open] summary {
  margin-bottom: var(--space-3);
}

/* ===== Palette and toast ===== */
.palette {
  position: absolute;
  top: 12vh;
  left: 50%;
  width: min(620px, calc(100% - 32px));
  transform: translateX(-50%);
  box-shadow: var(--shadow-lg);
}
.palette-input {
  height: 48px;
  margin: var(--space-3);
}
.palette-list {
  list-style: none;
  margin: 0;
  padding: 0 0 var(--space-2);
  max-height: 50vh;
  overflow-y: auto;
}
.palette-list li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 40px;
  padding: 0 var(--space-4);
  font-size: 14px;
  cursor: pointer;
}
.palette-list li small {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-subtle);
}
.palette-list li[aria-selected="true"] {
  background: var(--astra-soft);
  box-shadow: inset 2px 0 0 var(--astra-bright);
}
.palette-list .group {
  min-height: 28px;
  cursor: default;
}
.toast {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: min(460px, calc(100% - 32px));
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line-strong);
  background: var(--surface-overlay);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
}
.toast.is-error {
  border-color: var(--danger);
}
.toast .ico {
  color: var(--astra-bright);
}
.toast.is-error .ico {
  color: var(--danger);
}

/* ===== Responsive ===== */
@media (max-width: 1180px) {
  .consult {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  .health-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .rail {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(300px, 86vw);
    transform: translateX(-100%);
    transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .rail.is-open {
    transform: none;
    box-shadow: var(--shadow-lg);
  }
  .menu-btn {
    display: inline-flex;
  }
  .topbar {
    padding: 0 var(--space-4);
  }
  .top-meta,
  .top-search span:not(.ico),
  .top-search kbd {
    display: none;
  }
  .consult,
  .library {
    grid-template-columns: 1fr;
    height: auto;
  }
  .thread {
    padding: var(--space-6) var(--space-4) var(--space-4);
    overflow: visible;
  }
  .compose {
    position: sticky;
    bottom: 0;
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .consult-side {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .welcome h2 {
    font-size: 28px;
    line-height: 34px;
  }
  .library.has-reader .lib-list {
    display: none;
  }
  .library:not(.has-reader) .reader {
    display: none;
  }
  .lib-list {
    border-right: 0;
  }
  .reader {
    padding: var(--space-4);
  }
  .reader-back {
    display: inline-flex;
    align-self: flex-start;
  }
  .reader-grid,
  .health-metrics {
    grid-template-columns: 1fr 1fr;
  }
  .page-pad {
    padding: var(--space-4) var(--space-4) var(--space-8);
  }
  .drawer-body {
    grid-template-columns: 1fr;
    padding: var(--space-4);
  }
  .type-pick {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 560px) {
  .reader-grid {
    grid-template-columns: 1fr;
  }
  .top-actions .as-btn-label {
    display: none;
  }
  .drawer-foot {
    flex-wrap: wrap;
    padding: var(--space-3) var(--space-4);
  }
}
@media (prefers-reduced-motion: reduce) {
  .drawer,
  .rail {
    animation: none;
    transition: none;
  }
}

/* ===================================================================================
   Forma arredondada (21/10/2026). The owner asked for rounded corners and a more refined
   finish: the Astra palette stays, but its square forms are replaced (no chamfers, corner
   brackets or HUD grid; soft radii, layered surfaces and sentence-case labels).
   =================================================================================== */
:root {
  --font-display: var(--font-sans);
  --radius-xs: 6px;
  --radius-sm: 10px;
  --r-card: 16px;
  --r-panel: 20px;
  --edge-light: rgb(255 255 255 / 0.05);
  --lift: 0 1px 0 var(--edge-light) inset, 0 18px 40px -24px rgb(0 0 0 / 0.85);
  --lift-soft: 0 1px 0 var(--edge-light) inset, 0 8px 24px -18px rgb(0 0 0 / 0.8);
}
:root[data-theme="dia"] {
  --edge-light: rgb(255 255 255 / 0.9);
  --lift: 0 1px 2px rgb(8 20 42 / 0.05), 0 18px 40px -26px rgb(8 20 42 / 0.28);
  --lift-soft: 0 1px 2px rgb(8 20 42 / 0.05), 0 8px 22px -18px rgb(8 20 42 / 0.25);
}
body {
  background:
    radial-gradient(1100px 520px at 75% -10%, rgb(47 143 255 / 0.13), transparent 70%),
    radial-gradient(700px 420px at -5% 0%, rgb(124 200 255 / 0.06), transparent 70%),
    var(--void);
  background-attachment: fixed;
}
:root[data-theme="dia"] body {
  background:
    radial-gradient(1100px 520px at 75% -10%, rgb(11 95 214 / 0.09), transparent 70%),
    var(--surface);
  background-attachment: fixed;
}
.page,
.as-hud,
.boot,
.login {
  background-image: none;
}
.as-corner {
  display: none;
}

/* Labels: sentence case, quiet. */
.as-label-text,
.as-field-label,
.as-metric-label,
.as-panel-title,
.as-tab,
.as-btn,
.as-badge,
.as-msg-name,
.as-core-label,
.as-source-kind,
.as-composer-scope-label,
.as-rel-label,
.facts dt,
.type-pick b,
details.advanced summary,
.rail-status-text b {
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-family: var(--font-sans) !important;
}
.as-label-text,
.as-field-label,
.as-metric-label,
.facts dt {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
}
h1,
h2,
.top-title,
.welcome h2,
.reader-head h2,
.login-title,
.brand-word {
  letter-spacing: -0.02em;
}
.welcome h2 {
  font-size: 40px;
  line-height: 46px;
  font-weight: 600;
}

/* Buttons: rounded, no chamfer. */
.as-btn {
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
}
.as-btn::before,
.as-btn::after {
  clip-path: none !important;
  border-radius: inherit;
}
.as-btn::after {
  border-radius: calc(var(--radius-sm) - 1px);
}
.as-btn-primary::after {
  background: linear-gradient(180deg, color-mix(in srgb, var(--astra) 84%, white), var(--astra));
}
.as-btn-primary:hover:not(:disabled) {
  filter: drop-shadow(0 6px 14px var(--astra-glow));
}
.as-btn-sm {
  font-size: 12.5px;
}
.as-btn-lg {
  border-radius: 12px;
  font-size: 14px;
}

/* Cards and panels. */
.as-panel {
  border-radius: var(--r-panel);
  border-color: var(--line);
  background: linear-gradient(180deg, var(--surface-raised), color-mix(in srgb, var(--surface-raised) 70%, var(--surface)));
  box-shadow: var(--lift);
}
.as-panel-head {
  min-height: 52px;
  padding: 0 var(--space-5);
  border-bottom-color: color-mix(in srgb, var(--line) 70%, transparent);
}
.as-panel-body {
  padding: var(--space-5);
}
.as-panel-title {
  font-size: 14px;
  font-weight: 600;
}
.as-panel-title::before {
  border-radius: 50%;
  width: 7px;
  height: 7px;
}
.as-metric,
.metrics .as-metric,
.health-metrics .as-metric {
  border-radius: var(--r-card);
  background: linear-gradient(180deg, var(--surface-raised), color-mix(in srgb, var(--surface-raised) 70%, var(--surface)));
  box-shadow: var(--lift-soft);
}
.as-metric-value {
  font-weight: 600;
  letter-spacing: -0.02em;
}
.as-source,
.issue {
  border-radius: var(--r-card);
  box-shadow: var(--lift-soft);
}
.as-source.is-active {
  box-shadow: 0 0 0 1px var(--astra), 0 10px 30px -16px var(--astra-glow);
}
.as-badge {
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
}
.as-badge-dot,
.pdot {
  border-radius: 50%;
}
.as-source-kind,
kbd {
  border-radius: 6px;
}
.as-cite {
  clip-path: none;
  border-radius: 6px;
}
.as-msg-avatar {
  clip-path: none;
  border-radius: 10px;
}
.as-msg-bubble {
  border-radius: 18px 18px 6px 18px;
  background: var(--astra-soft);
  border-color: color-mix(in srgb, var(--astra) 35%, transparent);
}
.as-msg-body .quote {
  border-left: 0;
  border-radius: 14px;
  box-shadow: inset 3px 0 0 var(--astra);
}
.as-hl {
  border-radius: 4px;
}
.as-rel-seg {
  border-radius: 2px;
}
.as-trace-node {
  border-radius: 50%;
}

/* Tabs as a segmented control. */
.as-tabs {
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--void) 60%, var(--surface));
}
.as-tab {
  height: 32px;
  border-radius: 9px;
  font-size: 13px;
}
.as-tab[aria-selected="true"] {
  background: var(--surface-overlay);
  box-shadow: var(--lift-soft);
}
.as-tab[aria-selected="true"]::after {
  display: none;
}

/* Fields. */
.as-input-wrap,
.lib-filters select,
.queue-tools select,
.field-select,
.field-area,
.top-search {
  border-radius: var(--radius-sm);
}
.compose-scope {
  border-radius: 999px;
  padding: 0 var(--space-6) 0 var(--space-3);
}
.as-composer {
  border-radius: 20px;
  padding: var(--space-4) var(--space-4) var(--space-3) var(--space-5);
  background: var(--surface-raised);
  box-shadow: var(--lift);
}
.as-composer:focus-within {
  box-shadow: 0 0 0 1px var(--astra), 0 14px 40px -20px var(--astra-glow);
}
.suggest button {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
}
.type-pick label {
  border-radius: 12px;
}

/* Shell. */
.rail {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(12px);
  border-right-color: color-mix(in srgb, var(--line) 70%, transparent);
}
.rail-nav a {
  height: 40px;
  border-left: 0;
  border-radius: 10px;
}
.rail-nav a[aria-current="page"] {
  background: var(--astra-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--astra) 30%, transparent);
}
.rail-projects button,
.recent-list button,
.links-list button,
.palette-list li {
  border-radius: 10px;
}
.rail-foot {
  border-top: 0;
  padding: var(--space-3);
  border-radius: var(--r-card);
  background: var(--surface-raised);
  box-shadow: var(--lift-soft);
}
.topbar {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(14px);
  border-bottom-color: color-mix(in srgb, var(--line) 70%, transparent);
}
.top-title {
  font-size: 18px;
}
.consult-side,
.lib-list {
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.consult-side {
  border-left-color: color-mix(in srgb, var(--line) 70%, transparent);
}
.lib-list {
  border-right-color: color-mix(in srgb, var(--line) 70%, transparent);
}
.lib-items {
  padding: var(--space-2);
}
.lib-items li {
  border-bottom: 0;
}
.lib-item {
  border-left: 0;
  border-radius: 14px;
}
.lib-item[aria-current="true"] {
  background: var(--astra-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--astra) 35%, transparent);
}
.lib-count,
.lib-filters {
  border-bottom-color: color-mix(in srgb, var(--line) 70%, transparent);
}
.reader-notice {
  border-radius: 14px;
}
.recent-list,
.recent-list li {
  border: 0;
}

/* Floating layers. */
.drawer {
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(620px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
}
.drawer-back,
.palette-back {
  background: rgb(4 7 13 / 0.55);
  backdrop-filter: blur(4px);
}
.palette {
  border-radius: 20px;
  overflow: hidden;
}
.toast {
  border-radius: 14px;
}
.login-card {
  border-radius: 24px;
}

@media (max-width: 900px) {
  .drawer {
    inset: 0;
    width: 100%;
    border-radius: 0;
  }
  .rail {
    background: var(--surface);
  }
}

/* ===================================================================================
   Neutros (21/10/2026). "Está muito azul": surfaces are neutral graphite (dark) and neutral
   white (light); blue is kept only for the primary action, focus, links and selection.
   Contrast checked: ink ≥ 14:1, muted ≥ 6.7:1, subtle ≥ 4.6:1 on every surface; white on the
   primary fill ≥ 5:1.
   =================================================================================== */
:root {
  --void: #0b0b0d;
  --surface: #111214;
  --surface-raised: #17181b;
  --surface-overlay: #1d1f23;
  --line: #26282d;
  --line-strong: #3d4048;
  --ink: #ededf0;
  --ink-muted: #a3a5ad;
  --ink-subtle: #868892;
  --astra: #2563eb;
  --astra-hover: #1e56d6;
  --astra-bright: #7cb8ff;
  --astra-soft: #13161d;
  --astra-glow: #2563eb40;
  --on-astra: #ffffff;
  --focus: #7cb8ff;
  --grid: transparent;
  --edge-light: rgb(255 255 255 / 0.04);
  --glow-sm: 0 0 0 1px #2563eb66;
}
:root[data-theme="dia"] {
  --void: #f4f4f5;
  --surface: #fafafa;
  --surface-raised: #ffffff;
  --surface-overlay: #ffffff;
  --line: #e4e4e7;
  --line-strong: #c4c4cc;
  --ink: #0c0c0f;
  --ink-muted: #4a4b53;
  --ink-subtle: #62636c;
  --astra: #0b5fd6;
  --astra-hover: #0a4fb5;
  --astra-bright: #0b5fd6;
  --astra-soft: #eef3fc;
  --astra-glow: #0b5fd633;
  --on-astra: #ffffff;
  --focus: #0b5fd6;
  --glow-sm: 0 0 0 1px #0b5fd64d;
}
body,
:root[data-theme="dia"] body {
  background: var(--void);
}
/* Selection and active states are neutral surfaces with a thin blue cue, not blue fills. */
.rail-nav a[aria-current="page"] {
  background: var(--surface-overlay);
  box-shadow: inset 0 0 0 1px var(--line);
}
.rail-nav a[aria-current="page"] .ico {
  color: var(--astra-bright);
}
.lib-item[aria-current="true"] {
  background: var(--surface-overlay);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.as-msg-bubble {
  background: var(--surface-overlay);
  border-color: var(--line);
}
.as-msg-avatar {
  background: var(--surface-overlay);
  color: var(--astra-bright);
  box-shadow: inset 0 0 0 1px var(--line);
}
.as-msg-name {
  color: var(--ink) !important;
}
.as-panel-title::before {
  background: var(--ink-subtle);
  box-shadow: none;
}
.as-badge-astra {
  border-color: var(--line-strong);
  background: var(--surface-overlay);
  color: var(--ink);
}
.as-cite {
  background: var(--surface-overlay);
  color: var(--ink-muted);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
button.as-cite:hover,
.as-cite.is-active {
  background: var(--astra);
  color: var(--on-astra);
  box-shadow: none;
}
.as-hl {
  background: color-mix(in srgb, var(--astra) 22%, transparent);
  box-shadow: none;
}
.as-msg-body .quote {
  box-shadow: inset 2px 0 0 var(--line-strong);
}
.as-source.is-active {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 1px var(--astra);
}
.as-rel.is-high .as-rel-seg.is-on,
.as-rel-seg.is-on {
  background: var(--ink-muted);
  box-shadow: none;
}
.as-rel.is-high .as-rel-seg.is-on {
  background: var(--astra-bright);
}
.as-core-svg {
  filter: none;
}
.as-core-ring1,
.as-core-heart {
  stroke: var(--line-strong);
}
.as-core-heart {
  fill: var(--surface-overlay);
}
.as-composer:focus-within {
  box-shadow: 0 0 0 1px var(--astra), var(--lift);
}
.as-tab[aria-selected="true"] .as-tab-count {
  color: var(--ink);
}
.as-trace-step.is-done .as-trace-node {
  background: var(--ink-muted);
  border-color: var(--ink-muted);
  color: var(--surface);
}
.as-trace-step.is-done::before {
  background: var(--line-strong);
}
.type-pick label:has(input:checked) {
  border-color: var(--astra);
  background: var(--surface-overlay);
  box-shadow: 0 0 0 1px var(--astra);
}
.as-btn-primary::after {
  background: var(--astra);
}
.as-btn-primary:hover:not(:disabled)::after {
  background: var(--astra-hover);
}
.as-btn-primary:hover:not(:disabled) {
  filter: none;
}
.as-btn-secondary:hover:not(:disabled),
.as-btn-ghost:hover:not(:disabled) {
  --edge: var(--line-strong);
  --fill: var(--surface-overlay);
}
/* Blur behind layers is costly to paint and adds little: solid surfaces instead. */
.rail,
.topbar,
.drawer-back,
.palette-back {
  backdrop-filter: none;
}
.rail,
.topbar {
  background: var(--surface);
}
.consult-side,
.lib-list {
  background: var(--surface);
}
.drawer-back,
.palette-back {
  background: rgb(0 0 0 / 0.6);
}
:root[data-theme="dia"] .drawer-back,
:root[data-theme="dia"] .palette-back {
  background: rgb(12 12 15 / 0.35);
}
.reader-notice.is-info {
  border-color: var(--line-strong);
  background: var(--surface-overlay);
}
.reader-notice.is-info .ico {
  color: var(--ink-muted);
}
.reader-notice {
  border-color: color-mix(in srgb, var(--warning) 55%, var(--line));
  background: color-mix(in srgb, var(--warning) 8%, var(--surface-raised));
}
.facts {
  gap: 10px 16px;
}
.as-input:focus-visible,
.as-composer-input:focus-visible {
  outline: none;
}

