@font-face { font-family: 'Fraunces'; src: url('/fonts/fraunces-600.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/fonts/fraunces-400.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('/fonts/manrope-400.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('/fonts/manrope-600.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('/fonts/manrope-700.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --night: #0a1624; --night-2: #12233a; --ice: #66d0f2; --brand: #17256A; --brand-2: #22358f;
  --bg: #eef2f7; --card: #ffffff; --ink: #0b1726; --muted: #44536a; --line: #c9d3e0; --soft: #e4ebf4;
  --ok: #0b6e37; --ok-bg: #dcf3e5; --warn: #8a4b00; --warn-bg: #fdf0d8; --bad: #a8201a; --bad-bg: #fbe3e1;
  --blue-bg: #dfeefa; --radius: 16px; --tap: 64px;
  --shadow: 0 1px 2px rgba(10,22,36,.06), 0 6px 18px rgba(10,22,36,.07);
  font-size: 19px;
}
html.big { font-size: 22px; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem; line-height: 1.5; -webkit-font-smoothing: antialiased;
  min-height: 100vh; min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
}
body.has-bar { padding-bottom: calc(118px + env(safe-area-inset-bottom)); }
h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; margin: 0 0 .4em; text-wrap: balance; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.12rem; }
p { margin: 0 0 .8em; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 4px solid var(--ice); outline-offset: 2px; }

/* ---------- topo ---------- */
.top {
  position: sticky; top: 0; z-index: 20; background: var(--night); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; min-height: 68px;
  border-bottom: 3px solid var(--ice);
}
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px; cursor: pointer; min-height: 48px; }
.brand > img { flex: 0 0 auto; width: 46px; height: 29px; }
.brand-word img { display: block; height: 18px; width: auto; }
.top-right { display: flex; align-items: center; gap: 8px; }
.top-btn {
  min-width: 52px; min-height: 52px; border-radius: 12px; border: 2px solid rgba(255,255,255,.35);
  background: transparent; color: #fff; font-weight: 700; cursor: pointer; padding: 0 12px; font-size: .95rem;
}
.top-btn span { font-size: 1.3em; margin-left: 1px; }
.top-btn.user { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync { font-size: .78rem; font-weight: 600; padding: 6px 12px; border-radius: 99px; white-space: nowrap; }
.sync.ok { background: rgba(102,208,242,.16); color: #bfeeff; }
.sync.off { background: #fdf0d8; color: #6b3a00; }
.sync.busy { background: rgba(255,255,255,.12); color: #fff; }

/* ---------- área principal ---------- */
main { max-width: 820px; margin: 0 auto; padding: 22px 16px 40px; outline: none; }
main.wide { max-width: 1180px; }
.crumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.step-of { display: inline-block; background: var(--brand); color: #fff; border-radius: 99px; padding: 3px 12px; font-size: .8rem; font-weight: 700; margin-bottom: 10px; }
.lead { color: var(--muted); font-size: 1.02rem; }
.progress { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; margin: 4px 0 18px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--ice)); border-radius: 99px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; border: 1px solid #dfe5ee; }
.card.flat { box-shadow: none; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.grid3 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 700px) { .grid3 { grid-template-columns: repeat(3, 1fr); } }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-align: center;
  min-height: var(--tap); padding: 12px 22px; border-radius: 14px; border: 2px solid var(--brand);
  background: #fff; color: var(--brand); font-weight: 700; font-size: 1.02rem; cursor: pointer; text-decoration: none;
  line-height: 1.25; transition: transform .06s ease, background .15s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.green { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.red { background: #fff; border-color: var(--bad); color: var(--bad); }
.btn.red.solid { background: var(--bad); color: #fff; }
.btn.wa { background: #128C4A; border-color: #128C4A; color: #fff; }
.btn.block { display: flex; width: 100%; }
.btn.huge { min-height: 84px; font-size: 1.15rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn .ico { font-size: 1.35em; line-height: 1; }
.btn-col { display: grid; gap: 12px; }
.linkbtn { background: none; border: 0; color: var(--brand); font-weight: 700; text-decoration: underline; cursor: pointer; padding: 10px 4px; min-height: 48px; }

/* início: botões grandes */
.tiles { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 18px 0 26px; }
@media (min-width: 560px) { .tiles { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 14px;
  min-height: 132px; padding: 18px 20px; border-radius: 18px; border: 2px solid #d3dbe6; background: #fff; color: var(--ink);
  text-align: left; cursor: pointer; box-shadow: var(--shadow);
}
@media (max-width: 559px) {
  .tile { flex-direction: row; align-items: center; justify-content: flex-start; gap: 16px; min-height: 100px; padding: 16px 18px; }
  .tile .t-ico { font-size: 2.2rem; flex: 0 0 auto; }
}
.tile.main { background: var(--brand); color: #fff; border-color: var(--brand); }
.tile .t-ico { font-size: 2rem; line-height: 1; }
.tile .t-title { font-family: 'Fraunces', serif; font-size: 1.3rem; font-weight: 600; }
.tile .t-sub { font-size: .9rem; opacity: .85; }
.tile .count { background: var(--ice); color: var(--night); border-radius: 99px; padding: 2px 10px; font-weight: 700; font-size: .85rem; }

/* listas de atendimentos */
.list { display: grid; gap: 12px; }
@media (min-width: 900px) { main.wide .list { grid-template-columns: 1fr 1fr; } }
.item {
  display: block; width: 100%; text-align: left; background: #fff; border: 2px solid #dbe2ec; border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer; box-shadow: var(--shadow); color: var(--ink);
}
.item:hover { border-color: var(--brand); }
.item .i-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.item .i-name { font-weight: 700; font-size: 1.08rem; }
.item .i-num { color: var(--muted); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.item .i-sub { color: var(--muted); font-size: .92rem; margin: 2px 0 10px; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 5px 12px; font-size: .85rem; font-weight: 700; }
.badge.grey { background: var(--soft); color: #2e3d52; }
.badge.blue { background: var(--blue-bg); color: #0b4a7a; }
.badge.amber { background: var(--warn-bg); color: var(--warn); }
.badge.green { background: var(--ok-bg); color: var(--ok); }
.badge.red { background: var(--bad-bg); color: var(--bad); }
.empty { text-align: center; padding: 34px 18px; color: var(--muted); background: #fff; border-radius: var(--radius); border: 2px dashed var(--line); }
.empty .e-ico { font-size: 2.4rem; }

/* busca e campos */
label.lbl, .lbl { display: block; font-weight: 700; margin: 0 0 8px; font-size: 1.02rem; }
.hint { color: var(--muted); font-size: .88rem; margin: -4px 0 8px; }
.field { margin-bottom: 22px; }
.field.missing .lbl { color: var(--bad); }
.field.missing input, .field.missing textarea, .field.missing .chips { outline: 3px solid var(--bad); outline-offset: 3px; border-radius: 12px; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=search], input[type=date], input[type=password], textarea, select {
  width: 100%; min-height: var(--tap); padding: 14px 16px; border: 2px solid #9fb0c5; border-radius: 14px; background: #fff;
  font-size: 1.05rem; color: var(--ink);
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); outline: 3px solid rgba(102,208,242,.6); outline-offset: 0; }
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #7a879a; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  min-height: 56px; padding: 10px 18px; border-radius: 14px; border: 2px solid #9fb0c5; background: #fff; cursor: pointer;
  font-weight: 600; font-size: 1rem; color: var(--ink); display: inline-flex; align-items: center; gap: 8px;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.on::before { content: '✓'; font-weight: 800; }
.chip.ok.on { background: var(--ok); border-color: var(--ok); }
.chip.warn.on { background: #b56a00; border-color: #b56a00; }
.chip.bad.on { background: var(--bad); border-color: var(--bad); }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 64px; height: 64px; border-radius: 14px; border: 2px solid var(--brand); background: #fff; color: var(--brand); font-size: 1.8rem; font-weight: 700; cursor: pointer; }
.stepper output { min-width: 60px; text-align: center; font-size: 1.6rem; font-weight: 700; }
.dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.dims span { display: block; font-size: .85rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.cap { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.seg { display: inline-flex; border: 2px solid var(--brand); border-radius: 14px; overflow: hidden; }
.seg button { min-height: 60px; min-width: 70px; border: 0; background: #fff; color: var(--brand); font-weight: 700; cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; }
.loadbox { background: var(--night); color: #fff; border-radius: 14px; padding: 16px 18px; }
.loadbox b { color: var(--ice); font-size: 1.4rem; font-family: 'Fraunces', serif; }

/* fotos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-bottom: 12px; }
.ph { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--soft); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph button { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(10,22,36,.82); color: #fff; font-size: 1.2rem; cursor: pointer; }
.photo-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-btns input { display: none; }

/* tipos de serviço */
.types { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 600px) { .types { grid-template-columns: 1fr 1fr; } }
.type {
  display: flex; align-items: center; gap: 16px; min-height: 92px; padding: 14px 18px; border-radius: 16px; border: 2px solid #c5d0de;
  background: #fff; text-align: left; cursor: pointer; color: var(--ink);
}
.type.on { border-color: var(--brand); background: #eef1fb; box-shadow: inset 0 0 0 2px var(--brand); }
.type .ty-ico { font-size: 2.1rem; width: 52px; text-align: center; }
.type b { display: block; font-size: 1.1rem; }
.type span { color: var(--muted); font-size: .9rem; }

/* linha do método */
.method { display: grid; gap: 0; margin: 10px 0 20px; }
.mstep { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: start; position: relative; padding-bottom: 18px; }
.mstep:not(:last-child)::after { content: ''; position: absolute; left: 25px; top: 52px; bottom: 0; width: 3px; background: var(--line); }
.mstep.done:not(:last-child)::after { background: var(--ok); }
.mdot { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; background: #fff; border: 3px solid var(--line); color: var(--muted); }
.mstep.done .mdot { background: var(--ok); border-color: var(--ok); color: #fff; }
.mstep.now .mdot { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 5px rgba(102,208,242,.45); }
.mstep h3 { margin: 10px 0 2px; }
.mstep .ms-sub { color: var(--muted); font-size: .92rem; }
.mstep .ms-act { margin-top: 10px; }

/* itens da proposta */
.pitem { border: 2px solid #dbe2ec; border-radius: 14px; padding: 14px; margin-bottom: 12px; background: #fff; }
.pitem .pi-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.pitem .tag { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 3px 10px; border-radius: 99px; }
.tag.servico { background: var(--blue-bg); color: #0b4a7a; } .tag.peca { background: var(--warn-bg); color: var(--warn); }
.pitem .pi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.pitem .pi-grid span { display: block; font-size: .85rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.iconbtn { min-width: 52px; min-height: 52px; border-radius: 12px; border: 2px solid #c5d0de; background: #fff; cursor: pointer; font-size: 1.1rem; color: var(--bad); font-weight: 700; }
.total { background: var(--night); color: #fff; border-radius: 16px; padding: 18px 20px; display: grid; gap: 6px; }
.total .tl { display: flex; justify-content: space-between; gap: 10px; }
.total .tl.big { font-size: 1.4rem; font-family: 'Fraunces', serif; color: var(--ice); border-top: 1px solid rgba(255,255,255,.2); padding-top: 8px; margin-top: 4px; }

/* checklist de execução */
.check {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 12px 16px; border-radius: 14px; border: 2px solid #c5d0de;
  background: #fff; cursor: pointer; text-align: left; margin-bottom: 10px; font-weight: 600; color: var(--ink);
}
.check .box { flex: 0 0 40px; height: 40px; border-radius: 10px; border: 3px solid #8597ad; display: grid; place-items: center; font-size: 1.3rem; color: #fff; }
.check.on { border-color: var(--ok); background: var(--ok-bg); }
.check.on .box { background: var(--ok); border-color: var(--ok); }
.check .who { display: block; font-weight: 500; font-size: .82rem; color: var(--muted); }

/* resumo */
.kv { display: grid; grid-template-columns: minmax(110px, 36%) 1fr; gap: 6px 14px; }
.kv dt { color: var(--muted); font-weight: 600; } .kv dd { margin: 0; font-weight: 600; }
.mcard { border: 2px solid #dbe2ec; border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; background: #fff; display: flex; gap: 12px; align-items: center; }
.mcard .mc-body { flex: 1; min-width: 0; }
.mcard b { display: block; }

/* barra de ações fixa */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: rgba(255,255,255,.97); border-top: 2px solid #d5dde8;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 18px rgba(10,22,36,.08);
}
.bar .bar-in { max-width: 820px; margin: 0 auto; display: grid; grid-template-columns: minmax(110px, 1fr) 2fr; gap: 12px; }
.bar .bar-in.one { grid-template-columns: 1fr; }
.bar .btn { min-height: 72px; font-size: 1.08rem; }

/* PIN */
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 360px; margin: 16px auto; }
.pinpad button { height: 78px; border-radius: 16px; border: 2px solid #b9c6d6; background: #fff; font-size: 1.8rem; font-weight: 700; cursor: pointer; color: var(--ink); }
.pinpad button.fn { font-size: 1rem; }
.pindots { display: flex; justify-content: center; gap: 16px; margin: 10px 0; }
.pindots i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--brand); }
.pindots i.on { background: var(--brand); }
.login-hero { background: var(--night); color: #fff; border-radius: 20px; padding: 26px 22px; margin-bottom: 18px; text-align: center; }
.login-hero img { height: 70px; width: auto; }
.login-hero p { color: #bfeeff; margin: 8px 0 0; }
.people { display: grid; gap: 12px; }
@media (min-width: 600px) { .people { grid-template-columns: 1fr 1fr; } }
.person { min-height: 76px; border-radius: 16px; border: 2px solid #c5d0de; background: #fff; font-size: 1.15rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 12px 18px; color: var(--ink); }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; flex: 0 0 48px; }

/* assinatura */
.sig { border: 2px dashed #8597ad; border-radius: 14px; background: #fff; touch-action: none; width: 100%; height: 220px; display: block; }

/* aviso / toast / modal */
.note { border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; font-weight: 600; }
.note.blue { background: var(--blue-bg); color: #093e66; } .note.amber { background: var(--warn-bg); color: #6b3a00; }
.note.green { background: var(--ok-bg); color: #08542a; } .note.red { background: var(--bad-bg); color: #7d1712; }
.toast {
  position: fixed; left: 50%; bottom: calc(130px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); z-index: 60;
  background: var(--night); color: #fff; padding: 16px 22px; border-radius: 16px; font-weight: 700; font-size: 1.05rem;
  opacity: 0; pointer-events: none; transition: .25s ease; max-width: calc(100% - 32px); width: max-content; text-align: center;
  border-left: 6px solid var(--ice); box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-left-color: #ff8a80; }
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(10,22,36,.6); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal .box { background: #fff; border-radius: 20px; padding: 24px 22px; max-width: 520px; width: 100%; max-height: 90vh; overflow: auto; }
.modal .box h2 { margin-bottom: 10px; }
.modal .box .btn-col { margin-top: 18px; }

.loading { text-align: center; padding: 40px 10px; font-weight: 700; color: var(--muted); }
.spin { width: 42px; height: 42px; border-radius: 50%; border: 5px solid var(--soft); border-top-color: var(--brand); animation: sp 0.9s linear infinite; margin: 0 auto 14px; }
@keyframes sp { to { transform: rotate(360deg); } }
.pdfready { display: flex; align-items: center; gap: 14px; background: #fff; border: 2px solid var(--ok); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.pdfready .pi { width: 52px; height: 64px; border-radius: 8px; background: var(--bad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .8rem; flex: 0 0 52px; }
.pdfready b { display: block; word-break: break-word; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-title h2 { margin: 0; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.filters .chip { flex: 0 0 auto; min-height: 50px; }

@media (max-width: 420px) {
  :root { font-size: 18px; }
  html.big { font-size: 21px; }
  .brand-word { display: none; }
  .sync { font-size: .72rem; padding: 6px 10px; }
  h1 { font-size: 1.55rem; }
  .bar .bar-in { grid-template-columns: minmax(96px, 1fr) 2fr; }
}
@media (min-width: 1000px) {
  main { padding-top: 32px; }
  .bar .bar-in { max-width: 820px; }
}
@media print { .top, .bar { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.sync .s, .top-btn.user .s { display: none; }
.top { min-width: 0; }
.top-right { min-width: 0; flex-shrink: 1; }
@media (max-width: 480px) {
  .sync .l, .top-btn.user .l { display: none; }
  .sync .s, .top-btn.user .s { display: inline; }
  .top-btn.user { min-width: 52px; padding: 0 8px; }
  .top { padding-left: 12px; padding-right: 12px; gap: 6px; }
  .top-right { gap: 6px; }
}
.photo-btns > * { min-width: 0; }
@media (max-width: 380px) { .photo-btns { grid-template-columns: 1fr; } }
