* {
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #64748b;
    --border: #dbe3ef;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --shadow: 0 10px 25px rgba(15, 23, 42, .08);
}

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

a {
    color: var(--primary);
    text-decoration: none;
}

.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #0f172a;
    color: #fff;
    padding: 22px;
}

.sidebar h1 {
    font-size: 20px;
    margin: 0 0 26px;
}

.sidebar a {
    display: block;
    color: #e2e8f0;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
}

.sidebar a:hover,
.sidebar a.active {
    background: rgba(255, 255, 255, .12);
}

.main {
    flex: 1;
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric {
    padding: 20px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.metric span {
    color: var(--muted);
    font-size: 14px;
}

.metric strong {
    display: block;
    font-size: 30px;
    margin-top: 8px;
}

label {
    font-weight: 700;
    font-size: 14px;
    display: block;
    margin-bottom: 6px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 14px;
    background: #fff;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

button,
.btn {
    display: inline-block;
    border: 0;
    background: var(--primary);
    color: #fff;
    padding: 11px 16px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

button:hover,
.btn:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-secondary {
    background: #334155;
}

.btn-danger {
    background: var(--danger);
}

.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    background: #fff;
}

.alert.success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.alert.error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    text-align: left;
    vertical-align: top;
}

th {
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    background: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    background: #e0ecff;
    color: #1e40af;
    font-weight: 700;
    font-size: 12px;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 420px;
}

.small {
    color: var(--muted);
    font-size: 13px;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: end;
}

@media (max-width: 900px) {
    .wrapper {
        display: block;
    }

    .sidebar {
        width: 100%;
    }

    .grid-4,
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .main {
        padding: 18px;
    }

    .topbar {
        display: block;
    }
}
/* ===== AJUSTE RESPONSIVO / BOTÕES COMPACTOS ===== */

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 10px 8px;
    vertical-align: top;
    font-size: 13px;
}

.btn,
button,
input[type="submit"] {
    padding: 7px 10px !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    border-radius: 8px !important;
    min-width: auto !important;
    white-space: nowrap;
}

.btn-sm {
    padding: 5px 8px !important;
    font-size: 12px !important;
    border-radius: 7px !important;
}

.acoes-lead {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    max-width: 190px;
}

.acoes-lead a,
.acoes-lead button {
    margin: 0 !important;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.small {
    font-size: 12px;
}

/* Cards e formulários mais fluidos */
.card {
    overflow-x: auto;
}

/* Responsivo para telas menores */
@media (max-width: 900px) {
    .wrapper {
        display: block;
    }

    .sidebar {
        width: 100%;
        position: relative;
        min-height: auto;
    }

    .main {
        width: 100%;
        padding: 12px;
    }

    .grid,
    .grid-2,
    .grid-3,
    .grid-4,
    .grid-5 {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    table th,
    table td {
        font-size: 12px;
        padding: 8px 6px;
    }

    .acoes-lead {
        max-width: 100%;
    }
}
/* ===== MENU DROPDOWN DE ACOES ===== */

.dropdown-acoes {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    padding: 6px 10px !important;
    font-size: 16px !important;
    line-height: 1 !important;
    border-radius: 8px !important;
    min-width: 38px !important;
    text-align: center;
}

.dropdown-menu-acoes {
    display: none;
    position: absolute;
    right: 0;
    top: 36px;
    min-width: 170px;
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
    z-index: 999;
    padding: 6px;
}

.dropdown-menu-acoes a,
.dropdown-menu-acoes button {
    display: block;
    width: 100%;
    padding: 8px 10px !important;
    margin: 0 !important;
    border: 0;
    background: transparent;
    color: #1e293b;
    text-align: left;
    font-size: 13px !important;
    text-decoration: none;
    border-radius: 7px;
    cursor: pointer;
}

.dropdown-menu-acoes a:hover,
.dropdown-menu-acoes button:hover {
    background: #f1f5f9;
}

.dropdown-acoes.open .dropdown-menu-acoes {
    display: block;
}
/* =========================================================
   CRM ABATEL TELECOM - MENU PROFISSIONAL
========================================================= */

.sidebar {
    width: 290px;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #fff;
    padding: 24px 18px;
    border-right: 1px solid rgba(255,255,255,.05);
    overflow-y: auto;
}

.sidebar h1 {
    font-size: 22px;
    margin-bottom: 10px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.sidebar .small {
    color: #94a3b8;
    line-height: 1.6;
}

.menu-section {
    margin-top: 24px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,.06);
}

.menu-title {
    display: block;
    padding: 0 12px;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #64748b;
}

.sidebar .submenu-link {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 11px 14px;
    margin-bottom: 5px;

    border-radius: 12px;

    color: #dbe4f0;
    font-size: 14px;
    font-weight: 500;

    transition: all .18s ease;
}

.sidebar .submenu-link:hover {
    background: rgba(255,255,255,.08);
    transform: translateX(2px);
    color: #fff;
}

.sidebar .submenu-link.active {
    background: rgba(37,99,235,.22);
    color: #fff;
    border: 1px solid rgba(96,165,250,.35);
}

.sidebar .submenu-link.destaque {
    background: linear-gradient(90deg,#2563eb,#1d4ed8);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(37,99,235,.25);
}

.sidebar .submenu-link.destaque:hover {
    background: linear-gradient(90deg,#1d4ed8,#1e40af);
}

.topbar {
    background: #fff;
    padding: 18px 24px;
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.topbar h2 {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
}

.topbar .small {
    margin-top: 5px;
    color: #64748b;
}

.card {
    border-radius: 20px;
    transition: all .15s ease;
}

.card:hover {
    transform: translateY(-1px);
}

.metric {
    border-radius: 20px;
}

.metric strong {
    font-size: 34px;
    font-weight: 800;
}

table {
    border-radius: 16px;
    overflow: hidden;
}

th {
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    letter-spacing: .05em;
}

tbody tr:hover {
    background: #f8fafc;
}

.btn,
button {
    font-weight: 700;
    transition: all .18s ease;
}

.btn:hover,
button:hover {
    transform: translateY(-1px);
}

.alert {
    border-radius: 14px;
}

input,
select,
textarea {
    transition: all .18s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96,165,250,.15);
}

/* Scrollbar moderna */

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.12);
    border-radius: 20px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

/* Responsivo */

@media (max-width: 900px) {

    .sidebar {
        width: 100%;
        padding: 16px;
    }

    .menu-section {
        margin-top: 18px;
    }

    .sidebar .submenu-link {
        padding: 12px;
    }

    .topbar {
        padding: 16px;
    }
}

/* ===== CORREÃ‡ÃƒO DE LARGURA DA PÃGINA LEADS ===== */

.wrapper {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.main {
    min-width: 0;
    max-width: calc(100vw - 290px);
    overflow-x: hidden;
}

.card {
    max-width: 100%;
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

.table-responsive table {
    min-width: 1150px;
    width: max-content;
}

@media (max-width: 900px) {
    .main {
        max-width: 100vw;
        overflow-x: hidden;
    }

    .table-responsive table {
        min-width: 1050px;
    }
}
/* =========================================================
   LOGIN - AJUSTE DE LAYOUT
========================================================= */

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;

    min-height: 100vh;

    padding: 30px;
    background: #f1f5f9;
}

.login-container {
    width: 100%;
    max-width: 460px;

    background: #fff;

    padding: 36px;

    border-radius: 22px;

    border: 1px solid #dbe2ea;

    box-shadow:
        0 10px 30px rgba(15,23,42,.08),
        0 2px 8px rgba(15,23,42,.04);
}

.login-container h2 {
    margin-bottom: 12px;
    font-size: 34px;
    font-weight: 800;
    color: #0f172a;
}

.login-container p {
    margin-bottom: 24px;
    color: #64748b;
}

.login-container form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-container button {
    margin-top: 10px;
}

/* =========================================
   SIDEBAR COLAPSÁVEL
========================================= */

.toggle-sidebar-btn{
    position:fixed;
    top:12px;
    left:12px;
    z-index:999999;
    border:none;
    background:#0f172a;
    color:#fff;
    width:42px;
    height:42px;
    border-radius:10px;
    cursor:pointer;
    font-size:20px;
    display:none;
    box-shadow:0 6px 20px rgba(0,0,0,.18);
}

.hide-sidebar-btn{
    width:100%;
    margin-top:18px;
    border:none;
    background:#334155;
    color:#fff;
    border-radius:8px;
    padding:10px;
    cursor:pointer;
    font-size:13px;
}

.sidebar-collapsed .sidebar{
    width:0 !important;
    min-width:0 !important;
    overflow:hidden !important;
    padding:0 !important;
    border:none !important;
}

.sidebar-collapsed .main{
    margin-left:0 !important;
    width:100% !important;
    max-width:100% !important;
}

.sidebar-collapsed .toggle-sidebar-btn{
    display:block;
}

@media(max-width:1100px){
    .toggle-sidebar-btn{
        display:block;
    }

    .sidebar{
        position:fixed;
        left:0;
        top:0;
        bottom:0;
        z-index:999998;
        width:280px;
        overflow:auto;
    }

    .main{
        width:100%;
        margin-left:0 !important;
    }
}

/* =========================================================
   PADRÃƒO COMPACTO GLOBAL - CRM ABATEL
========================================================= */

.main{
    min-width:0 !important;
    max-width:100% !important;
    overflow-x:hidden !important;
    padding:18px !important;
}

.card{
    padding:14px !important;
    margin-bottom:14px !important;
    border-radius:14px !important;
    overflow:visible !important;
}

.card:hover{
    transform:none !important;
}

.table-responsive{
    width:100% !important;
    max-width:100% !important;
    overflow-x:hidden !important;
    overflow-y:visible !important;
}

.table-responsive table,
table{
    width:100% !important;
    min-width:0 !important;
    table-layout:fixed !important;
    border-collapse:collapse !important;
}

th,
td{
    padding:6px 5px !important;
    font-size:12px !important;
    line-height:1.25 !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    vertical-align:middle !important;
}

th{
    font-size:10px !important;
}

.btn,
button,
input[type="submit"]{
    padding:6px 9px !important;
    font-size:12px !important;
    border-radius:7px !important;
    line-height:1.2 !important;
    white-space:nowrap !important;
}

input,
select,
textarea{
    padding:8px 9px !important;
    font-size:13px !important;
    border-radius:8px !important;
}

label{
    font-size:12px !important;
}

.metric{
    padding:14px !important;
    border-radius:14px !important;
}

.metric strong{
    font-size:24px !important;
}

.metric span,
.small{
    font-size:12px !important;
}

.grid{
    gap:10px !important;
}

.topbar{
    padding:14px 18px !important;
    margin-bottom:14px !important;
    border-radius:14px !important;
}

.topbar h2{
    font-size:20px !important;
}

/* BotÃ£o global do menu */
.btn-menu-global{
    position:fixed !important;
    top:10px !important;
    right:14px !important;
    z-index:999999999 !important;
    border:0 !important;
    border-radius:8px !important;
    background:#2563eb !important;
    color:#fff !important;
    padding:8px 12px !important;
    font-size:13px !important;
    cursor:pointer !important;
    box-shadow:0 6px 18px rgba(0,0,0,.18) !important;
}

/* Responsivo */
@media(max-width:1100px){
    .main{
        padding:12px !important;
    }

    .grid-4,
    .grid-3,
    .grid-2{
        grid-template-columns:1fr !important;
    }

    th,
    td{
        font-size:11px !important;
        padding:5px 4px !important;
    }
}
