@font-face { font-family: Poppins; font-weight: 400; font-display: swap; src: url(/fonts/poppins-400.woff2) format('woff2'); }
@font-face { font-family: Poppins; font-weight: 500; font-display: swap; src: url(/fonts/poppins-500.woff2) format('woff2'); }
@font-face { font-family: Poppins; font-weight: 600; font-display: swap; src: url(/fonts/poppins-600.woff2) format('woff2'); }
@font-face { font-family: Poppins; font-weight: 700; font-display: swap; src: url(/fonts/poppins-700.woff2) format('woff2'); }

:root {
  --purple: #6a0dad; --purple-hover: #57098f; --pink: #ec4899; --pink-soft: #f8b4d9; --lavender: #f3e8ff;
  --deep: #32113f; --bg: #fbf8ff; --muted: #76627f; --line: #ece4f3;
  --ok: #15803d; --ok-bg: #e8f6ed; --warn: #a15c07; --warn-bg: #fdf2dc; --bad: #b91c1c; --bad-bg: #fdecec;
  --radius: 14px; --shadow: 0 1px 2px #32113f0a, 0 4px 14px #32113f0a; --side: 248px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font: 400 14px/1.5 Poppins, system-ui, sans-serif; background: var(--bg); color: var(--deep); -webkit-tap-highlight-color: transparent; }
h1 { font-size: 22px; font-weight: 600; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 500; }
a { color: var(--purple); text-decoration: none; }
small, .muted { color: var(--muted); font-size: 12px; }
svg.i { width: 18px; height: 18px; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

/* estrutura */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--deep); color: #fff; display: flex; flex-direction: column; padding: 20px 14px; gap: 4px; overflow-y: auto; z-index: 5; }
.sidebar nav { display: grid; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 600; padding: 0 8px 20px; }
.brand img { width: 34px; height: 34px; object-fit: contain; border-radius: 9px; }
.brand b { color: var(--pink-soft); font-weight: 600; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: #e9dcf0; font-weight: 500; transition: background .15s, color .15s; }
.nav-link:hover { background: #ffffff12; color: #fff; }
.nav-link.on { background: #6a0dad99; color: #fff; box-shadow: inset 3px 0 var(--pink); }
.profile { margin-top: auto; position: relative; padding-top: 12px; }
.profile > button { width: 100%; display: flex; align-items: center; gap: 10px; background: #ffffff0f; border: 0; color: #fff; padding: 10px; border-radius: 12px; cursor: pointer; font: inherit; text-align: left; }
.profile > button:hover { background: #ffffff1a; }
.profile small { color: #cbb5d6; display: block; }
.grow { flex: 1; min-width: 0; }
.truncate { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { margin-left: var(--side); min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 22px 32px 6px; flex-wrap: wrap; }
.content { padding: 18px 32px 48px; display: grid; gap: 18px; max-width: 1320px; grid-template-columns: minmax(0, 1fr); }
.menu { position: absolute; background: #fff; color: var(--deep); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px #32113f26; padding: 6px; z-index: 20; min-width: 190px; animation: pop .12s ease-out; }
.menu button, .menu a { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; background: none; font: inherit; color: var(--deep); padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.menu button:hover, .menu a:hover { background: var(--lavender); }
.profile .menu { bottom: calc(100% + 6px); left: 0; right: 0; }
.drop { position: relative; }
.drop .menu { top: calc(100% + 6px); right: 0; width: 310px; max-height: 360px; overflow: auto; }
.badge-dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--pink); border: 2px solid #fff; }
.bottom-nav, .fab { display: none; }

/* componentes */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 500 13px/1 Poppins, system-ui, sans-serif; padding: 11px 16px; border-radius: 12px; border: 1px solid transparent; background: var(--purple); color: #fff; cursor: pointer; transition: background .15s, transform .1s, box-shadow .15s; white-space: nowrap; }
.btn:hover { background: var(--purple-hover); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary-lg { box-shadow: 0 6px 16px #6a0dad33; }
.btn.pink { background: #fdf0f7; color: #be1d6f; border-color: var(--pink-soft); }
.btn.pink:hover { background: #fbe1ef; }
.btn.ghost { background: #fff; color: var(--deep); border-color: var(--line); }
.btn.ghost:hover { background: var(--lavender); }
.btn.danger { background: #fff; color: var(--bad); border-color: #f5caca; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 8px 11px; font-size: 12px; border-radius: 12px; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--deep); cursor: pointer; }
.icon-btn:hover { background: var(--lavender); }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: grid; gap: 12px; align-content: start; grid-template-columns: minmax(0, 1fr); }
.grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wide-left { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.top { align-items: start; }
.kpi { display: grid; gap: 6px; align-content: start; }
.kpi .ico { width: 38px; height: 38px; border-radius: 12px; background: var(--lavender); color: var(--purple); display: grid; place-items: center; }
.kpi .value { font-size: 26px; font-weight: 700; line-height: 1.2; }
.trend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 12px; background: var(--lavender); color: var(--muted); }
.trend.up { background: var(--ok-bg); color: var(--ok); }
.trend.down { background: var(--warn-bg); color: var(--warn); }
.badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 12px; background: var(--lavender); color: var(--purple); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.off { background: #f1eff3; color: var(--muted); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--pink-soft); color: var(--deep); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 22px; }
.list { display: grid; grid-template-columns: minmax(0, 1fr); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.time { font-weight: 600; width: 48px; flex: none; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; display: grid; gap: 10px; justify-items: center; }
.seg { display: inline-flex; background: var(--lavender); border-radius: 12px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: none; font: 500 12px Poppins, system-ui, sans-serif; color: var(--muted); padding: 7px 13px; border-radius: 12px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: #fff; color: var(--purple); box-shadow: var(--shadow); }
label.field { display: grid; gap: 5px; font-size: 12px; font-weight: 500; color: var(--muted); min-width: 0; }
input, select, textarea { width: 100%; font: 400 14px Poppins, system-ui, sans-serif; color: var(--deep); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--purple); box-shadow: 0 0 0 3px #6a0dad1f; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--purple); padding: 0; flex: none; }
textarea { min-height: 76px; resize: vertical; }
select.auto, input.auto { width: auto; }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 12px; top: 12px; color: var(--muted); }
.search input { padding-left: 40px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 500; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--bg); }
tr.click { cursor: pointer; }
tr:last-child td { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--ok); font-weight: 600; }
.neg { color: var(--bad); font-weight: 600; }

/* modal */
dialog { border: 0; border-radius: 16px; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); margin: auto; color: var(--deep); box-shadow: 0 24px 60px #32113f40; }
dialog::backdrop { background: #32113f73; }
dialog[open] { animation: pop .16s ease-out; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 0; gap: 10px; }
.modal-body { padding: 16px 20px 20px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.modal-body form.modal-body { padding: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: grid; gap: 6px; max-height: 190px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.checks label { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px; cursor: pointer; }
.checks label:hover { background: var(--lavender); }
.error { color: var(--bad); font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--deep); color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 60; box-shadow: 0 10px 30px #32113f40; animation: pop .16s ease-out; max-width: calc(100vw - 32px); }
@keyframes pop { from { opacity: 0; translate: 0 6px; } }

/* agenda */
.cal { display: grid; grid-template-columns: 52px repeat(var(--cols), minmax(0, 1fr)); }
.cal-head { text-align: center; padding: 6px 2px; font-size: 12px; color: var(--muted); border: 0; background: none; font-family: inherit; cursor: pointer; border-radius: 12px; }
.cal-head:hover { background: var(--lavender); }
.cal-head b { display: block; font-size: 16px; color: var(--deep); font-weight: 600; }
.cal-head.today b { color: var(--pink); }
.cal-hours { position: relative; }
.cal-hours span { position: absolute; right: 8px; font-size: 11px; color: var(--muted); translate: 0 -8px; }
.cal-col { position: relative; border-left: 1px solid var(--line); }
.slot { display: block; width: 100%; height: 32px; border: 0; border-top: 1px solid var(--line); background: none; cursor: pointer; color: #a08fab; font: 400 11px Poppins, system-ui, sans-serif; text-align: right; padding-right: 8px; }
.cols-many .slot { color: transparent; }
.slot.half { border-top: 1px dashed #f3eef8; }
.slot.closed { background: #f7f5f9; }
.slot:hover { background: var(--lavender); color: var(--purple); }
.event { display: flex; flex-direction: column; justify-content: flex-start; position: absolute; left: 3px; right: 3px; border: 0; border-left: 3px solid var(--purple); background: var(--lavender); color: var(--deep); border-radius: 8px; padding: 3px 8px; text-align: left; font: 400 11px/1.35 Poppins, system-ui, sans-serif; overflow: hidden; cursor: pointer; z-index: 1; transition: box-shadow .15s; }
.event:hover { box-shadow: 0 4px 14px #32113f33; z-index: 2; }
.event b { flex: none; display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event.pending { background: var(--warn-bg); border-color: #d97706; }
.event.done { background: var(--ok-bg); border-color: var(--ok); }
.event.block { background: repeating-linear-gradient(45deg, #eee9f2, #eee9f2 6px, #f7f5f9 6px, #f7f5f9 12px); border-color: var(--muted); }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.month > span { text-align: center; font-size: 11px; color: var(--muted); }
.day { min-height: 92px; min-width: 0; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 6px; display: flex; flex-direction: column; align-items: stretch; gap: 3px; cursor: pointer; font: inherit; text-align: left; color: var(--deep); overflow: hidden; }
.day:hover { border-color: var(--purple); }
.day.other { opacity: .4; }
.day.today > b { color: var(--pink); }
.day .badge { overflow: hidden; text-overflow: ellipsis; text-align: left; }

/* gráficos */
.chart { width: 100%; height: auto; display: block; margin-top: 10px; }
.chart text { font: 400 11px Poppins, system-ui, sans-serif; fill: var(--muted); }
.chart path:hover { opacity: .75; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.hbar { display: grid; gap: 5px; margin-bottom: 12px; }
.hbar > div:first-child { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.track { height: 8px; background: var(--lavender); border-radius: 4px; overflow: hidden; }
.track i { display: block; height: 100%; background: #7014b4; border-radius: 4px; }
.big { font-size: 28px; font-weight: 700; }

/* serviços e fotos */
.service-img { width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; object-fit: cover; background: var(--lavender); display: grid; place-items: center; color: var(--purple); }
.service-img svg { width: 30px; height: 30px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
.photos figure { position: relative; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; display: block; }
.photos figure button { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; }

/* entrada */
.auth { min-height: 100vh; display: grid; place-items: center; background: var(--deep); padding: 20px; }
.auth form { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 28px; display: grid; gap: 14px; }
.auth .brand { color: var(--deep); padding: 0; justify-content: center; }
.auth .brand b { color: var(--pink); }

@media (max-width: 1100px) {
  .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wide-left { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .topbar { padding: 14px 16px 4px; gap: 8px; }
  .topbar .grow { flex-basis: 55%; }
  .content { padding: 12px 16px 150px; gap: 12px; }
  h1 { font-size: 18px; }
  .grid { gap: 12px; }
  .g3, .g2 { grid-template-columns: minmax(0, 1fr); }
  .g3.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 14px; }
  .kpi .value { font-size: 19px; }
  .big { font-size: 22px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
  .bottom-nav a, .bottom-nav button { display: grid; justify-items: center; gap: 3px; padding: 10px 0; font: 500 10px Poppins, system-ui, sans-serif; color: var(--muted); background: none; border: 0; cursor: pointer; }
  .bottom-nav .on { color: var(--purple); }
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border-radius: 16px; border: 0; background: var(--purple); color: #fff; box-shadow: 0 8px 20px #6a0dad55; z-index: 7; cursor: pointer; }
  .fab svg { width: 24px; height: 24px; }
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 92dvh; }
  .month { gap: 3px; }
  .day { min-height: 52px; padding: 4px; align-items: center; }
  .day .events { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
  .day .badge { width: 7px; height: 7px; padding: 0; border-radius: 50%; background: var(--purple); font-size: 0; }
  .day .badge.warn { background: #d97706; }
  .day .badge.ok { background: var(--ok); }
  .hide-sm { display: none !important; }
  table.cards thead { display: none; }
  table.cards tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
  table.cards td { border: 0; padding: 0; }
  table.cards td.first { grid-column: 1; grid-row: 1 / span 2; }
  table.cards td.name { grid-column: 2; grid-row: 1; }
  table.cards td.phone { grid-column: 2; grid-row: 2; color: var(--muted); font-size: 12px; }
  table.cards td.status { grid-column: 3; grid-row: 1 / span 2; }
  .drop .menu { position: fixed; top: 66px; left: 12px; right: 12px; width: auto; }
}
.steps { padding-left: 20px; display: grid; gap: 8px; }
@media (max-width: 820px) {
  /* abaixo de 16px o iPhone aproxima a tela ao tocar no campo */
  input, select, textarea { font-size: 16px; }
  .topbar { padding-top: calc(14px + env(safe-area-inset-top)); }
}
@media (max-width: 420px) { .two { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
