/* Painel no estilo aplicativo: fundo neutro, títulos fortes, barra de abas embaixo no celular.
   A cor de destaque continua sendo a da marca do estúdio (--brand). */
body.panel {
  --bg: #f3f1ee;
  --card: #ffffff;
  --ink: #1d1b1a;
  --muted: #7a736d;
  --line: #e7e2dc;
  --shadow: 0 1px 0 rgba(29, 27, 26, .03);
  --panel-dark: #1f1d1c;
  background: var(--bg);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
body.panel h1, body.panel h2, body.panel .kpi b, body.panel .hero-num, body.panel .wk-head b, body.panel .home-head h1 {
  font-family: 'Inter', system-ui, sans-serif; font-weight: 800; letter-spacing: -.025em;
}
body.panel .top h1 { font-size: 30px; }
body.panel h2 { font-weight: 700; }
body.panel .card, body.panel .panel, body.panel .kpi, body.panel .wk-day, body.panel .cal, body.panel .alert, body.panel .pro-tile {
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
body.panel .kpi span, body.panel .eyebrow { letter-spacing: .1em; font-size: 11px; }
body.panel .kpi b { font-size: 24px; }
body.panel .hero-num { font-size: 42px; }

/* seletores: opção marcada em tinta escura */
body.panel .seg { background: #ebe7e2; border: 0; padding: 4px; border-radius: 12px; }
body.panel .seg button { border-radius: 9px; color: #5e5852; }
body.panel .seg button.on { background: var(--ink); color: #fff; }
body.panel .stepper button.on { border-color: var(--ink); }
body.panel .btn.ghost { background: #fff; border-color: var(--line); }

/* ---------- barra lateral (computador) ---------- */
body.panel nav.side { background: #fff; border-right: 1px solid var(--line); }
body.panel nav.side .brand { display: flex; gap: 10px; align-items: center; font-family: 'Inter', sans-serif; font-weight: 700; font-size: 15px; }
body.panel nav.side .brand small { font-weight: 400; }
body.panel nav.side button { justify-content: flex-start; gap: 10px; color: #5e5852; }
body.panel nav.side button .badge { margin-left: auto; }
body.panel nav.side button.on { background: var(--ink); color: #fff; }
body.panel nav.side .foot a { display: inline-flex; align-items: center; gap: 6px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.ic { width: 20px; height: 20px; flex: none; }
.ic.sm { width: 15px; height: 15px; }

/* ---------- topo, abas e botão + (só no celular) ---------- */
.appbar, .tabbar, .fab { display: none; }
@media (max-width: 860px) {
  body.panel .app { display: block; }
  body.panel nav.side { display: none; }
  .appbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 15;
    background: var(--panel-dark); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  }
  .appbar .avatar { background: #3a3634; }
  .ab-title { display: flex; flex-direction: column; line-height: 1.15; margin-right: auto; min-width: 0; }
  .ab-title b { font-size: 16px; }
  .ab-title small { color: #b9b1aa; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ab-btn { position: relative; width: 38px; height: 38px; border-radius: 12px; border: 1px solid #3a3634; background: #2a2725; color: #fff; display: grid; place-items: center; cursor: pointer; }
  .ab-btn .ic { width: 19px; height: 19px; }
  .dot-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--panel-dark); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    backdrop-filter: blur(8px);
  }
  .tabbar button { background: none; border: 0; display: grid; justify-items: center; gap: 3px; font-size: 11px; color: #8a827b; padding: 4px 0; cursor: pointer; position: relative; }
  .tabbar button.on { color: var(--ink); font-weight: 600; }
  .tabbar button.on::before { content: ''; position: absolute; top: -7px; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--ink); }
  .fab {
    display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 16;
    width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
  }
  .fab[hidden] { display: none; }
  .fab .ic { width: 26px; height: 26px; stroke-width: 2.2; }
  body.panel main.content { padding: 14px 12px calc(110px + env(safe-area-inset-bottom)); }
  body.panel .top h1 { font-size: 26px; }
  body.panel .top { gap: 8px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  /* gaveta vira "folha" que sobe de baixo */
  .drawer { top: auto; left: 0; right: 0; width: 100vw; max-height: 88vh; border-radius: 20px 20px 0 0; animation: none; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  @keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
}
.more-list { display: grid; gap: 6px; margin-top: 10px; }
.more-list button, .more-list a { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-size: 15px; cursor: pointer; text-align: left; }
.more-list .badge { margin-left: auto; background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; }

/* ---------- login ---------- */
body.login-page { background: var(--panel-dark, #1f1d1c); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(90% 60% at 50% 0%, #3a3330, #1f1d1c); }
.login-card { width: min(380px, 100%); background: #fff; border-radius: 22px; padding: 26px 22px; }
.login-card h1 { font-family: 'Inter', sans-serif; font-weight: 800; letter-spacing: -.02em; font-size: 26px; margin: 10px 0 4px; }
.login-card p { color: var(--muted); margin: 0 0 6px; font-size: 14px; }
.login-card .logo-img { width: 170px; margin: 0; }

/* tabelas largas rolam dentro do cartão, sem esticar a página no celular */
body.panel .card, body.panel .panel, body.panel .sub-card { overflow-x: auto; max-width: 100%; }
body.panel .card > table, body.panel .panel > table { min-width: 520px; }
body.panel table.mini { min-width: 0; }
@media (max-width: 860px) {
  html:has(body.panel), body.panel { overflow-x: clip; }
  body.panel main.content { max-width: 100vw; }
  body.panel .filters input[type=date] { flex: 1 1 130px; }
}
@media (max-width: 860px) {
  body.panel .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  body.panel .kpi { padding: 12px; }
  body.panel .kpi b { font-size: 20px; }
  body.panel .kpi small { font-size: 11px; }
  body.panel .filters { gap: 6px; }
  body.panel .filters .seg { width: 100%; }
}

/* busca de cliente no novo agendamento */
.client-results { display: grid; gap: 6px; margin-top: 6px; }
.client-results button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 9px 12px; cursor: pointer; }
.client-results button:hover { border-color: var(--brand); }
.client-results span { color: var(--muted); font-size: 12px; }

/* logo da marca no lugar das iniciais */
img.avatar.logo { object-fit: cover; background: #fff; border: 1px solid var(--line); padding: 0; }
body.panel nav.side .brand img.avatar.logo { width: 46px; height: 46px; border-radius: 12px; }
.appbar img.avatar.logo { border-color: transparent; border-radius: 10px; }

/* ---------- agendaê ---------- */
.ae-logo { display: inline-flex; align-items: center; gap: 8px; font-family: 'Inter', sans-serif; font-weight: 800; font-size: 22px; letter-spacing: -.04em; color: var(--ink); }
.ae-logo i { font-style: normal; color: #2563eb; margin-left: -8px; }
.ae-logo .sq { width: 32px; height: 32px; border-radius: 9px; background: #2563eb; color: #fff; display: grid; place-items: center; font-size: 20px; }
.lg-new { text-align: center; margin: 16px 0 0 !important; font-size: 14px; }
.lg-new a { color: #1d4ed8; font-weight: 700; }
.plan-bar { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; background: #e3ecfd; color: #1e3a8a; padding: 10px 26px; font-size: 14px; font-weight: 600; }
.plan-bar.bad { background: #b3342a; color: #fff; }
.plan-bar.bad .btn { background: #fff; color: #b3342a; }
.plan-card { background: var(--panel-dark, #1b1a19); color: #fff; border-radius: 18px; padding: 20px; margin: 10px 0 12px; }
.plan-card .eyebrow { color: #2563eb; font-weight: 700; }
.plan-val { font-size: 40px; font-weight: 800; letter-spacing: -.04em; margin: 4px 0 10px; }
.plan-val small { font-size: 15px; color: #b9b1aa; font-weight: 600; letter-spacing: 0; }
.plan-card ul { margin: 0; padding-left: 18px; color: #e2dcd6; display: grid; gap: 4px; }
@media (max-width: 860px) { .plan-bar { padding: 8px 12px; font-size: 13px; } }
body.panel nav.side .foot::after { content: 'agendaê'; font-weight: 800; letter-spacing: -.03em; color: #c9c2bb; }
/* ícones nos avisos (substituem emojis) */
.alert > .ic { width: 19px; height: 19px; color: var(--brand, #2563eb); }
.alert.bad > .ic { color: #b3342a; }
button.chip { display: inline-flex; align-items: center; gap: 7px; }
button.chip .ic { width: 17px; height: 17px; }
.lbl .ic.sm { vertical-align: -2px; margin-right: 4px; }
/* WhatsApp por QR code */
.qr-head { display: flex; gap: 14px; align-items: flex-start; }
.qr-head h2 { margin: 0 0 2px; }
.qr-ic { width: 44px !important; height: 44px !important; padding: 10px; border-radius: 14px; background: #e3ecfd; color: var(--brand, #2563eb); }
.qr-ic.ok { background: #e3f1e8; color: #2f7d4f; }
.risk { display: flex; gap: 10px; margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: #fbf0dc; color: #6b4410; font-size: 14px; line-height: 1.5; }
.risk > .ic { color: #a8660f; margin-top: 2px; }
.qr-wrap { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.qr-wrap h2 { margin-top: 0; }
.qr-img { width: 280px; height: 280px; border-radius: 16px; border: 1px solid var(--line, #e6e1db); display: grid; place-items: center; background: #fff; }
.qr-img img { width: 264px; height: 264px; image-rendering: pixelated; }
.spin { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #e3ecfd; border-top-color: var(--brand, #2563eb); animation: qrspin .8s linear infinite; }
@keyframes qrspin { to { transform: rotate(360deg); } }
.meta-adv { margin-top: 14px; }
.meta-adv > summary { cursor: pointer; font-weight: 700; font-size: 15px; list-style-position: inside; }
@media (max-width: 640px) { .qr-wrap { grid-template-columns: 1fr; } .qr-img { margin: 0 auto; } }
/* barra do plano no computador: fica em cima do conteúdo, na coluna da direita */
#planBar:empty { display: none; }
@media (min-width: 861px) {
  body.panel .app { grid-template-rows: auto 1fr; }
  body.panel nav.side { grid-row: 1 / span 2; }
  body.panel #planBar, body.panel main.content { grid-column: 2; }
  body.panel #planBar:empty + main.content { grid-row: 1 / span 2; }
}
/* barra fixa de salvar (Configurações) */
.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 760px; margin-top: 16px; padding: 12px 16px; border-radius: 14px; background: #fff; border: 1px solid var(--line, #e6e1db); box-shadow: 0 -6px 20px rgba(0,0,0,.06); font-size: 14px; color: var(--muted, #77706a); }
.save-bar.dirty { background: #e3ecfd; border-color: #b9cdf7; color: #1e3a8a; font-weight: 600; }
.save-bar .btn { width: auto; }
@media (max-width: 860px) { .save-bar { bottom: calc(68px + env(safe-area-inset-bottom)); } }
