/* GestãoBLZ — base visual e menu */

:root {
  /* marca: índigo-violeta */
  --brand: #5B4BD6;
  --brand-strong: #4A3BC0;
  --brand-soft: #F1EFFD;
  --brand-line: #DCD7F8;

  /* status (não usar como marca) */
  --ok: #16A34A;
  --warn: #E6A23C;

  --bg: #FAFBFC;
  --surface: #FFFFFF;
  --hover: #F4F5F7;
  --active: #EFF0F3;
  --line: #E9EAEE;
  --line-strong: #DEE0E5;

  --ink: #18191C;
  --ink-2: #5B5F67;
  --ink-3: #8B9099;

  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(17, 19, 24, .05);
  --shadow-pop: 0 12px 32px -8px rgba(17, 19, 24, .18), 0 2px 6px rgba(17, 19, 24, .06);

  --sidebar-w: 248px;
  --content-max: 1320px;
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-sm); }

.ico { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ico svg, [data-icon] svg { width: 100%; height: 100%; display: block; }

/* ---------- Layout ---------- */
.main {
  min-height: 100vh;
  padding: 44px 56px 64px calc(var(--sidebar-w) + 56px);
  outline: none;
}

/* ---------- Menu lateral ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 18px 12px 12px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  z-index: 20;
}

.sidebar > * { flex-shrink: 0; }

.brand { display: flex; align-items: center; padding: 4px 10px 20px; }
.brand-logo { display: block; height: 24px; width: auto; margin-left: -2px; }

.salon {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  transition: background .12s ease;
}
.salon:hover { background: var(--hover); }
.avatar {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-strong);
  font-weight: 600; font-size: 12px; letter-spacing: .02em;
}
.avatar--sm { width: 30px; height: 30px; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.salon-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.salon-text strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.salon-text span { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; height: 38px; margin-bottom: 14px;
  border-radius: var(--radius);
  background: var(--brand); color: #fff;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 1px 2px rgba(74, 59, 192, .3);
  transition: background .12s ease;
}
.btn-primary:hover { background: var(--brand-strong); }
.btn-primary .ico { width: 16px; height: 16px; }

.side-nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  transition: background .12s ease, color .12s ease;
}
.nav-item .ico { color: var(--ink-3); transition: color .12s ease; }
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--active); color: var(--ink); font-weight: 600; }
.nav-item[aria-current="page"] .ico { color: var(--brand); }

.side-bottom {
  margin-top: auto; padding-top: 12px;
  display: flex; flex-direction: column; gap: 1px;
}

.wa-row {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 10px; margin-bottom: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  font-size: 14px; font-weight: 500;
  transition: background .12s ease;
}
.wa-row:hover { background: var(--hover); }
.wa-row[aria-current="page"] { background: var(--active); }
.wa-glyph { width: 16px; height: 16px; color: #1FAF58; flex: none; }
.wa-state {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); flex: none; }
.is-connected .dot { background: var(--ok); }

.nav-item--quiet { height: 34px; font-size: 13.5px; }

/* ---------- Cabeçalho da página ---------- */
.page-head, .page-body { width: 100%; max-width: var(--content-max); margin-inline: auto; }
.page-head { margin-bottom: 28px; }
.page-date { margin: 0 0 4px; font-size: 13px; color: var(--ink-3); }
.page-title { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -.025em; }
.page-sub { margin: 6px 0 0; font-size: 15px; color: var(--ink-2); }

/* ---------- Corpo (provisório) ---------- */
.placeholder {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 64px 24px; border-radius: var(--radius-lg);
  border: 1px dashed var(--line-strong);
  background: var(--surface);
}
.placeholder .ico { width: 22px; height: 22px; color: var(--ink-3); margin-bottom: 14px; }
.placeholder h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.placeholder p { margin: 0; max-width: 340px; font-size: 14px; color: var(--ink-3); }

/* ---------- Topo e barra (celular) ---------- */
.mobile-top, .tabbar { display: none; }

.icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
}
.icon-btn .ico { width: 16px; height: 16px; }

/* ---------- Folha "Mais" ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(17, 19, 24, .28);
  opacity: 0; transition: opacity .22s ease;
}
.sheet-backdrop.is-open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-height: 85vh; overflow-y: auto;
  padding: 8px 14px calc(14px + var(--safe-b));
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow-pop);
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet.is-open { transform: translateY(0); }
.sheet:focus { outline: none; }
.sheet-handle { width: 36px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: 0 auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 12px; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.sheet-list {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
}
.sheet-list--quiet { margin-top: 10px; }
.sheet-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 0 14px;
  border-bottom: 1px solid var(--line);
  font-size: 15px; font-weight: 500;
}
.sheet-row:last-child { border-bottom: 0; }
.sheet-row:active { background: var(--hover); }
.sheet-row > .ico { width: 19px; height: 19px; color: var(--ink-2); }
.sheet-label { flex: 1; }
.sheet-meta { font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.sheet-row .chev { width: 16px; height: 16px; color: var(--ink-3); }
.sheet-list--quiet .sheet-row { color: #B42318; }
.sheet-list--quiet .sheet-row > .ico { color: #B42318; }

/* ---------- Aviso ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60;
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: var(--radius);
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-pop);
  transition: opacity .18s ease, transform .18s ease;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Telas grandes e TV: a interface cresce por inteiro ---------- */
@media (min-width: 1800px) { html { zoom: 1.12; } }
@media (min-width: 2300px) { html { zoom: 1.35; } }
@media (min-width: 3000px) { html { zoom: 1.75; } }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .main { padding: 36px 36px 56px calc(var(--sidebar-w) + 36px); }
}

/* ---------- Celular ---------- */
@media (max-width: 820px) {
  .sidebar { display: none; }

  .mobile-top {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    height: calc(56px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 16px 0;
    background: rgba(250, 251, 252, .92);
    backdrop-filter: saturate(1.6) blur(14px);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .mobile-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .mobile-brand strong { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  :root { --content-max: 680px; }
  .main { min-height: auto; padding: 22px 16px calc(var(--tabbar-h) + 32px + var(--safe-b)); }
  .page-head { margin-bottom: 20px; }
  .page-title { font-size: 23px; }
  .page-sub { font-size: 14.5px; }
  .placeholder { padding: 48px 20px; }

  .tabbar {
    display: block;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding-bottom: var(--safe-b);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: saturate(1.6) blur(14px);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-top: 1px solid var(--line);
  }
  .tabbar-inner {
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: var(--tabbar-h); max-width: 520px; margin: 0 auto;
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 11.5px; font-weight: 500; color: var(--ink-3);
    -webkit-tap-highlight-color: transparent;
  }
  .tab .ico { width: 22px; height: 22px; }
  .tab[aria-current="page"] { color: var(--ink); font-weight: 600; }
  .tab[aria-current="page"] .ico { color: var(--brand); }

  .tab--book { color: var(--brand-strong); font-weight: 600; }
  .tab-plus {
    display: grid; place-items: center;
    width: 40px; height: 30px; border-radius: 10px;
    background: var(--brand); color: #fff;
    box-shadow: 0 2px 6px rgba(91, 75, 214, .3);
  }
  .tab-plus .ico { width: 18px; height: 18px; }
  .tab--book:active .tab-plus { background: var(--brand-strong); }

  .toast { bottom: calc(var(--tabbar-h) + 14px + var(--safe-b)); }
}

@media (min-width: 821px) {
  .sheet, .sheet-backdrop { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Componentes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-kicker { font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px 12px;
}
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.card-head .muted { font-size: 13px; }
.muted { color: var(--ink-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease;
}
.btn .ico { width: 16px; height: 16px; }
.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(74, 59, 192, .3); }
.btn--primary:hover { background: var(--brand-strong); }
.btn--secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm); }
.btn--secondary:hover { background: var(--hover); }
.btn--block { width: 100%; }
.btn--sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ico--wa { color: #1FAF58; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  height: 26px; padding: 0 10px; border-radius: 99px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
  background: #F1F2F5; color: var(--ink-2);
}
.chip .ico { width: 13px; height: 13px; }
.chip--brand { background: var(--brand-soft); color: var(--brand-strong); }
.chip--ok { background: #EAF6EE; color: #15803D; }
.chip--warn { background: #FFF3E3; color: #B45309; }
.chip--action {
  background: var(--surface); color: var(--brand-strong);
  border: 1px solid var(--brand-line); font-weight: 600; cursor: pointer;
}
.chip--action:hover { background: var(--brand-soft); }
