.sd {
  --sd-ink: var(--text-main, #19362c);
  --sd-muted: #4d6258;
  --sd-surface: var(--bg-surface, #fff);
  --sd-border: var(--border-color, #d8e5de);
  --sd-accent: #0e6250;
  --sd-soft: #eaf5ee;
  --sd-error: #8c2f26;
  --sd-error-bg: #fdf0eb;
  --sd-shadow: 0 1px 2px rgb(16 54 44 / .06), 0 8px 24px rgb(16 54 44 / .06);
  color: var(--sd-ink);
}

html[data-theme="dark"] .sd {
  --sd-accent: #9ae2c5;
  --sd-muted: #abcdbe;
  --sd-soft: #253e33;
  --sd-error: #ffd0c6;
  --sd-error-bg: #492c2b;
  --sd-shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
}

.sd [hidden] { display: none !important; }
.sd :focus-visible, .sd-portal-header :focus-visible {
  outline: 2px solid var(--sd-accent, #0e6250);
  outline-offset: 3px;
}

.sd-workspace,
.sd-portal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem);
  gap: 16px;
  align-items: start;
}

.sd .sd-workspace, .sd .sd-dialog form {
  padding: 0;
  border: 0;
  background: transparent;
}

.sd-panel {
  min-width: 0;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--sd-border);
  border-radius: 12px;
  background: var(--sd-surface);
  color: var(--sd-ink);
}

.sd :is(form, section, fieldset, article, footer) { min-width: 0; }
.sd legend { padding: 0 5px; }
.sd-query { display: flex; flex-direction: column; gap: 12px; }
.sd-query > label { font-weight: 700; font-size: 1.12rem; }
.sd-query > button { align-self: flex-start; }
.sd summary { font-weight: 650; cursor: pointer; }
.sd details > .sd-form { margin-top: 17px; }
.sd-form { display: flex; flex-direction: column; gap: 13px; }
.sd :is(h1, h2, h3, h4, p) { margin: 0 0 8px; }
.sd p:last-child { margin-bottom: 0; }
.sd label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; font-weight: 600; }
.sd label.sd-check { flex-direction: row; align-items: center; font-weight: 500; }
.sd small, .sd-subtle { color: var(--sd-muted); font-size: .87rem; overflow-wrap: anywhere; }
.sd :is(input:not([type="checkbox"]), textarea, select) {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  box-sizing: border-box;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid var(--sd-border);
  border-radius: 8px;
  background: var(--sd-surface);
  color: var(--sd-ink);
  font: inherit;
  font-weight: 400;
}
.sd textarea { resize: vertical; line-height: 1.46; }
.sd select { appearance: auto; }
.sd input[type="checkbox"] { width: auto; margin: 0; flex: 0 0 auto; accent-color: #127059; }
.sd-states { display: grid; gap: 6px; max-height: 230px; overflow: auto; padding: 5px; }
.sd-states span { color: var(--sd-muted); font-size: .82rem; }

.sd-actions, .sd-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sd :is(.sd-primary, .sd-secondary, .sd-examples button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: .88rem;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.sd .sd-primary { color: #fff; background: #116552; }
.sd .sd-primary:hover { color: #fff; background: #0b4e40; }
.sd :is(.sd-secondary, .sd-examples button) { color: var(--sd-accent); background: var(--sd-soft); }
.sd :is(.sd-secondary, .sd-examples button):hover { border-color: var(--sd-accent); }
.sd .sd-examples button { border-radius: 999px; min-height: 34px; font-size: .81rem; }
.sd button:disabled { opacity: .55; cursor: progress; }
.sd .sd-link, .sd-portal-header .sd-link {
  width: fit-content;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--sd-accent, #0e6250);
  font: inherit;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.sd-status:not(:empty) { margin: 20px 0 10px; font-weight: 700; }
.sd-notice { padding: 10px 13px; border-radius: 8px; background: var(--sd-soft); color: var(--sd-ink); }
.sd-notice.sd-error { background: var(--sd-error-bg); color: var(--sd-error); }
.sd-order { margin: 12px 0; }
.sd-order summary span { display: block; margin: 3px 0 0 18px; font-weight: 400; }
.sd-item, .sd-columns { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sd-item {
  grid-template-columns: minmax(0, 1.2fr) minmax(6rem, .5fr) minmax(0, 1.4fr) auto;
  align-items: end;
  padding: 10px 0;
  border-bottom: 1px solid var(--sd-border);
}
.sd-item .sd-link { min-height: 42px; }
.sd-card-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 8px; }
.sd-card-header h3, .sd-evidence p, .sd-dialog :is(h3, label) { margin-bottom: 4px; }
.sd-card-header h3, .sd-evidence li, .sd-result p, .sd-preview p { overflow-wrap: anywhere; }
.sd-origin {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 650;
  color: var(--sd-accent);
  background: var(--sd-soft);
}
.sd-result, .sd-empty { margin: 12px 0; }
.sd-result h4 { margin-top: 10px; }
.sd-google-answer { white-space: pre-wrap; }
.sd-citation { display: inline-block; margin-left: .24em; color: var(--sd-accent); font-size: .82em; font-weight: 700; }
.sd #sd-copy-status:empty { display: none; }
.sd-google-sources { margin: 0 0 14px; padding-left: 20px; overflow-wrap: anywhere; }
.sd-google-suggestions { overflow: auto; }
.sd-evidence { margin: 0 0 12px; padding-left: 19px; }
.sd-evidence li + li { margin-top: 9px; }
.sd-delivery-note { padding: 9px 12px; background: var(--sd-soft); border-radius: 8px; }
.sd-source-list { margin-top: 10px; }
.sd-source-list ul { margin: 6px 0; padding-left: 20px; overflow-wrap: anywhere; }
.sd-contact-actions { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--sd-border); }
.sd-dialog {
  width: min(540px, calc(100% - 28px));
  box-sizing: border-box;
  padding: 21px;
  border: 1px solid var(--sd-border);
  border-radius: 12px;
  background: var(--sd-surface);
  color: var(--sd-ink);
}
.sd-dialog::backdrop { background: rgb(13 32 26 / .64); }
.sd-dialog .sd-actions { justify-content: flex-end; }

/* ===== Encontrar fornecedores: hero de busca ===== */
.sd-hero {
  display: grid;
  gap: 16px;
  margin: 0 0 8px;
  padding: 22px;
  border: 1px solid var(--sd-border);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--sd-soft), var(--sd-surface) 62%);
  box-shadow: var(--sd-shadow);
}
.sd-hero-main { display: flex; flex-direction: column; gap: 12px; }
.sd .sd-hero-label { font-size: 1.25rem; font-weight: 750; letter-spacing: -.01em; }
.sd-searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--sd-border);
  border-radius: 12px;
  background: var(--sd-surface);
  box-shadow: 0 1px 2px rgb(16 54 44 / .05);
}
.sd-searchbar:focus-within { border-color: var(--sd-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sd-accent) 22%, transparent); }
.sd-searchbar-icon { flex: 0 0 auto; color: var(--sd-accent); }
.sd .sd-searchbar textarea {
  flex: 1 1 auto;
  min-height: 48px;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
}
.sd .sd-searchbar .sd-submit { flex: 0 0 auto; min-height: 46px; padding: 8px 20px; font-size: .94rem; }
.sd-scope {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px dashed var(--sd-border);
}
.sd-scope > label { max-width: 22rem; }
.sd-scope .sd-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 12px; align-items: end; }
.sd-scope fieldset { margin: 0; padding: 10px; border: 1px solid var(--sd-border); border-radius: 10px; }

/* ===== Palco: busca em andamento + resultados ===== */
.sd-stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 12px; }
.sd-stage.is-loading { grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr); }
.sd-results[aria-busy="true"] > * { opacity: .45; transition: opacity .2s; }
.sd-panel-title { font-size: 1.1rem; font-weight: 750; }
.sd-loading { text-align: center; box-shadow: var(--sd-shadow); position: sticky; top: 12px; }
.sd-lens-wrap { width: min(100%, 210px); margin: 8px auto 14px; }
.sd-lens-svg { display: block; width: 100%; height: auto; overflow: visible; }
.sd-lens-halo { fill: var(--sd-soft); }
.sd-lens-track { fill: none; stroke: var(--sd-border); stroke-width: 2; stroke-dasharray: 3 7; stroke-linecap: round; }
.sd-lens-dot { fill: #1b9a78; }
.sd-lens-glass { fill: color-mix(in srgb, var(--sd-surface) 70%, transparent); }
.sd-lens-ring { fill: none; stroke: var(--sd-accent); stroke-width: 7; }
.sd-lens-shine { fill: none; stroke: var(--sd-accent); stroke-width: 3; stroke-linecap: round; opacity: .55; }
.sd-lens-handle { fill: none; stroke: var(--sd-accent); stroke-width: 10; stroke-linecap: round; }
.sd-lens-orbit { transform-origin: 100px 100px; animation: sd-orbit 5s linear infinite; }
.sd-lens-move { transform-origin: 100px 100px; animation: sd-sweep 2.8s ease-in-out infinite; }
.sd-lens-halo { animation: sd-pulse 2.4s ease-in-out infinite; transform-origin: 100px 100px; }
@keyframes sd-orbit { to { transform: rotate(360deg); } }
@keyframes sd-sweep {
  0%, 100% { transform: translate(-14px, -6px) rotate(-6deg); }
  50% { transform: translate(18px, 8px) rotate(6deg); }
}
@keyframes sd-pulse { 0%, 100% { opacity: .75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.03); } }

.sd-steps { display: grid; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; text-align: left; }
.sd-steps li {
  position: relative;
  padding: 9px 12px 9px 40px;
  border-radius: 10px;
  color: var(--sd-muted);
  font-size: .9rem;
  font-weight: 600;
}
.sd-steps li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  margin-top: -8px;
  border: 2px solid var(--sd-border);
  border-radius: 50%;
  background: var(--sd-surface);
}
.sd-steps li.is-current { background: var(--sd-soft); color: var(--sd-ink); }
.sd-steps li.is-current::before { border-color: var(--sd-accent); border-top-color: transparent; animation: sd-orbit 1s linear infinite; }
.sd-steps li.is-done { color: var(--sd-ink); }
.sd-steps li.is-done::before {
  border-color: #1b9a78;
  background: #1b9a78 radial-gradient(circle at 50% 50%, #fff 0 2px, transparent 3px);
}
.sd-loading-note { margin: 0; }

.sd-idle { text-align: center; padding: 34px 22px; border-style: dashed; margin: 0; }

/* ===== Resultados ===== */
.sd-results { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.sd-results-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; margin: 4px 0 2px; }
.sd-results-head .sd-panel-title { margin: 0; }
.sd-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 14px; }
.sd-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--sd-border);
  border-radius: 14px;
  background: var(--sd-surface);
  box-shadow: var(--sd-shadow);
  transition: border-color .15s, transform .15s;
}
.sd-card:hover { border-color: var(--sd-accent); }
.sd-card-header { flex-wrap: nowrap; justify-content: flex-start; align-items: center; gap: 12px; }
.sd-card-id { min-width: 0; flex: 1 1 auto; }
.sd-card-nameline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.sd-card-nameline h3 { margin: 0; font-size: 1.04rem; font-weight: 750; }
.sd-card-id p { margin: 2px 0 0; }
.sd-domain { color: var(--sd-accent); font-size: .84rem; font-weight: 600; overflow-wrap: anywhere; }
.sd-avatar {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, #127059, #1b9a78);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .02em;
}
.sd-avatar-logo { background: #fff; border: 1px solid var(--sd-border, #cfded6); overflow: hidden; }
.sd-avatar-logo img { display: block; width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.sd-origin-web { background: color-mix(in srgb, #1b9a78 16%, transparent); }
.sd-card-subtitle { margin: 0; font-size: .86rem; font-weight: 700; color: var(--sd-muted); text-transform: none; }
.sd-card-summary { margin: 0; line-height: 1.55; overflow-wrap: anywhere; }
.sd-card-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sd-card .sd-contact-actions { margin-top: auto; }
.sd-citation { text-decoration: none; padding: 0 2px; }
.sd-citation:hover { text-decoration: underline; }
.sd-google-intro { margin: 0; color: var(--sd-muted); }
.sd-google { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sd-google-answer { white-space: pre-wrap; overflow-wrap: anywhere; }

.sd .sd-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid var(--sd-border);
  border-radius: 999px;
  background: var(--sd-soft);
  color: var(--sd-accent);
  font-size: .8rem;
  font-weight: 650;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.sd .sd-chip:hover { border-color: var(--sd-accent); }
.sd-sources { padding: 14px 16px; border: 1px solid var(--sd-border); border-radius: 12px; background: var(--sd-surface); }
.sd-chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.sd-chip-list li { min-width: 0; }

/* Sugestões do Google: mantidas (exigência de exibição), sem barra vazia */
.sd-google-suggestions { overflow: auto; border-radius: 12px; }

.sd-empty h3 { margin-bottom: 6px; }
.sd-empty .sd-secondary { margin-top: 12px; }

.supplier-portal {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, sans-serif;
  background: #f3f8f5;
  color: #19362c;
}
.sd-portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px max(16px, calc((100% - 1020px) / 2));
  background: #fff;
  border-bottom: 1px solid #d8e5de;
}
.sd-portal-header a { color: #0e6250; }
.sd-portal-header .sd-brand { color: #19362c; font-weight: 800; font-size: 1.3rem; text-decoration: none; }
.sd-brand span { color: #127059; }
.sd-portal-main { width: min(calc(100% - 32px), 460px); margin: 38px auto; }
.sd-portal-wide { width: min(calc(100% - 32px), 1020px); }
.sd-portal-main h1 { font-size: clamp(1.55rem, 5vw, 2.2rem); margin-bottom: 17px; }
.sd-portal-main h2 { font-size: 1.16rem; }
.sd-portal-learn { margin-top: 14px !important; font-size: .9rem; }
.sd-portal-main fieldset { display: flex; flex-direction: column; gap: 12px; }
.sd-portal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.sd-pause { margin-top: 16px; }
.sd-portal-status, .sd-preview { margin-bottom: 16px !important; }
.sd .sd-region-dialog form { margin-top: 15px; }
.sd-region-options { margin: 0; min-width: 0; padding: 12px; border: 1px solid var(--sd-border); border-radius: 8px; }
.sd-region-options .sd-check { cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .sd-lens-orbit, .sd-lens-move, .sd-lens-halo, .sd-steps li.is-current::before { animation: none; }
  .sd-lens-move { transform: translate(2px, 2px); }
  .sd-steps li.is-current::before { border-top-color: var(--sd-accent); }
  .sd-card, .sd-results[aria-busy="true"] > * { transition: none; }
}

@media (max-width: 800px) {
  .sd-workspace, .sd-portal-grid { grid-template-columns: minmax(0, 1fr); }
  .sd-panel { padding: 15px; }
  .sd-item { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sd-portal-main { margin-top: 23px; }
  .sd-hero { padding: 16px; }
  .sd-stage.is-loading { grid-template-columns: minmax(0, 1fr); }
  .sd-loading { position: static; }
  .sd-lens-wrap { width: 150px; }
}

@media (max-width: 560px) {
  .sd-searchbar { flex-wrap: wrap; padding: 10px; }
  .sd-searchbar-icon { display: none; }
  .sd .sd-searchbar textarea { flex-basis: 100%; }
  .sd .sd-searchbar .sd-submit { width: 100%; }
}

@media (max-width: 390px) {
  .sd-columns { grid-template-columns: minmax(0, 1fr); }
  .sd-item { grid-template-columns: minmax(0, 1fr); }
  .sd-card { padding: 14px; }
}
