/* =====================================================================
   Estilo iOS: cores do sistema, listas agrupadas, barra translúcida,
   barra de abas inferior e controle segmentado. Carregado depois do app.css.
   ===================================================================== */
:root {
    --ios-blue: #3d6b5e; --ios-green: #34c759; --ios-red: #ff3b30; --ios-orange: #ff9500;
    --ios-bg: #f2f2f7; --ios-surface: #ffffff; --ios-fill: rgba(120, 120, 128, .12);
    --ios-separator: rgba(60, 60, 67, .22); --ios-label2: rgba(60, 60, 67, .6);
    --ios-bar: rgba(249, 249, 249, .86);
    --acento-rgb: 61, 107, 94; --acento-texto: #fff;
    --bs-body-bg: var(--ios-bg); --bs-body-color: #1c1c1e; --bs-secondary-color: var(--ios-label2);
    --bs-primary: var(--ios-blue); --bs-primary-rgb: var(--acento-rgb);
    --bs-link-color: var(--ios-blue); --bs-link-color-rgb: var(--acento-rgb); --bs-link-hover-color: color-mix(in srgb, var(--ios-blue) 80%, #000);
    --bs-success: var(--ios-green); --bs-success-rgb: 52, 199, 89;
    --bs-danger: var(--ios-red); --bs-danger-rgb: 255, 59, 48;
    --bs-border-color: var(--ios-separator); --bs-border-radius: .625rem;
    --bs-primary-bg-subtle: color-mix(in srgb, var(--ios-blue) 16%, var(--ios-surface)); --bs-tertiary-bg: #f7f7fa; --bs-secondary-bg: var(--ios-fill);
}
:root[data-bs-theme="dark"] {
    --ios-green: #30d158; --ios-red: #ff453a; --ios-orange: #ff9f0a;
    --ios-bg: #000000; --ios-surface: #1c1c1e; --ios-fill: rgba(120, 120, 128, .24);
    --ios-separator: rgba(84, 84, 88, .6); --ios-label2: rgba(235, 235, 245, .6);
    --ios-bar: rgba(28, 28, 30, .86);
    --bs-body-bg: var(--ios-bg); --bs-body-color: #fff; --bs-secondary-color: var(--ios-label2);
    --bs-link-hover-color: color-mix(in srgb, var(--ios-blue) 80%, #fff);
    --bs-success-rgb: 48, 209, 88; --bs-danger-rgb: 255, 69, 58;
    --bs-tertiary-bg: #151517;
}

/* Cor de destaque (Personalização), igual às do admin do Psicodrica: troca só o acento. */
:root[data-acento="azul"]    { --ios-blue: #0066d6; --acento-rgb: 0, 102, 214; }
:root[data-acento="verde"]   { --ios-blue: #1f7a3a; --acento-rgb: 31, 122, 58; }
:root[data-acento="roxo"]    { --ios-blue: #8944ab; --acento-rgb: 137, 68, 171; }
:root[data-acento="laranja"] { --ios-blue: #b45309; --acento-rgb: 180, 83, 9; }
:root[data-acento="rosa"]    { --ios-blue: #c2185b; --acento-rgb: 194, 24, 91; }
:root[data-acento="grafite"] { --ios-blue: #48484a; --acento-rgb: 72, 72, 74; }

:root[data-bs-theme="dark"]                         { --ios-blue: #6fb7a3; --acento-rgb: 111, 183, 163; --acento-texto: #000; }
:root[data-bs-theme="dark"][data-acento="azul"]     { --ios-blue: #0a84ff; --acento-rgb: 10, 132, 255;  --acento-texto: #fff; }
:root[data-bs-theme="dark"][data-acento="verde"]    { --ios-blue: #30d158; --acento-rgb: 48, 209, 88;   --acento-texto: #000; }
:root[data-bs-theme="dark"][data-acento="roxo"]     { --ios-blue: #bf5af2; --acento-rgb: 191, 90, 242;  --acento-texto: #fff; }
:root[data-bs-theme="dark"][data-acento="laranja"]  { --ios-blue: #ff9f0a; --acento-rgb: 255, 159, 10;  --acento-texto: #000; }
:root[data-bs-theme="dark"][data-acento="rosa"]     { --ios-blue: #ff375f; --acento-rgb: 255, 55, 95;   --acento-texto: #fff; }
:root[data-bs-theme="dark"][data-acento="grafite"]  { --ios-blue: #aeaeb2; --acento-rgb: 174, 174, 178; --acento-texto: #000; }

html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: 1.0625rem; letter-spacing: -.01em; -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
@media (min-width: 992px) { body { font-size: 1rem; } }
a { text-decoration: none; }
a:hover { text-decoration: none; opacity: .75; }

/* Título grande */
h1 { font-size: 2.125rem; font-weight: 700; letter-spacing: -.03em; margin-bottom: .25rem; }
h1 > i { display: none; }
h1 + p { color: var(--bs-secondary-color); font-size: .95rem; }
h5, .card-title { font-size: 1.0625rem; font-weight: 600; }
main.container { max-width: 760px; padding-top: 1.25rem; padding-bottom: 1rem; }
@media (min-width: 992px) { main.container { max-width: 960px; padding-top: 2rem; } }

@keyframes ios-fade { from { opacity: 0; } }

/* Página Sobre */
.passo-letra { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem;
    border-radius: .7rem; background: color-mix(in srgb, var(--ios-blue) 14%, transparent); color: var(--ios-blue); font-weight: 800; font-size: 1.25rem; }

/* Lista agrupada (inset grouped) */
.lista-agrupada { background: var(--ios-surface); border-radius: .75rem; margin-bottom: 1rem; overflow: hidden; }
.lista-agrupada .item { display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 48px; padding: .6rem 1rem;
    background: none; border: 0; border-bottom: .5px solid var(--ios-separator); color: var(--bs-body-color) !important;
    font-size: 1.0625rem; text-align: left; }
.lista-agrupada .item:last-child { border-bottom: 0; }
.lista-agrupada .item > i:first-child { color: var(--ios-blue); font-size: 1.3rem; }
.lista-agrupada .item .seta { margin-left: auto; color: var(--ios-label2); }
.lista-agrupada .item.perigo, .lista-agrupada .item.perigo > i { color: var(--ios-red) !important; }

/* ---------- Controle segmentado (tema) ---------- */
.segmented { display: inline-flex; padding: 2px; border-radius: .55rem; background: var(--ios-fill); }
.segmented button { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .7rem; min-height: 32px;
    border: 0; border-radius: .45rem; background: transparent; color: var(--bs-body-color); font-size: .8rem; font-weight: 500;
    transition: background-color .18s ease, box-shadow .18s ease; }
.segmented button.ativo { background: var(--ios-surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .04); font-weight: 600; }
[data-bs-theme="dark"] .segmented button.ativo { background: #636366; }

/* ---------- Cartões = seções agrupadas ---------- */
.card { border: 0; border-radius: .875rem; background: var(--ios-surface); box-shadow: none; }
.card.card-body { padding: 1.1rem 1.15rem; }
.card-header { background: transparent; border-bottom: .5px solid var(--ios-separator); font-weight: 600; }
.list-group-item { background: transparent; border-color: var(--ios-separator); }

/* ---------- Botões ---------- */
.btn { --bs-btn-border-radius: .7rem; --bs-btn-font-weight: 600; --bs-btn-padding-y: .55rem; --bs-btn-padding-x: 1.1rem;
    min-height: 44px; border: 0; letter-spacing: -.01em; transition: opacity .15s ease, transform .15s ease; }
.btn-sm { min-height: 34px; --bs-btn-padding-y: .3rem; --bs-btn-padding-x: .8rem; }
.btn:active { transform: scale(.97); opacity: .85; }
.btn-primary { --bs-btn-color: var(--acento-texto); --bs-btn-hover-color: var(--acento-texto); --bs-btn-active-color: var(--acento-texto); --bs-btn-disabled-color: var(--acento-texto); --bs-btn-disabled-bg: var(--ios-blue);
    --bs-btn-bg: var(--ios-blue); --bs-btn-hover-bg: var(--ios-blue); --bs-btn-active-bg: var(--ios-blue);
    --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-active-border-color: transparent; }
.btn-secondary, .btn-outline-secondary, .btn-outline-primary {
    --bs-btn-color: var(--ios-blue); --bs-btn-bg: color-mix(in srgb, var(--ios-blue) 13%, transparent);
    --bs-btn-hover-color: var(--ios-blue); --bs-btn-hover-bg: color-mix(in srgb, var(--ios-blue) 20%, transparent);
    --bs-btn-active-color: var(--ios-blue); --bs-btn-active-bg: color-mix(in srgb, var(--ios-blue) 24%, transparent);
    --bs-btn-disabled-color: var(--ios-label2); --bs-btn-disabled-bg: var(--ios-fill);
    --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-active-border-color: transparent; }
.btn[aria-busy="true"] { pointer-events: none; opacity: .6; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--ios-blue) 45%, transparent); outline-offset: 2px; }
.btn:focus-visible, .form-control:focus, .form-select:focus { box-shadow: none; }

/* ---------- Campos ---------- */
.form-control, .form-select { min-height: 44px; border: 0; border-radius: .7rem; background-color: var(--ios-fill);
    color: var(--bs-body-color); font-size: 1rem; }
.form-control:focus, .form-select:focus { background-color: var(--ios-fill); color: var(--bs-body-color);
    outline: 2px solid var(--ios-blue); outline-offset: -2px; }
.form-control::placeholder { color: var(--ios-label2); }
.form-label { font-size: .85rem; font-weight: 500; color: var(--ios-label2); margin-bottom: .3rem; }
.form-label > .form-control, .form-label > .form-select { margin-top: .3rem; }
small, .text-muted { color: var(--ios-label2) !important; }
legend { font-size: 1rem; font-weight: 600; }
.form-check-input[role="switch"] { width: 3.1rem; height: 1.9rem; margin-right: .6rem; border: 0;
    background-color: var(--ios-fill); vertical-align: middle; }
.form-check-input[role="switch"]:checked { background-color: var(--ios-green); border-color: var(--ios-green); }
.form-check-input[type="checkbox"]:not([role="switch"]) { width: 1.35rem; height: 1.35rem; border-radius: 50%; margin-right: .4rem; vertical-align: -.2rem; }
.form-check-input:checked:not([role="switch"]) { background-color: var(--ios-blue); border-color: var(--ios-blue); }
.badge.text-bg-warning { font-weight: 500; font-size: .9rem; padding: .5rem .75rem; border-radius: .6rem; }
details > summary { cursor: pointer; color: var(--ios-blue); font-weight: 500; padding: .35rem 0; }

/* ---------- Tabelas: linhas finas, sem listras ---------- */
.table { --bs-table-bg: transparent; --bs-table-striped-bg: transparent; --bs-table-border-color: var(--ios-separator); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .8rem .6rem; }
.table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ios-label2); font-weight: 600; }
.table-responsive { background: var(--ios-surface); border-radius: .875rem; padding: .25rem .6rem; }

/* ---------- Componentes do app com a cara iOS ---------- */
.chip { background: color-mix(in srgb, var(--ios-blue) 14%, transparent); color: var(--ios-blue); font-weight: 500; }
.resultados { background: var(--ios-surface); border: 0; border-radius: .75rem; }
.resultado { border-bottom: .5px solid var(--ios-separator); color: var(--bs-body-color); min-height: 44px; display: flex; align-items: center; }
.msg { border: 0; background: var(--ios-surface); border-radius: 1.1rem 1.1rem 1.1rem .3rem; }
.msg.minha { background: var(--ios-blue); color: #fff; border-radius: 1.1rem 1.1rem .3rem 1.1rem; }
.msg.minha small { color: rgba(255, 255, 255, .75) !important; }
.ev { border-radius: 0 .75rem .75rem 0; background: var(--ios-surface); }
#blazor-error-ui { bottom: 0; border-radius: .75rem; margin: 0 .75rem; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Dashboard ---------- */
@media (min-width: 1200px) { main.container { max-width: 1140px; } }

.lista-mensagens .item { align-items: flex-start; }
.lista-mensagens .corpo { min-width: 0; flex: 1; }
.lista-mensagens .titulo { font-weight: 600; font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-mensagens .texto { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-mensagens .lado { white-space: nowrap; margin-left: .5rem; }

.compromisso { height: 100%; padding: .75rem .85rem; background: var(--ios-surface); border-radius: .875rem;
    border-left: 4px solid var(--ios-separator); display: flex; flex-direction: column; gap: .15rem; }
.compromisso.ev-google { border-left-color: #4285f4; }
.compromisso.ev-outlook { border-left-color: #0f9d8a; }
.compromisso.ev-ics { border-left-color: #8a8f98; }
.compromisso .quando { font-size: .75rem; font-weight: 600; color: var(--ios-blue); text-transform: capitalize; }
.compromisso .titulo { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.compromisso .local { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compromisso .local i { margin-right: .15rem; }

/* ---------- Semáforo (monitoramento dos sites) ---------- */
/* Colunas por tela: celular 2, SM 3, MD e acima 6. */
.semaforos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 576px) { .semaforos { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 768px) { .semaforos { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.semaforo { display: flex; flex-direction: column; align-items: center; gap: .4rem; min-width: 0; padding: .6rem .35rem .5rem;
    background: var(--ios-bg); border-radius: .875rem; text-align: center; }
.semaforo .luzes { display: flex; flex-direction: column; gap: .3rem; padding: .35rem; border-radius: .8rem; background: #2c2c2e; outline-offset: 3px; }
.semaforo .luz { width: 1.15rem; height: 1.15rem; border-radius: 50%; background: #48484a; opacity: .45; transition: opacity .3s ease, box-shadow .3s ease; }
.semaforo-fora .l-fora { background: var(--ios-red); opacity: 1; box-shadow: 0 0 .7rem var(--ios-red); }
.semaforo-espera .l-espera { background: var(--ios-yellow); opacity: 1; box-shadow: 0 0 .7rem var(--ios-yellow); animation: ios-pisca 1.2s ease-in-out infinite; }
.semaforo-ok .l-ok { background: var(--ios-green); opacity: 1; box-shadow: 0 0 .7rem var(--ios-green); }
.semaforo-pausado { opacity: .6; }
.semaforo .nome { max-width: 100%; font-size: .8rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-icone { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; font-size: 1.05rem; }
@keyframes ios-gira { to { transform: rotate(360deg); } }
@keyframes ios-pisca { 50% { opacity: .35; } }
:root { --ios-yellow: #ffcc00; }
[data-bs-theme="dark"] { --ios-yellow: #ffd60a; }

/* Tooltip simples (hover e foco de teclado) */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
    content: attr(data-tip); position: absolute; z-index: 200; bottom: calc(100% + .45rem); left: 50%; transform: translateX(-50%);
    width: max-content; max-width: 10rem; padding: .3rem .55rem; border-radius: .45rem; background: rgba(28, 28, 30, .94); color: #fff;
    font-size: .75rem; font-weight: 500; line-height: 1.3; text-align: center; white-space: normal; pointer-events: none; }
.girando { display: inline-block; animation: ios-gira 1s linear infinite; }
