@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/app/fonts/urbanist-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/app/fonts/urbanist-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/app/fonts/nunito-sans-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/app/fonts/nunito-sans-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Roboto Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/app/fonts/roboto-mono-latin-400-normal.woff2") format("woff2");
}

:root {
  --paper: #f8f8fa;
  --surface: #ffffff;
  --surface-hover: #f4f4f5;
  --ink: #0a0a0a;
  --muted: #52525b;
  --subtle: #71717a;
  --line: #e4e4e7;
  --line-strong: #a1a1aa;
  --accent: #18181b;
  --accent-ink: #ffffff;
  --accent-soft: #f4f4f5;
  --display: "Urbanist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ui: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px -4px rgba(0, 0, 0, 0.08);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #09090b;
    --surface: #121214;
    --surface-hover: #18181b;
    --ink: #f4f4f5;
    --muted: #a1a1aa;
    --subtle: #71717a;
    --line: #27272a;
    --line-strong: #3f3f46;
    --accent: #f4f4f5;
    --accent-ink: #09090b;
    --accent-soft: #1e1e22;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 12px 4px 60px;
}

/* Header Masthead */
.masthead {
  margin-bottom: 24px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
  min-height: 44px;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(26px, 6vw, 36px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.lede {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  max-width: 58ch;
}

h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Painéis */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

.panel:hover {
  border-color: var(--line-strong);
}

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

/* Badges e Pílulas */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--ui);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

.badge-subtle {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--muted);
  border: 1px solid var(--line);
}

/* COMBOBOX & LISTA SUSPENSA (SUGGEST) */
.combo {
  position: relative;
  width: 100%;
}

input[type="text"], input[type="search"] {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font: 400 16px/1.4 var(--ui);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent);
}

.suggest {
  list-style: none;
  margin: 6px 0 0;
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}

.suggest li {
  margin: 0;
  padding: 0;
}

.suggest button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  text-align: left;
  font: 600 15px/1.3 var(--ui);
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.suggest button:hover, .suggest button:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.suggest small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  font-family: var(--mono);
  color: var(--muted);
}

.hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.hint strong {
  color: var(--ink);
  font-weight: 600;
  font-family: var(--mono);
}

/* LISTA DE CONSULTAS (CHOICES) */
.choices {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.choice:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.choice[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.choice-title {
  display: block;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}

.choice-sub {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  margin-top: 2px;
}

/* BOTÕES */
button {
  font-family: inherit;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  font: 600 14px/1 var(--ui);
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  font: 600 14px/1 var(--ui);
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--surface-hover);
}

.btn-link {
  background: none;
  border: 0;
  color: var(--muted);
  font: 500 13px/1 var(--ui);
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 6px;
  min-height: 36px;
}

.btn-link:hover {
  color: var(--ink);
}

/* CARDS DE ARTEFATOS */
.artifact-card {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 16px;
}

.artifact-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}

.artifact-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  flex-shrink: 0;
}

.artifact-meta-title {
  flex: 1;
  min-width: 0;
}

.artifact-tag {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.artifact-name {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--ui);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.artifact-desc {
  margin: 6px 0 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.artifact-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* PROGRESS BAR */
.progress-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 16px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

.progress-track {
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  width: 25%;
  background: var(--ink);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

.step-dot.active {
  color: var(--ink);
  font-weight: 700;
}

/* DOCUMENTOS GERADOS (TABS E CONTEÚDO) */
.docs-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.tab-btn {
  padding: 8px 14px;
  font: 600 13px/1 var(--ui);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  min-height: 38px;
}

.tab-btn:hover {
  color: var(--ink);
}

.tab-btn[aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.doc-viewer {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
}

.doc-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.doc-viewer-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--display);
}

.doc-text {
  white-space: pre-wrap;
  font: 400 13px/1.6 var(--mono);
  color: var(--ink);
  margin: 0;
  max-height: 60vh;
  overflow-y: auto;
}

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

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
