/* ==============================================================
   LeadsManager — Find it Out Design
   Sistema de design: cores da marca + hierarquia tipográfica
   --------------------------------------------------------------
   Títulos H1/H2 ....... Rubik Black (900)
   Subtítulos H3/H4 .... Manrope SemiBold (600) / Bold (700)
   Texto corrido ....... Manrope Regular (400)
   Labels/captions/CTA . Manrope Medium (500)
   ============================================================== */

/* ---------- 1. Tokens ---------- */
:root {
    /* Cores da marca */
    --brand-yellow:  #ECD626;
    --brand-black:   #040006;
    --brand-white:   #FFFFFF;
    --brand-magenta: #D52941;
    --brand-orange:  #EC4E20;   /* complementar */

    /* Neutros derivados do preto da marca */
    --ink-900: #040006;
    --ink-800: #14121A;
    --ink-700: #2A2830;
    --ink-600: #4A4854;
    --ink-500: #6B6875;
    --ink-400: #9B99A3;
    --ink-300: #C9C7CF;
    --ink-200: #E5E4E9;
    --ink-100: #F1F0F4;
    --ink-050: #F8F7FA;

    /* Semânticas */
    --ok:      #12A150;
    --ok-bg:   #E8F7EE;
    --warn:    var(--brand-orange);
    --warn-bg: #FDEDE7;
    --err:     var(--brand-magenta);
    --err-bg:  #FCE9EC;
    --info:    #7A5AF8;
    --info-bg: #EFEBFE;

    /* Superfícies */
    --surface:        var(--brand-white);
    --surface-sunken: var(--ink-050);
    --border:         var(--ink-200);
    --border-strong:  var(--ink-300);

    /* Tipografia */
    --font-display: 'Rubik', 'Arial Black', system-ui, sans-serif;
    --font-body:    'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* Escala tipográfica */
    --fs-display: clamp(2.75rem, 6vw, 4.25rem);
    --fs-h1:      clamp(1.9rem, 3.4vw, 2.6rem);
    --fs-h2:      clamp(1.45rem, 2.4vw, 1.85rem);
    --fs-h3:      1.175rem;
    --fs-h4:      1rem;
    --fs-body:    0.9375rem;
    --fs-sm:      0.8125rem;
    --fs-xs:      0.6875rem;

    /* Espaçamento — generoso, para a leitura respirar */
    --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
    --sp-5: 24px;  --sp-6: 32px;  --sp-7: 48px;  --sp-8: 64px;  --sp-9: 96px;

    /* Raios e sombras */
    --r-sm: 8px;  --r-md: 14px;  --r-lg: 20px;  --r-xl: 28px;  --r-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(4, 0, 6, .05), 0 1px 3px rgba(4, 0, 6, .04);
    --shadow-md: 0 4px 12px rgba(4, 0, 6, .06), 0 2px 4px rgba(4, 0, 6, .04);
    --shadow-lg: 0 18px 40px rgba(4, 0, 6, .10), 0 4px 12px rgba(4, 0, 6, .05);
    --shadow-brand: 0 12px 28px rgba(213, 41, 65, .22);

    --sidebar-w: 268px;
    --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: 400;
    line-height: 1.65;
    color: var(--ink-800);
    background: var(--surface-sunken);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- 3. Hierarquia tipográfica ---------- */
h1, h2 {
    font-family: var(--font-display);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -0.025em;
    color: var(--ink-900);
    margin: 0;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }

h3, h4 {
    font-family: var(--font-body);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--ink-900);
    margin: 0;
}
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); font-weight: 600; }

p { margin: 0 0 var(--sp-4); }
p:last-child { margin-bottom: 0; }

.display {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: var(--fs-display);
    line-height: 1.02;
    letter-spacing: -0.035em;
}

.eyebrow {
    font-weight: 500;
    font-size: var(--fs-xs);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-500);
    margin: 0 0 var(--sp-3);
}

.lead-text { font-size: 1.0625rem; color: var(--ink-600); max-width: 62ch; }
.muted     { color: var(--ink-500); }
.small     { font-size: var(--fs-sm); }
.tabular   { font-variant-numeric: tabular-nums; }

/* ---------- 4. Estrutura ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--brand-black);
    color: var(--brand-white);
    display: flex;
    flex-direction: column;
    padding: var(--sp-6) var(--sp-4) var(--sp-5);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar__brand {
    display: block;
    padding: 0 var(--sp-3) var(--sp-6);
}
/* O logótipo tem proporção 724:150 — dimensionar pela largura. */
.sidebar__logo { width: 172px; max-width: 100%; height: auto; }
.sidebar__tag {
    font-size: var(--fs-xs);
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--brand-yellow);
    margin-top: var(--sp-3);
}

.nav { display: flex; flex-direction: column; gap: var(--sp-1); }
.nav__section {
    font-size: var(--fs-xs);
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .38);
    padding: var(--sp-5) var(--sp-3) var(--sp-2);
}
.nav__link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-3);
    border-radius: var(--r-sm);
    font-weight: 500;
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, .72);
    transition: background .18s var(--ease), color .18s var(--ease);
}
.nav__link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav__link.is-active {
    background: var(--brand-yellow);
    color: var(--brand-black);
    font-weight: 600;
}
.nav__link.is-active .nav__icon { opacity: 1; }
.nav__icon { width: 18px; height: 18px; opacity: .8; flex: 0 0 18px; }
.nav__badge {
    margin-left: auto;
    font-size: var(--fs-xs);
    font-weight: 600;
    background: rgba(255, 255, 255, .12);
    padding: 2px 8px;
    border-radius: var(--r-pill);
}
.nav__link.is-active .nav__badge { background: rgba(4, 0, 6, .14); }

.sidebar__footer { margin-top: auto; padding-top: var(--sp-6); }
.user-chip {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, .06);
}
.user-chip__avatar {
    width: 36px; height: 36px;
    flex: 0 0 36px;
    border-radius: var(--r-pill);
    background: var(--brand-magenta);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700; font-size: var(--fs-sm);
}
.user-chip__name { font-weight: 600; font-size: var(--fs-sm); line-height: 1.3; }
.user-chip__mail { font-size: var(--fs-xs); color: rgba(255,255,255,.5); overflow: hidden; text-overflow: ellipsis; }
.user-chip__out {
    margin-left: auto; background: none; border: 0; cursor: pointer;
    color: rgba(255,255,255,.5); padding: var(--sp-2); border-radius: var(--r-sm);
}
.user-chip__out:hover { color: var(--brand-yellow); background: rgba(255,255,255,.08); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: var(--sp-5) var(--sp-7);
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    position: sticky; top: 0; z-index: 20;
}
.topbar__title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar__actions { margin-left: auto; display: flex; gap: var(--sp-3); flex-shrink: 0; }

.content { padding: var(--sp-7); flex: 1; }
.content--narrow { max-width: 920px; }
.page-foot {
    padding: var(--sp-7) var(--sp-7) var(--sp-8);
    border-top: 1px solid var(--border);
    color: var(--ink-400);
    font-size: var(--fs-sm);
    display: flex; gap: var(--sp-5); flex-wrap: wrap; align-items: center;
}

/* ---------- 5. Cartões ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-6);
    box-shadow: var(--shadow-sm);
}
.card--flush { padding: 0; overflow: hidden; }
.card__head {
    display: flex; align-items: flex-start; gap: var(--sp-4);
    padding: var(--sp-6) var(--sp-6) var(--sp-4);
}
.card__head--bordered { border-bottom: 1px solid var(--border); padding-bottom: var(--sp-5); }
.card__head h3 { margin: 0; }
.card__head-actions { margin-left: auto; display: flex; gap: var(--sp-2); }
.card__body { padding: var(--sp-6); }
.card__body--tight { padding: var(--sp-5) var(--sp-6); }

.grid { display: grid; gap: var(--sp-5); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid--2     { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--3     { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stack       { display: flex; flex-direction: column; gap: var(--sp-5); }
.stack--lg   { gap: var(--sp-7); }
.row         { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }

/* ---------- 6. Cartões de estatística ---------- */
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-5) var(--sp-5) var(--sp-5);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.stat::after {
    content: ''; position: absolute; inset: 0 auto 0 0; width: 4px;
    background: var(--stat-accent, var(--brand-yellow));
}
.stat__label {
    font-weight: 500; font-size: var(--fs-xs);
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--ink-500);
    margin-bottom: var(--sp-3);
}
.stat__value {
    font-family: var(--font-display); font-weight: 900;
    font-size: 2.4rem; line-height: 1; letter-spacing: -0.03em;
    color: var(--ink-900);
    font-variant-numeric: tabular-nums;
}
.stat__meta { margin-top: var(--sp-3); font-size: var(--fs-sm); color: var(--ink-500); }

/* ---------- 7. Botões ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
    font-weight: 500; font-size: 0.9375rem; line-height: 1;
    padding: 13px var(--sp-5);
    border-radius: var(--r-pill);
    border: 1px solid transparent;
    cursor: pointer;
    text-align: center;
    transition: transform .12s var(--ease), box-shadow .18s var(--ease),
                background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(236, 214, 38, .6); outline-offset: 2px; }

.btn--primary {
    background: var(--brand-magenta); color: #fff; font-weight: 600;
    box-shadow: var(--shadow-brand);
}
.btn--primary:hover { background: #C0203A; }

.btn--accent {
    background: var(--brand-yellow); color: var(--brand-black); font-weight: 600;
}
.btn--accent:hover { background: #DBC61C; }

.btn--dark { background: var(--brand-black); color: #fff; font-weight: 600; }
.btn--dark:hover { background: var(--ink-700); }

.btn--ghost { background: var(--surface); color: var(--ink-800); border-color: var(--border-strong); }
.btn--ghost:hover { border-color: var(--ink-500); background: var(--ink-050); }

.btn--quiet { background: transparent; color: var(--ink-500); padding: 10px var(--sp-3); }
.btn--quiet:hover { color: var(--ink-900); background: var(--ink-100); }

.btn--danger { background: transparent; color: var(--err); border-color: rgba(213,41,65,.3); }
.btn--danger:hover { background: var(--err-bg); border-color: var(--err); }

.btn--sm { padding: 8px var(--sp-4); font-size: var(--fs-sm); }
.btn--block { width: 100%; }
.btn__icon { width: 17px; height: 17px; }

/* ---------- 8. Formulários ---------- */
.form { display: flex; flex-direction: column; gap: var(--sp-7); }

/* O `padding: 0` limpa o valor por omissão que o browser dá ao <fieldset>.
   Quando o <fieldset> é também um cartão, tem de recuperar o espaçamento do
   cartão — daí a segunda regra, mais específica, que não depende da ordem.
   O `min-width: 0` corrige a largura mínima que o browser impõe aos fieldsets. */
.fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.fieldset.card { padding: var(--sp-6); }
.fieldset__head { margin-bottom: var(--sp-5); padding-bottom: var(--sp-4); border-bottom: 1px solid var(--border); }
.fieldset__head h3 { margin-bottom: var(--sp-2); }
.fieldset__head p  { color: var(--ink-500); font-size: var(--fs-sm); margin: 0; max-width: 68ch; }

.field { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.field:last-child { margin-bottom: 0; }
.field--row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-5); }

.label {
    font-weight: 500; font-size: var(--fs-sm);
    color: var(--ink-700);
    display: flex; align-items: center; gap: var(--sp-2);
}
.label .req { color: var(--brand-magenta); font-weight: 700; }
.hint { font-size: var(--fs-sm); color: var(--ink-500); margin-top: var(--sp-1); }

.input, .select, .textarea {
    width: 100%;
    padding: 13px var(--sp-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink-900);
    font-size: var(--fs-body);
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand-black);
    box-shadow: 0 0 0 4px rgba(236, 214, 38, .35);
}
.textarea { resize: vertical; min-height: 130px; line-height: 1.7; }
.textarea--tall { min-height: 320px; }
.textarea--mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: var(--fs-sm); }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%234A4854' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--sp-4) center;
    padding-right: var(--sp-8);
}

.switch { display: flex; align-items: center; gap: var(--sp-3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
    width: 44px; height: 26px; flex: 0 0 44px;
    background: var(--ink-300); border-radius: var(--r-pill);
    position: relative; transition: background .2s var(--ease);
}
.switch__track::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #fff; box-shadow: var(--shadow-sm);
    transition: transform .2s var(--ease);
}
.switch input:checked + .switch__track { background: var(--ok); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 4px rgba(236,214,38,.4); }

.color-picker { display: flex; align-items: center; gap: var(--sp-3); }
.color-picker input[type="color"] {
    width: 52px; height: 44px; padding: 3px;
    border: 1px solid var(--border-strong); border-radius: var(--r-sm);
    background: var(--surface); cursor: pointer;
}

.form-actions {
    display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap;
    padding-top: var(--sp-5); border-top: 1px solid var(--border);
}
.form-actions .spacer { margin-left: auto; }

/* ---------- 9. Etiquetas ---------- */
.tag {
    display: inline-flex; align-items: center; gap: 6px;
    font-weight: 500; font-size: var(--fs-xs);
    letter-spacing: 0.04em;
    padding: 5px 11px;
    border-radius: var(--r-pill);
    background: var(--ink-100); color: var(--ink-700);
    white-space: nowrap;
}
.tag__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 7px; }
.tag--status { font-weight: 600; }
.tag--outline { background: transparent; border: 1px solid var(--border-strong); }

/* ---------- 10. Tabelas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.table th {
    text-align: left;
    font-weight: 500; font-size: var(--fs-xs);
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--ink-500);
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--border);
    background: var(--ink-050);
    white-space: nowrap;
}
.table td {
    padding: var(--sp-5);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr { transition: background .14s var(--ease); }
.table tbody tr:hover { background: var(--ink-050); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.is-numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .cell-title { font-weight: 600; color: var(--ink-900); display: block; }
.table .cell-sub   { font-size: var(--fs-sm); color: var(--ink-500); }
.table .cell-actions { text-align: right; white-space: nowrap; }

/* ---------- 11. Alertas ---------- */
.alert {
    display: flex; gap: var(--sp-4); align-items: flex-start;
    padding: var(--sp-4) var(--sp-5);
    border-radius: var(--r-md);
    border-left: 4px solid;
    font-size: 0.9375rem;
    margin-bottom: var(--sp-5);
}
.alert__icon { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 2px; }
.alert--success { background: var(--ok-bg);   border-color: var(--ok);   color: #0B6B36; }
.alert--error   { background: var(--err-bg);  border-color: var(--err);  color: #9A1B2E; }
.alert--warning { background: var(--warn-bg); border-color: var(--warn); color: #A83411; }
.alert--info    { background: var(--info-bg); border-color: var(--info); color: #4B32B5; }

/* ---------- 12. Estado vazio ---------- */
.empty {
    text-align: center;
    padding: var(--sp-9) var(--sp-6);
    max-width: 480px; margin: 0 auto;
}
.empty__mark {
    width: 76px; height: 76px; margin: 0 auto var(--sp-5);
    border-radius: var(--r-lg);
    display: grid; place-items: center;
    background: var(--brand-yellow);
    color: var(--brand-black);
}
.empty h3 { margin-bottom: var(--sp-3); }
.empty p  { color: var(--ink-500); margin-bottom: var(--sp-6); }

/* ---------- 13. Barras / gráficos simples ---------- */
.bars { display: flex; flex-direction: column; gap: var(--sp-4); }
.bar__top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; gap: var(--sp-3); }
.bar__name { font-weight: 500; font-size: var(--fs-sm); }
.bar__val  { font-weight: 700; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.bar__track { height: 9px; background: var(--ink-100); border-radius: var(--r-pill); overflow: hidden; }
.bar__fill  { height: 100%; border-radius: var(--r-pill); transition: width .5s var(--ease); }

.spark { display: flex; align-items: flex-end; gap: var(--sp-3); height: 132px; padding-top: var(--sp-4); }
.spark__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); height: 100%; justify-content: flex-end; }
.spark__bar {
    width: 100%; max-width: 46px;
    background: linear-gradient(180deg, var(--brand-yellow), #F4E163);
    border-radius: var(--r-sm) var(--r-sm) 4px 4px;
    min-height: 5px;
    transition: height .5s var(--ease);
}
.spark__col:last-child .spark__bar { background: linear-gradient(180deg, var(--brand-magenta), #E8546A); }
.spark__label { font-size: var(--fs-xs); font-weight: 500; color: var(--ink-500); }
.spark__value { font-size: var(--fs-xs); font-weight: 700; color: var(--ink-700); }

/* ---------- 14. Cronologia ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
    position: relative;
    padding: 0 0 var(--sp-5) var(--sp-6);
    border-left: 2px solid var(--border);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
    content: ''; position: absolute; left: -6px; top: 5px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--brand-yellow); border: 2px solid var(--surface);
    box-shadow: 0 0 0 2px var(--border);
}
.timeline__msg  { font-size: 0.9375rem; }
.timeline__meta { font-size: var(--fs-xs); color: var(--ink-400); margin-top: 2px; }

/* ---------- 15. Blocos de texto (preços / brief) ---------- */
.prose-block {
    background: var(--ink-050);
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand-yellow);
    border-radius: var(--r-md);
    padding: var(--sp-5);
    white-space: pre-wrap;
    line-height: 1.75;
    font-size: 0.9375rem;
    color: var(--ink-700);
    max-height: 420px;
    overflow-y: auto;
}
.prose-block--magenta { border-left-color: var(--brand-magenta); }

/* ---------- 16. Filtros ---------- */
.filters {
    display: grid;
    grid-template-columns: minmax(200px, 1.4fr) repeat(3, minmax(150px, 1fr)) auto;
    gap: var(--sp-3);
    align-items: end;
}
.filters .field { margin-bottom: 0; }

/* ---------- 17. Login (capa) ---------- */
.cover {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background: var(--brand-black);
}
.cover__brandside {
    padding: var(--sp-9) var(--sp-8);
    display: flex; flex-direction: column; justify-content: space-between;
    color: var(--brand-white);
    position: relative; overflow: hidden;
}
.cover__brandside::before {
    content: '';
    position: absolute; right: -180px; top: -120px;
    width: 520px; height: 520px; border-radius: 50%;
    background: radial-gradient(circle, rgba(236,214,38,.20), transparent 68%);
    pointer-events: none;
}
.cover__brandside::after {
    content: '';
    position: absolute; left: -140px; bottom: -180px;
    width: 460px; height: 460px; border-radius: 50%;
    background: radial-gradient(circle, rgba(213,41,65,.24), transparent 68%);
    pointer-events: none;
}
.cover__logo { width: 290px; max-width: 62%; height: auto; position: relative; }
.cover__headline { position: relative; margin: var(--sp-8) 0 var(--sp-6); }
/* Medida em `em` para acompanhar o tamanho do título, não o do texto corrido. */
.cover__headline .display { color: var(--brand-white); max-width: 9.5em; }
.cover__headline .display em { font-style: normal; color: var(--brand-yellow); }
.cover__sub { position: relative; color: rgba(255,255,255,.62); max-width: 46ch; font-size: 1.0625rem; }
.cover__marks { position: relative; display: flex; gap: var(--sp-3); margin-top: var(--sp-7); }
.cover__mark { width: 34px; height: 6px; border-radius: var(--r-pill); }
.cover__foot { position: relative; font-size: var(--fs-sm); color: rgba(255,255,255,.4); }

.cover__formside {
    background: var(--brand-white);
    display: flex; align-items: center; justify-content: center;
    padding: var(--sp-8) var(--sp-7);
}
.login-box { width: 100%; max-width: 400px; }
.login-box h1 { margin-bottom: var(--sp-3); }
.login-box > p { color: var(--ink-500); margin-bottom: var(--sp-7); }
.login-box .field { margin-bottom: var(--sp-5); }
.login-note {
    margin-top: var(--sp-7); padding-top: var(--sp-5);
    border-top: 1px solid var(--border);
    font-size: var(--fs-sm); color: var(--ink-400);
    display: flex; gap: var(--sp-3); align-items: flex-start;
}
.login-note svg { flex: 0 0 16px; margin-top: 3px; }

/* ---------- 18. Página de contacto (fecho) ---------- */
.closing {
    background: var(--brand-black);
    color: var(--brand-white);
    border-radius: var(--r-xl);
    padding: var(--sp-9) var(--sp-8);
    position: relative; overflow: hidden;
}
.closing::before {
    content: ''; position: absolute; right: -160px; bottom: -200px;
    width: 520px; height: 520px; border-radius: 50%;
    background: radial-gradient(circle, rgba(236,214,38,.16), transparent 70%);
}
.closing__inner { position: relative; max-width: 720px; }
.closing h2 { color: var(--brand-white); margin-bottom: var(--sp-5); }
.closing h2 em { font-style: normal; color: var(--brand-yellow); }
.closing p { color: rgba(255,255,255,.68); font-size: 1.0625rem; }
.contact-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--sp-6) var(--sp-7); margin-top: var(--sp-8); position: relative;
}
.contact-item__label {
    font-size: var(--fs-xs); font-weight: 500; letter-spacing: .14em;
    text-transform: uppercase; color: var(--brand-yellow); margin-bottom: var(--sp-2);
}
.contact-item__value {
    font-size: 1rem; font-weight: 600; color: #fff;
    overflow-wrap: break-word;   /* só parte se não couber mesmo */
}
.contact-item__value a:hover { color: var(--brand-yellow); }

/* ---------- 19. Utilitários ---------- */
.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--brand-yellow); color: var(--brand-black);
    padding: var(--sp-3) var(--sp-5); border-radius: 0 0 var(--r-sm) 0;
    font-weight: 600; z-index: 100;
}
.skip-link:focus { left: 0; }
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.inline-form { display: inline; }
.divider { height: 1px; background: var(--border); border: 0; margin: var(--sp-6) 0; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); } .mt-6 { margin-top: var(--sp-6); }
.mb-4 { margin-bottom: var(--sp-4); } .mb-5 { margin-bottom: var(--sp-5); } .mb-6 { margin-bottom: var(--sp-6); }

/* ---------- 20. Responsivo ---------- */
@media (max-width: 1080px) {
    .cover { grid-template-columns: 1fr; }
    .cover__brandside { padding: var(--sp-7) var(--sp-6); }
    .cover__headline { margin: var(--sp-6) 0 var(--sp-5); }
    .filters { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
    :root { --sidebar-w: 100%; }
    .shell { flex-direction: column; }
    .sidebar {
        position: static; height: auto; width: 100%; flex: none;
        padding: var(--sp-4);
        flex-direction: row; align-items: center; gap: var(--sp-4);
        overflow-x: auto;
    }
    .sidebar__brand { padding: 0 var(--sp-3) 0 0; flex: 0 0 auto; }
    .sidebar__logo { width: 140px; }
    .sidebar__tag { display: none; }
    .nav { flex-direction: row; gap: var(--sp-1); }
    .nav__section { display: none; }
    .nav__link { padding: var(--sp-2) var(--sp-3); white-space: nowrap; }
    .sidebar__footer { margin-top: 0; margin-left: auto; padding-top: 0; }
    .user-chip__name, .user-chip__mail { display: none; }
    .topbar, .content, .page-foot { padding-left: var(--sp-5); padding-right: var(--sp-5); }
    .content { padding-top: var(--sp-6); padding-bottom: var(--sp-6); }
    .filters { grid-template-columns: 1fr; }
    .closing { padding: var(--sp-7) var(--sp-5); }
}

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

@media print {
    .sidebar, .topbar__actions, .btn, .filters { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border-color: #ddd; }
}

/* ---------- 21. Pré-visualização da proposta ---------- */
.pdf-frame {
    display: block;
    width: 100%;
    height: min(78vh, 900px);
    border: 0;
    background: var(--ink-100);
}

/* Botão em espera durante uma geração longa */
.btn.is-working {
    pointer-events: none;
    opacity: .75;
}
.btn.is-working::before {
    content: '';
    width: 14px; height: 14px;
    margin-right: 2px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: lm-spin .7s linear infinite;
}
@keyframes lm-spin { to { transform: rotate(360deg); } }

/* ---------- 22. Mensagens de resposta à lead ---------- */
.msg {
    border: 1px solid var(--border);
    border-left: 4px solid var(--msg-accent, var(--ink-300));
    border-radius: var(--r-md);
    padding: var(--sp-5);
    background: var(--surface);
}
.msg__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-4);
}
.msg__icon {
    width: 30px; height: 30px;
    flex: 0 0 30px;
    border-radius: var(--r-sm);
    display: grid; place-items: center;
    background: var(--msg-accent, var(--ink-300));
    color: #fff;
}
/* O texto é para copiar tal e qual: preserva as quebras de linha. */
.msg__body {
    margin-top: var(--sp-4);
    padding: var(--sp-4) var(--sp-5);
    background: var(--ink-050);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    white-space: pre-wrap;
    line-height: 1.7;
    font-size: 0.9375rem;
    color: var(--ink-800);
}
.msg details summary { padding: var(--sp-2) 0; }

/* Confirmação de que o texto foi para a área de transferência */
.btn.is-copied {
    background: var(--ok);
    color: #fff;
    border-color: var(--ok);
}

/* ---------- 23. Autenticação em dois passos ---------- */
.input--code {
    font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
    font-size: 1.5rem;
    letter-spacing: 0.35em;
    text-align: center;
    padding-left: var(--sp-3);
}
.totp-setup {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--sp-6);
    align-items: start;
}
.totp-qr {
    background: #fff;
    padding: var(--sp-4);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    width: 220px;
    min-height: 220px;
    display: grid;
    place-items: center;
}
.totp-qr svg { width: 188px; height: 188px; display: block; }

/* Códigos de recuperação e chave manual: para copiar tal e qual */
.codes {
    font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    line-height: 2;
    white-space: pre-wrap;
    background: var(--ink-050);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-5);
    color: var(--ink-900);
}

@media (max-width: 720px) {
    .totp-setup { grid-template-columns: 1fr; }
}

/* ==============================================================
   24. Duas colunas: conteúdo + coluna lateral
   ==============================================================
   Estava em `style=` directo nas views, e um estilo inline não pode
   ser sobreposto por uma media query — as colunas nunca colapsavam
   e sobrepunham-se no telemóvel. Fica aqui, para poder respirar.

   A proporção da coluna principal muda por view, através da
   variável --split-main. */

.split {
    display: grid;
    grid-template-columns: minmax(0, var(--split-main, 1.65fr)) minmax(280px, 1fr);
    align-items: start;
    gap: var(--sp-6);
}

@media (max-width: 900px) {
    .split { grid-template-columns: 1fr; }

    /* Na ficha da lead, a coluna lateral sobe: mudar o estado, ver o
       histórico e eliminar ficam à mão, sem percorrer as mensagens
       e a proposta todas primeiro. */
    .split__side { order: -1; }
}

/* ==============================================================
   25. Espera pela geração da proposta
   ==============================================================
   A proposta é escrita no servidor, sem ligação a esta página. O
   indicador serve só para dizer que alguma coisa está a acontecer;
   quem manda é a pergunta periódica ao servidor. */

.spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto var(--sp-5);
    border: 3px solid var(--ink-100);
    border-top-color: var(--info);
    border-radius: 50%;
    animation: girar 900ms linear infinite;
}

@keyframes girar {
    to { transform: rotate(360deg); }
}

/* Quem pediu para reduzir movimento continua a precisar de saber que
   há trabalho a decorrer: em vez de rodar, respira. */
@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation: respirar 1.6s ease-in-out infinite;
        border-top-color: var(--ink-100);
        background: var(--info);
    }
    @keyframes respirar {
        0%, 100% { opacity: 0.35; }
        50%      { opacity: 1; }
    }
}

/* ==============================================================
   26. Avisos — "a proposta está pronta"
   ==============================================================
   Aparecem em qualquer página do painel quando uma proposta que
   estava a ser gerada fica pronta ou falha. Ficam até serem
   fechados: o objectivo é que se dê por eles. */

.avisos {
    position: fixed;
    right: var(--sp-5);
    bottom: var(--sp-5);
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    width: min(360px, calc(100vw - 2 * var(--sp-5)));
    pointer-events: none;
}

.aviso {
    position: relative;
    pointer-events: auto;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-left: 5px solid var(--ok);
    border-radius: var(--r-md);
    padding: var(--sp-4) var(--sp-5) var(--sp-5);
    box-shadow: 0 12px 32px rgba(4, 0, 6, 0.16);
    animation: aviso-entrar 260ms ease-out;
}
.aviso--erro { border-left-color: var(--brand-magenta); }

.aviso strong { display: block; margin-bottom: var(--sp-1); padding-right: var(--sp-6); }
.aviso p      { margin: 0 0 var(--sp-4); color: var(--ink-600, #5b5866); font-size: var(--fs-sm); }

.aviso__fechar {
    position: absolute;
    top: var(--sp-2);
    right: var(--sp-3);
    border: 0;
    background: none;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--ink-500, #8a8795);
    cursor: pointer;
    padding: var(--sp-1);
}

@keyframes aviso-entrar {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .aviso { animation: none; }
}
@media (max-width: 720px) {
    .avisos { right: var(--sp-3); left: var(--sp-3); bottom: var(--sp-3); width: auto; }
}

/* ==============================================================
   27. Rentabilidade — colunas de números
   ============================================================== */
.table .num    { text-align: right; }
.table td.num { white-space: nowrap; }

/* O quadro por origem tem dez colunas: cabeçalhos em duas linhas e
   espaçamento mais curto, para caber sem deslizar num ecrã de portátil. */
.table--rent { font-size: var(--fs-sm); }
.table--rent th { white-space: normal; line-height: 1.3; vertical-align: bottom; }
.table--rent th, .table--rent td { padding-left: var(--sp-3); padding-right: var(--sp-3); }
.table--rent th:first-child, .table--rent td:first-child { padding-left: var(--sp-6); }
.table--rent th:last-child,  .table--rent td:last-child  { padding-right: var(--sp-6); }
.table--rent .destaque { display: block; margin-top: 4px; font-size: var(--fs-xs); font-weight: 700; color: var(--ok); }
