/* Free tools on the public site (spec-ferramentas-gratis). Loaded after landing.css and built on its tokens
   (--fg, --dim, --surf, --hair, --brand...): same visual language as the home page, no output.css / Tailwind,
   like the rest of the marketing pages. */

/* ---------- headline ---------- */
/* Compact on purpose: at 1366x768 the form has to start above the fold. */
.thero { position: relative; overflow: clip; padding: clamp(20px, 3.5vh, 36px) 0 clamp(24px, 4vh, 36px); }
.thero-h1 { margin: 12px 0 12px; max-width: 24ch; font-size: clamp(1.9rem, 4.2vw, 3rem); }
.thero-lede { max-width: 64ch; margin-bottom: 14px; font-size: clamp(1rem, 1.6vw, 1.1rem); }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin-bottom: 14px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.crumbs li + li::before { content: "/"; margin-right: 6px; opacity: .6; }
.crumbs a { color: var(--dim); }
.crumbs a:hover { color: var(--fg); }

/* ---------- sections: shorter than the home page, a tool page is a working page ---------- */
.tool-sec { padding: clamp(44px, 7vh, 84px) 0; }
.tool-main { padding-top: 0; }
.tool-h2 { margin: 16px 0 20px; }

/* ---------- form + result ---------- */
/* minmax(0, 1fr): without it the wide income-statement table stretches the column past a phone screen. */
.tool-grid { display: grid; gap: 22px; align-items: start; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
    .tool-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 34px; }
    .tool-result { position: sticky; top: 96px; }
}

.tool-form { background: var(--surf); border: 1px solid var(--hair); border-radius: var(--r); padding: 22px 20px 24px; display: grid; gap: 22px; }
.tool-form fieldset { border: 0; display: grid; gap: 14px; min-width: 0; }
.tf-legend { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.tf-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }

.tf { display: grid; gap: 6px; min-width: 0; }
.tf-label { font-size: .88rem; font-weight: 600; color: var(--fg); }
.tf-box {
    display: flex; align-items: center; min-height: 46px;
    background: var(--bg); border: 1px solid var(--hair-strong); border-radius: var(--r);
    transition: border-color .18s var(--ease);
}
.tf-box:focus-within { border-color: var(--brand-bright); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.tf-affix { padding: 0 12px; font-family: var(--mono); font-size: 13px; color: var(--faint); white-space: nowrap; }
.tf-input {
    flex: 1; min-width: 0; width: 100%; height: 44px; padding: 0 12px;
    background: transparent; border: 0; outline: 0; color: var(--fg);
    font-family: var(--mono); font-size: 16px; /* 16px keeps iOS from zooming on focus */
}
.tf-affix + .tf-input { padding-left: 0; }
.tf-area { height: auto; min-height: 104px; padding: 10px 12px; resize: vertical; line-height: 1.45; font-size: 15px; }
.tf-check { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; background: var(--bg); border: 1px solid var(--hair-strong); border-radius: var(--r); cursor: pointer; font-size: .95rem; }
.tf-check input { width: 20px; height: 20px; accent-color: var(--brand); }
.tr-title { font-family: var(--display); font-weight: 700; font-size: clamp(1.3rem, 3vw, 1.7rem); line-height: 1.15; margin: 10px 0 10px; }
.tf-hint { font-size: 12.5px; line-height: 1.45; color: var(--faint); }

.tool-submit { justify-self: start; }
/* With JavaScript the result follows each keystroke, so the button only matters without it. */
.js .tool-submit { display: none; }

.tool-result .tr-card { background: var(--surf); border: 1px solid var(--hair); border-left: 2px solid var(--brand); border-radius: var(--r); padding: 26px 24px; }
.tr-k { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.tr-v { font-family: var(--display); font-weight: 800; font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: .95; margin: 10px 0 8px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.tr-v small { font-size: .38em; font-weight: 600; letter-spacing: 0; color: var(--dim); margin-left: 6px; }
.tr-v.g { color: var(--money); }
.tr-v.neg { color: var(--warn); }
.tr-note { font-size: .9rem; color: var(--dim); }
.tr-note b { color: var(--fg); }
.tr-rows { margin-top: 18px; border-top: 1px solid var(--hair); }
.tr-gap { margin-top: 26px; }
.tr-warn { margin-top: 16px; padding: 10px 14px; border-left: 2px solid var(--warn); font-size: .88rem; color: var(--fg); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.srow .v.neg { color: var(--warn); }

.tool-error { background: var(--surf); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); border-left: 2px solid var(--warn); border-radius: var(--r); padding: 18px 20px; color: var(--fg); font-size: .95rem; }
.tool-error:empty { display: none; }

/* income statement table of the profit tool */
.tr-table-wrap { margin-top: 18px; overflow-x: auto; }
.tr-table { width: 100%; border-collapse: collapse; font-size: .84rem; min-width: 420px; }
.tr-table th, .tr-table td { padding: 9px 8px; text-align: right; border-bottom: 1px solid var(--hair); white-space: nowrap; }
.tr-table th:first-child, .tr-table td:first-child { text-align: left; }
.tr-table thead th { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 500; }
.tr-table td { font-family: var(--mono); }
.tr-table tr.total td { color: var(--fg); font-weight: 600; }

/* ---------- closing call ---------- */
.tool-cta { padding: clamp(40px, 6vh, 72px) 0; }
.cta-card { background: var(--surf); border: 1px solid var(--brand); border-radius: var(--r); padding: 28px 24px; box-shadow: rgba(0, 100, 224, .18) 0 20px 50px; max-width: 860px; }
.cta-card .h-md { margin: 14px 0 12px; }
.cta-text { color: var(--dim); max-width: 62ch; }
.cta-plan { margin-top: 12px; font-size: .9rem; color: var(--faint); }
.cta-plan b { color: var(--fg); }
.cta-card .hero-cta { margin: 20px 0 0; }

/* ---------- long text ---------- */
.prose p, .prose ol, .prose ul { color: var(--dim); margin-bottom: 14px; max-width: 72ch; }
.prose ol, .prose ul { padding-left: 22px; display: grid; gap: 8px; }
.prose b { color: var(--fg); font-weight: 650; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- tool cards (index and "veja também") ---------- */
.tgrid { display: grid; gap: 1px; background: var(--hair); border: 1px solid var(--hair); border-radius: var(--r); overflow: hidden; }
@media (min-width: 700px) { .tgrid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .tgrid { grid-template-columns: repeat(3, 1fr); } }
.tcard-link { background: var(--bg); padding: 24px 22px 26px; display: flex; flex-direction: column; gap: 10px; position: relative; transition: background-color .22s var(--ease); }
.tcard-link:hover { background: var(--surf); }
.tcard-link::before { content: ""; position: absolute; left: 0; top: 0; width: 0; height: 2px; background: var(--brand); transition: width .32s var(--ease); }
.tcard-link:hover::before { width: 100%; }
.tcard-meta { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.tcard-sum { font-size: .88rem; color: var(--dim); flex: 1; }
.tcard-go { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.tool-all { margin-top: 18px; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.tool-all a { color: var(--accent); }

.tool-index { padding-top: 0; }
.tfilter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 30px; }
.tchip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; cursor: pointer; background: transparent; color: var(--dim); border: 1px solid var(--hair-strong); border-radius: var(--r); font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.tchip span { color: var(--faint); }
.tchip:hover { color: var(--fg); }
.tchip.on { background: var(--brand-grad); border-color: transparent; color: #fff; }
.tchip.on span { color: rgba(255, 255, 255, .8); }
.tgroup + .tgroup { margin-top: 44px; }
.tgroup .tool-h2 { margin: 0 0 6px; }
.tgroup-desc { color: var(--dim); margin-bottom: 18px; font-size: .95rem; }
.tgroup[hidden] { display: none; }

@media (max-width: 520px) {
    .tf-row { grid-template-columns: 1fr; }
}

.tr-words { font-size: 1.25rem; line-height: 1.45; color: var(--fg); margin: 12px 0 18px; }

/* ---------- printable sheet (OS, orçamento, recibo) ----------
   A sheet of paper on the dark page: the sheet is the form and the printout at the same time, so it uses its own
   light colours instead of the page tone tokens. */
.doc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.doc-privacy { font-size: 13px; color: var(--faint); flex-basis: 100%; }

.sheet {
    --paper: #FFFFFF; --ink: #101722; --ink-dim: #5A6577; --rule: #D5DBE5;
    background: var(--paper); color: var(--ink); border-radius: var(--r);
    padding: clamp(18px, 4vw, 40px); max-width: 960px;
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .7);
    font-size: 14px; line-height: 1.5;
}
.sh-in {
    width: 100%; min-width: 0; min-height: 34px; padding: 4px 6px;
    background: transparent; color: var(--ink); border: 0; border-bottom: 1px solid var(--rule); border-radius: 0;
    font: inherit;
}
.sh-in::placeholder { color: #9AA4B4; }
.sh-in:focus { outline: 0; border-bottom-color: var(--brand-deep); background: #F2F7FF; }
.sh-strong { font-family: var(--display); font-weight: 700; font-size: 1.15rem; }
.sh-sel { appearance: auto; }

.sh-head { display: grid; gap: 18px; padding-bottom: 18px; border-bottom: 2px solid var(--ink); }
@media (min-width: 720px) { .sh-head { grid-template-columns: 1fr 240px; } }
.sh-shop { display: grid; gap: 2px; }
.sh-title { display: grid; gap: 6px; align-content: start; }
.sh-kind { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 1.5rem; letter-spacing: -.02em; line-height: 1; margin-bottom: 4px; }
.sh-mini { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .06em; }
.sh-num { max-width: 90px; }
.sh-date { max-width: 170px; }
.sh-amount { font-size: 1.1rem; color: var(--ink); font-weight: 700; }
.sh-amount .sh-in { font-weight: 700; font-size: 1.1rem; }

.sh-block { padding: 16px 0; border-bottom: 1px solid var(--rule); }
.sh-label { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 4px; }
.sh-grid { display: grid; gap: 4px 14px; }
@media (min-width: 640px) {
    .sh-grid-2 { grid-template-columns: 2fr 1fr; }
    .sh-grid-4 { grid-template-columns: 1fr 2fr 1fr 1fr; }
}
.sh-wide { margin-top: 6px; }

.sh-items { width: 100%; border-collapse: collapse; }
.sh-items th { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--ink); }
.sh-items td { padding: 2px 4px; vertical-align: middle; }
.sh-items .c-kind { width: 110px; }
.sh-items .c-num { width: 104px; text-align: right; }
.sh-items .c-num .sh-in { text-align: right; }
.sh-items .c-total { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.sh-items .c-del { width: 36px; text-align: center; }
.sh-del { width: 32px; height: 32px; border: 0; background: transparent; color: var(--ink-dim); font-size: 20px; cursor: pointer; border-radius: 4px; }
.sh-del:hover { background: #F2F4F8; color: #B42318; }
.sh-add { margin-top: 10px; padding: 8px 12px; border: 1px dashed var(--rule); background: transparent; color: var(--brand-deep); font: inherit; font-weight: 600; cursor: pointer; border-radius: 4px; }
.sh-error { color: #B42318; font-size: 13px; margin-top: 8px; }
.sh-error:empty { display: none; }

/* Below tablet width each line becomes a small card: type and description on top, the numbers underneath. */
@media (max-width: 719px) {
    .sh-items thead { display: none; }
    .sh-items, .sh-items tbody { display: block; }
    .sh-items tr { display: grid; grid-template-columns: 1fr 1fr 1fr 36px; gap: 2px 8px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
    .sh-items td { display: block; width: auto !important; padding: 0; }
    .sh-items td:nth-child(1) { grid-column: 1 / 2; }
    .sh-items td:nth-child(2) { grid-column: 2 / 5; }
    .sh-items td:nth-child(6) { grid-column: 1 / 4; text-align: right; padding-top: 4px; }
    .sh-items td:nth-child(7) { grid-row: 2; grid-column: 4; }
    /* The column headers are hidden on a phone, so each number cell names itself. */
    .sh-items td[data-label]::before { content: attr(data-label); display: block; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); text-align: right; }
}

.sh-foot { display: grid; gap: 18px; padding: 16px 0; }
@media (min-width: 720px) { .sh-foot { grid-template-columns: 1fr 280px; } }
.sh-area { resize: vertical; border: 1px solid var(--rule); border-radius: 4px; margin-bottom: 10px; }
.sh-totals { display: grid; gap: 4px; align-content: start; }
.sh-totals div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--rule); }
.sh-totals dt { color: var(--ink-dim); }
.sh-totals dd { font-variant-numeric: tabular-nums; font-weight: 600; }
.sh-totals .sh-grand { border-bottom: 2px solid var(--ink); font-size: 1.15rem; }
.sh-totals .sh-grand dt { color: var(--ink); font-weight: 700; }

.sh-sign { display: grid; gap: 30px; padding-top: 44px; }
@media (min-width: 640px) { .sh-sign { grid-template-columns: 1fr 1fr; } }
.sh-sign-one { grid-template-columns: minmax(0, 420px) !important; justify-content: center; }
.sh-line { display: block; border-top: 1px solid var(--ink); }
.sh-sign p { font-size: 12px; color: var(--ink-dim); text-align: center; margin-top: 6px; }
.sh-center { text-align: center; border-bottom: 0; }

.sh-receipt-body { padding: 22px 0 6px; font-size: 15px; line-height: 2.1; }
.sh-receipt-body p + p { margin-top: 8px; }
.sh-inline { display: inline-block; width: auto; min-width: 140px; }
.sh-inline-wide { min-width: min(320px, 100%); }
.sh-words { font-weight: 600; }
.sh-place { text-align: right; }

/* ---------- print: only the sheet goes to paper ---------- */
@media print {
    @page { margin: 12mm; }
    body { background: #fff !important; color: #000; }
    body > *:not(.tool-doc-sec), .no-print, .doc-actions, .sh-add, .sh-del, noscript { display: none !important; }
    .tool-doc-sec { padding: 0 !important; }
    .tool-doc-sec .wrap { padding: 0; max-width: none; }
    .sheet { box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
    .sh-in { border-bottom-color: transparent; }
    .sh-in::placeholder { color: transparent; }
    .sh-area { border-color: transparent; }
    .sh-sel { appearance: none; }
}
