/* Componentes compartilhados entre as telas: botões, tons de cor, cards, selos, alternador,
   tabela, avatar, etiqueta, interruptor e cartão de aviso. Números e filtros por situação
   ficam em indicators.css. O que é de uma tela só fica no CSS da feature. */

/* Botões: ação principal em roxo sólido */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .15s, box-shadow .15s, background .15s;
}
.btn-primary { background: var(--c-purple); color: #fff !important; box-shadow: 0 8px 18px rgba(77, 36, 202, .22); }
.btn-primary:hover { transform: translateY(-1px); background: var(--c-purple-dark); }
.btn-secondary { background: #fff; border-color: #cfc4f5; color: var(--c-purple) !important; }
.btn-secondary:hover { background: #f6f3ff; border-color: var(--c-purple-ring); }
.btn-quiet { background: #fff; border-color: var(--c-line); color: var(--c-soft) !important; }
.btn-quiet:hover { background: #f6f3ff; border-color: var(--c-purple-ring); color: var(--c-purple) !important; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 12px; }
/* Ação destrutiva: contorno vermelho na linha; sólido no botão final de um modal */
.btn-danger { background: #fff; border-color: #f3c4c4; color: #b91c1c !important; }
.btn-danger:hover { background: #fef1f1; border-color: #ef9a9a; }
.btn-danger-solid { background: #b91c1c; color: #fff !important; }
.btn-danger-solid:hover { background: #991b1b; }
/* Botão só com ícone (precisa de aria-label) */
.btn-icon { width: 40px; min-height: 40px; padding: 0; border-radius: 12px; }
.btn-icon .ms { font-size: 20px; }
.btn .ms { font-size: 18px; }

/* Tons para detalhes coloridos (ícone, avatar, chip, faixa). A classe só define as cores e o
   componente usa: --bg fundo pastel, --fg texto/ícone, --bd borda, --c cor sólida (faixa,
   barra). Verde só para sucesso (ex.: "Ativos"); roxo marca seleção, não tom de item. */
.tone-blue { --bg: #dbeafe; --fg: #1e3a8a; --bd: #93c5fd; --c: #2f5fd6; }
.tone-cyan { --bg: #dcf5fc; --fg: #0e5a73; --bd: #86d7ee; --c: #0a7fb0; }
.tone-pink { --bg: #fde7f1; --fg: #9d174d; --bd: #f4a6c9; --c: #c2367d; }
.tone-yellow { --bg: #fff4cc; --fg: #854d0e; --bd: #f5d565; --c: #ca8a04; }
.tone-orange { --bg: #ffedd5; --fg: #9a3412; --bd: #fdba74; --c: #c2410c; }
.tone-violet { --bg: #ede7ff; --fg: #4d24ca; --bd: #c4b5fd; --c: #6b3fd4; }
.tone-fuchsia { --bg: #fae8ff; --fg: #86198f; --bd: #f0abfc; --c: #a21caf; }
.tone-red { --bg: #fee2e2; --fg: #991b1b; --bd: #fca5a5; --c: #b91c1c; }
.tone-green { --bg: #dcf7e6; --fg: #14532d; --bd: #9fdfb8; --c: #15803d; }
.tone-gray { --bg: #eef2f6; --fg: #334155; --bd: #cbd5e1; --c: #64748b; }

/* Card de conteúdo */
.card {
    background: #fff;
    border: 1px solid var(--c-line);
    border-radius: 24px;
    box-shadow: 0 14px 36px rgba(72, 107, 135, .10);
}
.card-pad { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.card-h { display: flex; align-items: center; gap: 12px; }
.card-title { margin: 0; font-size: 20px; font-weight: 700; color: var(--c-strong); }
.card-sub { margin: 4px 0 0; font-size: 14px; color: var(--c-muted); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }

/* Ícone colorido do título de um card */
.hchip {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    border: 1px solid;
}
.hchip--blue { background: #dbeafe; color: #1e3a8a; border-color: #93c5fd; }
.hchip--yellow { background: #fff4cc; color: #854d0e; border-color: #f5d565; }
.hchip--pink { background: #fde7f1; color: #9d174d; border-color: #f4a6c9; }
.hchip--red { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.hchip--fuchsia { background: #fae8ff; color: #86198f; border-color: #f0abfc; }
.hchip--cyan { background: #dcf5fc; color: #0e5a73; border-color: #86d7ee; }

/* Selos de status */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border-radius: 99px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.badge .ms { font-size: 16px; }
.b-ok { background: #dcf7e6; color: #14532d; border-color: #9fdfb8; }
.b-warn { background: #ffedd5; color: #9a3412; border-color: #fdba74; }
.b-err { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.b-info { background: #dbeafe; color: #1e3a8a; border-color: #93c5fd; }
.b-neutral { background: #eef2f6; color: #334155; border-color: #cbd5e1; }

/* Número com − e + dos lados (Gerenciador, limite de usuários) */
.stepper-row { display: flex; gap: 8px; align-items: center; justify-content: center; }
.stepper-row .input { max-width: 110px; text-align: center; font-size: 18px; font-weight: 700; -moz-appearance: textfield; appearance: textfield; }
/* Sem as setinhas do navegador: os botões − e + já fazem isso */
.stepper-row .input::-webkit-inner-spin-button, .stepper-row .input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-row .btn-icon { width: 46px; min-height: 46px; }

/* Alternador (ex.: Gráfico | Tabela) */
.seg { display: inline-flex; padding: 4px; border-radius: 14px; background: #e2f0ee; gap: 4px; }
.seg button {
    min-height: 36px;
    padding: 0 14px;
    border: none;
    border-radius: 10px;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-muted);
    cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--c-purple); color: #fff; box-shadow: 0 4px 10px rgba(77, 36, 202, .25); }
.seg button:disabled { opacity: .5; cursor: not-allowed; } /* opção indisponível (ex.: Pronto atendimento sem Tasy) */

/* Tabela */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.tbl th {
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: var(--c-soft);
    background: #f1f4f9;
    padding: 10px 12px;
    border-bottom: 1px solid #dbe3ec;
    position: sticky;
    top: 0;
}
/* Nome das colunas centralizado em todas as tabelas (o th de linha, scope="row", segue à esquerda) */
.tbl thead th { text-align: center; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #e8eff3; }
.tbl tbody tr:nth-child(even) td { background: #fafbfd; }
.tbl tbody tr:hover td { background: var(--c-purple-bg); }
.tbl-box { max-height: 280px; overflow: auto; border: 1px solid var(--c-line-2); border-radius: 14px; }

/* Card de tabela: sem padding (a tabela vai até a borda) e uma faixa em cima com busca,
   contador e botões. <section class="card table-card"><div class="table-card-head">… */
.table-card { padding: 0; overflow: hidden; }
.table-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid #e8eff3; }

/* Avatar com iniciais */
.av {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid;
}
.av-1 { background: #dbeafe; color: #1e3a8a; border-color: #93c5fd; }
.av-2 { background: #fde7f1; color: #9d174d; border-color: #f4a6c9; }
.av-3 { background: #fff4cc; color: #854d0e; border-color: #f5d565; }
.av-4 { background: #dcf5fc; color: #0e5a73; border-color: #86d7ee; }
.av-5 { background: #ffedd5; color: #9a3412; border-color: #fdba74; }

/* Etiqueta colorida (ex.: especialidade). Mesma cor para o mesmo texto: o JS escolhe
   tag-1..6 a partir do texto. */
.tag {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    height: 28px;
    padding: 0 10px;
    border-radius: 99px;
    border: 1px solid;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tag-1 { background: #dcf5fc; color: #0e5a73; border-color: #86d7ee; }
.tag-2 { background: #ffedd5; color: #9a3412; border-color: #fdba74; }
.tag-3 { background: #dbeafe; color: #1e3a8a; border-color: #93c5fd; }
.tag-4 { background: #fff4cc; color: #854d0e; border-color: #f5d565; }
.tag-5 { background: #fae8ff; color: #86198f; border-color: #f0abfc; }
.tag-6 { background: #fde7f1; color: #9d174d; border-color: #f4a6c9; }

/* Interruptor (ex.: Ativo). <button class="switch" role="switch" aria-checked="true">.
   Ligado = verde de sucesso. */
.switch {
    position: relative;
    width: 46px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 99px;
    background: #cbd5e1;
    cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
}
.switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .3);
    transition: transform .15s;
}
.switch[aria-checked="true"] { background: #15803d; }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch:disabled { opacity: .55; cursor: wait; }

/* Lista de opções com interruptor: interruptor | (ícone) | título e explicação.
   <div class="switch-list"><div class="switch-row"><button class="switch" role="switch"
   aria-labelledby="x-t" aria-describedby="x-d"></button><span class="switch-row-ic tone-blue">
   (opcional)</span><div class="switch-row-text"><span class="switch-row-title" id="x-t">…
   <span class="switch-row-desc" id="x-d">… */
.switch-list { display: flex; flex-direction: column; gap: 4px; }
.switch-row { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; }
.switch-row .switch { margin-top: 1px; }
.switch-row:has(.switch-row-ic) .switch { margin-top: 6px; } /* centro do ícone de 36px */
.switch-row-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--bg); color: var(--fg); border: 1px solid var(--bd); }
.switch-row-ic .ms { font-size: 20px; }
.switch-row-text { display: flex; flex-direction: column; min-width: 0; }
.switch-row-title { font-size: 15px; font-weight: 600; color: var(--c-strong); }
.switch-row-desc { font-size: 14px; color: var(--c-muted); }

/* Estado vazio / erro dentro de um card */
.empty { margin: 0; padding: 16px 0; font-size: 14px; color: var(--c-muted); }

/* Toque (celular ou tela de toque): alvos com pelo menos 40px de altura. O visual
   no computador com mouse não muda; o interruptor só ganha área de toque em volta. */
@media (pointer: coarse), (max-width: 720px) {
    .btn-sm, .seg button { min-height: 40px; }
    .switch::before { content: ""; position: absolute; inset: -7px -2px; }
}

/* Cartão de aviso de página inteira (erro 404/403, sem acesso): ícone, título, texto e botões
   centralizados. <section class="card state-card"> com .state-card-ic, -code, -title, -text, -actions */
.state-card { max-width: 640px; margin: 24px auto; padding: 40px 28px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.state-card-ic { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; background: var(--c-teal-bg); color: var(--c-teal); }
.state-card-ic .ms { font-size: 36px; }
.state-card-ic--warn { background: #ffedd5; color: #9a3412; }
.state-card-code { margin: 6px 0 0; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #47657d; }
.state-card-title { margin: 0; justify-content: center; }
.state-card-text { margin: 0; max-width: 460px; font-size: 16px; line-height: 1.5; color: var(--c-soft); }
.state-card-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
