/* App da equipe: celular primeiro; barra inferior no celular, lateral no computador. */
body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(246, 241, 234, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 22px; }
.topbar .who { font-size: 13px; color: var(--muted); text-align: right; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--paper); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 9px; min-height: 58px;
  font-size: 11.5px; font-weight: 600; color: var(--muted); text-decoration: none;
}
.tabbar a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current=page] { color: var(--gold-d); }

main { padding: 16px; max-width: 1100px; margin: 0 auto; }
.screen-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.screen-head h2 { font-size: 26px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.scroll-x { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card + .card { margin-top: 12px; }
.card h3 { font-size: 18px; margin-bottom: 10px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px; text-decoration: none; color: inherit; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; }
.list .item:hover { background: var(--gold-t); }
.item b { display: block; font-weight: 600; }
.empty { padding: 28px 8px; text-align: center; color: var(--muted); }

/* ---------- agenda ---------- */
.daynav { display: flex; align-items: center; gap: 6px; }
.daynav label { position: relative; }
.daynav .label { font-family: var(--display); font-size: 20px; min-width: 150px; text-align: center; }
.cal-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); pointer-events: none; }
.cal-line.half { background: #f0e9df; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.iconbtn:hover { background: var(--gold-t); }
.iconbtn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

.cal { display: grid; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 230px); max-height: calc(100dvh - 230px); }
.cal-head { position: sticky; top: 0; z-index: 3; background: var(--paper); border-bottom: 1px solid var(--line); padding: 10px 8px; font-weight: 600; font-size: 14px; text-align: center; }
.cal-head i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.cal-times { position: relative; border-right: 1px solid var(--line); }
.cal-times span { position: absolute; right: 6px; font-size: 11.5px; color: var(--muted); transform: translateY(-50%); }
.cal-col { position: relative; border-right: 1px solid var(--line); cursor: pointer; }
.cal-col:last-child { border-right: 0; }
.cal-off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, #f3ede4 0 6px, #ece4d8 6px 12px); pointer-events: none; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 2; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.appt {
  position: absolute; left: 4px; right: 4px; z-index: 1; border-radius: 8px; padding: 5px 8px; overflow: hidden;
  background: var(--gold-t); border-left: 4px solid var(--gold); font-size: 13px; line-height: 1.25; cursor: pointer; text-align: left; border-top: 0; border-right: 0; border-bottom: 0;
  display: flex; flex-direction: column; justify-content: flex-start;
}
.appt b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt span { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.confirmado { background: #ecdcc0; }
.appt.em_atendimento { background: var(--pink); border-left-color: #b9867f; }
.appt.concluido { background: var(--ok-t); border-left-color: var(--ok); }
.appt.faltou { background: var(--bad-t); border-left-color: var(--bad); }
.appt.cancelado { background: #f1eeea; border-left-color: #b8aea4; opacity: .7; }
.appt.cancelado b { text-decoration: line-through; }
.appt.online::after { content: "marcou online"; font-size: 10.5px; font-weight: 700; color: var(--gold-d); letter-spacing: .04em; text-transform: uppercase; }
.cal-block { position: absolute; left: 4px; right: 4px; border-radius: 8px; background: #e6ddd1; color: var(--muted); font-size: 12.5px; padding: 4px 8px; cursor: pointer; border: 1px dashed #c9bba9; text-align: left; }

.fab {
  position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 25;
  box-shadow: 0 6px 20px rgba(28, 23, 21, .18);
}

.status { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--gold-t); color: var(--gold-d); }
.status.concluido { background: var(--ok-t); color: var(--ok); }
.status.faltou, .status.cancelado { background: var(--bad-t); color: var(--bad); }
.status.em_atendimento { background: var(--pink); color: #8a5a54; }

/* ---------- sheet (painel que sobe) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(28, 23, 21, .35); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; overflow: auto; background: var(--ivory);
  border-radius: 18px 18px 0 0; padding: 0 16px calc(18px + env(safe-area-inset-bottom));
  animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 10px; background: var(--ivory); }
.sheet-head h2 { font-size: 22px; }
.sheet .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.results { margin: -4px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); max-height: 220px; overflow: auto; }
.results button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; }
.results button:hover { background: var(--gold-t); }
.picked { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--gold-t); margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.stats div { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.stats b { display: block; font-family: var(--display); font-size: 22px; font-weight: 400; }
.stats span { font-size: 12px; color: var(--muted); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 12px 18px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold-l); }
.timeline li.nota::before { background: var(--gold); }
.timeline small { display: block; color: var(--muted); font-size: 12px; }

/* ---------- funis ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 82vw); gap: 12px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x mandatory; }
.stage { background: #efe7db; border-radius: var(--radius); padding: 10px; scroll-snap-align: start; min-height: 200px; }
.stage h3 { font-family: var(--body); font-size: 14px; font-weight: 700; display: flex; justify-content: space-between; margin: 2px 4px 10px; }
.stage.won h3 { color: var(--ok); }
.stage.lost h3 { color: var(--bad); }
.deal { display: block; width: 100%; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.deal:hover { border-color: var(--gold-l); }
.deal b { display: block; font-weight: 600; }
.deal span { display: block; font-size: 12.5px; color: var(--muted); }
.deal .late { color: var(--bad); font-weight: 600; }

/* ---------- login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login form { width: 100%; max-width: 360px; }
.login .brand { justify-content: center; margin-bottom: 28px; }
.login .brand img { width: 46px; height: 56px; }
.login .brand b { font-size: 28px; }
.err { color: var(--bad); font-size: 14px; margin: 0 0 12px; }

#toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; pointer-events: none; }
#toast div { background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.2); animation: up .18s ease-out; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--gold); }
.hours { display: grid; grid-template-columns: 52px 1fr 1fr; gap: 6px 8px; align-items: center; font-size: 14px; }
.hours input { min-height: 38px; padding: 6px 8px; }
.price-row { display: grid; grid-template-columns: 1fr 110px 90px; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 14px; }
.price-row input { min-height: 38px; }

@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 92px; }
  .tabbar { top: 0; right: auto; width: 92px; grid-template-columns: 1fr; grid-auto-rows: 76px; align-content: start; border-top: 0; border-right: 1px solid var(--line); padding-top: 70px; }
  .fab { bottom: 24px; right: 24px; }
  #toast { bottom: 24px; }
  .board { grid-auto-columns: 260px; }
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 18px; max-height: 88vh; }
}
