/* ============================================================
   INFECZERO
   Página principal do observador
   ============================================================ */


/* ============================================================
   VARIÁVEIS
   ============================================================ */

:root {

    --bg-app: #E6EEF4;

    --surface: #FFFFFF;
    --surface-secondary: #F7FAFC;

    --primary-navy: #13355A;

    --action-blue: #0066CC;
    --action-blue-hover: #0052A3;

    --text-main: #1E293B;
    --text-muted: #64748B;

    --border-color: #B8C9D8;

    --success: #15803D;
    --success-light: #DCFCE7;

    --warning: #B45309;
    --warning-light: #FEF3C7;

    --danger: #DC2626;
    --danger-light: #FEE2E2;

    --focus: #0F62FE;

    --radius-small: 6px;
    --radius-medium: 10px;
    --radius-large: 16px;

    --shadow-small:
        0 1px 3px rgba(15, 23, 42, 0.08);

    --shadow-medium:
        0 4px 12px rgba(15, 23, 42, 0.08);

    --shadow-hover:
        0 8px 20px rgba(15, 23, 42, 0.12);
}


/* ============================================================
   RESET
   ============================================================ */

* {
    box-sizing: border-box;
}


html {
    scroll-behavior: smooth;
}


body {

    margin: 0;

    min-height: 100vh;

    /* Foto do serviço (CTI) embaçada e comprimida (46 KB), sob um
       véu claro que preserva a leitura dos cartões. O borrão também
       anonimiza pessoas e telas clínicas. */
    background-color: var(--bg-app);

    background-image:
        linear-gradient(
            rgba(230, 238, 244, 0.42),
            rgba(230, 238, 244, 0.62)
        ),
        url("fundo-inicio.jpg");

    background-position: center;

    background-size: cover;

    background-repeat: no-repeat;

    color: var(--text-main);

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    line-height: 1.5;
}


/* ============================================================
   ELEMENTOS GERAIS
   ============================================================ */

button,
a {
    font: inherit;
}


button {
    cursor: pointer;
}


button:focus-visible,
a:focus-visible {

    outline: 3px solid var(--focus);
    outline-offset: 3px;
}


.icon {

    width: 20px;
    height: 20px;

    fill: none;

    stroke: currentColor;

    stroke-width: 2;

    stroke-linecap: round;
    stroke-linejoin: round;

    flex-shrink: 0;
}


.icon-large {

    width: 30px;
    height: 30px;
}


/* Ícone em imagem (PNG tingido) dentro do quadro do cartão —
   mesmo tamanho dos ícones Lucide (.icon-large). */

.action-icon .icon-imagem {

    width: 30px;
    height: 30px;

    object-fit: contain;
}


/* ============================================================
   CABEÇALHO
   ============================================================ */

.app-header {

    position: sticky;

    top: 0;

    z-index: 100;

    background: var(--primary-navy);

    color: #FFFFFF;

    box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.18);
}


.header-content {

    width: min(1100px, calc(100% - 32px));

    min-height: 76px;

    margin: 0 auto;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 24px;
}


.brand-area {

    display: flex;

    align-items: center;

    gap: 12px;

    min-width: 0;
}


.app-icon {

    width: 46px;
    height: 46px;

    flex-shrink: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: rgba(255, 255, 255, 0.12);

    border: 1px solid rgba(255, 255, 255, 0.25);

    color: #FFFFFF;

    font-size: 15px;

    font-weight: 800;

    letter-spacing: 0.04em;
}


.brand-text {

    min-width: 0;
}


.brand-text h1 {

    margin: 0;

    font-size: 1.35rem;

    line-height: 1.2;

    letter-spacing: 0.02em;
}


.brand-text p {

    margin: 3px 0 0;

    color: rgba(255, 255, 255, 0.78);

    font-size: 0.78rem;

    line-height: 1.3;
}


.logout-button {

    min-height: 44px;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 8px;

    padding: 8px 14px;

    border: 1px solid rgba(255, 255, 255, 0.35);

    border-radius: var(--radius-medium);

    background: transparent;

    color: #FFFFFF;

    font-weight: 600;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}


.logout-button:hover {

    background: rgba(255, 255, 255, 0.1);

    border-color: rgba(255, 255, 255, 0.55);
}


/* ============================================================
   CONTEÚDO PRINCIPAL
   ============================================================ */

.main-content {

    width: min(1100px, calc(100% - 32px));

    margin: 0 auto;

    padding: 32px 0 56px;
}


.main-content > section {

    margin-bottom: 24px;
}


/* ============================================================
   TEXTOS DE SEÇÃO
   ============================================================ */

.eyebrow {

    margin: 0 0 5px;

    color: var(--action-blue);

    font-size: 0.78rem;

    font-weight: 800;

    text-transform: uppercase;

    letter-spacing: 0.07em;
}


.section-title h2,
.section-heading h2,
.sync-header h2 {

    margin: 0;

    color: var(--primary-navy);

    font-size: 1.35rem;

    line-height: 1.25;
}


.section-title > p:not(.eyebrow) {

    margin: 7px 0 0;

    color: var(--text-muted);

    font-size: 0.94rem;
}


/* ============================================================
   IDENTIFICAÇÃO AUTOMÁTICA
   ============================================================ */

.identity-section {

    padding: 24px;

    background: var(--surface);

    border: 1px solid var(--border-color);

    border-radius: var(--radius-large);

    box-shadow: var(--shadow-small);
}


.section-heading {

    display: flex;

    align-items: flex-start;

    justify-content: space-between;

    gap: 20px;

    margin-bottom: 22px;
}


.automatic-badge {

    display: inline-flex;

    align-items: center;

    gap: 7px;

    flex-shrink: 0;

    padding: 7px 10px;

    border-radius: 999px;

    background: #EEF4F8;

    border: 1px solid var(--border-color);

    color: var(--primary-navy);

    font-size: 0.76rem;

    font-weight: 700;
}


.automatic-badge .icon {

    width: 15px;
    height: 15px;
}


.identity-grid {

    display: grid;

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

    gap: 16px;
}


.identity-item {

    min-height: 78px;

    display: flex;

    flex-direction: column;

    justify-content: center;

    gap: 5px;

    padding: 15px 17px;

    background: var(--surface-secondary);

    border: 1px solid var(--border-color);

    border-radius: var(--radius-medium);
}


.identity-label {

    color: var(--text-muted);

    font-size: 0.78rem;

    font-weight: 700;

    text-transform: uppercase;

    letter-spacing: 0.04em;
}


.identity-value {

    color: var(--primary-navy);

    font-size: 1rem;

    font-weight: 700;
}


.identity-info {

    margin: 16px 0 0;

    color: var(--text-muted);

    font-size: 0.83rem;
}


/* ============================================================
   STATUS DA CONEXÃO
   ============================================================ */

.connection-section {

    min-height: 76px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    padding: 16px 20px;

    background: var(--surface);

    border: 1px solid var(--border-color);

    border-radius: var(--radius-large);

    box-shadow: var(--shadow-small);
}


.connection-status {

    display: flex;

    align-items: center;

    gap: 12px;
}


.status-indicator {

    width: 13px;
    height: 13px;

    flex-shrink: 0;

    border-radius: 50%;

    background: var(--success);

    box-shadow:
        0 0 0 4px var(--success-light);
}


.connection-status.is-offline .status-indicator {

    background: var(--warning);

    box-shadow:
        0 0 0 4px var(--warning-light);
}


.connection-text {

    display: flex;

    flex-direction: column;

    gap: 1px;
}


.connection-text strong {

    color: var(--text-main);

    font-size: 0.95rem;
}


.connection-text span {

    color: var(--text-muted);

    font-size: 0.82rem;
}


.offline-info {

    color: var(--text-muted);

    font-size: 0.8rem;

    text-align: right;
}


/* ============================================================
   AÇÕES
   ============================================================ */

.actions-section {

    padding: 24px;

    background: var(--surface);

    border: 1px solid var(--border-color);

    border-radius: var(--radius-large);

    box-shadow: var(--shadow-small);
}


.actions-grid {

    display: grid;

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

    gap: 16px;

    margin-top: 22px;
}


.action-card {

    min-height: 160px;

    width: 100%;

    display: flex;

    align-items: flex-start;

    gap: 18px;

    padding: 20px;

    text-align: left;

    text-decoration: none;

    background: var(--surface);

    border: 1px solid var(--border-color);

    border-radius: var(--radius-large);

    color: var(--text-main);

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease;
}


.action-card:hover {

    transform: translateY(-2px);

    border-color: #8EA9BE;

    box-shadow: var(--shadow-hover);
}


.action-card-primary {

    border-color: #91BCE5;

    background:
        linear-gradient(
            145deg,
            #FFFFFF 0%,
            #F5FAFF 100%
        );
}


.action-icon {

    width: 58px;
    height: 58px;

    flex-shrink: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 14px;

    background: #EAF3FB;

    color: var(--action-blue);
}


.action-content {

    min-width: 0;

    flex: 1;
}


.action-title-row {

    display: flex;

    align-items: flex-start;

    justify-content: space-between;

    gap: 10px;
}


.action-title-row h3 {

    margin: 0;

    color: var(--primary-navy);

    font-size: 1.02rem;

    line-height: 1.35;
}


.action-content p {

    margin: 9px 0 10px;

    color: var(--text-muted);

    font-size: 0.86rem;

    line-height: 1.5;
}


.action-description {

    color: var(--action-blue);

    font-size: 0.78rem;

    font-weight: 700;
}


.arrow-icon {

    width: 21px;
    height: 21px;

    flex-shrink: 0;

    fill: none;

    stroke: var(--action-blue);

    stroke-width: 2;

    stroke-linecap: round;

    stroke-linejoin: round;
}


.development-badge {

    flex-shrink: 0;

    padding: 4px 7px;

    border-radius: 5px;

    background: #F1F5F9;

    border: 1px solid #CBD5E1;

    color: var(--text-muted);

    font-size: 0.67rem;

    font-weight: 700;

    white-space: nowrap;
}


/* ============================================================
   SINCRONIZAÇÃO
   ============================================================ */

.sync-section {

    padding: 24px;

    background: var(--surface);

    border: 1px solid var(--border-color);

    border-radius: var(--radius-large);

    box-shadow: var(--shadow-small);
}


.sync-header {

    display: flex;

    align-items: flex-start;

    justify-content: space-between;

    gap: 20px;
}


.sync-status-badge {

    display: inline-flex;

    align-items: center;

    gap: 8px;

    padding: 7px 11px;

    border-radius: 999px;

    background: var(--success-light);

    border: 1px solid #BBE7C8;

    color: var(--success);

    font-size: 0.78rem;

    font-weight: 700;
}


.sync-dot {

    width: 8px;
    height: 8px;

    border-radius: 50%;

    background: currentColor;
}


.sync-status-badge.is-waiting {

    background: var(--warning-light);

    border-color: #F5D58A;

    color: var(--warning);
}


.sync-content {

    margin-top: 20px;

    padding: 18px;

    background: var(--surface-secondary);

    border: 1px solid var(--border-color);

    border-radius: var(--radius-medium);
}


.sync-summary {

    display: flex;

    align-items: baseline;

    gap: 8px;

    flex-wrap: wrap;
}


.sync-summary strong {

    color: var(--primary-navy);

    font-size: 1.7rem;

    line-height: 1;
}


.sync-summary span {

    color: var(--text-muted);

    font-size: 0.9rem;
}


.sync-description {

    margin: 8px 0 0;

    color: var(--text-muted);

    font-size: 0.82rem;
}


/* Aviso de cota de armazenamento quase cheia. */

.aviso-quota-inicial {

    margin: 12px 0 0;

    padding: 10px 13px;

    background: #FDF1D7;

    border: 1px solid #F2D9A0;

    border-radius: var(--radius-medium);

    color: #92400E;

    font-size: 0.82rem;

    font-weight: 600;
}


.sync-link {

    display: inline-flex;

    align-items: center;

    gap: 7px;

    margin-top: 14px;

    min-height: 44px;

    color: var(--action-blue);

    font-size: 0.85rem;

    font-weight: 650;

    text-decoration: none;
}


.sync-link:hover {

    text-decoration: underline;
}


.sync-link .icon {

    width: 17px;
    height: 17px;
}


.prototype-notice {

    display: flex;

    align-items: flex-start;

    gap: 9px;

    margin-top: 14px;

    padding: 12px 14px;

    background: #F8FAFC;

    border: 1px solid #D8E1E8;

    border-radius: var(--radius-medium);

    color: var(--text-muted);

    font-size: 0.78rem;

    line-height: 1.45;
}


.prototype-notice .icon {

    width: 17px;
    height: 17px;

    margin-top: 1px;

    color: var(--action-blue);
}


/* ============================================================
   MENSAGEM DE INTERFACE
   ============================================================ */

.live-message {

    position: fixed;

    left: 50%;

    bottom: 24px;

    z-index: 200;

    max-width: min(500px, calc(100% - 32px));

    padding: 13px 18px;

    transform:
        translate(-50%, 20px);

    opacity: 0;

    pointer-events: none;

    background: var(--primary-navy);

    border-radius: var(--radius-medium);

    color: #FFFFFF;

    box-shadow: var(--shadow-hover);

    font-size: 0.86rem;

    text-align: center;

    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}


.live-message.is-visible {

    opacity: 1;

    transform:
        translate(-50%, 0);
}


/* ============================================================
   RESPONSIVIDADE
   ============================================================ */

@media (max-width: 760px) {

    .header-content {

        min-height: 68px;

        width: min(100% - 24px, 1100px);

        gap: 12px;
    }


    .brand-text p {

        display: none;
    }


    .brand-text h1 {

        font-size: 1.15rem;
    }


    .app-icon {

        width: 40px;
        height: 40px;

        border-radius: 8px;

        font-size: 13px;
    }


    .logout-button span {

        display: none;
    }


    .logout-button {

        width: 44px;
        padding: 8px;
    }


    .main-content {

        width: min(100% - 24px, 1100px);

        padding-top: 20px;
    }


    .section-heading {

        flex-direction: column;

        align-items: flex-start;
    }


    .identity-grid {

        grid-template-columns: 1fr;
    }


    .connection-section {

        align-items: flex-start;

        flex-direction: column;

        gap: 10px;
    }


    .offline-info {

        text-align: left;
    }


    .actions-grid {

        grid-template-columns: 1fr;
    }
}


@media (max-width: 480px) {

    .identity-section,
    .actions-section,
    .sync-section {

        padding: 18px;
    }


    .action-card {

        min-height: 0;

        padding: 17px;

        gap: 13px;
    }


    .action-icon {

        width: 48px;
        height: 48px;

        border-radius: 11px;
    }


    .icon-large {

        width: 25px;
        height: 25px;
    }


    .action-icon .icon-imagem {

        width: 25px;
        height: 25px;
    }


    .action-title-row {

        flex-direction: column;

        align-items: flex-start;
    }


    .development-badge {

        white-space: normal;
    }


    .sync-header {

        flex-direction: column;
    }
}


/* ============================================================
   REDUÇÃO DE MOVIMENTO
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }


    *,
    *::before,
    *::after {

        transition-duration: 0.01ms !important;

        animation-duration: 0.01ms !important;

        animation-iteration-count: 1 !important;
    }
}