/* ============================================================
   Atelier — Painel da nail designer
   Direção: editorial, quente e refinado. Creme + bordô + terracota + ouro.
   ============================================================ */

:root {
  --cream:      #F8F1E7;
  --cream-2:    #F2E7D8;
  --paper:      #FCF8F2;
  --ink:        #3A2230;   /* bordô profundo (texto) */
  --ink-soft:   #6E5360;
  --wine:       #5B2333;
  --terra:      #C26B57;   /* terracota/rosé (acento) */
  --terra-deep: #A8503D;
  --gold:       #B0894F;
  --line:       #E3D6C5;
  --ok:         #4F7A52;
  --warn:       #B5722A;

  --shadow-sm: 0 1px 2px rgba(58,34,48,.06), 0 2px 8px rgba(58,34,48,.05);
  --shadow-md: 0 6px 22px rgba(58,34,48,.10), 0 2px 6px rgba(58,34,48,.06);
  --shadow-lg: 0 24px 60px rgba(58,34,48,.18);
  --radius: 16px;

  --display: "Fraunces", Georgia, serif;
  --body: "Hanken Grotesk", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--body);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 110% -10%, rgba(194,107,87,.10), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(176,137,79,.10), transparent 55%),
    var(--cream);
  -webkit-font-smoothing: antialiased;
  position: relative;
}
/* grão sutil por cima de tudo */
body::after {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--terra); color: var(--paper); }

/* ---------- utilidades de tipografia ---------- */
.display { font-family: var(--display); font-weight: 500; letter-spacing: -.01em; }
.eyebrow {
  font-size: .72rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold); font-weight: 600;
}

/* ============================================================
   AUTH (login / cadastro) — layout em duas colunas
   ============================================================ */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100dvh; }

.auth__brand {
  position: relative; overflow: hidden;
  background:
    linear-gradient(160deg, var(--wine) 0%, #401726 55%, #2C0F1B 100%);
  color: var(--cream);
  padding: clamp(2rem, 5vw, 4.5rem);
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth__brand::before { /* arcos decorativos (esmaltes/unhas estilizadas) */
  content: ""; position: absolute; right: -22%; top: -10%;
  width: 70%; aspect-ratio: 1; border-radius: 50% 50% 48% 52% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 35% 30%, rgba(194,107,87,.55), transparent 60%),
              radial-gradient(circle at 70% 70%, rgba(176,137,79,.35), transparent 55%);
  filter: blur(2px);
}
.auth__brand::after { /* linha de "lixa"/textura */
  content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 38%;
  background: repeating-linear-gradient(135deg, rgba(248,241,231,.04) 0 2px, transparent 2px 14px);
  pointer-events: none;
}
.brand__mark {
  font-family: var(--display); font-weight: 600; font-size: 1.5rem;
  display: flex; align-items: center; gap: .55rem; position: relative; z-index: 1;
}
.brand__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--terra);
  box-shadow: 0 0 0 4px rgba(194,107,87,.25); }
.brand__hero { position: relative; z-index: 1; max-width: 26ch; }
.brand__hero h1 {
  font-family: var(--display); font-weight: 400; font-optical-sizing: auto;
  font-size: clamp(2.4rem, 4.4vw, 3.9rem); line-height: 1.02; letter-spacing: -.02em;
  margin: 1rem 0 1.1rem;
}
.brand__hero h1 em { font-style: italic; color: var(--terra); }
.brand__hero p { color: rgba(248,241,231,.78); font-size: 1.02rem; line-height: 1.6; }
.brand__foot { position: relative; z-index: 1; color: rgba(248,241,231,.55); font-size: .82rem; }

.auth__panel {
  display: flex; align-items: center; justify-content: center;
  padding: clamp(1.5rem, 5vw, 3rem);
}
.card-auth {
  width: 100%; max-width: 400px;
  animation: rise .7s cubic-bezier(.2,.8,.2,1) both;
}
.card-auth h2 { font-family: var(--display); font-weight: 500; font-size: 1.9rem; letter-spacing: -.02em; margin-bottom: .35rem; }
.card-auth .sub { color: var(--ink-soft); margin-bottom: 1.8rem; }

/* ---------- formulários ---------- */
.field { margin-bottom: 1.05rem; }
.field label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .4rem; letter-spacing: .01em; }
.field input, .field select {
  width: 100%; padding: .82rem .95rem; font-family: var(--body); font-size: .98rem; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 11px;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--terra);
  box-shadow: 0 0 0 4px rgba(194,107,87,.14);
}
.field input::placeholder { color: #bdaa9d; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--body); font-weight: 600; font-size: .96rem; cursor: pointer;
  padding: .85rem 1.3rem; border-radius: 11px; border: 1.5px solid transparent;
  transition: transform .15s cubic-bezier(.2,.8,.2,1), box-shadow .2s, background .2s, color .2s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn--primary { background: var(--wine); color: var(--cream); box-shadow: var(--shadow-md); width: 100%; }
.btn--primary:hover { background: #6a2a3c; box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--terra); color: var(--terra-deep); }
.btn--terra { background: var(--terra); color: var(--paper); }
.btn--terra:hover { background: var(--terra-deep); }
.btn--sm { padding: .5rem .8rem; font-size: .84rem; border-radius: 9px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.switch { margin-top: 1.4rem; font-size: .9rem; color: var(--ink-soft); text-align: center; }
.switch a { color: var(--terra-deep); font-weight: 600; text-decoration: none; cursor: pointer; }
.switch a:hover { text-decoration: underline; }

.form-error {
  background: rgba(168,80,61,.10); border: 1px solid rgba(168,80,61,.28); color: var(--terra-deep);
  padding: .7rem .9rem; border-radius: 10px; font-size: .88rem; margin-bottom: 1rem;
}

/* ============================================================
   APP SHELL — sidebar + conteúdo
   ============================================================ */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100dvh; }

.side {
  background: linear-gradient(180deg, #45192A 0%, #341320 100%);
  color: var(--cream); padding: 1.6rem 1.1rem; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh;
}
.side__brand { font-family: var(--display); font-weight: 600; font-size: 1.25rem; display: flex; align-items: center; gap: .5rem; padding: .3rem .5rem 1.4rem; }
.side__nav { display: flex; flex-direction: column; gap: .25rem; }
.nav-item {
  display: flex; align-items: center; gap: .7rem; padding: .72rem .8rem; border-radius: 10px;
  color: rgba(248,241,231,.72); font-weight: 500; font-size: .94rem; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, color .15s, border-color .15s;
}
.nav-item:hover { background: rgba(248,241,231,.06); color: var(--cream); }
.nav-item.is-active { background: rgba(194,107,87,.18); color: #fff; border-color: rgba(194,107,87,.4); }
.nav-item .ic { width: 18px; text-align: center; opacity: .9; }
.side__foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(248,241,231,.12); }
.side__user { font-size: .82rem; color: rgba(248,241,231,.7); margin-bottom: .6rem; line-height: 1.4; }
.side__user strong { color: var(--cream); display: block; font-weight: 600; }

.main { padding: clamp(1.4rem, 3.5vw, 3rem); max-width: 1100px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.8rem; flex-wrap: wrap; }
.page-head h1 { font-family: var(--display); font-weight: 500; font-size: clamp(1.8rem, 3vw, 2.5rem); letter-spacing: -.02em; }
.page-head p { color: var(--ink-soft); margin-top: .25rem; }

/* ---------- cards / listas ---------- */
.grid { display: grid; gap: 1rem; }
.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s;
  animation: rise .5s cubic-bezier(.2,.8,.2,1) both;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.svc__top { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.svc__name { font-family: var(--display); font-weight: 500; font-size: 1.2rem; letter-spacing: -.01em; }
.svc__price { font-family: var(--display); font-size: 1.35rem; color: var(--wine); white-space: nowrap; }
.svc__meta { color: var(--ink-soft); font-size: .9rem; margin-top: .5rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.svc__actions { margin-top: 1rem; display: flex; gap: .5rem; }
.tag { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 600; letter-spacing: .04em;
  padding: .22rem .55rem; border-radius: 999px; text-transform: uppercase; }
.tag--off { background: #efe3d4; color: var(--ink-soft); }
.tag--on { background: rgba(79,122,82,.14); color: var(--ok); }
.tag--warn { background: rgba(180,140,60,.15); color: #a07020; }

/* agenda */
.timeline { display: flex; flex-direction: column; gap: .6rem; }
.appt {
  display: grid; grid-template-columns: 88px 1fr auto; gap: 1rem; align-items: center;
  background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--terra);
  border-radius: 12px; padding: .9rem 1.1rem; box-shadow: var(--shadow-sm);
  animation: rise .5s cubic-bezier(.2,.8,.2,1) both;
}
.appt__time { font-family: var(--display); font-size: 1.2rem; color: var(--wine); }
.appt__time small { display: block; font-family: var(--body); font-size: .72rem; color: var(--ink-soft); }
.appt__svc { font-weight: 600; }
.appt__who { color: var(--ink-soft); font-size: .88rem; }
.st { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: .25rem .6rem; border-radius: 999px; }
.st--confirmado { background: rgba(79,122,82,.15); color: var(--ok); }
.st--pendente, .st--aguardando_pagamento { background: rgba(181,114,42,.15); color: var(--warn); }
.st--cancelado, .st--no_show { background: #ece1d5; color: var(--ink-soft); }
.st--concluido { background: rgba(91,35,51,.12); color: var(--wine); }

/* status do canal (config) */
.statline { display: flex; align-items: center; gap: .6rem; padding: .9rem 1.1rem; border: 1px solid var(--line);
  border-radius: 12px; background: var(--paper); margin-bottom: .7rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot--off { background: #cdbba9; }
.dot--on { background: var(--ok); }

/* empty state */
.empty { text-align: center; padding: 3.5rem 1rem; color: var(--ink-soft); border: 2px dashed var(--line); border-radius: var(--radius); }
.empty .big { font-family: var(--display); font-size: 1.4rem; color: var(--ink); margin: .6rem 0 .3rem; }

/* toolbar */
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.4rem; }
.toolbar input[type="date"] { padding: .55rem .7rem; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); font-family: var(--body); }

/* jornada chips */
.days { display: flex; flex-wrap: wrap; gap: .5rem; }
.day-chip { padding: .5rem .8rem; border-radius: 10px; border: 1.5px solid var(--line); background: var(--paper);
  font-weight: 600; font-size: .85rem; cursor: pointer; }
.day-chip.is-on { background: var(--wine); color: var(--cream); border-color: var(--wine); }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(44,15,27,.45); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 100; animation: fade .2s both; }
.modal { background: var(--paper); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 440px;
  padding: 1.7rem; animation: rise .35s cubic-bezier(.2,.8,.2,1) both; }
.modal h3 { font-family: var(--display); font-weight: 500; font-size: 1.5rem; margin-bottom: 1.2rem; }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.modal__actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.3rem; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 24px);
  background: var(--ink); color: var(--cream); padding: .8rem 1.2rem; border-radius: 12px;
  box-shadow: var(--shadow-lg); font-weight: 500; font-size: .92rem; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 9998; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--terra-deep); }

/* ---------- loader ---------- */
.loader { display: grid; place-items: center; min-height: 100dvh; }
.spin { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--terra); animation: spin .8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* stagger nos cards/appointments */
.stagger > * { animation-delay: calc(var(--i, 0) * 60ms); }

/* ---------- agente (F2) ---------- */

/* Interruptor liga/desliga do agente */
.switch {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .45rem 1rem; border-radius: 999px; border: 2px solid var(--line);
  background: var(--paper); color: var(--ink-soft); font-size: .9rem;
  font-family: var(--body); cursor: pointer; transition: all .2s;
}
.switch--on {
  background: #e6f4e6; border-color: var(--ok); color: var(--ok); font-weight: 600;
}

/* Abas internas da área Agente */
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; border-bottom: 2px solid var(--line); padding-bottom: .4rem; margin-bottom: 1rem; }
.tab {
  padding: .35rem .85rem; border-radius: 8px 8px 0 0; border: none; background: transparent;
  color: var(--ink-soft); font-family: var(--body); font-size: .88rem; cursor: pointer;
  transition: background .15s, color .15s;
}
.tab.is-active { background: var(--cream-2); color: var(--terra-deep); font-weight: 600; }
.tab:hover:not(.is-active) { background: var(--cream-2); }

/* Chip clicável de variável (mensagens) */
.var-chip {
  padding: .2rem .6rem; border-radius: 6px; border: 1.5px dashed var(--terra); background: transparent;
  color: var(--terra-deep); font-size: .8rem; font-family: var(--body); cursor: pointer;
  transition: background .15s;
}
.var-chip:hover { background: rgba(194,107,87,.08); }

/* Caixa de prévia da mensagem */
.preview {
  background: var(--cream-2); border: 1px solid var(--line); border-radius: 10px;
  padding: .7rem 1rem; font-size: .9rem; line-height: 1.6; min-height: 3rem;
  color: var(--ink); white-space: pre-wrap;
}

/* Item de FAQ */
.faq-item {
  display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem;
  padding: .8rem 0; border-bottom: 1px solid var(--line);
}
.faq-item--off { opacity: .5; }
.faq-item__body { flex: 1; }
.faq-item__q { font-weight: 600; font-size: .95rem; }
.faq-item__a { color: var(--ink-soft); font-size: .88rem; margin-top: .2rem; }
.faq-item__ctrl { display: flex; gap: .3rem; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.btn--xs { padding: .18rem .5rem; font-size: .78rem; }
.btn--active { background: var(--cream-2); color: var(--terra-deep); font-weight: 600; }

/* ---------- skeleton (shimmer creme) ---------- */
.skeleton { position: relative; overflow: hidden; background: var(--cream-2); border-radius: 12px; }
.skeleton--card { height: 84px; margin-bottom: .8rem; }
.skeleton::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
  transform: translateX(-100%); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- bloco de erro recuperável ---------- */
.error-box { text-align: center; padding: 2.4rem 1rem; border: 1.5px solid rgba(168,80,61,.28);
  border-radius: var(--radius); background: rgba(168,80,61,.06); color: var(--terra-deep); }
.error-box p { margin-bottom: 1rem; }

/* ---------- banner offline/sessão ---------- */
.banner { background: var(--warn); color: var(--paper); text-align: center;
  padding: .55rem 1rem; font-size: .88rem; font-weight: 600; }

/* ---------- faixa de impersonação (inline no shell) ---------- */
.imp-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .6rem 1rem; margin: -1.4rem -1.4rem 1.4rem;
  background: var(--wine); color: #fff; font-weight: 600; font-size: .92rem;
}

/* ---------- onboarding / checklist ---------- */
.onboard { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem 1.4rem; box-shadow: var(--shadow-sm); margin-bottom: 1.6rem; }
.onboard__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.onboard__head strong { font-family: var(--display); font-size: 1.2rem; }
.onboard__sub { color: var(--ink-soft); font-size: .88rem; margin-top: .15rem; }
.onboard__bar { height: 8px; border-radius: 999px; background: var(--cream-2); margin: 1rem 0 1.1rem; overflow: hidden; }
.onboard__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--terra), var(--gold)); transition: width .4s; }
.checklist { list-style: none; display: flex; flex-direction: column; gap: .55rem; }
.checklist li { display: flex; align-items: center; gap: .7rem; }
.checklist li .check { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
  border: 1.5px solid var(--line); font-size: .8rem; color: var(--ink-soft); flex-shrink: 0; }
.checklist li.is-done { color: var(--ink-soft); text-decoration: line-through; }
.checklist li.is-done .check { background: rgba(79,122,82,.15); color: var(--ok); border-color: transparent; }
.checklist li button { margin-left: auto; }

/* ---------- responsivo mobile (bottombar) ---------- */
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth__brand { display: none; }

  .app { grid-template-columns: 1fr; }
  .main { padding: 1.2rem 1rem 5.5rem; } /* espaço para a bottombar */

  .side { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; z-index: 50;
    flex-direction: row; align-items: center; gap: 0; padding: .4rem .3rem;
    background: linear-gradient(180deg, #45192A, #341320); box-shadow: 0 -6px 20px rgba(58,34,48,.25); }
  .side__brand, .side__foot { display: none; }
  .side__nav { flex-direction: row; flex: 1; justify-content: space-around; gap: 0; }
  .nav-item { flex-direction: column; gap: .15rem; padding: .45rem .3rem; font-size: .7rem; text-align: center; border-radius: 8px; min-height: 44px; justify-content: center; }
  .nav-item .ic { font-size: 1.05rem; }

  .page-head { align-items: flex-start; }
  .page-head .btn { width: 100%; }
  .toolbar { flex-direction: column; align-items: stretch; }

  .imp-bar { margin: -1.2rem -1rem 1.2rem; }
}

@media (max-width: 560px) {
  .appt { grid-template-columns: 1fr auto; row-gap: .4rem; }
  .appt__time { grid-column: 1 / -1; }
  .modal .row { grid-template-columns: 1fr; }
  .modal { max-height: 88dvh; overflow-y: auto; }
}

/* ---------- acessibilidade: foco ---------- */
.btn:focus-visible, .nav-item:focus-visible, .field input:focus-visible { outline: 2px solid var(--terra); outline-offset: 2px; }

/* ============================================================
   Faixa de impersonação (legado — mantido para compatibilidade)
   ============================================================ */
.imp-banner {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.6rem 1rem;
  background: var(--wine, #5B2333); color: #fff;
  font-family: 'Hanken Grotesk', sans-serif; font-weight: 600; font-size: 0.95rem;
}
.imp-banner__sair {
  background: rgba(255,255,255,0.18); color: #fff; border: 0;
  border-radius: 999px; padding: 0.35rem 0.9rem; cursor: pointer; font-weight: 600;
}
.imp-banner__sair:hover { background: rgba(255,255,255,0.3); }
