.mobile-nav,
.mobile-brand {
  display: none;
}
.mobile-menu {
  color: var(--ft-text);
  background: var(--ft-surface);
  border: 1px solid var(--ft-border);
  border-radius: 22px 22px 0 0;
  width: min(100%, 560px);
  max-width: 100%;
  max-height: 85dvh;
  margin: auto auto 0;
  padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mobile-menu::backdrop {
  background: #0009;
  backdrop-filter: blur(4px);
}
.mobile-menu-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.mobile-menu-heading h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}
.mobile-menu-close {
  width: 44px;
  height: 44px;
  background: var(--ft-raised);
  color: var(--ft-text);
  border: 1px solid var(--ft-border);
  border-radius: 12px;
  font: inherit;
  font-size: 26px;
}
.mobile-menu-links {
  display: grid;
  gap: 5px;
}
.mobile-menu-links a {
  display: flex;
  align-items: center;
  min-height: 48px;
  gap: 14px;
  padding: 12px;
  border-radius: 10px;
  font-size: 15px;
  text-decoration: none;
}
.mobile-menu-links a[aria-current="page"] {
  background: var(--ft-accent-soft);
  color: var(--ft-accent-text);
}
.mobile-menu-links svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.mobile-menu-links .nav-count {
  display: none;
}
.mobile-menu-action {
  display: block;
  width: 100%;
  text-align: left;
  min-height: 48px;
  border: 0;
  border-top: 1px solid var(--ft-border);
  background: transparent;
  color: var(--ft-accent-text);
  font: inherit;
  font-size: 15px;
  padding: 14px 12px;
  margin-top: 12px;
}
.mobile-menu-logout {
  color: var(--ft-muted);
  margin-top: 0;
}
.mobile-menu-open {
  overflow: hidden;
}
@media (max-width: 700px) {
  .app-body .sidebar {
    display: none;
  }
  .app-body .mobile-brand {
    display: inline-flex;
    gap: 7px;
    font-size: 20px;
    white-space: nowrap;
  }
  .app-body .mobile-brand img {
    width: 30px;
    height: 30px;
  }
  .app-body .app-topbar {
    position: sticky;
    z-index: 25;
    top: 0;
    height: auto;
    min-height: 68px;
    padding: max(12px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right)) 12px
      max(16px, env(safe-area-inset-left));
    background: var(--ft-surface);
  }
  .app-body .app-topbar > p {
    display: none;
  }
  .app-body .topbar-controls {
    margin-left: auto;
  }
  .app-body .mobile-nav {
    position: fixed;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    padding: 8px max(6px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    background: var(--ft-surface);
    border-top: 1px solid var(--ft-border);
  }
  .mobile-nav a,
  .mobile-nav button {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    min-height: 52px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--ft-muted);
    font: inherit;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    padding: 5px 1px;
  }
  .mobile-nav svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
  }
  .mobile-more-icon {
    height: 21px;
    font-size: 19px;
    letter-spacing: 2px;
    line-height: 14px;
  }
  .mobile-nav a[aria-current="page"],
  .mobile-nav button[aria-pressed="true"] {
    color: var(--ft-accent-text);
    background: var(--ft-accent-soft);
  }
  .app-body .app-main {
    padding: 24px max(16px, env(safe-area-inset-right))
      calc(92px + env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }
  .app-body .page-heading h1 {
    font-size: clamp(25px, 7vw, 32px);
    line-height: 1.2;
    overflow-wrap: anywhere;
  }
  .app-body .page-heading p {
    font-size: 14px;
    line-height: 1.65;
  }
  .app-body
    :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    font-size: 16px;
    min-height: 48px;
    min-width: 0;
    max-width: 100%;
  }
  .app-body .filters .date-field input {
    font-size: 16px;
    padding: 10px 7px;
  }
  .app-body .filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
  }
  .app-body .filters .field {
    width: auto;
    min-width: 0;
    max-width: none;
  }
  .app-body .filters .period-field,
  .app-body .filters .account-field {
    grid-column: 1 / -1;
  }
  .app-body .filters .filter-submit {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 46px;
    margin: 0;
  }
  .app-body .heading-actions .button-primary {
    max-width: none;
    min-height: 46px;
  }
  .app-body .button {
    min-height: 44px;
  }
  .app-body .metric-card > strong {
    font-size: clamp(18px, 5.2vw, 25px);
    letter-spacing: -0.6px;
  }
  .app-body .metric-label {
    align-items: flex-start;
  }
  .app-body .metric-label .metric-arrow {
    flex-shrink: 0;
  }
  .app-body .panel-heading {
    flex-wrap: wrap;
  }
  .app-body .connection-main {
    min-width: 0;
    width: 100%;
  }
  .app-body .connection-text {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .app-body .connection-actions {
    margin-left: 0;
    flex-wrap: wrap;
    width: 100%;
  }
  .app-body .connection-actions .button {
    flex: 1;
    justify-content: center;
  }
  .app-body .connection-row > .status-badge {
    margin-left: 0;
  }
  .app-body .confirm-dialog {
    max-width: calc(100% - 28px);
    max-height: 85dvh;
    overflow-y: auto;
  }
  .app-body .toasts {
    bottom: calc(90px + env(safe-area-inset-bottom));
  }
  .app-body .transactions-table {
    display: block;
    white-space: normal;
  }
  .app-body .transactions-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .app-body .transactions-table tbody {
    display: grid;
    padding: 0 16px;
  }
  .app-body .transactions-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 10px;
    padding: 18px 0;
    border-bottom: 1px solid var(--ft-border);
  }
  .app-body .transactions-table tbody tr:last-child {
    border-bottom: 0;
  }
  .app-body .transactions-table td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
    max-width: 100%;
    font-size: 13px;
    overflow-wrap: anywhere;
  }
  .app-body .transactions-table .description-cell {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    max-width: 100%;
    font-size: 15px;
  }
  .app-body .transactions-table .date-cell {
    grid-column: 1;
    grid-row: 1;
  }
  .app-body .transactions-table .amount-cell {
    grid-column: 1 / -1;
    grid-row: 3;
    font-size: 20px;
    font-weight: 650;
    text-align: left;
  }
  .app-body .transactions-table .account-cell {
    grid-column: 1 / -1;
    grid-row: 4;
  }
  .app-body .transactions-table .category-cell {
    grid-column: 1 / -1;
  }
  .app-body .transactions-table .category-cell::before {
    content: "Categoria: ";
    color: var(--ft-muted);
  }
  .app-body .transactions-table .status-cell {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }
  .app-body .transactions-table .status-badge {
    white-space: normal;
    text-align: center;
  }
  .app-body .pg-intro > .button {
    white-space: normal;
  }
  .auth-body .auth-main {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
  .landing-page .hero-actions {
    flex-wrap: wrap;
  }
  .landing-page .hero-actions .button {
    min-height: 48px;
  }
  .landing-page .hero h1 {
    font-size: clamp(34px, 9.7vw, 54px);
  }
}
@media (max-width: 360px) {
  .app-body .metrics {
    grid-template-columns: minmax(0, 1fr);
  }
  .app-body .metric-card > strong {
    font-size: 28px;
  }
  .app-body .filters .date-field {
    grid-column: 1 / -1;
  }
  .app-body .dialog-actions {
    flex-direction: column-reverse;
  }
  .app-body .dialog-actions .button {
    width: 100%;
  }
}
@media (max-height: 500px) and (max-width: 950px) {
  .mobile-menu {
    max-height: 95dvh;
  }
  .app-body .app-topbar {
    position: static;
  }
}
