/* =====================================================================
   Barbearize Gestor — design system
   Superfícies em camadas, um único acento (dourado), tipografia Inter,
   escala fixa de espaçamento, raio e sombra.
   ===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* superfícies (do fundo para cima) */
  --bg: #0c0b0a;
  --bg2: #141311;          /* campos, áreas rebaixadas */
  --card: #181714;         /* cartões */
  --card2: #1f1d19;        /* hover / elevado */
  --line: #2a2723;         /* bordas */
  --line2: #36322c;        /* bordas em hover */
  /* texto */
  --text: #f4f1ea;
  --text2: #cfc8bb;
  --muted: #958d80;
  /* acento e estados */
  --gold: #d6aa52;
  --gold-rgb: 214, 170, 82;
  --gold2: color-mix(in srgb, var(--gold) 78%, black);
  --gold-soft: rgba(var(--gold-rgb), .12);
  --gold-dark: color-mix(in srgb, var(--gold) 16%, var(--bg));
  --on-gold: #1b1406;
  --sec: #1c1813;
  --ok: #3fb67a;
  --ok-soft: rgba(63, 182, 122, .12);
  --warn: #e3a33b;
  --warn-soft: rgba(227, 163, 59, .12);
  --bad: #e5584c;
  --bad-soft: rgba(229, 88, 76, .12);
  --blue: #5a9ce6;
  --blue-soft: rgba(90, 156, 230, .12);
  /* forma */
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-1: 0 1px 0 rgba(255,255,255,.03) inset, 0 1px 2px rgba(0,0,0,.35);
  --shadow-2: 0 10px 30px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.3);
  --ring: 0 0 0 3px rgba(var(--gold-rgb), .28);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
::selection { background: rgba(var(--gold-rgb), .35); }
a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: color-mix(in srgb, var(--gold) 80%, white); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -.015em; font-weight: 700; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 15.5px; }
code { background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }
.brand { font-weight: 800; letter-spacing: -.03em; }
.brand b { color: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.spacer { flex: 1; }
.num, .kpi .v, td.num { font-variant-numeric: tabular-nums; }

/* barra de rolagem discreta */
* { scrollbar-width: thin; scrollbar-color: #3a352e transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #34302a; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- formulários ---------- */
label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text2); margin: 12px 0 6px; }
input, select, textarea {
  width: 100%; height: 40px; background: var(--bg2); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 0 12px; font: inherit; font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #6e675c; }
input:hover, select:hover, textarea:hover { border-color: var(--line2); }
input:focus, select:focus, textarea:focus { border-color: var(--gold2); box-shadow: var(--ring); background: #171512; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--gold); margin: 0; }
input[type=color] { padding: 3px; height: 40px; cursor: pointer; }
input[type=file] { height: auto; padding: 8px; }
input[type=date], input[type=time] { color-scheme: dark; }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23958d80' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
label.row { font-size: 14px; font-weight: 500; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 90%, white), color-mix(in srgb, var(--gold) 88%, black)); color: var(--on-gold);
  font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 1px 2px rgba(0,0,0,.4);
  transition: filter .15s, transform .05s, background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.07); color: var(--on-gold); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible, a:focus-visible, button:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.ghost { background: var(--card); color: var(--text); border-color: var(--line); box-shadow: var(--shadow-1); }
.btn.ghost:hover { background: var(--card2); border-color: var(--line2); color: var(--text); filter: none; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.ok { background: linear-gradient(180deg, #48c285, #34a56c); color: #04170c; }
.btn.bad { background: linear-gradient(180deg, #ec6a5e, #d24c40); color: #fff; }
.btn.blue { background: linear-gradient(180deg, #6aa8ec, #4d8fd8); color: #06121f; }
.btn.wa { background: linear-gradient(180deg, #2fdc72, #1fbf5c); color: #03220f; }
.btn.block { width: 100%; }

/* ---------- cartões ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-1); }
.card h3 { margin-bottom: 12px; }
.err { color: var(--bad); font-size: 13px; min-height: 1.2em; margin-top: 8px; }
.err:empty { min-height: 0; margin: 0; }

/* ---------- etiquetas de status (ponto + texto) ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 650; letter-spacing: .01em; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-agendado { background: var(--gold-soft); color: var(--gold); border-color: rgba(var(--gold-rgb),.22); }
.st-confirmado { background: var(--ok-soft); color: var(--ok); border-color: rgba(63,182,122,.22); }
.st-concluido { background: var(--blue-soft); color: var(--blue); border-color: rgba(90,156,230,.22); }
.st-faltou { background: var(--bad-soft); color: var(--bad); border-color: rgba(229,88,76,.22); }
.st-cancelado { background: rgba(255,255,255,.04); color: #8d877d; border-color: var(--line); }

/* ---------- tabelas ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: var(--card); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: rgba(255,255,255,.018); }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--card2); }
.tablewrap { overflow-x: auto; }

/* ---------- janelas (modal) ---------- */
@keyframes nr-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nr-pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-bg { position: fixed; inset: 0; background: rgba(6,5,4,.66); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; z-index: 50; overflow-y: auto; animation: nr-fade .15s ease-out; }
.modal { background: var(--card); border: 1px solid var(--line2); border-radius: 18px; width: 100%; max-width: 540px; padding: 24px; position: relative; box-shadow: var(--shadow-2); animation: nr-pop .18s cubic-bezier(.2,.8,.2,1); }
.modal h2 { padding-right: 36px; }
.modal .x { position: absolute; right: 14px; top: 14px; width: 32px; height: 32px; display: grid; place-items: center; background: transparent; border: 1px solid transparent; border-radius: 9px; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; transition: background .15s, color .15s; }
.modal .x:hover { background: var(--card2); color: var(--text); border-color: var(--line); }

/* ---------- aviso rápido (toast) ---------- */
@keyframes nr-up { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; background: #221f1a; border: 1px solid var(--line2); color: var(--text); padding: 11px 18px 11px 14px; border-radius: 12px; z-index: 99; box-shadow: var(--shadow-2); font-weight: 500; animation: nr-up .2s ease-out; max-width: calc(100vw - 32px); }
.toast::before { content: '✓'; width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: 12px; font-weight: 800; }

.toast.err { border-color: rgba(229,88,76,.45); }
.toast.err::before { content: "!"; background: var(--bad-soft); color: var(--bad); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* =====================================================================
   Tema claro (o painel e a página do cliente podem usar)
   ===================================================================== */
:root[data-theme="light"] {
  --bg: #f4f2ee; --bg2: #ffffff; --card: #ffffff; --card2: #f5f3ef; --line: #e3dfd7; --line2: #d2ccc1;
  --text: #1b1915; --text2: #47423a; --muted: #776f63;
  --gold-dark: color-mix(in srgb, var(--gold) 14%, white);
  --shadow-1: 0 1px 2px rgba(30,25,15,.06), 0 0 0 1px rgba(30,25,15,.02);
  --shadow-2: 0 14px 36px rgba(30,25,15,.16), 0 2px 6px rgba(30,25,15,.08);
  color-scheme: light;
}
[data-theme="light"] input, [data-theme="light"] select, [data-theme="light"] textarea { background: #fbfaf8; }
[data-theme="light"] input:focus, [data-theme="light"] select:focus, [data-theme="light"] textarea:focus { background: #fff; }
[data-theme="light"] input::placeholder, [data-theme="light"] textarea::placeholder { color: #aaa293; }
[data-theme="light"] .toast { background: #fff; }
[data-theme="light"] .modal-bg { background: rgba(40,35,25,.35); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #d5cfc4; border-color: var(--bg); }
[data-theme="light"] .st-cancelado { background: #f0eee9; color: #8a8378; }
[data-theme="light"] .st-agendado { color: color-mix(in srgb, var(--gold) 70%, black); }
[data-theme="light"] a { color: color-mix(in srgb, var(--gold) 70%, black); }
[data-theme="light"] .brand b { color: color-mix(in srgb, var(--gold) 80%, black); }
[data-theme="light"] a.btn { color: var(--on-gold); }
[data-theme="light"] a.btn.ghost { color: var(--text); }
[data-theme="light"] a.btn.wa { color: #03220f; }
