.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.brand-mark { width: 40px; height: 40px; border: 1.5px solid var(--brass); color: var(--brass); display: grid; place-items: center; font-family: var(--f-display); font-weight: 900; font-size: 18px; border-radius: 50%; flex: none; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--ink); padding: 24px max(16px, env(safe-area-inset-left, 0px)); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 14px; padding: 32px; display: grid; gap: 16px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 34px; margin-top: 6px; }
.login-card .muted { margin-top: -12px; }
.hint { font-size: 12.5px; color: var(--muted); background: var(--paper); padding: 10px 12px; border-radius: var(--radius-sm); }
.hint:empty { display: none; }
.form-err { color: var(--bad); font-weight: 600; font-size: 14px; }
.form-err:empty { display: none; }
.back-link { font-size: 13px; color: var(--muted); text-decoration: none; text-align: center; }

/* estrutura */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: var(--on-ink); display: flex; flex-direction: column; padding: 20px 14px calc(20px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px)); position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 24px; font-family: var(--f-display); font-weight: 800; font-size: 19px; text-transform: uppercase; line-height: 1; }
.side-brand span:last-child { display: grid; gap: 3px; }
.side-brand small { font-family: var(--f-body); font-size: 10.5px; letter-spacing: .14em; color: var(--on-ink-muted); font-weight: 600; }
.side-nav { display: grid; gap: 4px; }
.side-nav button { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--on-ink-muted); font-weight: 600; font-size: 14px; cursor: pointer; text-align: left; }
.side-nav button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-nav button:hover { color: var(--on-ink); background: rgba(255,255,255,.04); }
.side-nav button.on { color: var(--on-ink); background: rgba(255,255,255,.07); box-shadow: inset 2px 0 0 var(--brass); }
.side-foot { margin-top: auto; display: grid; gap: 4px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.mode { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brass); padding: 0 12px 8px; }
.side-link { display: block; padding: 8px 12px; color: var(--on-ink-muted); text-decoration: none; background: none; border: 0; text-align: left; font-size: 13.5px; font-weight: 600; cursor: pointer; border-radius: var(--radius-sm); }
.side-link:hover { color: var(--on-ink); background: rgba(255,255,255,.04); }

.main { min-width: 0; padding: 0 max(28px, env(safe-area-inset-right, 0px)) 48px 28px; }
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 -28px; padding: 10px 28px; background: var(--brass-soft); color: var(--text); font-size: 13.5px; border-bottom: 1px solid color-mix(in srgb, var(--brass) 30%, transparent); }
.demo-actions { display: flex; gap: 8px; }
.main-head { display: flex; align-items: center; gap: 16px; padding: 28px 0 22px; flex-wrap: wrap; }
.main-head h1 { font-size: 40px; }
.head-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.side-toggle { display: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); flex-direction: column; justify-content: center; gap: 6px; padding: 0 11px; cursor: pointer; }
.side-toggle span { height: 2px; background: var(--text); border-radius: 2px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 6px; }
.kpi .lbl { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kpi .val { font-family: var(--f-display); font-size: 36px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .foot { font-size: 12.5px; color: var(--muted); }
.kpi .foot b { font-weight: 700; }
.kpi .foot .up { color: var(--ok); } .kpi .foot .down { color: var(--bad); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.grid-2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 20px; }
.link { background: none; border: 0; color: var(--brass-strong); font-weight: 700; font-size: 13px; cursor: pointer; padding: 0; }

/* gráfico de barras */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--f-body); }
.chart .bar { fill: var(--brass); }
.chart .bar.dim { fill: color-mix(in srgb, var(--brass) 35%, var(--surface)); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .bar, .chart .bar.hl { fill: var(--brass-strong); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--on-ink); padding: 8px 10px; border-radius: var(--radius-sm); font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: var(--shadow); }
.tip b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }

/* barras horizontais */
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; font-size: 13.5px; }
.hbar .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .v { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.hbar .track { grid-column: 1 / -1; height: 8px; background: color-mix(in srgb, var(--line) 70%, transparent); border-radius: 4px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--brass); border-radius: 4px; }

.next-list { list-style: none; margin: 0; padding: 0; display: grid; }
.next-list li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.next-list li:last-child { border: 0; }
.next-list .time { font-family: var(--f-display); font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.next-list .who { min-width: 0; }
.next-list .who strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.next-list .who span { font-size: 12.5px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-s { color: var(--muted); padding: 18px 0; text-align: center; font-size: 14px; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.input-sm { height: 36px; font-size: 13.5px; padding: 0 10px; width: auto; }
.grow { flex: 1; min-width: 180px; }
.seg { display: flex; gap: 4px; }
.ag-label { font-size: 15px; }
.legend-row { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }

/* agenda diária */
.agenda-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.agenda { display: grid; min-width: 720px; position: relative; }
.ag-col-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.ag-col-head .av { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--brass); display: grid; place-items: center; font-family: var(--f-display); font-weight: 900; font-size: 13px; flex: none; }
.ag-col-head small { display: block; color: var(--muted); font-weight: 600; font-size: 11.5px; }
.ag-times { position: relative; border-right: 1px solid var(--line); }
.ag-times span { position: absolute; right: 8px; font-size: 11px; color: var(--muted); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.ag-col { position: relative; border-right: 1px solid var(--line); cursor: copy; }
.ag-col:last-child { border-right: 0; }
.ag-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.ag-line.half { border-top-style: dashed; opacity: .6; }
.ag-ev { position: absolute; left: 4px; right: 4px; border-radius: 6px; padding: 5px 8px; font-size: 12px; line-height: 1.3; overflow: hidden; cursor: pointer; border-left: 3px solid; text-align: left; border-top: 0; border-right: 0; border-bottom: 0; }
.ag-ev strong { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-ev span { color: inherit; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.ag-ev.confirmado { background: var(--info-soft); color: var(--info); border-color: var(--info); }
.ag-ev.concluido { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.ag-ev.faltou { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.ag-ev.block { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--muted) 12%, var(--surface)) 0 6px, var(--surface) 6px 12px); color: var(--muted); border-color: var(--muted); }
.ag-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--bad); z-index: 2; pointer-events: none; }
.ag-now::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.ag-closed { padding: 48px; text-align: center; color: var(--muted); }

/* tabela */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 820px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 60%, var(--surface)); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--paper) 50%, var(--surface)); }
.table .r { text-align: right; font-variant-numeric: tabular-nums; }
.table .when strong { display: block; font-variant-numeric: tabular-nums; }
.table .when span, .table .sm { color: var(--muted); font-size: 12.5px; }
.table .acts { display: flex; gap: 6px; justify-content: flex-end; }
.table tfoot td { font-weight: 800; background: color-mix(in srgb, var(--paper) 60%, var(--surface)); }
.icon-btn { width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--text); border-color: var(--muted); }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.ok:hover { color: var(--ok); border-color: var(--ok); }
.icon-btn.bad:hover { color: var(--bad); border-color: var(--bad); }

/* modal */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal-back { position: absolute; inset: 0; background: rgba(10, 10, 12, .55); }
.modal-card { position: relative; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.modal-head h2 { font-size: 26px; }
.x { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.detail { margin: 0 0 18px; display: grid; gap: 10px; }
.detail div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; font-size: 14px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; font-weight: 600; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.form-stack { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 70; transform: translateX(-100%); transition: transform .2s; padding-top: calc(20px + env(safe-area-inset-top, 0px)); }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  .side-toggle { display: flex; }
  .main { padding: 0 max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
  .demo-bar { margin: 0 -16px; padding: 10px 16px; }
  .grid-2, .grid-2.even { grid-template-columns: 1fr; }
  .main-head h1 { font-size: 32px; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .val { font-size: 28px; }
  .legend-row { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .head-actions { margin-left: 0; width: 100%; }
}

/* ---------- Serviços e horários ---------- */
.cat-intro { margin-bottom: 14px; }
.cat-form { display: grid; gap: 18px; }
.panel-head.pad { padding: 18px 20px 0; }
.cat-table { min-width: 620px; }
.cat-table input.num { width: 104px; text-align: right; }
.cat-table tr.off td:first-child { opacity: .55; }
.switch { position: relative; display: inline-flex; width: 42px; height: 24px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { flex: 1; border-radius: 999px; background: var(--line); transition: background .2s; position: relative; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--brass); outline-offset: 2px; }
.cat-hours, .cat-barbers { display: grid; gap: 4px; }
.hrow { display: grid; grid-template-columns: minmax(110px, 1fr) auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.hrow:last-child, .brow:last-child { border-bottom: 0; }
.hrow label { display: flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.hrow input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ok); }
.hrow.closed input[type="time"] { opacity: .35; }
.brow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.brow small { display: block; color: var(--muted); font-size: 12.5px; }
.cat-rules { display: grid; gap: 12px; }
.cat-rules .field span { font-size: 13px; font-weight: 600; color: var(--muted); }
.cat-rules .input-sm { width: 120px; }
.cat-save { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 14px 0; background: linear-gradient(transparent, var(--paper) 30%); }
.code-tag { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: .12em; }

/* ---------- Avisos e Recebimentos ---------- */
.av-form { display: grid; gap: 2px; }
.av-form .brow { cursor: pointer; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.code-box { display: block; padding: 10px 12px; background: color-mix(in srgb, var(--paper) 60%, var(--surface)); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 12.5px; word-break: break-all; }
.av-table td .sm { max-width: 260px; }
.kpi .val.sm-val { font-size: 22px; }
.ag-ev.aguardando_pagamento { border-style: dashed; opacity: .85; }

/* ---------- Produtos ---------- */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11.5px; font-weight: 800; display: inline-grid; place-items: center; }
.falta-banner { width: 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; text-align: left; margin-bottom: 18px; padding: 14px 18px; border: 0; border-left: 5px solid var(--warn); border-radius: var(--radius); background: var(--warn-soft); color: var(--text); font: inherit; cursor: pointer; }
.falta-banner.grave { border-left-color: var(--bad); background: var(--bad-soft); }
.falta-banner b { font-weight: 800; }
.falta-banner span { color: var(--muted); flex: 1; min-width: 200px; }
.falta-banner em { font-style: normal; font-weight: 800; color: var(--brass-strong); }
.nv { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; background: var(--warn); color: #fff; white-space: nowrap; }
.nv.acabou { background: var(--bad); }
#pfTable tr.off td { opacity: .55; }
#pfTable .obs { max-width: 280px; }
.chk-inline { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.prod-novo { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; margin-bottom: 6px; }
.prod-novo .input-sm, .prod-row .input-sm { width: 100%; min-width: 0; }
.prod-lista { display: grid; max-height: 520px; overflow-y: auto; }
.prod-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .8fr) auto; gap: 6px; }
@media (max-width: 600px) { .prod-novo, .prod-row { grid-template-columns: 1fr 1fr; } }
