/* =============================================================
   PAINEL ADMINISTRATIVO — Barbearia
   ============================================================= */
:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --ink: #1d1a16;
  --ink-2: #5d574e;
  --ink-3: #948c80;
  --line: #e7e2d9;
  --side: #16130f;
  --side-2: #221e18;
  --accent: #c8963e;
  --accent-ink: #1d1a16;
  --accent-soft: #f6ecda;
  --blue: #2f6fb8; --blue-soft: #e5eef9;
  --teal: #198a85; --teal-soft: #e0f3f2;
  --green: #2e8a4e; --green-soft: #e3f3e8;
  --amber: #b77812; --amber-soft: #fbf0d9;
  --red: #c0392b; --red-soft: #fbe6e3;
  --gray: #7b746a; --gray-soft: #eeebe5;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(30,25,15,.06), 0 4px 16px rgba(30,25,15,.05);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .6em; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
code { background: var(--gray-soft); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }
.ic { vertical-align: -3px; flex-shrink: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.mt { margin-top: 18px; } .mb { margin-bottom: 18px; } .mb0 { margin-bottom: 0; }
.right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--side); color: #d8d0c2; position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 40; transition: transform .2s; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .2px; border-bottom: 1px solid #2a251e; }
.sidebar .brand .logo { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: var(--side); display: grid; place-items: center; overflow: hidden; }
.sidebar .brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.sidebar nav { padding: 10px 10px 30px; }
.sidebar .group { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; color: #81776a; padding: 16px 12px 6px; }
.sidebar a { display: flex; align-items: center; gap: 11px; color: #d8d0c2; padding: 8px 12px; border-radius: 7px; margin: 1px 0; font-size: 13.5px; }
.sidebar a:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.sidebar a.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.main { flex: 1; margin-left: 240px; min-width: 0; }
.topbar { height: 58px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 30; }
.topbar .title { font-weight: 600; font-size: 15px; flex: 1; }
.topbar .user { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; }
.topbar .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--amber); display: grid; place-items: center; font-weight: 700; }
.menu-toggle { display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: var(--ink); }
.content { padding: 24px; max-width: 1400px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.overlay { display: none; }

/* ---------- Cartões ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 16px 18px 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 1fr) 360px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.stat.accent { background: var(--side); color: #fff; border-color: var(--side); }
.stat.accent .label { color: #b9ad9a; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fbfaf7; white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fcfbf8; }
.table tfoot td { font-weight: 700; background: #fbfaf7; border-top: 1px solid var(--line); }
.table .actions { white-space: nowrap; text-align: right; }
.table .actions form { display: inline; }
.empty { text-align: center; padding: 36px 16px; color: var(--ink-3); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; text-transform: capitalize; white-space: nowrap; }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-teal { background: var(--teal-soft); color: var(--teal); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-gray { background: var(--gray-soft); color: var(--gray); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: #f8f6f2; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #b98632; }
.btn-dark { background: var(--side); border-color: var(--side); color: #fff; }
.btn-dark:hover { background: #2b261f; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: #267441; }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn-wa:hover { background: #1fb457; }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Formulários ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=tel], input[type=datetime-local], input[type=search], input[type=color], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid #d9d2c6; border-radius: 8px; background: #fff; font: inherit; font-weight: 400; color: var(--ink); }
input[type=color] { height: 38px; padding: 3px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200,150,62,.18); }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }
label.check input { width: auto; margin: 0; }
.form-row { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters label { margin-bottom: 0; min-width: 140px; }
.filters .btn { height: 38px; }
.help { font-weight: 400; color: var(--ink-3); font-size: 12px; display: block; margin-top: 4px; }

/* ---------- Alertas ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; border: 1px solid transparent; }
.alert-success { background: var(--green-soft); color: #1e6337; border-color: #c7e6d1; }
.alert-error { background: var(--red-soft); color: #922a1f; border-color: #f2c9c3; }
.alert-info { background: var(--blue-soft); color: #234f83; border-color: #c9dbf1; }
.alert-warning { background: var(--amber-soft); color: #7d5410; border-color: #f0dbb0; }

/* ---------- Abas ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.active { color: var(--ink); border-color: var(--accent); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(20,16,10,.5); display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 40px 16px; overflow-y: auto; }
.modal.open { display: flex; }
.modal-box { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-box.lg { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 20px; }
.modal-close { background: none; border: 0; cursor: pointer; color: var(--ink-3); padding: 4px; }

/* ---------- Agenda (visão do dia) ---------- */
.agenda-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agenda-nav .date-label { font-weight: 700; font-size: 16px; min-width: 210px; text-align: center; }
.agenda { display: grid; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow-x: auto; }
.agenda-head, .agenda-body { display: grid; }
.agenda-head > div { padding: 10px; font-weight: 700; border-bottom: 1px solid var(--line); background: #fbfaf7; display: flex; align-items: center; gap: 8px; position: sticky; top: 0; }
.agenda-times { border-right: 1px solid var(--line); }
.agenda-time { height: 48px; font-size: 11.5px; color: var(--ink-3); padding: 3px 8px; border-bottom: 1px dashed #efeae2; text-align: right; }
.agenda-col { position: relative; border-right: 1px solid var(--line); }
.agenda-col:last-child { border-right: 0; }
.agenda-slot { height: 48px; border-bottom: 1px dashed #efeae2; cursor: pointer; }
.agenda-slot:hover { background: var(--accent-soft); }
.agenda-slot.closed { background: repeating-linear-gradient(45deg, #f7f5f1, #f7f5f1 6px, #f1eee8 6px, #f1eee8 12px); cursor: default; }
.ag-item { position: absolute; left: 4px; right: 4px; border-radius: 7px; padding: 5px 8px; font-size: 12px; overflow: hidden; cursor: pointer; border-left: 4px solid; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); line-height: 1.3; }
.ag-item:hover { z-index: 5; box-shadow: 0 3px 10px rgba(0,0,0,.18); }
.ag-item b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-item .t { color: var(--ink-3); font-size: 11px; }
.ag-item.st-concluido { opacity: .65; }
.ag-item.st-cancelado, .ag-item.st-faltou { opacity: .45; text-decoration: line-through; }
.ag-item.bloqueio { background: repeating-linear-gradient(45deg, #eee, #eee 5px, #e4e4e4 5px, #e4e4e4 10px); border-left-color: #999; color: #555; cursor: default; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 6; pointer-events: none; }
.slots { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 14px; }
.slots button { border: 1px solid #d9d2c6; background: #fff; border-radius: 7px; padding: 6px 10px; cursor: pointer; font: inherit; font-size: 13px; }
.slots button.sel { background: var(--accent); border-color: var(--accent); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #d9d2c6; border-radius: 20px; padding: 5px 11px; cursor: pointer; font-size: 13px; font-weight: 500; margin: 0; background: #fff; }
.chip input { width: auto; margin: 0; }
.chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- Frente de caixa (PDV) ---------- */
.pdv { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.pdv-items td input, .pdv-items td select { margin: 0; padding: 7px 9px; }
.pdv-total { background: var(--side); color: #fff; border-radius: var(--radius); padding: 18px; }
.pdv-total .row { display: flex; justify-content: space-between; padding: 4px 0; color: #cfc5b5; }
.pdv-total .big { font-size: 32px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.pdv-total .falta { color: #ffb4a8; } .pdv-total .troco { color: #9be0b1; }
.pag-row { display: grid; grid-template-columns: 1fr 110px 70px 32px; gap: 6px; margin-bottom: 6px; }
.pag-row select, .pag-row input { margin: 0; padding: 7px 8px; }
.quick-pay { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.cobrar-list a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; color: var(--ink); }
.cobrar-list a:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.plano-box { background: var(--teal-soft); color: #11615d; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }

/* ---------- Recibo ---------- */
.recibo { max-width: 340px; margin: 0 auto; background: #fff; padding: 20px; font-family: "Courier New", monospace; font-size: 13px; border: 1px dashed #bbb; }
.recibo h3 { text-align: center; margin: 0 0 4px; }
.recibo hr { border: 0; border-top: 1px dashed #999; margin: 10px 0; }
.recibo .l { display: flex; justify-content: space-between; gap: 8px; }

/* ---------- Diversos ---------- */
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--accent-soft); display: inline-grid; place-items: center; font-weight: 700; color: var(--amber); flex-shrink: 0; }
.person { display: flex; align-items: center; gap: 10px; }
.gallery-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.gallery-admin figure { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.gallery-admin img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.gallery-admin figcaption { padding: 8px; font-size: 12px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.thumb { width: 100%; max-width: 220px; border-radius: 8px; border: 1px solid var(--line); display: block; margin-bottom: 8px; }
.bar { height: 8px; background: var(--gray-soft); border-radius: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.pagination { display: flex; gap: 4px; justify-content: center; padding: 14px; flex-wrap: wrap; }
.pagination a { padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink-2); }
.pagination a.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; }
.share-box { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Login ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, #2c251b, #16130f 60%); }
.auth-card { background: #fff; border-radius: 14px; padding: 30px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; margin-bottom: 20px; color: var(--ink); }
.auth-brand .ic { color: var(--accent); }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pdv, .grid-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 0 14px; }
  .topbar .user span { display: none; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .value { font-size: 19px; }
  .kv { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar, .no-print, .page-head .actions { display: none !important; }
  .main { margin: 0; } .content { padding: 0; } body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}
