@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
    --blue-900: #073769;
    --blue-800: #064b8f;
    --blue-700: #075ba8;
    --yellow: #f5c400;
    --ink: #14283d;
    --muted: #627386;
    --line: #d8e1ea;
    --surface: #fff;
    --canvas: #eef3f7;
    --font: "Inter", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; min-height: 100%; }
body { overflow: hidden; font-family: var(--font); color: var(--ink); background: var(--canvas); }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }

.app-shell {
    width: min(1180px, 100%);
    height: 100dvh;
    margin: 0 auto;
    padding: 18px 22px 12px;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 12px;
}

.app-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; min-width: 0; gap: 11px; }
.brand-mark {
    width: 40px; height: 40px; flex: 0 0 40px;
    display: grid; place-items: center;
    border-radius: 10px; color: #fff; background: var(--blue-800);
    font-size: 1.05rem; font-weight: 700; letter-spacing: -.06em;
    box-shadow: inset 0 -4px 0 var(--yellow);
}
.brand-copy { min-width: 0; }
.brand-copy strong { display: block; color: var(--blue-900); font-size: 1rem; line-height: 1.2; }
.brand-copy span { display: block; margin-top: 2px; color: var(--muted); font-size: .74rem; }
.header-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .75rem; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #23a26d; box-shadow: 0 0 0 3px #dff5eb; }

.course-nav {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #e4ebf2;
}
.course-nav button {
    min-width: 0; min-height: 42px; padding: 8px 12px;
    border: 0; border-radius: 9px; color: #526578; background: transparent;
    font-size: .82rem; font-weight: 600; cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.course-nav button:hover { color: var(--blue-800); background: rgba(255,255,255,.58); }
.course-nav button.is-active { color: var(--blue-900); background: #fff; box-shadow: 0 1px 4px rgba(27,49,73,.12); }

.workspace {
    min-height: 0; overflow: hidden;
    display: grid; grid-template-columns: minmax(240px,.72fr) minmax(470px,1.28fr);
    border: 1px solid var(--line); border-radius: 18px; background: var(--surface);
    box-shadow: 0 16px 40px rgba(33,56,82,.09);
}
.course-panel {
    position: relative; min-height: 0; overflow: hidden;
    display: flex; flex-direction: column; padding: clamp(20px,3vh,30px);
    color: #fff; background: var(--blue-900);
}
.course-panel::after { content: ""; position: absolute; top: 0; right: 0; width: 5px; height: 100%; background: var(--yellow); }
.course-kicker { position: relative; z-index: 1; color: #b8d4ef; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.course-panel h1 { position: relative; z-index: 1; margin-top: 9px; max-width: 360px; color: #fff; font-size: clamp(1.45rem,3vw,2.2rem); line-height: 1.08; letter-spacing: -.035em; }
.course-panel > p { position: relative; z-index: 1; max-width: 330px; margin-top: 12px; color: #d3e2f0; font-size: .84rem; line-height: 1.5; }
.course-image { position: relative; min-height: 0; flex: 1; margin-top: 20px; overflow: hidden; border: 1px solid rgba(255,255,255,.16); border-radius: 12px; background: #0c457b; }
.course-image img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center; opacity: .92; }

.form-card { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: clamp(20px,3vh,30px) clamp(22px,3.5vw,42px); }
.form-header { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: clamp(16px,2.6vh,24px); }
.form-header h2 { color: var(--blue-900); font-size: clamp(1.25rem,2.3vw,1.7rem); line-height: 1.15; letter-spacing: -.025em; }
.form-header p { max-width: 310px; color: var(--muted); font-size: .78rem; line-height: 1.45; text-align: right; }
.formulario { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: clamp(12px,2vh,18px) 16px; }
.input-group { min-width: 0; display: grid; gap: 6px; }
.input-group[hidden] { display: none; }
.input-group label { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: #344a60; font-size: .76rem; font-weight: 600; }
.cpf-lookup-status { overflow: hidden; color: var(--muted); font-size: .64rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.cpf-lookup-status[data-state="loading"] { color: var(--blue-700); }
.cpf-lookup-status[data-state="success"] { color: #16805a; }
.cpf-lookup-status[data-state="warning"] { color: #9a6700; }
input {
    width: 100%; height: 46px; min-width: 0; padding: 0 13px;
    border: 1px solid #cbd6e0; border-radius: 9px; outline: 0;
    color: var(--ink); background: #fbfcfd; font-size: .9rem;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}
input::placeholder { color: #95a2af; }
input:hover { border-color: #aab8c6; }
input:focus { border-color: var(--blue-700); background: #fff; box-shadow: 0 0 0 3px rgba(7,91,168,.12); }
input[readonly] { color: #40566c; background: #eef2f6; cursor: default; }
input[readonly]:focus { border-color: #cbd6e0; background: #eef2f6; box-shadow: none; }
.submit-button {
    grid-column: 1 / -1; min-height: 48px; margin-top: 2px;
    border: 0; border-radius: 9px; color: #fff; background: var(--blue-800);
    font-size: .88rem; font-weight: 700; cursor: pointer;
    box-shadow: 0 7px 16px rgba(6,75,143,.2);
    transition: background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.submit-button:hover { background: var(--blue-900); box-shadow: 0 9px 20px rgba(6,75,143,.24); transform: translateY(-1px); }
.submit-button:active { transform: translateY(0); }
.app-footer { color: #708090; font-size: .68rem; text-align: center; }
.autor-link { color: var(--blue-800); font-weight: 600; text-decoration: none; }
.autor-link:hover { text-decoration: underline; }

.resultado-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.resultado-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.resultado-card { min-height: 72px; display: grid; align-content: start; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; text-align: left; background: #f7f9fb; }
.resultado-label { color: var(--muted); font-size: .73rem; font-weight: 600; }
.resultado-value { color: var(--blue-900); font-size: .9rem; line-height: 1.35; overflow-wrap: anywhere; }
.swal-helper-text { margin-top: 12px; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.swal-pdf-button { min-height: 42px; margin-top: 14px; padding: 0 16px; border: 0; border-radius: 8px; color: #fff; background: var(--blue-800); font-size: .82rem; font-weight: 700; cursor: pointer; }
.swal2-popup { width: min(40rem,calc(100vw - 24px)) !important; max-width: calc(100vw - 24px) !important; max-height: calc(100dvh - 24px) !important; overflow-y: auto !important; border-radius: 14px !important; }
.swal2-title { color: var(--blue-900) !important; font-size: 1.35rem !important; }
.swal2-html-container { overflow-wrap: anywhere; }
.swal2-actions { flex-wrap: wrap; gap: 8px; }
.swal2-actions button { margin: 0 !important; border-radius: 8px !important; }

@media (max-width: 760px) {
    .app-shell { padding: 10px 10px 7px; gap: 8px; }
    .brand-mark { width: 34px; height: 34px; flex-basis: 34px; font-size: .9rem; }
    .brand-copy strong { font-size: .88rem; }
    .brand-copy span, .header-status { font-size: .64rem; }
    .course-nav button { min-height: 38px; padding: 6px 4px; font-size: .68rem; line-height: 1.15; }
    .workspace { grid-template-columns: 1fr; grid-template-rows: auto minmax(0,1fr); border-radius: 14px; }
    .course-panel { min-height: 82px; padding: 12px 14px 13px; justify-content: center; }
    .course-panel::after { inset: auto 0 0; width: 100%; height: 4px; }
    .course-kicker { font-size: .58rem; }
    .course-panel h1 { margin-top: 4px; padding-right: 76px; font-size: 1.12rem; }
    .course-panel > p { display: none; }
    .course-image { position: absolute; top: 10px; right: 14px; width: 62px; height: 62px; min-height: auto; margin: 0; border-radius: 9px; }
    .form-card { padding: 14px; }
    .form-header { align-items: center; margin-bottom: 12px; }
    .form-header h2 { font-size: 1.05rem; }
    .form-header p { max-width: 150px; font-size: .63rem; line-height: 1.3; }
    .formulario { gap: 10px 8px; }
    .input-group { gap: 4px; }
    .input-group label { overflow: hidden; font-size: .64rem; text-overflow: ellipsis; white-space: nowrap; }
    input { height: 40px; padding: 0 9px; font-size: .78rem; }
    .submit-button { min-height: 42px; font-size: .8rem; }
    .app-footer { font-size: .58rem; }
    .resultado-card { min-height: 60px; padding: 8px; }
}

@media (max-height: 650px) {
    .app-shell { padding-top: 7px; gap: 6px; }
    .course-nav button { min-height: 34px; }
    .course-panel { padding-top: 12px; padding-bottom: 12px; }
    .course-image { margin-top: 12px; }
    .form-card { padding-top: 14px; padding-bottom: 14px; }
    .form-header { margin-bottom: 10px; }
    .formulario { gap: 9px 12px; }
    input { height: 38px; }
    .submit-button { min-height: 40px; }
}

@media (max-width: 370px) {
    .header-status { display: none; }
    .course-nav button { font-size: .62rem; }
    .form-card { padding-left: 10px; padding-right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
