/* BL Barbearia — visual escuro, preto e ouro da marca. */
:root {
  --bg: #0d0c0a;
  --panel: #17150f;
  --panel-2: #1f1c14;
  --line: #2f2a1e;
  --fg: #f4ecd6;
  --muted: #a69c82;
  --gold: #efbd2c;
  --gold-deep: #a97d10;
  --on-gold: #17130a;
  --ok: #78c48a;
  --warn: #e8a54a;
  --danger: #e46e58;
  --info: #7fb2e5;
  --f-display: "DM Serif Display", Georgia, "Times New Roman", serif;
  --f-label: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --f-body: "Barlow", "Segoe UI", Roboto, Arial, sans-serif;
  --r: 10px;
  color-scheme: dark;
}
html { -webkit-text-size-adjust: 100%; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 15px; line-height: 1.45; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
* { box-sizing: border-box; }
a { color: var(--gold); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.wrap { max-width: 1160px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.label { font-family: var(--f-label); font-weight: 600; text-transform: uppercase; letter-spacing: .12em; font-size: 13px; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3 { text-wrap: balance; margin: 0; font-weight: 400; }
h2 { font-family: var(--f-display); font-size: 26px; line-height: 1.15; }
h3 { font-family: var(--f-label); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: 17px; }

/* header */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 14px; padding-block: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; text-decoration: none; color: var(--fg); }
.brand img { width: 48px; height: 48px; border-radius: 50%; display: block; }
.brand b { font-family: var(--f-display); font-weight: 400; font-size: 22px; line-height: 1; display: block; }
.brand small { font-family: var(--f-label); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; }
.tab { border: 1px solid transparent; background: none; padding: 8px 14px; border-radius: 999px; cursor: pointer; font-family: var(--f-label); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; font-size: 14px; color: var(--muted); text-decoration: none; }
.tab:hover { color: var(--fg); }
.tab[aria-current="page"] { color: var(--on-gold); background: var(--gold); }

/* hero strip */
.hero { border-bottom: 1px solid var(--line); background:
  radial-gradient(ellipse at 85% 0%, color-mix(in srgb, var(--gold) 12%, transparent), transparent 60%), var(--bg); }
.hero .wrap { padding-block: 28px 24px; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; }
.hero h1 { font-family: var(--f-display); font-size: clamp(30px, 5vw, 46px); line-height: 1.05; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero p { color: var(--muted); margin: 10px 0 0; max-width: 52ch; }
.facts { display: grid; gap: 6px; font-size: 14px; color: var(--muted); text-align: right; }
.facts b { color: var(--fg); font-weight: 500; }
.pole { height: 6px; background: repeating-linear-gradient(-45deg, var(--gold) 0 10px, var(--bg) 10px 20px); opacity: .85; }

/* layout */
main { padding-block: 24px 48px; }
.book { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.step { border-top: 1px solid var(--line); padding-block: 22px; display: grid; gap: 14px; }
.step:first-child { border-top: 0; padding-top: 0; }
.step-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.step-n { font-family: var(--f-display); color: var(--gold); font-size: 26px; line-height: 1; min-width: 22px; }
.step-h .hint { color: var(--muted); font-size: 14px; }
.step.locked { opacity: .45; pointer-events: none; }

.group-t { margin: 6px 0 2px; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.opt { text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; padding: 12px 14px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); cursor: pointer; }
.opt:hover { border-color: var(--gold-deep); }
.opt[aria-pressed="true"] { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--panel)); }
.opt .n { font-weight: 600; }
.opt .p { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 600; }
.opt .d { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--panel); padding: 9px 14px; border-radius: 999px; cursor: pointer; font-weight: 500; }
.chip:hover:not(:disabled) { border-color: var(--gold-deep); }
.chip[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.chip:disabled { opacity: .35; cursor: not-allowed; text-decoration: line-through; }
.chip small { color: inherit; opacity: .75; font-size: 12px; }

.days { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.day { flex: 0 0 auto; width: 62px; padding: 8px 0; border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); cursor: pointer; display: grid; justify-items: center; gap: 0; }
.day .w { font-family: var(--f-label); text-transform: uppercase; letter-spacing: .1em; font-size: 12px; color: var(--muted); }
.day .d { font-family: var(--f-display); font-size: 22px; line-height: 1.1; }
.day .m { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.day[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.day[aria-pressed="true"] .w, .day[aria-pressed="true"] .m { color: var(--on-gold); }
.day:disabled { opacity: .3; cursor: not-allowed; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.slot { padding: 9px 0; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; cursor: pointer; font-variant-numeric: tabular-nums; font-weight: 600; }
.slot:hover { border-color: var(--gold-deep); }
.slot[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.empty { color: var(--muted); padding: 14px; border: 1px dashed var(--line); border-radius: var(--r); }

.prod { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.prod:last-child { border-bottom: 0; }
.prod .p { color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; }
.prod .v { color: var(--muted); font-size: 13px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.qty button { width: 34px; height: 32px; border: 0; background: var(--panel-2); cursor: pointer; font-size: 18px; line-height: 1; }
.qty button:hover { background: var(--line); }
.qty span { min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-family: var(--f-label); text-transform: uppercase; letter-spacing: .1em; font-size: 12px; color: var(--muted); font-weight: 600; }
input[type=text], input[type=tel], input[type=number], input[type=date], input[type=time], select, textarea { width: 100%; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; }
textarea { resize: vertical; min-height: 64px; }

.summary { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 86px); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.summary .pole { height: 5px; }
.summary .in { padding: 18px; display: grid; gap: 12px; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.sum-row span:first-child { color: var(--muted); }
.sum-row span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.sum-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: 12px; }
.sum-total b { font-family: var(--f-display); font-weight: 400; font-size: 30px; color: var(--gold); font-variant-numeric: tabular-nums; }
.note { font-size: 13px; color: var(--muted); }
.note.warn { color: var(--warn); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 999px; border: 1px solid var(--gold); background: var(--gold); color: var(--on-gold); cursor: pointer; font-family: var(--f-label); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 15px; text-decoration: none; text-align: center; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--gold); }
.btn.quiet { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn[aria-disabled="true"], .btn:disabled { opacity: .4; pointer-events: none; }
.btn-col { display: grid; gap: 8px; }

.done { text-align: center; display: grid; gap: 10px; justify-items: center; padding: 8px 0; }
.done .big { font-family: var(--f-display); font-size: 28px; color: var(--gold); }

footer { border-top: 1px solid var(--line); }
footer .wrap { padding-block: 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; font-size: 14px; color: var(--muted); }
footer b { color: var(--fg); font-weight: 500; }
.hours { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; font-variant-numeric: tabular-nums; }
.copy { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy code { font-family: var(--f-body); color: var(--fg); user-select: all; }

/* painel */
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.subtab { border: 1px solid var(--line); background: var(--panel); padding: 7px 13px; border-radius: 8px; cursor: pointer; font-family: var(--f-label); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: 14px; color: var(--muted); }
.subtab[aria-current="page"] { color: var(--gold); border-color: var(--gold); }
.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.bar .sp { flex: 1; }
.bar h2 { font-size: 24px; }
.iconbtn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 18px; }
.banner { padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); color: var(--muted); margin-bottom: 16px; font-size: 14px; }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); color: var(--warn); }

.cal-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.cal { display: grid; min-width: 100%; }
.cal-head { display: contents; }
.cal-h { position: sticky; top: 0; padding: 10px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--panel-2); font-weight: 600; min-width: 0; }
.cal-h small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.cal-h:first-child { border-left: 0; }
.cal-times { position: relative; }
.cal-times span { position: absolute; right: 6px; transform: translateY(3px); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-col { position: relative; border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--hour)); cursor: copy; min-width: 150px; }
.cal-col.off { cursor: default; background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--gold) 7%, transparent) 0 8px, transparent 8px 16px), var(--bg); }
.cal-col .offlabel { position: absolute; inset: 12px 8px auto; text-align: center; color: var(--muted); font-size: 13px; }
.ev { position: absolute; left: 4px; right: 4px; border-radius: 7px; padding: 5px 8px; font-size: 13px; line-height: 1.25; overflow: hidden; cursor: pointer; border: 1px solid; text-align: left; display: block; width: auto; }
.ev b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev span { color: inherit; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.ev.confirmado { background: color-mix(in srgb, var(--gold) 20%, var(--panel)); border-color: var(--gold-deep); color: var(--fg); }
.ev.concluido { background: color-mix(in srgb, var(--ok) 16%, var(--panel)); border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.ev.block { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--gold) 22%, var(--bg)) 0 7px, var(--bg) 7px 14px); border-color: var(--gold-deep); color: var(--fg); }
.ev.block b { background: var(--bg); display: inline-block; padding: 0 4px; border-radius: 4px; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); pointer-events: none; z-index: 2; }

.daylist { margin-top: 18px; display: grid; gap: 6px; }
.li { display: grid; grid-template-columns: 64px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); cursor: pointer; text-align: left; width: 100%; }
.li .t { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--gold); }
.li .who { min-width: 0; }
.li .who b { font-weight: 600; }
.li .who span { color: var(--muted); font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { font-family: var(--f-label); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.pill.confirmado { color: var(--gold); border-color: var(--gold-deep); }
.pill.concluido { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.pill.faltou { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }
.pill.cancelado { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 22px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 4px; }
.kpi b { font-family: var(--f-display); font-weight: 400; font-size: 28px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi.main b { color: var(--gold); }
.kpi small { color: var(--muted); font-size: 13px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 22px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-family: var(--f-label); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel-2); }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; background: var(--panel-2); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.two > * { min-width: 0; }

.edit-list { display: grid; gap: 8px; margin-bottom: 14px; }
.edit-row { display: grid; gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.edit-row.svc { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.3fr) 110px 100px auto; }
.edit-row.prd { grid-template-columns: minmax(0, 2fr) minmax(0, 1.6fr) 110px 100px auto auto; }
.edit-row .field label { font-size: 11px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; cursor: pointer; padding-bottom: 10px; }
.check input { width: 17px; height: 17px; accent-color: var(--gold); }
.wd { display: flex; gap: 4px; flex-wrap: wrap; }
.wd label { display: inline-flex; }
.wd input { position: absolute; opacity: 0; pointer-events: none; }
.wd span { padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; font-family: var(--f-label); text-transform: uppercase; letter-spacing: .06em; font-size: 13px; cursor: pointer; color: var(--muted); }
.wd input:checked + span { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.wd input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.barber-card { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.barber-card .fields { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.hours-edit { display: grid; grid-template-columns: 120px auto 1fr 1fr; gap: 8px 12px; align-items: center; max-width: 560px; }
.savebar { position: sticky; bottom: 0; margin-top: 18px; padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); background: var(--panel-2); border: 1px solid var(--gold-deep); border-radius: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.savebar .sp { flex: 1; min-width: 160px; }
.section-t { margin: 22px 0 10px; }

dialog { background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(0,0,0,.7); }
.dlg-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.dlg-h h2 { font-size: 22px; flex: 1; }
.dlg-b { padding: 18px; display: grid; gap: 14px; }
.dlg-f { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dlg-f .sp { flex: 1; }
.mini-slots { display: flex; gap: 5px; flex-wrap: wrap; }
.mini-slots button { padding: 4px 8px; font-size: 13px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-variant-numeric: tabular-nums; }
.mini-slots button:hover { border-color: var(--gold); }
.prodpick { display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.prodpick .prod { padding: 6px 0; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.5); max-width: calc(100vw - 32px); }

@media (max-width: 880px) {
  .book { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; }
  .hero .wrap { grid-template-columns: 1fr; }
  .facts { text-align: left; }
  .two { grid-template-columns: 1fr; }
  .edit-row.svc, .edit-row.prd { grid-template-columns: 1fr 1fr; }
  .edit-row .field:first-child { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .fields { grid-template-columns: 1fr; }
  .brand small { display: none; }
  .hours-edit { grid-template-columns: 1fr auto; }
  .hours-edit .lbl { grid-column: 1 / -1; padding-top: 6px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

img { max-width: 100%; }
[hidden] { display: none !important; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.center-card { max-width: 480px; margin: 40px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.center-card .in { padding: 22px; display: grid; gap: 14px; }
.err { color: var(--danger); font-size: 14px; }
