/* FinanKey 1.5.21 — previsão personalizada e calculadora completa. */

/* A nota escura usa ouro nos dois temas; verde continua reservado a entradas. */
.theme-toggle.theme-notes-button::after {
  color: #e6c86f !important;
  border-color: #c9a84e !important;
  background:
    radial-gradient(circle at center, transparent 0 5px, rgba(230, 200, 111, .48) 5.5px 6px, transparent 6.5px),
    linear-gradient(125deg, rgba(230, 200, 111, .12), transparent 35% 65%, rgba(230, 200, 111, .08)),
    #090a09 !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .38), inset 0 0 0 1px rgba(255, 238, 177, .05) !important;
}

.forecast-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--line, rgba(255, 255, 255, .12));
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface, #111) 88%, transparent);
  box-shadow: inset 0 1px rgba(255, 255, 255, .035), 0 12px 30px rgba(0, 0, 0, .1);
}

.forecast-mode-tabs > button {
  appearance: none;
  min-width: 0;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--muted, #888);
  text-align: left;
  background: transparent;
  cursor: pointer;
  transition: transform 150ms ease, background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.forecast-mode-tabs > button:hover { transform: translateY(-1px); }

.forecast-mode-tabs > button > span:first-child {
  width: 38px;
  height: 38px;
  border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
  border-radius: 12px;
  display: grid;
  place-items: center;
}

.forecast-mode-tabs svg { width: 18px; height: 18px; }

.forecast-mode-tabs > button > span:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.forecast-mode-tabs strong {
  color: inherit;
  font-size: 12px;
  line-height: 1.15;
}

.forecast-mode-tabs small {
  overflow: hidden;
  color: inherit;
  font-size: 9px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: .68;
}

.forecast-mode-tabs > button.is-active {
  color: #fff;
  border-color: rgba(255, 255, 255, .12);
  background:
    radial-gradient(circle at 8% 0, rgba(255, 255, 255, .1), transparent 44%),
    linear-gradient(145deg, #222, #090909);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22), inset 0 1px rgba(255, 255, 255, .07);
}

.forecast-mode-tabs > button.is-active > span:first-child {
  color: #e6c86f;
  border-color: rgba(230, 200, 111, .3);
  background: rgba(230, 200, 111, .07);
}

.forecast-custom-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.forecast-custom-summary article {
  min-height: 126px;
  padding: 19px;
  border: 1px solid var(--line, rgba(255, 255, 255, .12));
  border-radius: 22px;
  display: grid;
  align-content: center;
  gap: 8px;
  background: color-mix(in srgb, var(--surface, #111) 88%, transparent);
}

.forecast-custom-summary span,
.forecast-custom-summary small {
  color: var(--muted, #888);
  font-size: 10px;
}

.forecast-custom-summary strong {
  color: var(--text, #fff);
  font-size: clamp(22px, 2.5vw, 32px);
  letter-spacing: -.045em;
}

.forecast-custom-summary .is-negative strong { color: var(--coral, #d42f43); }
.forecast-custom-summary .is-positive strong { color: #16834f; }

.forecast-tool-panel {
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--line, rgba(255, 255, 255, .12));
  border-radius: 26px;
  background: color-mix(in srgb, var(--surface, #111) 90%, transparent);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .12);
}

.forecast-tool-panel > header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line, rgba(255, 255, 255, .1));
}

.forecast-tool-panel h2 {
  margin: 6px 0 5px;
  color: var(--text, #fff);
  font-size: 22px;
  letter-spacing: -.035em;
}

.forecast-tool-panel header p {
  max-width: 640px;
  margin: 0;
  color: var(--muted, #888);
  font-size: 11px;
  line-height: 1.45;
}

.forecast-tool-actions { display: flex; gap: 7px; }
.forecast-custom-controls { min-width: min(100%, 360px); display: grid; gap: 8px; }
.forecast-custom-month { display: grid; gap: 5px; }
.forecast-custom-month > span { color: var(--muted, #888); font-size: 8px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.forecast-custom-month input {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line, rgba(255, 255, 255, .1));
  border-radius: 12px;
  color: var(--text, #fff);
  color-scheme: dark;
  background: rgba(255, 255, 255, .04);
  font: 750 10px/1 Inter, ui-sans-serif, sans-serif;
}

.forecast-tool-actions button,
.calculator-clear {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line, rgba(255, 255, 255, .12));
  border-radius: 12px;
  color: var(--text, #fff);
  background: rgba(255, 255, 255, .05);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.forecast-custom-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 15px;
}

.forecast-custom-item {
  position: relative;
  min-width: 0;
  min-height: 72px;
  padding: 11px 13px;
  border: 1px solid var(--line, rgba(255, 255, 255, .1));
  border-radius: 17px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, .025);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.forecast-custom-item:hover { transform: translateY(-1px); }
.forecast-custom-item.is-selected {
  border-color: rgba(230, 200, 111, .45);
  background: rgba(230, 200, 111, .07);
}

.forecast-custom-item > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.forecast-custom-check {
  width: 26px;
  height: 26px;
  border: 1px solid color-mix(in srgb, var(--text, #fff) 18%, transparent);
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: transparent;
  background: color-mix(in srgb, var(--surface, #111) 82%, transparent);
}

.forecast-custom-item.is-selected .forecast-custom-check {
  color: #111;
  border-color: #e6c86f;
  background: #e6c86f;
}

.forecast-custom-check svg { width: 15px; height: 15px; }
.forecast-custom-copy { min-width: 0; display: grid; gap: 4px; }
.forecast-custom-copy strong,
.forecast-custom-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.forecast-custom-copy strong { color: var(--text, #fff); font-size: 11px; }
.forecast-custom-copy small { color: var(--muted, #888); font-size: 8px; }
.forecast-custom-value { color: var(--text, #fff); font-size: 11px; white-space: nowrap; }

.forecast-calculator-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding-top: 16px;
  align-items: stretch;
}

.forecast-gameboy {
  padding: 16px;
  border: 1px solid rgba(230, 200, 111, .25);
  border-radius: 30px 30px 46px 30px;
  display: grid;
  gap: 13px;
  align-content: start;
  background:
    radial-gradient(circle at 10% 0, rgba(255, 255, 255, .09), transparent 38%),
    linear-gradient(145deg, #252525, #0b0b0b 65%);
  box-shadow: inset 0 1px rgba(255, 255, 255, .08), 0 20px 45px rgba(0, 0, 0, .22);
}

.calculator-screen {
  height: 224px;
  min-height: 224px;
  padding: 15px;
  border: 8px solid #171717;
  border-radius: 18px 18px 28px 18px;
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  align-items: stretch;
  gap: 12px;
  overflow: hidden;
  color: #172115;
  background:
    linear-gradient(rgba(23, 33, 21, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 33, 21, .045) 1px, transparent 1px),
    #b8c9a7;
  background-size: 5px 5px;
  box-shadow: inset 0 0 18px rgba(15, 31, 13, .18);
}

.calculator-screen-summary { min-width: 0; display: grid; align-content: start; gap: 8px; overflow: hidden; }
.calculator-screen-heading { display: flex; justify-content: space-between; gap: 10px; }
.calculator-screen-heading span,
.calculator-screen-heading small { font: 800 8px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; }
.calculator-screen-summary > strong { min-width: 0; overflow: hidden; font: 800 clamp(25px, 4vw, 40px)/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: -.07em; text-overflow: ellipsis; white-space: nowrap; }
.calculator-input-preview { max-width: 100%; overflow: hidden; color: inherit; font: 700 9px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; opacity: .72; }

.calculator-ledger { display: grid; gap: 3px; margin-top: 3px; }
.calculator-ledger button {
  min-width: 0;
  padding: 2px 0;
  border: 0;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: inherit;
  background: transparent;
  font: 700 8px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  cursor: pointer;
}
.calculator-ledger button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.calculator-keypad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.calculator-keypad button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 13px;
  color: #f7f7f4;
  background: linear-gradient(145deg, #303030, #141414);
  box-shadow: 0 4px 0 #050505, inset 0 1px rgba(255, 255, 255, .1);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.calculator-keypad button:active { transform: translateY(3px); box-shadow: 0 1px 0 #050505; }
.calculator-keypad .key-operator { color: #17130a; border-color: #e6c86f; background: linear-gradient(145deg, #f0d986, #bc9635); }
.calculator-keypad .key-clear { color: #fff; border-color: rgba(210, 54, 75, .35); background: linear-gradient(145deg, #9f3342, #551b24); }

.calculator-use-total {
  min-height: 45px;
  padding: 0 13px;
  border: 1px solid rgba(230, 200, 111, .3);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #17130a;
  background: linear-gradient(145deg, #f1d986, #c29b3d);
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}
.calculator-use-total svg { width: 16px; }

.calculator-accounts {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line, rgba(255, 255, 255, .1));
  border-radius: 22px;
  background: rgba(255, 255, 255, .025);
}

.calculator-screen-accounts {
  height: 100%;
  padding: 8px;
  border-color: rgba(23, 33, 21, .16);
  border-radius: 13px;
  overflow: hidden;
  color: inherit;
  background: rgba(255, 255, 255, .16);
}

.calculator-accounts-heading { display: flex; justify-content: space-between; gap: 8px; padding: 2px 2px 8px; }
.calculator-accounts-heading strong { color: var(--text, #fff); font-size: 11px; }
.calculator-accounts-heading small { color: var(--muted, #888); font-size: 8px; }
.calculator-account-list { display: grid; grid-template-columns: 1fr; gap: 5px; }
.calculator-screen-accounts .calculator-account-list { max-height: 160px; padding-right: 2px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.calculator-account-list article {
  min-width: 0;
  min-height: 48px;
  padding: 6px 7px;
  border: 1px solid var(--line, rgba(255, 255, 255, .09));
  border-radius: 15px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--surface, #111) 74%, transparent);
}
.calculator-account-list article > div:first-child { min-width: 0; display: grid; gap: 4px; }
.calculator-account-list article > div:first-child strong,
.calculator-account-list article > div:first-child small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calculator-account-list article > div:first-child strong { color: var(--text, #fff); font-size: 9px; }
.calculator-account-list article > div:first-child small { color: var(--muted, #888); font-size: 8px; }
.calculator-account-list article > div:last-child { display: flex; gap: 5px; }
.calculator-account-list article.is-selected { grid-template-columns: 1fr; }
.calculator-account-list article.is-selected > div:last-child { justify-content: flex-end; }
.calculator-account-list article button {
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid var(--line, rgba(255, 255, 255, .12));
  border-radius: 10px;
  color: var(--text, #fff);
  background: rgba(255, 255, 255, .05);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}
.calculator-account-list article button:disabled { opacity: .32; cursor: default; }
.calculator-account-list article select {
  width: 46px;
  height: 27px;
  padding: 0 4px;
  border: 1px solid var(--line, rgba(255, 255, 255, .12));
  border-radius: 9px;
  color: var(--text, #fff);
  color-scheme: dark;
  background: rgba(255, 255, 255, .05);
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}
.calculator-account-list article button:last-child { color: #17130a; border-color: #e6c86f; background: #e6c86f; }
.calculator-account-list article.is-selected { border-color: rgba(230, 200, 111, .76); background: rgba(230, 200, 111, .12); animation: fk-account-card-select 260ms cubic-bezier(.2, .9, .25, 1); }
.calculator-account-list article button.is-selected { animation: fk-account-check-pop 360ms cubic-bezier(.18, .9, .28, 1.35); }
.calculator-clear.is-placeholder { visibility: hidden; pointer-events: none; }
.calculator-empty { color: var(--muted, #888); font-size: 10px; }

@keyframes fk-account-check-pop {
  0% { transform: scale(.72) rotate(-16deg); }
  58% { transform: scale(1.16) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes fk-account-card-select {
  0% { transform: translateY(2px); opacity: .76; }
  100% { transform: translateY(0); opacity: 1; }
}

html[data-theme="light"] .forecast-mode-tabs,
html[data-theme="light"] .forecast-tool-panel,
html[data-theme="light"] .forecast-custom-summary article,
html[data-theme="light"] .calculator-accounts {
  border-color: rgba(35, 31, 28, .13);
  background: rgba(255, 255, 255, .78);
}

html[data-theme="light"] .forecast-mode-tabs > button { color: #6f6b6f; }
html[data-theme="light"] .forecast-mode-tabs > button.is-active { color: #fff; border-color: #090909; background: linear-gradient(145deg, #242424, #070707); }
html[data-theme="light"] .forecast-mode-tabs > button.is-active > span:first-child { color: #fff; border-color: rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .07); }
html[data-theme="light"] .forecast-custom-summary strong,
html[data-theme="light"] .forecast-tool-panel h2,
html[data-theme="light"] .forecast-custom-copy strong,
html[data-theme="light"] .forecast-custom-value,
html[data-theme="light"] .calculator-accounts-heading strong,
html[data-theme="light"] .calculator-account-list article > div:first-child strong { color: #151416; }
html[data-theme="light"] .forecast-custom-item,
html[data-theme="light"] .calculator-account-list article { border-color: rgba(35, 31, 28, .12); background: rgba(255, 255, 255, .62); }
html[data-theme="light"] .forecast-custom-item.is-selected { border-color: rgba(20, 20, 20, .6); background: rgba(20, 20, 20, .075); }
html[data-theme="light"] .forecast-custom-check { border-color: rgba(35, 31, 28, .2); background: rgba(255, 255, 255, .82); }
html[data-theme="light"] .forecast-custom-item.is-selected .forecast-custom-check { color: #fff; border-color: #111; background: #111; }
html[data-theme="light"] .forecast-tool-actions button,
html[data-theme="light"] .calculator-clear { color: #272428; border-color: rgba(35, 31, 28, .15); background: rgba(255, 255, 255, .72); }
html[data-theme="light"] .forecast-custom-month input { color: #181718; color-scheme: light; border-color: rgba(35, 31, 28, .15); background: rgba(255, 255, 255, .78); }
html[data-theme="light"] .calculator-account-list article button { color: #222; border-color: rgba(35, 31, 28, .16); background: rgba(255, 255, 255, .8); }
html[data-theme="light"] .calculator-account-list article button:last-child { color: #fff; border-color: #111; background: #111; }
html[data-theme="light"] .calculator-account-list article select { color: #181718; color-scheme: light; border-color: rgba(35, 31, 28, .16); background: rgba(255, 255, 255, .84); }

html[data-theme="light"] .theme-toggle.theme-notes-button::after {
  color: #f7f7f7 !important;
  border-color: #1b1b1b !important;
  background:
    radial-gradient(circle at center, transparent 0 5px, rgba(255, 255, 255, .2) 5.5px 6px, transparent 6.5px),
    linear-gradient(125deg, rgba(255, 255, 255, .06), transparent 35% 65%, rgba(255, 255, 255, .04)),
    #090909 !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .3) !important;
}

/* No tema claro o formato lembra um portátil, mas a linguagem é limpa e atual. */
html[data-theme="light"] .forecast-gameboy {
  border-color: rgba(35, 31, 28, .14);
  background:
    radial-gradient(circle at 10% 0, rgba(255, 255, 255, .92), transparent 42%),
    linear-gradient(145deg, rgba(255, 255, 255, .94), rgba(242, 240, 236, .9));
  box-shadow: 0 18px 38px rgba(52, 46, 39, .1), inset 0 1px #fff;
}

html[data-theme="light"] .calculator-screen {
  color: #151416;
  border: 1px solid rgba(35, 31, 28, .14);
  background:
    radial-gradient(circle at 82% 0, rgba(20, 20, 20, .045), transparent 42%),
    linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(247, 246, 243, .94));
  background-size: auto;
  box-shadow: inset 0 1px #fff, 0 10px 24px rgba(52, 46, 39, .07);
}

html[data-theme="light"] .calculator-screen-heading span,
html[data-theme="light"] .calculator-screen-heading small,
html[data-theme="light"] .calculator-screen-summary > strong,
html[data-theme="light"] .calculator-input-preview,
html[data-theme="light"] .calculator-ledger button {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

html[data-theme="light"] .calculator-screen-summary > strong {
  font-weight: 790;
  letter-spacing: -.055em;
}

html[data-theme="light"] .calculator-keypad button {
  color: #242124;
  border-color: rgba(35, 31, 28, .14);
  background: linear-gradient(145deg, #fff, #efede9);
  box-shadow: 0 3px 0 #d9d5ce, inset 0 1px #fff;
}

html[data-theme="light"] .calculator-keypad button:active {
  box-shadow: 0 1px 0 #d9d5ce;
}

html[data-theme="light"] .calculator-keypad .key-operator {
  color: #fff;
  border-color: #151515;
  background: linear-gradient(145deg, #292929, #080808);
  box-shadow: 0 3px 0 #000, inset 0 1px rgba(255, 255, 255, .13);
}

html[data-theme="light"] .calculator-keypad .key-clear {
  color: #a62d3d;
  border-color: rgba(190, 46, 65, .2);
  background: linear-gradient(145deg, #fff, #f7ecee);
  box-shadow: 0 3px 0 #dfc9cd, inset 0 1px #fff;
}

html[data-theme="light"] .calculator-use-total {
  color: #fff;
  border-color: #111;
  background: linear-gradient(145deg, #2b2b2b, #080808);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .16), inset 0 1px rgba(255, 255, 255, .12);
}

html[data-theme="light"] .calculator-screen-accounts {
  border-color: rgba(35, 31, 28, .13);
  background: rgba(255, 255, 255, .5);
}

html[data-theme="light"] .calculator-account-list article.is-selected {
  border-color: rgba(17, 17, 17, .58);
  background: rgba(17, 17, 17, .075);
}

@media (max-width: 819px) {
  .forecast-mode-tabs { gap: 5px; padding: 5px; border-radius: 19px; }
  .forecast-mode-tabs > button { min-height: 58px; padding: 8px 6px; grid-template-columns: 31px minmax(0, 1fr); gap: 7px; border-radius: 14px; }
  .forecast-mode-tabs > button > span:first-child { width: 31px; height: 31px; border-radius: 10px; }
  .forecast-mode-tabs svg { width: 16px; height: 16px; }
  .forecast-mode-tabs strong { font-size: 9px; }
  .forecast-mode-tabs small { display: none; }
  .forecast-custom-summary { grid-template-columns: 1fr; gap: 8px; }
  .forecast-custom-summary article { min-height: 92px; padding: 15px 16px; border-radius: 19px; }
  .forecast-tool-panel { padding: 14px; border-radius: 22px; }
  .forecast-tool-panel > header { align-items: stretch; flex-direction: column; }
  .forecast-tool-actions { width: 100%; }
  .forecast-custom-controls { width: 100%; }
  .forecast-tool-actions button { flex: 1; }
  .forecast-custom-list { grid-template-columns: 1fr; }
  .forecast-custom-item { min-height: 67px; }
  .forecast-calculator-shell { grid-template-columns: 1fr; }
  .forecast-gameboy { border-radius: 25px 25px 39px 25px; }
  .calculator-screen { height: 224px; min-height: 224px; }
  .calculator-screen-summary > strong { font-size: 18px; letter-spacing: -.035em; }
}

@media (max-width: 390px) {
  .forecast-mode-tabs > button { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .forecast-mode-tabs > button > span:last-child { justify-items: center; }
  .forecast-custom-value { font-size: 10px; }
  .calculator-screen { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 11px; }
  .calculator-screen-summary > strong { font-size: 17px; }
  .calculator-screen-accounts { padding: 6px; }
  .calculator-account-list article { grid-template-columns: minmax(0, 1fr) auto; gap: 4px; }
  .calculator-account-list article.is-selected { grid-template-columns: 1fr; }
  .calculator-account-list article button { width: 25px; height: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  .forecast-mode-tabs > button,
  .forecast-custom-item,
  .calculator-account-list article,
  .calculator-account-list article button { transition: none; animation: none; }
}
