*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  line-height: 1.5;
  color: var(--color-brand-dark);
  background: var(--surface-page);
}

.site-header {
  background: linear-gradient(180deg, var(--color-brand-light) 0%, var(--color-brand-lighter) 100%);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
}

.brand {
  color: var(--color-brand-dark);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}

.app-main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  min-height: 60vh;
}

.offline-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.45rem 0.75rem;
  background: #fff3cd;
  color: #5c4d00;
  font-size: 0.85rem;
  text-align: center;
  border-bottom: 1px solid #e6d89a;
}

.app-loading {
  text-align: center;
  padding: 2rem 0;
}

.legal-page {
  max-width: 36rem;
}

.legal-body h2,
.legal-body h3 {
  font-family: var(--font-display);
  color: var(--color-brand-dark);
  font-size: 1.05rem;
  margin: 1.25rem 0 0.4rem;
}

.legal-body p {
  margin: 0.5rem 0;
  line-height: 1.55;
  color: var(--color-brand-muted);
}

.legal-static-note {
  margin-top: 1.25rem;
  font-size: 0.85rem;
}

.prefs-meta {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border-soft);
}

.prefs-legal-links {
  font-size: 0.88rem;
}

.prefs-legal-links a {
  color: var(--color-brand);
}

.lead {
  color: var(--color-brand-muted);
}

.home-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-block;
  padding: 0.68rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  color: inherit;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: transform 0.12s ease;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-secondary {
  background: var(--surface-card);
  border-color: var(--color-border);
  color: var(--color-brand-dark);
}

.btn-link {
  border: none;
  background: none;
  color: var(--color-brand);
  text-decoration: underline;
  box-shadow: none;
  font-weight: 500;
}

.btn-choice {
  width: 100%;
  text-align: left;
  margin-bottom: 0.35rem;
}

.choice-group {
  margin: 1rem 0;
}

.breadcrumb,
.step-meta,
.muted {
  color: var(--color-brand-muted);
  font-size: 0.9rem;
}

.field-label {
  display: block;
  font-weight: 600;
  margin: 1rem 0 0.35rem;
}

.field-hint {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--color-brand-muted);
}

.field-block .btn-secondary[data-needs-open] {
  margin-bottom: 0.5rem;
}

.privacy-home,
.privacy-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface-muted);
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--color-brand-muted);
  font-weight: 500;
}

.privacy-home {
  margin: 1rem 0 0;
}

.privacy-banner {
  margin: 0 0 1rem;
}

.empty-field-reminder {
  background: var(--surface-notice);
  border: 1px solid #e6d9a8;
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin: 0.75rem 0 0;
}

.reminder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.end-privacy {
  margin: 0.75rem 0 1rem;
}

textarea {
  width: 100%;
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  resize: vertical;
}

.wizard-nav {
  margin-top: 1.5rem;
}

.node-body p,
.example-text p {
  margin: 0.75rem 0;
}

.node-body h3,
.example-text h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.05rem;
}

.node-body h4,
.example-text h4 {
  margin: 1rem 0 0.35rem;
  font-size: 0.98rem;
}

.notebook-label {
  font-weight: 600;
}

.summary-text {
  white-space: pre-wrap;
  font: inherit;
  background: var(--surface-card);
  padding: 0.75rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.summary section {
  margin-bottom: 1rem;
}

.notice {
  background: var(--surface-notice);
  border: 1px solid #e6d9a8;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
}

.examples-intro {
  margin: 0 0 1.1rem;
  line-height: 1.55;
  color: var(--color-text);
}

.examples-intro p {
  margin: 0 0 0.65rem;
}

.examples-intro p:last-child {
  margin-bottom: 0;
}

.examples-intro a {
  color: var(--color-brand);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.examples-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.examples-list a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.68rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--surface-card);
  border: 1.5px solid var(--color-border);
  text-decoration: none;
  color: var(--color-brand-dark);
  font-weight: 600;
}

.examples-list a:hover {
  background: var(--color-brand-icon-bg);
}

.history-item {
  background: var(--surface-card);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-card);
}

.history-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.history-item-head h2 {
  margin: 0;
  font-size: 1rem;
  font-family: var(--font-display);
  color: var(--color-brand-dark);
  line-height: 1.3;
}

.history-date {
  margin: 0.25rem 0 0.35rem;
  font-size: 0.82rem;
}

.history-preview {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.45;
}

.history-item a {
  color: var(--color-brand);
  font-weight: 600;
}

.badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  background: var(--color-brand-icon-bg);
  color: var(--color-brand-muted);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  white-space: nowrap;
}

.badge--done {
  background: #e8f5ec;
  color: #2d6a3e;
}

.badge--draft {
  background: #fff4e6;
  color: #9a6b1a;
}

.history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 1rem;
}

.history-filter {
  border: 1.5px solid var(--color-border);
  background: var(--surface-card);
  color: var(--color-brand-muted);
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.history-filter.is-active {
  background: var(--color-brand-icon-bg);
  border-color: var(--color-brand);
  color: var(--color-brand-dark);
  font-weight: 600;
}

.history-stats {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
}

.history-notice {
  margin: 0.5rem 0 1rem;
  padding: 0.65rem 0.85rem;
  background: #fff8e8;
  border-radius: var(--radius-md);
  border: 1px solid #f0e0b8;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.history-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--color-border);
  background: var(--surface-card);
  color: var(--color-brand-dark);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

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

.history-btn--danger {
  color: #a33;
  border-color: #e8c4c4;
  background: #fffafa;
}

.history-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0 0.75rem;
}

.history-bulk-danger {
  color: #a33;
  border-color: #e8c4c4;
}

.history-empty {
  padding: 1rem 0;
}

.summary-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.summary-meta {
  margin: -0.25rem 0 1rem;
}

.summary--page {
  background: var(--surface-card);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.summary-section h3 {
  font-size: 0.95rem;
  margin: 0.75rem 0 0.35rem;
  color: var(--color-brand-dark);
}

.summary-section:first-child h3 {
  margin-top: 0;
}

.prefs-check {
  font-weight: 600;
}

.prefs-hint {
  margin: 0.25rem 0 0.75rem;
  font-size: 0.85rem;
}

.prefs-select-label {
  display: block;
  margin-top: 0.75rem;
  font-weight: 600;
}

.prefs-select {
  display: block;
  width: 100%;
  max-width: 16rem;
  margin-top: 0.35rem;
  padding: 0.45rem 0.6rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font: inherit;
  background: #fff;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(61, 47, 92, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
}

.overlay[hidden] {
  display: none;
}

body.needs-sheet-open {
  overflow: hidden;
}

.needs-sheet {
  background: var(--surface-page);
  width: 100%;
  max-width: 28rem;
  max-height: 90vh;
  border-radius: 18px 18px 0 0;
  border: 1.5px solid var(--color-border);
  border-bottom: none;
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.85rem 0.85rem;
  box-shadow: 0 -8px 32px rgba(61, 47, 92, 0.15);
}

.needs-sheet-handle {
  width: 2.5rem;
  height: 0.25rem;
  background: var(--color-border);
  border-radius: var(--radius-pill);
  margin: 0.15rem auto 0.5rem;
}

.needs-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.needs-sheet-header h2 {
  font-family: var(--font-display);
  color: var(--color-brand-dark);
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.2;
}

.needs-sheet-sub {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--color-brand-muted);
}

.needs-sheet-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: var(--color-brand-icon-bg);
  color: var(--color-brand-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.needs-axes-strip {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  margin-bottom: 0.35rem;
  scrollbar-width: none;
}

.needs-axes-strip::-webkit-scrollbar {
  display: none;
}

.needs-axis-pill {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.55rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-brand-dark);
}

.needs-axis-pill-num {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--color-brand);
  color: #fff;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.needs-search-wrap {
  margin-bottom: 0.35rem;
}

#needs-search {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font: inherit;
  font-size: 0.92rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: #fff;
  outline: none;
}

#needs-search:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 2px rgba(125, 107, 168, 0.2);
}

.needs-selected-bar {
  padding: 0.3rem 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-brand);
  text-align: center;
}

.needs-list {
  overflow: auto;
  flex: 1;
  min-height: 8rem;
  padding-right: 0.15rem;
}

.needs-category {
  margin-bottom: 0.75rem;
}

.needs-category-title {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 0.88rem;
  color: var(--color-brand-dark);
}

.needs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
}

.needs-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.38rem 0.65rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: #fff;
  font-size: 0.82rem;
  color: var(--color-brand-dark);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  line-height: 1.25;
}

.needs-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
  margin: 0;
}

.needs-chip span {
  pointer-events: none;
}

.needs-chip--on {
  background: var(--color-brand-icon-bg);
  border-color: var(--color-brand);
  font-weight: 600;
}

.needs-empty {
  text-align: center;
  color: var(--color-brand-muted);
  font-size: 0.88rem;
  padding: 1rem 0;
}

.needs-sheet-footer {
  padding-top: 0.65rem;
}

.needs-apply-btn {
  width: 100%;
  border-radius: var(--radius-pill);
  padding: 0.65rem 1rem;
  font-weight: 700;
}

.overlay-panel {
  /* alias legado */
}

.node-content {
  margin: 1rem 0;
}

.text-block {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
}

.text-orientacao {
  background: var(--surface-orientacao);
  border-left: 4px solid var(--color-brand);
}

.text-exemplo-contextual {
  background: rgba(255, 255, 255, 0.7);
  border: 1.5px dashed var(--color-border);
}

.text-explicacao {
  background: var(--surface-card);
  border: 1px solid var(--color-border);
  font-size: 0.98rem;
}

.text-resumo-necessidades {
  background: #f0f4ff;
  border: 1px dashed #7a8fc9;
  font-size: 0.92rem;
}

.text-explicacao-gate {
  background: var(--surface-notice);
  border: 1px solid #e6d9a8;
  padding: 0;
}

.gate-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.exemplo-toggle {
  background: none;
  border: none;
  color: var(--color-brand);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  padding: 0;
  margin-bottom: 0.5rem;
}

.exemplo-panel[hidden] {
  display: none;
}

.prefs-form fieldset {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: var(--surface-card);
}

.prefs-form legend {
  font-family: var(--font-display);
  color: var(--color-brand-dark);
  font-weight: 700;
}

.prefs-form label {
  display: block;
  margin: 0.35rem 0;
}

h1 {
  font-family: var(--font-display);
  color: var(--color-brand-dark);
}
