:root {
    --bg: #f7f3ff;
    --surface: #ffffff;
    --surface-soft: #fff7ed;
    --text: #22192f;
    --muted: #6d617a;
    --line: #e8dff2;
    --primary: #6d28d9;
    --primary-dark: #4c1d95;
    --accent: #f97316;
    --danger: #b42318;
    --success: #027a48;
    --radius: 18px;
    --shadow: 0 20px 50px rgba(33, 25, 47, .08);
    --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

/* Garante que campos condicionais realmente desapareçam mesmo quando .form-field define display:grid. */
[hidden],
.form-field[hidden],
.conditional-field[hidden],
.is-conditionally-hidden {
    display: none !important;
}

html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
strong, b { font-weight: 500; }
button, input, select, textarea { font: inherit; }
h1, h2, h3 { margin: 0; font-weight: 500; }
h1 { font-size: clamp(1.45rem, 2vw, 2rem); }
h2 { font-size: 1.15rem; }
p { margin: 0; }
.small { font-size: .86rem; }
.muted { color: var(--muted); }

.guest-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(249, 115, 22, .16), transparent 28rem),
        radial-gradient(circle at bottom right, rgba(109, 40, 217, .18), transparent 30rem),
        var(--bg);
}
.guest-shell {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 24px;
}
.brand-panel, .guest-card, .panel, .metric {
    background: rgba(255,255,255,.92);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.brand-panel {
    padding: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
}
.brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: white;
    font-weight: 500;
}
.guest-card { padding: 32px; }

.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: stretch; background: linear-gradient(90deg, #20142f 0 220px, transparent 220px); }
.sidebar {
    position: sticky;
    top: 0;
    min-height: 100dvh;
    height: auto;
    background: #20142f;
    color: white;
    padding: 22px;
    overflow-y: auto;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.brand strong, .brand small { display: block; }
.brand small { color: rgba(255,255,255,.7); font-size: .82rem; }
.side-nav { display: grid; gap: 6px; }
.side-nav a {
    padding: 10px 12px;
    border-radius: 12px;
    color: rgba(255,255,255,.86);
}
.side-nav a:hover, .side-nav a:focus { background: rgba(255,255,255,.1); color: white; }

.main-area { min-width: 0; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
    height: 72px;
    padding: 0 24px;
    background: rgba(255,255,255,.88);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 5;
}
.topbar small { display: block; color: var(--muted); }
.content { width: 100%; padding: 28px 28px 96px; max-width: 1440px; margin: 0 auto; flex: 1 0 auto; }

.menu-button {
    display: none;
    border: 0;
    border-radius: 12px;
    background: var(--surface-soft);
    padding: 10px 12px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 20px;
}
.page-heading p { color: var(--muted); margin-top: 5px; }

.button {
    border: 0;
    border-radius: 13px;
    padding: 10px 14px;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 500;
}
.button.primary { background: linear-gradient(135deg, var(--accent), var(--primary)); color: white; }
.button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line); }

.flash-stack {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin: 0 0 14px;
}
.flash-stack[hidden] { display: none; }
.alert {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    margin: 0;
    border: 1px solid var(--line);
    background: var(--surface);
    line-height: 1.45;
}
.alert.success { border-color: rgba(2,122,72,.25); color: var(--success); background: #ecfdf3; }
.alert.error { border-color: rgba(180,35,24,.25); color: var(--danger); background: #fff1f0; }
.alert.warning { border-color: rgba(249,115,22,.28); color: #9a3412; background: #fff7ed; }
.alert.info { border-color: rgba(109,40,217,.18); color: var(--primary); background: #f7f0ff; }
.alert.is-leaving {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .18s ease, transform .18s ease;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.metric { padding: 18px; }
.metric span { display: block; color: var(--muted); font-size: .9rem; }
.metric strong { font-size: 1.6rem; font-weight: 500; margin-top: 6px; display: block; }

.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.panel { padding: 20px; margin-bottom: 18px; }
.list-cards { display: grid; gap: 10px; margin-top: 14px; }
.list-cards article {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    background: #fff;
}
.list-cards strong, .list-cards span, .list-cards small { display: block; }
.list-cards span, .list-cards small { color: var(--muted); }

.filters {
    display: grid;
    grid-template-columns: 1fr 220px auto;
    gap: 12px;
    align-items: end;
    background: rgba(255,255,255,.74);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 18px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}
.form-grid .form-field--textarea,
.form-grid .form-field--wide {
    grid-column: 1 / -1;
}

.module-form--opportunities {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stack { display: grid; gap: 14px; }
.form-field { display: grid; gap: 7px; }
.form-field label { font-weight: 500; color: #352842; }
.form-field input, .form-field select, .form-field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 11px 12px;
    background: #fff;
    color: var(--text);
    outline: none;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    border-color: rgba(109,40,217,.55);
    box-shadow: 0 0 0 4px rgba(109,40,217,.08);
}

.validation-summary {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(180,35,24,.24);
    background: #fff1f0;
    color: var(--danger);
}
.validation-summary strong { display: block; margin-bottom: 8px; }
.validation-summary ul { margin: 0; padding-left: 18px; }
.validation-summary a { text-decoration: underline; }
.form-field.has-error input,
.form-field.has-error select,
.form-field.has-error textarea,
.form-field input[aria-invalid="true"],
.form-field select[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] {
    border-color: rgba(180,35,24,.55);
    box-shadow: 0 0 0 4px rgba(180,35,24,.08);
}
.field-help {
    display: block;
    color: var(--muted);
    font-size: .8rem;
    line-height: 1.35;
}
.field-error {
    display: block;
    color: var(--danger);
    font-size: .84rem;
    font-weight: 500;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.topbar-spacer { flex: 1 1 auto; }
.topbar-actions > .button.secondary[href="/logout"] {
    min-height: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 12px;
}
.reminder-dropdown { position: relative; }
.reminder-button {
    position: relative;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(31, 16, 48, .055);
}
.reminder-button:hover,
.reminder-button:focus-visible {
    border-color: rgba(108, 43, 217, .28);
    box-shadow: 0 0 0 4px rgba(108, 43, 217, .08);
}
.reminder-button-icon svg { width: 18px; height: 18px; display: block; }
.reminder-badge {
    position: absolute;
    top: -5px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: #fff;
    font-size: .72rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(108, 43, 217, .22);
}
.reminder-menu {
    position: fixed;
    top: var(--reminder-menu-top, 72px);
    right: var(--reminder-menu-right, 16px);
    z-index: 2600;
    width: min(360px, calc(100vw - 32px));
    max-height: var(--reminder-menu-max-height, min(560px, calc(100dvh - 96px)));
    overflow: auto;
    overscroll-behavior: contain;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255,255,255,.99);
    box-shadow: 0 26px 50px rgba(23, 12, 42, .22);
    isolation: isolate;
}
.reminder-menu[hidden] { display: none; }
.reminder-menu-header { display: grid; gap: 2px; margin-bottom: 10px; padding: 4px 2px 10px; border-bottom: 1px solid var(--line); }
.reminder-menu-header small { color: var(--muted); }
.reminder-empty { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
 .reminder-list { display: grid; gap: 10px; }
.reminder-item {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.reminder-item:hover,
.reminder-item:focus-within {
    border-color: rgba(108, 43, 217, .22);
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(31, 16, 48, .08);
}
.reminder-item-link {
    display: grid;
    gap: 6px;
    padding: 12px 44px 12px 12px;
    min-height: 112px;
}
.reminder-item--has-action .reminder-item-link {
    min-height: 0;
    padding-bottom: 8px;
}
.reminder-item-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0 12px 12px;
}
.reminder-item-action.button.compact {
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: .82rem;
}
.reminder-item strong { font-size: .94rem; line-height: 1.25; }
.reminder-item small { color: var(--muted); line-height: 1.35; }
.reminder-item-chip {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 500;
    background: rgba(108, 43, 217, .08);
    color: var(--primary);
}
.reminder-item-recurrence .reminder-item-chip { background: rgba(244, 116, 36, .12); color: #be5b0f; }
.reminder-item-contact_schedule .reminder-item-chip { background: rgba(33, 150, 95, .12); color: #16754b; }
.reminder-item-birthday .reminder-item-chip { background: rgba(108, 43, 217, .08); color: var(--primary); }
.reminder-item-date { font-weight: 500; color: var(--text) !important; }
.reminder-dismiss-form {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
}
.reminder-dismiss {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(220, 38, 38, .14);
    border-radius: 10px;
    background: rgba(220, 38, 38, .06);
    color: #dc2626;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.reminder-dismiss:hover,
.reminder-dismiss:focus-visible {
    background: rgba(220, 38, 38, .11);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, .08);
}
.reminder-dismiss svg { width: 16px; height: 16px; display: block; }

.language-switcher {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}
.language-switcher a {
    min-width: 34px;
    min-height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 500;
}
.language-switcher a.is-active {
    color: white;
    background: linear-gradient(135deg, var(--accent), var(--primary));
}

.language-switcher a .locale-flag {
    width: 22px;
    height: 16px;
    display: block;
    border-radius: 4px;
    box-shadow: 0 2px 7px rgba(20, 12, 35, .14);
}
.language-switcher a.is-active .locale-flag {
    box-shadow: 0 3px 10px rgba(255,255,255,.22), 0 0 0 1px rgba(255,255,255,.22);
}
.guest-language { justify-content: flex-end; margin-bottom: 18px; }

.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; justify-content: flex-end; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .86rem; font-weight: 500; }
.actions { text-align: right; width: 110px; }
.inline { display: inline; }
.icon-action {
    border: 1px solid var(--line);
    background: #fff;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    margin-left: 4px;
    cursor: pointer;
}
.icon-action svg {
    display: block;
    pointer-events: none;
}
.icon-action:hover,
.icon-action:focus {
    border-color: rgba(249, 115, 22, .32);
    color: var(--accent);
    box-shadow: 0 8px 20px rgba(249, 115, 22, .12);
}
.icon-action.danger {
    color: var(--danger);
    background: rgba(180, 35, 24, .06);
    border-color: rgba(180, 35, 24, .16);
}
.icon-action.danger:hover,
.icon-action.danger:focus {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--accent), var(--primary));
}
tr.is-removing-from-screen,
[data-resource-row].is-removing-from-screen {
    opacity: 0;
    transform: translateX(8px);
    transition: opacity .2s ease, transform .2s ease;
}
.empty {
    color: var(--muted);
    padding: 20px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    background: #fff;
}

@media (max-width: 1200px) {
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .module-form--opportunities { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1060px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-two { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; background: var(--bg); }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 286px;
        min-height: 100dvh;
        height: 100dvh;
        transform: translateX(-105%);
        transition: transform .2s ease;
        z-index: 10;
    }
    .sidebar.open { transform: translateX(0); }
    .menu-button { display: inline-flex; }
}

@media (max-width: 720px) {
    .content { padding: 18px; }
    .guest-shell { grid-template-columns: 1fr; }
    .brand-panel { display: none; }
    .page-heading { flex-direction: column; }
    .filters, .form-grid { grid-template-columns: 1fr; }
    .form-actions { justify-content: stretch; flex-direction: column; }
    .metric-grid { grid-template-columns: 1fr; }
    .responsive-table thead { display: none; }
    .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
    .responsive-table tr {
        border: 1px solid var(--line);
        border-radius: 15px;
        padding: 10px;
        margin-bottom: 12px;
        background: #fff;
    }
    .responsive-table td {
        border: 0;
        padding: 8px 4px;
        display: flex;
        justify-content: space-between;
        gap: 14px;
    }
    .responsive-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 500;
    }
    .actions { text-align: left; width: 100%; }

    .responsive-table.contact-mobile-list tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 12px;
        padding: 14px 16px;
    }
    .responsive-table.contact-mobile-list td {
        display: none;
    }
    .responsive-table.contact-mobile-list td[data-field="name"] {
        display: block;
        width: auto;
        min-width: 0;
        padding: 0;
        color: var(--text);
        font-weight: 500;
        line-height: 1.35;
        overflow-wrap: normal;
    }
    .responsive-table.contact-mobile-list td[data-field="name"]::before {
        display: none;
        content: "";
    }
    .responsive-table.contact-mobile-list td.actions {
        display: inline-flex;
        width: auto;
        justify-content: flex-end;
        align-items: center;
        gap: 8px;
        padding: 0;
        text-align: right;
    }
    .responsive-table.contact-mobile-list td.actions::before {
        display: none;
        content: "";
    }
    .responsive-table.contact-mobile-list .inline {
        display: inline-flex;
    }
    .responsive-table.contact-mobile-list .icon-action {
        margin-left: 0;
        flex: 0 0 34px;
    }
}

.report-line { display:flex; justify-content:space-between; gap:12px; padding:10px 0; border-bottom:1px solid var(--line); }
.report-line strong { font-weight:500; }


/* Hotfix 2026-07-06: lembrete verde de nova oportunidade vindo da landing no dropdown do topo. */
.reminder-item-landing_opportunity {
    border-color: rgba(22, 163, 74, .24);
    background: linear-gradient(135deg, rgba(22, 163, 74, .10), rgba(236, 253, 245, .94));
}

.reminder-item-landing_opportunity:hover,
.reminder-item-landing_opportunity:focus-within {
    border-color: rgba(22, 163, 74, .38);
    box-shadow: 0 14px 28px rgba(22, 101, 52, .12);
}

.reminder-item-landing_opportunity .reminder-item-chip {
    background: rgba(22, 163, 74, .14);
    color: #15803d;
}

.reminder-item-link--button {
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.reminder-item:not(:has(.reminder-dismiss-form)) .reminder-item-link {
    padding-right: 12px;
}

/* Utilitário de acessibilidade global: conteúdo disponível a leitores de tela sem ocupar o layout. */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}


/* v40 — ação de dispensar aviso com ícone de lixeira real. */
.reminder-dismiss--trash {
    padding: 0;
    line-height: 0;
}
.reminder-dismiss--trash svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    pointer-events: none;
}

/* v83 — aviso de chamado corrigido no sino de notificações. */
.reminder-item-ticket_corrected {
    border-color: rgba(22, 163, 74, .26);
    background: linear-gradient(135deg, rgba(22, 163, 74, .09), rgba(240, 253, 244, .96));
}
.reminder-item-ticket_corrected:hover,
.reminder-item-ticket_corrected:focus-within {
    border-color: rgba(22, 163, 74, .42);
    box-shadow: 0 14px 28px rgba(22, 101, 52, .12);
}
.reminder-item-ticket_corrected .reminder-item-chip {
    background: rgba(22, 163, 74, .14);
    color: #15803d;
}
