/* TREFO glass: floating controls over a calm, readable graphite content layer.
   No animated blur, canvas lens shaders or continuously running effects. */
:root {
  --glass-solid: #253135;
  --glass-fill: linear-gradient(155deg, #d9f2e916, #ffffff05 45%, #9fcbbb0a), #182226ed;
  --glass-edge: #e0f4ed35;
  --glass-shadow: 0 12px 32px #00000045, inset 0 1px 0 #f1fff329, inset 0 -1px 0 #ffffff06;
  --glass-blur: blur(18px) saturate(1.35);
  --glass-radius: 28px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, Manrope, system-ui, sans-serif;
  background-image: radial-gradient(ellipse 75% 540px at 85% 0, #30745c24, transparent 85%);
}

/* Cards retain opaque backing; financial text never sits on changing scenery. */
.card, .metric, .wallet-card, .quick-action {
  background: linear-gradient(145deg, #e0fff907, transparent 62%), var(--panel);
  border-color: #cde1db1e;
  box-shadow: inset 0 1px 0 #ffffff07, 0 5px 18px #0000000f;
  border-radius: 22px;
}
.hero-card {
  border-radius: var(--glass-radius);
  border-color: #c5f4df3b;
  background: radial-gradient(ellipse at 93% -15%, #5fbaa240, transparent 66%), linear-gradient(135deg, #1c433b, #162b2c 75%);
  box-shadow: inset 0 1px 0 #f1fff333, inset 0 -1px 0 #ffffff05, 0 12px 30px #0000001c;
}
.hero-card::after { border-color: #d5fcec10; box-shadow: 0 0 0 42px #d5fcec03; }
.hero-card::before { opacity: .045; }
.hero-label { color: #d9ebe3; }
.hero-note, .hero-kicker { color: #b9cfc5; }
.wallet-amount, .metric-value, .hero-amount { letter-spacing: -1px; }
.project-name, .project-name > div, .channel-banner > span:last-child { min-width: 0; }
.project-card .project-name { max-width: 100%; }
.project-name strong, .project-name small, .channel-banner strong { overflow-wrap: anywhere; }
.project-card-top .project-name strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.4;
}
.project-avatar {
  background: linear-gradient(145deg, #497c6540, #28433940), #253a33;
  box-shadow: inset 0 1px 0 #ffffff12;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  background: #162125;
  border-bottom-color: #ffffff0b;
}
.topbar-logo { border-radius: 12px; box-shadow: inset 0 1px 0 #eefff331; }
.top-actions { gap: 9px; }
.top-actions .icon-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff09;
  border: 1px solid #edfff317;
  color: #c8d9d2;
  box-shadow: inset 0 1px 0 #ffffff0d;
}
.top-actions .user-avatar { width: 32px; height: 32px; }
.sidebar { background: linear-gradient(155deg, #23362f6b, #141e227d); }
.workspace { border-radius: 18px; background: #ffffff04; }
.nav-overflow { display: contents; }
.nav-item { border-radius: 15px; }
.nav-item.selected { background: #b6edce13; }

.primary-button, .secondary-button, .select-control {
  border-radius: 22px;
  min-height: 44px;
}
.primary-button {
  background: linear-gradient(165deg, #419473, #2a7056);
  border-color: #c3f7d640;
  box-shadow: inset 0 1px 0 #edfff321, 0 3px 8px #00000014;
}
.hero-footer .primary-button, .bank-panel .primary-button, .hero-card .primary-button {
  background: linear-gradient(165deg, #e2f9ed, #b9e8d3);
  border-color: #effff799;
  color: #173e30;
  box-shadow: inset 0 1px 0 #ffffffb3, 0 3px 10px #05130b24;
}
.secondary-button, .select-control {
  background: linear-gradient(165deg, #ffffff0b, #ffffff02), #233036;
  border-color: #d3eee22c;
  box-shadow: inset 0 1px 0 #ffffff07;
}
.search { border-radius: 25px; background: #1a272c; border-color: #d3eee22b; }
.search:focus-within { border-color: #9adebe8c; box-shadow: 0 0 0 3px #8fe5bf0b; }
.segmented { border-radius: 25px; background: #121d21b3; border-color: #c5dfd620; }
.segmented button { border-radius: 21px; }
.segmented button[aria-selected=true], .segmented button[aria-pressed=true] {
  background: linear-gradient(150deg, #e5fff023, #ffffff0b);
  box-shadow: inset 0 1px 0 #ffffff26, 0 2px 5px #00000014;
  color: #d9f5e7;
}
.activity-toolbar .segmented::before { content: none; }
.activity-toolbar .segmented { padding: 5px; border-radius: 28px; }
.activity-toolbar .segmented button { position: relative; z-index: 1; min-height: 44px; }
.segmented-selection {
  position: absolute;
  inset: 0 auto auto 0;
  border-radius: 24px;
  pointer-events: none;
  background: linear-gradient(145deg, #edfff529, #d0eee913 55%, #d0eee91c);
  border: 1px solid #effff62b;
  box-shadow: inset 0 1px 0 #ffffff21, inset 0 -1px 0 #ffffff08, 0 2px 6px #0000000d;
}
.activity-toolbar .segmented button[aria-selected=true] { background: transparent; box-shadow: none; }
.activity-value .activity-time {
  display: block;
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.3;
  color: #a7bab4;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.content.swipe-tracking { will-change: transform; }
.content.swipe-tracking, .content.swipe-tracking * { user-select: none; -webkit-user-select: none; }
.content.swipe-tracking.page-enter > *, .content.swipe-arriving.page-enter > * { animation: none; }

.sheet {
  background: var(--glass-solid);
  border: 1px solid var(--glass-edge);
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow), 0 24px 80px #00000050;
}
.sheet::backdrop { background: #020b0c80; backdrop-filter: none; -webkit-backdrop-filter: none; }
.sheet-grabber span { background: #d0e0d566; width: 36px; }
.sheet .icon-button { border-radius: 50%; background: #ffffff09; color: #baccc3; }
.sheet input, .sheet select, .sheet textarea { border-radius: 15px; border-color: #d1eddf26; }
.sheet .fund-line { border-color: #e3f5ef13; }
.danger-button { border-radius: 23px; }
.toast { border-radius: 22px; }

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar {
    background: #131d21d4;
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
  }
  .sheet {
    background: linear-gradient(150deg, #d9f2e912, #ffffff02 55%), #1d292ded;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
  }
}

@media (max-width: 760px) {
  .sidebar { background: transparent; }
  .content { padding-bottom: calc(116px + env(safe-area-inset-bottom)); }
  .topbar { padding: 9px 20px; }
  .card, .metric, .wallet-card, .quick-action { border-radius: 22px; }
  .hero-card { border-radius: var(--glass-radius); }
  .hero-label { font-size: 13px; }
  .quick-action { padding: 16px 14px; }
  .quick-action small { font-size: 11px; }
  .select-control { padding-left: 15px; padding-right: 12px; }
  .primary-button, .secondary-button { padding-left: 16px; padding-right: 16px; }
  .navigation, .navigation.more-open {
    left: 14px;
    right: 14px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    margin-inline: auto;
    max-width: 480px;
    padding: 6px;
    gap: 0;
    border: 1px solid var(--glass-edge);
    border-radius: 40px;
    background: var(--glass-solid);
    box-shadow: var(--glass-shadow);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    animation: none;
    isolation: isolate;
  }
  .navigation .nav-item, .navigation.more-open .nav-item {
    min-height: 60px;
    padding: 7px 2px 6px;
    font-size: 10.5px;
    letter-spacing: 0;
    font-weight: 600;
    gap: 4px;
    border-radius: 32px;
    color: #c0ccc8;
  }
  .navigation .nav-icon, .navigation .nav-icon .ui-icon { width: 24px; height: 24px; }
  .navigation .nav-item.selected, .navigation .nav-item[aria-expanded=true] { color: #dffcef; }
  .navigation .nav-item.selected .nav-icon, .navigation .nav-item[aria-expanded=true] .nav-icon { color: #a7f0d1; }
  .nav-selection {
    transition: none;
    border-radius: 32px;
    background: linear-gradient(145deg, #edfff529, #d0eee913 55%, #d0eee91c);
    border: 1px solid #effff62b;
    box-shadow: inset 0 1px 0 #ffffff21, inset 0 -1px 0 #ffffff08, 0 2px 6px #0000000d;
  }
  .navigation > .nav-item {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
  .navigation > .nav-item:active { transform: none; }
  :root:not(.keyboard-navigation) .navigation > .nav-item:focus-visible { outline: none; }
  .navigation.capsule-pressed .nav-selection {
    background: linear-gradient(130deg, #f2fff54a, #dcfff91c 48%, #d6f9ef30);
    border-color: #effff675;
    box-shadow: inset 0 1px 0 #ffffff73, inset 1px 0 0 #a7ffe02e, inset -1px 0 0 #d4deff3d, 0 4px 15px #00000030;
  }
  .navigation.capsule-pressed > .nav-item,
  .navigation.capsule-pressed > .nav-item .nav-icon { color: #b4c3be; }
  .navigation.capsule-pressed > .capsule-target { color: #eefff7; }
  .navigation.capsule-pressed > .capsule-target .nav-icon { color: #b3ffdc; }
  .navigation.capsule-outside .nav-selection { opacity: .55; }
  .navigation.capsule-dragging .nav-selection { transition: none; will-change: transform; }
  .nav-overflow { display: none; }
  .navigation.more-open .nav-overflow {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    position: absolute;
    inset: auto -1px calc(100% + 11px);
    max-height: calc(100dvh - 180px - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 9px;
    background: var(--glass-solid);
    border: 1px solid var(--glass-edge);
    border-radius: var(--glass-radius);
    box-shadow: var(--glass-shadow);
  }
  .navigation.more-open .nav-overflow .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    gap: 10px;
    min-height: 53px;
    padding: 10px;
    border-radius: 18px;
    font-size: 11px;
    background: #ffffff05;
  }
  .navigation.more-open .nav-overflow .nav-item.selected { background: #b5f5d31c; }
  .nav-overflow .nav-icon, .nav-overflow .nav-icon .ui-icon { width: 22px; height: 22px; }
  .navigation .nav-item:focus-visible { outline-offset: -4px; border-radius: 30px; }
  .navigation .nav-overflow .nav-item:focus-visible { border-radius: 16px; }
  .sheet {
    width: calc(100% - 16px);
    max-width: 580px;
    max-height: calc(100dvh - 28px);
    margin: auto auto 8px;
    padding: 0 22px calc(22px + env(safe-area-inset-bottom));
    border-bottom: 1px solid var(--glass-edge);
    border-radius: 30px;
  }
  .sheet-grabber { height: 34px; }
  .toast { bottom: calc(100px + env(safe-area-inset-bottom)); }
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    /* Keep the dock blur off its ancestor: an ancestor backdrop-filter would
       prevent the separately floating More menu from blurring page content. */
    .navigation, .navigation.more-open { background: transparent; }
    .navigation::before {
      content: '';
      position: absolute;
      inset: 0;
      z-index: -1;
      pointer-events: none;
      border-radius: inherit;
      background: var(--glass-fill);
      backdrop-filter: var(--glass-blur);
      -webkit-backdrop-filter: var(--glass-blur);
    }
    .navigation.more-open .nav-overflow {
      background: linear-gradient(150deg, #d9f2e914, #ffffff03 55%), #1d292df7;
      backdrop-filter: var(--glass-blur);
      -webkit-backdrop-filter: var(--glass-blur);
    }
  }
}

@media (max-width: 350px) {
  .navigation, .navigation.more-open { left: 10px; right: 10px; padding: 5px; }
  .navigation .nav-item, .navigation.more-open .nav-item { font-size: 10px; min-height: 58px; }
  .navigation.more-open .nav-overflow .nav-item { padding: 8px; font-size: 10px; gap: 7px; }
  .sheet { padding-inline: 17px; }
}
@media (hover: hover) and (pointer: fine) {
  .secondary-button:hover:not(:disabled), .select-control:hover { background-color: #2c3c3f; }
  .navigation .nav-item:hover { background-color: #ffffff08; }
  .navigation .nav-item.selected:hover { background-color: transparent; }
}
@media (prefers-reduced-motion: no-preference) {
  /* The interruptible capsule spring is driven by navigation.mjs. */
  .nav-selection { transition: none; }
  .navigation.more-open .nav-overflow { animation: glass-menu-enter 180ms var(--ease) both; transform-origin: 75% 100%; }
  @keyframes glass-menu-enter {
    from { opacity: 0; transform: translateY(5px) scale(.98); }
    to { opacity: 1; transform: none; }
  }
}
.keyboard-navigation .navigation.more-open .nav-overflow { animation: none; }
.keyboard-navigation .nav-selection { transition: none; }
.navigation.capsule-dragging .nav-selection { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .navigation .nav-item, .nav-selection, .navigation.more-open .nav-overflow { animation: none; transition: none; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .topbar, .sheet, .navigation, .navigation::before, .navigation.more-open, .navigation.more-open .nav-overflow {
    background: var(--glass-solid);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .nav-selection { background: #3b514b; border-color: #8ab59f; }
  .navigation.capsule-pressed .nav-selection { background: #496a5c; border-color: #b5e9d4; }
}

/* Outgoing panes stay below the fixed header/dock and cannot receive input.
   Clip to one viewport so a long live feed never promotes a page-sized bitmap. */
.page-motion-exit { position: fixed; overflow: hidden; contain: strict; pointer-events: none; z-index: 3; will-change: transform,opacity; }
.page-motion-exit * { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .page-motion-exit { display: none; } }
/* Transforming an incoming pane must not create horizontal document scrolling. */
body { overflow-x: clip; }

/* The page controller owns transforms, including immediate reduced motion. */
.content, .page-motion-exit { transition-property: none; }
