.quotes {
  --ink: #20362d;
  --sage: #e9efe4;
  --paper: #fafbf8;
  color: var(--ink);
  background: #f4f5ef;
  display: grid;
  grid-template-columns: 195px minmax(0, 1fr);
  margin: 0;
  min-height: 100vh;
}
.quotes * {
  box-sizing: border-box;
}
.rail {
  background: #1e342b;
  color: #f9fbf4;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.rail .brand {
  font-size: 1.55rem;
  color: #fff;
  text-decoration: none;
  padding: 0 0.55rem;
}
.rail nav {
  display: grid;
  gap: 0.3rem;
}
.rail nav a {
  color: #dfe8df;
  padding: 0.75rem 0.65rem;
  text-decoration: none;
  border-radius: 0.45rem;
}
.rail nav a[aria-current] {
  background: #385342;
  color: #fff;
  font-weight: 700;
}
#account-name {
  font-size: 0.72rem;
  overflow-wrap: anywhere;
  margin-top: auto;
}
.quotes main {
  margin: 0;
  width: 100%;
  max-width: 1650px;
  padding: 1.25rem clamp(0.85rem, 2.6vw, 2.75rem) 4rem;
  min-width: 0;
}
.crumb,
.heading,
.toolbar,
.actions,
dialog header,
.row,
.metric-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.crumb {
  font-size: 0.78rem;
  border-bottom: 1px solid var(--line, rgba(59, 58, 166, 0.14));
  padding: 0.5rem 0 1rem;
}
.crumb a,
.quotes a {
  color: inherit;
}
.heading {
  margin: 1.5rem 0;
}
.heading h1 {
  font-size: clamp(1.8rem, 3vw, 2.75rem);
}
.quotes button,
.button {
  min-height: 44px;
  font-size: 0.95rem;
  line-height: 1.25;
  padding: 0.72rem 1rem;
  border-radius: 0.6rem;
  touch-action: manipulation;
}
.quotes input,
.quotes select {
  min-height: 48px;
  padding: 0.7rem 0.8rem;
  font-size: 1rem;
  border-radius: 0.55rem;
}
.button {
  display: inline-block;
  background: #284d38;
  color: white !important;
  text-decoration: none;
  font-weight: 700;
}
.quotes .light,
.result {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line, rgba(59, 58, 166, 0.14));
}
.quotes .subtle {
  background: transparent;
  color: #32543b;
  padding: 0.35rem 0.45rem;
  text-decoration: underline;
}
.quotes label {
  font-size: 0.8rem;
}
.quotes textarea {
  font: inherit;
  padding: 0.7rem;
  border: 1px solid var(--line, rgba(59, 58, 166, 0.14));
  border-radius: 0.45rem;
  width: 100%;
  min-height: 4rem;
}
#notice:not(:empty) {
  background: #fff7e0;
  padding: 0.75rem 1rem;
  border-radius: 0.4rem;
  margin: 1rem 0;
  color: #6e4217;
}
#save-state {
  font-weight: 650;
  color: #45683f;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.metric {
  padding: 1rem;
  border-radius: 0.65rem;
  background: #e5ecdf;
}
.metric strong {
  font-size: 1.5rem;
  display: block;
}
.metric span {
  font-size: 0.8rem;
}
.box {
  background: #fff;
  border: 1px solid var(--line, rgba(59, 58, 166, 0.14));
  border-radius: 0.8rem;
  padding: clamp(0.85rem, 1.7vw, 1.35rem);
  min-width: 0;
}
.box h2 {
  font-size: 1.15rem;
  margin-bottom: 0.85rem;
}
.stack {
  display: grid;
  gap: 0.85rem;
  align-content: start;
  min-width: 0;
}
.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(235px, 290px);
  gap: 1rem;
  align-items: start;
}
.summary {
  position: sticky;
  top: 1rem;
}
.summary .metric-line {
  padding: 0.35rem 0;
  font-size: 0.86rem;
}
.summary .grand {
  padding: 1rem 0;
  border-top: 1px solid #ced7cf;
  font-size: 1.1rem;
}
.summary .actions,
.summary .actions button {
  width: 100%;
}
.actions {
  justify-content: flex-start;
}
.inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr));
  gap: 0.75rem;
  align-items: end;
}
.catalog {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin: 0.85rem 0;
}
.product-section {
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--line, rgba(59, 58, 166, 0.14));
  border-radius: 0.8rem;
  background: #fff;
}
.product-section > h3 {
  margin: 0 0 0.75rem;
  padding: 0 0 0.65rem;
  border-bottom: 1px solid var(--line, rgba(59, 58, 166, 0.14));
  font-size: 0.98rem;
  line-height: 1.45;
}
.product-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 0.7rem;
}
.catalog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.catalog-heading h2 {
  margin: 0;
}
.catalog-heading p {
  margin: 0.2rem 0 0;
}
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.45rem 0 0.8rem;
}
.category-chip {
  border: 1px solid var(--line, rgba(59, 58, 166, 0.14));
  border-radius: 999px;
  min-height: 44px;
  padding: 0.62rem 0.95rem;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}
.category-chip span {
  margin-left: 0.25rem;
  color: #57695d;
  font-size: 0.78rem;
}
#category-filters .category-chip span,
.model-choice > span:nth-child(2) {
  display: none;
}
.model-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
}
.model-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-height: 64px;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line, rgba(59, 58, 166, 0.14));
  border-radius: 0.9rem;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  text-align: left;
  box-shadow: 0 2px 8px rgb(28 48 35 / 5%);
}
.model-choice:hover,
.model-choice:focus-visible {
  border-color: #577c58;
  background: #f6f9f2;
}
.step-caption {
  margin: 0 0 0.7rem;
  color: #57695d;
  font-size: 0.88rem;
  font-weight: 600;
}
.product-option { min-width: 0; }
.option-price {
  color: #315d38 !important;
  font-size: 1.06rem !important;
  font-weight: 750 !important;
}
.option-price.pending { color: #7b5b16 !important; font-size: 0.9rem !important; }
.category-chip.selected {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}
.category-chip.selected span {
  color: white;
}
.select-hint {
  font-weight: 600;
}
.quotes .result {
  display: grid;
  gap: 0.4rem;
  text-align: left;
  width: 100%;
  min-height: 104px;
  padding: 1rem 1.1rem;
  background: var(--paper);
  border-radius: 0.8rem;
  transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}
.quotes .result.quick-add {
  border-left: 4px solid #577c58;
}
.quotes .result:hover {
  border-color: #577c58;
  background: #f6f9f2;
}
.quotes .result:active {
  transform: scale(0.99);
}
.quotes .result:disabled {
  opacity: 0.7;
  cursor: progress;
}
.result strong {
  font-size: 1rem;
  line-height: 1.35;
}
.result span:nth-of-type(2) {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
}
.select-hint {
  color: #2d5c37 !important;
  font-weight: 700;
}
.result span,
.hint,
.quiet {
  color: #57695d;
  font-size: 0.8rem;
  line-height: 1.5;
}
.result img {
  height: 80px;
  max-width: 100%;
  object-fit: contain;
}
.quotes table {
  font-size: 0.8rem;
}
.quotes td,
.quotes th {
  white-space: normal;
  text-align: left;
  vertical-align: top;
}
.quotes .scroll {
  overflow: auto;
  max-width: 100%;
}
.quotes .items {
  min-width: 760px;
}
.quotes .listing {
  min-width: 960px;
}
.quotes details {
  margin-top: 0.55rem;
}
.quotes summary {
  font-size: 0.85rem;
}
.badge {
  display: inline-block;
  background: var(--sage);
  border-radius: 2rem;
  padding: 0.22rem 0.6rem;
  white-space: nowrap;
}
.quotes dialog {
  border: 1px solid var(--line, rgba(59, 58, 166, 0.14));
  border-radius: 0.8rem;
  width: min(680px, 94vw);
  max-height: 88vh;
  color: var(--ink);
  padding: 1.3rem;
}
.quotes dialog::backdrop {
  background: #11261bd6;
}
.quotes dialog header {
  margin-bottom: 1rem;
}
.quotes pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.empty {
  padding: 1.1rem 0;
  color: #596959;
}
.rule-json {
  font-family: monospace !important;
  min-height: 9rem !important;
}
@media (max-width: 1050px) {
  .quotes {
    grid-template-columns: 145px minmax(0, 1fr);
  }
  .editor {
    grid-template-columns: minmax(0, 1fr) 225px;
  }
}
@media (max-width: 800px) {
  .quotes {
    display: block;
  }
  .rail {
    position: static;
    height: auto;
    padding: 0.65rem 1rem;
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
  }
  .rail nav {
    display: flex;
  }
  .rail nav a {
    font-size: 0.75rem;
    padding: 0.5rem;
  }
  .rail #account-name {
    display: none;
  }
  .editor {
    grid-template-columns: 1fr;
  }
  .summary {
    position: static;
  }
  .quotes main {
    padding: 0.75rem 0.8rem 3rem;
  }
  .metrics {
    gap: 0.4rem;
  }
  .metric {
    padding: 0.7rem;
  }
  .heading {
    margin: 1rem 0;
  }
}
@media (max-width: 600px) {
  .quotes main {
    padding: 0.65rem 0.65rem 3rem;
  }
  .heading {
    align-items: flex-start;
  }
  .heading .actions {
    gap: 0.35rem;
  }
  .box {
    padding: 0.85rem;
  }
  .category-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }
  .category-chip {
    width: 100%;
    padding: 0.6rem 0.65rem;
    text-align: left;
    font-size: 0.84rem;
  }
  .catalog {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .product-section {
    padding: 0.65rem;
  }
  .product-section-grid {
    grid-template-columns: 1fr;
  }
  .quotes .result {
    min-height: 76px;
    padding: 0.85rem;
  }
  .model-grid { grid-template-columns: 1fr; }
  .model-choice { min-height: 60px; }
  .quote-metadata summary,
  .quotes details summary {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .editor > .summary {
    position: sticky;
    z-index: 5;
    bottom: 0;
    width: 100%;
    max-height: none;
    overflow: visible;
    padding: 0.65rem 0.85rem calc(0.65rem + env(safe-area-inset-bottom));
    border-radius: 1rem 1rem 0 0;
    box-shadow: 0 -8px 28px #20362d24;
  }
  .editor > .summary h2 {
    display: none;
  }
  .summary #totals > .metric-line:not(:first-child):not(.grand) {
    display: none;
  }
  .summary .metric-line:first-child {
    padding: 0.1rem 0;
    font-size: 0.78rem;
  }
  .summary .metric-line.grand {
    padding: 0.25rem 0 0.45rem;
    border-top: 0;
    font-size: 1rem;
  }
  .summary .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }
  .summary .actions button {
    width: 100%;
    min-height: 48px;
  }
  #composition .items,
  #composition .items tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }
  #composition .items thead {
    display: none;
  }
  #composition .items tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.15rem 0.45rem;
    margin-bottom: 0.7rem;
    padding: 0.5rem;
    border: 1px solid var(--line, rgba(59, 58, 166, 0.14));
    border-radius: 0.7rem;
  }
  #composition .items td {
    min-width: 0;
    border: 0;
    padding: 0.4rem;
    overflow-wrap: anywhere;
  }
  #composition .items td:first-child,
  #composition .items td:nth-child(2),
  #composition .items td:nth-child(3),
  #composition .items td:last-child {
    grid-column: 1 / -1;
  }
  #composition .items td:first-child {
    border-radius: 0.45rem;
    background: var(--sage);
    font-weight: 700;
  }
  #composition .items td:nth-child(4)::before { content: 'Medidas (mm): '; }
  #composition .items td:nth-child(5)::before { content: 'Quantidade: '; }
  #composition .items td:nth-child(6)::before { content: 'Unidade: '; }
  #composition .items td:nth-child(7)::before { content: 'Unitário: '; }
  #composition .items td:nth-child(8)::before { content: 'Desconto: '; }
  #composition .items td:nth-child(9)::before { content: 'Total: '; font-weight: 700; }
  #composition .items td:nth-child(2) small {
    color: #57695d;
  }
}

/* Seletor de esquadrias */
#selector [hidden], #selector .actions button:disabled { display: none; }
#selector { border-radius: 16px; }
#selector .catalog-heading h2 { font-size: 1.35rem; letter-spacing: -.025em; }
#selector .catalog { margin: 0; }
.picker-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-top: 1rem; border-top: 1px solid #dbe3da; }
.picker-header h3 { margin: .18rem 0; font-size: 1.16rem; letter-spacing: -.02em; }
.picker-header small, .picker-option small { color: #4b6858; font-size: .88rem; }
#selector .picker-back { min-height: 44px; background: transparent; color: #345c47; border: 0; }
.picker-options { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,175px),1fr)); gap: .6rem; }
#selector .picker-option { display: flex; align-items: center; gap: .65rem; min-height: 60px; padding: .8rem 1rem; border: 1px solid var(--line, rgba(59, 58, 166, 0.14)); background: #fff; color: #203d30; border-radius: 12px; text-align: left; font: inherit; cursor: pointer; }
#selector .picker-option:hover, #selector .picker-option:focus-visible { background: #eef5ef; border-color: #497759; }
.picker-option strong, .picker-option small { display: block; }
.picker-option small { margin-top: .2rem; font-variant-numeric: tabular-nums; }
.picker-option b { margin-left: auto; color: #456651; font-size: 1.25rem; }
.picker-option i { width: 1.35rem; height: 1.35rem; border-radius: 50%; border: 1px solid rgba(24, 26, 61, 0.25); flex: none; }
.picker-option [data-color="Brilhante"] { background: linear-gradient(130deg,#84928d,#f8faf9 50%,#8b9893); }
.picker-option [data-color="Preto"] { background: #252926; }
.picker-option [data-color="Branco"] { background: #fff; }
@media(max-width: 600px) {
  .picker-options { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #selector .picker-option { padding: .7rem; }
}


/* Tabelas que viram cartões no celular (ex.: Equipe). Cada célula usa data-label como rótulo. */
.quotes .listing.cards td { vertical-align: middle; }
@media (max-width: 600px) {
  .quotes .scroll:has(> .listing.cards) { overflow: visible; }
  .quotes .listing.cards, .quotes .listing.cards tbody { display: block; width: 100%; min-width: 0; }
  .quotes .listing.cards thead { display: none; }
  .quotes .listing.cards tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.15rem 0.45rem;
    margin-bottom: 0.7rem;
    padding: 0.5rem;
    border: 1px solid var(--line, rgba(59, 58, 166, 0.14));
    border-radius: 0.7rem;
  }
  .quotes .listing.cards td { min-width: 0; border: 0; padding: 0.4rem; overflow-wrap: anywhere; }
  .quotes .listing.cards td:first-child { grid-column: 1 / -1; border-radius: 0.45rem; background: var(--sage); }
  .quotes .listing.cards td.wide, .quotes .listing.cards td:last-child { grid-column: 1 / -1; }
  .quotes .listing.cards td[data-label]::before { content: attr(data-label) ': '; color: #5b6b7f; font-size: 0.85em; }
  .quotes .listing.cards td:last-child button { width: 100%; min-height: 44px; }
  .quotes .listing.cards td:last-child:empty { display: none; }
}

/* Indicadores clicáveis (atalhos de filtro) e alerta de lead parado. */
.quotes button.metric { text-align: left; font: inherit; color: inherit; cursor: pointer; }
.quotes button.metric:hover, .quotes button.metric:focus-visible { outline: 2px solid #2f6fed; outline-offset: 2px; }
.quotes .metric-alert strong, .quotes .badge.alert { color: #b4530a; }
.quotes .badge.alert { background: #fff1e6; font-weight: 700; }
.quotes label.check { display: flex; align-items: center; gap: 0.5rem; align-self: end; min-height: 44px; }
.quotes label.check input { width: auto; min-height: 0; }

/* Celular: navegação numa linha só (rola para o lado) e conteúdo nunca escondido atrás da barra fixa do total. */
@media (max-width: 800px) {
  .rail nav { min-width: 0; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .rail nav a { white-space: nowrap; flex: none; }
}
@media (max-width: 600px) {
  html:has(.editor) { scroll-padding-bottom: calc(10rem + env(safe-area-inset-bottom)); }
}

/* Botão de conversa no WhatsApp e indicadores-botão com a mesma largura dos demais. */
.quotes a.whatsapp {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0.45rem 0.9rem;
  border-radius: 0.6rem; background: #1f9d55; color: #fff; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.quotes a.whatsapp:hover, .quotes a.whatsapp:focus-visible { background: #17803f; }
.quotes button.metric { display: block; width: 100%; border: 0; background: #fff; }

/* Bandeiras de orçamento parado: verde 1–2 dias, amarela 3–6, vermelha 7+. */
.quotes .flag { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; margin-right: 0.35rem; vertical-align: 0.05em; }
.quotes .flag-verde { background: #1f9d55; }
.quotes .flag-amarela { background: #e5a50a; }
.quotes .flag-vermelha { background: #d93025; }
.quotes .flag-chip { display: inline-flex; align-items: center; margin: 0.3rem 0 0; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.quotes .flag-chip-verde { background: #e7f6ed; color: #17663a; }
.quotes .flag-chip-amarela { background: #fdf3d7; color: #7a5600; }
.quotes .flag-chip-vermelha { background: #fde8e6; color: #a1231a; }
.quotes td .badge + .flag-chip { display: flex; width: fit-content; }

/* Catálogo guiado: trilha de escolhas e observação da peça na medida. */
.quotes #guide .category-filters { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.4rem; }
.quotes #guide .category-chip span { font-weight: 400; opacity: 0.75; margin-right: 0.2rem; }
.quotes #guide .picker-option small { display: block; }
.quotes #guide .option-note { color: #7a5600; font-weight: 600; }
@media (max-width: 600px) {
  .quotes #guide .picker-options { grid-template-columns: 1fr; }
}
.quotes #guide .picker-option > small { margin-left: auto; white-space: nowrap; color: #5b6b7f; font-size: 0.8rem; }

/* Painel do gestor */
.quotes .hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; align-items: end; }
.quotes .hero > div { display: grid; gap: 0.25rem; }
.quotes .hero-value { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.1; }
.quotes .progress { display: inline-block; width: 120px; height: 8px; border-radius: 999px; background: #e3e8f0; vertical-align: middle; overflow: hidden; }
.quotes .hero .progress { width: 100%; height: 10px; }
.quotes .progress-bar { display: block; height: 100%; border-radius: inherit; }
.quotes .progress-bar.good { background: #1f9d55; }
.quotes .progress-bar.mid { background: #e5a50a; }
.quotes .progress-bar.low { background: #e8590c; }
.quotes .good-text { color: #17663a; font-weight: 700; }
.quotes a.metric { text-decoration: none; color: inherit; }
.quotes .metric-danger strong { color: #a1231a; }
.quotes .split { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.quotes .month-picker { display: flex; align-items: center; gap: 0.4rem; }
