:root {
  --ink: #182321;
  --muted: #66736f;
  --line: #dce5e1;
  --panel: #ffffff;
  --paper: #f4f7f5;
  --paper-strong: #eaf1ee;
  --teal: #0f6b63;
  --teal-dark: #0a403c;
  --teal-2: #e4f2ef;
  --red: #b83a3a;
  --gold: #b97818;
  --blue: #315f93;
  --violet: #694a9e;
  --shadow: 0 18px 42px rgba(24, 35, 33, 0.1);
  --soft-shadow: 0 8px 22px rgba(24, 35, 33, 0.07);
  --radius: 8px;
  --pill-radius: 999px;
  --focus: 0 0 0 3px rgba(15, 107, 99, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(244, 247, 245, 0.92), rgba(244, 247, 245, 1)),
    radial-gradient(circle at 10% 0%, rgba(15, 107, 99, 0.12), transparent 30%);
  font-family: Inter, "Segoe UI", Roboto, Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

body.dark-mode {
  --ink: #eaf4f1;
  --muted: #b8c8c3;
  --line: #314c47;
  --panel: #132320;
  --paper: #0d1715;
  --paper-strong: #182a27;
  --teal: #4fd0bd;
  --teal-dark: #d7fff7;
  --teal-2: #173d38;
  --red: #df6666;
  --gold: #e2b65c;
  --blue: #70a9e8;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
  --soft-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
  --focus: 0 0 0 3px rgba(79, 208, 189, 0.32);
  background:
    linear-gradient(180deg, rgba(13, 23, 21, 0.96), rgba(13, 23, 21, 1)),
    radial-gradient(circle at 10% 0%, rgba(79, 208, 189, 0.12), transparent 30%);
}

button,
input,
select,
textarea,
a {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  transform: translateY(-160%);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: #fff;
  background: var(--teal-dark);
  font-weight: 900;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 86px;
  padding: 16px clamp(16px, 3vw, 30px);
  color: #fff;
  background: linear-gradient(115deg, #0b3432 0%, #0f6b63 52%, #315f93 100%);
  box-shadow: 0 12px 28px rgba(10, 64, 60, 0.18);
}

.topbar-right {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.top-actions .secondary,
.top-actions .import-button,
.tool-actions .secondary,
.read-tool-button {
  min-height: 34px;
  color: #0a403c;
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.94);
}

.top-actions .secondary:hover,
.top-actions .import-button:hover,
.tool-actions .secondary:hover,
.read-tool-button:hover {
  background: #fff;
}

.top-link {
  display: inline-flex;
  align-items: center;
}

.topbar h1 {
  max-width: 760px;
  margin: 0;
  color: #fff;
  font-size: clamp(22px, 2.45vw, 32px);
  line-height: 1.12;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: #d8b46f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(84px, 1fr));
  gap: 8px;
  min-width: min(340px, 40vw);
}

.tool-actions {
  min-width: min(340px, 40vw);
}

.status-strip div {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.status-label {
  display: block;
  margin-bottom: 1px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.status-strip strong {
  font-size: 19px;
  line-height: 1;
}

.app-shell {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  min-height: calc(100vh - 92px);
}

.side-nav {
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh - 92px);
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
}

.tab-button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  margin-bottom: 6px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #263431;
  background: transparent;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.tab-button:hover,
.tab-button.active {
  border-color: rgba(15, 107, 99, 0.22);
  background: var(--teal-2);
  color: var(--teal-dark);
  font-weight: 800;
}

.tab-button:hover {
  transform: translateX(2px);
}

.workspace {
  min-width: 0;
  width: min(100%, 1420px);
  padding: clamp(18px, 2.4vw, 32px);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.section-heading {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.section-heading.compact {
  margin-top: 28px;
}

.section-heading h2,
.section-heading h3,
.editor-header h3 {
  margin: 0;
  color: var(--teal-dark);
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.section-heading p {
  max-width: 860px;
  margin: 6px 0 0;
  color: var(--muted);
}

.form-grid,
.activity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 13px;
  align-items: start;
}

label {
  display: grid;
  gap: 6px;
  color: #34433f;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #bdcbc6;
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  font-weight: 400;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #8eaaa2;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  outline: none;
  box-shadow: var(--focus);
}

input[readonly],
textarea[readonly] {
  background: #f7faf8;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea,
body.dark-mode .activity-card,
body.dark-mode .calc-group,
body.dark-mode .calculator-summary,
body.dark-mode .intro-panel,
body.dark-mode .callout,
body.dark-mode .step-card,
body.dark-mode .checklist,
body.dark-mode .faq-item,
body.dark-mode .flow-item,
body.dark-mode .guidance-card,
body.dark-mode .guidance-hero,
body.dark-mode .preview-document,
body.dark-mode .criteria-list,
body.dark-mode .notice-modal {
  color: var(--ink);
  border-color: var(--line);
  background: var(--panel);
}

body.dark-mode label,
body.dark-mode .field-help,
body.dark-mode .status-label,
body.dark-mode .calc-list-row span,
body.dark-mode .fixed-meta {
  color: #d7e7e3;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  color: #f4fffc;
  border-color: #5f8880;
  background: #102a26;
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
  color: #b9cbc6;
  opacity: 1;
}

body.dark-mode input:hover,
body.dark-mode select:hover,
body.dark-mode textarea:hover {
  border-color: #83b7ad;
}

body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
  border-color: #78decf;
  background: #12322d;
}

body.dark-mode input[readonly],
body.dark-mode textarea[readonly],
body.dark-mode .secondary,
body.dark-mode .import-button {
  color: var(--teal-dark);
  background: #132f2b;
}

body.dark-mode .side-nav,
body.dark-mode .site-footer {
  background: rgba(19, 35, 32, 0.94);
}

body.dark-mode .footer-action,
body.dark-mode .footer-contact-link {
  color: #f4fffb;
  border-color: rgba(111, 211, 196, 0.42);
  background: linear-gradient(180deg, rgba(24, 93, 84, 0.96), rgba(14, 59, 54, 0.96));
  box-shadow: none;
}

body.dark-mode .footer-share {
  background: linear-gradient(180deg, #167f74, #0b514b);
}

body.dark-mode .footer-policy-link {
  color: #d4e7e2;
  border-color: rgba(111, 211, 196, 0.22);
  background: rgba(255, 255, 255, 0.06);
}

body.dark-mode .section-heading p,
body.dark-mode .guidance-card p,
body.dark-mode .guidance-hero p,
body.dark-mode .notice-modal p,
body.dark-mode .intro-panel p,
body.dark-mode .callout p,
body.dark-mode .faq-item p,
body.dark-mode .fixed-summary p,
body.dark-mode .attachment-audit p,
body.dark-mode .attachment-audit-item p {
  color: #d5e2df;
}

body.dark-mode .top-actions .secondary,
body.dark-mode .tool-actions .secondary,
body.dark-mode .read-tool-button {
  color: #d7fff7;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(14, 34, 31, 0.92);
}

body.dark-mode .attachment-audit,
body.dark-mode .attachment-audit-item {
  color: var(--ink);
  border-color: var(--line);
  background: #132320;
}

body.dark-mode .attachment-audit-item.warn,
body.dark-mode .attachment-audit li {
  background: #321b1b;
}

.field-help {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.wide,
.full {
  grid-column: 1 / -1;
}

.large-textarea {
  width: 100%;
  min-height: 440px;
}

#memorialText {
  text-align: justify;
  line-height: 1.65;
}

.criteria-layout {
  display: grid;
  grid-template-columns: minmax(230px, 310px) minmax(0, 1fr);
  gap: 16px;
  transition: grid-template-columns 0.18s ease;
}

.criteria-layout.criteria-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.criteria-layout.criteria-collapsed .criteria-list {
  display: none;
}

.criteria-layout.criteria-collapsed .editor-header {
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
}

.criteria-list {
  align-self: start;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.criterion-button {
  width: 100%;
  padding: 12px 13px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.criterion-button:last-child {
  border-bottom: 0;
}

.criterion-button:hover,
.criterion-button.active {
  background: var(--teal-2);
  color: var(--teal-dark);
}

.criterion-button strong {
  display: block;
  margin-bottom: 4px;
}

.criterion-button span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.activity-editor {
  min-width: 0;
}

.criteria-workbench {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(300px, 370px);
  gap: 16px;
  align-items: start;
}

.editor-header,
.actions-row,
.generator-panel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.editor-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
}

.editor-header #addActivityButton,
.editor-header #toggleCriteriaPanel {
  white-space: nowrap;
}

.criterion-rules {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.rule-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 88px 48px;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: var(--radius);
  background: #fff;
  align-items: start;
  box-shadow: 0 4px 14px rgba(24, 35, 33, 0.04);
}

.rule-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.rule-row strong {
  line-height: 1.28;
}

.rule-row strong:last-child {
  color: var(--teal-dark);
  text-align: right;
}

.activity-list {
  display: grid;
  gap: 10px;
}

.activity-card,
.calc-group,
.calculator-summary,
.intro-panel,
.callout,
.step-card,
.checklist,
.faq-item,
.flow-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.activity-card {
  padding: 12px;
}

.activity-draft {
  border-color: #dcb76d;
  background: #fffdf7;
}

.activity-draft::before {
  content: "Rascunho - clique em Fixar item para incluir na pontuação e na prévia";
  display: block;
  margin-bottom: 10px;
  padding: 8px 10px 8px 12px;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  color: #62430f;
  background: #fff3cf;
  font-size: 13px;
  font-weight: 800;
}

.activity-fixed {
  border-color: #b8cac6;
  background: #fbfdfc;
}

.fixed-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
}

.fixed-summary h4 {
  margin: 4px 0;
  color: var(--teal-dark);
  font-size: 16px;
}

.fixed-summary p {
  margin: 3px 0;
  color: #33413f;
}

.fixed-specific {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.fixed-meta {
  color: var(--muted);
  font-size: 13px;
}

.fixed-badge {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: var(--teal-2);
  font-size: 12px;
  font-weight: 800;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.attachment-pill {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 8px;
  border: 1px solid #d8bf80;
  border-radius: var(--pill-radius);
  color: #5a4215;
  background: #fff7df;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.attachment-pill span {
  min-width: 0;
}

.attachment-remove {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border-radius: var(--pill-radius);
  border: 1px solid #c48c3a;
  background: #fffdf7;
  color: #7a2f17;
  font-size: 14px;
  line-height: 1;
}

.attachment-remove:hover,
.attachment-remove:focus {
  background: #f8dfc6;
  color: #4d1c0d;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  margin-top: 10px;
}

.primary,
.secondary,
.danger,
.import-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 7px 11px;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.primary:hover,
.secondary:hover,
.danger:hover,
.import-button:hover {
  transform: translateY(-1px);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.import-button:focus-within {
  outline: none;
  box-shadow: var(--focus);
}

button:disabled,
.primary:disabled,
.secondary:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  filter: grayscale(0.35);
  transform: none;
}

.primary {
  color: #fff;
  background: var(--teal);
  box-shadow: 0 7px 16px rgba(15, 107, 99, 0.16);
}

.primary:hover {
  background: var(--teal-dark);
}

.secondary,
.import-button {
  color: var(--teal-dark);
  border-color: #a7c2bb;
  background: #fff;
}

.secondary:hover,
.import-button:hover {
  border-color: var(--teal);
  background: var(--teal-2);
}

.danger {
  color: #fff;
  background: var(--red);
}

.danger:hover {
  background: #932d2d;
}

.activity-fixed .danger {
  color: var(--red);
  border-color: #d9aaa6;
  background: #fff;
}

.large {
  min-width: 138px;
  min-height: 38px;
}

.compact-action {
  min-height: 32px;
  padding: 6px 10px;
}

.button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1em;
  color: currentColor;
  font-size: 0.95em;
  line-height: 1;
  flex: 0 0 auto;
}

.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  width: 120px;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--pill-radius);
  padding: 5px 10px 5px 34px;
  color: #0a403c;
  background: rgba(255, 255, 255, 0.94);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.theme-switch::before {
  content: "";
  position: absolute;
  left: 7px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #d7e7e3;
  box-shadow: inset 0 0 0 1px rgba(10, 64, 60, 0.24);
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.theme-switch::after {
  content: "";
  position: absolute;
  left: 13px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--teal);
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.theme-switch[aria-pressed="true"] {
  justify-content: flex-start;
  padding-right: 34px;
  padding-left: 10px;
  color: #fff;
  border-color: rgba(79, 208, 189, 0.58);
  background: #173d38;
}

.theme-switch[aria-pressed="true"]::before {
  transform: translateX(86px);
  background: #0b2421;
}

.theme-switch[aria-pressed="true"]::after {
  transform: translateX(86px);
  background: #f0c969;
}

.read-tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius);
  padding: 7px 12px;
  color: #fff;
  background: rgba(10, 64, 60, 0.8);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.read-tool-button:hover,
.read-tool-button[aria-pressed="true"] {
  background: #0a403c;
  transform: translateY(-1px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

.activity-grid input[data-field="points"],
.activity-grid input[data-field="total"],
.activity-grid textarea[data-field="specific"][readonly] {
  min-height: 32px;
  border-color: transparent;
  background: var(--teal-2);
  color: var(--teal-dark);
  box-shadow: none;
}

.activity-grid input[data-field="points"],
.activity-grid input[data-field="total"] {
  font-size: 18px;
  font-weight: 900;
  text-align: right;
}

.activity-grid textarea[data-field="specific"][readonly] {
  min-height: 84px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
  resize: none;
  cursor: default;
}

input[type="file"] {
  padding: 6px;
  background: #fbfdfc;
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  min-height: 30px;
  border: 1px solid #9ebbb3;
  border-radius: var(--radius);
  padding: 6px 10px;
  color: var(--teal-dark);
  background: var(--teal-2);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.validation-box {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.validation-item {
  padding: 11px 13px;
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 4px 14px rgba(24, 35, 33, 0.04);
}

.validation-item.ok {
  border-color: var(--teal);
}

.validation-item.warn {
  border-color: var(--red);
}

.attachment-audit {
  margin: 12px 0;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.attachment-audit p {
  margin: 5px 0 0;
  color: #33413f;
}

.attachment-audit h3 {
  margin: 0 0 9px;
  color: var(--teal-dark);
  font-size: 16px;
}

.attachment-audit {
  border-left: 4px solid var(--red);
  background: #fffafa;
}

.attachment-audit ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.attachment-audit li {
  color: #5b201d;
  line-height: 1.45;
}

.preview-document {
  max-width: 980px;
  padding: clamp(18px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.preview-document h3 {
  margin: 22px 0 8px;
  color: var(--teal-dark);
}

.preview-document table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 18px;
  font-size: 12px;
}

.preview-document th,
.preview-document td {
  border: 1px solid var(--line);
  padding: 8px;
  vertical-align: top;
}

.preview-document th {
  color: var(--teal-dark);
  background: var(--teal-2);
  text-align: left;
}

.preview-document .memorial-paragraph {
  text-align: justify;
  line-height: 1.65;
}

.generation-result {
  margin-top: 18px;
}

.locked-final-controls p {
  max-width: 420px;
  margin: 2px 0 0;
  color: #7a4c04;
  font-size: 13px;
  font-weight: 900;
}

.locked-final-controls .checkbox-line {
  margin-bottom: 0;
}

body.dark-mode .locked-final-controls p {
  color: #ffe1a2;
}

.attachment-thermometer {
  margin: 12px 0 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: var(--radius);
  background: #f8fbfa;
}

.thermometer-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
}

.thermometer-header span {
  font-weight: 800;
}

.thermometer-track {
  height: 9px;
  margin: 9px 0 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8e6;
}

.thermometer-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.attachment-thermometer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.skip-countdown-card {
  margin: 14px 0 10px;
  padding: 11px 13px;
  border: 1px solid #d6e3df;
  border-left: 4px solid rgba(15, 107, 99, 0.68);
  border-radius: var(--radius);
  background: #f8fbfa;
  box-shadow: 0 5px 14px rgba(24, 35, 33, 0.04);
}

.skip-countdown-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--teal-dark);
  font-size: 0.9rem;
}

.skip-countdown-header span {
  font-weight: 900;
  white-space: nowrap;
}

.skip-countdown-track {
  height: 7px;
  margin: 8px 0 7px;
  overflow: hidden;
  border-radius: var(--pill-radius);
  background: #e2ebe8;
}

.skip-countdown-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #315f93);
  transition: width 0.2s ease;
}

.skip-countdown-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.attachment-thermometer.delay-medium {
  border-left-color: var(--gold);
  background: #fff8e6;
}

.attachment-thermometer.delay-medium .thermometer-track span {
  background: var(--gold);
}

.attachment-thermometer.delay-high {
  border-left-color: var(--red);
  background: #fff1ef;
}

.attachment-thermometer.delay-high .thermometer-track span {
  background: var(--red);
}

.attachment-thermometer.delay-very-high {
  border-left-color: #7f1d1d;
  background: #fff0f0;
}

.attachment-thermometer.delay-very-high .thermometer-track span {
  background: #7f1d1d;
}

.generation-progress {
  padding: 12px 14px;
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  background: #eef7f5;
  color: #123b38;
  font-weight: 800;
}

.generation-result a {
  color: var(--teal-dark);
  font-weight: 800;
}

.calculator-shell {
  width: min(100%, 1480px);
  padding: clamp(18px, 2.4vw, 32px);
}

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 360px);
  gap: 16px;
  align-items: start;
}

.calculator-items {
  display: grid;
  gap: 16px;
}

.calc-group {
  overflow: hidden;
}

.calc-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f9fbfa;
}

.calc-group-header h2 {
  margin: 0;
  color: var(--teal-dark);
  font-size: 17px;
}

.calc-group-header strong {
  min-width: 120px;
  color: var(--teal-dark);
  text-align: right;
}

.calc-list-head,
.calc-list-row {
  display: grid;
  grid-template-columns: 46px minmax(320px, 1fr) minmax(170px, 0.45fr) 86px 78px;
  gap: 10px;
  align-items: start;
}

.calc-list-head {
  padding: 9px 16px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.calc-list-row {
  padding: 11px 16px;
  border-top: 1px solid #edf1ef;
}

.calc-list-row.active {
  background: #f1faf7;
}

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

.calc-list-row span {
  color: var(--muted);
  font-size: 12px;
}

.calc-list-row input,
.calc-list-row select {
  min-height: 36px;
}

.calc-list-row > strong:last-child {
  color: var(--teal-dark);
  text-align: right;
}

.calc-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(260px, 1.5fr) minmax(150px, 0.7fr) minmax(130px, 0.6fr);
  gap: 10px;
}

.calc-item-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: start;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: #33413f;
}

.calc-item-summary span {
  color: var(--muted);
  font-size: 13px;
}

.calculator-summary {
  position: sticky;
  top: 16px;
  padding: 16px;
}

.calculator-summary h2 {
  margin: 0 0 8px;
  color: var(--teal-dark);
}

.summary-number {
  margin: 0 0 6px;
  font-size: 18px;
}

.summary-number strong {
  font-size: 34px;
  color: var(--teal-dark);
}

.calc-chart {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
}

.calc-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--teal-dark);
  font-size: 13px;
}

.calc-chart-head span {
  color: var(--muted);
  font-size: 12px;
}

.calc-chart-bars {
  display: grid;
  gap: 8px;
}

.calc-bar-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.calc-bar-row span {
  color: var(--muted);
  font-weight: 800;
}

.calc-bar-row strong {
  color: var(--teal-dark);
  text-align: right;
}

.calc-bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: var(--pill-radius);
  background: #e6eeeb;
}

.calc-bar-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  transition: width 0.2s ease;
}

.rsc-result-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.rsc-result {
  display: grid;
  gap: 2px;
  padding: 9px 11px;
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  background: #fff8e8;
}

.rsc-result.ok {
  border-left-color: var(--teal);
  background: var(--teal-2);
}

.rsc-result span {
  color: #33413f;
  font-size: 13px;
}

.final-controls {
  display: grid;
  gap: 10px;
  min-width: 250px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.checkbox-line input {
  width: auto;
  min-height: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 31, 31, 0.5);
}

.modal-backdrop[hidden] {
  display: none;
}

.notice-modal {
  position: relative;
  width: min(640px, 100%);
  max-height: min(92vh, 780px);
  overflow: auto;
  padding: 24px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 24px 72px rgba(15, 24, 24, 0.3);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  min-height: 34px;
  border-radius: var(--pill-radius);
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.notice-modal h2 {
  margin: 0 0 10px;
  color: var(--teal-dark);
}

.notice-modal p {
  margin: 0 0 12px;
  color: #33413f;
}

.json-exit-modal {
  width: min(560px, 100%);
}

.json-exit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.danger-soft {
  color: #8f2f2a;
  border-color: rgba(194, 49, 43, 0.35);
  background: #fff8f7;
}

body.dark-mode .danger-soft {
  color: #ffd6d1;
  border-color: rgba(255, 131, 121, 0.35);
  background: rgba(110, 33, 29, 0.36);
}

.contribution-modal-card {
  width: min(940px, 100%);
  padding: 22px 30px 26px;
}

.contribution-visual {
  display: block;
  width: 100%;
  max-height: min(52vh, 520px);
  margin: 6px auto 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  object-fit: contain;
  background: #f4faf7;
  box-shadow: 0 12px 26px rgba(16, 55, 51, 0.12);
}

.contribution-modal-card .amount-options {
  justify-content: center;
  margin: 8px 0 12px;
}

.contribution-modal-card .amount-options label {
  min-width: 98px;
  justify-content: center;
}

.contribution-modal-card .amount-options .custom-amount-option {
  min-width: 130px;
}

.custom-contribution-field {
  display: grid;
  gap: 6px;
  max-width: 260px;
  margin: 4px auto 12px;
  color: var(--teal-dark);
  font-weight: 800;
}

.money-input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid #a7c2bb;
  border-radius: var(--radius);
  padding: 0 10px;
  background: #fff;
}

.money-input span {
  color: var(--muted);
  font-weight: 800;
}

.money-input input {
  min-height: 42px;
  border: 0;
  padding: 8px 0;
  box-shadow: none;
}

.money-input input:focus {
  outline: none;
  box-shadow: none;
}

.custom-contribution-field:focus-within .money-input {
  border-color: var(--teal);
  box-shadow: var(--focus);
}

.contribution-modal-card .contribution-actions {
  display: grid;
  grid-template-columns: max-content max-content;
  gap: 10px;
  align-items: stretch;
  justify-content: start;
  margin: 10px 0 14px;
}

.contribution-modal-card .contribution-actions .primary,
.contribution-modal-card .contribution-actions .secondary {
  min-height: 44px;
}

.contribution-modal-card .checkbox-line {
  margin-top: 4px;
}

.contribution-modal-card #continueWithoutContributionButton {
  margin-top: 6px;
  min-width: 180px;
}

.contribution-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 16px 0;
}

.payment-note,
.abc-exemption {
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #eef7f5;
  color: #123b38;
  font-weight: 800;
}

.abc-exemption[hidden] {
  display: none;
}

.is-exempt #contributeMercadoPagoButton {
  text-decoration: line-through;
}

.share-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
}

.share-card img {
  width: min(220px, 70vw);
  aspect-ratio: 9 / 16;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.share-card figcaption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

[vw].enabled {
  z-index: 18 !important;
}

.site-footer {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 18px 18px 26px;
  border-top: 1px solid var(--line);
  background: #edf3f0;
}

.footer-contact-row,
.footer-policy-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.footer-contact-row {
  gap: 12px;
}

.footer-action,
.footer-contact-link,
.footer-policy-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 900;
  line-height: 1.15;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.footer-action,
.footer-contact-link {
  padding: 10px 15px;
  border: 1px solid rgba(15, 107, 99, 0.3);
  color: #063f39;
  background: linear-gradient(180deg, #ffffff, #eef8f5);
  box-shadow: 0 8px 18px rgba(15, 107, 99, 0.08);
}

.footer-share {
  color: #ffffff;
  border-color: rgba(15, 107, 99, 0.2);
  background: linear-gradient(180deg, #158278, #0f6b63);
}

.footer-policy-link {
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid rgba(15, 107, 99, 0.16);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
  font-size: 13px;
}

.footer-action:hover,
.footer-contact-link:hover,
.footer-policy-link:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 107, 99, 0.42);
  box-shadow: 0 10px 22px rgba(15, 107, 99, 0.12);
}

.guidance-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px);
}

.guidance-hero {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.guidance-hero h2 {
  max-width: 860px;
  margin: 0;
  color: var(--teal-dark);
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.14;
}

.guidance-hero p {
  max-width: 900px;
  margin: 0;
  color: #33413f;
  font-size: 1rem;
}

.guidance-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.guidance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.guidance-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.guidance-card h3 {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 17px;
}

.guidance-card p {
  margin: 0;
  color: #33413f;
}

.guidance-card.emphasis {
  border-left: 5px solid var(--gold);
  background: #fffaf0;
}

.legal-page .guidance-hero {
  margin-bottom: 16px;
}

.amount-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 8px;
}

.amount-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: #fff;
}

.amount-options input {
  width: auto;
  min-height: auto;
}

.guide-section {
  margin-bottom: 28px;
}

.intro-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 18px;
  padding: 22px;
}

.intro-panel h2 {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 25px;
}

.intro-panel p {
  margin: 0 0 12px;
  color: #33413f;
}

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

.quick-list li {
  padding: 9px 10px;
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  background: var(--teal-2);
  color: var(--teal-dark);
  font-weight: 800;
}

.step-list {
  display: grid;
  gap: 14px;
  counter-reset: step;
}

.step-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
}

.step-number {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  color: #fff;
  background: var(--teal);
  font-weight: 900;
}

.step-card h3 {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 17px;
}

.step-card p {
  margin: 0 0 8px;
  color: #33413f;
}

.step-card ul,
.checklist ul {
  margin: 0;
  padding-left: 18px;
  color: #33413f;
}

.step-card li,
.checklist li {
  margin: 5px 0;
}

.note {
  display: inline-block;
  margin-top: 4px;
  padding: 5px 8px;
  border-radius: 999px;
  color: #5a4215;
  background: #fff7df;
  font-size: 12px;
  font-weight: 800;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.checklist,
.faq-item,
.callout {
  padding: 16px;
}

.checklist h3,
.faq-item h3,
.callout h3 {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 17px;
}

.callout {
  border-left: 5px solid var(--gold);
}

.callout p,
.faq-item p {
  margin: 0;
  color: #33413f;
}

.mini-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.flow-item {
  padding: 12px;
  text-align: center;
}

.flow-item strong {
  display: block;
  color: var(--teal-dark);
}

.flow-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1100px) {
  .criteria-workbench {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .topbar,
  .app-shell,
  .criteria-layout,
  .calculator-layout,
  .form-grid,
  .activity-grid,
  .calc-grid,
  .calc-item-summary,
  .calc-list-head,
  .calc-list-row,
  .intro-panel,
  .guidance-grid,
  .two-column,
  .mini-flow {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 16px;
  }

  .topbar-right {
    justify-items: stretch;
  }

  .status-strip {
    min-width: 0;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .tool-actions {
    justify-content: flex-start;
    min-width: 0;
  }

  .top-actions .secondary,
  .top-actions .import-button,
  .tool-actions .secondary,
  .top-actions .primary {
    flex: 0 1 auto;
    justify-content: center;
    text-align: center;
  }

  .editor-header {
    grid-template-columns: 1fr;
    align-items: start;
    justify-items: start;
  }

  .side-nav {
    position: static;
    display: flex;
    gap: 6px;
    height: auto;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .tab-button {
    min-width: 118px;
    justify-content: center;
    text-align: center;
  }

  .tab-button:hover {
    transform: none;
  }

  .rule-row {
    grid-template-columns: 1fr;
  }

  .calc-list-head {
    display: none;
  }

  .calc-group-header {
    display: grid;
  }

  .calc-group-header strong,
  .calc-list-row > strong:last-child {
    text-align: left;
  }

  .fixed-summary,
  .step-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .status-strip {
    grid-template-columns: 1fr;
  }

  .workspace,
  .calculator-shell {
    padding: 16px;
  }

  .top-actions,
  .actions-row,
  .card-actions,
  .contribution-actions {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .card-actions .primary,
  .card-actions .secondary,
  .card-actions .danger {
    flex: 1 1 138px;
  }

  .contribution-actions .primary,
  .contribution-actions .secondary {
    flex: 1 1 180px;
  }

  .contribution-modal-card {
    padding: 20px;
  }

  .contribution-modal-card .contribution-actions {
    grid-template-columns: 1fr;
  }

  .contribution-modal-card .amount-options label {
    flex: 1 1 120px;
  }

  .custom-contribution-field {
    max-width: none;
  }

  .contribution-visual {
    max-height: 260px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .side-nav,
  .section-heading,
  .generator-panel,
  .validation-box,
  .top-actions,
  .tool-actions {
    display: none !important;
  }

  body * {
    visibility: hidden !important;
  }

  body::before {
    content: "Impressão direta da página desabilitada. Use as funções próprias do sistema quando aplicável.";
    visibility: visible !important;
    display: block;
    margin: 3cm auto;
    max-width: 16cm;
    color: #000;
    font: 14pt Arial, sans-serif;
    text-align: center;
  }

  .app-shell,
  .workspace,
  .tab-panel {
    display: block;
    padding: 0;
  }

  .tab-panel:not(#tab-previa) {
    display: none;
  }

  .preview-document,
  .intro-panel,
  .callout,
  .step-card,
  .checklist,
  .faq-item {
    max-width: none;
    padding: 0;
    border: 0;
    box-shadow: none;
    break-inside: avoid;
  }
}
