

:root{
  --bg:#f6f7fb;
  --card:#fff;
  --text:#0f172a; /* ✅ corrigido: faltava # */
  --muted:#64748b;
  --border:#e5e7eb;
  --primary:#0d6efd;
  --danger:#dc3545;
  --shadow:0 10px 30px rgba(2,6,23,.06);
  --radius:16px;
}

html{ box-sizing:border-box; }
*,*::before,*::after{ box-sizing:inherit; }

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Helvetica Neue", sans-serif;
  font-weight:400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a{ color:inherit; }

/* =========================
   Layout
========================= */
.app{ display:flex; min-height:100vh; }

.content{
  flex:1;
  padding:24px;
  max-width:1200px;
  margin:0 auto;
}

h2{
  margin:6px 0 16px;
  font-size:22px;
  letter-spacing:-.2px;
  font-weight:600;
}

/* =========================
   Sidebar
========================= */
.sidebar{
  width:270px;
  background:linear-gradient(180deg,#0d6efd 0%,#0b5ed7 100%);
  color:#fff;
  padding:22px;
  position:sticky;
  top:0;
  height:100vh;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:18px;
}

.brand img{
  width:38px;
  height:38px;
  border-radius:12px;
  background:rgba(255,255,255,.12);
  padding:6px;
}

.brand .name{
  font-weight:600;
  letter-spacing:.2px;
}

.nav{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.nav a{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 12px;
  border-radius:12px;
  color:#fff;
  text-decoration:none;
  font-weight:500;
  opacity:.95;
  transition: background .15s ease, opacity .15s ease, transform .05s ease;
}

.nav a:hover{
  background:rgba(255,255,255,.12);
  opacity:1;
}

.nav a:active{ transform: translateY(1px); }

.nav a.active{
  background: rgba(255,255,255,.18);
  opacity:1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}

.meta{
  margin-top:18px;
  padding-top:14px;
  border-top:1px solid rgba(255,255,255,.22);
  font-size:13px;
}
.meta .empresa{ font-weight:600; }
.meta .plano{ opacity:.9; font-weight:400; }

/* =========================
   Topbar
========================= */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:16px 18px;
  background:var(--card);
  border:1px solid rgba(15,23,42,.08);
  border-radius:var(--radius);
  box-shadow:0 14px 40px rgba(2,6,23,.06);
  margin-bottom:18px;
}

.topbar .title strong{ font-size:16px; font-weight:600; }
.topbar .title span{
  display:block;
  margin-top:2px;
  font-size:13px;
  color:var(--muted);
  font-weight:400;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  color:var(--muted);
  font-weight:500;
  font-size:13px;
  background:#fff;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.04);
}

/* =========================
   Grid / Cards / KPI (DASHBOARD)
========================= */
.grid{
  display:grid;
  grid-template-columns:repeat(12,1fr);
  gap:14px;
}

.card{
  background:var(--card);
  border:1px solid rgba(15,23,42,.08);
  border-radius:var(--radius);
  box-shadow:0 14px 40px rgba(2,6,23,.06);
  padding:16px;
}

.kpi{
  grid-column:span 4;
  min-height:112px;
}

.kpi-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.kpi-title{
  display:flex;
  align-items:center;
  gap:12px;
}

.kpi-icon{
  width:44px;
  height:44px;
  border-radius:16px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(13,110,253,.10);
  color:var(--primary);
  box-shadow: inset 0 0 0 1px rgba(13,110,253,.10);
}

.kpi-label{
  margin:0;
  font-size:12px;
  color:var(--muted);
  font-weight:500;
  text-transform:uppercase;
  letter-spacing:.3px;
}

.kpi-value{
  margin-top:8px;
  font-size:32px;
  font-weight:700;
  letter-spacing:-1px;
  line-height:1.05;
}

.kpi-sub{
  margin-top:6px;
  font-size:12px;
  color:var(--muted);
  font-weight:400;
  opacity:.95;
}

.section{ grid-column:span 12; padding:18px; }

/* =========================
   Section Header
========================= */
.section-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.section-title h3{
  margin:0;
  font-size:14px;
  font-weight:600;
  letter-spacing:-.2px;
  color:var(--text);
}

.section-title .hint{
  color:var(--muted);
  font-size:12px;
  font-weight:400;
}

/* =========================
   Progress / Alert
========================= */
.progress{
  height:14px;
  border-radius:999px;
  background:#eef2f7;
  overflow:hidden;
  border:1px solid var(--border);
}

.progress > div{
  height:100%;
  background:var(--primary);
  border-radius:999px;
}

.alert{
  margin-top:12px;
  padding:12px;
  border-radius:14px;
  border:1px solid rgba(220,53,69,.25);
  background:rgba(220,53,69,.06);
  color:var(--danger);
  font-weight:600;
}

/* =========================
   Buttons (quick actions)
========================= */
.qa{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background:#fff;
  text-decoration:none;
  font-weight:500;
  color:var(--text);
  transition: transform .05s ease, filter .15s ease;
}

.qa:active{ transform: translateY(1px); }

.qa.primary{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff;
}

.qa.primary:hover{ filter: brightness(.96); }

.qa.danger{
  background: rgba(220,53,69,.08);
  border-color: rgba(220,53,69,.18);
  color: #b42318;
}

/* =========================
   Charts (DASHBOARD)
========================= */
.charts{
  display:grid;
  grid-template-columns:repeat(12,1fr);
  gap:14px;
  margin-top:6px;
}

.chart{
  grid-column:span 4;
  padding:16px;
  border:1px solid rgba(15,23,42,.08);
  border-radius:var(--radius);
  background:#fff;
  box-shadow:0 10px 30px rgba(2,6,23,.05);
}

.chart .chart-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}

.chart .chart-head h3{
  margin:0;
  font-size:14px;
  font-weight:600;
}

.chart .chart-head p{
  margin:4px 0 0;
  font-size:12px;
  color:var(--muted);
  font-weight:400;
}

.chart .chart-body{ color:var(--primary); }
.chart .chart-body svg{ display:block; }

.chart .chart-foot{
  margin-top:10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  color:var(--muted);
  font-weight:400;
  font-size:12px;
}

/* =========================
   Clientes (lista bonita)
========================= */
.cliente-row{
  display:grid;
  grid-template-columns: 1.2fr 1fr 220px;
  gap:12px;
  align-items:center;
  padding:14px 16px;
  border:1px solid rgba(15,23,42,.08);
  border-radius:16px;
  background:#fff;
  box-shadow:0 10px 30px rgba(2,6,23,.04);
}

.cliente-nome{
  font-weight:500;
}

.cliente-zap{
  color:var(--muted);
  font-weight:400;
  text-align:center;
}

/* =========================
   Agenda: botões bonitos
========================= */
.ag-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.ag-btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 14px;
  border-radius:999px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  text-decoration:none;
  font-size:14px;
  font-weight:500;
  box-shadow:0 8px 20px rgba(2,6,23,.08);
}

.ag-btn:hover{
  border-color: rgba(13,110,253,.35);
}

.ag-btn.primary{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff;
}

/* =========================
   Agenda grid (24h / 7 dias)
========================= */
.agenda-wrap{
  width:100%;
  overflow:auto;
  border-radius:16px;
}

.agenda-grid{
  display:grid;
  grid-template-columns: 70px repeat(7, minmax(160px, 1fr));
  min-width: 100%;
  border:1px solid var(--border);
  border-radius:16px;
  background:#fff;
}

.ag-head{
  position:sticky;
  top:0;
  z-index:5;
  background:#f8fafc;
  border-bottom:1px solid var(--border);
  padding:8px;
  text-align:center;
  font-weight:500;
}

.ag-time{
  font-size:12px;
  color:var(--muted);
  text-align:right;
  padding:10px 8px;
  border-right:1px solid var(--border);
  border-bottom:1px solid var(--border);
  background:#fafafa;
}

.ag-cell{
  min-height:64px;
  border-bottom:1px solid var(--border);
  border-right:1px solid var(--border);
  padding:6px;
  background:#fff;
}

.ag-cell:hover{
  background:#f8fafc;
}

.ag-event{
  display:block;
  padding:6px 8px;
  border-radius:10px;
  font-size:12px;
  line-height:1.2;
  margin-bottom:6px;
  text-decoration:none;
  color:#0f172a;
  background:#e7f0ff;
  border:1px solid rgba(13,110,253,.25);
}

.ag-event-title{
  font-weight:500;
  font-size:12px;
}

.ag-event-sub{
  font-size:11px;
  color:#334155;
  font-weight:400;
}

.st-agendado{
  background:#e7f0ff;
  border-color:#b6d4fe;
}

.st-confirmado{
  background:#e6f4ea;
  border-color:#b7dfc2;
}

.st-cancelado{
  background:#fdecec;
  border-color:#f5b7b1;
  text-decoration: line-through;
}

/* =========================
   Responsive
========================= */
@media (max-width: 1100px){
  .kpi{ grid-column:span 6; }
  .chart{ grid-column:span 6; }
  .cliente-row{ grid-template-columns: 1fr 1fr; }
  .cliente-row > div:last-child{ grid-column: 1 / -1; justify-content:flex-start !important; }
}

/* ✅ MENU MOBILE (substitui o "sidebar some") */
.mobile-topbar{
  display:none;
  position:sticky;
  top:0;
  z-index:50;
  background: rgba(246,247,251,.92);
  backdrop-filter: blur(10px);
  border-bottom:1px solid rgba(15,23,42,.08);
  padding:10px 14px;
  gap:12px;
  align-items:center;
  justify-content:space-between;
}

.mobile-menu-btn{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(15,23,42,.12);
  background:#fff;
  color:var(--text);
  font-weight:600;
  cursor:pointer;
}

.mobile-brand{
  display:inline-flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color:var(--text);
}
.mobile-brand img{
  width:32px;
  height:32px;
  border-radius:12px;
  padding:6px;
  background: rgba(13,110,253,.10);
  border:1px solid rgba(13,110,253,.12);
  object-fit:contain;
}
.mobile-brand strong{
  font-size:14px;
  font-weight:600;
  letter-spacing:-.2px;
}

.sidebar-close{
  display:none;
  margin-left:auto;
  border:1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.12);
  color:#fff;
  border-radius:12px;
  padding:8px 10px;
  cursor:pointer;
}

.sidebar-overlay{
  display:none;
  position:fixed;
  inset:0;
  background: rgba(2,6,23,.45);
  z-index:60;
}

@media (max-width: 780px){
  .mobile-topbar{ display:flex; }

  /* ⛔ removido: .sidebar{ display:none; }  -> agora é drawer */
  .sidebar{
    position:fixed;
    top:0;
    left:0;
    height:100vh;
    width:280px;
    z-index:70;
    transform: translateX(-105%);
    transition: transform .18s ease;
    box-shadow: 0 20px 60px rgba(2,6,23,.30);
  }

  .sidebar-close{ display:inline-flex; }
  .content{ padding:16px; }
  .kpi, .chart{ grid-column:span 12; }
  .topbar{ flex-direction:column; align-items:flex-start; }

  body.sidebar-open .sidebar{ transform: translateX(0); }
  body.sidebar-open .sidebar-overlay{ display:block; }
  body.sidebar-open{ overflow:hidden; }

  /* (linha de segurança p/ Android evitar scroll lateral quando drawer abre) */
  body{ overflow-x:hidden; }
}

/* iOS: remove o retângulo azul (tap highlight) na área da marca do menu */
.sidebar .brand,
.sidebar .brand *{
  -webkit-tap-highlight-color: transparent;
}

/* evita "fundo" aparecer ao tocar (estado :active) */
.sidebar .brand:active,
.sidebar .brand *:active{
  background-color: transparent !important;
}

/* garante que o wrapper branco continue branco (sem overlay estranho) */
.sidebar .brand > div{
  background: #fff !important;
}

.sidebar .brand,
.sidebar .brand *{
  -webkit-touch-callout: none;
  user-select: none;
}