:root {
    --blue: #163f73;
    --blue-dark: #102d52;
    --blue-ink: #0d2748;
    --orange: #ef6b2e;
    --green: #18a85f;
    --red: #d92d20;
    --purple: #6f3cc3;
    --text: #172033;
    --muted: #667085;
    --line: #d9e2ec;
    --bg: #f4f6f9;
    --white: #fff;
}

* { box-sizing: border-box; }
html { width: 100%; min-width: 0; }
body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    width: 100%;
    min-width: 0;
}
a { color: inherit; text-decoration: none; }
.auth-page { min-height: 100vh; display: grid; place-items: center; background: #f5f7fa; }
.auth-shell { width: min(420px, calc(100vw - 32px)); }
.login-card, .panel, .placeholder {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(16, 45, 82, .08);
}
.login-card { padding: 32px; }
.login-brand { margin-bottom: 26px; border-bottom: 1px solid var(--line); padding-bottom: 22px; }
.login-brand img { display: block; width: 132px; height: auto; margin-bottom: 16px; }
.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--blue);
    color: var(--white);
    font-weight: 800;
    border-bottom: 4px solid var(--orange);
}
.login-brand h1 { margin: 14px 0 4px; font-size: 28px; }
.login-brand p, .brand small, .topbar span, .user-menu small { color: var(--muted); }
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 7px; font-weight: 700; }
input, select {
    min-height: 42px;
    border: 1px solid #c5cfda;
    border-radius: 6px;
    padding: 9px 11px;
    font: inherit;
}
input:focus, select:focus, .btn:focus, .main-nav a:focus { outline: 3px solid rgba(239, 107, 46, .25); outline-offset: 2px; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 0;
    border-radius: 6px;
    padding: 9px 16px;
    font-weight: 800;
    cursor: pointer;
}
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover, .btn-secondary:hover { filter: brightness(.94); }
.btn-secondary { background: #e8eef5; color: var(--blue-dark); }
.alert { padding: 12px 14px; border-radius: 6px; margin-bottom: 16px; }
.alert-error { background: #fff2f0; color: #9f1b13; border: 1px solid #ffd0ca; }
.alert-error strong { display: block; margin-bottom: 6px; }
.form-inline-error {
    border: 1px solid #ffd0ca;
    border-radius: 6px;
    background: #fff2f0;
    color: #9f1b13;
    padding: 10px 12px;
    font-weight: 700;
}
.app-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
    width: 100%;
    min-width: 0;
}
.sidebar {
    background: linear-gradient(180deg, var(--blue-ink) 0%, var(--blue-dark) 100%);
    color: var(--white);
    padding: 18px 12px;
    min-width: 0;
    border-right: 1px solid rgba(255, 255, 255, .08);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 8px 16px; margin-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.brand img { width: 54px; height: auto; background: var(--white); border-radius: 6px; padding: 5px; }
.brand span:last-child { display: grid; gap: 3px; }
.brand strong { letter-spacing: .2px; }
.brand small { line-height: 1.25; }
.main-nav { display: grid; gap: 3px; padding-top: 6px; }
.main-nav a { padding: 10px 12px; border-radius: 6px; color: #dce8f5; font-weight: 700; border-left: 4px solid transparent; }
.main-nav a:hover, .main-nav a.active { background: rgba(255, 255, 255, .11); color: var(--white); }
.main-nav a.active { border-left-color: var(--orange); }
.main-area { min-width: 0; width: 100%; overflow-x: hidden; }
.topbar {
    height: 68px;
    background: var(--white);
    border-bottom: 3px solid var(--orange);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
}
.topbar > div:first-child { display: grid; gap: 3px; }
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-menu { text-align: right; }
.user-menu span { color: var(--text); font-weight: 800; }
.content { padding: 24px; width: 100%; max-width: 100%; min-width: 0; }
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.metric-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-top: 4px solid var(--blue);
    border-radius: 8px;
    padding: 14px 15px;
    display: grid;
    gap: 8px;
    min-width: 0;
}
.metric-card strong { font-size: 26px; line-height: 1; }
.metric-card span, .metric-card small { color: var(--muted); font-weight: 700; }
.metric-card.azul { border-top-color: var(--blue); }
.metric-card.verde { border-top-color: var(--green); }
.metric-card.laranja { border-top-color: var(--orange); }
.metric-card.vermelho { border-top-color: var(--red); }
.metric-card.roxo { border-top-color: var(--purple); }
.panel-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); gap: 18px; width: 100%; min-width: 0; }
.panel { padding: 18px; min-width: 0; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel h2 { margin: 0; font-size: 18px; }
.badge, .status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 800;
    font-size: 12px;
    background: #fff4ed;
    color: #b84a16;
}
.badge-soft { background: #eef4ff; color: var(--blue); }
.badge-rescue { background: #fff4ed; color: var(--orange); border: 1px solid #ffd7bd; margin-left: 6px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; background: var(--white); }
.data-table th {
    background: #f0f4f8;
    color: var(--blue-dark);
    text-align: left;
    padding: 11px;
    font-size: 13px;
    border-bottom: 2px solid var(--orange);
}
.data-table td { border-top: 1px solid var(--line); padding: 11px; }
.data-table tbody tr:hover { background: #f8fbff; }
.status-pill { background: #e9f7ef; color: #087443; border-radius: 6px; }
.operation-table { min-width: 980px; }
.status-row-primeira-tentativa { background: #ead9cf; }
.status-row-segunda-tentativa { background: #e5f6e8; }
.status-row-duplicidade { background: #f7c5ec; }
.status-row-novo-lead { background: #fff; }
.status-row-resgate-leads { background: #fff4ed; }
.status-row-interessado { background: #fff6cf; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { outline: 2px solid rgba(239, 107, 46, .28); outline-offset: -2px; }
.status-pill-primeira-tentativa { background: #8b451f; color: #fff; }
.status-pill-segunda-tentativa { background: #7be28d; color: #0f4d1d; }
.status-pill-duplicidade { background: #f000c8; color: #fff; }
.status-pill-novo-lead { background: #fff; color: var(--blue-dark); border: 1px solid #cfd9e5; }
.status-pill-resgate-leads { background: var(--orange); color: #fff; }
.status-pill-interessado { background: #facc15; color: #5f3b00; }
.placeholder { padding: 34px; max-width: 720px; }
.placeholder h1 { margin: 14px 0 8px; font-size: 30px; }
.placeholder p { color: var(--muted); margin-bottom: 22px; }
.latest-leads-panel { margin-bottom: 18px; }
.latest-leads-table { min-width: 720px; }
.dashboard-main-panel, .reports-panel { width: 100%; }
.empty-state { color: var(--muted); text-align: center; padding: 18px; }
.rd-filters { margin-bottom: 18px; }
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}
.filter-grid label { display: grid; gap: 6px; font-weight: 800; color: var(--blue-dark); }
.filter-grid select { min-width: 0; text-overflow: ellipsis; }
.filter-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.rd-card-group { margin-bottom: 18px; }
.rd-card-group h2 { margin: 0 0 10px; color: var(--blue-dark); font-size: 15px; text-transform: uppercase; }
.rd-dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.rd-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}
.rd-chart-panel { min-height: 0; }
.chart-box { position: relative; height: 230px; width: 100%; }
.rd-chart { width: 100% !important; height: 230px !important; display: block; }
.bar-chart { display: grid; gap: 9px; }
.bar-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(120px, 1.4fr) 64px;
    gap: 10px;
    align-items: center;
}
.bar-label {
    min-width: 0;
    color: var(--blue-dark);
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bar-track { height: 14px; background: #e8eef5; border-radius: 999px; overflow: hidden; }
.bar-track span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--orange)); border-radius: inherit; }
.bar-row strong { text-align: right; color: var(--text); }
.section-subtitle { margin: -4px 0 14px; color: var(--muted); font-weight: 700; }
.alert-panel { border-left: 5px solid var(--orange); background: #fff8f2; color: var(--blue-dark); margin-bottom: 18px; }
.alert-success { border-left: 5px solid var(--green); background: #eefaf2; color: #0f5d2a; margin-bottom: 18px; }
.badge-danger { background: #fff2f0; color: var(--red); }
.sticky-filters { position: sticky; top: 0; z-index: 5; }
.limited-table { max-height: 620px; overflow: auto; }
.limited-table thead th { position: sticky; top: 0; z-index: 2; }
.batch-toolbar {
    display: grid;
    grid-template-columns: max-content minmax(220px, 1fr) minmax(180px, 1fr) max-content;
    gap: 12px;
    align-items: end;
    margin-bottom: 14px;
}
.batch-toolbar label { display: grid; gap: 6px; font-weight: 800; color: var(--blue-dark); }
.batch-toolbar small { grid-column: 1 / -1; color: var(--muted); font-weight: 800; }
.checkline { display: inline-flex !important; grid-auto-flow: column; align-items: center; gap: 8px; }
.checkline input, [data-batch-item] { min-height: auto; }
.rescue-confirm-form { display: grid; gap: 14px; max-width: 620px; }
.rescue-confirm-form label { display: grid; gap: 7px; font-weight: 800; color: var(--blue-dark); }
.inline-warning { color: #9a3412; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 6px; padding: 8px; font-weight: 800; }
.filter-search { grid-column: span 2; }
.conversion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}
.conversion-grid strong {
    display: grid;
    gap: 6px;
    border-left: 4px solid var(--orange);
    background: #f8fbff;
    border-radius: 6px;
    padding: 12px;
    font-size: 24px;
}
.conversion-grid small { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.funnel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.funnel-step {
    border: 1px solid var(--line);
    border-top: 4px solid var(--orange);
    border-radius: 8px;
    background: #f8fbff;
    padding: 12px;
    display: grid;
    gap: 6px;
}
.funnel-step span { color: var(--blue-dark); font-weight: 900; font-size: 12px; }
.funnel-step strong { font-size: 24px; color: var(--text); }
.funnel-step small { color: var(--muted); font-weight: 800; }
.rescue-rates { margin-top: 12px; }
.compact-table { min-width: 520px; }
.rd-rescues-table { min-width: 1480px; }
.table-link { color: var(--blue); font-weight: 800; }
.row-note { display: block; margin-top: 4px; color: var(--muted); font-weight: 800; }
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(13, 39, 72, .52);
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 18px;
}
.modal-backdrop[hidden] { display: none; }
.modal-panel {
    width: min(900px, 100%);
    max-height: min(860px, calc(100vh - 36px));
    overflow: auto;
    background: var(--white);
    border-radius: 8px;
    border-top: 5px solid var(--orange);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
    padding: 20px;
}
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.modal-header h2 { margin: 0; color: var(--blue-dark); }
.modal-close {
    border: 0;
    background: #e8eef5;
    color: var(--blue-dark);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    font-size: 24px;
    cursor: pointer;
}
.modal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 14px; }
.modal-grid article, .last-notes {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbff;
    padding: 12px;
}
.modal-grid h3, .last-notes h3 { margin: 0 0 8px; color: var(--blue-dark); }
.modal-grid p { margin: 6px 0; }
.attendance-form { display: grid; gap: 12px; }
.attendance-form label { display: grid; gap: 6px; color: var(--blue-dark); font-weight: 800; }
textarea {
    border: 1px solid #c5cfda;
    border-radius: 6px;
    padding: 10px 11px;
    font: inherit;
    resize: vertical;
}
.last-notes article { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.last-notes p { margin: 5px 0 0; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; color: var(--muted); font-weight: 800; }
.rd-history-table { min-width: 1420px; }
.rd-detail-panel { margin-bottom: 18px; }
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}
.detail-grid article {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #f8fbff;
}
.detail-grid h3 { margin: 0 0 10px; color: var(--blue-dark); }
.detail-grid p { margin: 7px 0; }
.capture-page {
    min-height: 100vh;
    background: radial-gradient(circle at 50% 35%, #12638e 0%, #102d52 46%, #080d2f 100%);
    color: var(--white);
}
.capture-hero {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(360px, 430px);
    align-items: center;
    gap: 42px;
    width: min(1120px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 48px 0;
}
.capture-content { display: grid; gap: 28px; justify-items: start; }
.capture-logo { width: 178px; height: auto; }
.capture-copy h1 { margin: 0; font-size: 52px; line-height: .95; color: var(--orange); }
.capture-copy h1 span { display: block; color: var(--white); }
.capture-copy p { font-size: 20px; margin: 14px 0 0; color: #d8edf8; }
.capture-form-card {
    background: rgba(255, 255, 255, .96);
    color: var(--text);
    border-radius: 8px;
    padding: 24px;
    border-top: 5px solid var(--orange);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .24);
}
.capture-form-card .form { gap: 13px; }
.capture-form-card .form label span { color: var(--blue-dark); }
.btn-capture { width: 100%; min-height: 46px; background: var(--orange); color: var(--white); font-size: 15px; }
.privacy-note { color: var(--muted); margin: 2px 0 0; line-height: 1.4; }
.privacy-note a { color: var(--blue); font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.hp-field { position: absolute; left: -9999px; opacity: 0; }
.success-state { grid-template-columns: minmax(320px, 520px); justify-content: center; }
.success-card { text-align: center; }
.success-card .capture-logo { margin: 0 auto 18px; }
.success-card h1 { color: var(--blue-dark); margin: 0 0 8px; }
.success-card p { color: var(--muted); margin-bottom: 22px; }
.conversion-step { grid-template-columns: minmax(280px, 1fr) minmax(420px, 520px); }
.conversion-card { padding: 24px; }
.conversion-header { display: grid; gap: 7px; margin-bottom: 18px; }
.conversion-header h1 { margin: 0; color: var(--blue-dark); font-size: 24px; line-height: 1.18; }
.offer-box {
    border-radius: 8px;
    background: linear-gradient(135deg, #fff7f1, #ffffff);
    border: 1px solid #ffd7bd;
    border-left: 6px solid var(--orange);
    padding: 18px;
    margin: 18px 0;
    display: grid;
    gap: 5px;
}
.offer-box span {
    color: var(--orange);
    font-weight: 900;
    font-size: 13px;
}
.offer-box strong {
    color: var(--blue-dark);
    font-size: 36px;
    line-height: 1;
}
.offer-box small {
    color: var(--muted);
    font-weight: 800;
    line-height: 1.35;
}
.conversion-copy {
    color: var(--text);
    font-weight: 800;
    line-height: 1.45;
    margin: 0 0 16px;
}
.conversion-cta { text-align: center; text-decoration: none; }
.ingresso-step { grid-template-columns: minmax(280px, 1fr) minmax(420px, 500px); }
.ingresso-form-card { padding: 24px; }
.ingresso-card-header { display: grid; gap: 7px; margin-bottom: 18px; }
.step-label {
    color: var(--orange);
    font-weight: 900;
    font-size: 12px;
    text-transform: uppercase;
}
.ingresso-card-header h1 {
    margin: 0;
    color: var(--blue-dark);
    font-size: 24px;
    line-height: 1.15;
}
.ingresso-card-header p { margin: 0; color: var(--muted); line-height: 1.45; }
.journey-box {
    display: grid;
    gap: 12px;
    background: #f5f8fb;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 18px;
}
.journey-box div { display: grid; gap: 4px; }
.journey-box span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.journey-box strong { color: var(--text); line-height: 1.3; }
.ingresso-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.ingresso-option {
    width: 100%;
    min-height: 54px;
    border: 1px solid #cfd9e5;
    border-radius: 8px;
    background: #fff;
    color: var(--blue-dark);
    font-weight: 900;
    font-size: 14px;
    cursor: pointer;
    padding: 12px;
    text-align: left;
}
.ingresso-option:hover, .ingresso-option.selected {
    border-color: var(--orange);
    background: #fff7f1;
    color: var(--blue-ink);
}
.course-return-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 16px;
    color: var(--orange);
    font-weight: 800;
    text-decoration: none;
}
.course-return-link span { font-size: 18px; line-height: 1; }
.course-return-link:hover { filter: brightness(.9); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 1180px) {
    .dashboard-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .panel-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .brand img { width: 48px; }
    .main-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topbar { height: auto; padding: 14px; align-items: flex-start; }
    .topbar, .user-menu { flex-direction: column; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .content { padding: 14px; }
    .capture-hero { grid-template-columns: 1fr; align-items: start; gap: 24px; padding: 28px 0; }
    .capture-copy h1 { font-size: 40px; }
    .capture-logo { width: 138px; }
    .ingresso-step { grid-template-columns: 1fr; }
    .ingresso-options { grid-template-columns: 1fr; }
}
