/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
:root {
    --bg-color: #F5F7FA;
    --surface-color: #FFFFFF;
    --surface-soft: #F5F7FA;
    --text-color: #111827;
    --text-muted: #6b7280;
    --border-color: #d1d5db;
    --primary-color: #0F4C81;
    --primary-hover: #1B6CA8;
    --danger-color: #EA3943;
    --danger-hover: #c62832;
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-elevated: 0 10px 30px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] {
    --bg-color: #0e1420;
    --surface-color: #151f30;
    --surface-soft: #1b2638;
    --text-color: #e5e7eb;
    --text-muted: #9ca3af;
    --border-color: #32445f;
    --primary-color: #6cb6ff;
    --primary-hover: #91c9ff;
    --danger-color: #ff7b7b;
    --danger-hover: #ff9b9b;
    --shadow-card: 0 12px 28px rgba(0, 0, 0, 0.45);
    --shadow-elevated: 0 14px 36px rgba(0, 0, 0, 0.5);
}

[data-theme="blue"] {
    --bg-color: #eef6ff;
    --surface-color: #ffffff;
    --surface-soft: #deecff;
    --text-color: #0f233a;
    --text-muted: #4f6a88;
    --border-color: #bed8f8;
    --primary-color: #2e7cc7;
    --primary-hover: #2267aa;
    --danger-color: #d9480f;
    --danger-hover: #b3470f;
    --shadow-card: 0 10px 30px rgba(46, 124, 199, 0.14);
    --shadow-elevated: 0 10px 30px rgba(46, 124, 199, 0.2);
}

[data-theme="orange"] {
    --bg-color: #fff5e8;
    --surface-color: #ffffff;
    --surface-soft: #ffe8c9;
    --text-color: #3a2411;
    --text-muted: #866444;
    --border-color: #f3c58a;
    --primary-color: #d06a00;
    --primary-hover: #b85c00;
    --danger-color: #d9480f;
    --danger-hover: #b3470f;
    --shadow-card: 0 10px 30px rgba(208, 106, 0, 0.12);
    --shadow-elevated: 0 10px 30px rgba(208, 106, 0, 0.18);
}

[data-theme="pink"] {
    --bg-color: #fff2f7;
    --surface-color: #ffffff;
    --surface-soft: #ffe5f0;
    --text-color: #3b1024;
    --text-muted: #8a4b69;
    --border-color: #f2bfd4;
    --primary-color: #c2255c;
    --primary-hover: #a61e4d;
    --danger-color: #e03131;
    --danger-hover: #c92a2a;
    --shadow-card: 0 10px 30px rgba(194, 37, 92, 0.14);
    --shadow-elevated: 0 10px 30px rgba(194, 37, 92, 0.2);
}

[data-theme="green"] {
    --bg-color: #edf9f0;
    --surface-color: #ffffff;
    --surface-soft: #dcf3e3;
    --text-color: #163223;
    --text-muted: #4d6b5d;
    --border-color: #b8e2c7;
    --primary-color: #1d6f42;
    --primary-hover: #165634;
    --danger-color: #d9480f;
    --danger-hover: #b3470f;
    --shadow-card: 0 10px 30px rgba(29, 111, 66, 0.12);
    --shadow-elevated: 0 10px 30px rgba(29, 111, 66, 0.18);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

body.has-bottom-nav {
    padding-bottom: 92px;
}
/* Card */
.login-container {
    background: var(--surface-color);
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-card);
}
.login-container img{
    width: 50%;
    margin: -35% 25% 25px 25%;
}
.logo {
    text-align: center;
    margin-bottom: 30px;
    font-weight: 700;
    font-size: 22px;
    color: var(--primary-color);
}
.form-group {
    margin-bottom: 10px;
}
label {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text-color);
}
input {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    font-size: 14px;
}
input:focus {
    outline: none;
    border-color: var(--primary-color);
}
.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.checkbox input{
    width: 10%;
}
#chkRenovacao{
  width: 30%;
}
button {
    padding: 10px 14px;
    background-color: var(--primary-color);
    color: white;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.12s ease;
}
button:hover {
    background-color: var(--primary-hover);
}
button:active {
    transform: translateY(1px);
}
button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}
.login-container button {
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

/* Botões padronizados nas telas internas */
.mini-btn,
.btn {
    width: auto;
    min-height: 42px;
    background: var(--primary-color);
    color: #fff;
    border: 1px solid var(--primary-color);
    border-radius: 12px;
    font-weight: 800;
}
.mini-btn:hover,
.btn:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-secondary,
.mini-btn.btn-secondary,
.btn.btn-secondary,
.tabs button,
.actions button {
    background: var(--surface-color);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover,
.mini-btn.btn-secondary:hover,
.btn.btn-secondary:hover,
.tabs button:hover,
.actions button:hover {
    background: var(--surface-soft);
}

.tabs button.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.btn-danger,
.mini-btn.btn-danger,
.btn.btn-danger,
.actions .danger,
.actions button.danger {
    background: rgba(234, 57, 67, 0.08) !important;
    color: var(--danger-color) !important;
    border: 1px solid rgba(234, 57, 67, 0.35) !important;
}
.btn-danger:hover,
.mini-btn.btn-danger:hover,
.btn.btn-danger:hover,
.actions .danger:hover,
.actions button.danger:hover {
    background: rgba(234, 57, 67, 0.16);
    border-color: rgba(234, 57, 67, 0.55);
    color: var(--danger-hover);
}

/* Botao voltar no topo esquerdo */
.btnVoltar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    margin-bottom: 12px;
}
#btnSalvarLancamento{
  margin-top: 5px;
}
.btnVoltar::before {
    content: "←";
    font-size: 16px;
    line-height: 1;
}

/* Menu inferior fixo */
.app-tabs {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 99998;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-elevated);
}
.app-tab {
    min-height: 52px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid transparent;
    background: transparent;
}
.app-tab__icon {
    width: 18px;
    height: 18px;
    line-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.app-tab__icon svg {
    width: 18px;
    height: 18px;
    display: block;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.app-tab__label {
    line-height: 1.1;
    font-weight: 500;
}
.app-tab:hover {
    background: var(--surface-soft);
    color: var(--text-color);
}
.app-tab.active {
    color: #fff;
    background: var(--primary-color);
    border-color: var(--primary-color);
}
.app-tab-config {
    color: var(--danger-color);
}
[data-theme="dark"] .app-tab.active {
    color: #081019;
}
.settings-menu {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}
.settings-menu .mini-btn {
    width: 100%;
    justify-content: center;
}
.settings-menu .mini-btn.btn-secondary {
    color: var(--text-color);
}
.link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}
.link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}
.error {
    color: var(--danger-color);
    font-size: 13px;
    margin-bottom: 15px;
}
/* Banner instalar PWA (fixo no rodapé) */
.install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 12px 12px;
  box-shadow: var(--shadow-elevated);
}
.install-banner.hidden {
  display: none !important;
}
.install-banner__title {
  font-weight: 900;
  font-size: 14px;
  color: var(--primary-color);
  line-height: 1.2;
}
.install-banner__sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 600;
}
.install-banner__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.install-btn {
  border: none;
  background: var(--primary-color);
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 900;
  cursor: pointer;
}
.install-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.close-btn {
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-color);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 900;
  cursor: pointer;
}
@media (max-width: 420px) {
  .install-banner {
    flex-direction: column;
    align-items: stretch;
  }
  .install-banner__actions {
    width: 100%;
  }
  .install-btn, .close-btn {
    width: 100%;
  }
}

.benef ul{
  text-align: left;
}

/* Modal iOS - Instalação */
.ios-modal.hidden { display: none; }
.ios-modal { position: fixed; inset: 0; z-index: 99999; }

.ios-modal__backdrop{
  position:absolute; inset:0;
  background: rgba(0,0,0,.45);
}

.ios-modal__card{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 420px);
  background: var(--surface-color);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow-elevated);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.ios-modal__top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
}

.ios-modal__title{
  font-weight: 900;
  font-size: 16px;
  color: var(--primary-color);
}

.ios-modal__sub{
  margin-top: 2px;
  color:var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.ios-modal__close{
  border: 0;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color:var(--text-muted);
  padding: 6px 8px;
  border-radius: 10px;
}
.ios-modal__close:hover{ background:var(--surface-soft); }

.ios-steps{
  margin: 14px 0 12px;
  padding-left: 18px;
  color:var(--text-color);
  font-size: 14px;
  font-weight: 700;
}
.ios-steps li{
  margin: 10px 0;
  line-height: 1.25;
}
.ios-share-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(108, 182, 255, 0.18);
  margin-left: 6px;
  font-size: 14px;
}

.ios-modal__hint{
  background: var(--surface-soft);
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  border-radius: 14px;
  color:var(--text-color);
  font-size: 12px;
  font-weight: 700;
}

.ios-modal__btn{
  margin-top: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--primary-color);
  color:#fff;
  font-weight: 900;
  cursor: pointer;
}
.ios-modal__btn:hover{ filter: brightness(0.95); }

.theme-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 100000;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-color);
  box-shadow: var(--shadow-card);
  font-size: 0;
  font-weight: 600;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--surface-soft);
}

.theme-toggle .theme-icon {
  width: 22px;
  height: 22px;
  display: block;
  color: #f6c945;
}

.benef{
  background: var(--border-color) !important;
}

/* Overrides de tema nas telas do app */
[data-theme="dark"] .topbar,
[data-theme="dark"] .card,
[data-theme="dark"] .login-container,
[data-theme="dark"] .sheet tfoot td,
[data-theme="dark"] .stickyCol,
[data-theme="dark"] .stickyRight {
  background: var(--surface-color);
  color: var(--text-color);
  box-shadow: var(--shadow-card);
}

[data-theme="dark"] .pill,
[data-theme="dark"] .badge,
[data-theme="dark"] .yearSelect,
[data-theme="dark"] .select,
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] .item,
[data-theme="dark"] .sheetWrap {
  background: var(--surface-soft);
  color: var(--text-color);
  border-color: var(--border-color);
}

[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .mini-btn.btn-secondary,
[data-theme="dark"] .tabs button,
[data-theme="dark"] .actions button {
  background: var(--surface-soft);
  color: var(--text-color);
  border-color: var(--border-color);
}
[data-theme="dark"] .btn-secondary:hover,
[data-theme="dark"] .mini-btn.btn-secondary:hover,
[data-theme="dark"] .tabs button:hover,
[data-theme="dark"] .actions button:hover {
  background: #24344c;
}
[data-theme="dark"] .mini-btn,
[data-theme="dark"] .btn {
  color: #081019;
}
[data-theme="dark"] .tabs button.active {
  background: var(--primary-color);
  color: var(--bg-color);
}

[data-theme="dark"] .brand .title,
[data-theme="dark"] .title,
[data-theme="dark"] .yearTitle {
  color: var(--primary-color);
}

[data-theme="dark"] .muted,
[data-theme="dark"] .sub,
[data-theme="dark"] .meta,
[data-theme="dark"] .lbl,
[data-theme="dark"] .hint,
[data-theme="dark"] .brand .subtitle,
[data-theme="dark"] .install-banner__sub {
  color: var(--text-muted);
}

[data-theme="dark"] .sheet thead th {
  background: #1a2537;
  color: var(--text-color);
}

[data-theme="dark"] .sheet th,
[data-theme="dark"] .sheet td {
  border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .sheet.saldo td.pos {
  background: rgba(34, 197, 94, 0.2);
}
[data-theme="dark"] .sheet.saldo td.neg {
  background: rgba(239, 68, 68, 0.2);
}
[data-theme="dark"] .sheet.saldo td.zero {
  background: rgba(148, 163, 184, 0.2);
}

[data-theme="dark"] hr {
  background: var(--primary-color);
  border: var(--primary-color);
}

[data-theme="dark"] .benef{
  background: #32445f !important;
}

[data-theme="dark"] .benef h3{
  color: #FFFFFF !important;
}

[data-theme="dark"] .metric{
  color: #6cb6ff;
}

[data-theme="dark"] .metric.saldo-neutro{
  color: #FFFFFF !important;
}
