/* ============================================================
   ERP SaaS — app.linkeducacional.com.br
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 240px;
  --topbar-h:  56px;
  --radius:    10px;
  --shadow:    0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --border:    #e9ecef;
  --text:      #0f172a;
  --muted:     #64748b;
  --bg:        #f4f6f9;
  --white:     #ffffff;
  --primary:   #2563eb;
  --green:     #16a34a;
  --red:       #dc2626;
  --orange:    #ea580c;
  --purple:    #7c3aed;
  --cyan:      #0891b2;
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Layout ── */
.app-layout { display: flex; min-height: 100vh; }
.app-main   { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.app-content { flex: 1; padding: 24px 28px; }

/* ── Sidebar ── */
.app-sidebar {
  width: var(--sidebar-w); min-height: 100vh; background: #0f172a;
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.app-sidebar__header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 14px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.app-sidebar__logo     { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.app-sidebar__logo-text {
  width: 36px; height: 36px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; font-weight: 700;
  font-size: .85rem; color: #fff; flex-shrink: 0;
}
.app-sidebar__empresa strong { display: block; color: #f1f5f9; font-size: .88rem; line-height: 1.3; }
.app-sidebar__empresa span   { color: #94a3b8; font-size: .74rem; }

.app-sidebar__nav   { flex: 1; padding: 8px 0; }
.app-sidebar__item  {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px; color: #94a3b8; font-size: .875rem;
  text-decoration: none; border-radius: 7px; margin: 2px 8px;
  transition: background .15s, color .15s;
}
.app-sidebar__item:hover { background: rgba(255,255,255,.07); color: #e2e8f0; }
.app-sidebar__item.active { background: var(--primary); color: #fff; font-weight: 500; }
.app-sidebar__icon  { font-size: 1rem; width: 20px; text-align: center; }

.app-sidebar__subs  { margin: 0 8px 4px 8px; border-left: 2px solid rgba(255,255,255,.12); padding-left: 4px; }
.app-sidebar__sub   {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; color: #94a3b8; font-size: .82rem;
  text-decoration: none; border-radius: 6px;
  transition: background .15s, color .15s;
}
.app-sidebar__sub:hover  { background: rgba(255,255,255,.06); color: #e2e8f0; }
.app-sidebar__sub.active { color: #fff; font-weight: 500; background: rgba(255,255,255,.1); }

.app-sidebar__footer { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.07); }
.app-sidebar__user   { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.app-sidebar__avatar {
  width: 30px; height: 30px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: .8rem;
  font-weight: 700; color: #fff; flex-shrink: 0;
}
.app-sidebar__user strong { display: block; color: #f1f5f9; font-size: .82rem; }
.app-sidebar__user span   { color: #94a3b8; font-size: .72rem; }
.app-sidebar__sair  { color: #64748b; font-size: .78rem; text-decoration: none; }
.app-sidebar__sair:hover { color: #94a3b8; }

/* ── Top bar ── */
.app-topbar {
  height: var(--topbar-h); background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 28px;
  position: sticky; top: 0; z-index: 10;
}
.app-topbar__title { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.app-topbar__actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* ── Cards de KPI ── */
.kpi-row   { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi       { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.kpi__icon { font-size: 1.5rem; margin-bottom: 8px; }
.kpi__val  { font-size: 1.9rem; font-weight: 700; color: var(--text); line-height: 1; }
.kpi__lbl  { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.kpi__sub  { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.kpi.green { border-left: 4px solid var(--green); }
.kpi.red   { border-left: 4px solid var(--red);   }
.kpi.blue  { border-left: 4px solid var(--primary); }
.kpi.purple{ border-left: 4px solid var(--purple); }
.kpi.orange{ border-left: 4px solid var(--orange); }
.kpi.cyan  { border-left: 4px solid var(--cyan);   }

/* ── Cards genéricos ── */
.card          { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px; }
.card__head    { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.card__title   { font-size: .95rem; font-weight: 600; }
.card__body    { padding: 20px; }
.card-grid     { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media(max-width:768px){ .card-grid { grid-template-columns: 1fr; } }

/* ── Tabelas ── */
.tbl           { width: 100%; border-collapse: collapse; font-size: .875rem; }
.tbl th        { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: .72rem;
                 text-transform: uppercase; letter-spacing: .04em; padding: 10px 16px; text-align: left; }
.tbl td        { padding: 11px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
.tbl tr:hover td { background: #f8fafc; }
.tbl__empty    { text-align: center; padding: 36px; color: var(--muted); }

/* ── Formulários ── */
.form-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media(max-width:640px){ .form-grid, .form-grid3 { grid-template-columns: 1fr; } }
.fg         { display: flex; flex-direction: column; gap: 5px; }
.fg.full    { grid-column: 1 / -1; }
.fg label   { font-size: .82rem; font-weight: 500; color: #374151; }
.fg input, .fg select, .fg textarea {
  border: 1px solid #d1d5db; border-radius: 7px; padding: 8px 11px;
  font-size: .9rem; font-family: inherit; transition: border .15s;
  background: var(--white); color: var(--text);
}
.fg input:focus, .fg select:focus, .fg textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.fg textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ── Botões ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 8px; font-size: .875rem; font-weight: 500; cursor: pointer;
  text-decoration: none; border: none; font-family: inherit; transition: filter .15s, opacity .15s; }
.btn:hover    { filter: brightness(.93); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-green    { background: var(--green); color: #fff; }
.btn-red      { background: #fee2e2; color: var(--red); }
.btn-ghost    { background: #f1f5f9; color: #374151; }
.btn-sm       { padding: 5px 12px; font-size: .8rem; }
.btn-outline  { background: transparent; border: 1.5px solid var(--border); color: var(--text); }

/* ── Badges ── */
.badge        { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .73rem; font-weight: 600; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-red    { background: #fee2e2; color: var(--red); }
.badge-orange { background: #fff7ed; color: var(--orange); }
.badge-blue   { background: #eff6ff; color: var(--primary); }
.badge-purple { background: #f5f3ff; color: var(--purple); }
.badge-gray   { background: #f1f5f9; color: var(--muted); }
.badge-cyan   { background: #ecfeff; color: var(--cyan); }

/* ── Flash ── */
.flash       { padding: 11px 16px; border-radius: 8px; margin-bottom: 18px; font-size: .9rem; font-weight: 500; }
.flash-ok    { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.flash-err   { background: #fee2e2; color: var(--red); border: 1px solid #fca5a5; }
.flash-warn  { background: #fefce8; color: #854d0e; border: 1px solid #fde047; }

/* ── Progress ── */
.progress     { background: #e2e8f0; border-radius: 99px; height: 7px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; background: var(--primary); transition: width .4s; }

/* ── Login/Registro ── */
.auth-page   { min-height: 100vh; display: flex; align-items: center; justify-content: center;
               background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 60%, #2563eb 100%); padding: 20px; }
.auth-box    { background: var(--white); border-radius: 16px; padding: 36px 40px;
               width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-logo   { text-align: center; margin-bottom: 28px; }
.auth-logo img { height: 48px; }
.auth-logo h1  { font-size: 1.4rem; color: var(--text); margin-top: 8px; }
.auth-logo p   { color: var(--muted); font-size: .88rem; margin-top: 4px; }

/* ── Dashboard modules grid ── */
.modulos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.modulo-card  {
  display: flex; flex-direction: column; gap: 8px; padding: 20px;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: var(--text); border-bottom: 4px solid transparent;
  transition: transform .15s, box-shadow .15s;
}
.modulo-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,.1); }
.modulo-card__icon { font-size: 2rem; }
.modulo-card__name { font-weight: 600; font-size: .95rem; }
.modulo-card__desc { font-size: .8rem; color: var(--muted); }

/* ── Funil CRM ── */
.funil { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.funil-col { min-width: 220px; background: #f8fafc; border-radius: var(--radius); padding: 12px; flex-shrink: 0; }
.funil-col__header { font-size: .82rem; font-weight: 600; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; }
.funil-lead { background: var(--white); border-radius: 7px; padding: 12px; margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); font-size: .85rem; cursor: pointer; }
.funil-lead:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.funil-lead__nome { font-weight: 600; }
.funil-lead__info { color: var(--muted); font-size: .78rem; margin-top: 2px; }

/* ── Pagination ── */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 14px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 5px 11px; border-radius: 6px; font-size: .83rem; text-decoration: none;
  color: var(--text); background: #f1f5f9;
}
.pagination .current { background: var(--primary); color: #fff; font-weight: 600; }

/* ── Responsivo ── */
@media(max-width: 900px) {
  .app-sidebar { position: fixed; left: -260px; z-index: 100; transition: left .25s; }
  .app-sidebar.open { left: 0; }
  .app-content { padding: 16px; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
}
