:root {
    --o: #f58220;
    --od: #d86d11;
    --b: #121212;
    --bg: #f7f7f8;
    --bd: #ececec;
    --m: #6c757d;
    --sh: 0 10px 30px rgba(0, 0, 0, .06);
    --r: 18px
}

* {
    box-sizing: border-box
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--b)
}

a {
    text-decoration: none
}

.sidebar {
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    background: var(--b);
    color: #fff;
}

.sidebar-brand {
    padding: 1.25rem 1rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08)
}

.sidebar-logo {
    width: 100%;
    max-width: 190px;
    display: block;
    margin: 0 auto;
    border-radius: 10px;
    background: #fff
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, .88);
    border-radius: 10px;
    padding: .8rem .9rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    font-weight: 500
}

.sidebar .nav-link:hover, .sidebar .nav-link.active {
    background: var(--o);
    color: #fff
}

.sidebar-section-title {
    color: rgba(255, 255, 255, .55);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 1rem 0 .6rem;
    padding: 0 .9rem
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--bd);
    position: sticky;
    top: 0;
    z-index: 100
}

.content-wrapper {
    padding: 1.5rem
}

.page-title {
    font-weight: 700
}

.card-clean, .stats-card {
    background: #fff;
    border: none;
    border-radius: var(--r);
    box-shadow: var(--sh)
}

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(245, 130, 32, .12);
    color: var(--o);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem
}

.btn-primary, .btn-success {
    background: var(--o);
    border-color: var(--o)
}

.btn-primary:hover, .btn-success:hover {
    background: var(--od);
    border-color: var(--od)
}

.btn-outline-primary {
    color: var(--o);
    border-color: var(--o)
}

.btn-outline-primary:hover {
    background: var(--o);
    border-color: var(--o)
}

.btn-dark {
    background: var(--b);
    border-color: var(--b)
}

.form-control, .form-select {
    border-radius: 12px;
    border-color: var(--bd);
    min-height: 44px
}

.form-control:focus, .form-select:focus {
    border-color: rgba(245, 130, 32, .4);
    box-shadow: 0 0 0 .2rem rgba(245, 130, 32, .12)
}

.user-chip {
    display: flex;
    align-items: center;
    gap: .75rem
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--b);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700
}

.notification-dot {
    position: absolute;
    top: .2rem;
    right: .2rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--o)
}

.summary-box, .relation-note {
    background: #fff8f1;
    border: 1px solid #ffe0c1;
    border-radius: 16px;
    padding: 1rem
}

.relation-note {
    border-left: 4px solid var(--o)
}

.kpi-number {
    font-size: 1.5rem;
    font-weight: 700
}

.section-subtitle, .google-note {
    color: var(--m)
}

.nav-tabs .nav-link {
    color: var(--b);
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 600
}

.nav-tabs .nav-link.active {
    color: var(--o);
    border-bottom: 3px solid var(--o);
    background: transparent
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--o)!important;
    border-color: var(--o)!important;
    color: #fff!important
}

.report-card {
    height: 100%
}

.linha-total td {
    background-color: #d1f7d6 !important;
}

.linha-forte td {
    background-color: #7bc680 !important;
}

/* ── Offcanvas sidebar (mobile/tablet) ── */
.offcanvas-sidebar {
    width: 260px !important;
    background: var(--b);
    color: #fff;
}

.offcanvas-sidebar .sidebar-brand {
    padding: 1.25rem 1rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.offcanvas-sidebar .nav-link {
    color: rgba(255,255,255,.88);
    border-radius: 10px;
    padding: .8rem .9rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    font-weight: 500;
}

.offcanvas-sidebar .nav-link:hover,
.offcanvas-sidebar .nav-link.active {
    background: var(--o);
    color: #fff;
}

.offcanvas-sidebar .sidebar-section-title {
    color: rgba(255,255,255,.55);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 1rem 0 .6rem;
    padding: 0 .9rem;
}

/* Botão hambúrguer só aparece em telas < lg */
.btn-sidebar-toggle {
    display: none;
}
@media (max-width: 991.98px) {
    .btn-sidebar-toggle {
        display: inline-flex;
    }
    main.col-lg-10 {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
    }
}

/* ════════════════════════════════════════
   MELHORIAS DE RESPONSIVIDADE MOBILE
   ════════════════════════════════════════ */

/* Topbar: reduz padding lateral em telas pequenas */
@media (max-width: 575.98px) {
  .topbar .d-flex.px-4 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* User-chip: esconde o texto em telas muito pequenas, mantém só o avatar */
  .user-chip > div:last-child {
    display: none;
  }

  /* Título da página menor */
  .page-title {
    font-size: 1.1rem !important;
  }

  /* Breadcrumb menor */
  .breadcrumb {
    font-size: .75rem;
  }

  /* Content wrapper: menos padding lateral */
  .content-wrapper {
    padding: 1rem 0.75rem;
  }

  /* Cards com menos padding */
  .card-clean, .stats-card {
    padding: 1rem !important;
  }

  /* Botões de ação: empilha em coluna em formulários */
  .btn-group-mobile {
    flex-direction: column;
    width: 100%;
  }
  .btn-group-mobile .btn {
    width: 100%;
    margin-bottom: .5rem;
  }
}

/* Tablet (sm–md) */
@media (max-width: 767.98px) {
  .content-wrapper {
    padding: 1.25rem 1rem;
  }

  /* Topbar: garante que o hamburguer + título não quebrem */
  .topbar .d-flex {
    flex-wrap: nowrap;
    overflow: hidden;
  }

  /* Seções de formulário: reduz gap entre cards */
  .row.g-4 {
    --bs-gutter-x: 0.75rem;
    --bs-gutter-y: 0.75rem;
  }
}

/* Garante que main ocupe 100% quando sidebar some */
@media (max-width: 991.98px) {
  main.col-lg-10 {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
  }

  /* Remove margem do ms-sm-auto que pode causar deslocamento */
  .ms-sm-auto {
    margin-left: 0 !important;
  }

  /* Topbar fica sticky e cobre 100% */
  .topbar {
    width: 100%;
  }
}

/* Tabelas: sempre scrolláveis horizontalmente em mobile */
@media (max-width: 767.98px) {
  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }

  /* DataTables: ajuste do filtro de busca */
  .dataTables_wrapper .dataTables_filter input {
    width: 140px;
  }

  /* KPI cards: fonte menor para caber em 2 colunas */
  .kpi-value {
    font-size: 1.2rem !important;
  }
  .kpi-label {
    font-size: .7rem !important;
  }
}

/* Modais: padding lateral menor em mobile */
@media (max-width: 575.98px) {
  .modal-dialog {
    margin: .5rem;
  }
  .modal-body {
    padding: 1rem;
  }
  .modal-header, .modal-footer {
    padding: .75rem 1rem;
  }
}

/* Offcanvas: garante z-index acima de tudo */
.offcanvas-sidebar {
  z-index: 1055;
}
