/* =============================================================================
   BARBEARIA URBANA — design system do painel
   Papel e tinta (claro) / preto e off-white (escuro), um so vermelho de poste de
   barbearia como destaque, titulos e numeros em Bebas Neue, texto em Inter.
   Cantos quase retos, sombra dura nos cartoes de destaque, listras diagonais.
   Regra das cores: vermelho = acao/destaque; tinta invertida = selecionado.
   ============================================================================= */

:root {
  /* superficies (claro: papel) */
  --bg: #f2eee6;
  --surface: #fbf9f4;
  --surface-2: #e8e2d6;
  --line: #d8d0c1;
  --line-strong: #141414;

  /* texto */
  --ink: #141414;
  --ink-soft: #5a544b;
  --ink-faint: #736c61;

  /* barras de navegacao: pretas nos dois temas */
  --chrome: #0b0b0b;
  --chrome-2: #181818;
  --chrome-line: #262626;
  --chrome-ink: #f2ede4;
  --chrome-soft: #8f8a82;

  /* destaque — sobrescrito em tempo real pela cor escolhida pelo barbeiro (theme.js) */
  --accent: #d92d20;
  --accent-strong: #b6261b;
  --accent-ink: #ffffff;
  --accent-text: color-mix(in oklab, var(--accent) 85%, black);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);

  /* semanticas — fixas, nao seguem a cor de destaque */
  --pos: #1e8a4c;
  --neg: #c8261b;
  --warn: #a86a0c;

  /* dados: as mesmas cores em todo grafico do painel */
  --chart-revenue: var(--ink);
  --chart-expense: var(--neg);
  --chart-tax: var(--warn);

  /* listras de poste de barbearia */
  --stripe-light: #f2ede4;
  --stripes: linear-gradient(135deg,
    var(--accent) 25%, var(--stripe-light) 25%, var(--stripe-light) 50%,
    var(--accent) 50%, var(--accent) 75%, var(--stripe-light) 75%);
  --stripe-size: 28px 28px;

  --shadow-hard: 4px 4px 0 var(--ink);
  --radius: 4px;
  --radius-sm: 3px;

  --font-display: "Bebas Neue", "Oswald", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0d0d0d;
  --surface: #171717;
  --surface-2: #222222;
  --line: #2c2c2c;
  --line-strong: #f2ede4;

  --ink: #f2ede4;
  --ink-soft: #a9a39a;
  --ink-faint: #827c74;

  --accent-text: color-mix(in oklab, var(--accent) 72%, white);
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);

  --pos: #3cc47a;
  --neg: #ff5a4e;
  --warn: #f2b33d;

  --shadow-hard: 4px 4px 0 var(--accent);

  color-scheme: dark;
}

/* =============================================================================
   BASE
   ============================================================================= */
*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font-body);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--accent-text); }
button { font: inherit; color: inherit; }
img { max-width: 100%; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 18px; height: 18px; flex: none;
  display: inline-block; vertical-align: middle;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

.num { font-variant-numeric: tabular-nums; }

.display {
  font-family: var(--font-display); font-weight: 400;
  letter-spacing: 0.03em; text-transform: uppercase; line-height: 0.95;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.note, .stat-note { font-size: 13px; color: var(--ink-faint); }
.card-sub { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; margin: -4px 0 14px; }

#loading-bar {
  position: fixed; top: 0; left: 0; z-index: 400;
  height: 4px; width: 0; opacity: 0;
  background: var(--stripes); background-size: var(--stripe-size);
  animation: pole 0.7s linear infinite;
  transition: width 0.25s ease, opacity 0.3s ease;
}
#loading-bar.active { opacity: 1; }
@keyframes pole { to { background-position: 28px 0; } }

/* =============================================================================
   FORMULARIOS
   ============================================================================= */
input[type="text"], input[type="password"], input[type="number"], input[type="email"],
input[type="search"], input[type="date"], input[type="time"], input[type="month"], input[type="tel"],
select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  font: 500 15px/1.3 var(--font-body);
  color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
select { cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .time-field > label {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px;
  font: 700 11.5px/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-soft);
}
.field-hint {
  font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none;
  color: var(--ink-faint);
}

.time-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.time-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }

.color-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.color-row input[type="color"] {
  width: 48px; height: 40px; padding: 3px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 30px; height: 30px; border-radius: var(--radius-sm); cursor: pointer;
  border: 2px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line);
}
.swatch.is-active { box-shadow: 0 0 0 2px var(--ink); }

/* =============================================================================
   BOTOES
   ============================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px;
  border: 2px solid transparent; border-radius: var(--radius-sm);
  font: 700 12.5px/1 var(--font-body); letter-spacing: 0.07em; text-transform: uppercase;
  white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.08s, box-shadow 0.12s;
}
.btn:active { transform: translate(1px, 1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn .icon { width: 17px; height: 17px; stroke-width: 2.2; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); }

.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }

.btn-quiet { background: var(--surface-2); color: var(--ink); }
.btn-quiet:hover { background: color-mix(in srgb, var(--ink) 14%, var(--surface-2)); }

.btn-danger { background: transparent; color: var(--neg); border-color: color-mix(in srgb, var(--neg) 55%, transparent); }
.btn-danger:hover { background: var(--neg); border-color: var(--neg); color: #fff; }

.btn-sm { min-height: 34px; padding: 0 12px; font-size: 11.5px; gap: 6px; }
.btn-sm .icon { width: 15px; height: 15px; }

.btn-icon {
  width: 38px; height: 38px; flex: none; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.btn-icon:hover { background: var(--ink); color: var(--bg); }
.btn-icon.danger { color: var(--neg); }
.btn-icon.danger:hover { background: var(--neg); color: #fff; }
.btn-icon-sm { width: 32px; height: 32px; }
.btn-icon-sm .icon { width: 16px; height: 16px; }
/* no toque (celular), nenhum alvo abaixo de 44px — no mouse os botoes pequenos continuam compactos */
@media (pointer: coarse) {
  .btn-sm { min-height: 44px; }
  .btn-icon-sm { width: 44px; height: 44px; }
  .swatch { width: 40px; height: 40px; }
}

.switch-btn { border: none; background: none; padding: 4px; cursor: pointer; display: inline-flex; }
.switch {
  display: inline-flex; width: 44px; height: 26px; padding: 3px;
  border-radius: var(--radius-sm); transition: background 0.15s;
}
.switch-on { background: var(--ink); }
.switch-off { background: var(--line); }
.switch-thumb {
  width: 20px; height: 20px; border-radius: 2px; background: var(--bg);
  transition: transform 0.15s;
}
.switch-on .switch-thumb { transform: translateX(18px); }

.toggle-switch {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  width: 44px; height: 26px; border-radius: var(--radius-sm);
  background: var(--line); position: relative; cursor: pointer; transition: background 0.15s;
}
.toggle-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 2px; background: var(--bg);
  transition: transform 0.15s;
}
.toggle-switch:checked { background: var(--ink); }
.toggle-switch:checked::after { transform: translateX(18px); }

/* =============================================================================
   CARTOES, ETIQUETAS, SELOS
   ============================================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}
.card-hero { border: 2px solid var(--line-strong); box-shadow: var(--shadow-hard); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head .section-title { flex: 1; margin: 0; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 40px; padding: 0 15px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-soft);
  font: 700 13px var(--font-body); cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip-on:hover { color: var(--bg); }

.tag {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 3px 8px; border-radius: 2px;
  background: var(--surface-2); color: var(--ink-soft);
  font: 600 12px/1.4 var(--font-body);
  overflow-wrap: anywhere;
}
.tag .icon { width: 13px; height: 13px; }
/* presenca: confirmou (verde) ou lembrete sem resposta (ambar) — sempre com texto, nunca so a cor */
.tag-ok { color: var(--pos); background: color-mix(in srgb, var(--pos) 14%, transparent); }
.tag-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.tag-bad { color: var(--neg); background: color-mix(in srgb, var(--neg) 12%, transparent); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 2px;
  background: var(--surface-2); color: var(--ink-soft);
  font: 700 10.5px/1.2 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase;
  white-space: nowrap;
}
.pill-pos { background: color-mix(in srgb, var(--pos) 15%, transparent); color: var(--pos); }

.stamp {
  display: inline-block; white-space: nowrap;
  padding: 4px 8px 2px; border: 2px solid currentColor; border-radius: 2px;
  font: 400 15px/1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-text); transform: rotate(-3deg);
}

.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 11.5px/1.2 var(--font-body); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent-text);
}
.kicker::before { content: ""; width: 8px; height: 8px; background: var(--accent); flex: none; }

.segmented {
  display: inline-flex; max-width: 100%; align-self: flex-start;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden;
}
.segmented button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 1 1 auto;
  min-height: 40px; padding: 0 14px; border: none; background: transparent; color: var(--ink);
  font: 700 12px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; white-space: nowrap;
}
.segmented button + button { border-left: 1.5px solid var(--line-strong); }
.segmented button.is-active { background: var(--ink); color: var(--bg); }
.segmented .icon { width: 16px; height: 16px; }

.alert-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--warn);
  border-radius: var(--radius);
  font-size: 14px; line-height: 1.5;
}
.alert-banner > .icon { width: 22px; height: 22px; color: var(--warn); }
.alert-banner > div { flex: 1; min-width: 0; }
.alert-banner strong { font-weight: 800; }
.alert-banner .btn { flex: none; }
.alert-banner.alert-danger { border-left-color: var(--neg); }
.alert-banner.alert-danger > .icon { color: var(--neg); }

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 26px 16px; text-align: center; color: var(--ink-faint); font-size: 14px;
}
.empty .icon { width: 30px; height: 30px; stroke-width: 1.6; }
.empty strong { font: 400 24px/1 var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink); }
.empty p { max-width: 38ch; }

/* =============================================================================
   ESTRUTURA — menu lateral (computador) / barra do topo (celular)
   ============================================================================= */
.shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh; min-height: 100dvh;
}

.sidebar {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--chrome); color: var(--chrome-ink);
  border-right: 1px solid var(--chrome-line);
  overflow-y: auto;
}
.sidebar-band { height: 10px; flex: none; background: var(--stripes); background-size: var(--stripe-size); }

.sidebar-brand { display: flex; align-items: center; gap: 13px; padding: 22px 20px 16px; }
/* simbolo Aparei (Navalha-A): cabo na cor do texto do menu, lamina sempre no vermelho poste */
.brand-mark { width: 40px; height: 44px; flex: none; color: var(--chrome-ink); }
.brand-text { min-width: 0; }
.brand-name {
  font: 400 27px/0.92 var(--font-display); letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--chrome-ink); overflow-wrap: anywhere;
}
.brand-sub {
  margin-top: 5px;
  font: 700 10px/1.2 var(--font-body); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--chrome-soft);
}

.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 12px 16px; flex: 1; }
.nav-group {
  padding: 18px 12px 6px;
  font: 700 10.5px/1 var(--font-body); letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--chrome-soft);
}
.nav-item {
  position: relative; width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: none; border-radius: var(--radius-sm);
  background: none; cursor: pointer; text-align: left;
  font: 600 14px/1.2 var(--font-body);
  color: color-mix(in srgb, var(--chrome-ink) 72%, transparent);
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--chrome-2); color: var(--chrome-ink); }
.nav-item.active { background: var(--chrome-2); color: var(--chrome-ink); }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: var(--accent);
}
.nav-item.active .icon { color: var(--accent); }

.wa-status {
  display: flex; align-items: center; gap: 10px;
  margin: 0 12px 10px; padding: 10px 12px;
  background: var(--chrome-2); border: 1px solid var(--chrome-line); border-radius: var(--radius-sm);
  color: var(--chrome-ink); font: 600 12.5px/1.2 var(--font-body);
  text-align: left; cursor: pointer;
}
.wa-status:hover { border-color: var(--chrome-soft); }
.wa-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wa-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--chrome-soft); }
.wa-dot.ok { background: #3cc47a; box-shadow: 0 0 0 3px rgba(60, 196, 122, 0.22); }
.wa-dot.warn { background: #f2b33d; box-shadow: 0 0 0 3px rgba(242, 179, 61, 0.22); }
.wa-dot.bad { background: #ff5a4e; box-shadow: 0 0 0 3px rgba(255, 90, 78, 0.25); animation: wa-pulse 1.6s ease-in-out infinite; }
@keyframes wa-pulse { 50% { opacity: 0.4; } }

.sidebar-footer {
  display: flex; align-items: center; gap: 4px;
  margin: 0 12px 14px; padding: 10px 4px 0 12px;
  border-top: 1px solid var(--chrome-line);
  color: var(--chrome-soft); font-size: 12.5px;
}
.sidebar-user { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer button {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px;
  border: none; border-radius: var(--radius-sm); background: none; color: inherit; cursor: pointer;
  font: 600 12px var(--font-body);
}
.sidebar-footer button:hover { background: var(--chrome-2); color: var(--chrome-ink); }
.sidebar-footer .icon { width: 16px; height: 16px; }
#theme-toggle-icon { display: inline-flex; }

/* ---- conteudo ---- */
.main { min-width: 0; padding: 36px 44px 80px; }
.view { display: none; flex-direction: column; gap: 22px; max-width: 1120px; margin: 0 auto; }
.view.active { display: flex; animation: view-in 0.18s ease-out; }
/* so opacidade: transform aqui viraria o "containing block" do botao flutuante (fixed) */
@keyframes view-in { from { opacity: 0; } to { opacity: 1; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 20px; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; }
.page-title {
  margin-top: 6px;
  font: 400 48px/0.92 var(--font-display); letter-spacing: 0.015em; text-transform: uppercase;
  overflow-wrap: anywhere;
}
.page-sub { margin-top: 10px; max-width: 64ch; font-size: 14.5px; line-height: 1.5; color: var(--ink-soft); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.section-title {
  display: flex; align-items: center; gap: 12px; margin: 0 0 14px;
  font: 400 23px/1 var(--font-display); letter-spacing: 0.04em; text-transform: uppercase;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-title .count {
  font: 700 12px/1 var(--font-body); letter-spacing: 0.08em; color: var(--ink-faint);
}

.subnav { display: flex; gap: 26px; border-bottom: 2px solid var(--line); overflow-x: auto; }
.subnav-item {
  flex: none; margin-bottom: -2px; padding: 10px 0;
  border: none; border-bottom: 3px solid transparent; background: none; cursor: pointer;
  font: 700 12.5px/1.2 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint);
}
.subnav-item:hover { color: var(--ink); }
.subnav-item.is-active { color: var(--ink); border-bottom-color: var(--accent); }

/* ---- barra de baixo (celular) ---- */
.bottom-nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: var(--chrome); border-top: 1px solid var(--chrome-line);
}
.bottom-nav .nav-item {
  flex: 1 1 0; min-width: 0;
  flex-direction: column; justify-content: center; gap: 4px;
  padding: 7px 2px 5px; text-align: center; background: none;
  font: 700 10.5px/1.1 var(--font-body); letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--chrome-soft);
}
.bottom-nav .nav-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottom-nav .nav-item .icon { width: 23px; height: 23px; }
.bottom-nav .nav-item:hover { background: none; }
.bottom-nav .nav-item.active { background: none; color: var(--chrome-ink); }
.bottom-nav .nav-item.active::before { left: 24%; right: 24%; top: -6px; bottom: auto; width: auto; height: 3px; }

/* =============================================================================
   HOJE
   ============================================================================= */
.hoje-grid {
  display: grid; gap: 22px; align-items: start;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  grid-template-areas: "next kpis" "today upcoming";
}
.next-card { grid-area: next; }
.kpi-stack { grid-area: kpis; }
.hoje-today { grid-area: today; }
.hoje-upcoming { grid-area: upcoming; }

.next-card { position: relative; display: flex; flex-direction: column; gap: 16px; overflow: hidden; padding: 22px 22px 20px; align-self: stretch; }
.next-card::before {
  content: ""; position: absolute; top: 0; right: 0; width: 110px; height: 10px;
  background: var(--stripes); background-size: var(--stripe-size);
}
.next-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-right: 110px; }
.next-main { display: flex; align-items: flex-end; gap: 10px 20px; flex-wrap: wrap; }
.next-time { font: 400 76px/0.8 var(--font-display); letter-spacing: 0.01em; }
.next-who { flex: 1; min-width: 180px; }
.next-name {
  font: 400 36px/0.95 var(--font-display); letter-spacing: 0.02em; text-transform: uppercase;
  overflow-wrap: anywhere;
}
.next-meta { margin-top: 6px; font-size: 14px; color: var(--ink-soft); }
.next-price { font: 400 30px/1 var(--font-display); letter-spacing: 0.02em; }
.next-address { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--ink-soft); }
.next-address .icon { margin-top: 2px; }
.next-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.next-empty strong { display: block; font: 400 44px/0.9 var(--font-display); text-transform: uppercase; letter-spacing: 0.02em; }
.next-empty p { margin-top: 8px; color: var(--ink-soft); font-size: 14px; max-width: 46ch; }

.kpi-stack { display: grid; gap: 12px; }
.kpi {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.kpi-label {
  font: 700 11px/1.2 var(--font-body); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-soft);
}
.kpi-value { font: 400 42px/0.9 var(--font-display); letter-spacing: 0.01em; white-space: nowrap; }
.kpi-value.pos { color: var(--pos); }
.kpi-value.neg { color: var(--neg); }
.kpi-link {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 0; border: none; border-bottom: 2px solid var(--line); background: none; cursor: pointer;
  font: 700 12px var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft);
}
.kpi-link:hover { color: var(--ink); border-bottom-color: var(--accent); }
.kpi-link .icon { width: 15px; height: 15px; }

.kpi-value.kpi-soft { color: var(--ink-soft); }

/* A FECHAR: atendimentos que ja passaram, com o fechamento a um toque */
.close-card { margin-bottom: 22px; border: 2px solid var(--line-strong); }
.close-list { display: flex; flex-direction: column; }
.close-row {
  display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.close-row:first-child { border-top: none; padding-top: 2px; }
.close-when b { display: block; font: 400 25px/1 var(--font-display); letter-spacing: 0.02em; }
.close-when span {
  display: block; margin-top: 3px;
  font: 700 10.5px/1.2 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint);
}
.close-who { min-width: 0; }
.close-actions { display: flex; align-items: center; gap: 8px; }
.close-row.is-saving { opacity: 0.5; pointer-events: none; }
.pix-qr { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pix-qr img { width: 240px; max-width: 100%; height: auto; background: #fff; padding: 8px; border: 1px solid var(--line); }
.pix-code {
  width: 100%; padding: 10px 12px; border: 1.5px dashed var(--line); border-radius: var(--radius-sm);
  font: 500 12px/1.4 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; color: var(--ink-soft);
  overflow-wrap: anywhere; user-select: all;
}
@media (max-width: 640px) {
  .close-row { grid-template-columns: 50px minmax(0, 1fr); }
  .close-actions { grid-column: 1 / -1; }
  .close-actions .btn-primary { flex: 1; }
}

.timeline, .up-list { display: flex; flex-direction: column; }
.tl-row {
  display: grid; grid-template-columns: 58px 4px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 11px 0; border-top: 1px solid var(--line);
}
.tl-row:first-child { border-top: none; padding-top: 2px; }
.tl-time { font: 400 25px/1 var(--font-display); letter-spacing: 0.02em; }
.tl-bar { align-self: stretch; min-height: 34px; border-radius: 2px; background: var(--line-strong); }
.tl-row.is-past { opacity: 0.45; }
.tl-row.is-past .tl-bar { background: var(--line); }
.tl-row.is-next .tl-bar { background: var(--accent); }
.tl-row.is-next .tl-time { color: var(--accent-text); }
.tl-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-meta { font-size: 13px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-price { font: 400 20px/1 var(--font-display); letter-spacing: 0.02em; color: var(--ink-soft); white-space: nowrap; }

.up-row {
  display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 11px 0; border-top: 1px solid var(--line);
}
.up-row:first-child { border-top: none; padding-top: 2px; }
.up-day { font: 700 10.5px/1.2 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.up-time { margin-top: 3px; font: 400 23px/1 var(--font-display); letter-spacing: 0.02em; }
.up-body { min-width: 0; }

/* =============================================================================
   AGENDA
   ============================================================================= */
.agenda-toolbar { display: flex; align-items: center; gap: 12px; }
.day-strip {
  flex: 1; min-width: 0;
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity;
  padding: 2px 2px 8px; scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
}
.day-chip {
  flex: none; scroll-snap-align: start; width: 60px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 6px; cursor: pointer;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.day-chip:hover { border-color: var(--ink); }
.day-chip-wd { font: 700 10.5px/1 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.day-chip-num { font: 400 27px/0.9 var(--font-display); }
.day-chip-count { min-height: 14px; font: 800 11px/14px var(--font-body); color: var(--accent-text); }
.day-chip.is-today { border-color: var(--line-strong); }
.day-chip.is-closed { opacity: 0.45; }
.day-chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); opacity: 1; }
.day-chip.is-active .day-chip-wd { color: var(--bg); }
.day-chip.is-active .day-chip-count { color: var(--bg); }

.agenda-tools-right { display: flex; align-items: center; gap: 8px; flex: none; }
.date-pick { position: relative; display: flex; align-items: center; }
.date-pick .icon { position: absolute; left: 12px; color: var(--ink-faint); pointer-events: none; }
.date-pick input { width: 172px; padding-left: 38px; }

.slot-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.slot-chip {
  min-width: 68px; padding: 8px 10px 6px; text-align: center;
  border: 1.5px solid transparent; border-radius: var(--radius-sm);
  font: 400 20px/1 var(--font-display); letter-spacing: 0.04em;
}
.slot-free { border-color: var(--ink); color: var(--ink); background: var(--surface); }
.slot-occupied { background: var(--surface-2); color: var(--ink-faint); text-decoration: line-through; }
.slot-blocked {
  color: var(--neg); text-decoration: line-through;
  border-color: color-mix(in srgb, var(--neg) 45%, transparent);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--neg) 18%, transparent) 0 5px, transparent 5px 10px);
}
.slot-past { color: var(--ink-faint); border-color: var(--line); opacity: 0.6; }
.slot-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 12.5px; color: var(--ink-soft); }
.slot-legend span { display: inline-flex; align-items: center; gap: 7px; }
.slot-legend i { width: 14px; height: 14px; border-radius: 2px; display: inline-block; }
.slot-legend .lg-free { border: 1.5px solid var(--ink); }
.slot-legend .lg-occupied { background: var(--surface-2); }
.slot-legend .lg-blocked {
  border: 1.5px solid color-mix(in srgb, var(--neg) 45%, transparent);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--neg) 30%, transparent) 0 3px, transparent 3px 6px);
}

.appt-list { display: flex; flex-direction: column; gap: 10px; }
.agenda-day-header {
  display: flex; align-items: baseline; gap: 12px; margin: 18px 0 2px;
  font: 400 25px/1 var(--font-display); letter-spacing: 0.04em; text-transform: uppercase;
}
.agenda-day-header:first-child { margin-top: 0; }
.agenda-day-header::after { content: ""; flex: 1; height: 1px; background: var(--line); align-self: center; }
.adh-count { font: 700 12px/1 var(--font-body); letter-spacing: 0.06em; text-transform: none; color: var(--ink-faint); }

.appt-card {
  display: grid; grid-template-columns: 86px minmax(0, 1fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.appt-when {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 18px 6px; border-right: 2px dashed var(--line);
}
.appt-time { font: 400 31px/0.9 var(--font-display); letter-spacing: 0.02em; }
.appt-body { min-width: 0; padding: 15px 18px; display: flex; flex-direction: column; gap: 6px; }
.appt-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.appt-name { font-weight: 800; font-size: 16.5px; line-height: 1.25; overflow-wrap: anywhere; }
.appt-name.cancelled { text-decoration: line-through; color: var(--ink-faint); }
.appt-price { flex: none; font: 400 25px/1 var(--font-display); letter-spacing: 0.02em; }
.appt-meta {
  display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap; min-width: 0;
  font-size: 13.5px; color: var(--ink-soft); overflow-wrap: anywhere;
}
.appt-meta .icon { width: 15px; height: 15px; margin-top: 2px; }
.appt-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.appt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.appt-actions .spacer { flex: 1; }
.appt-card.cancelled { opacity: 0.6; }

.agenda-extra-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }

.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 13.5px;
}
.mini-row-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mini-row-title { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.mini-row-sub { font-size: 12.5px; color: var(--ink-soft); overflow-wrap: anywhere; }
.mini-row-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.mini-row .btn-icon, .mini-row .btn-quiet { background: var(--surface); }

/* =============================================================================
   CLIENTES
   ============================================================================= */
.client-toolbar { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1 1 260px; max-width: 460px; display: flex; align-items: center; }
.search-box .icon { position: absolute; left: 13px; color: var(--ink-faint); pointer-events: none; }
.search-box input { padding-left: 40px; min-height: 48px; }
.count-note { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

.client-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 12px; }
.client-card {
  display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 14px;
  padding: 16px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.avatar {
  width: 50px; height: 50px; border-radius: var(--radius-sm);
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  font: 400 25px/1 var(--font-display); letter-spacing: 0.04em;
}
.avatar.is-booked { background: var(--accent); color: var(--accent-ink); }
.client-main { min-width: 0; }
.client-name { font-weight: 800; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.client-phone { margin-top: 2px; font-size: 13px; color: var(--ink-soft); }
.client-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; }
.client-stat { display: flex; flex-direction: column; min-width: 0; }
.client-stat b { font: 400 21px/1 var(--font-display); letter-spacing: 0.02em; font-weight: 400; }
.client-stat.is-bad b { color: var(--neg); }
.client-card.is-lost { opacity: 0.75; }
.mini-row.is-off { opacity: 0.55; }
.link-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-row input { flex: 1 1 220px; }
#plans-section { margin-top: 10px; }
.duration-tag {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  min-height: 32px; padding: 0 2px; border: none; border-bottom: 1.5px dashed var(--line);
  background: none; color: var(--ink-soft); font: 600 13px var(--font-body); cursor: pointer;
}
.duration-tag:hover { color: var(--ink); border-bottom-color: var(--accent); }
.duration-tag .icon { width: 15px; height: 15px; }
.rating-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.rating-head b { font: 400 44px/0.9 var(--font-display); }
.rating-head span { font-size: 13px; color: var(--ink-soft); }
#view-clients > .segmented { align-self: flex-start; }
.segmented .count { margin-left: 2px; opacity: 0.7; }

/* ficha do cliente (modal) */
.check-row { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--accent); }
.check-row small { color: var(--ink-faint); }
.ficha-subtitle {
  margin: 6px 0 -6px; font: 700 11.5px/1.3 var(--font-body); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-soft);
}
.ficha-data { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.ficha-data-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.client-stat span {
  margin-top: 3px;
  font: 700 10px/1.2 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint);
}
.client-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.client-actions .btn { flex: 1; }

.history-row {
  display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 11px 0; border-top: 1px solid var(--line);
}
.history-row:first-child { border-top: none; }
.history-day { font: 700 11.5px/1.2 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; }
.history-time { margin-top: 3px; font: 400 21px/1 var(--font-display); letter-spacing: 0.02em; color: var(--ink-soft); }
.history-main { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.history-sub { font-size: 12px; color: var(--ink-faint); overflow-wrap: anywhere; }
.history-price { font: 400 21px/1 var(--font-display); letter-spacing: 0.02em; }
.history-row.cancelled .history-main, .history-row.cancelled .history-price { text-decoration: line-through; color: var(--ink-faint); }

/* =============================================================================
   FINANCAS — resumo do mes e despesas
   ============================================================================= */
.report-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.month-label {
  min-width: 210px; text-align: center;
  font: 400 30px/1 var(--font-display); letter-spacing: 0.04em; text-transform: uppercase;
}
.month-pick { margin-left: auto; }
.month-pick input { width: 180px; }

.dre-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); padding: 0; overflow: hidden; }
.dre-head { display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 26px 26px 24px; border-right: 1px solid var(--line); min-width: 0; }
.dre-profit { font: 400 68px/0.85 var(--font-display); letter-spacing: 0.01em; overflow-wrap: anywhere; }
.dre-profit.pos { color: var(--pos); }
.dre-profit.neg { color: var(--neg); }
.dre-profit-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13.5px; color: var(--ink-soft); }
.dre-margin { display: inline-flex; align-items: baseline; gap: 6px; font: 700 11px var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
.dre-margin b { font: 400 22px/1 var(--font-display); letter-spacing: 0.02em; color: var(--ink); }
.dre-lines { display: flex; flex-direction: column; justify-content: center; padding: 10px 26px; min-width: 0; }
.dre-line {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline;
  padding: 13px 0; border-top: 1px solid var(--line);
}
.dre-line:first-child { border-top: none; }
.dre-sign { font: 400 24px/1 var(--font-display); color: var(--ink-faint); }
.dre-line-label {
  display: flex; align-items: center; gap: 8px;
  font: 700 12px/1.2 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase;
}
.dre-swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.sw-revenue { background: var(--chart-revenue); }
.sw-tax { background: var(--chart-tax); }
.sw-expense { background: var(--chart-expense); }
.dre-line-value { font: 400 29px/1 var(--font-display); letter-spacing: 0.02em; text-align: right; white-space: nowrap; }
.dre-line-sub { grid-column: 2 / -1; font-size: 12.5px; color: var(--ink-faint); }

.fin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; align-items: start; }

.expense-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px 28px; flex-wrap: wrap; }
.expense-summary-total { margin-top: 8px; font: 400 46px/0.9 var(--font-display); letter-spacing: 0.01em; color: var(--neg); }
.expense-summary-split { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 13.5px; color: var(--ink-soft); }
.expense-summary-split b { display: block; font: 400 24px/1 var(--font-display); letter-spacing: 0.02em; color: var(--ink); margin-top: 4px; font-weight: 400; }

.expense-list { display: flex; flex-direction: column; gap: 8px; }
.expense-month {
  display: flex; align-items: baseline; gap: 12px; margin: 16px 0 4px;
  font: 400 24px/1 var(--font-display); letter-spacing: 0.04em; text-transform: uppercase;
}
.expense-month:first-child { margin-top: 0; }
.expense-month::after { content: ""; flex: 1; height: 1px; background: var(--line); align-self: center; }
.expense-month .count { order: 2; font: 700 12.5px/1 var(--font-body); letter-spacing: 0.04em; color: var(--ink-soft); text-transform: none; }
.expense-month::after { order: 1; }
.expense-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto; gap: 14px; align-items: center;
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.expense-date { text-align: center; line-height: 1; }
.expense-date b { display: block; font: 400 29px/0.9 var(--font-display); font-weight: 400; }
.expense-date span { font: 700 10.5px/1.2 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
.expense-main { min-width: 0; }
.expense-desc { font-weight: 700; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.expense-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.expense-amount { font: 400 25px/1 var(--font-display); letter-spacing: 0.02em; color: var(--neg); white-space: nowrap; }

/* =============================================================================
   GRAFICOS (sem biblioteca)
   ============================================================================= */
.bar-chart { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; align-items: baseline; }
.bar-label { font: 600 13.5px/1.3 var(--font-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-value { font: 700 13.5px/1.3 var(--font-body); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.bar-track { grid-column: 1 / -1; height: 10px; background: var(--surface-2); border-radius: 1px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--chart-revenue); transition: width 0.3s ease; }
.bar-fill-expense { background: var(--chart-expense); }
.bar-detail { grid-column: 1 / -1; margin-top: -2px; font-size: 12px; color: var(--ink-faint); }

.trend-chart { position: relative; }
.trend-legend { display: flex; gap: 18px; margin-bottom: 12px; font: 600 12.5px/1 var(--font-body); color: var(--ink-soft); }
.trend-legend-item { display: inline-flex; align-items: center; gap: 7px; }
.trend-legend-swatch { width: 12px; height: 12px; border-radius: 2px; flex: none; }
.trend-svg { width: 100%; height: auto; display: block; }
.trend-svg .grid-line { stroke: var(--line); stroke-width: 1; }
.trend-svg .axis-label { fill: var(--ink-faint); font: 600 10px var(--font-body); }
.trend-svg .month-label { fill: var(--ink-soft); font: 700 10.5px var(--font-body); }
.trend-svg .bar-mark { cursor: pointer; transition: opacity 0.15s ease; }
.trend-svg .bar-mark:hover, .trend-svg .bar-mark:focus { opacity: 0.75; outline: none; }
.trend-tooltip {
  position: absolute; z-index: 5; pointer-events: none; white-space: nowrap;
  padding: 9px 11px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--bg);
  font-size: 12.5px; line-height: 1.5;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  opacity: 0; transition: opacity 0.1s ease;
}
.trend-tooltip[data-visible="true"] { opacity: 1; }
.trend-tooltip .tt-row { display: flex; align-items: center; gap: 7px; }
.trend-tooltip .tt-key { width: 9px; height: 9px; border-radius: 2px; flex: none; box-shadow: 0 0 0 1px var(--bg); }
.trend-tooltip .tt-val { font-weight: 800; }
.trend-tooltip .tt-month { margin-bottom: 2px; font: 400 17px/1 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; }

.rank-chart { position: relative; display: flex; align-items: flex-end; gap: 6px; height: 176px; padding-top: 26px; }
.rank-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rank-bar-wrap { position: relative; flex: 1; width: 100%; display: flex; align-items: flex-end; }
/* rotulo do maior/menor valor, logo acima da propria barra (o `bottom` vem inline, da altura dela) */
.rank-extreme {
  position: absolute; left: -6px; right: -6px; text-align: center; white-space: nowrap;
  font: 400 15px/1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint);
}
.rank-extreme.is-max { color: var(--accent-text); }
.rank-bar {
  width: 100%; min-height: 2px; border-radius: 2px 2px 0 0;
  background: color-mix(in srgb, var(--ink) 80%, transparent);
  transition: height 0.3s ease;
}
.rank-bar.is-max { background: var(--accent); }
.rank-value { font: 400 19px/1 var(--font-display); letter-spacing: 0.02em; }
.rank-name { font: 700 10.5px/1.2 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; }

.table-wrap { overflow-x: auto; margin-top: 14px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.report-table th, .report-table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.report-table th { font: 700 10.5px/1.2 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.report-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.report-table tr.is-extreme td { font-weight: 800; color: var(--accent-text); }
.table-toggle {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 4px 0;
  border: none; border-bottom: 2px solid var(--line); background: none; cursor: pointer;
  font: 700 12px/1.2 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft);
}
.table-toggle:hover { color: var(--ink); border-bottom-color: var(--accent); }

/* =============================================================================
   SERVICOS
   ============================================================================= */
.service-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.service-card {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 18px 18px 14px 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
/* a borda listrada de etiqueta de preco */
.service-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px;
  background: var(--stripes); background-size: 14px 14px;
}
.service-card.inactive { opacity: 0.55; }
.service-card.inactive::before { filter: grayscale(1); }
.service-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.region-name {
  font: 400 27px/0.95 var(--font-display); letter-spacing: 0.03em; text-transform: uppercase;
  overflow-wrap: anywhere;
}
.price-tag {
  align-self: flex-start; padding: 0 0 3px; cursor: pointer;
  font: 400 38px/1 var(--font-display); letter-spacing: 0.01em; color: var(--ink);
  background: none; border: none; border-bottom: 2px dashed var(--line);
}
.price-tag:hover { color: var(--accent-text); border-bottom-color: var(--accent); }
.service-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 10px; border-top: 1px solid var(--line);
}
.region-status { font: 700 11px/1.2 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
.region-status.is-on { color: var(--pos); }

/* =============================================================================
   REGIOES + MAPA
   ============================================================================= */
.regions-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.map-col { min-width: 0; }
.map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.map-pins-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font: 600 13.5px/1.3 var(--font-body); color: var(--ink-soft); }
#map { width: 100%; height: 500px; border: 2px solid var(--line-strong); border-radius: var(--radius); z-index: 0; }
.map-hint { margin-top: 8px; font-size: 12.5px; color: var(--ink-faint); }

.region-list { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.region-card {
  display: flex; flex-direction: column; gap: 12px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.region-card.inactive { opacity: 0.6; }
.region-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.region-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.region-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.service-price-list { display: flex; flex-direction: column; gap: 5px; }
.service-price-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.service-price-row b { color: var(--ink); font-weight: 700; }
.region-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding-top: 12px; border-top: 1px solid var(--line);
}

.leaflet-container { font-family: var(--font-body); background: var(--surface-2); }
/* sem trocar de provedor de tiles: no escuro, o proprio mapa do OSM e invertido */
[data-theme="dark"] #map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9) saturate(0.35); }
#map .leaflet-bar { border: 2px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: none; }
#map .leaflet-bar a { color: #141414; }
#map .leaflet-popup-content-wrapper, #map .leaflet-popup-tip { background: var(--surface); color: var(--ink); border-radius: var(--radius); }
#map .leaflet-popup-content { font: 13px/1.5 var(--font-body); }
#map .leaflet-tooltip { font: 700 12px var(--font-body); }
.appt-pin { background: none; border: none; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.4)); }
.appt-pin svg { display: block; }

/* =============================================================================
   CONFIGURACOES + MAIS
   ============================================================================= */
.settings-section { display: flex; flex-direction: column; gap: 0; }
.settings-card { display: flex; flex-direction: column; gap: 18px; }
#horizon-input { max-width: 160px; }

.save-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.toast-inline { display: inline-flex; align-items: center; gap: 6px; font: 700 13.5px var(--font-body); color: var(--pos); }

.wa-panel { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.wa-panel-info { flex: 1; min-width: 220px; }
.wa-badge {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  background: var(--chrome); color: var(--chrome-ink);
  font: 700 12px/1.2 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase;
}
.wa-desc { margin-top: 12px; font-size: 14px; line-height: 1.55; color: var(--ink-soft); }
.wa-qr { align-self: center; }
.wa-qr img { display: block; padding: 8px; background: #fff; border: 2px solid var(--line-strong); border-radius: var(--radius); }

/* conectar: pelo numero (codigo de 8 letras) ou pelo QR */
.wa-connect { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; max-width: 460px; }
.wa-connect .segmented { align-self: flex-start; }
.wa-hint { font-size: 13px; line-height: 1.55; color: var(--ink-faint); }
.wa-by-code, .wa-by-qr, .wa-pair-form, .wa-pair-wait, .wa-pair-show { display: flex; flex-direction: column; gap: 12px; }
.wa-by-code[hidden], .wa-by-qr[hidden], .wa-pair-wait[hidden], .wa-pair-show[hidden], .wa-pair-form[hidden], .wa-pair-other[hidden] { display: none; }
.wa-pair-form .btn, .wa-pair-show > .btn-primary { min-height: 48px; }
.wa-pair-code {
  align-self: flex-start; padding: 10px 16px;
  font: 400 44px/1 var(--font-display); letter-spacing: 0.14em; font-variant-numeric: tabular-nums;
  background: var(--surface-2); border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  user-select: all;
}
.wa-pair-error { font-size: 14px; line-height: 1.5; color: var(--accent); font-weight: 600; }
.wa-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.5; color: var(--ink-soft); }
.wa-pair-other {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px;
  font-size: 13.5px; line-height: 1.5; background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: var(--radius);
}
.wa-pair-other .btn { align-self: flex-start; }
.wa-connect .btn-quiet { align-self: flex-start; }

.more-list {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.more-item {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  width: 100%; padding: 14px 16px; border: none; border-top: 1px solid var(--line);
  background: none; color: var(--ink); text-align: left; cursor: pointer;
}
.more-item:first-child { border-top: none; }
.more-item:hover { background: var(--surface-2); }
.more-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--surface-2); }
.more-item:hover .more-icon { background: var(--surface); }
.more-text { min-width: 0; }
.more-text b { display: block; font: 400 23px/1 var(--font-display); letter-spacing: 0.03em; text-transform: uppercase; font-weight: 400; }
.more-text small { display: block; margin-top: 4px; font-size: 12.5px; color: var(--ink-soft); }
.more-item .chev { color: var(--ink-faint); }
.more-account { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.more-user { margin-top: 6px; font-weight: 800; font-size: 16px; overflow-wrap: anywhere; }

/* =============================================================================
   MODAL (folha de baixo no celular), TOAST, ASSISTENTE INICIAL
   ============================================================================= */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(8, 8, 8, 0.62); backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal-card {
  width: 100%; max-width: 450px; max-height: min(90vh, 780px); overflow-y: auto;
  display: flex; flex-direction: column;
  background: var(--surface); border: 2px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  animation: modal-in 0.16s ease-out;
}
.modal-card::before { content: ""; display: block; flex: none; height: 8px; background: var(--stripes); background-size: var(--stripe-size); }
.modal-card h3 { margin: 18px 22px 0; font: 400 31px/1 var(--font-display); letter-spacing: 0.03em; text-transform: uppercase; }
.modal-desc { margin: 8px 22px 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); }
#modal-fields { display: flex; flex-direction: column; gap: 14px; padding: 18px 22px 6px; }
/* erro de validacao dentro do formulario: o que foi digitado continua la pra corrigir */
.modal-error {
  margin: 8px 22px 0; padding: 10px 12px;
  border: 2px solid var(--neg); border-radius: var(--radius);
  background: var(--surface-2); color: var(--neg);
  font-size: 13.5px; font-weight: 700; line-height: 1.4;
}
.modal-actions {
  position: sticky; bottom: 0;
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px 20px; background: var(--surface);
}
.modal-actions .btn-danger { background: var(--neg); border-color: var(--neg); color: #fff; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }

.toast-stack {
  position: fixed; left: 50%; bottom: 24px; z-index: 300;
  transform: translateX(-50%); width: min(92vw, 420px);
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-left: 5px solid var(--pos); border-radius: var(--radius-sm);
  background: var(--ink); color: var(--bg);
  font: 600 14px/1.4 var(--font-body);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  animation: toast-in 0.18s ease-out;
}
.toast-item .icon { width: 18px; height: 18px; color: var(--pos); }
.toast-item.toast-error { border-left-color: var(--neg); }
.toast-item.toast-error .icon { color: var(--neg); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.onboarding-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  align-items: center; justify-content: center; padding: 24px; overflow-y: auto;
  background: var(--bg);
}
.onboarding-overlay.open { display: flex; }
.onboarding-card {
  width: 100%; max-width: 480px; margin: auto;
  display: flex; flex-direction: column; gap: 18px; padding: 0 0 24px; overflow: hidden;
  background: var(--surface); border: 2px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
}
.onboarding-card > * { margin: 0 24px; }
.onboarding-card > .onboarding-band { margin: 0; height: 12px; background: var(--stripes); background-size: var(--stripe-size); }
.onboarding-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* =============================================================================
   LOGIN
   ============================================================================= */
.login-shell {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--bg);
}
.login-art {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 48px; background: var(--chrome); color: var(--chrome-ink);
}
.login-pole {
  position: absolute; top: -10px; bottom: -10px; right: 64px; width: 120px;
  background: var(--stripes); background-size: 40px 40px;
  border-left: 5px solid var(--chrome-ink); border-right: 5px solid var(--chrome-ink);
}
.login-art-title {
  position: relative; max-width: 68%;
  font: 400 clamp(54px, 7vw, 104px)/0.86 var(--font-display); letter-spacing: 0.01em; text-transform: uppercase;
  overflow-wrap: anywhere;
}
.login-art-sub {
  position: relative; margin-top: 16px;
  display: flex; align-items: center; gap: 10px;
  font: 700 12px/1.3 var(--font-body); letter-spacing: 0.2em; text-transform: uppercase; color: var(--chrome-soft);
}
.login-mark { width: 26px; height: 28px; flex: none; color: var(--chrome-ink); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.login-card h1 { margin-top: 6px; font: 400 46px/0.92 var(--font-display); letter-spacing: 0.02em; text-transform: uppercase; }
.login-card .btn { min-height: 50px; font-size: 13.5px; }
.login-error { min-height: 20px; color: var(--neg); font-size: 13.5px; font-weight: 600; }
.login-error:empty { min-height: 0; }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-form[hidden] { display: none; }
.login-tabs { display: flex; align-self: stretch; }
.login-tabs button { flex: 1 1 0; min-height: 44px; }
.login-switch { text-align: center; font-size: 14px; color: var(--ink-soft); }
.login-text { font-size: 15px; line-height: 1.5; color: var(--ink-soft); }
.login-ok { color: var(--pos); font-size: 14px; font-weight: 600; line-height: 1.45; }
.login-ok:empty { display: none; }
.login-switch a, .login-card .check-row a { color: var(--accent-text); font-weight: 700; }

/* =============================================================================
   RESPONSIVO
   ============================================================================= */
@media (max-width: 1100px) {
  .hoje-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "next" "kpis" "today" "upcoming"; }
  .kpi-stack { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 8px; padding: 14px; }
  .kpi-value { font-size: 34px; }
  .kpi-link { grid-column: 1 / -1; }
  /* o valor em cima: um rotulo que quebra em duas linhas nao desalinha os numeros */
  .kpi { flex-direction: column-reverse; justify-content: flex-end; }
  .regions-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .shell { display: block; }

  /* o menu lateral vira a barra preta do topo: nome da barbearia + status do WhatsApp */
  .sidebar {
    position: sticky; top: 0; z-index: 50;
    height: auto; min-height: 58px; overflow: visible;
    flex-direction: row; align-items: center; gap: 10px;
    padding: 4px 14px 0;
    border-right: none; border-bottom: 1px solid var(--chrome-line);
  }
  .sidebar-band { position: absolute; top: 0; left: 0; right: 0; height: 4px; }
  .sidebar-brand { flex: 1; min-width: 0; gap: 10px; padding: 8px 0; }
  .brand-mark { width: 28px; height: 30px; }
  /* line-height folgado: com overflow escondido, o til do "JOÃO" era cortado */
  .brand-name { font-size: 23px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand-sub, .nav, .sidebar-footer { display: none; }
  .wa-status { flex: none; max-width: 48%; margin: 0; padding: 7px 10px; font-size: 12px; }

  .main { padding: 20px 16px calc(104px + env(safe-area-inset-bottom)); }
  .bottom-nav { display: flex; }

  .page-title { font-size: 40px; }
  .view { gap: 18px; }

  /* o botao de criar vira flutuante, logo acima da barra de baixo */
  .fab {
    position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 55;
    width: 60px; height: 60px; min-height: 0; padding: 0; border-radius: var(--radius);
    box-shadow: 3px 3px 0 var(--line-strong);
  }
  .fab .icon { width: 28px; height: 28px; stroke-width: 2.4; }
  .fab .btn-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap;
  }

  .toast-stack { bottom: calc(88px + env(safe-area-inset-bottom)); }

  .agenda-toolbar { flex-wrap: wrap; }
  .day-strip { flex: 1 1 100%; }

  /* o botao de salvar acompanha a rolagem enquanto ha configuracao acima dele */
  .save-bar {
    position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 30;
    margin: 0 -16px; padding: 12px 16px;
    background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(6px);
    border-top: 1px solid var(--line);
  }
  .save-bar .btn { flex: 1; }

  #map { height: 60vh; min-height: 320px; }

  input[type="text"], input[type="password"], input[type="number"], input[type="email"],
  input[type="search"], input[type="date"], input[type="time"], input[type="month"], input[type="tel"],
  select, textarea { font-size: 16px; } /* menos que 16px e o iPhone da zoom ao tocar */
}

@media (max-width: 760px) {
  .dre-card { grid-template-columns: minmax(0, 1fr); }
  .dre-head { border-right: none; border-bottom: 1px solid var(--line); padding: 22px 20px; }
  .dre-lines { padding: 6px 20px; }
  .dre-profit { font-size: 58px; }

  .login-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .login-art { min-height: 200px; padding: 28px 22px 22px; border-bottom: 1px solid var(--chrome-line); }
  .login-pole { right: 22px; width: 64px; background-size: 28px 28px; border-width: 3px; }
  .login-art-title { font-size: 50px; max-width: 72%; }
  .login-panel { align-items: flex-start; padding: 28px 20px 40px; }
}

@media (max-width: 640px) {
  .card { padding: 16px; }
  .page-title { font-size: 38px; }
  .section-title { font-size: 21px; }

  .next-card { padding: 18px 16px 16px; }
  .next-head { padding-right: 70px; }
  .next-card::before { width: 70px; }
  .next-time { font-size: 62px; }
  .next-name { font-size: 30px; }
  .next-actions .btn { flex: 1; }

  .kpi { padding: 12px; }
  .kpi-label { font-size: 10px; letter-spacing: 0.1em; }
  .kpi-value { font-size: 27px; }

  .tl-row { grid-template-columns: 50px 3px minmax(0, 1fr) auto; gap: 10px; }
  .tl-time { font-size: 22px; }

  .agenda-tools-right { flex: 1 1 100%; }
  .date-pick { flex: 1; }
  .date-pick input { width: 100%; }

  .appt-card { grid-template-columns: 66px minmax(0, 1fr); }
  .appt-when { padding: 15px 4px; }
  .appt-time { font-size: 26px; }
  .appt-body { padding: 13px 14px; }
  .appt-price { font-size: 22px; }
  .appt-actions .spacer { display: none; }

  .alert-banner { flex-wrap: wrap; }
  .alert-banner > div { flex-basis: calc(100% - 40px); }
  .alert-banner .btn { margin-left: 36px; }

  .month-label { min-width: 0; flex: 1; font-size: 26px; }
  .month-pick { flex: 1 1 100%; }
  .month-pick input { width: 100%; }

  .expense-row { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px 12px; }
  .expense-row .btn-icon { grid-column: 3; grid-row: 1; justify-self: end; }
  .expense-amount { grid-column: 2 / -1; grid-row: 2; font-size: 22px; }
  .expense-date b { font-size: 26px; }

  .rank-chart { gap: 3px; height: 156px; }
  .rank-name { font-size: 9.5px; letter-spacing: 0; }
  .rank-value { font-size: 16px; }
  .rank-extreme { font-size: 13px; }

  .time-row { grid-template-columns: minmax(0, 1fr); }
  .segmented { display: flex; align-self: stretch; }
  .segmented button { flex: 1 1 0; min-width: 0; padding: 0 6px; gap: 5px; font-size: 11px; letter-spacing: 0.04em; }
  .search-box { flex-basis: 100%; max-width: none; }

  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-card {
    max-width: none; max-height: 92vh; border-width: 2px 0 0; border-radius: 10px 10px 0 0;
    box-shadow: none; animation: sheet-in 0.2s ease-out;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-card::before { border-radius: 8px 8px 0 0; }
  .modal-actions .btn { flex: 1; }

}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
}
