/* DimiSIP Painel — © 2026 dimisolucoes.com.br */

:root {
  --fundo: #f4f6fb;
  --superficie: #ffffff;
  --borda: #e7ebf3;
  --texto: #0f172a;
  --texto-2: #64748b;
  --marca: #16a34a;
  --marca-2: #22c55e;
  --primaria: #4f46e5;
  --primaria-2: #6366f1;
  --primaria-suave: #eef2ff;
  --menu: #0b1220;
  --menu-2: #111a2e;
  --raio: 16px;
  --raio-p: 10px;
  --sombra: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --sombra-alta: 0 10px 30px rgba(15, 23, 42, .10);
  --largura-menu: 256px;

  --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: var(--texto);
  --bs-body-bg: var(--fundo);
  --bs-border-color: var(--borda);
  --bs-primary: var(--primaria);
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: var(--primaria);
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: #4338ca;
  --bs-link-hover-color-rgb: 67, 56, 202;
  --bs-border-radius: var(--raio-p);
  --bs-border-radius-lg: 12px;
}

body { background: var(--fundo); color: var(--texto); font-size: .925rem; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }
::selection { background: #c7d2fe; }

/* ---------------------------------------------------------------- Estrutura */
.app { display: flex; min-height: 100vh; }
.conteudo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pagina { flex: 1; padding: 1.75rem 2rem 1rem; max-width: 1680px; width: 100%; }
@media (max-width: 991.98px) { .pagina { padding: 1.25rem 1rem .5rem; } }

/* Menu lateral */
.sidebar {
  width: var(--largura-menu); flex-shrink: 0;
  background: radial-gradient(120% 60% at 0% 0%, #1b2a4a 0%, transparent 60%), linear-gradient(180deg, var(--menu-2), var(--menu));
  color: #cbd5e1; display: flex; flex-direction: column;
}
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; }
}
@media (max-width: 991.98px) {
  .sidebar.offcanvas-lg { --bs-offcanvas-width: 280px; --bs-offcanvas-bg: var(--menu); }
}
.sidebar-topo { display: flex; align-items: center; justify-content: space-between; padding: 1.35rem 1.25rem 1rem; }
.marca { display: flex; align-items: center; gap: .7rem; color: #fff; }
.marca img { filter: drop-shadow(0 4px 12px rgba(34, 197, 94, .35)); }
.marca b { display: block; font-size: 1.12rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.marca small { display: block; color: #8796b0; font-size: .72rem; font-weight: 500; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem .85rem; scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }
.sidebar-nav .grupo { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: #5f6f8c; margin: 1.1rem .65rem .45rem; }
.sidebar-nav .grupo:first-child { margin-top: .25rem; }
.sidebar-nav .item {
  display: flex; align-items: center; gap: .75rem; padding: .62rem .8rem; margin-bottom: 2px;
  border-radius: 10px; color: #b4c0d4; font-weight: 500; transition: background .15s, color .15s;
}
.sidebar-nav .item i { font-size: 1.08rem; width: 1.2rem; text-align: center; opacity: .85; }
.sidebar-nav .item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav .item.ativo { background: linear-gradient(90deg, rgba(99, 102, 241, .95), rgba(79, 70, 229, .85)); color: #fff; box-shadow: 0 6px 18px rgba(79, 70, 229, .35); }
.sidebar-nav .item.ativo i { opacity: 1; }
.sidebar-nav .contador { margin-left: auto; background: rgba(34, 197, 94, .18); color: #4ade80; font-size: .72rem; font-weight: 700; padding: .05rem .5rem; border-radius: 99px; }
.sidebar-rodape { padding: .85rem; border-top: 1px solid rgba(255, 255, 255, .06); }
.perfil { display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem; border-radius: 12px; color: #e2e8f0; }
.perfil:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.perfil b { display: block; font-size: .85rem; font-weight: 600; }
.perfil small { display: block; font-size: .72rem; color: #8796b0; }
.avatar {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--marca-2), var(--marca)); color: #fff; font-weight: 700; font-size: .82rem;
}

/* Barra superior */
.topbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem;
  padding: .85rem 2rem; background: rgba(244, 246, 251, .82); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid rgba(231, 235, 243, .8);
}
@media (max-width: 991.98px) { .topbar { padding: .7rem 1rem; } }
.topbar-titulo { font-weight: 500; color: #94a3b8; font-size: .88rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-titulo b { color: var(--texto); font-weight: 700; }
.topbar-data { color: var(--texto-2); font-size: .82rem; }
.btn-icone { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--superficie); border: 1px solid var(--borda); font-size: 1.3rem; padding: 0 !important; line-height: 1; }
.pill-online { display: inline-flex; align-items: center; gap: .1rem; padding: .35rem .8rem; border-radius: 99px; background: var(--superficie); border: 1px solid var(--borda); color: var(--texto); font-size: .8rem; font-weight: 600; }
.pill-online:hover { border-color: #bbf7d0; background: #f0fdf4; color: var(--texto); }
.rodape { text-align: center; color: #94a3b8; font-size: .78rem; padding: .45rem 0; }
.rodape a { color: #94a3b8; }

/* Títulos das páginas */
.pagina h1.h3 { font-weight: 800; letter-spacing: -.02em; font-size: 1.6rem; }
.pagina h1.h3 + .text-muted, .pagina h1 ~ .text-muted.small { color: var(--texto-2) !important; }

/* ---------------------------------------------------------------- Componentes */
.card { border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); background: var(--superficie); }
.card > .card-header:first-child { border-radius: var(--raio) var(--raio) 0 0; }
.card-header { background: transparent; border-bottom: 1px solid var(--borda); font-weight: 700; padding: 1rem 1.25rem; font-size: .95rem; }
.card-body { padding: 1.25rem; }
.card > .table-responsive:last-child, .card > .table-responsive:last-child .table { border-radius: 0 0 var(--raio) var(--raio); }
.card .list-group-flush .list-group-item { padding: .7rem 1.25rem; border-color: var(--borda); }

/* Indicadores */
.kpi { transition: transform .15s ease, box-shadow .15s ease; overflow: hidden; position: relative; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--sombra-alta); }
.kpi .card-body { padding: 1.15rem 1.25rem; }
.kpi .valor { font-size: 1.75rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.kpi .valor .sub { display: block; font-size: .74rem; font-weight: 600; color: var(--texto-2); letter-spacing: 0; margin-top: .2rem; }
.kpi .rotulo { color: var(--texto-2); font-size: .8rem; font-weight: 600; margin-top: .2rem; }
.kpi .icone { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
@media (max-width: 576px) { .kpi .valor { font-size: 1.35rem; } .kpi .icone { width: 40px; height: 40px; font-size: 1.1rem; } }

.grafico { position: relative; height: 290px; }
.grafico.baixo { height: 240px; }

/* Tabelas */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: #f8faff; margin-bottom: 0; }
.table > :not(caption) > * > * { vertical-align: middle; padding: .8rem 1rem; border-bottom-color: #eef1f6; }
.table thead th {
  background: #f8fafc; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  color: #64748b; font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--borda);
}
.table tbody tr:last-child > * { border-bottom: 0; }
.table-sm > :not(caption) > * > * { padding: .55rem .9rem; }

/* Etiquetas suaves */
.tag {
  display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .65rem; border-radius: 99px;
  font-size: .76rem; font-weight: 600; white-space: nowrap; line-height: 1.2;
}
.tag i { font-size: .8rem; }
.tag-efetuada { background: #eef2ff; color: #4338ca; }
.tag-recebida { background: #ecfdf5; color: #047857; }
.tag-perdida { background: #fff1f2; color: #be123c; }
.tag-nao_atendida { background: #fff7ed; color: #c2410c; }
.tag-recusada { background: #f1f5f9; color: #475569; }
.tag-dnd      { background: #faf5ff; color: #7e22ce; }
.tag-interna { background: #ecfeff; color: #0e7490; }
.tag-externa { background: #fffbeb; color: #b45309; }
.badge { font-weight: 600; border-radius: 8px; padding: .38em .65em; }
.badge.text-bg-info { background: #e0f2fe !important; color: #0369a1 !important; }
.badge.text-bg-success { background: #dcfce7 !important; color: #15803d !important; }
.badge.text-bg-danger { background: #ffe4e6 !important; color: #be123c !important; }
.badge.text-bg-secondary { background: #f1f5f9 !important; color: #475569 !important; }
.badge.text-bg-dark { background: #1e293b !important; }
.badge.text-bg-light { background: #f8fafc !important; color: #475569 !important; }

/* Status */
.ponto { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: #cbd5e1; margin-right: .4rem; vertical-align: middle; }
.ponto.on { background: var(--marca-2); box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); animation: pulso 2.4s infinite; }
.ponto.ocupado { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); }
.ponto.dnd { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .18); }
@keyframes pulso { 0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); } 50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, .06); } }
@media (prefers-reduced-motion: reduce) { .ponto.on { animation: none; } }

/* Botões */
.btn { border-radius: var(--raio-p); font-weight: 600; padding: .5rem 1rem; }
.btn-sm { border-radius: 8px; padding: .3rem .6rem; }
.btn-lg { border-radius: 12px; padding: .7rem 1.2rem; }
.btn-primary {
  --bs-btn-bg: var(--primaria); --bs-btn-border-color: var(--primaria);
  --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca;
  --bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3;
  --bs-btn-disabled-bg: var(--primaria); --bs-btn-disabled-border-color: var(--primaria);
  box-shadow: 0 4px 12px rgba(79, 70, 229, .25);
}
.btn-success {
  --bs-btn-bg: var(--marca); --bs-btn-border-color: var(--marca);
  --bs-btn-hover-bg: #15803d; --bs-btn-hover-border-color: #15803d;
  --bs-btn-active-bg: #166534; --bs-btn-active-border-color: #166534;
  box-shadow: 0 4px 12px rgba(22, 163, 74, .25);
}
.btn-outline-secondary { --bs-btn-color: #475569; --bs-btn-border-color: var(--borda); --bs-btn-bg: #fff; --bs-btn-hover-bg: #f8fafc; --bs-btn-hover-color: var(--texto); --bs-btn-hover-border-color: #cbd5e1; --bs-btn-active-bg: #f1f5f9; --bs-btn-active-color: var(--texto); --bs-btn-active-border-color: #cbd5e1; }
.btn-outline-primary { --bs-btn-color: var(--primaria); --bs-btn-border-color: #c7d2fe; --bs-btn-bg: #fff; --bs-btn-hover-bg: var(--primaria-suave); --bs-btn-hover-color: #4338ca; --bs-btn-hover-border-color: #a5b4fc; --bs-btn-active-bg: #e0e7ff; --bs-btn-active-color: #3730a3; }
.btn-outline-danger { --bs-btn-border-color: #fecdd3; --bs-btn-bg: #fff; }
.btn-light { --bs-btn-bg: #f1f5f9; --bs-btn-border-color: #f1f5f9; --bs-btn-hover-bg: #e2e8f0; --bs-btn-hover-border-color: #e2e8f0; }

/* Formulários */
.form-control, .form-select { border-radius: var(--raio-p); border-color: #dfe4ee; padding: .55rem .85rem; }
.form-select { padding-right: 2.4rem; background-position: right .8rem center; }
.form-control-lg { border-radius: 12px; padding: .75rem 1rem; }
.form-control:focus, .form-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 4px rgba(99, 102, 241, .15); }
.form-label { font-weight: 600; font-size: .85rem; color: #334155; }
.form-text { color: #94a3b8; font-size: .78rem; }
.input-group-text { background: #f8fafc; border-color: #dfe4ee; }
.form-check-input:checked { background-color: var(--primaria); border-color: var(--primaria); }
.form-check-input:focus { box-shadow: 0 0 0 4px rgba(99, 102, 241, .15); border-color: #a5b4fc; }
.form-switch .form-check-input { cursor: pointer; width: 2.4em; height: 1.3em; }
.form-switch .form-check-input:checked { background-color: var(--marca-2); border-color: var(--marca-2); }
.filtros { background: var(--superficie); }
.filtros .form-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8 !important; font-weight: 700; }
form.card-body h2.h6, .card-body h2.h6 { font-weight: 700; padding-top: .75rem; border-top: 1px dashed var(--borda); }

/* Avisos, menus, paginação */
.alert { border: 0; border-radius: 12px; box-shadow: var(--sombra); }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger { background: #fff1f2; color: #9f1239; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info { background: #eff6ff; color: #1e40af; }
.aviso { display: flex; align-items: center; }
.dropdown-menu { border: 1px solid var(--borda); border-radius: 12px; padding: .4rem; box-shadow: var(--sombra-alta); }
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; font-size: .88rem; }
.pagination { --bs-pagination-border-radius: 10px; --bs-pagination-active-bg: var(--primaria); --bs-pagination-active-border-color: var(--primaria); --bs-pagination-color: #475569; gap: .25rem; }
.pagination .page-link { border-radius: 10px !important; border-color: var(--borda); min-width: 2.2rem; text-align: center; }
.vazio { color: #94a3b8; text-align: center; padding: 3rem 1rem; }
.vazio > i { color: #cbd5e1; }

/* ---------------------------------------------------------------- Login / instalação */
.tela-login {
  min-height: 100vh; display: grid; place-items: center; padding: 1.25rem;
  background:
    radial-gradient(60% 50% at 15% 10%, rgba(99, 102, 241, .45), transparent 60%),
    radial-gradient(50% 50% at 90% 90%, rgba(34, 197, 94, .30), transparent 60%),
    linear-gradient(160deg, #0b1220, #131d36);
}
.tela-login .card { width: 100%; max-width: 420px; border: 0; border-radius: 20px; box-shadow: 0 30px 60px rgba(2, 6, 23, .45); }
.login-split { display: grid; grid-template-columns: 1.1fr 1fr; max-width: 980px !important; overflow: hidden; }
.login-lado { padding: 3rem; color: #e2e8f0; background: linear-gradient(160deg, #1e1b4b, #312e81 55%, #4338ca); position: relative; }
.login-lado::after { content: ""; position: absolute; inset: auto -80px -80px auto; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(34, 197, 94, .45), transparent 70%); }
.login-lado h2 { color: #fff; font-weight: 800; letter-spacing: -.02em; font-size: 1.8rem; }
.login-lado ul { list-style: none; padding: 0; margin: 1.75rem 0 0; }
.login-lado li { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: 1rem; font-size: .92rem; color: #c7d2fe; }
.login-lado li i { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .1); color: #fff; }
.login-form { padding: 3rem 2.5rem; background: #fff; }
@media (max-width: 767.98px) {
  .login-split { grid-template-columns: 1fr; max-width: 440px !important; }
  .login-lado { display: none; }
  .login-form { padding: 2rem 1.5rem; }
}

/* ---------------------------------------------------------------- Página Aplicativo */
.app-destaque {
  border: 0; color: #fff; overflow: hidden; position: relative;
  background: radial-gradient(60% 120% at 100% 0%, rgba(34, 197, 94, .35), transparent 60%), linear-gradient(135deg, #1e1b4b, #3730a3 60%, #4f46e5);
  box-shadow: 0 18px 40px rgba(79, 70, 229, .28);
}
.app-destaque img { filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .35)); }
.app-destaque .btn-light { color: #3730a3; }
.app-destaque .btn-outline-light { --bs-btn-border-color: rgba(255, 255, 255, .45); --bs-btn-hover-bg: rgba(255, 255, 255, .12); --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #fff; }
.btn.copiado { --bs-btn-bg: #dcfce7; --bs-btn-color: #15803d; --bs-btn-border-color: #86efac; background: #dcfce7 !important; color: #15803d !important; }
.notas { white-space: normal; color: #334155; line-height: 1.7; }

/* ---------------------------------------------------------------- Disponibilidade */
.linha-tempo { position: relative; height: 14px; border-radius: 7px; background: #e2e8f0; overflow: hidden; }
.linha-tempo span { position: absolute; top: 0; bottom: 0; }
.linha-tempo-eixo { display: flex; justify-content: space-between; font-size: .66rem; color: #94a3b8; margin-top: 2px; font-variant-numeric: tabular-nums; }
.legenda { display: inline-flex; flex-wrap: wrap; gap: .9rem; color: var(--texto-2); }
.legenda i { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }

/* ---------------------------------------------------------------- Dropdowns com pesquisa (Tom Select) */
.ts-wrapper.form-select { padding: 0 !important; cursor: pointer; }
.ts-wrapper.form-select.focus { border-color: #a5b4fc; box-shadow: 0 0 0 4px rgba(99, 102, 241, .15); }
.ts-wrapper.form-select .ts-control { border: 0 !important; background: transparent !important; box-shadow: none !important; padding: .5rem 2.4rem .5rem .85rem !important; min-height: 40px; font-size: inherit; border-radius: var(--raio-p); }
.ts-wrapper.form-select.form-select-sm .ts-control { min-height: 29px; padding: .2rem 2rem .2rem .6rem; font-size: .85rem; }
.filtros .ts-wrapper { min-width: 200px; }
.ts-wrapper.single .ts-control { flex-wrap: nowrap; overflow: hidden; }
.ts-wrapper.single .ts-control > .item { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filtros .ts-wrapper { max-width: 280px; }
.filtros .ts-wrapper .ts-control { max-width: 280px; }
.ts-dropdown { border: 1px solid var(--borda); border-radius: 12px; box-shadow: var(--sombra-alta); padding: .35rem; margin-top: 6px; z-index: 1080; font-size: .9rem; }
.ts-dropdown .dropdown-input-wrap { padding: .15rem .15rem .4rem; }
.ts-dropdown .dropdown-input { border: 1px solid #dfe4ee; border-radius: 8px; padding: .45rem .7rem; width: 100%; outline: none; }
.ts-dropdown .dropdown-input:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
.ts-dropdown .option { border-radius: 8px; padding: .45rem .7rem; }
.ts-dropdown .active { background: var(--primaria-suave); color: #3730a3; }
.ts-dropdown .selected { font-weight: 600; }
.ts-dropdown-content { max-height: 320px; }
.ts-sub { display: block; font-size: .72rem; color: #94a3b8; line-height: 1.2; margin-top: 1px; }
.ts-dropdown .active .ts-sub { color: #6366f1; }
.ts-sub-item { font-size: .72rem; color: #94a3b8; margin-left: .4rem; }
.ts-dropdown .no-results { padding: .5rem .7rem; color: #94a3b8; }

/* ---------------------------------------------------------------- Pesquisa compacta nas tabelas */
.busca-tabela { position: relative; width: 200px; max-width: 100%; }
.busca-tabela i { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: .8rem; pointer-events: none; }
.busca-tabela .form-control { padding-left: 1.8rem; border-radius: 99px; }
@media (max-width: 575.98px) { .busca-tabela { width: 100%; } }
button.pill-online { cursor: pointer; }

/* ---------------------------------------------------------------- Dashboard no modo TV (botão TV) */
.tv-topo { display: none; }
body.tv { background: var(--fundo); overflow-y: auto; }
body.tv .sidebar, body.tv .topbar, body.tv .rodape, body.tv .filtros, body.tv .dash-titulo, body.tv .tv-oculto, body.tv .aviso { display: none !important; }
body.tv .pagina { max-width: none; padding: .75rem 1rem .5rem; }
body.tv .tv-topo { display: flex; align-items: center; gap: .75rem; margin-bottom: .6rem; }
.tv-titulo b { display: block; font-size: 1.2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.tv-titulo small { display: block; color: var(--texto-2); font-size: .8rem; font-weight: 600; }
.tv-relogio { font-weight: 700; color: var(--texto); font-size: 1rem; text-transform: capitalize; }
body.tv #painelDados .row { --bs-gutter-x: .6rem; --bs-gutter-y: .6rem; margin-bottom: .6rem !important; }
body.tv .kpis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .6rem; margin: 0 0 .6rem !important; }
body.tv .kpis > div { width: auto; max-width: none; padding: 0; margin: 0; }
@media (max-width: 1399.98px) { body.tv .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
body.tv .kpi .card-body { padding: .6rem .8rem; gap: .65rem !important; }
body.tv .kpi .icone { width: 38px; height: 38px; border-radius: 11px; font-size: 1.05rem; }
body.tv .kpi .valor { font-size: 1.55rem; }
body.tv .kpi .valor .sub { font-size: .68rem; margin-top: .1rem; }
body.tv .kpi .rotulo { font-size: .72rem; margin-top: .1rem; }
body.tv .card-header { padding: .45rem .9rem; font-size: .85rem; }
body.tv .card-body { padding: .45rem .75rem; }
body.tv .grafico { height: 27vh; min-height: 180px; }
body.tv .tv-tabela { max-height: 32vh; overflow-y: auto; }
body.tv .tv-tabela thead th { position: sticky; top: 0; background: var(--superficie); z-index: 1; }
body.tv .table > :not(caption) > * > * { padding: .32rem .6rem; font-size: .8rem; }

/* ---------------------------------------------------------------- Mobile (< 576 px) */
@media (max-width: 575.98px) {

  /* Topbar */
  .topbar { gap: .5rem; }

  /* Cabeçalhos de página: empilhar título + ações */
  .pagina > .d-flex.mb-3.justify-content-between,
  .dash-titulo { flex-direction: column !important; align-items: flex-start !important; }

  /* ── Ramais: barra de controles em grade 2×N ── */
  #cabRamais { flex-direction: column !important; align-items: flex-start !important; }
  #cabRamais > div:last-child {
    width: 100%;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: .35rem !important;
  }
  /* Cada formulário ocupa metade da linha */
  #cabRamais > div:last-child form {
    flex: 1 1 calc(50% - .2rem);
    min-width: 0;
    display: block !important;
  }
  #cabRamais > div:last-child .form-select { width: 100%; font-size: .8rem; }
  #cabRamais > div:last-child form .btn { width: 100%; }
  /* Campo de busca e link "Mostrar todos": linha inteira */
  #cabRamais > div:last-child .busca-tabela,
  #cabRamais > div:last-child > a.btn {
    flex: 1 1 100%; width: 100%; display: block !important; text-align: center;
  }

  /* ── Filtros de período: prevenir invasão entre colunas ── */
  .filtros .col-6 { overflow: hidden; min-width: 0; }
  .filtros .form-select,
  .filtros .form-control { font-size: .78rem; min-width: 0; }
  /* Tom Select dentro de filtros */
  .filtros .ts-wrapper .ts-control { font-size: .78rem; }
  /* Botão Filtrar: linha inteira */
  .filtros .filtrar-botao { width: 100%; }
  .filtros .filtrar-botao .btn { width: 100%; }

  /* Tabelas: compactas */
  .table > :not(caption) > * > * { padding: .4rem .55rem; font-size: .8rem; }
  .table thead th { font-size: .64rem; letter-spacing: .03em; }

  /* Card-header com flex: permite quebrar */
  .card-header.d-flex { flex-wrap: wrap; gap: .4rem; }

  /* Tags e badges */
  .tag { font-size: .7rem; padding: .22rem .5rem; gap: .25rem; }
  .badge { font-size: .67rem; }

  /* Paginação compacta */
  .pagination .page-link { min-width: 1.9rem; padding: .28rem .4rem; font-size: .8rem; }

  /* Dropdowns: não saem da tela */
  .dropdown-menu { max-width: calc(100vw - .75rem); }

  /* Gráficos: altura menor */
  .grafico { height: 220px; }
  .grafico.baixo { height: 180px; }

  /* Disponibilidade: linha-tempo compacta */
  .linha-tempo { height: 10px; }
  .linha-tempo-eixo { font-size: .58rem; }

}
