/* =====================================================================
   NZBarber — Design System
   Light/Dark via [data-theme]; mobile-first; premium e minimalista.
   ===================================================================== */

:root{
  --brand: #6366f1;
  --brand-2: #4f46e5;
  --brand-rgb: 99,102,241;

  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f1f6;
  --border: #e4e7ee;
  --text: #1a1d29;
  --muted: #6b7280;
  --heading: #0f1117;

  --ok: #16a34a; --ok-bg:#dcfce7;
  --warn:#d97706; --warn-bg:#fef3c7;
  --info:#2563eb; --info-bg:#dbeafe;
  --danger:#dc2626; --danger-bg:#fee2e2;
  --purple:#7c3aed; --purple-bg:#ede9fe;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.12);
  --sidebar-w: 250px;
  --header-h: 62px;
  --font: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="dark"]{
  --bg:#0b0d14; --surface:#151823; --surface-2:#1c2030; --border:#262b3d;
  --text:#e5e7eb; --muted:#9199ad; --heading:#f3f4f6;
  --ok:#4ade80; --ok-bg:rgba(34,197,94,.15);
  --warn:#fbbf24; --warn-bg:rgba(217,119,6,.18);
  --info:#60a5fa; --info-bg:rgba(37,99,235,.18);
  --danger:#f87171; --danger-bg:rgba(220,38,38,.18);
  --purple:#a78bfa; --purple-bg:rgba(124,58,237,.2);
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:var(--font); background:var(--bg); color:var(--text);
  font-size:15px; line-height:1.5; -webkit-font-smoothing:antialiased;
}
a{color:var(--brand); text-decoration:none}
h1,h2,h3,h4{color:var(--heading); margin:0}
::-webkit-scrollbar{width:9px;height:9px}
::-webkit-scrollbar-thumb{background:var(--border);border-radius:99px}

/* ---------- Layout do painel ---------- */
.app{display:flex; min-height:100vh}
.sidebar{
  width:var(--sidebar-w); background:var(--surface); border-right:1px solid var(--border);
  position:fixed; inset:0 auto 0 0; display:flex; flex-direction:column; z-index:40;
  transition:transform .25s ease;
}
.sidebar__brand{display:flex; align-items:center; gap:10px; padding:18px 20px; border-bottom:1px solid var(--border)}
.sidebar__brand .logo{width:38px;height:38px;border-radius:11px;background:linear-gradient(135deg,var(--brand),var(--purple));
  display:flex;align-items:center;justify-content:center;font-size:20px;color:#fff;overflow:hidden}
.sidebar__brand .logo img{width:100%;height:100%;object-fit:cover}
.sidebar__brand strong{font-size:16px; color:var(--heading); line-height:1.1}
.sidebar__brand small{color:var(--muted); font-size:11px}
.nav{flex:1; overflow-y:auto; padding:12px 10px}
.nav__group{font-size:11px; text-transform:uppercase; letter-spacing:.6px; color:var(--muted); padding:14px 12px 6px}
.nav a{
  display:flex; align-items:center; gap:11px; padding:10px 12px; border-radius:var(--radius-sm);
  color:var(--text); font-weight:500; font-size:14px; margin-bottom:2px; transition:.15s;
}
.nav a svg{width:19px;height:19px;flex:none;opacity:.8}
.nav a:hover{background:var(--surface-2)}
.nav a.active{background:rgba(var(--brand-rgb),.12); color:var(--brand)}
.nav a.active svg{opacity:1}
.sidebar__foot{padding:12px; border-top:1px solid var(--border)}

.main{flex:1; margin-left:var(--sidebar-w); display:flex; flex-direction:column; min-width:0}
.topbar{
  height:var(--header-h); background:var(--surface); border-bottom:1px solid var(--border);
  display:flex; align-items:center; gap:14px; padding:0 22px; position:sticky; top:0; z-index:30;
}
.topbar h1{font-size:18px; font-weight:700; flex:1}
.topbar__actions{display:flex; align-items:center; gap:10px}
.content{padding:22px; flex:1}
.hamburger{display:none; background:none; border:none; cursor:pointer; color:var(--text); padding:6px}

/* ---------- Cards ---------- */
.card{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow)}
.card__body{padding:18px}
.card__head{padding:16px 18px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:10px}
.card__head h3{font-size:15px; flex:1}

.grid{display:grid; gap:16px}
.grid-4{grid-template-columns:repeat(4,1fr)}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-2{grid-template-columns:repeat(2,1fr)}

/* Stat tiles */
.stat{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:18px; box-shadow:var(--shadow)}
.stat__label{color:var(--muted); font-size:13px; display:flex; align-items:center; gap:8px}
.stat__icon{width:34px;height:34px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:17px}
.stat__value{font-size:28px; font-weight:800; color:var(--heading); margin-top:10px; letter-spacing:-.5px}
.stat__sub{font-size:12px; color:var(--muted); margin-top:3px}
.stat__row{display:flex; align-items:center; justify-content:space-between}

/* ---------- Badges de status ---------- */
.badge{display:inline-flex; align-items:center; gap:5px; font-size:12px; font-weight:600;
  padding:3px 9px; border-radius:99px; white-space:nowrap}
.badge::before{content:""; width:7px; height:7px; border-radius:99px; background:currentColor}
.badge-scheduled{color:var(--info); background:var(--info-bg)}
.badge-confirmed{color:var(--ok); background:var(--ok-bg)}
.badge-awaiting_payment,.badge-pending{color:var(--warn); background:var(--warn-bg)}
.badge-paid{color:var(--ok); background:var(--ok-bg)}
.badge-arrived{color:var(--purple); background:var(--purple-bg)}
.badge-in_service{color:var(--info); background:var(--info-bg)}
.badge-completed{color:var(--muted); background:var(--surface-2)}
.badge-cancelled{color:var(--danger); background:var(--danger-bg)}
.badge-no_show{color:var(--warn); background:var(--warn-bg)}

/* ---------- Botões ---------- */
.btn{display:inline-flex; align-items:center; justify-content:center; gap:8px; cursor:pointer;
  padding:10px 16px; border-radius:var(--radius-sm); border:1px solid transparent; font-family:inherit;
  font-size:14px; font-weight:600; transition:.15s; white-space:nowrap}
.btn:disabled{opacity:.55; cursor:not-allowed}
.btn svg{width:17px;height:17px}
.btn-primary{background:var(--brand); color:#fff}
.btn-primary:hover:not(:disabled){background:var(--brand-2)}
.btn-ghost{background:transparent; color:var(--text); border-color:var(--border)}
.btn-ghost:hover{background:var(--surface-2)}
.btn-danger{background:var(--danger); color:#fff}
.btn-sm{padding:6px 11px; font-size:13px}
.btn-block{width:100%}
.btn-icon{padding:8px; width:38px; height:38px}

/* ---------- Formulários ---------- */
.field{margin-bottom:15px}
.field label{display:block; font-size:13px; color:var(--muted); margin-bottom:6px; font-weight:500}
.input, .select, textarea.input{
  width:100%; padding:11px 13px; border:1px solid var(--border); border-radius:var(--radius-sm);
  background:var(--surface); color:var(--text); font-size:15px; font-family:inherit; outline:none; transition:.15s;
}
.input:focus, .select:focus, textarea.input:focus{border-color:var(--brand); box-shadow:0 0 0 3px rgba(var(--brand-rgb),.15)}
.field .hint{font-size:12px; color:var(--muted); margin-top:5px}
.field .error{font-size:12.5px; color:var(--danger); margin-top:5px}

/* ---------- Toasts ---------- */
.toasts{position:fixed; top:16px; right:16px; z-index:100; display:flex; flex-direction:column; gap:10px; max-width:min(360px,92vw)}
.toast{background:var(--surface); border:1px solid var(--border); border-left:4px solid var(--brand);
  border-radius:var(--radius-sm); padding:13px 15px; box-shadow:var(--shadow-lg); font-size:14px;
  display:flex; gap:10px; align-items:flex-start; animation:toastIn .25s ease}
.toast.success{border-left-color:var(--ok)}
.toast.error{border-left-color:var(--danger)}
.toast.warn{border-left-color:var(--warn)}
@keyframes toastIn{from{opacity:0; transform:translateX(20px)}to{opacity:1; transform:none}}

/* ---------- Tabelas ---------- */
.table-wrap{overflow-x:auto}
table.tbl{width:100%; border-collapse:collapse; font-size:14px}
table.tbl th{text-align:left; color:var(--muted); font-weight:600; font-size:12px; text-transform:uppercase;
  letter-spacing:.4px; padding:11px 14px; border-bottom:1px solid var(--border)}
table.tbl td{padding:13px 14px; border-bottom:1px solid var(--border)}
table.tbl tr:last-child td{border-bottom:none}
table.tbl tr:hover td{background:var(--surface-2)}

/* ---------- Empty state ---------- */
.empty{text-align:center; padding:48px 20px; color:var(--muted)}
.empty .ico{font-size:40px; margin-bottom:12px; opacity:.5}
.empty h3{color:var(--text); margin-bottom:6px; font-size:16px}

/* ---------- Skeleton ---------- */
.skeleton{background:linear-gradient(90deg,var(--surface-2) 25%,var(--border) 37%,var(--surface-2) 63%);
  background-size:400% 100%; animation:sk 1.4s ease infinite; border-radius:8px}
@keyframes sk{0%{background-position:100% 50%}100%{background-position:0 50%}}

/* ---------- Bottom nav (mobile) ---------- */
.bottomnav{display:none; position:fixed; bottom:0; left:0; right:0; z-index:45;
  background:var(--surface); border-top:1px solid var(--border); padding:6px 4px calc(6px + env(safe-area-inset-bottom));
  grid-template-columns:repeat(5,1fr)}
.bottomnav a{display:flex; flex-direction:column; align-items:center; gap:3px; padding:6px 2px;
  color:var(--muted); font-size:10.5px; font-weight:500; border-radius:10px}
.bottomnav a svg{width:22px;height:22px}
.bottomnav a.active{color:var(--brand)}
.bottomnav .fab{margin-top:-22px}
.bottomnav .fab span{width:48px;height:48px;border-radius:50%;background:var(--brand);color:#fff;
  display:flex;align-items:center;justify-content:center;box-shadow:0 6px 16px rgba(var(--brand-rgb),.5)}
.bottomnav .fab svg{width:26px;height:26px}

/* Overlay para sidebar mobile */
.overlay{display:none; position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:39}
.overlay.show{display:block}

/* ---------- Modais ---------- */
.modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:60;display:none;
  align-items:flex-end;justify-content:center;padding:0}
.modal-backdrop.open{display:flex}
.modal{background:var(--surface);width:100%;max-width:520px;border-radius:18px 18px 0 0;
  box-shadow:var(--shadow-lg);max-height:92vh;display:flex;flex-direction:column;animation:modalUp .25s ease}
@keyframes modalUp{from{transform:translateY(30px);opacity:.6}to{transform:none;opacity:1}}
.modal__head{display:flex;align-items:center;justify-content:space-between;padding:18px 20px;border-bottom:1px solid var(--border)}
.modal__head h3{font-size:17px}
.modal__body{padding:20px;overflow-y:auto}
.modal__foot{padding:14px 20px;border-top:1px solid var(--border);display:flex;gap:10px;justify-content:flex-end}
@media (min-width:640px){
  .modal-backdrop{align-items:center;padding:20px}
  .modal{border-radius:18px}
}
input[type=checkbox]{width:18px;height:18px;accent-color:var(--brand);cursor:pointer}

/* ---------- Utilitários ---------- */
.flex{display:flex} .items-center{align-items:center} .justify-between{justify-content:space-between}
.gap-2{gap:8px} .gap-3{gap:12px} .mt-3{margin-top:12px} .mt-4{margin-top:18px} .mb-3{margin-bottom:12px}
.text-muted{color:var(--muted)} .text-sm{font-size:13px} .text-right{text-align:right}
.fw-700{font-weight:700} .wrap-actions{display:flex;gap:8px;flex-wrap:wrap}
.page-title{font-size:22px; font-weight:800; margin-bottom:4px}
.page-sub{color:var(--muted); margin-bottom:20px; font-size:14px}
.hidden{display:none!important}

/* ---------- Responsivo ---------- */
@media (max-width: 1100px){ .grid-4{grid-template-columns:repeat(2,1fr)} }
@media (max-width: 900px){
  .sidebar{transform:translateX(-100%)}
  .sidebar.open{transform:none}
  .main{margin-left:0}
  .hamburger{display:block}
  .bottomnav{display:grid}
  .content{padding:16px 14px 88px}
  .grid-3{grid-template-columns:1fr 1fr}
}
@media (max-width: 560px){
  .grid-2,.grid-3{grid-template-columns:1fr}
  .topbar h1{font-size:16px}
}
