/* Parte logada: lista de projetos e editor. Tema escuro por padrão, claro por data-theme="light". */
/* Cores e fontes seguem o nevext.com.br (tema escuro e claro). */
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400..700&family=Geist+Mono:wght@400..700&display=swap");
:root {
  --bg: #0a0c10;
  --surface: #12151c;
  --raised: #1a1f2a;
  --line: #232733;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --brand: #1c70e3;
  --brand-strong: #1559b8;
  --brand-soft: rgb(59 130 246 / 0.28);
  --danger: #e5484d;
  --warn: #f5a524;
  --link: #93c5fd;
  --code-bg: #ffffff;
  --code-text: #111827;
  --code-gutter: #6b7280;
  --code-size: 14px;
  --panel-w: 280px;
  --pdf-share: 0.42;
  --font: "Geist", "Noto Sans", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", "Cascadia Code", Consolas, "DejaVu Sans Mono", "Courier New", monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f8f9fc;
  --surface: #ffffff;
  --raised: #eef1f6;
  --line: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --brand-soft: rgb(37 99 235 / 0.14);
  --link: #2563eb;
  color-scheme: light;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
}
a {
  color: var(--link);
}
:focus-visible {
  outline: 2px solid #7fb8ff;
  outline-offset: 1px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
}
.skip-link:focus {
  top: 12px;
}
.spacer {
  flex: 1;
}
.muted {
  color: var(--muted);
}
.pad {
  margin: 0;
  padding: 8px 14px;
}

/* ---------- controles ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 16px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-strong);
}
.btn-outline {
  border-color: var(--muted);
}
.btn-outline:hover {
  background: var(--raised);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.icon-btn:hover:not(:disabled),
.top-btn:hover,
.menu-btn:hover {
  background: rgb(127 140 160 / 0.22);
}
.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.text-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}
.chip {
  display: inline-block;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--raised);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.badge {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--warn);
  color: #111827;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.badge.error {
  background: var(--danger);
  color: #fff;
}

/* ---------- menu, janela, aviso ---------- */
.menu-pop {
  position: fixed;
  z-index: 200;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  max-height: min(70vh, 520px);
  padding: 6px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.4);
}
.menu-pop hr {
  width: 100%;
  margin: 4px 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.menu-heading {
  padding: 6px 10px 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover:not(:disabled),
.menu-item:focus-visible {
  background: var(--raised);
}
.menu-item:disabled {
  color: var(--muted);
  cursor: default;
}
.menu-item.danger {
  color: var(--danger);
}
.menu-item kbd {
  margin-left: auto;
  padding-left: 16px;
  color: var(--muted);
  font: 12px var(--font);
}
.menu-check {
  width: 14px;
  color: var(--brand);
  font-weight: 700;
}
.dialog {
  width: min(480px, 100% - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}
.dialog.wide {
  width: min(680px, 100% - 32px);
}
.dialog::backdrop {
  background: rgb(0 0 0 / 0.5);
}
.dialog header,
.dialog footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
}
.dialog header {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.dialog h2 {
  margin: 0;
  font-size: 18px;
}
.dialog-body {
  padding: 18px;
}
.dialog-body p {
  margin: 0;
}
.dialog footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}
.settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings h3 {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.keys {
  width: 100%;
  border-collapse: collapse;
}
.keys th,
.keys td {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.keys th {
  padding-right: 16px;
  font: 600 13px var(--mono);
  white-space: nowrap;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 300;
  max-width: min(520px, 100% - 32px);
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  transform: translateX(-50%);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
}
.missing {
  max-width: 520px;
  margin: 120px auto;
  padding: 0 20px;
  text-align: center;
}

/* ---------- lista de projetos ---------- */
.dash {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
}
.dash-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100vh;
  padding: 24px 12px 16px;
  overflow-y: auto;
  position: sticky;
  top: 0;
}
.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 24px;
  color: var(--text);
  font-size: 26px;
  font-weight: 700;
  text-decoration: none;
}
.dash-side hr {
  margin: 12px 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.filters {
  margin: 0;
  padding: 0;
  list-style: none;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px 8px 44px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.side-link:hover {
  background: var(--raised);
}
.side-link.strong,
.side-bottom .side-link,
.tag-row .side-link {
  padding-left: 12px;
  font-weight: 600;
}
.side-link.active {
  background: var(--brand-strong);
  color: #fff;
}
.side-heading {
  margin: 4px 12px 4px 44px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}
.tag-row {
  display: flex;
  align-items: center;
}
.tag-row .side-link {
  padding-left: 44px;
  font-weight: 400;
}
.side-bottom {
  margin-top: auto;
}
.dash-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.dash-top {
  display: flex;
  justify-content: flex-end;
  gap: 28px;
  padding: 22px 28px;
}
.dash-top a {
  color: var(--text);
  text-decoration: none;
}
.dash-top a:hover {
  text-decoration: underline;
}
.dash-card {
  flex: 1;
  padding: 24px;
  border-radius: 16px 0 0 0;
  background: var(--surface);
}
.notice {
  margin: 0 0 20px;
  padding: 12px 16px;
  border: 1px solid #3a67a8;
  border-radius: 6px;
  background: rgb(58 103 168 / 0.22);
}
.dash-head h1 {
  margin: 0 0 16px;
  font-size: 24px;
}
.dash-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.search-field {
  flex: 1;
  max-width: 900px;
}
.search-field input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--muted);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.bulk .btn {
  padding: 3px 14px;
}
.projects {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg);
  border-radius: 6px;
}
.projects th,
.projects td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.projects tbody tr:hover {
  background: var(--raised);
}
.projects td a {
  color: var(--text);
  text-decoration: none;
}
.projects td a:hover {
  text-decoration: underline;
}
.col-check {
  width: 44px;
}
.col-owner {
  width: 16%;
}
.col-date {
  width: 24%;
}
.col-actions {
  width: 190px;
  text-align: right !important;
  white-space: nowrap;
}
.sort {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.sort[data-dir="asc"]::after {
  content: " ↑";
}
.sort[data-dir="desc"]::after {
  content: " ↓";
}
.empty {
  margin: 48px 0;
  color: var(--muted);
  text-align: center;
}
.count {
  margin: 16px 0 0;
  color: var(--muted);
  text-align: center;
}

/* ---------- editor ---------- */
.ide {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.ide-top {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 8px;
}
.ide-home {
  display: inline-flex;
  padding: 4px;
  color: var(--brand);
}
.menubar {
  display: flex;
}
.menu-btn,
.top-btn,
.title-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.title-btn {
  max-width: 34vw;
  overflow: hidden;
  white-space: nowrap;
}
.save-status {
  min-width: 70px;
  color: var(--muted);
  font-size: 13px;
}
.ide-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.ide-rail {
  display: flex;
  flex: none;
  flex-direction: column;
  width: 40px;
  padding: 4px 0;
}
.ide-rail [role="tablist"],
.rail-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.rail-bottom {
  margin-top: auto;
}
.rail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  cursor: pointer;
}
.rail-btn:hover {
  background: var(--raised);
}
.rail-btn[aria-selected="true"] {
  background: var(--brand-strong);
  color: #fff;
}
.ide-panel {
  flex: none;
  width: var(--panel-w);
  overflow-y: auto;
  background: var(--bg);
}
.panel-closed .ide-panel,
.panel-closed [data-split="panel"] {
  display: none;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 6px 6px 14px;
}
.panel-head.sub {
  margin-top: 8px;
  border-top: 4px solid var(--surface);
}
.panel-head h2 {
  flex: 1;
  margin: 0;
  font-size: 15px;
}
.tree,
.tree ul,
.outline,
.hits,
.cards-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.tree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding-right: 4px;
  border-radius: 6px;
  margin: 0 4px;
  cursor: pointer;
}
.tree-row:hover {
  background: var(--raised);
}
.tree-row.active {
  background: var(--brand-strong);
  color: #fff;
}
.tree-row .icon-btn {
  visibility: hidden;
}
.tree-row:hover .icon-btn,
.tree-row.active .icon-btn,
.tree-row .icon-btn:focus-visible {
  visibility: visible;
}
.tree-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.outline-item {
  display: block;
  width: 100%;
  padding: 6px 12px;
  overflow: hidden;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.outline-item:hover {
  background: var(--raised);
}
.hits button {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.hits button:hover {
  background: var(--raised);
}
.hits span {
  color: var(--muted);
  font: 12px var(--mono);
  word-break: break-all;
}
.cards-list li {
  display: flex;
  flex-direction: column;
  margin: 8px 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
}
.cards-list strong {
  color: var(--text);
}
.splitter {
  flex: none;
  width: 8px;
  background: var(--bg);
  cursor: col-resize;
  touch-action: none;
}
.splitter:hover,
.splitter:focus-visible {
  background: var(--line);
}
.resizing iframe {
  pointer-events: none;
}
.ide-editor,
.ide-pdf {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ide-editor {
  flex: 1;
}
.ide-pdf {
  flex: none;
  width: calc(var(--pdf-share) * 100%);
}
[data-layout="editor"] .ide-pdf,
[data-layout="editor"] [data-split="pdf"],
[data-layout="pdf"] .ide-editor,
[data-layout="pdf"] [data-split="pdf"] {
  display: none;
}
[data-layout="pdf"] .ide-pdf {
  flex: 1;
}
.file-tabs {
  display: flex;
  flex: none;
  height: 34px;
}
.file-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  font-weight: 600;
}
.toolbar,
.pdf-bar,
.find {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
  min-height: 38px;
  padding: 4px 8px;
  background: var(--surface);
}
.toolbar {
  flex-wrap: wrap;
}
.sep {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--line);
}
.tool-select {
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.mode {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  background: var(--raised);
}
.mode-btn {
  padding: 2px 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.mode-btn.active {
  background: var(--brand);
  color: #fff;
}
.mode-btn[aria-disabled="true"] {
  color: var(--muted);
}
.find {
  gap: 6px;
  border-top: 1px solid var(--line);
}
.find input {
  flex: 1;
  max-width: 320px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.code-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--code-bg);
  color: var(--code-text);
}
.code {
  position: relative;
  min-height: 100%;
  font: var(--code-size) / 1.5 var(--mono);
  tab-size: 2;
}
.lines,
.code textarea {
  margin: 0;
  padding: 0;
  border: 0;
  font: inherit;
  letter-spacing: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
}
.ln {
  position: relative;
  min-height: 1.5em;
  padding: 0 12px 0 56px;
}
.ln::before {
  content: attr(data-n);
  position: absolute;
  left: 0;
  width: 44px;
  color: var(--code-gutter);
  text-align: right;
  user-select: none;
}
.ln.error::before {
  background: #fde2e2;
  color: #a4161a;
  font-weight: 700;
}
.ln.warning::before {
  background: #fdf0cf;
  color: #7a5200;
}
.code textarea {
  position: absolute;
  top: 0;
  left: 56px;
  width: calc(100% - 68px);
  height: 100%;
  overflow: hidden;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--code-text);
  outline: none;
}
.code textarea::selection {
  background: rgb(91 95 233 / 0.28);
  color: transparent;
}
.tk-cmd { color: #2b3fd6; }
.tk-com { color: #6b7280; font-style: italic; }
.tk-math { color: #b3261e; }
.tk-br { color: #0b7a4b; }
.binary {
  padding: 32px;
  text-align: center;
}
.binary img {
  max-width: 100%;
  max-height: 60vh;
  box-shadow: 0 2px 12px rgb(17 24 39 / 0.2);
}
.split-btn {
  display: inline-flex;
  margin-right: 6px;
}
.btn-compile {
  padding: 4px 14px;
  border: 0;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn-compile:first-child {
  border-radius: 999px 0 0 999px;
}
.btn-compile:last-child {
  padding: 4px 10px;
  border-left: 1px solid rgb(255 255 255 / 0.4);
  border-radius: 0 999px 999px 0;
}
.btn-compile:hover {
  background: var(--brand-strong);
}
.pdf-view {
  flex: 1;
  min-height: 0;
  background: #e9ecf0;
}
.pdf-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.pdf-empty {
  margin: 0;
  padding: 48px 24px;
  color: #6b7280;
  text-align: center;
}
.logs {
  flex: 1;
  min-height: 0;
  padding: 12px;
  overflow: auto;
  background: var(--bg);
}
.log-list {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.log-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-left: 4px solid var(--warn);
  border-radius: 6px;
  background: var(--surface);
}
.log-list li.error {
  border-left-color: var(--danger);
}
.logs pre {
  margin: 8px 0 0;
  padding: 12px;
  overflow: auto;
  border-radius: 6px;
  background: var(--surface);
  font: 12px/1.5 var(--mono);
  white-space: pre-wrap;
}
.logs summary {
  cursor: pointer;
}

@media (max-width: 900px) {
  .dash {
    grid-template-columns: 1fr;
  }
  .dash-side {
    position: static;
    height: auto;
  }
  .col-owner,
  .col-date {
    display: none;
  }
  .dash-card {
    border-radius: 0;
  }
  .ide-pdf {
    width: 50%;
  }
}

/* ---------- visualizador de PDF próprio ---------- */
.pdf-bar {
  min-height: 40px;
}
.logs-btn {
  position: relative;
  margin-right: 4px;
}
.logs-btn[aria-pressed="true"] {
  background: var(--brand-soft);
}
.logs-btn .badge {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 18px;
  padding: 0 4px;
  font-size: 11px;
}
.pdf-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.page-input {
  width: 38px;
  height: 26px;
  margin-left: 6px;
  padding: 0 4px;
  border: 1px solid var(--muted);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: center;
}
.pdf-nav [data-page-total] {
  margin: 0 10px 0 4px;
  white-space: nowrap;
}
.zoom-btn {
  min-width: 56px;
  justify-content: center;
  font-weight: 400;
}
.pdf-view {
  position: relative;
  display: flex;
  flex-direction: column;
}
.pdf-pages {
  flex: 1;
  min-height: 0;
  padding: 12px 0 0;
  overflow: auto;
  outline: none;
}
.pdf-page {
  margin-inline: auto;
  background: #fff;
  box-shadow: 0 1px 6px rgb(17 24 39 / 0.22);
}
.pdf-page canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- edição em conjunto: presença e cursores ---------- */
.presence {
  display: inline-flex;
  gap: 4px;
  margin-right: 4px;
}
.avatar {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: var(--who);
  color: #fff;
  font: 600 12px var(--font);
  cursor: pointer;
}
.cursors {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.cursor {
  position: absolute;
  width: 2px;
  margin-left: -1px;
  background: var(--who);
}
.cursor-name {
  position: absolute;
  bottom: 100%;
  left: 0;
  padding: 0 5px;
  border-radius: 3px 3px 3px 0;
  background: var(--who);
  color: #fff;
  font: 600 11px/1.5 var(--font);
  white-space: nowrap;
}
.rail-btn.has-news {
  position: relative;
}
.rail-btn.has-news::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}
.read-only .code textarea {
  cursor: default;
}

/* ---------- chat e comentários ---------- */
.chat-list,
.comments {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 8px 14px;
  overflow: auto;
  list-style: none;
}
.chat-list li,
.comments li {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--raised);
  overflow-wrap: anywhere;
}
.chat-list li.mine {
  background: var(--brand-soft);
}
.chat-list p,
.comments p {
  margin: 2px 0 0;
}
.chat-who {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.comments li.resolved {
  opacity: 0.65;
}
.comment-quote {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  padding: 4px 8px;
  border: 0;
  border-left: 3px solid var(--warn);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.comment-quote strong {
  display: block;
  font-size: 12px;
}
.comment-quote span {
  font: 13px var(--mono);
}
.comments form {
  margin-top: 6px;
}
.comment-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

/* ---------- compartilhar ---------- */
.share h3,
.history-view h4 {
  margin: 18px 0 8px;
  font-size: 15px;
}
.share h3:first-child {
  margin-top: 0;
}
.share-row {
  display: flex;
  gap: 8px;
}
.share-row .text-input {
  flex: 1;
  min-width: 0;
}
.share-row select.text-input {
  flex: 0 0 150px;
}
.share-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.share-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.share-list li > span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.share-list select.text-input {
  width: 150px;
}

/* ---------- histórico ---------- */
.history {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  min-height: 50vh;
}
.history-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-list {
  margin: 0;
  padding: 0;
  max-height: 60vh;
  overflow: auto;
  list-style: none;
}
.history-list button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.history-list button:hover {
  background: var(--raised);
}
.history-list button[aria-current="true"] {
  background: var(--brand-strong);
  color: #fff;
}
.history-list button[aria-current="true"] .muted {
  color: inherit;
}
.history-list span {
  display: block;
  font-size: 12px;
}
.history-view {
  min-width: 0;
  max-height: 68vh;
  overflow: auto;
}
.history-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-head strong {
  flex: 1;
}
.diff {
  margin: 0;
  padding: 8px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--code-text);
  font: 13px/1.5 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.diff span {
  display: block;
  padding: 0 10px;
}
.diff .add {
  background: #dcfce7;
}
.diff .del {
  background: #fee2e2;
}
.diff .skip {
  color: var(--code-gutter);
}
.dialog.wide:has(.history) {
  width: min(1040px, 100% - 32px);
}

/* ---------- página da conta ---------- */
.account-page {
  overflow: auto;
}
.account-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
}
.account {
  width: min(640px, 100% - 32px);
  margin: 0 auto 64px;
}
.account-card {
  display: grid;
  gap: 12px;
  margin: 20px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.account-card h2 {
  margin: 0;
  font-size: 18px;
}
.account-card p {
  margin: 0;
}
.account-card .btn {
  justify-self: start;
}
.account-card.danger {
  border-color: var(--danger);
}
/* Integrações (assets/app/account.js) e a escolha do projeto do Nevext (assets/app/nevext-link.js). */
.account-card h3 {
  margin: 4px 0 0;
  font-size: 15px;
}
.integration-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.integration-list li {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.5fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.integration-list .integration-name a {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.integration-list .card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
@media (max-width: 640px) {
  .integration-list li {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
.nevext-pick {
  display: grid;
  gap: 6px;
  max-height: 280px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}
.nevext-pick li {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.nevext-pick small {
  display: block;
}

/* ---------- busca e substituição, sugestões ---------- */
.find {
  flex-direction: column;
  align-items: stretch;
}
.find-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.find [aria-pressed="true"] {
  background: var(--brand-soft);
}
.find .btn {
  padding: 3px 12px;
}
.suggest {
  position: absolute;
  z-index: 5;
  min-width: 180px;
  max-height: 220px;
  margin: 0;
  padding: 4px;
  overflow: auto;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: 13px var(--mono);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
}
.suggest li {
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.suggest li[aria-selected="true"] {
  background: var(--brand-strong);
  color: #fff;
}
.pdf-invert .pdf-page canvas {
  filter: invert(1) hue-rotate(180deg);
}

/* ---------- assistente de IA ---------- */
.ai-form textarea {
  width: 100%;
  resize: vertical;
}
.ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.ai-actions .btn {
  padding: 4px 12px;
  font-size: 13px;
}
.ai-answers {
  padding: 0 14px 14px;
}
.ai-answer {
  margin-bottom: 14px;
  padding: 10px;
  border-radius: 8px;
  background: var(--raised);
  overflow-wrap: anywhere;
}
.ai-answer p {
  margin: 0 0 8px;
  white-space: pre-wrap;
}
.ai-code pre {
  margin: 0 0 4px;
  padding: 8px;
  overflow: auto;
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--code-text);
  font: 12px/1.5 var(--mono);
}
.ai-code {
  margin-bottom: 8px;
}
.find-row {
  flex-wrap: wrap;
}

/* O E rebaixado do nome, como na marca do TeX. */
.tex-e {
  display: inline-block;
  margin: 0 -0.06em;
  transform: translateY(0.2em);
}

/* ---------- montar tabela ---------- */
.grid-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 10px 0;
}
.grid-tools .btn {
  padding: 3px 12px;
}
.grid-edit {
  max-height: 46vh;
  margin-bottom: 10px;
  overflow: auto;
}
.grid-edit table {
  border-collapse: collapse;
}
.grid-edit td {
  padding: 2px;
}
.grid-edit input {
  width: 130px;
  padding: 5px 8px;
}
.grid-edit input.head {
  font-weight: 700;
}
.table-dialog > .text-input {
  width: 100%;
  margin-top: 10px;
}
.review-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.review-tools .text-input {
  flex: 1;
  min-width: 140px;
}

.share-card h2 a {
  color: inherit;
}
.share-card .share-list li:first-child {
  border-top: 0;
}

.brand-logo {
  width: auto;
  height: 30px;
}

/* ---------- modo visual ---------- */
.visual {
  max-width: 820px;
  min-height: 100%;
  margin: 0 auto;
  padding: 28px 40px 80px;
  font: 17px/1.65 Georgia, "Times New Roman", serif;
}
.visual [contenteditable] {
  outline: none;
}
.visual .v-block {
  margin: 0 0 14px;
  min-height: 1.65em;
  border-radius: 4px;
}
.visual .v-block:focus,
.visual li:focus {
  background: rgb(28 112 227 / 0.05);
}
.visual h1,
.visual h2,
.visual h3,
.visual h4,
.visual h5,
.visual h6 {
  margin-top: 26px;
  font-family: var(--font);
  line-height: 1.25;
}
.visual h1 { font-size: 30px; }
.visual h2 { font-size: 24px; }
.visual h3 { font-size: 20px; }
.visual h4 { font-size: 17px; }
.visual h5,
.visual h6 { font-size: 15px; }
.visual ul.v-block,
.visual ol.v-block {
  padding-left: 28px;
}
.visual li {
  min-height: 1.65em;
}
.visual code {
  font: 0.88em var(--mono);
}
.v-chip {
  padding: 1px 6px;
  border: 1px solid #d5dbe6;
  border-radius: 5px;
  background: #f2f5fa;
  color: #1c4fa1;
  font: 0.8em var(--mono);
  white-space: nowrap;
  cursor: default;
  user-select: all;
}
.v-chip.v-math {
  border-color: #f0d2cf;
  background: #fdf4f3;
  color: #b3261e;
}
.v-raw {
  position: relative;
  margin: 0 0 14px;
  border: 1px dashed #c6cedb;
  border-radius: 8px;
  background: #f8f9fc;
}
.v-raw summary,
.v-tag {
  display: block;
  padding: 4px 10px;
  color: #6b7280;
  font: 600 12px var(--font);
  letter-spacing: 0.02em;
}
.v-raw summary {
  cursor: pointer;
}
.v-code {
  display: block;
  width: 100%;
  padding: 2px 10px 8px;
  overflow: hidden;
  border: 0;
  outline: none;
  resize: none;
  background: none;
  color: var(--code-text);
  font: 13px/1.5 var(--mono);
  white-space: pre-wrap;
}
.v-empty {
  color: #6b7280;
  font-family: var(--font);
}

/* ---------- telas pequenas (celular) ---------- */
.only-small,
.small-tabs {
  display: none;
}
@media (max-width: 760px) {
  .ide {
    height: 100dvh;
  }
  .only-small {
    display: inline-flex;
  }
  .menubar,
  .ide-top .spacer:first-of-type,
  .ide-top [data-history],
  .ide-top [data-layout-btn],
  .presence,
  .splitter {
    display: none;
  }
  .ide-top {
    gap: 2px;
    padding: 0 4px;
  }
  .title-btn {
    flex: 1;
    min-width: 0;
    max-width: none;
    justify-content: center;
    text-overflow: ellipsis;
  }
  .save-status {
    min-width: 0;
    font-size: 12px;
  }
  .small-tabs {
    display: flex;
    flex: none;
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .small-tabs button {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 0;
    border: 0;
    background: none;
    color: var(--muted);
    font: 600 12px var(--font);
  }
  .small-tabs button[aria-pressed="true"] {
    color: var(--link);
  }
  /* uma parte por vez */
  .ide .ide-rail,
  .ide .ide-panel,
  .ide .ide-editor,
  .ide .ide-pdf {
    display: none;
  }
  .ide[data-part="panel"] .ide-rail,
  .ide[data-part="editor"] .ide-editor,
  .ide[data-part="pdf"] .ide-pdf {
    display: flex;
  }
  .ide[data-part="panel"] .ide-panel {
    display: block;
    flex: 1;
    width: auto;
  }
  .ide .ide-editor,
  .ide .ide-pdf {
    flex: 1;
    width: 100%;
  }
  .rail-bottom {
    display: none;
  }
  .toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .toolbar > * {
    flex: none;
  }
  .toolbar .spacer {
    display: none;
  }
  .tree-row {
    min-height: 44px;
  }
  .tree-row .icon-btn {
    visibility: visible;
  }
  .ln {
    padding-left: 40px;
  }
  .ln::before {
    width: 30px;
  }
  .code textarea {
    left: 40px;
    width: calc(100% - 52px);
  }
  .visual {
    padding: 16px 16px 60px;
  }
  .menu-pop {
    max-height: 80dvh;
  }
  .history {
    grid-template-columns: 1fr;
  }
  .share-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ---------- Draw.io e Zotero ---------- */
.dialog.drawio {
  width: min(1500px, 100% - 16px);
  max-width: none;
  height: calc(100dvh - 16px);
  max-height: none;
}
.dialog.drawio[open] {
  display: flex;
  flex-direction: column;
}
.dialog.drawio header {
  flex: none;
  padding: 8px 14px;
}
.drawio-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}
.cards-list .btn {
  align-self: flex-start;
  margin-top: 8px;
}
.zotero-step h3 {
  margin: 8px 0 0;
}
.zotero-step:empty {
  display: none;
}

/* ---------- aviso de limite para quem está sem conta ---------- */
.anon-note {
  flex: none;
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--brand-soft);
  font-size: 13px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cards-list .card-actions .btn {
  margin-top: 8px;
}

/* ---------- novo projeto: privado ou público ---------- */
.choices {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}
.choices legend {
  padding: 0 0 6px;
  font-weight: 600;
}
.choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.choice:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.choice span {
  display: grid;
  gap: 2px;
}
.choice small {
  color: var(--muted);
  font-size: 13px;
}

/* ---------- seu progresso ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
.stat {
  display: grid;
  gap: 2px;
  padding: 12px;
  border-radius: 10px;
  background: var(--raised);
}
.stat strong {
  font-size: 26px;
  line-height: 1.1;
}
.stat span {
  color: var(--muted);
  font-size: 13px;
}
.stats.small .stat strong {
  font-size: 18px;
}
.spark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 72px;
  padding-top: 4px;
}
.spark i {
  flex: 1;
  min-height: 3px;
  border-radius: 2px 2px 0 0;
  background: var(--line);
}
.spark i.on {
  background: var(--brand);
}
.progress h3 {
  margin: 8px 0 0;
  font-size: 15px;
}
.badges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.badges li {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
}
.badges li.earned {
  border: 1px solid var(--brand);
  background: var(--brand-soft);
  color: var(--text);
}
.badges strong {
  font-size: 14px;
}
.badges small {
  color: var(--muted);
}
.account {
  width: min(760px, 100% - 32px);
}

/* ---------- moderação da galeria ---------- */
.mod-heading {
  margin: 32px 0 0;
  font-size: 16px;
  color: var(--muted);
}
.report-list {
  margin: 0;
  padding-left: 18px;
}
.account-card .card-actions .btn {
  justify-self: auto;
}
.message-body {
  white-space: pre-wrap;
}

/* ---------- do código ao PDF: destaque do trecho ---------- */
.pdf-page {
  position: relative;
}
.pdf-mark {
  position: absolute;
  border: 2px solid var(--brand);
  border-radius: 4px;
  background: rgb(28 112 227 / 0.16);
  pointer-events: none;
  animation: pdf-mark 2.2s ease-out forwards;
}
@keyframes pdf-mark {
  0%, 60% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- imagens que faltam ---------- */
.missing-images {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid var(--warn);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--surface);
}
.missing-images p,
.missing-images ul {
  margin: 0;
}
.missing-images ul {
  max-height: 180px;
  padding-left: 20px;
  overflow: auto;
  font: 13px var(--mono);
}

/* ---------- projetos da comunidade, dentro da lista de projetos ---------- */
.community {
  padding: 4px 0 24px;
}
.community-lead {
  max-width: 760px;
  margin: 0 0 16px;
  color: var(--muted);
}
.community-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  font-weight: 600;
}
.community-filter .text-input {
  width: auto;
}
.community-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.community-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.community-main {
  flex: 1 1 320px;
}
.community-main p {
  margin: 4px 0 0;
}
.community-name {
  margin-right: 8px;
  font-size: 17px;
  font-weight: 700;
}
.community-actions {
  display: flex;
  gap: 8px;
}

/* ---------- os três links de compartilhamento ---------- */
.link-card {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
}
.link-card .share-row {
  margin-top: 6px;
}

/* ---------- publicação ---------- */
.publish h3 {
  margin: 12px 0 0;
  color: var(--text);
  font-size: 15px;
  text-transform: none;
}
.variant-list,
.review-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.variant-list .chip {
  margin-right: 8px;
}
.review-list {
  max-height: 220px;
  overflow: auto;
  font-size: 13px;
}
@media (max-width: 760px) {
  .ide-top [data-publish] {
    display: none;
  }
}

.explain {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: var(--raised);
}
.explain p {
  margin: 0;
}

.steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}
.check-ok {
  margin: 0;
  padding: 10px 14px;
  border-left: 4px solid #2f9e62;
  border-radius: 8px;
  background: var(--raised);
}
