/* Legibilidade da aplicação autenticada. O site institucional mantém sua escala própria. */
.app {
  --app-text-small: 13px;
  --app-text-body: 15px;
  --app-text-title: 18px;
  --muted: var(--color-text-secondary);
  font-size: var(--app-text-body);
  line-height: 1.5;
}

.app :is(strong, time, .transaction-value, .bill-value, .promo-price, .stat-card) {
  font-variant-numeric: tabular-nums;
}

/* Cabeçalho superior e identificação PF/PJ */
.app .topbar {
  height: auto;
  min-height: 104px;
  gap: 24px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.app .top-identity {
  display: grid;
  align-content: center;
  margin-right: auto;
}

.app .topbar p {
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.4;
}

.app .topbar h2 {
  font-size: 20px;
  line-height: 1.3;
}

.app .company-identity {
  max-width: min(100%, 520px);
  margin-top: 9px;
  gap: 10px;
  padding: 7px 11px 7px 7px;
  font-size: 12px;
  line-height: 1.35;
}

.app .company-identity-logo {
  flex-basis: 34px;
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.app .company-identity-copy {
  gap: 10px;
}

.app .company-identity b {
  max-width: 250px;
  font-size: 13px;
}

.app .company-identity i {
  padding-left: 10px;
  font-size: 12px;
  line-height: 1.35;
}

.app .top-actions {
  flex: 0 0 auto;
  align-items: center;
}

.app .profile-switcher button {
  min-height: 44px;
  padding: 8px 13px;
  font-size: 13px;
  line-height: 1.2;
}

.app .icon-btn {
  display: grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
}

/* Navegação lateral */
.app .sidebar nav button {
  min-height: 44px;
  font-size: 14px;
  line-height: 1.35;
}

.app .sidebar-tip b,
.app .profile-mini b {
  font-size: 14px;
}

.app .sidebar-tip p,
.app .sidebar-tip small,
.app .profile-mini small {
  font-size: 12px;
  line-height: 1.5;
}

/* Títulos, painéis e indicadores */
.app .page {
  padding-top: 40px;
}

.app .page-title {
  align-items: center;
  gap: 24px;
  margin-bottom: 30px;
}

.app .page-title h1,
.app #page-bills .page-title h1 {
  font-size: 30px;
  line-height: 1.2;
}

.app .page-title p,
.app #page-bills .page-title p {
  max-width: 720px;
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.55;
}

.app .stats-grid {
  gap: 20px;
}

.app .stat-card {
  min-width: 0;
  min-height: 138px;
  padding: 24px;
}

.app .stat-head,
.app .stat-card > span,
.app .payables-stats .stat-card > span,
.app .payable-report-stats .stat-card > span {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.app .stat-card strong,
.app .payables-stats .stat-card strong,
.app .payable-report-stats .stat-card strong {
  margin: 15px 0 9px;
  font-size: clamp(24px, 2vw, 29px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.app .stat-card small,
.app .payables-stats .stat-card small,
.app .payable-report-stats .stat-card small {
  font-size: 13px;
  line-height: 1.45;
}

.app .stat-card,
.app .panel {
  border-radius: 16px;
}

.app .panel-title {
  gap: 18px;
}

.app .panel-title h3,
.app .settings-form h3,
.app .report-chart h3 {
  font-size: 17px;
  line-height: 1.35;
}

.app .panel-title p {
  margin-top: 7px;
  font-size: 14px;
  line-height: 1.5;
}

.app :is(.btn, .select, .text-btn, .panel-title button) {
  font-size: 14px;
}

.app .btn,
.app .select {
  min-height: 44px;
}

.app .month-picker {
  min-width: 220px;
  gap: 5px;
  padding-top: 9px;
  padding-bottom: 9px;
}

.app .month-picker > span {
  font-size: 12px;
  line-height: 1.3;
}

.app .month-picker .select {
  min-height: 22px;
  font-size: 14px;
}

/* Listas financeiras e valores */
.app .transaction-row {
  min-height: 70px;
  gap: 15px;
  padding: 16px 4px;
}

.app .transaction-row b {
  font-size: 14px;
  line-height: 1.4;
}

.app .transaction-row small,
.app .transaction-row time {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.4;
}

.app .transaction-value {
  min-width: 112px;
  font-size: 15px;
  line-height: 1.35;
}

.app .category-meta,
.app .pie-legend span,
.app .goal-values small,
.app .goal-ring span,
.app .pie-center small,
.app .legend {
  font-size: 13px;
  line-height: 1.4;
}

.app .pie-center strong {
  font-size: 17px;
}

.app .fixed-card p,
.app .fixed-summary small,
.app .purchase-card p,
.app .purchase-card small,
.app .purchase-metadata {
  font-size: 13px;
  line-height: 1.55;
}

.app .fixed-state,
.app .purchase-section-title span,
.app .purchase-status-section .purchase-card > header > strong {
  font-size: 12px;
  line-height: 1.25;
}

.app .purchase-status-section .purchase-card > header > strong {
  font-size: 16px;
  line-height: 1.35;
}

.app .purchase-section-title p,
.app .installment-row small,
.app .installment-row button {
  font-size: 13px;
  line-height: 1.45;
}

.app .installment-row {
  min-height: 58px;
  padding-top: 14px;
  padding-bottom: 14px;
}

/* Busca, contatos, cobranças e contas empresariais */
.app .contact-toolbar,
.app .transaction-toolbar {
  gap: 18px;
  padding: 20px;
}

.app .contact-toolbar label > span,
.app .report-period > span,
.app .search-label,
.app .type-filter-group > span,
.app .payables-toolbar label > span,
.app .payable-report-filters label {
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: .35px;
}

.app .contact-toolbar input,
.app .search-field,
.app .type-filter-options,
.app .payables-toolbar .select,
.app .payable-report-filters input,
.app .payable-report-filters select {
  min-height: 46px;
  font-size: 14px;
}

.app .contact-toolbar > small,
.app .filter-result-bar,
.app .alphabetical-order,
.app .type-filter-options button {
  font-size: 13px;
  line-height: 1.4;
}

.app .filter-result-bar {
  min-height: 48px;
}

.app .supplier-card h3 {
  font-size: 18px;
}

.app .supplier-card .supplier-category,
.app .record-open,
.app .semantic-delete {
  font-size: 13px;
}

.app .supplier-contact {
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
}

.app .business-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app .supplier-list {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 18px;
}

.app .supplier-card-head {
  align-items: flex-start;
  flex-wrap: wrap;
}

.app .cards-list > .empty {
  grid-column: 1 / -1;
}

.app .bill-row {
  min-height: 96px;
  grid-template-columns: minmax(190px, 1.25fr) minmax(120px, .75fr) minmax(115px, .65fr) minmax(110px, .55fr) auto auto;
  gap: 18px;
  padding: 20px;
}

.app .bill-row b {
  font-size: 15px;
  line-height: 1.4;
}

.app .bill-row small,
.app .bill-due {
  font-size: 13px;
  line-height: 1.45;
}

.app .bill-value {
  min-width: 108px;
  font-size: 16px;
}

.app .bill-row .bill-supplier,
.app .bill-row .bill-due {
  display: block;
}

.app .bill-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.app .bill-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app .bill-actions button {
  min-height: 44px;
  padding: 8px 10px;
  font-size: 13px;
}

.app .bill-filter button,
.app .payable-tabs button {
  min-height: 44px;
  padding: 9px 13px;
  font-size: 13px;
  line-height: 1.3;
}

.app .payable-account h3,
.app .payable-row-content b {
  font-size: 17px;
}

.app .payable-account-list:has(> .payable-detail-row) {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr));
}

.app :is(.payable-sector, .payable-summary small, .payable-progress-label, .payable-account summary, .payable-installment small) {
  font-size: 13px;
  line-height: 1.5;
}

.app .payable-summary strong,
.app .payable-installment > strong {
  font-size: 15px;
  line-height: 1.35;
}

.app .payable-summary > span {
  min-width: 0;
  padding: 15px;
}

.app .sector-month-summary #payables-sector-summary {
  gap: 13px;
}

.app .sector-month-summary #payables-sector-summary > div {
  padding: 16px;
}

.app .sector-month-summary :is(span, small, strong),
.app .report-sector-row :is(span, strong),
.app .expense-month-row :is(b, small, strong, i) {
  font-size: 14px;
  line-height: 1.5;
}

.app .cashflow-balance span,
.app .cashflow-balance p,
.app .cashflow-week span,
.app .cashflow-week small,
.app .cashflow-event small {
  font-size: 13px;
  line-height: 1.5;
}

.app .cashflow-main .stat-card strong,
.app .cashflow-event b,
.app .cashflow-event > strong {
  font-size: 15px;
  line-height: 1.4;
}

/* Agenda e calendário */
.app .agenda-item {
  min-height: 82px;
  gap: 24px;
  padding: 20px 6px;
}

.app .agenda-item > time b {
  font-size: 18px;
}

.app .agenda-item > time small,
.app .agenda-item > div p,
.app .agenda-item > button {
  font-size: 13px;
  line-height: 1.45;
}

.app .agenda-item > div > b {
  font-size: 15px;
}

.app .agenda-item > button {
  min-height: 44px;
  padding: 8px 11px;
}

.app .calendar-weekdays span,
.app .calendar-day > b {
  font-size: 12px;
}

.app .calendar-task,
.app .calendar-day > small {
  font-size: 12px;
  line-height: 1.35;
}

/* Alertas, Clara e configurações */
.app .alerts-panel {
  width: min(390px, calc(100vw - 28px));
}

.app .alert-item {
  gap: 12px;
  padding: 15px 17px;
}

.app .alert-item b {
  font-size: 14px;
  line-height: 1.4;
}

.app .alert-item small,
.app .alerts-empty {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.5;
}

.app .alerts-badge {
  min-width: 22px;
  height: 22px;
  font-size: 12px;
}

.app .clara-panel-head p,
.app .clara-processing,
.app .clara-guided section > span,
.app #guided-params label,
.app .guided-result small {
  font-size: 12px;
  line-height: 1.45;
}

.app .clara-panel-head {
  min-height: 104px;
  padding: 22px 24px;
}

.app .chat-welcome,
.app .chat-message,
.app .clara-guided section > button:not(.guided-favorite),
.app .guided-back,
.app .guided-run,
.app #guided-params > b {
  font-size: 14px;
  line-height: 1.5;
}

.app .clara-guided section > button:not(.guided-favorite),
.app .guided-back,
.app .guided-run {
  min-height: 44px;
  padding: 10px 12px;
}

.app .settings-section-title p,
.app .settings-section-title > span,
.app .detail-kind,
.app .detail-field small,
.app .detail-field button {
  font-size: 12px;
  line-height: 1.45;
}

.app .settings-form label,
.app .company-settings label {
  font-size: 14px;
  line-height: 1.4;
}

.app .settings-form label small,
.app .company-settings label small {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}

.app .company-logo-editor {
  background: var(--cream);
}

.app .business-card-heading span,
.app .business-card-preview footer,
.app .business-card-preview footer b {
  font-size: 12px;
  line-height: 1.4;
}

.app .business-card-preview footer {
  bottom: 16px;
  color: var(--muted);
}

.app .report-legend,
.app .report-summary {
  font-size: 13px;
  line-height: 1.5;
}

.app .section-heading-inline > span,
.app .profile-tour b,
.app .profile-tour span {
  font-size: 13px;
  line-height: 1.45;
}

.app.business-mode #page-reports > .page-title p::after {
  font-size: 15px;
  line-height: 1.55;
}

dialog {
  --muted: var(--color-text-secondary);
}

.theme-dark dialog {
  --muted: var(--color-text-secondary);
}

dialog label {
  font-size: 14px;
  line-height: 1.4;
}

dialog input,
dialog select {
  min-height: 46px;
  font-size: 15px;
}

dialog .modal-head p,
dialog .calculation-summary,
dialog .choice-check small {
  font-size: 13px;
  line-height: 1.5;
}

#savings-modal .savings-available span,
#savings-modal .savings-available button {
  font-size: 13px;
  line-height: 1.45;
}

#savings-modal .savings-available strong {
  font-size: 16px;
  line-height: 1.35;
}

#savings-modal .savings-available button {
  min-height: 44px;
  padding: 9px 12px;
}

.record-details-dialog .detail-kind,
.record-details-dialog .detail-field small,
.record-details-dialog .detail-field button,
.day-dialog .day-task-item small,
.sector-dialog .sector-manager-row small,
.onboarding-dialog .onboarding-step {
  font-size: 13px;
  line-height: 1.45;
}

.record-details-dialog .detail-field span,
.day-dialog .day-task-item b,
.day-dialog .day-task-item p,
.sector-dialog .sector-manager-row b,
.onboarding-dialog .onboarding-options b {
  font-size: 14px;
  line-height: 1.5;
}

.onboarding-dialog .onboarding-options span,
.onboarding-dialog .profile-choice-reminder {
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1180px) {
  .app .bill-row {
    grid-template-columns: minmax(0, 1fr) minmax(120px, auto) auto;
    align-items: center;
  }

  .app .bill-row > :nth-child(1) { grid-column: 1; grid-row: 1; }
  .app .bill-row .bill-supplier { grid-column: 1; grid-row: 2; }
  .app .bill-row .bill-due { grid-column: 2; grid-row: 1; }
  .app .bill-row .bill-value { grid-column: 2; grid-row: 2; text-align: left; }
  .app .bill-row .bill-status { grid-column: 3; grid-row: 1; }
  .app .bill-row .bill-actions { grid-column: 3; grid-row: 2; }

  .app .business-dashboard > .stats-grid,
  .app .payables-stats,
  .app .payable-report-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app.business-mode .payable-report-grid {
    grid-template-columns: 1fr;
  }

  .app .payable-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .app .sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 15;
    width: 100%;
    height: auto;
    padding: 8px 12px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-right: 0;
    transform: none;
    box-shadow: 0 -8px 30px rgba(24, 58, 53, .08);
  }

  .app main,
  .app.clara-open main {
    margin-left: 0;
    padding-bottom: 82px;
  }

  .app .sidebar > .logo,
  .app .sidebar-tip,
  .app .profile-mini {
    display: none;
  }

  .app .sidebar nav {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .app .sidebar nav::-webkit-scrollbar {
    display: none;
  }

  .app .sidebar nav button {
    flex: 0 0 auto;
    min-height: 58px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 7px 12px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .app .sidebar nav button span {
    font-size: 18px;
  }

  .app .clara-panel {
    left: 0;
    bottom: 75px;
    z-index: 17;
  }

  .app .clara-overlay {
    z-index: 16;
  }
}

@media (max-width: 760px) {
  .app .topbar {
    min-height: 104px;
    gap: 12px;
    padding: 13px 18px;
  }

  .app .top-actions {
    gap: 8px;
  }

  .app .profile-switcher {
    position: static;
    transform: none;
    box-shadow: none;
  }

  .app #theme-toggle {
    display: none;
  }

  .app .company-identity {
    max-width: min(100%, 330px);
  }

  .app .company-identity b {
    max-width: 170px;
  }

  .app .page {
    padding-top: 30px;
  }

  .app .page-title {
    align-items: flex-start;
    margin-bottom: 24px;
  }

  .app .page-title h1,
  .app #page-bills .page-title h1 {
    font-size: 27px;
  }

  .app .stat-card {
    min-height: 128px;
    padding: 20px;
  }

  .app .transaction-row,
  .app .transaction-list.large .transaction-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }

  .app .transaction-row > .transaction-icon { grid-column: 1; grid-row: 1 / 3; }
  .app .transaction-row > span:nth-child(2) { grid-column: 2; grid-row: 1; }
  .app .transaction-row > time { display: block; grid-column: 2; grid-row: 2; }
  .app .transaction-row > .transaction-value { grid-column: 3; grid-row: 1; }
  .app .transaction-row > .delete-btn { grid-column: 3; grid-row: 2; justify-self: end; }

  .app .contact-toolbar,
  .app .transaction-toolbar {
    padding: 17px;
  }

  .app .calendar-weekdays,
  .app .task-calendar {
    min-width: 720px;
  }

  .app .calendar-task {
    font-size: 12px;
  }

  .app .legend {
    display: block;
    line-height: 1.5;
  }
}

@media (max-width: 620px) {
  .app .topbar {
    min-height: 0;
    align-items: stretch;
    flex-direction: column;
    padding-block: 16px;
  }

  .app .top-actions {
    justify-content: flex-start;
  }

  .app .profile-switcher-wrap {
    margin-right: auto;
  }

  .app .company-identity-copy {
    display: grid;
    gap: 2px;
  }

  .app .company-identity b {
    max-width: 190px;
  }

  .app .company-identity i {
    display: block;
    padding-left: 0;
    border-left: 0;
    font-size: 12px;
  }

  .app .business-dashboard > .stats-grid,
  .app .payables-stats,
  .app .payable-report-stats {
    grid-template-columns: 1fr;
  }

  .app .bill-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 11px 16px;
  }

  .app .bill-row > :nth-child(1) { grid-column: 1 / -1; grid-row: 1; }
  .app .bill-row .bill-supplier { grid-column: 1; grid-row: 2; }
  .app .bill-row .bill-due { grid-column: 2; grid-row: 2; }
  .app .bill-row .bill-value { grid-column: 1; grid-row: 3; }
  .app .bill-row .bill-status { grid-column: 2; grid-row: 3; }
  .app .bill-row .bill-actions { grid-column: 1 / -1; grid-row: 4; justify-content: flex-start; }

  .app .payable-summary,
  .app .sector-month-summary #payables-sector-summary {
    grid-template-columns: 1fr;
  }

  .app .danger-zone,
  .app .logout-zone,
  .app .settings-section-title {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }

  .app .danger-zone .btn,
  .app .logout-zone .btn {
    width: 100%;
  }
}

@media (max-width: 470px) {
  .app .topbar h2 {
    font-size: 18px;
  }

  .app .page-title {
    display: grid;
  }

  .app .stats-grid {
    grid-template-columns: 1fr;
  }

  .app .transaction-row,
  .app .transaction-list.large .transaction-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .app .transaction-row > .transaction-value {
    grid-column: 2;
    grid-row: 3;
    min-width: 0;
    margin-top: 4px;
    text-align: left;
  }

  .app .transaction-row > .delete-btn {
    grid-column: 1;
    grid-row: 3;
    justify-self: center;
  }
}
