/* ─── PocketFlow Tab Navigation ─── */

.pf-app .pf-ti {
  display: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.pf-app .pf-fab,
.pf-app .pf-tab-more,
.pf-app .pf-more-sheet { display: none !important; }

.pf-app .pf-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
  width: min(100%, 860px);
  margin: 0 auto 24px;
  padding: 6px;
  overflow: visible;
  border: 1px solid #dde8e3;
  border-radius: 16px;
  background: #fffefa;
  box-shadow: 0 3px 16px #1456590d;
}

.pf-app .pf-tabs button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-width: 0 !important;
  min-height: 48px !important;
  padding: 8px 4px !important;
  border: 0;
  border-radius: 11px !important;
  background: transparent;
  color: #3e6262 !important;
  font-size: 15px !important;
  font-weight: 750 !important;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.pf-app .pf-tabs button.active {
  background: #0f686a !important;
  color: #fff !important;
}

.pf-app .pf-tabs button:not(.active):hover {
  background: #e9f4f0 !important;
  color: #10565b !important;
}

.pf-app .pf-tabs button:focus-visible {
  outline: 3px solid #ed7652 !important;
  outline-offset: 2px;
}

/* ─── Mobile Bottom Navigation ─── */
@media (max-width: 760px) {
  .pf-app {
    padding-bottom: 80px !important;
  }

  .pf-app .pf-tabs {
    position: fixed !important;
    z-index: 9999;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    display: flex !important;
    grid-template-columns: none !important;
    gap: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 2px 0 calc(2px + env(safe-area-inset-bottom)) !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fffefa !important;
    box-shadow: 0 -2px 20px #14233818 !important;
    overflow: visible !important;
  }

  .pf-app .pf-ti { display: block; }

  .pf-app .pf-tabs > [data-tab="calendar"],
  .pf-app .pf-tabs > [data-tab="budget"],
  .pf-app .pf-tabs > [data-tab="assets"],
  .pf-app .pf-tabs > [data-tab="repeat"],
  .pf-app .pf-tabs > [data-tab="settings"] {
    display: none !important;
  }

  .pf-app .pf-tabs button {
    flex: 1 !important;
    flex-direction: column !important;
    gap: 2px !important;
    min-width: 0 !important;
    min-height: 52px !important;
    padding: 6px 0 4px !important;
    border-radius: 0 !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    color: #8b9e9e !important;
    background: transparent !important;
    line-height: 1.2 !important;
  }

  .pf-app .pf-tabs button.active {
    background: transparent !important;
    color: #10565b !important;
  }

  .pf-app .pf-tabs button:not(.active):hover {
    background: transparent !important;
  }

  .pf-app .pf-tabs > [data-tab="home"] { order: 1; }
  .pf-app .pf-tabs > [data-tab="history"] { order: 2; }
  .pf-app .pf-tabs > [data-tab="stats"] { order: 4; }
  .pf-app .pf-tab-more { order: 5; }

  .pf-app .pf-tabs::after {
    content: '';
    order: 3;
    flex: 1 !important;
    min-width: 56px;
  }

  .pf-app .pf-tab-more {
    display: flex !important;
  }

  .pf-app[data-pf-current="calendar"] .pf-tab-more,
  .pf-app[data-pf-current="budget"] .pf-tab-more,
  .pf-app[data-pf-current="assets"] .pf-tab-more,
  .pf-app[data-pf-current="repeat"] .pf-tab-more,
  .pf-app[data-pf-current="settings"] .pf-tab-more {
    color: #10565b !important;
  }

  /* ─── FAB ─── */
  .pf-app .pf-fab {
    display: grid !important;
    place-items: center;
    position: fixed;
    z-index: 10000;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    border: 0;
    border-radius: 50%;
    background: #c24b32 !important;
    color: #fff;
    box-shadow: 0 4px 16px #c24b3250;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
  }
  .pf-app .pf-fab:active {
    transform: translateX(-50%) scale(0.92);
  }
  .pf-app .pf-fab svg {
    width: 24px;
    height: 24px;
  }

  /* ─── More Sheet ─── */
  .pf-app .pf-more-sheet {
    display: block !important;
    position: fixed;
    z-index: 10001;
    inset: 0;
  }
  .pf-app .pf-more-sheet[hidden] { display: none !important; }

  .pf-more-overlay {
    position: absolute;
    inset: 0;
    background: #00000040;
    animation: pf-fade .2s;
  }

  .pf-more-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 20px calc(16px + env(safe-area-inset-bottom));
    background: #fffefa;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 30px #14233825;
    animation: pf-slide .25s;
  }

  .pf-more-handle {
    width: 36px;
    height: 4px;
    margin: 0 auto 14px;
    border-radius: 2px;
    background: #d0d5dc;
  }

  .pf-more-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }

  .pf-more-grid button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 4px 12px;
    border: 0;
    border-radius: 14px;
    background: #f2f6f4;
    color: #344155;
    font-size: 11px;
    font-weight: 650;
    cursor: pointer;
    transition: background .12s;
  }

  .pf-more-grid button .pf-ti {
    display: block;
    width: 24px;
    height: 24px;
  }

  .pf-more-grid button.active {
    background: #dff0eb;
    color: #10565b;
  }

  .pf-more-grid button:active {
    background: #e0e5eb;
  }

  @keyframes pf-fade { from { opacity: 0; } }
  @keyframes pf-slide { from { transform: translateY(100%); } }
}

@media (max-width: 360px) {
  .pf-app .pf-tabs button { font-size: 9px !important; }
  .pf-app .pf-ti { width: 20px; height: 20px; }
  .pf-more-grid button { padding: 12px 2px 10px; font-size: 10px; }
}
