:root {
  --red: #e30613;
  --ink: #222222;
  --muted: #5c5854;
  --line: #e4e0da;
  --paper: #f1f5f4;
  --card: #ffffff;
  --ok: #0f6b3c;
  --ok-bg: #e5f6ec;
  --proposta: #0b4f8a;
  --proposta-bg: #e7f1fa;
  --follow: #8a5a00;
  --follow-bg: #fff4d6;
  --none: #8d1d24;
  --none-bg: #fde8ea;
}

* { box-sizing: border-box; }

body.has-sync { padding-bottom: 72px; }
body {
  margin: 0;
  padding-bottom: 16px;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.4;
}

.sync-dock {
  position: fixed;
  z-index: 20;
  left: 16px;
  bottom: 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  -webkit-tap-highlight-color: transparent;
}
.sync-when {
  margin: 0;
  min-width: 0;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.15;
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--paper);
  -webkit-user-select: none;
  user-select: none;
}
.sync-state {
  width: 38px;
  height: 38px;
  flex: none;
  border: 0;
  border-radius: 999px;
  background: var(--ok);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.sync-state:focus { outline: none; }
.sync-state::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 6V3L8 7l4 4V8c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l1.46 1.46A6.97 6.97 0 0 0 19 13c0-3.87-3.13-7-7-7zm0 12c-2.76 0-5-2.24-5-5 0-.65.13-1.26.36-1.83L5.9 9.71A6.97 6.97 0 0 0 5 13c0 3.87 3.13 7 7 7v3l4-4-4-4v3z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 6V3L8 7l4 4V8c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l1.46 1.46A6.97 6.97 0 0 0 19 13c0-3.87-3.13-7-7-7zm0 12c-2.76 0-5-2.24-5-5 0-.65.13-1.26.36-1.83L5.9 9.71A6.97 6.97 0 0 0 5 13c0 3.87 3.13 7 7 7v3l4-4-4-4v3z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ask {
  border: 0;
  border-radius: 16px;
  padding: 20px;
  width: min(420px, calc(100% - 32px));
}
.ask::backdrop { background: rgba(0, 0, 0, 0.45); }
.ask h2 { margin: 0 0 8px; font-size: 1.25rem; }
.ask p { margin: 0 0 12px; }
.ask .button { margin-top: 8px; }
.ask-drop { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.sync-state[data-mode="wait"] { background: var(--proposta); }
.sync-state[data-mode="bad"] { background: var(--red); }
.sync-state[data-mode="off"] { background: var(--muted); }
.sync-state.sync-spin::before { animation: sync-spin 0.7s ease; }
@keyframes sync-spin { to { transform: rotate(360deg); } }

.top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 3px solid var(--red);
}
.top-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.logo-link { display: flex; line-height: 0; }
.logo { height: 28px; width: auto; }

@media (max-width: 720px) {
  .top { gap: 4px 8px; padding: 6px 12px; }
  .logo { height: 22px; }
  .eyebrow { font-size: 11px; }
  .stand { gap: 8px; margin-bottom: 8px; padding: 8px 12px; }
  .stand p { font-size: 0.75rem; }
  .stand strong { font-size: 1.05rem; }
  main { padding: 12px; }
}

.stand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px 14px;
  background: #fff;
  border: 2px solid var(--red);
  border-radius: 12px;
}
.stand p { margin: 0; color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stand strong { flex: 1; font-size: 1.25rem; }
a.stand { color: inherit; text-decoration: none; }
.stand span { color: var(--red); font-weight: 700; }

.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  width: 100%;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.choice.current { border-color: var(--red); }
.choice span { float: right; color: var(--red); font-size: 0.85rem; }
.choice-row { position: relative; }
.hold-edit {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  appearance: none;
}
.hold-edit[hidden] { display: none; }
.add-row { position: relative; line-height: 0; }
.add-row input { display: block; line-height: 1.4; padding-right: 7.6rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 0.8rem; }

.top-text { flex: 1; min-width: 0; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.who { margin: 0; font-weight: 700; }

main { padding: 16px; max-width: 640px; margin: 0 auto; }
main.wide { max-width: 1100px; }
.stats { display: flex; gap: 8px; }
.stat {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.stat span { color: var(--muted); font-size: 0.85rem; }
.stat strong { display: block; font-size: 1.8rem; line-height: 1.2; }
.donuts { display: none; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.donuts.is-open { display: flex; }
.donuts figure { margin: 0; width: 148px; flex: none; }
.donut-ring { position: relative; width: 148px; height: 148px; margin: 0 auto; }
.donuts canvas { display: block; width: 148px !important; height: 148px !important; }
.donut-mid {
  position: absolute;
  inset: 18%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}
.donut-mid span { display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: 0.95rem; line-height: 1; }
.donut-mid span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.donut-mid .with::before { background: #0f6b3c; }
.donut-mid .without::before { background: #c4bfb8; }
.donuts figcaption { margin: 2px 0 0; text-align: center; font-size: 0.85rem; font-weight: 650; }
.donut-legend { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 4px; color: var(--muted); font-size: 0.75rem; font-weight: 650; }
.donut-legend[hidden] { display: none; }
.donut-legend span { display: flex; align-items: center; gap: 5px; }
.donut-legend span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--swatch); flex: none; }
.donut-total { margin: 0; text-align: center; color: var(--muted); font-size: 0.75rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

h1 { font-size: 1.45rem; margin: 0 0 8px; }
.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 8px;
}
.title-row h1 { flex: 1; margin: 0; }
.scan-close {
  flex: none;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.scan { margin: 0 0 12px; }
.scan video {
  display: none;
  width: 100%;
  max-height: 50vh;
  border-radius: 12px;
  background: #111;
  object-fit: cover;
}
.scan video.is-live { display: block; }
.scan .hint { margin: 8px 0; }
.edits { display: flex; flex-direction: column; gap: 16px; }
.edit { padding-top: 12px; border-top: 1px solid var(--line); }
.edit p { margin: 0 0 4px; }
.edit .button { width: auto; margin-top: 8px; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }

.lead, .hint, .meta { color: var(--muted); }
.lead { margin-top: 0; }
.hint { font-size: 0.92rem; }
.meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.field { display: block; margin: 12px 0; }
.field span { display: block; font-weight: 650; margin-bottom: 6px; }

input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 12px;
  border: 1px solid #c8c4be;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--red);
  border-color: var(--red);
}

input:disabled, textarea:disabled, select:disabled {
  background: #eceae6;
  color: #8a847c;
  border-color: #ddd9d3;
  cursor: not-allowed;
}

a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.hit.active { outline: 2px solid var(--red); outline-offset: 2px; }

.group {
  margin: 16px 0;
  padding: 4px 12px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.field .PhoneInput { align-items: stretch; gap: 8px; }
.phone-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  gap: 8px;
  flex: none;
  box-sizing: border-box;
  min-height: calc(16px * 1.4 + 24px);
  margin: 0;
  padding: 0 14px;
  border: 1px solid #c8c4be;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.phone-code::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.7;
}
.phone-flag { font-size: 2rem; line-height: 1; }
.PhoneInputInput { width: auto; min-width: 0; margin: 0; }
.phone-countries { width: min(420px, calc(100% - 24px)); padding: 16px; border: 0; border-radius: 16px; }
.phone-countries::backdrop { background: rgba(0, 0, 0, 0.35); }
.phone-countries ul { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; }
.phone-countries .country {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 10px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.phone-countries .country.is-current { font-weight: 700; }
.phone-countries .country.is-active { background: var(--paper); }
.phone-countries .dial { margin-left: auto; color: var(--muted); }
.field-error {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  color: var(--red);
  font-size: 0.92rem;
  font-weight: 650;
  transition: opacity 0.5s ease;
}
.field-error.is-leaving { opacity: 0; }
input.reverted, textarea.reverted, select.reverted { animation: revert-wash 1.6s ease; }
input.arrived, textarea.arrived, select.arrived { animation: arrive-wash 1.6s ease; }
@keyframes revert-wash {
  0% { background-color: #fde8ea; }
  100% { background-color: #fff; }
}
@keyframes arrive-wash {
  0% { background-color: var(--proposta-bg); }
  100% { background-color: #fff; }
}
.company-line > .field-error { grid-column: 1 / -1; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] {
  border-color: var(--red);
}
.req { color: var(--red); font-weight: 700; }
.company-line {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  align-items: center;
  margin: 12px 0;
}
.company-line > span { font-weight: 650; }
.company-line .check { margin: 0; }
.company-line input[name="company"] { grid-column: 1 / -1; margin-top: 6px; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  font-weight: 650;
}

.check input { width: 1.3rem; height: 1.3rem; }

.button {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 14px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary {
  background: #fff;
  color: var(--red);
  border: 2px solid var(--red);
}

.banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
}
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.bad { background: var(--none-bg); color: var(--none); }

.see-all { margin: 16px 0 0; text-align: center; }
.see-all a { color: var(--proposta); font-weight: 700; text-decoration: none; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.filters a {
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 650;
  background: #fff;
}
.filters a.current { border-color: var(--red); color: var(--red); }

button.hit {
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.hit {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  background: #fff;
  -webkit-tap-highlight-color: transparent;
}
.hit.pressed { background: #f3f1ee; }
.hit > a { display: block; flex: 1; min-width: 0; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.hit-orders { text-align: right; min-width: 4.6rem; }
.hit-orders strong { display: block; font-size: 1.35rem; line-height: 1; }
.hit-orders span { display: block; color: var(--muted); font-size: 0.75rem; }
.hit .star { position: static; }
.star {
  border: 0;
  background: transparent;
  color: #c8c4be;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.hit-starred .star, .star.on { color: #c8960a; }

.ficha-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 8px;
}
.ficha-title h1 { flex: 1; margin: 0; }
.ficha-title .star { font-size: 1.8rem; margin-top: 2px; }

.hit strong { display: block; }
.hit .sub, .hit .sum { display: block; color: var(--muted); font-size: 0.92rem; }
.hit-new { border-style: dashed; border-color: var(--red); color: var(--red); font-weight: 700; }
.order-model { margin: 0 0 12px; }
.order-model span { display: block; color: var(--muted); font-size: 0.85rem; }
.order-model strong { font-size: 1.15rem; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}
.pill-Encomenda { background: var(--ok-bg); color: var(--ok); }
.pill-Proposta { background: var(--proposta-bg); color: var(--proposta); }
.pill-Follow-up { background: var(--follow-bg); color: var(--follow); }
.pill-Sem-interesse { background: var(--none-bg); color: var(--none); }
.class-mark { display: inline-flex; align-items: center; gap: 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.downloads {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}
@media (min-width: 1040px) {
  .downloads { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.section-head h2 { margin: 0; }
.list-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 11rem;
  min-height: 44px;
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
}
.download {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 44px;
  gap: 6px;
  padding: 0 12px;
  border: 2px solid var(--proposta);
  border-radius: 10px;
  background: var(--proposta-bg);
  color: var(--proposta);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.download::before,
.download.today::after {
  content: "";
  width: 18px;
  height: 18px;
  background: currentColor;
  flex: none;
}
.download.clients::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4zm0 2c-4 0-8 2-8 4v2h16v-2c0-2-4-4-8-4z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4zm0 2c-4 0-8 2-8 4v2h16v-2c0-2-4-4-8-4z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.download.csv-orders {
  border-color: var(--ok);
  background: var(--ok-bg);
  color: var(--ok);
}
.download.csv-orders::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 2h12a2 2 0 0 1 2 2v18l-3-2-3 2-3-2-3 2-3-2-3 2V4a2 2 0 0 1 2-2zm2 6h8v2H8V8zm0 4h8v2H8v-2z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 2h12a2 2 0 0 1 2 2v18l-3-2-3 2-3-2-3 2-3-2-3 2V4a2 2 0 0 1 2-2zm2 6h8v2H8V8zm0 4h8v2H8v-2z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.download.today::after {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 2h2v2h6V2h2v2h3v18H4V4h3V2zm12 8H5v10h14V10z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 2h2v2h6V2h2v2h3v18H4V4h3V2zm12 8H5v10h14V10z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.order-open {
  margin-top: 0;
  background: var(--proposta-bg);
  color: var(--proposta);
  border: 2px solid var(--proposta);
}
.order-row { position: relative; padding-right: 96px; }
.order-row .hold-edit { top: 18px; transform: none; }

.orders { list-style: none; padding: 0; margin: 12px 0; }
.orders li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.orders li p { margin: 4px 0 0; }

.qty {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.qty span { color: var(--muted); font-size: 0.85rem; font-weight: 650; }

.button.compact {
  width: auto;
  display: inline-block;
  margin-top: 10px;
  padding: 8px 14px;
}

.qr-fold { margin-top: 8px; }
.qr-fold summary {
  display: inline-block;
  padding: 10px 14px;
  border: 2px solid var(--red);
  border-radius: 10px;
  color: var(--red);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.qr-fold summary::-webkit-details-marker { display: none; }
.qr-fold .when-open { display: none; }
.qr-fold[open] .when-closed { display: none; }
.qr-fold[open] .when-open { display: inline; }
.qr-fold img { display: block; margin: 12px 0; background: #fff; padding: 8px; border-radius: 10px; }

.back, .footer-link { margin: 0 0 12px; }
.back a, .footer-link a { color: var(--proposta); font-weight: 700; text-decoration: none; }
.back a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.back a::before {
  content: "";
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.logout { margin: 0; }
.linkish {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  padding: 8px;
  cursor: pointer;
  text-decoration: none;
}
