:root {
  --app-primary: #075985;
  --app-primary-strong: #0c4a6e;
  --app-primary-soft: #e0f2fe;
  --app-accent: #0284c7;
  --app-bg: #f1f5f9;
  --app-surface: #ffffff;
  --app-border: #dbe4ee;
  --app-text: #0f172a;
  --app-muted: #64748b;
  --app-success: #15803d;
  --app-danger: #b91c1c;
  --app-warning: #a16207;
  --app-shadow: 0 12px 30px rgb(15 23 42 / 8%);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  padding-top: 78px;
  background:
    radial-gradient(circle at top right, rgb(14 165 233 / 8%), transparent 31rem),
    var(--app-bg);
  color: var(--app-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select { min-height: 38px; }

.appbar {
  min-height: 70px;
  background: linear-gradient(115deg, var(--app-primary-strong), var(--app-primary));
}

.navbar-brand { line-height: 1.05; }
.brand-icon {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  background: rgb(255 255 255 / 15%);
  font-size: 1.2rem;
}
.brand-subtitle { opacity: .76; font-size: .72rem; font-weight: 500; }

.app-wide {
  width: 100%;
  max-width: none;
}

main {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

.hero-card {
  padding: 1.35rem 1.5rem;
  border: 1px solid rgb(2 132 199 / 18%);
  border-radius: 20px;
  background: linear-gradient(125deg, #fff, #f0f9ff);
  box-shadow: var(--app-shadow);
}

.eyebrow {
  margin-bottom: .45rem;
  color: var(--app-primary);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.status-panel {
  min-width: min(100%, 310px);
  padding: .9rem 1rem;
  border: 1px solid var(--app-border);
  border-radius: 14px;
  background: rgb(255 255 255 / 80%);
}
.status-label { color: var(--app-muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; }

.app-card {
  border: 1px solid var(--app-border);
  border-radius: 18px;
  background: var(--app-surface);
  box-shadow: var(--app-shadow);
  overflow: hidden;
}

.app-card-header {
  min-height: 76px;
  padding: 1rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--app-border);
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.section-number {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  margin-right: .5rem;
  border-radius: 9px;
  background: var(--app-primary-soft);
  color: var(--app-primary);
  font-weight: 900;
}
.section-help { margin-top: .3rem; color: var(--app-muted); font-size: .82rem; }

.form-label {
  margin-bottom: .35rem;
  color: #334155;
  font-size: .79rem;
  font-weight: 700;
}

.form-control,
.form-select,
.input-group-text {
  border-color: #cbd5e1;
}
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--app-accent);
  box-shadow: 0 0 0 .22rem rgb(2 132 199 / 14%);
}

.calculation-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .7rem;
}
.calculation-strip > div {
  padding: .8rem;
  border: 1px solid var(--app-border);
  border-radius: 12px;
  background: #f8fafc;
}
.calculation-strip span { display: block; color: var(--app-muted); font-size: .72rem; font-weight: 700; }
.calculation-strip strong { display: block; margin-top: .15rem; color: var(--app-primary); font-size: .98rem; }

.component-card {
  padding: .9rem;
  border: 1px solid var(--app-border);
  border-radius: 13px;
  background: #fff;
}
.component-card .form-check-label { font-size: .76rem; }
.component-current {
  padding: .45rem .65rem;
  border-radius: 9px;
  background: var(--app-primary-soft);
  color: var(--app-primary-strong);
  font-size: .76rem;
  font-weight: 800;
}

.tip-box {
  display: flex;
  gap: .75rem;
  padding: .9rem;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  background: #f0f9ff;
  color: #0c4a6e;
  font-size: .82rem;
}
.tip-box > i { margin-top: .15rem; color: #f59e0b; }

.table-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.search-group { width: min(320px, 100%); }
.table-container { max-height: 64vh; min-height: 180px; }

.table {
  --bs-table-hover-bg: #f8fafc;
  font-size: .82rem;
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  padding-block: .82rem;
  border-bottom: 1px solid #cbd5e1;
  background: #eaf2f8;
  color: #334155;
  font-size: .69rem;
  letter-spacing: .025em;
  text-transform: uppercase;
  white-space: nowrap;
}
.table tbody td { padding-block: .68rem; border-color: #e2e8f0; vertical-align: middle; }
.table .description-col { min-width: 310px; }
.table .action-col { width: 42px; }
.table input[type="number"] { min-width: 92px; }
.table .form-control-sm { min-height: 32px; font-size: .78rem; }
.table-row-disabled { opacity: .48; background: #f8fafc; }
.table-row-locked { background: #fbfdff; }
.table-row-derived { background: #fffbeb; }

.drag-handle {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #94a3b8;
  cursor: grab;
}
.drag-handle:hover { background: #e2e8f0; color: #475569; }
.drag-handle:active { cursor: grabbing; }
.drag-handle.is-disabled { cursor: not-allowed; opacity: .35; }
.sortable-ghost { opacity: .35; background: var(--app-primary-soft) !important; }

.formula-preview {
  max-width: 520px;
  color: var(--app-muted);
  font-size: .7rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.formula-preview span { display: block; }
.code-badge { min-width: 42px; }
.rule-badge { white-space: normal; text-align: left; font-size: .68rem; }

.value-positive { color: var(--app-success) !important; font-weight: 800; }
.value-negative { color: var(--app-danger) !important; font-weight: 800; }
.value-zero { color: var(--app-muted) !important; font-weight: 700; }

.empty-state {
  min-height: 230px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: .4rem;
  color: var(--app-muted);
  text-align: center;
}
.empty-state i { font-size: 2rem; color: #94a3b8; }

.summary-card {
  min-height: 110px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--app-border);
  border-radius: 15px;
  background: #f8fafc;
}
.summary-card .summary-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #fff;
  font-size: 1.35rem;
  box-shadow: 0 4px 15px rgb(15 23 42 / 8%);
}
.summary-card small { display: block; color: var(--app-muted); font-weight: 700; }
.summary-card strong { display: block; margin-top: .15rem; font-size: clamp(1.22rem, 2vw, 1.65rem); }
.summary-due .summary-icon { color: var(--app-primary); }
.summary-paid .summary-icon { color: #475569; }
.summary-difference.is-positive { border-color: #86efac; background: #f0fdf4; }
.summary-difference.is-positive .summary-icon,
.summary-difference.is-positive strong { color: var(--app-success); }
.summary-difference.is-negative { border-color: #fecaca; background: #fef2f2; }
.summary-difference.is-negative .summary-icon,
.summary-difference.is-negative strong { color: var(--app-danger); }

.memory-card {
  height: 100%;
  padding: .95rem;
  border: 1px solid var(--app-border);
  border-radius: 13px;
  background: #fff;
}
.memory-card h3 { margin: 0 0 .5rem; font-size: .85rem; font-weight: 800; }
.memory-card .memory-value { font-size: 1.08rem; font-weight: 900; }
.memory-card code {
  display: block;
  margin-top: .5rem;
  padding: .5rem;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  font-size: .68rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.rule-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .9rem;
  border: 1px solid var(--app-border);
  border-radius: 12px;
  background: #f8fafc;
}
.rule-card strong { color: var(--app-primary-strong); }
.rule-card span { color: var(--app-muted); }

.preset-card {
  height: 100%;
  padding: 1rem;
  border: 1px solid var(--app-border);
  border-radius: 14px;
  background: #fff;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.preset-card:hover { transform: translateY(-2px); border-color: #7dd3fc; box-shadow: 0 10px 25px rgb(15 23 42 / 9%); }
.preset-card p { min-height: 2.5em; color: var(--app-muted); font-size: .77rem; }
.preset-year {
  grid-column: 1 / -1;
  margin-top: .4rem;
  color: var(--app-primary-strong);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.modal-header-primary {
  border-bottom: 0;
  background: linear-gradient(115deg, var(--app-primary-strong), var(--app-primary));
  color: #fff;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem .25rem 0;
  color: var(--app-muted);
  font-size: .75rem;
}

@media (max-width: 1199.98px) {
  body { padding-top: 72px; }
  .navbar-collapse { padding-bottom: .6rem; }
}

@media (max-width: 767.98px) {
  body { padding-top: 70px; }
  .hero-card { padding: 1.1rem; border-radius: 15px; }
  .app-card { border-radius: 14px; }
  .app-card-header { align-items: flex-start; }
  .calculation-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-tools { width: 100%; align-items: stretch; }
  .search-group { width: 100%; }
  .status-panel { min-width: 100%; }
}

@media (max-width: 479.98px) {
  .calculation-strip { grid-template-columns: 1fr; }
  .summary-card { min-height: 92px; }
  .app-card-header { padding-inline: .9rem; }
}

@media print {
  @page { size: A4 landscape; margin: 9mm; }
  body { padding: 0; background: #fff !important; font-size: 10px; }
  .appbar,
  #btnAdicionarVerba,
  #btnAdicionarComponente,
  .table-tools,
  .drag-handle,
  .action-cell,
  .toast-container,
  .tip-box,
  #modalCompetencias,
  footer { display: none !important; }
  main { max-width: none; padding: 0 !important; }
  .hero-card,
  .app-card { box-shadow: none; break-inside: avoid; }
  .hero-card { padding: .5rem; margin-bottom: 7mm !important; }
  .app-card { border-radius: 0; margin-bottom: 6mm !important; }
  .card-body { padding: .6rem !important; }
  .table-container { max-height: none; overflow: visible; }
  .table { font-size: 7.5px; }
  .table thead th { position: static; padding: 4px; }
  .table tbody td { padding: 4px; }
  .table input,
  .table select { border: 0 !important; padding: 0 !important; background: transparent !important; font-size: inherit !important; }
  .formula-preview { font-size: 6.5px; }
  .accordion-collapse { display: block !important; }
  .accordion-button::after { display: none; }
  .accordion-button { padding: .5rem; }
  .summary-card { min-height: 70px; padding: .6rem; }
}

/* ===== Versão 2.1.0: tooltips, toggles e edição bidirecional ===== */
.info-icon {
  margin-left: .25rem;
  color: var(--app-primary);
  font-size: .78rem;
  cursor: help;
  opacity: .82;
}
.info-icon:hover,
.info-icon:focus { opacity: 1; outline: none; }
.tooltip { --bs-tooltip-max-width: 330px; }
.tooltip-inner { padding: .65rem .75rem; text-align: left; font-size: .78rem; line-height: 1.45; }

.page-navigation {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .7rem;
  padding: .65rem;
  border: 1px solid var(--app-border);
  border-radius: 17px;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 8px 26px rgb(15 23 42 / 7%);
  position: sticky;
  top: 78px;
  z-index: 20;
  backdrop-filter: blur(12px);
}
.page-nav-item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .75rem .85rem;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: #475569;
  text-align: left;
  transition: .18s ease;
}
.page-nav-item:hover { background: #f1f5f9; color: var(--app-primary-strong); }
.page-nav-item.active {
  border-color: #7dd3fc;
  background: var(--app-primary-soft);
  color: var(--app-primary-strong);
  box-shadow: inset 0 0 0 1px rgb(2 132 199 / 8%);
}
.page-nav-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #e2e8f0;
}
.page-nav-item.active .page-nav-icon { background: var(--app-primary); color: #fff; }
.page-nav-item strong,
.page-nav-item small { display: block; }
.page-nav-item strong { font-size: .83rem; }
.page-nav-item small { margin-top: .08rem; color: var(--app-muted); font-size: .68rem; }
.app-page { animation: pageIn .18s ease; }
.app-page[hidden] { display: none !important; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.workflow-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; }
.workflow-card {
  position: relative;
  min-height: 175px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .45rem;
  padding: 1rem;
  border: 1px solid var(--app-border);
  border-radius: 15px;
  background: #fff;
  text-align: left;
  transition: .18s ease;
}
.workflow-card:hover { transform: translateY(-2px); border-color: #7dd3fc; box-shadow: 0 12px 25px rgb(15 23 42 / 8%); }
.workflow-card > span {
  position: absolute;
  top: .7rem;
  right: .8rem;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--app-primary-soft);
  color: var(--app-primary);
  font-weight: 900;
  font-size: .75rem;
}
.workflow-card > i { margin: .15rem 0 .55rem; color: var(--app-primary); font-size: 1.55rem; }
.workflow-card strong { color: #0f172a; font-size: .92rem; }
.workflow-card small { color: var(--app-muted); line-height: 1.45; }
.instruction-panel {
  display: flex;
  gap: .85rem;
  padding: 1rem;
  border: 1px solid #bae6fd;
  border-radius: 14px;
  background: #f0f9ff;
  color: #0c4a6e;
  font-size: .82rem;
}
.instruction-panel > i { margin-top: .2rem; font-size: 1.15rem; }
.instruction-panel strong { display: block; margin-bottom: .25rem; }
.home-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.home-summary > div {
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: .9rem;
  border: 1px solid var(--app-border);
  border-radius: 13px;
  background: #f8fafc;
}
.home-summary span { color: var(--app-muted); font-size: .72rem; font-weight: 700; }
.home-summary strong { margin-top: .2rem; font-size: 1.08rem; }
.home-summary .is-positive { background: #f0fdf4; border-color: #86efac; }
.home-summary .is-positive strong { color: var(--app-success); }
.home-summary .is-negative { background: #fef2f2; border-color: #fecaca; }
.home-summary .is-negative strong { color: var(--app-danger); }
.page-actions { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }

/* Toggle acessível e consistente */
.app-toggle {
  --toggle-width: 42px;
  --toggle-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  margin: 0;
  cursor: pointer;
  user-select: none;
}
.app-toggle > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.app-toggle-track {
  width: var(--toggle-width);
  height: var(--toggle-height);
  flex: 0 0 var(--toggle-width);
  padding: 3px;
  display: flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #e2e8f0;
  transition: .18s ease;
}
.app-toggle-track > span {
  width: calc(var(--toggle-height) - 8px);
  height: calc(var(--toggle-height) - 8px);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgb(15 23 42 / 25%);
  transition: transform .18s ease;
}
.app-toggle > input:checked + .app-toggle-track { border-color: var(--app-primary); background: var(--app-primary); }
.app-toggle > input:checked + .app-toggle-track > span { transform: translateX(calc(var(--toggle-width) - var(--toggle-height))); }
.app-toggle > input:focus-visible + .app-toggle-track { outline: 3px solid rgb(2 132 199 / 20%); outline-offset: 2px; }
.app-toggle-copy strong,
.app-toggle-copy small { display: block; }
.app-toggle-copy strong { color: #334155; font-size: .78rem; line-height: 1.1; }
.app-toggle-copy small { margin-top: .17rem; color: var(--app-muted); font-size: .67rem; line-height: 1.2; }
.app-toggle-wide {
  width: 100%;
  min-height: 48px;
  padding: .55rem .7rem;
  border: 1px solid var(--app-border);
  border-radius: 12px;
  background: #f8fafc;
}
.app-toggle-compact { --toggle-width: 36px; --toggle-height: 21px; gap: .45rem; }
.app-toggle-icon { --toggle-width: 36px; --toggle-height: 20px; justify-content: center; }
.component-toggle-group { display: grid; gap: .45rem; }

.editing-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--app-border);
  background: #f8fafc;
  color: #475569;
  font-size: .72rem;
}
.editing-legend > span:first-child { margin-right: auto; font-weight: 700; }
.source-example,
.calculated-example { padding: .25rem .5rem; border-radius: 7px; border: 1px solid; }
.source-example { border-color: #38bdf8; background: #f0f9ff; color: #0369a1; }
.calculated-example { border-color: #e2e8f0; background: #fff; color: #64748b; }
.editable-calculation { position: relative; min-width: 115px; padding-bottom: 14px; }
.editable-calculation .form-control,
.editable-calculation .input-group-text { transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.editable-calculation.calculation-source .form-control,
.editable-calculation.calculation-source .input-group-text {
  border-color: #38bdf8;
  background: #f0f9ff;
}
.editable-calculation.calculation-source .form-control:focus { box-shadow: 0 0 0 .18rem rgb(14 165 233 / 15%); }
.editable-calculation.calculation-output .form-control,
.editable-calculation.calculation-output .input-group-text { background: #f8fafc; color: #64748b; }
.calculation-mode-label {
  position: absolute;
  right: 2px;
  bottom: 0;
  color: #64748b;
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.calculation-source .calculation-mode-label { color: #0284c7; }
.table input[type="number"] { min-width: 108px; }
.formula-preview { font-variant-numeric: tabular-nums; }

/* Notificações robustas */
.app-notification {
  width: min(430px, calc(100vw - 2rem));
  border: 0;
  border-left: 5px solid var(--app-primary);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgb(15 23 42 / 22%);
  overflow: hidden;
}
.app-notification .toast-header { padding: .8rem .9rem; border-bottom-color: #e2e8f0; }
.app-notification .toast-body { padding: .9rem 1rem 1rem; color: #334155; line-height: 1.45; }
.notification-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-right: .65rem;
  border-radius: 10px;
  background: var(--app-primary-soft);
  color: var(--app-primary);
  font-size: 1.05rem;
}
.notification-details { margin: .7rem 0 0; padding: .65rem .75rem .65rem 1.75rem; border-radius: 9px; background: #f8fafc; font-size: .75rem; }
.notification-details li + li { margin-top: .25rem; }
.notification-success { border-left-color: var(--app-success); }
.notification-success .notification-icon { background: #dcfce7; color: var(--app-success); }
.notification-warning { border-left-color: #d97706; }
.notification-warning .notification-icon { background: #fef3c7; color: #b45309; }
.notification-danger { border-left-color: var(--app-danger); }
.notification-danger .notification-icon { background: #fee2e2; color: var(--app-danger); }

@media (max-width: 991.98px) {
  .page-navigation { grid-template-columns: repeat(2, minmax(0, 1fr)); position: static; }
  .workflow-grid { grid-template-columns: 1fr; }
  .workflow-card { min-height: 135px; }
}
@media (max-width: 575.98px) {
  .page-navigation { grid-template-columns: 1fr 1fr; gap: .4rem; padding: .45rem; }
  .page-nav-item { padding: .55rem; gap: .45rem; }
  .page-nav-icon { width: 30px; height: 30px; flex-basis: 30px; }
  .page-nav-item small { display: none; }
  .home-summary { grid-template-columns: 1fr; }
  .page-actions .btn { width: 100%; }
}

@media print {
  .page-navigation { display: none !important; }
  .app-page { display: block !important; }
  .app-page[hidden] { display: block !important; }
  [data-page="inicio"], [data-page="parametros"] .page-actions, [data-page="lancamentos"] .page-actions, [data-page="resultados"] .page-actions,
  .editing-legend { display: none !important; }
}

/* ===== Versão 2.1.1: página única, calendário e divisores selecionáveis ===== */
.app-page {
  display: block !important;
  scroll-margin-top: 92px;
}

.app-page[hidden] {
  display: block !important;
}

.app-page + .app-page {
  margin-top: 1rem;
}

.competence-picker .form-control[type="month"] {
  min-width: 0;
  cursor: pointer;
}

.competence-picker .btn {
  min-width: 46px;
  display: inline-grid;
  place-items: center;
}

.calendar-hint {
  min-height: 1.2rem;
  color: #475569;
  line-height: 1.35;
}

.form-text {
  margin-top: .35rem;
  color: #64748b;
  font-size: .72rem;
}

section[data-page="parametros"] > .app-card,
section[data-page="resultados"] > .app-card {
  margin-bottom: 0 !important;
}

@media (max-width: 575.98px) {
  .competence-picker .btn {
    min-width: 44px;
  }
}

/* ===== Versão 2.1.3: grade wide real para os cards 1 e 2 ===== */
.primary-cards-grid {
  width: 100%;
  display: grid !important;
  grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.primary-card-main,
.primary-card-side {
  min-width: 0;
}

.primary-card-main > .app-card,
.primary-card-side > .app-card {
  height: 100%;
}

@media (min-width: 1600px) {
  .primary-cards-grid {
    grid-template-columns: minmax(0, 68%) minmax(420px, 32%);
    gap: 1.25rem;
  }

  main.app-wide,
  .navbar .app-wide {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }
}

@media (max-width: 1199.98px) {
  .primary-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== v3 shell / landing ===== */
:root {
  --shell-paper: #f7f2e8;
  --shell-paper-strong: #f3ede1;
  --shell-line: rgba(155, 121, 63, .18);
  --shell-ink: #2a3555;
  --shell-blue: #2f48ae;
  --shell-blue-soft: #eaf0ff;
  --shell-red: #c6525f;
  --shell-green: #1b8d63;
  --shell-orange: #ef9e23;
}
body,
.quick-calculator-page {
  background:
    linear-gradient(to bottom, rgba(155,121,63,.11) 1px, transparent 1px) 0 0 / 100% 32px,
    var(--shell-paper);
}
.material-icons-round {
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  line-height: 1;
}
.shell-navbar.appbar,
.appbar {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(47,72,174,.12);
}
.shell-brand,
.navbar-brand { color: var(--shell-ink) !important; }
.shell-logo {
  width: 52px; height: 52px; display:grid; place-items:center; border-radius: 16px;
  background: linear-gradient(135deg, var(--shell-blue-soft), #fff); color: var(--shell-blue);
  border: 1px solid rgba(47,72,174,.16); font-size: 30px;
}
.shell-kicker { display:block; text-transform: uppercase; letter-spacing: .18em; color: var(--shell-red); font-size: .72rem; font-weight: 800; }
.shell-title { font-family: 'Caveat', cursive; color: var(--shell-blue); font-size: 3rem; line-height: .92; }
.shell-subtitle, .brand-subtitle { color: #6c7488 !important; }
.shell-action-btn, .navbar .btn {
  border-radius: 14px; border: 1px solid rgba(47,72,174,.16);
  background: rgba(255,255,255,.9); color: var(--shell-ink);
}
.shell-action-btn:hover, .navbar .btn:hover { background: var(--shell-blue-soft); }
.app-wide { max-width: 1750px; }
body { padding-top: 94px; color: var(--shell-ink); }
.shell-panel, .hero-card, .app-card, .quick-input-card, .quick-result-card {
  background: rgba(255,255,255,.82); border: 1px solid rgba(47,72,174,.12);
  border-radius: 26px; box-shadow: 0 12px 34px rgba(50,50,93,.08);
}
.landing-hero { padding: 2rem; }
.eyebrow-shell, .eyebrow { display:inline-flex; align-items:center; gap:.45rem; color: var(--shell-red); font-size:.82rem; font-weight:800; text-transform: uppercase; letter-spacing:.08em; }
.shell-heading { font-family: 'Caveat', cursive; color: var(--shell-blue); font-size: clamp(3rem, 4vw, 4.8rem); line-height: .95; margin: .5rem 0 1rem; }
.shell-lead { font-size: 1.06rem; color: #536078; max-width: 62rem; }
.hero-pill-list { display:flex; flex-wrap:wrap; gap:.75rem; margin-top:1.2rem; }
.hero-pill { display:inline-flex; align-items:center; gap:.45rem; padding:.55rem .9rem; border-radius:999px; background:#fff; border:1px solid rgba(47,72,174,.12); font-weight:600; color:#52617b; }
.shell-card { display:flex; gap:1rem; padding:1.3rem; border-radius:22px; background: linear-gradient(180deg, #fff, #f9fbff); border:1px solid rgba(47,72,174,.12); }
.shell-card-highlight { min-height: 100%; }
.shell-card-icon { width:64px; height:64px; border-radius:18px; display:grid; place-items:center; font-size: 30px; }
.shell-icon-calc { background: rgba(47,72,174,.12); color: var(--shell-blue); }
.section-tag { text-transform: uppercase; letter-spacing: .12em; font-size: .73rem; font-weight: 800; color: var(--shell-red); }
.shell-section-title { font-size: 1.7rem; font-weight: 800; color: var(--shell-ink); }
.shell-steps li { margin-bottom:.45rem; color:#586684; }
.mode-card { padding: 1.5rem; border-radius: 24px; background: linear-gradient(180deg,#fff,#fbfdff); border:1px solid rgba(47,72,174,.14); box-shadow: 0 8px 24px rgba(50,50,93,.07); }
.mode-card-top { display:flex; align-items:center; justify-content:space-between; margin-bottom:1rem; }
.mode-badge { display:inline-flex; align-items:center; padding:.35rem .65rem; background:var(--shell-blue-soft); color:var(--shell-blue); border-radius:999px; font-weight:700; font-size:.85rem; }
.mode-icon { width:54px; height:54px; display:grid; place-items:center; border-radius:16px; font-size:30px; }
.mode-card-calculadora .mode-icon { background: rgba(27,141,99,.12); color: var(--shell-green); }
.mode-card-diferenca .mode-icon { background: rgba(239,158,35,.14); color: var(--shell-orange); }
.mode-card h3 { font-size: 1.45rem; font-weight: 800; margin-bottom:.6rem; }
.mode-card p { color:#586684; }
.mode-list { padding-left:1.2rem; color:#56637b; }
.mode-list li { margin-bottom:.42rem; }
.mode-actions { margin-top: 1rem; display:flex; }
.mode-actions .btn { display:inline-flex; align-items:center; gap:.35rem; border-radius: 14px; }
.shell-accordion .accordion-item,
.accordion-item { border:1px solid rgba(47,72,174,.12); border-radius: 18px !important; overflow:hidden; background: rgba(255,255,255,.74); }
.shell-accordion .accordion-button,
.accordion-button { background: rgba(235,240,255,.7); color: var(--shell-ink); font-weight: 700; box-shadow:none; }
.shell-accordion .accordion-button:not(.collapsed),
.accordion-button:not(.collapsed) { background: rgba(227,234,255,.9); color: var(--shell-blue); }
.shell-modal .modal-content,
.shell-modal { border-radius: 24px; background: #fff; border:1px solid rgba(47,72,174,.12); }
.settings-shortcut { display:flex; flex-direction:column; gap:.2rem; padding:1rem; text-decoration:none; color:inherit; background:#f8faff; border:1px solid rgba(47,72,174,.12); border-radius:18px; }
.settings-shortcut span.material-icons-round { color: var(--shell-blue); font-size: 28px; }
.settings-shortcut strong { color: var(--shell-ink); }
.settings-shortcut small { color:#647089; }
.app-footer { display:flex; justify-content:space-between; flex-wrap:wrap; gap:.8rem; color:#66748f; padding: 1rem 0; font-size:.9rem; }
.info-icon { color: var(--shell-blue); }
.app-card-header { background: transparent; border-bottom: 1px solid rgba(47,72,174,.1); }
.section-number { background: var(--shell-blue-soft); color: var(--shell-blue); }
.status-panel, .quick-status-panel { background: rgba(250,252,255,.92); border:1px solid rgba(47,72,174,.12); }
.search-group .input-group-text, .input-group-text { background: #fff; }
.primary-cards-grid { gap: 1rem; }
.primary-card-main .card, .primary-card-side .card { min-height: 100%; }
.quick-summary-grid { display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.quick-summary-card { background:#fff; border:1px solid rgba(47,72,174,.12); border-radius:18px; padding:1rem; display:flex; gap:.8rem; align-items:center; }
.quick-summary-total { background: linear-gradient(180deg, #f8fbff, #ecf3ff); }
.quick-summary-icon { width:44px; height:44px; display:grid; place-items:center; border-radius:14px; background: var(--shell-blue-soft); color: var(--shell-blue); }
@media (max-width: 992px) {
  .shell-title { font-size: 2.4rem; }
  .quick-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 576px) {
  .quick-summary-grid { grid-template-columns: 1fr; }
  .landing-hero, .shell-panel { padding: 1.2rem; }
}

/* ===== v3.1 refinements ===== */
.material-icons-round {
  font-family: 'Material Icons Round' !important;
  font-weight: normal;
  font-style: normal;
  font-size: 1.15em;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'liga';
  vertical-align: -.14em;
}
.mi-blue { color: #2563eb !important; }
.mi-purple { color: #7c3aed !important; }
.mi-green { color: #059669 !important; }
.mi-orange { color: #ea580c !important; }
.mi-red { color: #dc2626 !important; }
.mi-slate { color: #64748b !important; }

.main-expander-header {
  position: relative;
  padding-right: 4.2rem !important;
  cursor: pointer;
}
.main-expander-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  min-height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f4f7ff;
  border: 1px solid #cbd8f4;
}
.main-expander-toggle .material-icons-round { transition: transform .2s ease; }
.main-expander-toggle:not(.collapsed) .material-icons-round { transform: rotate(180deg); }
[data-main-expander] > .card-body.collapse:not(.show) { display: none; }

.creator-pill {
  margin-inline: auto;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .9rem;
  border: 1px solid #cbd8f4;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: #243b75;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(47,72,174,.08);
}
.creator-pill:hover { background: #eef3ff; color: #1d4ed8; }
.creator-pill-separator { width: 1px; height: 18px; background: #d7deed; }
.creator-pill small { color: #c24155; font-weight: 700; }

.competence-picker [data-competence-display] {
  background: #fff;
  cursor: pointer;
  font-weight: 650;
}
.competence-modal .modal-dialog { max-width: 560px; }
.competence-modal .modal-content {
  border: 0;
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(15,23,42,.28);
}
.competence-modal-header {
  border: 0;
  padding: 1.2rem 1.25rem .4rem;
  align-items: center;
}
.competence-modal-header small { color: #64748b; }
.competence-round-btn {
  width: 42px;
  height: 42px;
  min-height: 42px;
  border: 1px solid #cbd8f4;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: #164e75;
}
.competence-picker-panel {
  background: #f8fbff;
  border: 1px solid #cfe0f5;
  border-radius: 20px;
  padding: 1rem;
}
.competence-year-nav {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  text-align: center;
  gap: .7rem;
  margin-bottom: .8rem;
}
.competence-year-nav strong { font-size: 1.08rem; color: #17416c; }
.competence-month-grid,
.competence-year-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem;
}
.competence-month-btn,
.competence-year-btn {
  border: 1px solid #c7d8ef;
  background: #fff;
  color: #173b63;
  border-radius: 13px;
  font-weight: 750;
  min-height: 42px;
}
.competence-month-btn:hover,
.competence-year-btn:hover { background: #eef4ff; border-color: #8fb0e2; }
.competence-month-btn.is-selected,
.competence-year-btn.is-selected {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #2563eb, #6d3dd1);
  box-shadow: 0 8px 18px rgba(70,66,190,.22);
}
.competence-year-labels {
  display: flex;
  justify-content: space-between;
  margin: 1rem 0 .45rem;
  color: #64748b;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
}

.smart-source-control { display: grid; gap: .25rem; min-width: 150px; }
.smart-source-control > span {
  font-size: .67rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6b7280;
  font-weight: 800;
}
.smart-source-control select {
  border-color: #c7d8ef;
  background-color: #f8fbff;
  font-size: .75rem;
}
.editable-calculation input[readonly] {
  background: #f3f6fa;
  color: #65748a;
  cursor: not-allowed;
}
.calculation-mode-label { white-space: nowrap; }

.documentation-page .doc-hero { padding: 2rem; }
.doc-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1rem; }
.doc-card { background:#fff; border:1px solid #d6e1f0; border-radius:20px; padding:1.15rem; }
.doc-card-icon { width:46px; height:46px; border-radius:14px; display:grid; place-items:center; background:#eef3ff; margin-bottom:.75rem; }
.doc-formula { display:block; background:#0f2742; color:#e8f4ff; border-radius:12px; padding:.8rem; margin-top:.7rem; overflow:auto; }
.doc-example { border-left:4px solid #7c3aed; background:#f7f3ff; padding:.8rem 1rem; border-radius:0 12px 12px 0; }
@media (max-width: 900px) {
  .doc-grid { grid-template-columns: 1fr; }
  .competence-month-grid, .competence-year-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.smart-comparison-banner {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin: 0;
  padding: .85rem 1rem;
  background: linear-gradient(90deg, #f4f0ff, #f8fbff);
  border-bottom: 1px solid #d8dff1;
  color: #344367;
}
.smart-comparison-banner > .material-icons-round {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(66,59,141,.09);
  font-size: 25px;
}
.smart-comparison-banner strong,
.smart-comparison-banner small { display: block; }
.smart-comparison-banner small { color: #65728c; margin-top: .1rem; }
.creator-pill-row {
  flex: 0 0 100%;
  display: flex;
  justify-content: center;
  margin-top: .25rem;
}
/* Controles visuais também usam Google Icons */
.accordion-button::after {
  width: auto;
  height: auto;
  margin-left: auto;
  background: none !important;
  transform: none !important;
  content: 'expand_more';
  font-family: 'Material Icons Round';
  font-size: 1.35rem;
  font-feature-settings: 'liga';
  color: #3159b8;
  transition: transform .2s ease;
}
.accordion-button:not(.collapsed)::after { transform: rotate(180deg) !important; }
.btn-close {
  background: none !important;
  width: 36px;
  height: 36px;
  padding: 0 !important;
  display: grid;
  place-items: center;
  opacity: 1;
  border-radius: 50%;
}
.btn-close::before {
  content: 'close';
  font-family: 'Material Icons Round';
  font-size: 1.25rem;
  font-feature-settings: 'liga';
  color: #475569;
}
.navbar-toggler { color: #24427a; border-color: #cbd8f4; }
.navbar-toggler .material-icons-round { font-size: 1.55rem; }

/* ===== v3.2.0 refinements ===== */
body { padding-bottom: 78px; }
.app-footer { min-height: 12px; padding: 0; margin: 0; }
.fixed-creator-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1050;
  display: flex;
  justify-content: center;
  padding: .45rem 1rem;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(247,242,232,.96) 32%);
}
.fixed-creator-footer .creator-pill {
  pointer-events: auto;
  margin: 0;
  padding: .48rem .9rem;
  max-width: calc(100vw - 2rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.creator-pill-separator,
.creator-pill small { display: none !important; }

.appbar-icon-actions { align-items: center; }
.appbar-icon-btn {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0 !important;
  display: inline-grid !important;
  place-items: center;
  border-radius: 50% !important;
  background: #fff !important;
  color: #294878 !important;
  border: 1px solid #d7e0f0 !important;
  box-shadow: 0 4px 12px rgba(31,61,112,.07);
}
.appbar-icon-btn:hover,
.appbar-icon-btn:focus-visible {
  background: #eef4ff !important;
  border-color: #9eb8e7 !important;
  transform: translateY(-1px);
}
.appbar-icon-btn .material-icons-round { font-size: 1.3rem; }
.home-brand-icon {
  background: #eef4ff !important;
  border-color: #c7d8f3 !important;
}
.home-brand-icon .material-icons-round { font-size: 1.45rem; }

/* Garante que textos de ligatura nunca apareçam como palavras. */
.material-icons-round {
  font-family: 'Material Icons Round' !important;
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'liga';
}

/* Documentação: conteúdo contido, legível e responsivo. */
.documentation-page main { max-width: 1480px; }
.documentation-page .shell-panel { overflow: hidden; }
.documentation-page .doc-hero {
  padding: clamp(1.25rem, 2vw, 2.25rem);
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(240,245,255,.92));
}
.documentation-page .shell-heading {
  font-size: clamp(2.7rem, 5vw, 4.4rem);
  overflow-wrap: anywhere;
}
.doc-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}
.doc-card {
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  word-break: normal;
  overflow-wrap: anywhere;
}
.doc-card p { color: #596781; line-height: 1.6; }
.doc-formula {
  width: 100%;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.55;
}
.doc-example {
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.55;
}
.documentation-page .accordion-item { margin-bottom: .75rem !important; }
.documentation-page .accordion-button {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
  padding: 1rem 1.1rem;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}
.documentation-page .accordion-button > .material-icons-round {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(35,63,112,.08);
}
.documentation-page .accordion-body {
  padding: 1.15rem;
  overflow: hidden;
}
.documentation-page .accordion-body p { line-height: 1.65; color: #4f5f7a; }
@media (max-width: 991.98px) {
  .doc-grid { grid-template-columns: 1fr; }
}

/* Seletor de competência: somente o campo textual e um único calendário. */
.competence-picker input[type="month"].d-none { display: none !important; }
.competence-picker [data-competence-display] {
  text-transform: none;
  font-variant-numeric: tabular-nums;
}
.competence-open-btn { width: 46px; padding-inline: 0; }

/* ===== v3.3.0 — central com três modos ===== */
.landing-main-title { font-size: clamp(2.45rem, 4vw, 3.8rem); }
.mode-card { display: flex; flex-direction: column; }
.mode-card .mode-actions { margin-top: auto; padding-top: .75rem; }
.mode-card-retroativo .mode-icon { background: rgba(124,58,237,.12); color: #7c3aed; }
.mode-card-retroativo { border-color: rgba(124,58,237,.18); }
@media (min-width: 1200px) {
  .mode-card { min-height: 100%; }
}

/* ===== v3.3.1 refinements ===== */
.mode-card-top { justify-content: flex-end; }
.mode-card .btn .material-icons-round { margin-right: .35rem; }
.mode-card .btn { gap: .35rem; }
.doc-card { padding: 1.5rem !important; }
.doc-card-icon { width: auto; height: auto; background: transparent !important; box-shadow: none !important; border-radius: 0 !important; margin-bottom: .9rem; }
.doc-card-icon .material-icons-round, .doc-card > .material-icons-round { font-size: 2rem; }
.documentation-page .accordion-button > .material-icons-round { background: transparent; box-shadow: none; width: auto; height: auto; border-radius: 0; }
.app-toggle-compact { align-items: center; gap: .65rem; }
.app-toggle-compact .app-toggle-copy strong { font-size: .86rem; }
.app-toggle-compact .app-toggle-copy small { display: block; color: #66748e; }
.retro-input-group-compact .form-control, .retro-input-group-compact .input-group-text { min-height: 42px; }
.mobile-mode-shortcuts { display: none; width: 100%; margin-top: .75rem; gap: .5rem; }
.mobile-mode-shortcuts .btn { flex: 1 1 0; min-height: 42px; border-radius: 14px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; background: #fff; border: 1px solid #d7e0f0; color: #294878; }
.mobile-mode-shortcuts .btn.is-active { background: linear-gradient(135deg,#2563eb,#6d3dd1); color: #fff; border-color: transparent; }
@media (max-width: 767.98px) { .mobile-mode-shortcuts { display: flex; } .appbar .container-fluid { padding-bottom: .75rem; } .mode-card .mode-actions .btn { width: 100%; } }
.competence-modal .modal-dialog { max-width: min(980px, calc(100vw - 1rem)); }
.competence-modal .modal-content { border-radius: 28px; background: #f7f9fc; }
.competence-modal .modal-header, .competence-modal .modal-footer { border: 0; }
.competence-topband { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border-radius: 24px 24px 0 0; background: linear-gradient(90deg,#26539a,#7538b8); color: #fff; }
.competence-topband > div { padding: 1rem; text-align: center; }
.competence-topband small { display: block; opacity: .82; text-transform: uppercase; font-weight: 800; letter-spacing: .05em; }
.competence-topband strong { display: block; font-size: 1.2rem; margin-top: .2rem; }
.competence-modal-body { padding: 1rem 1rem 1.1rem; }
.competence-summary-row { display: grid; grid-template-columns: 44px 1fr 44px; gap: .75rem; align-items: center; margin-bottom: .9rem; }
.competence-summary-card { background: #edf2f8; border-radius: 18px; padding: .95rem 1rem; text-align: center; }
.competence-summary-card strong { display: block; font-size: clamp(1.15rem, 2vw, 1.65rem); color: #143f6c; }
.competence-summary-card small { color: #6a7a94; }
.competence-toolbar { display: flex; justify-content: space-between; gap: .75rem; align-items: center; margin-bottom: .9rem; flex-wrap: wrap; }
.competence-view-toggle { display: inline-flex; gap: .25rem; padding: .25rem; border-radius: 999px; background: #edf2f7; border: 1px solid #d2ddec; }
.competence-view-toggle .btn { border-radius: 999px; min-height: 38px; border: 0; color: #21456f; font-weight: 800; }
.competence-view-toggle .btn.is-active { background: #fff; box-shadow: 0 2px 8px rgba(31,61,112,.08); }
.competence-calendar-wrap { border: 1px solid #cfdaea; border-radius: 22px; padding: .85rem; background: #f5f8fc; }
.competence-quick-panel { margin-bottom: .85rem; border: 1px solid #cfdaea; border-radius: 20px; padding: .85rem; background: #f8fbff; }
.competence-panel-yearhead { display: grid; grid-template-columns: 44px 1fr 44px; gap: .5rem; align-items: center; text-align: center; margin-bottom: .8rem; }
.competence-panel-yearhead strong { color: #17416c; font-size: 1.05rem; }
.competence-month-grid, .competence-year-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .55rem; }
.competence-month-btn, .competence-year-btn, .competence-day-btn { border: 1px solid #c7d8ef; background: #fff; color: #173b63; border-radius: 13px; font-weight: 750; min-height: 42px; }
.competence-month-btn.is-selected, .competence-year-btn.is-selected { color: #fff; border-color: transparent; background: linear-gradient(135deg, #2563eb, #6d3dd1); box-shadow: 0 8px 18px rgba(70,66,190,.22); }
.competence-year-labels { display: flex; justify-content: space-between; margin: .8rem 0 .45rem; color: #64748b; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.competence-months-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.competence-month-card { border: 1px solid #cfdaea; border-radius: 18px; padding: .7rem .7rem .85rem; background: #fff; }
.competence-month-title { text-align: center; color: #163f6a; font-size: 1.15rem; font-weight: 800; margin-bottom: .5rem; }
.competence-month-title small { color: #6c7c95; margin-left: .25rem; }
.competence-weekdays, .competence-days-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .35rem; }
.competence-weekdays span { text-align: center; font-size: .78rem; font-weight: 800; color: #7c3aed; padding: .3rem 0; }
.competence-day-btn { min-height: 40px; padding: 0; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.competence-day-btn.is-muted { color: #bac4d1; background: transparent; border-color: transparent; }
.competence-day-btn.is-selected { border-color: #b56be8; color: #7c3aed; box-shadow: inset 0 0 0 1px #c084fc; }
.competence-day-btn.is-today { box-shadow: inset 0 0 0 1px #8bb3ec; }
.competence-footer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .9rem; }
.competence-status-chip { display: inline-flex; align-items: center; gap: .55rem; padding: .45rem .7rem; border-radius: 999px; background: #eef2f7; color: #58708d; font-weight: 700; }
.competence-footer-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-left: auto; }
@media (max-width: 900px) { .competence-months-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .competence-month-grid, .competence-year-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .competence-summary-row { grid-template-columns: 40px 1fr 40px; gap: .5rem; } .competence-footer-actions { width: 100%; } .competence-footer-actions .btn { flex: 1 1 0; } }

/* ===== v3.3.2 refinements ===== */
.shell-card-clean { background: linear-gradient(180deg, #ffffff, #fbfdff); padding: 1.55rem; }
.shell-card-clean .shell-card-icon { background: transparent; width: auto; height: auto; border-radius: 0; }
.shell-card-clean .shell-card-icon .material-icons-round { font-size: 2.2rem; }
.mode-card, .doc-card, .download-card { padding: 1.5rem !important; }
.mode-card h3, .doc-card h3, .download-card h3 { margin-top: .35rem; margin-bottom: .7rem; }
.mode-card p, .doc-card p, .download-card p { line-height: 1.65; margin-bottom: .9rem; }
.mode-card-top { justify-content: flex-start; margin-bottom: .8rem; }
.mode-icon, .download-card > .material-icons-round {
  width: auto !important;
  height: auto !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 2rem !important;
  display: inline-flex;
}
.mode-card-calculadora .mode-icon { color: var(--shell-green); }
.mode-card-diferenca .mode-icon { color: var(--shell-orange); }
.mode-card-retroativo .mode-icon { color: #7c3aed; }
.mode-btn { background: transparent !important; font-weight: 700; }
.mode-btn .material-icons-round { margin-right: .35rem; }
.mode-btn-calc { color: var(--shell-green) !important; border-color: rgba(27,141,99,.45) !important; }
.mode-btn-diff { color: var(--shell-orange) !important; border-color: rgba(239,158,35,.45) !important; }
.mode-btn-retro { color: #7c3aed !important; border-color: rgba(124,58,237,.35) !important; }
.mode-btn:hover, .mode-btn:focus { background: rgba(37,99,235,.04) !important; }
.download-card {
  height: 100%;
  background: linear-gradient(180deg,#fff,#fbfdff);
  border:1px solid rgba(47,72,174,.14);
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(50,50,93,.07);
  display:flex;
  flex-direction:column;
}
.download-card .btn { margin-top: auto; align-self: flex-start; }
.documentation-page .shell-panel,
.landing-body .shell-panel { padding: 1.5rem; }
.documentation-page .accordion-button .material-icons-round { min-width: 24px; }
.documentation-page .accordion-button { align-items: center; }
.doc-card-icon { width: auto; height: auto; background: transparent !important; border-radius: 0 !important; margin-bottom: .8rem; }
.doc-card-icon .material-icons-round { font-size: 2rem; }
.competence-toolbar { justify-content: flex-end; }
.competence-calendar-wrap { background: #f8fbff; }
.competence-footer-actions { display:flex; gap:.5rem; flex-wrap:wrap; }
.competence-months-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:.85rem; }
@media (max-width: 900px) {
  .competence-months-grid { grid-template-columns: 1fr; }
}

/* ===== v3.3.3 — identidade visual unificada e calendário de faltas ===== */
:root {
  --card-thin-border: #d9e3f1;
  --card-thin-shadow: 0 4px 14px rgba(32, 62, 105, .055);
}
.appbar {
  background: rgba(255, 255, 255, .97) !important;
  border-bottom: 1px solid #e2e8f2;
  box-shadow: 0 3px 12px rgba(32, 62, 105, .06) !important;
}
.appbar .brand-icon,
.appbar-icon-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px;
  border-radius: 12px !important;
  background: #fff !important;
  border: 1px solid #dce5f1 !important;
  box-shadow: 0 2px 7px rgba(31, 65, 110, .05) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.appbar .brand-icon .material-icons-round,
.appbar-icon-btn .material-icons-round { font-size: 21px; }
.appbar-icon-btn:hover,
.appbar-icon-btn:focus {
  border-color: #9fb7d7 !important;
  background: #f8fbff !important;
  transform: translateY(-1px);
}
.shell-panel,
.hero-card,
.app-card,
.retro-card,
.retro-result-card,
.settings-shortcut,
.doc-card,
.mode-card,
.download-card,
.status-panel,
.quick-summary-card,
.hour-input-card,
.tip-box {
  border: 1px solid var(--card-thin-border) !important;
  box-shadow: var(--card-thin-shadow) !important;
}
.shell-panel,
.hero-card,
.app-card,
.retro-card,
.retro-result-card { border-radius: 18px !important; }
.mode-card,
.doc-card,
.download-card { border-radius: 16px !important; }
.app-card-header,
.card-header.app-card-header {
  background: #f7f9fd !important;
  border-bottom: 1px solid #e1e8f2 !important;
  padding: .95rem 1.1rem !important;
}
.app-card > .card-body,
.retro-card > .card-body,
.retro-result-card > .card-body { padding: 1.1rem !important; }
.quick-summary-card,
.hour-input-card { border-radius: 14px !important; }
.quick-summary-icon,
.hour-icon,
.notification-icon {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}
.quick-summary-negative strong,
.quick-formula-negative code,
.dsr-loss-row .result-value { color: #b4233a !important; }
.salary-proportional-row { background: #f4faf6; }
.dsr-loss-row { background: #fff5f6; }

.absence-modal .modal-dialog { max-width: 680px; }
.absence-modal .modal-content {
  border: 1px solid #d8e3f1;
  border-radius: 22px;
  box-shadow: 0 18px 45px rgba(26, 58, 100, .16);
  overflow: hidden;
}
.absence-modal .modal-header,
.absence-modal .modal-footer {
  border-color: #e3eaf3;
  background: #fbfcff;
}
.absence-month-title {
  font-weight: 800;
  color: #143f6c;
  text-align: center;
  font-size: 1.2rem;
  margin-bottom: .35rem;
}
.absence-calendar-card {
  border: 1px solid #d7e2f0;
  border-radius: 16px;
  background: #f8fbff;
  padding: .85rem;
}
.absence-weekdays,
.absence-days-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .4rem;
}
.absence-weekdays span {
  text-align: center;
  color: #6d28d9;
  font-size: .75rem;
  font-weight: 800;
  padding: .2rem 0;
}
.absence-day-placeholder { min-height: 46px; }
.absence-day-btn {
  min-height: 46px;
  border: 1px solid #d7e2f0 !important;
  background: #fff !important;
  color: #173a61 !important;
  border-radius: 12px !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: .25rem !important;
  font-weight: 750;
}
.absence-day-btn small { min-height: .7rem; font-size: .58rem; color: #8795aa; }
.absence-day-btn.is-sunday { background: #faf7ff !important; }
.absence-day-btn.is-selected {
  color: #fff !important;
  border-color: transparent !important;
  background: linear-gradient(135deg, #e23d5e, #a82d73) !important;
  box-shadow: 0 6px 15px rgba(183, 43, 93, .2) !important;
}
.absence-day-btn.is-selected small { color: rgba(255,255,255,.82); }
.absence-selection-summary {
  display: grid;
  gap: .65rem;
  border: 1px solid #dbe5f1;
  border-radius: 14px;
  padding: .85rem;
  background: #fff;
  color: #50627c;
}
.absence-selection-summary p { font-size: .86rem; line-height: 1.5; }
.absence-loss-chip,
.absence-carryover {
  display: flex;
  gap: .55rem;
  align-items: center;
  padding: .65rem .75rem;
  border-radius: 12px;
}
.absence-loss-chip { background: #fff0f3; color: #98233f; }
.absence-loss-chip small { display: block; color: #8b6170; }
.absence-carryover { background: #eef5ff; color: #315b8f; }

.verb-code-note {
  display: block;
  font-size: .75rem;
  color: #71819a;
  margin-top: .2rem;
}
@media (max-width: 575.98px) {
  .absence-weekdays,
  .absence-days-grid { gap: .25rem; }
  .absence-day-btn { min-height: 41px; border-radius: 10px !important; }
  .absence-modal .modal-body { padding: .85rem; }
}

/* ===== v3.3.5 — wide real, cards finos, entrada decimal e tooltips ===== */
.app-wide {
  width: 100% !important;
  max-width: none !important;
}
main.app-wide,
.navbar .app-wide {
  padding-left: 10px !important;
  padding-right: 10px !important;
}
@media (max-width: 767.98px) {
  main.app-wide,
  .navbar .app-wide { padding-left: 6px !important; padding-right: 6px !important; }
}
.shell-panel,
.hero-card,
.app-card,
.mode-card,
.doc-card,
.download-card,
.status-panel,
.settings-shortcut,
.quick-summary-card,
.hour-input-card,
.tip-box {
  border-width: 1px !important;
  border-color: #dde6f1 !important;
  box-shadow: 0 2px 9px rgba(31, 65, 110, .045) !important;
}
.app-card-header,
.card-header.app-card-header {
  min-height: 0 !important;
  padding: .72rem .9rem !important;
  background: #fbfcfe !important;
}
.app-card > .card-body { padding: .9rem !important; }
.rtl-decimal-input {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}
.rtl-decimal-input:focus { text-align: right !important; }
.tooltip { pointer-events: none !important; }
.tooltip.show { opacity: .96; }

/* ===== v4.5.0 — Guia didático reforçado ===== */
.guide-mode-flow-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.8rem; }
.guide-mode-flow { min-width:0; display:grid; grid-template-columns:48px 1fr; gap:.75rem; padding:1rem; border:1px solid #dbe5ef; border-radius:16px; background:#fff; }
.guide-mode-flow > .material-icons-round { width:44px; height:44px; display:grid; place-items:center; border-radius:13px; font-size:23px!important; }
.guide-mode-flow h3 { margin:.3rem 0 .35rem; color:#183451; font-size:1rem; }
.guide-mode-flow p { margin:0 0 .45rem; color:#52657d; font-size:.75rem; }
.guide-mode-flow ul { margin:.25rem 0 .55rem; padding-left:1.05rem; color:#52657d; font-size:.72rem; line-height:1.55; }
.guide-mode-flow small { display:block; color:#40556d; font-size:.68rem; }
.guide-flow-badge { display:inline-flex; padding:.2rem .5rem; border-radius:999px; background:#f1f5f9; color:#53667a; font-size:.59rem; font-weight:850; text-transform:uppercase; letter-spacing:.04em; }
.guide-mode-flow--green { background:#f4fdf8; border-color:#bde9cf; }.guide-mode-flow--green>.material-icons-round{background:#e2f8eb;color:#059669}
.guide-mode-flow--blue { background:#f5faff; border-color:#c5def4; }.guide-mode-flow--blue>.material-icons-round{background:#e6f2ff;color:#2563eb}
.guide-mode-flow--purple { background:#fbf8ff; border-color:#decdf8; }.guide-mode-flow--purple>.material-icons-round{background:#f1eafe;color:#7c3aed}
.guide-mode-flow--orange { background:#fffaf4; border-color:#f4d5ae; }.guide-mode-flow--orange>.material-icons-round{background:#fff0df;color:#ea580c}
.support-resource-head { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; }
.support-resource-badge { display:inline-flex; align-items:center; gap:.35rem; padding:.45rem .7rem; border:1px solid #cbdcf0; border-radius:999px; background:#f7fbff; color:#2a5f97; font-size:.68rem; font-weight:850; }
.support-resource-card { display:grid; grid-template-columns:58px minmax(0,1fr) auto; gap:1rem; align-items:center; padding:1rem; border:1px solid #cfe0ef; border-radius:18px; background:linear-gradient(135deg,#fbfdff,#f3f9ff); }
.support-resource-icon { width:54px; height:54px; display:grid; place-items:center; border-radius:16px; background:#e8f7ef; color:#059669; }
.support-resource-icon .material-icons-round { font-size:28px!important; }
.support-resource-content h3 { margin:0 0 .3rem; color:#17375d; font-size:1rem; }
.support-resource-content p { margin:0; color:#5c6e83; font-size:.76rem; line-height:1.55; }
.support-resource-pills { display:flex; flex-wrap:wrap; gap:.4rem; margin-top:.65rem; }
.support-resource-pills span { padding:.25rem .5rem; border:1px solid #d7e4ef; border-radius:999px; background:#fff; color:#53677d; font-size:.6rem; font-weight:800; }
.support-resource-button { min-width:190px; display:flex; align-items:center; gap:.55rem; padding:.75rem .9rem; border:1px solid #8fb9e3; border-radius:14px; background:#fff; color:#165a97; text-decoration:none; }
.support-resource-button:hover { background:#f2f8ff; color:#0f4e86; }
.support-resource-button>.material-icons-round { font-size:21px!important; }
.support-resource-button span:last-child { display:grid; }.support-resource-button strong{font-size:.76rem}.support-resource-button small{font-size:.6rem;color:#738297}
.formula-detail-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.55rem; margin-bottom:1rem; }
.formula-detail-grid article { display:flex; gap:.55rem; align-items:flex-start; padding:.7rem .75rem; border:1px solid #dce6ef; border-radius:13px; background:#f9fbfd; }
.formula-detail-grid article>.material-icons-round { flex:0 0 auto; font-size:20px!important; margin-top:.1rem; }
.formula-detail-grid small { display:block; color:#718096; font-size:.58rem; font-weight:900; text-transform:uppercase; letter-spacing:.05em; }
.formula-detail-grid strong { display:block; margin-top:.15rem; color:#30465e; font-size:.7rem; line-height:1.45; }
.tone-blue{color:#2563eb!important}.tone-green{color:#059669!important}.tone-purple{color:#7c3aed!important}.tone-orange{color:#ea580c!important}.tone-slate{color:#64748b!important}
.formula-caution { display:flex; gap:.6rem; align-items:flex-start; margin-top:1rem; padding:.75rem .85rem; border:1px solid #f2d7a8; border-radius:13px; background:#fffaf2; }
.formula-caution>.material-icons-round { color:#ea580c; font-size:20px!important; }.formula-caution strong{display:block;color:#7a4b13;font-size:.72rem}.formula-caution p{margin:.15rem 0 0!important;color:#775f43!important;font-size:.69rem!important}
.interactive-example { margin-top:1rem; padding:.85rem; border:1px solid #cfe0ef; border-radius:15px; background:linear-gradient(180deg,#fafdff,#f4f9fc); }
.interactive-example__head { display:flex; align-items:center; gap:.55rem; margin-bottom:.75rem; }.interactive-example__head>.material-icons-round{color:#2563eb;font-size:22px!important}.interactive-example__head div{display:grid;gap:.05rem}.interactive-example__head small{color:#64748b;font-size:.57rem;font-weight:900;text-transform:uppercase}.interactive-example__head strong{color:#193a5d;font-size:.75rem}.interactive-badge{margin-left:auto;padding:.25rem .5rem;border-radius:999px;background:#eaf8f0;color:#087443;font-size:.57rem;font-weight:900}
.interactive-example__fields { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.55rem; }.interactive-example__fields label{display:grid;gap:.25rem;color:#53667a;font-size:.62rem;font-weight:800}.interactive-example__fields input,.interactive-example__fields select{min-width:0;width:100%;height:36px;border:1px solid #cbd8e5;border-radius:9px;background:#fff;padding:.35rem .55rem;color:#213b58;font-size:.72rem}.guide-input-wrap{position:relative}.guide-input-wrap input{padding-right:36px}.guide-input-wrap small{position:absolute;right:9px;top:50%;transform:translateY(-50%);color:#8795a5;font-size:.58rem}
.interactive-example__results { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.55rem; margin-top:.65rem; }.interactive-example__results article{padding:.65rem .75rem;border:1px solid #dbe5ef;border-radius:11px;background:#fff}.interactive-example__results small{display:block;color:#718096;font-size:.58rem;font-weight:850}.interactive-example__results strong{display:block;margin-top:.12rem;color:#153b63;font-size:.86rem}
.interactive-example__memory { margin-top:.6rem; padding:.55rem .65rem; border-radius:10px; background:#102b48; color:#eaf5ff; font-family:ui-monospace,SFMono-Regular,Consolas,monospace; font-size:.64rem; line-height:1.5; overflow-wrap:anywhere; }
@media(max-width:850px){.guide-mode-flow-grid,.formula-detail-grid{grid-template-columns:1fr}.support-resource-card{grid-template-columns:48px 1fr}.support-resource-button{grid-column:1/-1;min-width:0}.support-resource-head{flex-direction:column}.interactive-example__fields{grid-template-columns:1fr}.interactive-example__results{grid-template-columns:1fr}.interactive-badge{display:none}}
