/* BCB-SWAP-DEX: Swap blue surfaces/controls; Exchange section-switch behavior.
   Retain the fund's own desktop composition, not either reference app's frame. */
.fund-app {
  font-family: system-ui, sans-serif;
  color: #f4f8ff;
  background:
    radial-gradient(ellipse at 50% 15%, #102b49 0%, transparent 60%), #070e19;
  font-synthesis: none;
  color-scheme: dark;
  --accent: #68deff;
  --line: #355b91;
  --muted: #afc0d8;
  --surface: #101f37;
  --field: #101f35;
  --panel:
    radial-gradient(ellipse at 50% 0%, #2374b580 0%, transparent 46%),
    linear-gradient(155deg, #1c3659 0%, #101f37 40%, #091424 100%);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}
.environment {
  background: #091424;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  padding: 10px max(24px, calc((100vw - 1320px) / 2));
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  letter-spacing: 0.03em;
}
.environment span {
  color: var(--muted);
}
main {
  max-width: 1368px;
  margin: auto;
  padding: 32px 24px;
}
header,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
header {
  margin-bottom: 20px;
}
h1 {
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.035em;
  margin: 4px 0 8px;
}
h2 {
  font-size: 20px;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
h3 {
  font-size: 15px;
  margin: 0;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 8px;
}
p {
  margin: 6px 0 16px;
}
header p {
  color: var(--muted);
  margin-bottom: 0;
}
.hint {
  font-size: 12px;
  color: var(--muted);
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  margin: 20px 0;
}
.metrics > div {
  background: var(--surface);
  padding: 20px 24px;
}
.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.metrics strong {
  display: block;
  font-size: 26px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.metrics small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(350px, 1fr);
  gap: 20px;
  scroll-margin-top: 80px;
}
.layout > * {
  min-width: 0;
}
.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow:
    inset 0 1px 0 #a7d6ff38,
    inset 0 -1px 0 #3465a533,
    0 24px 64px #00000055;
  margin: 0 0 20px;
}
.table-scroll {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
th {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  padding: 12px 8px;
}
td {
  border-top: 1px solid var(--line);
  text-align: right;
  padding: 16px 8px;
  white-space: nowrap;
}
th:first-child,
td:first-child {
  text-align: left;
  padding-left: 0;
}
td:first-child strong {
  display: block;
}
td small {
  color: var(--muted);
  display: block;
  font-size: 11px;
}
.badge {
  background: #132f59;
  border: 1px solid var(--line);
  color: #b6cae5;
  border-radius: 8px;
  font-size: 11px;
  padding: 4px 8px;
  white-space: nowrap;
}
label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  margin-bottom: 12px;
}
input,
select {
  font: inherit;
  color: inherit;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  width: 100%;
  min-width: 0;
  font-size: 16px;
}
fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
button {
  font: inherit;
  font-weight: 600;
  font-size: 12px;
  color: #f4f8ff;
  background: #132f59;
  border: 1px solid #f4f8ff1a;
  border-radius: 16px;
  padding: 10px 14px;
  cursor: pointer;
  line-height: 1.5;
  min-height: 44px;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}
.primary {
  min-height: 60px;
  font-size: 22.5px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.03em;
  padding: 2px 14px;
  overflow-wrap: anywhere;
}
@media (hover: hover) {
  button:hover:not(:disabled) {
    border-color: #78baff;
    box-shadow:
      inset 0 1px 0 #c0ddff55,
      0 0 18px #4389ee26;
  }
}
button:disabled {
  border-color: #344c70;
  background: var(--field);
  color: var(--muted);
  cursor: not-allowed;
}
.fund-app :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.secondary {
  color: #b6cae5;
  background: transparent;
  border-color: #416da9;
  border-radius: 8px;
}
.text-button {
  background: transparent;
  border: 0;
  color: var(--accent);
  padding: 3px 0;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
.position {
  margin: 12px 0 20px;
  font-variant-numeric: tabular-nums;
}
.position div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0;
}
.position dt {
  font-size: 12px;
  color: var(--muted);
}
.position dd {
  font-weight: 600;
  margin: 0;
}
.position + form {
  margin-top: 16px;
}
aside form button {
  width: 100%;
}
aside .section-head button {
  width: auto;
}
#notice {
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: #101f35;
  border-radius: 12px;
  font-size: 13px;
}
#notice.error {
  border-color: #b96d78;
  color: #ffc3ca;
  background: #301d2b;
}
#withdraw-preview {
  margin: 10px 0 16px;
}
#withdraw-preview table {
  font-size: 11px;
}
#withdraw-preview td {
  padding: 10px 4px;
}
#withdraw-preview th {
  padding: 8px 4px;
  font-size: 10px;
}
details {
  margin-top: 20px;
  font-size: 12px;
}
summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}
#history {
  padding-left: 20px;
  font-size: 12px;
  color: var(--muted);
}
#history li {
  margin-bottom: 6px;
}
a {
  color: var(--accent);
}
footer {
  font-size: 12px;
  color: var(--muted);
  max-width: 860px;
  padding: 8px 0 24px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.fee-rates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}
.fee-rates > div {
  display: flex;
  flex-direction: column;
}
.fee-rates dt {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
}
.fee-rates dd {
  margin: 0;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}
.section-switch {
  display: none;
}
.warning {
  color: #ffd08a;
}
@media (max-width: 900px) {
  main {
    padding-bottom: calc(98px + env(safe-area-inset-bottom, 0px));
  }
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .layout[data-section="portfolio"] > #section-investor,
  .layout[data-section="investor"] > #section-portfolio {
    display: none;
  }
  .section-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    position: fixed;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    left: max(8px, env(safe-area-inset-left, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    z-index: 5;
    padding: 4px;
    background: #070e19;
  }
  .section-switch button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 52px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .section-switch button[aria-pressed="true"] {
    background: linear-gradient(#68deff26, transparent);
    color: var(--accent);
  }
  .section-switch button:focus-visible {
    outline-offset: -2px;
  }
  .fund-app:has(input:focus) .section-switch {
    visibility: hidden;
  }
  .metrics > div {
    padding: 16px;
  }
  .metrics strong {
    font-size: 22px;
  }
}
@media (max-width: 640px) {
  main {
    padding-top: 24px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .environment {
    padding: 10px 16px;
  }
  .environment span {
    display: none;
  }
  header {
    align-items: flex-start;
    gap: 8px;
  }
  header button {
    max-width: 105px;
    flex-shrink: 0;
  }
  h1 {
    font-size: 28px;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
  }
  .card {
    padding: 18px;
  }
  .section-head {
    flex-wrap: wrap;
    gap: 6px;
  }
  .badge {
    margin-bottom: 8px;
  }
  td {
    padding: 12px 7px;
  }
  th {
    padding: 10px 7px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .fund-app * {
    transition: none;
    scroll-behavior: auto;
  }
}
