/* XP Sistema: componentes compartilhados pelos modulos (carregado depois do style.css) */

.narrow { max-width: 640px; margin: 0 auto; width: 100%; }
.small { font-size: 0.88rem; }
.nowrap { white-space: nowrap; }
.pre-line { white-space: pre-line; }
.text-error { color: var(--error); }
.align-end { align-self: end; }
h3 { font-family: "Space Grotesk", sans-serif; margin: 0 0 10px; }
[hidden] { display: none !important; }

.app-header .button-ghost.is-active {
    border-color: var(--xp-amber);
    color: var(--xp-amber);
}

.app-header a.user-badge { text-decoration: none; color: inherit; }

.button-small { min-height: 34px; padding: 0 10px; font-size: 0.9rem; border-radius: 10px; }
.button-tiny { font-size: 0.8rem; font-weight: 600; color: var(--accent-strong); margin-left: 6px; }
.button-danger { background: linear-gradient(135deg, #dc2626, #991b1b); }
.button-danger:hover { box-shadow: 0 10px 22px rgba(185, 28, 28, 0.25); }
.danger-zone { border-color: rgba(185, 28, 28, 0.25); }

.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.filter-bar { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.filter-bar label > span, .form-grid label > span { font-size: 0.92rem; }

.panel-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.panel-grid-wide { grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); }

.module-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.module-card {
    display: grid;
    gap: 6px;
    padding: 18px;
    border-radius: 20px;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--line);
    border-top: 4px solid var(--xp-orange);
    background: var(--paper-strong);
    transition: transform 140ms ease, box-shadow 140ms ease;
}
.module-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.module-card strong { font-family: "Space Grotesk", sans-serif; font-size: 1.2rem; }
.module-card span { color: var(--muted); }

/* tabelas */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table th { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.data-table a { color: inherit; }
.data-table tr.is-muted td { opacity: 0.55; }
.empty-cell { text-align: center !important; color: var(--muted); padding: 24px !important; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; white-space: nowrap; }
.pagination { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 14px; }

.simple-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.simple-list li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper-strong); }
.simple-list li.is-active { border-color: var(--xp-orange); box-shadow: 0 0 0 2px rgba(245, 134, 52, 0.15); }
.simple-list a { color: inherit; }

/* icone de auditoria */
.audit-btn {
    min-height: 34px;
    padding: 0 8px;
    gap: 6px;
    border-radius: 10px;
    background: rgba(46, 50, 87, 0.08);
    color: var(--xp-navy);
    border: 1px solid var(--line);
}
.audit-btn:hover { background: var(--xp-navy); color: #fff; box-shadow: none; }

.modal { position: fixed; inset: 0; background: rgba(15, 17, 35, 0.6); display: grid; place-items: center; z-index: 50; padding: 12px; }
.modal-box {
    width: min(1000px, 100%);
    height: min(92vh, 1100px);
    display: grid;
    grid-template-rows: auto 1fr;
    border-radius: 14px;
    overflow: hidden;
    background: #2b2d3a;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.modal-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; color: #fff; background: #1f2128; }
.modal-bar-actions { display: flex; gap: 8px; align-items: center; }
.modal-bar .button-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.2); background: transparent; }
.modal-close { min-height: 34px; width: 38px; padding: 0; font-size: 1.6rem; background: transparent; }
.modal-close:hover { box-shadow: none; color: var(--xp-amber); }
.modal iframe { width: 100%; height: 100%; border: 0; background: #e9eaef; }
body.modal-aberto { overflow: hidden; }

/* permissoes */
.perm-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.perm-group { border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px 14px; display: grid; gap: 8px; background: var(--paper-strong); margin: 0; }
.perm-group legend { font-weight: 700; padding: 0 6px; font-family: "Space Grotesk", sans-serif; }
.checkbox { font-weight: 500; }
.checkbox.is-disabled { opacity: 0.5; }
.check-grid { display: grid; gap: 6px 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); max-height: 320px; overflow: auto; padding: 4px; }

/* helpdesk */
.sub-nav { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); }
.sub-nav a { padding: 8px 14px; border-radius: 12px; text-decoration: none; color: var(--muted); font-weight: 700; }
.sub-nav a.is-active { background: var(--xp-navy); color: #fff; }
.sub-nav a:hover:not(.is-active) { color: var(--ink); background: rgba(46, 50, 87, 0.06); }

.stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat-card { display: grid; gap: 2px; padding: 16px 18px; border-radius: 20px; border: 1px solid var(--line); background: var(--paper-strong); }
.stat-card span, .stat-card small { color: var(--muted); }
.stat-card strong { font-family: "Space Grotesk", sans-serif; font-size: 2rem; color: var(--xp-navy); }
.stat-card strong.stat-small { font-size: 1.15rem; }

.queue-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.queue-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--xp-orange);
    background: var(--paper-strong);
}
.queue-item.is-done { border-left-color: var(--success); opacity: 0.75; }
.queue-main { display: grid; gap: 4px; }
.queue-phone { font-weight: 700; font-size: 1.05rem; }

.ixc-search { margin-bottom: 14px; }
.ixc-results { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; max-height: 300px; overflow: auto; }
.ixc-results li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper-strong); cursor: pointer; }
.ixc-results li:hover { border-color: var(--xp-orange); }
.ixc-results li.muted { cursor: default; border-style: dashed; }

.choice-row { display: flex; gap: 8px; flex-wrap: wrap; }
.choice { display: inline-flex; align-items: center; gap: 0; font-weight: 600; cursor: pointer; position: relative; }
.choice input, .rating-item input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper-strong); }
.choice input:checked + span { background: var(--xp-navy); color: #fff; border-color: var(--xp-navy); }
.choice input:focus-visible + span, .rating-item input:focus-visible + span { box-shadow: 0 0 0 3px rgba(245, 134, 52, 0.35); }

.question-list { margin: 0; padding-left: 22px; display: grid; gap: 14px; }
.question { padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--paper-strong); }
.question-text { margin: 0 0 10px; font-weight: 700; }
.rating { display: grid; grid-template-columns: repeat(11, minmax(34px, 1fr)); gap: 6px; }
.rating-item { display: block; cursor: pointer; position: relative; }
.rating-item span { display: grid; place-items: center; height: 42px; border-radius: 10px; border: 1px solid var(--line); font-weight: 700; background: #fff; }
.rating-baixa input:checked + span { background: #dc2626; color: #fff; border-color: #dc2626; }
.rating-media input:checked + span { background: var(--xp-amber); color: #fff; border-color: var(--xp-amber); }
.rating-alta input:checked + span { background: var(--success); color: #fff; border-color: var(--success); }
.score-preview { padding: 8px 14px; border-radius: 12px; background: rgba(46, 50, 87, 0.08); font-weight: 700; }
.score-preview strong { font-size: 1.3rem; color: var(--xp-navy); }

/* perguntas e questionarios */
.field-label { display: block; font-weight: 600; margin-bottom: 6px; }
.opcoes-box { display: grid; gap: 10px; padding: 12px 14px; border-radius: 16px; border: 1px dashed var(--line); }
.opcoes-lista { display: grid; gap: 8px; }
.opcao-row { display: grid; grid-template-columns: 1fr 110px auto; gap: 8px; align-items: center; }
.questionario-bloco { border: 0; padding: 0; margin: 14px 0 0; min-width: 0; }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 460px; overflow: auto; }
.pick-item { display: grid; grid-template-columns: 1fr 90px; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper-strong); }
.pick-item:has(input[type=checkbox]:checked) { border-color: var(--xp-orange); }
.pick-item.is-muted { opacity: 0.6; }
.pick-item small { display: block; }
.ordem-input { padding: 8px 10px; }

.image-row { display: flex; gap: 14px; align-items: center; }
.thumb-small { width: 96px; height: 72px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.candidate-box summary { cursor: pointer; }

@media (max-width: 900px) {
    .form-grid, .form-grid-3, .form-grid-4, .panel-grid-wide { grid-template-columns: 1fr; }
    .queue-item { flex-direction: column; align-items: stretch; }
    .rating { grid-template-columns: repeat(6, 1fr); }
    .data-table th, .data-table td { padding: 8px 6px; }
}

@media print {
    .app-header, .flash-stack, .no-print, .sub-nav, .audit-btn { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}

/* busca de CTO */
.found-banner { display: block; margin-bottom: 12px; text-decoration: none; }
.found-in { font-size: 0.82rem; color: #b4500f; background: rgba(245, 134, 52, 0.12); border-radius: 8px; padding: 3px 8px; width: fit-content; }
.codigo-aviso { grid-column: 1 / -1; color: var(--error); font-weight: 700; font-size: 0.92rem; }

/* ------------------------------------------------------------------ layout com menu lateral */
:root { --sidebar-w: 248px; --sidebar-w-mini: 72px; }

.app-layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns 180ms ease; }
.menu-recolhido .app-layout { grid-template-columns: var(--sidebar-w-mini) minmax(0, 1fr); }

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 0% 0%, rgba(245, 134, 52, 0.22), transparent 40%),
        linear-gradient(180deg, var(--xp-navy) 0%, var(--xp-navy-deep) 100%);
    border-right: 4px solid transparent;
    border-image: linear-gradient(180deg, var(--xp-orange), var(--xp-amber), var(--xp-yellow)) 1;
    z-index: 40;
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; text-decoration: none; color: #fff; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.sidebar-brand img { height: 40px; width: auto; flex: none; }
.sidebar-brand .rotulo { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.15rem; white-space: nowrap; }

.side-nav { display: grid; gap: 4px; align-content: start; flex: 1; }
.side-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    list-style: none;
}
.side-link::-webkit-details-marker { display: none; }
.side-link .icone { flex: none; }
.side-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; transform: none; box-shadow: none; }
.side-link.is-active { background: linear-gradient(135deg, var(--xp-orange), var(--accent-strong)); color: #fff; box-shadow: 0 8px 18px rgba(245, 134, 52, 0.25); }
.side-link.is-parent-active { color: var(--xp-amber); }
.side-group { display: grid; gap: 4px; }
.side-caret { margin-left: auto; display: inline-flex; transition: transform 150ms ease; }
.side-group[open] .side-caret { transform: rotate(90deg); }
.side-sublink { padding-left: 28px; min-height: 40px; font-size: 0.95rem; }

.sidebar-foot { display: grid; gap: 4px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.sidebar-foot form { margin: 0; }
.side-user { display: grid; line-height: 1.15; overflow: hidden; }
.side-user strong { overflow: hidden; text-overflow: ellipsis; }
.side-user small { color: rgba(255, 255, 255, 0.6); font-weight: 500; }
.side-sair { color: #ffb4a8; }

/* recolhido: so icones */
.menu-recolhido .sidebar { padding: 14px 10px; }
.menu-recolhido .sidebar .rotulo { display: none; }
.menu-recolhido .side-link { justify-content: center; padding: 0; }
.menu-recolhido .side-sublink { padding: 0; }
.menu-recolhido .sidebar-brand { justify-content: center; padding: 4px 0 12px; }
.menu-recolhido .sidebar-brand img { height: 30px; }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: rgba(246, 246, 249, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar-toggle { min-height: 40px; width: 42px; padding: 0; border-radius: 12px; background: var(--paper-strong); color: var(--xp-navy); border: 1px solid var(--line); }
.topbar-toggle:hover { box-shadow: none; transform: none; border-color: var(--xp-orange); color: var(--xp-orange); }
.topbar-title { font-family: "Space Grotesk", sans-serif; font-size: 1.2rem; }
.topbar-user { margin-left: auto; color: var(--muted); font-weight: 600; }
.app-content { width: min(1240px, 100%); margin: 0 auto; padding: 18px 20px 40px; }

.sidebar-fundo { display: none; }

@media (max-width: 900px) {
    .app-layout, .menu-recolhido .app-layout { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: fixed; left: 0; top: 0; width: min(280px, 85vw); transform: translateX(-105%); transition: transform 200ms ease; }
    .menu-aberto .sidebar { transform: none; box-shadow: 20px 0 40px rgba(0, 0, 0, 0.3); }
    /* no celular o menu sempre abre completo */
    .menu-recolhido .sidebar .rotulo { display: revert; }
    .menu-recolhido .side-link { justify-content: flex-start; padding: 0 12px; }
    .menu-recolhido .side-sublink { padding-left: 28px; }
    .menu-recolhido .sidebar-brand { justify-content: flex-start; }
    .menu-aberto .sidebar-fundo { display: block; position: fixed; inset: 0; background: rgba(15, 17, 35, 0.5); z-index: 35; }
    .app-content { padding: 12px 10px 32px; }
    .topbar { padding: 8px 10px; }
}

@media print {
    .sidebar, .topbar, .sidebar-fundo { display: none !important; }
    .app-layout { display: block; }
}

/* ------------------------------------------------------------------ dashboard */
.dash-hello { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-hello h2 { margin: 0; }
.dash-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
.dash-card { display: grid; gap: 14px; }
.dash-card-head { display: flex; align-items: center; gap: 10px; }
.dash-card-head .dash-icone { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(245, 134, 52, 0.14); color: var(--accent-strong); }
.dash-card-head h3 { margin: 0; }
.dash-card-head a { margin-left: auto; font-weight: 700; color: var(--accent-strong); text-decoration: none; font-size: 0.92rem; }
.dash-nums { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.dash-num { display: grid; gap: 2px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--paper-strong); text-decoration: none; color: inherit; }
.dash-num strong { font-family: "Space Grotesk", sans-serif; font-size: 1.7rem; color: var(--xp-navy); line-height: 1.1; }
.dash-num span { color: var(--muted); font-size: 0.9rem; }
.dash-num small { color: var(--muted); font-size: 0.8rem; }
.dash-num.is-alerta { border-color: rgba(185, 28, 28, 0.3); background: rgba(185, 28, 28, 0.05); }
.dash-num.is-alerta strong { color: var(--error); }
a.dash-num:hover { border-color: var(--xp-orange); }
.dash-lista h4 { margin: 0 0 6px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.dash-lista ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.dash-lista li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(46, 50, 87, 0.04); }
.dash-lista li a { color: inherit; text-decoration: none; font-weight: 600; }
.dash-lista li a:hover { color: var(--accent-strong); }
.dash-lista li span { color: var(--muted); white-space: nowrap; font-size: 0.9rem; }
.dash-barra { height: 6px; border-radius: 99px; background: rgba(46, 50, 87, 0.08); overflow: hidden; margin-top: 4px; }
.dash-barra i { display: block; height: 100%; background: linear-gradient(90deg, var(--xp-orange), var(--xp-amber)); }

/* Discador do Helpdesk (callcenter / WebRTC) */
.discar-lista { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.discar-lista:empty { display: none; }
.link-discar { all: unset; cursor: pointer; color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; font: inherit; }
.link-discar:hover { color: var(--xp-navy); }
.discador-pagina { min-height: 100vh; display: grid; place-items: start center; padding: 14px; }
.softphone { width: 100%; max-width: 360px; display: grid; gap: 14px; padding: 18px; border-radius: 24px; background: var(--paper-strong); border: 1px solid var(--line); box-shadow: var(--shadow); }
.softphone-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.softphone-topo h2 { margin: 0; }
.softphone-estado { font-size: 0.82rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; text-align: right; max-width: 60%; }
.softphone-estado[data-tipo="ok"] { background: rgba(21, 128, 61, 0.12); color: var(--success); }
.softphone-estado[data-tipo="pendente"] { background: rgba(249, 167, 41, 0.18); color: #92580a; }
.softphone-estado[data-tipo="erro"] { background: rgba(185, 28, 28, 0.1); color: var(--error); }
.softphone-visor { display: grid; gap: 4px; text-align: center; padding: 14px; border-radius: 18px; background: var(--xp-navy); color: #fff; }
.softphone-cliente { font-weight: 700; min-height: 1.2em; color: var(--xp-amber); }
.softphone-visor input { text-align: center; font-family: "Space Grotesk", sans-serif; font-size: 1.6rem; background: transparent; color: #fff; border: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.25); border-radius: 0; padding: 6px 0; }
.softphone-visor input::placeholder { color: rgba(255, 255, 255, 0.45); font-size: 1.1rem; }
.softphone-visor input:focus { outline: none; border-bottom-color: var(--xp-orange); box-shadow: none; }
.softphone-chamada { font-size: 0.92rem; min-height: 1.2em; color: rgba(255, 255, 255, 0.85); }
.softphone-tempo { font-family: "Space Grotesk", sans-serif; font-size: 1.3rem; font-weight: 700; }
.softphone-teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.softphone-tecla { min-height: 52px; font-size: 1.3rem; font-family: "Space Grotesk", sans-serif; background: rgba(46, 50, 87, 0.06); color: var(--xp-navy); box-shadow: none; }
.softphone-tecla:hover { background: rgba(245, 134, 52, 0.16); box-shadow: none; }
.softphone-acoes { display: flex; gap: 8px; }
.softphone-acoes > button { flex: 1; min-height: 50px; font-size: 1.05rem; }
.softphone-acoes > button[hidden] { display: none; }
.softphone-ligar, .softphone-atender { background: linear-gradient(135deg, #16a34a, #15803d); }
.softphone-rodape { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.softphone-dica { margin: 0; text-align: center; }

/* Integracoes (Configuracoes > Integracoes) */
.integracao-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.integracao-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.integracao-teste { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); margin-top: 12px; }
.integracao-teste.is-ok { background: rgba(21, 128, 61, 0.07); border-color: rgba(21, 128, 61, 0.25); }
.integracao-teste.is-ok strong { color: var(--success); }
.integracao-teste.is-erro { background: rgba(185, 28, 28, 0.06); border-color: rgba(185, 28, 28, 0.25); }
.integracao-teste.is-erro strong { color: var(--error); }
.integracao-campos { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; min-width: 0; }
.integracao-campos label small { font-weight: 400; }
.integracao-passos li { margin-bottom: 6px; }

/* Telefone no topo (discar.js) */
.telefone-chip { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; margin-left: auto; margin-right: 12px; padding: 6px 12px; border-radius: 99px; font-size: 0.85rem; font-weight: 700; border: 1px solid var(--line); background: var(--paper-strong); color: var(--muted); white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.telefone-chip .telefone-rotulo { overflow: hidden; text-overflow: ellipsis; }
.telefone-chip:hover { border-color: var(--xp-orange); }
.telefone-chip[data-tipo="online"] { color: var(--success); border-color: rgba(21, 128, 61, 0.35); background: rgba(21, 128, 61, 0.08); }
.telefone-chip[data-tipo="ocupado"] { color: #92580a; border-color: rgba(249, 167, 41, 0.5); background: rgba(249, 167, 41, 0.14); }
.telefone-chip[data-tipo="erro"] { color: var(--error); border-color: rgba(185, 28, 28, 0.3); background: rgba(185, 28, 28, 0.06); }
.telefone-chip[data-tipo="tocando"] { color: #fff; background: #16a34a; border-color: #16a34a; animation: telefone-pulso 1s ease-in-out infinite; }
@keyframes telefone-pulso { 50% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.25); } }
.softphone-extras { display: flex; gap: 6px; justify-content: center; }
.softphone-extras[hidden] { display: none; }
.softphone-alertas { justify-self: center; }
.softphone-alertas[hidden] { display: none; }

.telefone-chip + .topbar-user { margin-left: 0; }

/* Telefone no canto direito (templates/_telefone.html). Comeca abaixo do topo para o botao
   "Telefone" continuar visivel (clicar de novo esconde). */
:root { --topo-altura: 61px; --telefone-largura: 360px; }
.telefone-painel {
    position: fixed; right: 0; top: var(--topo-altura); bottom: 0; z-index: 40;
    width: min(var(--telefone-largura), 100vw); overflow-y: auto;
    display: grid; align-content: start; gap: 14px; padding: 16px 18px 24px;
    background: var(--paper-strong); border-left: 1px solid var(--line);
    box-shadow: -18px 0 40px rgba(31, 34, 64, 0.12);
    transform: translateX(105%); visibility: hidden;
    transition: transform 200ms ease, visibility 0s linear 200ms;
}
.telefone-painel.aberto { transform: none; visibility: visible; transition: transform 200ms ease; }
.telefone-topo-acoes { display: flex; align-items: center; gap: 8px; }
.telefone-fechar { all: unset; cursor: pointer; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; font-size: 1.4rem; color: var(--muted); }
.telefone-fechar:hover { background: rgba(46, 50, 87, 0.08); color: var(--ink); }
.telefone-painel .softphone-estado { max-width: 190px; }
.telefone-chip[aria-expanded="true"] { box-shadow: 0 0 0 2px rgba(245, 134, 52, 0.45); }
/* tela larga: o conteudo encolhe para o telefone nao cobrir nada */
@media (min-width: 1200px) {
    .telefone-aberto .app-content { padding-right: calc(var(--telefone-largura) + 20px); }
}
@media (max-width: 900px) {
    :root { --topo-altura: 57px; }
}

/* Permissoes do grupo: lista por modulo que abre/fecha (usuarios/_permissoes.html) */
.perm-lista { display: grid; gap: 8px; }
.perm-topo { display: flex; gap: 12px; justify-content: flex-end; }
.perm-modulo { border: 1px solid var(--line); border-radius: 14px; background: var(--paper-strong); overflow: hidden; }
.perm-modulo > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 14px; user-select: none; }
.perm-modulo > summary::-webkit-details-marker { display: none; }
.perm-modulo > summary:hover { background: rgba(46, 50, 87, 0.04); }
.perm-modulo > summary strong { font-family: "Space Grotesk", sans-serif; }
.perm-seta { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform 150ms ease; flex: none; }
.perm-modulo[open] .perm-seta { transform: rotate(45deg); }
.perm-contagem { margin-left: auto; font-size: 0.85rem; color: var(--muted); font-weight: 600; padding: 2px 10px; border-radius: 99px; background: rgba(46, 50, 87, 0.06); }
.perm-contagem.tem { color: var(--success); background: rgba(21, 128, 61, 0.1); }
.perm-itens { list-style: none; margin: 0; padding: 0 0 6px; border-top: 1px solid var(--line); }
.perm-itens li + li { border-top: 1px solid var(--line); }
.perm-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 32px; cursor: pointer; font-weight: 500; }
.perm-item:hover { background: rgba(245, 134, 52, 0.06); }
.perm-item input { width: auto; margin: 0; flex: none; }
.perm-item span { flex: 1; }
.perm-item code { font-size: 0.78rem; color: var(--muted); background: rgba(46, 50, 87, 0.06); padding: 2px 6px; border-radius: 6px; }
.perm-item.is-disabled { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 700px) { .perm-item code { display: none; } .perm-item { padding-left: 16px; } }
