:root {
  --ink: #102033;
  --muted: #657386;
  --line: #c7d3df;
  --paper: #f5f8fc;
  --panel: #ffffff;
  --wash: #edf3f8;
  --brand: #2d496f;
  --brand-dark: #173456;
  --accent: #8b0b18;
  --accent-soft: #f6e8ea;
  --mark: #d69f2f;
  --shadow: 0 18px 46px rgba(23, 52, 86, .10);
}

* { box-sizing: border-box; }

.hidden {
  display: none !important;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--paper), #eef4fa 460px, #fbfcfe);
  letter-spacing: 0;
}

button, input, select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--brand-dark);
  min-height: 36px;
  padding: 0 14px;
  border-radius: 5px;
  cursor: pointer;
}

button:hover { border-color: var(--brand); }

.button-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--brand-dark);
  background: var(--panel);
  padding: 0 14px;
  text-decoration: none;
}

.button-link:hover {
  border-color: var(--brand);
}

button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

button.saved:disabled {
  color: #245b35;
  background: #dcefe2;
  border-color: #91bf9c;
  opacity: 1;
}

.primary {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.hero {
  color: #fff;
  background:
    linear-gradient(118deg, #173456 0%, #2d496f 58%, #436487 100%);
}

.hero--compact .hero-inner {
  padding-bottom: 34px;
}

.hero-inner {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 42px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mark);
}

.issn-badge {
  color: var(--brand-dark);
  background: #fff;
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 800;
}

.update-note {
  opacity: .86;
}

.about-link {
  color: #fff;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 999px;
  padding: 4px 10px;
  text-decoration: none;
}

.about-link:hover {
  color: var(--brand-dark);
  background: #fff;
}

.return-button {
  color: var(--brand-dark);
  background: #fff;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 5px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  text-decoration: none;
}

.return-button:hover {
  background: var(--wash);
}

h1 {
  max-width: 760px;
  margin: 10px 0 10px;
  font-size: clamp(30px, 4.2vw, 48px);
  line-height: .96;
}

.hero p {
  max-width: 820px;
  margin: 0;
  font-size: 15px;
}

.shell {
  width: min(1120px, calc(100% - 36px));
  margin: 18px auto 48px;
}

.value-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.value-grid article,
.search-panel,
.results-panel {
  min-width: 0;
  background: rgba(255,255,255,.82);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.value-grid article {
  min-height: 112px;
  padding: 18px;
}

.metric {
  display: block;
  color: var(--brand-dark);
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 4px;
}

.value-grid strong {
  display: block;
  margin-bottom: 8px;
}

.value-grid p,
.results-head p,
label,
.result-card p,
.meta-line,
.reader-biblio {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.search-panel {
  position: sticky;
  top: 12px;
  min-width: 0;
  padding: 16px;
}

.panel-title {
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 12px;
}

.panel-subtitle {
  color: var(--accent);
  border-top: 1px solid var(--line);
  margin: 14px 0 12px;
  padding-top: 14px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.sentiment-panel {
  margin-top: 14px;
}

.sentiment-panel button {
  width: 100%;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-weight: 700;
}

input, select {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
}

input:focus, select:focus {
  outline: 2px solid rgba(45, 73, 111, .24);
  border-color: var(--accent);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.results-panel {
  padding: 16px;
  min-width: 0;
}

.results-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  min-width: 0;
}

.results-head > div {
  min-width: 0;
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: start;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.mini-stats div {
  min-width: 0;
  background: var(--wash);
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 5px;
}

.mini-stats strong {
  display: block;
  color: var(--brand);
  font-size: 20px;
}

.mini-stats span {
  color: var(--muted);
  font-size: 12px;
}

.results {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.result-card {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 5px;
  padding: 14px 16px;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.tag {
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.result-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.25;
}

.result-card h3 a {
  color: var(--ink);
  text-decoration: none;
}

.result-card h3 a:hover {
  color: var(--brand);
}

.review-preview {
  white-space: pre-line;
  overflow-wrap: anywhere;
  margin-bottom: 0;
}

.search-hit {
  color: inherit;
  background: #ffe66d;
  border-radius: 2px;
  padding: 0 .08em;
}

.result-reference {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--ink);
  background: var(--wash);
  border-left: 3px solid var(--brand);
  margin: 10px 0 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.biblio {
  display: grid;
  gap: 3px;
  margin: 10px 0;
  font-size: 13px;
}

.biblio b { color: var(--brand-dark); }

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.sentiment-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.sentiment-list li {
  border-left: 3px solid var(--accent);
  background: #fbf6f4;
  padding: 9px 10px;
}

.sentiment-list p {
  margin: 6px 0 0;
}

.sentiment-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sentiment-tags span {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

.sentiment-tags .positivo {
  color: #245b35;
  background: #e4f1e7;
  border-color: #b8d6c0;
}

.sentiment-tags .negativo {
  color: #8a2533;
  background: #f5e2e5;
  border-color: #e2b8c0;
}

.sentiment-tags .neutro {
  color: #5f5a34;
  background: #f1eed9;
  border-color: #d9d1a8;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

dialog {
  width: min(920px, calc(100% - 28px));
  max-height: 86vh;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0;
  box-shadow: 0 30px 90px rgba(16, 32, 51, .28);
}

dialog::backdrop {
  background: rgba(16, 32, 51, .50);
}

.reader-close-row {
  display: flex;
  justify-content: flex-end;
  padding: 10px 14px 0;
  background: #fff;
}

#closeReader {
  min-width: 36px;
  height: 36px;
  padding: 0;
  color: var(--brand-dark);
  background: #fff;
  border-color: var(--line);
  font-size: 24px;
}

.reader-biblio {
  margin: 8px 22px 0;
  padding: 14px 16px;
  border-left: 3px solid var(--brand);
  border-bottom: 1px solid var(--line);
  background: #eef5f1;
  line-height: 1.45;
}

.reader-sentiments {
  margin: 8px 22px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  background: #fff;
}

.reader-sentiments .sentiment-list li {
  border-left-color: var(--brand);
  background: var(--wash);
}

.admin-edit {
  margin: 8px 22px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  background: #f7fbff;
}

.admin-edit-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.admin-edit #editStatus {
  color: var(--muted);
  font-size: 13px;
}

.admin-edit form {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.admin-edit label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-edit input,
.admin-edit textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  font: inherit;
  padding: 7px 9px;
}

.url-test-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
}

.url-test-row button {
  white-space: nowrap;
}

.admin-edit textarea {
  line-height: 1.45;
  resize: vertical;
}

.admin-edit textarea[name="corpo_texto"] {
  min-height: min(68vh, 760px);
  white-space: pre-wrap;
}

.admin-edit button.saved:disabled {
  box-shadow: inset 0 0 0 1px rgba(36, 91, 53, .16);
}

dialog.is-editing {
  max-height: 96vh;
}

.reader-controls h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.reader-controls p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.highlight-buttons {
  display: grid;
  gap: 10px;
}

.highlight-group {
  display: grid;
  gap: 6px;
  align-items: start;
}

.highlight-group-title {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.highlight-group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.highlight-buttons button {
  --tone: var(--brand);
  --tone-bg: #f7fafc;
  --tone-ink: var(--brand-dark);
  --tone-border: var(--line);
  min-height: 30px;
  color: var(--tone-ink);
  background: var(--tone-bg);
  border-color: var(--tone-border);
  box-shadow: inset 0 -2px 0 rgba(255,255,255,.34);
}

.highlight-buttons button.active {
  color: var(--tone-ink);
  background: var(--tone-bg);
  border-color: var(--tone);
  box-shadow: inset 0 0 0 1px var(--tone), 0 1px 0 rgba(16, 32, 51, .04);
  font-weight: 800;
}

.highlight-buttons.highlights-hidden button[data-highlight] {
  opacity: .72;
}

.tone-all {
  --tone: #2d496f;
  --tone-bg: #d7e4f2;
  --tone-ink: #173456;
  --tone-border: #9fb1c7;
}

.tone-positivo {
  --tone: #1f8a4c;
  --tone-bg: #b7ebcc;
  --tone-ink: #166337;
  --tone-border: #78bd94;
}

.tone-negativo {
  --tone: #c7332d;
  --tone-bg: #ffb7b2;
  --tone-ink: #992822;
  --tone-border: #df817b;
}

.tone-neutro {
  --tone: #6b7280;
  --tone-bg: #d5d9e1;
  --tone-ink: #4b5563;
  --tone-border: #aab2be;
}

.tone-epistemica {
  --tone: #2f68c9;
  --tone-bg: #b9d0ff;
  --tone-ink: #1e4f9b;
  --tone-border: #7fa3ea;
}

.tone-deontica {
  --tone: #b7791f;
  --tone-bg: #ffcc66;
  --tone-ink: #8a5a15;
  --tone-border: #d69f2f;
}

.tone-dinamica {
  --tone: #7c4acb;
  --tone-bg: #d3b9ff;
  --tone-ink: #6235a5;
  --tone-border: #a98ade;
}

.tone-emocional {
  --tone: #c43d79;
  --tone-bg: #ffb8d7;
  --tone-ink: #9d2d5f;
  --tone-border: #db7aa7;
}

.highlight-buttons button.tone-all {
  background-color: #d7e4f2;
  border-color: #9fb1c7;
  color: #173456;
}

.highlight-buttons button.tone-positivo {
  background-color: #b7ebcc;
  border-color: #78bd94;
  color: #166337;
}

.highlight-buttons button.tone-negativo {
  background-color: #ffb7b2;
  border-color: #df817b;
  color: #992822;
}

.highlight-buttons button.tone-neutro {
  background-color: #d5d9e1;
  border-color: #aab2be;
  color: #4b5563;
}

.highlight-buttons button.tone-epistemica {
  background-color: #b9d0ff;
  border-color: #7fa3ea;
  color: #1e4f9b;
}

.highlight-buttons button.tone-deontica {
  background-color: #ffcc66;
  border-color: #d69f2f;
  color: #8a5a15;
}

.highlight-buttons button.tone-dinamica {
  background-color: #d3b9ff;
  border-color: #a98ade;
  color: #6235a5;
}

.highlight-buttons button.tone-emocional {
  background-color: #ffb8d7;
  border-color: #db7aa7;
  color: #9d2d5f;
}

#readerBody {
  padding: 22px;
  white-space: pre-wrap;
  font-size: 16px;
  line-height: 1.62;
}

.review-period {
  border-radius: 4px;
  transition: background-color .12s ease;
}

.review-period.has-mark {
  text-decoration: underline;
  text-decoration-color: rgba(139, 11, 24, .22);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.review-period.highlighted {
  text-decoration: none;
  box-shadow: 0 0 0 2px rgba(255,255,255,.86);
}

.hl-positive { background: #d9f5e4; }
.hl-negative { background: #ffd9d6; }
.hl-neutral { background: #e5e7eb; }
.hl-epistemica { background: #dceafe; }
.hl-deontica { background: #ffe7b8; }
.hl-dinamica { background: #eadcff; }
.hl-emocional { background: #ffd9e8; }

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 5px;
}

.empty.small {
  padding: 14px;
  text-align: left;
}

.info-shell {
  width: min(900px, calc(100% - 36px));
  margin: 26px auto 56px;
}

.single-reader {
  width: min(960px, calc(100% - 36px));
  margin: 18px auto 56px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.single-reader .reader-biblio,
.single-reader .admin-edit {
  margin-left: 22px;
  margin-right: 22px;
}

.embedded-reader .hero {
  display: none;
}

.embedded-reader .single-reader {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.batch-shell {
  width: min(960px, calc(100% - 36px));
  margin: 18px auto 56px;
}

.batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.batch-actions span {
  color: var(--muted);
  font-size: 13px;
}

.review-queue {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 14px;
  width: min(1320px, calc(100% - 28px));
}

.queue-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: calc(100vh - 210px);
  overflow: auto;
}

.queue-item {
  display: grid;
  gap: 4px;
  min-height: auto;
  padding: 10px 12px;
  text-align: left;
  background: #fff;
}

.queue-item.active {
  border-color: var(--brand);
  box-shadow: inset 3px 0 0 var(--brand);
}

.queue-item strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.queue-item span {
  color: var(--muted);
  font-size: 12px;
}

.queue-reader {
  min-width: 0;
}

.queue-reader iframe {
  width: 100%;
  height: calc(100vh - 238px);
  min-height: 620px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.info-section {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.info-section p {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 14px;
}

.info-section a,
.site-footer a {
  color: var(--brand);
}

.editor-list {
  display: grid;
  gap: 20px;
}

.editor-list article {
  padding-left: 16px;
  border-left: 3px solid var(--brand);
}

.editor-list h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.contact-line {
  color: var(--muted) !important;
  font-size: 14px !important;
}

.site-footer {
  padding: 24px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.site-footer p {
  margin: 0 0 8px;
}

@media (max-width: 860px) {
  .value-grid,
  .workspace,
  .mini-stats {
    grid-template-columns: 1fr;
  }

  .search-panel {
    position: static;
  }
}

@media (min-width: 861px) and (max-width: 1100px) {
  .value-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .shell,
  .hero-inner {
    width: min(100% - 24px, 1120px);
  }

  .field-grid,
  .button-row {
    grid-template-columns: 1fr;
  }

  .results-head {
    display: block;
  }

  .head-actions {
    margin-top: 10px;
  }

}
