:root {
    --color-primary: #087f5b;
    --color-primary-dark: #066347;
    --color-text: #18312d;
    --color-muted: #64756f;
    --color-border: #dce6e1;
    --color-surface: #fff;
    --color-bg: #f4f7f5;
    --color-soft: #eaf4ee;
    --radius-card: 20px;
    --shadow-card: 0 5px 24px rgba(25,58,44,.045);
    --app-header-top: 0px;
    --app-scroll-padding: 104px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; scroll-padding-top: var(--app-scroll-padding); }
body { margin: 0; background: var(--color-bg); color: var(--color-text); font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
svg { display: block; flex-shrink: 0; }
img { max-width: 100%; }
a { color: var(--color-primary); text-underline-offset: 3px; }
h1, h2, h3 { color: var(--color-text); line-height: 1.2; letter-spacing: -.035em; }
h1 { font-size: clamp(28px, 3.1vw, 38px); font-weight: 700; }
h2 { font-size: 22px; font-weight: 650; }
p { line-height: 1.65; }
::selection { background: #cbeedb; color: #11382a; }
:focus-visible { outline: 3px solid #73bd9c; outline-offset: 4px; }
.app-header { position: sticky; top: var(--app-header-top); z-index: 150; background: #fff; border-bottom: 1px solid var(--color-border); box-shadow: 0 4px 18px rgba(25,58,44,.05); }
.app-header-inner { max-width: 1280px; min-height: 86px; margin: auto; padding: 18px 28px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--color-text); text-decoration: none; flex-shrink: 0; }
.app-brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--color-text); color: #8dd8b1; }
.app-brand-name { display: block; font-size: 16px; font-weight: 750; letter-spacing: -.03em; line-height: 1.2; }
.app-brand-caption { display: block; margin-top: 3px; font-size: 11px; color: var(--color-muted); letter-spacing: .025em; }
.app-nav { display: flex; gap: 4px; align-items: center; }
.app-nav a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; border-radius: 10px; color: var(--color-muted); text-decoration: none; font-size: 13px; font-weight: 600; white-space: nowrap; }
.app-nav a:hover { background: #f2f6f3; color: var(--color-text); }
.app-nav a[aria-current="page"] { background: var(--color-soft); color: var(--color-primary-dark); }
.app-main { min-height: calc(100vh - 170px); }
.app-footer { max-width: 1160px; margin: auto; padding: 24px 28px 30px; display: flex; justify-content: space-between; gap: 16px; color: var(--color-muted); font-size: 12px; border-top: 1px solid var(--color-border); }
.app-footer span:first-child { font-weight: 600; }
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 200; background: var(--color-text); color: #fff; padding: 12px 18px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.container { max-width: 1160px; margin: auto; padding: 36px 28px; }
.primary-button, .primary-form-button, .primary-link-button, .primary-simulator-button, .primary-dashboard-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 12px 20px; border: 1px solid var(--color-primary); border-radius: 12px; background: var(--color-primary); color: #fff; font-size: 14px; font-weight: 650; line-height: 1.35; text-decoration: none; cursor: pointer; box-shadow: 0 3px 6px rgba(8,127,91,.08); transition: background .18s, box-shadow .18s, transform .18s; }
.primary-button:hover, .primary-form-button:hover, .primary-link-button:hover, .primary-simulator-button:hover, .primary-dashboard-button:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); box-shadow: 0 5px 14px rgba(8,127,91,.16); transform: translateY(-1px); }
.secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 11px 18px; border: 1px solid var(--color-border); border-radius: 11px; background: #fff; color: var(--color-text); font-size: 14px; font-weight: 600; line-height: 1.35; text-decoration: none; transition: background .18s, border-color .18s; }
.secondary-button:hover { background: #f3f8f5; border-color: #b9cdc1; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; color: var(--color-muted); font-size: 13px; font-weight: 600; text-decoration: none; padding: 4px 0; }
.back-link:hover { color: var(--color-primary); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--color-border); }
.field-help { display: block; margin: 8px 0; font-size: 12px; line-height: 1.55; color: var(--color-muted); }
.alert-error { margin: 16px 0; padding: 14px 18px; background: #fff2f0; border: 1px solid #efcec7; border-left: 3px solid #bf4c3a; border-radius: 11px; color: #943b2c; font-size: 14px; }
.form-help { padding: 14px 18px; border-radius: 12px; color: var(--color-muted); background: #edf5f0; font-size: 13px; }
.status-card { max-width: 620px; margin: 64px auto; padding: 36px; border: 1px solid var(--color-border); border-radius: var(--radius-card); background: #fff; box-shadow: var(--shadow-card); }
.status-card h1 { margin-top: 0; }
.empty-state { padding: 52px 28px; border: 1px dashed #c8dad0; border-radius: var(--radius-card); background: #fff; text-align: center; }
.empty-state h2 { margin: 0 0 12px; }
.empty-state p { max-width: 440px; margin: 0 auto; color: var(--color-muted); font-size: 14px; }
.empty-state a { display: inline-flex; margin-top: 20px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea { min-height: 48px; padding: 12px 14px; border: 1px solid #ccdad2; border-radius: 11px; background: #fff; color: var(--color-text); transition: border-color .18s, box-shadow .18s; }
input::placeholder, textarea::placeholder { color: #83958b; opacity: 1; }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 4px rgba(8,127,91,.09); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--color-primary); width: 17px; height: 17px; }
.context-help { position: relative; min-height: 32px; margin-bottom: 8px; min-width: 0; }
.context-help .context-help-label { padding: 4px 40px 0 0; }
.context-help > label.context-help-label[for] { display: block; margin: 0; }
.context-help > span.context-help-label { margin: 0; }
.card-form-card .context-help, .transaction-form-card .context-help { margin-top: 21px; }
.context-help-disclosure > summary {
    position: absolute; top: 0; right: 0; width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center; list-style: none;
    border: 1px solid var(--color-border); border-radius: 50%; background: #fff;
    color: var(--color-primary-dark); font-size: 14px; font-weight: 700;
    line-height: 1; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
}
.context-help-disclosure > summary::-webkit-details-marker { display: none; }
.context-help-disclosure > summary:hover,
.context-help-disclosure[open] > summary { background: var(--color-soft); border-color: #93bfa7; }
.context-help .context-help-content {
    margin-top: 12px; padding: 14px 16px; border: 1px solid #cde3d5;
    border-radius: 11px; background: #f0f7f3; color: var(--color-text);
    font-size: 13px; line-height: 1.65; overflow-wrap: anywhere;
}
.context-help .context-help-content p { margin: 0 0 10px; color: inherit; font-size: inherit; line-height: inherit; }
.context-help .context-help-content p:last-child { margin-bottom: 0; }
.context-help-floating .context-help-content {
    position: absolute; top: 100%; right: 0; z-index: 20;
    width: min(420px, calc(100vw - 72px)); margin-top: 8px;
    box-shadow: 0 10px 32px rgba(25, 58, 44, .15);
}
.dashboard .metric-card-highlight:has(.context-help-floating .context-help-disclosure[open]) { overflow: visible; z-index: 2; }
.dashboard .metric-card-highlight:has(.context-help-floating .context-help-disclosure[open])::after { display: none; }
@media (max-width: 1250px) {
    /* A marca pode sair da tela; os links permanecem presos ao topo. */
    :root { --app-header-top: -76px; --app-scroll-padding: 80px; }
    .app-header-inner { flex-direction: column; align-items: flex-start; gap: 16px; padding-bottom: 12px; }
    .app-nav { width: 100%; overflow-x: auto; padding-top: 4px; padding-bottom: 4px; }
}
@media (max-width: 600px) {
    :root { --app-header-top: -70px; --app-scroll-padding: 150px; }
    .app-header-inner { padding: 18px 18px 8px; gap: 12px; }
    .app-brand { min-height: 40px; }
    .app-brand-mark { width: 36px; height: 36px; border-radius: 11px; }
    .app-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; overflow: visible; }
    .app-nav a { padding: 9px 6px; font-size: 11px; justify-content: center; }
    .app-nav svg { width: 15px; height: 15px; }
    .container { padding: 28px 18px; }
    .app-footer { margin: 0 18px; padding: 22px 0; flex-direction: column; gap: 3px; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .primary-form-button, .form-actions .secondary-button { width: 100%; }
    .status-card { margin: 28px 18px; padding: 24px; }
}
@media (max-width: 380px) {
    .app-nav svg { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
