@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  --bg: #f4f6f5;
  --bg-strong: #e9eeec;
  --panel: #fff;
  --panel-soft: #f7f9f8;
  --text: #253441;
  --text-strong: #101b2b;
  --muted: #617281;
  --line: #dce5e2;
  --line-strong: #c6d3cf;
  --brand: #117765;
  --brand-strong: #0e6556;
  --brand-soft: #e9f6f2;
  --accent: #a67634;
  --accent-soft: #fbf1e0;
  --good: #136f56;
  --good-soft: #e5f5ee;
  --bad: #ae3e54;
  --bad-soft: #fdebf0;
  --shadow: 0 12px 28px rgba(19, 41, 49, 0.055);
  --elevate: 0 18px 38px rgba(19, 41, 49, 0.1);
  --app-gradient: #f4f6f5;
  --metric-grad: #fff;
  --chart-bg: #fff;
  --topbar-tint: #f4f6f5;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Manrope", ui-sans-serif, system-ui, sans-serif;
  font-family: var(--sans);
}

:root[data-theme="dark"] {
  --bg: #0d1723;
  --bg-strong: #13212e;
  --panel: #172532;
  --panel-soft: #1a2b38;
  --text: #dce7e5;
  --text-strong: #fff;
  --muted: #a4b5b7;
  --line: #304250;
  --line-strong: #405763;
  --brand: #3ac5ad;
  --brand-strong: #6ad9c3;
  --brand-soft: #173d3b;
  --accent: #d4aa68;
  --accent-soft: #3a2f23;
  --good: #60d3a7;
  --good-soft: #183c32;
  --bad: #ff8294;
  --bad-soft: #3e2430;
  --shadow: 0 16px 28px rgba(0, 0, 0, 0.15);
  --elevate: 0 20px 44px rgba(0, 0, 0, 0.25);
  --app-gradient: #0d1723;
  --metric-grad: #172532;
  --chart-bg: #172532;
}

body {
  background: var(--app-gradient);
  font-family: var(--sans);
  font-weight: 500;
}

button, input, select { font-family: var(--sans); }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
::selection { color: #fff; background: #117765; }
* { scrollbar-color: #a9bbb6 transparent; scrollbar-width: thin; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
.market-row:focus-visible, .market-result:focus-visible {
  outline: 2px solid #c79d54;
  outline-offset: 3px;
}

.panel, .master-sidebar, .metric, .market-strip, .tabs {
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.panel { padding: clamp(20px, 2vw, 28px); }
.panel h2 { font-size: clamp(19px, 1.7vw, 23px); letter-spacing: -0.025em; }
.eyebrow { color: var(--muted); font-size: 11px; letter-spacing: 0.08em; }

.topbar {
  align-items: center;
  padding-top: 16px;
  padding-bottom: 16px;
}
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 44px; height: 44px; object-fit: contain; }
.topbar h1 { font-size: 21px; font-weight: 800; letter-spacing: -0.035em; }
.header-copy { margin-top: 3px; font-size: 12px; font-weight: 600; }
.topbar-actions { gap: 8px; }
.status-pill { border-radius: 999px; font-size: 11px; }
.icon-button, .ghost-button, .primary-button, .danger-button, .tab,
.market-mode, .master-menu-item { border-radius: 10px; }
.primary-button { background: #117765; color: #fff; }
.primary-button:hover { background: #0e6556; }
.primary-button:active, .ghost-button:active, .icon-button:active,
.master-menu-item:active { transform: scale(.98); }
.ghost-button { background: var(--brand-soft); }

/* Sign-in is intentionally more expressive than the workspace. */
.portal-mode { background: #edf2f0; }
:root[data-theme="dark"] .portal-mode { background: #0d1723; }
.portal-mode .portal-view {
  min-height: 100svh;
  padding: clamp(18px, 3vw, 42px);
  display: grid;
  place-items: center;
}
.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(400px, .95fr);
  width: min(1160px, 100%);
  min-height: min(750px, calc(100svh - 84px));
  overflow: hidden;
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 32px 80px rgba(14, 38, 43, .16);
}
.auth-story {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 610px;
  padding: 36px 40px;
  color: #fff;
  background: #101b2b url("/assets/login-art.jpg") center center / cover no-repeat;
  isolation: isolate;
}
.auth-story::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: linear-gradient(180deg, rgba(7, 18, 31, .5), transparent 35%, rgba(6, 16, 28, .82));
}
.auth-story-top { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 800; letter-spacing: .16em; }
.auth-story-top img { width: 45px; height: 45px; object-fit: contain; }
.auth-story-copy { max-width: 470px; margin-top: auto; padding-bottom: 28px; }
.auth-overline { color: #86e5d0; font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.auth-story-copy h2 { margin: 14px 0 14px; font-size: clamp(48px, 5vw, 76px); line-height: 1.03; letter-spacing: -.04em; }
.auth-story-copy p { max-width: 38ch; margin: 0; color: #d9e6e5; font-size: 15px; line-height: 1.65; }
.auth-story-foot { margin: 0; color: #c5d5d1; font-size: 12px; letter-spacing: .02em; }
.portal-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: none;
  padding: clamp(36px, 5vw, 74px);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.auth-form-brand { display: none; }
.portal-panel .panel-heading { align-items: flex-start; margin-bottom: 28px; }
.portal-panel .panel-heading > div { max-width: 360px; }
.portal-panel .eyebrow { margin-bottom: 10px; color: var(--brand-strong); }
.portal-panel h2 { font-size: clamp(29px, 2.7vw, 39px); line-height: 1.12; letter-spacing: -.035em; }
.auth-description { margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.portal-panel .portal-theme-toggle { flex: 0 0 auto; }
.portal-form { gap: 17px; }
.portal-form label { gap: 8px; color: var(--text-strong); font-size: 12px; font-weight: 750; }
.portal-form input, .portal-form .captcha-box {
  min-height: 49px;
  border-radius: 10px;
  border-color: var(--line-strong);
  background: var(--input-bg);
  font-size: 14px;
}
.portal-form input { padding: 0 14px; }
.portal-form input::placeholder { color: #84949d; font-weight: 500; }
.portal-form .captcha-row { grid-template-columns: minmax(0, 1fr) 49px; align-items: end; }
.portal-form .captcha-row > div { min-width: 0; }
.portal-form .captcha-label { margin-bottom: 8px; color: var(--text-strong); font-size: 12px; font-weight: 750; }
.portal-form .captcha-box { font-size: 16px; letter-spacing: .12em; }
.portal-form .captcha-row button { width: 49px; min-width: 49px; min-height: 49px; }
.portal-form .form-submit { min-height: 50px; margin-top: 6px; font-size: 14px; }

/* Financial workspace: restrained shell, strong numerical hierarchy. */
.master-shell { grid-template-columns: 230px minmax(0, 1fr); gap: 20px; }
.master-sidebar {
  gap: 4px;
  padding: 12px;
  border: 0;
  background: #101b2b;
  box-shadow: none;
}
.master-menu-item { min-height: 46px; padding: 0 13px; color: #b5c7c8; font-size: 12px; font-weight: 700; }
.master-menu-item:hover { color: #fff; background: #233b48; }
.master-menu-item.is-active { color: #fff; background: #117765; box-shadow: none; }
.master-menu-item svg { width: 18px; height: 18px; }
.metrics-grid { gap: 14px; }
.metric { min-height: 118px; padding: 18px; border: 1px solid var(--line); }
.metric strong { font-size: clamp(17px, 1.75vw, 23px); font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.metric span { font-size: 12px; font-weight: 700; }
.metric small { font-size: 12px; font-weight: 600; }
.metric-icon { border-radius: 10px; }
.dashboard-grid { gap: 16px; margin-top: 16px; }
.graph-data-note { margin: -4px 0 18px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.asset-chart { gap: 8px; }
.market-row, .market-result { position: relative; transition: background 160ms ease; }
.market-detail-hit { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; border: 0; border-radius: inherit; background: transparent; cursor: pointer; }
.market-detail-hit:focus-visible { outline: 2px solid #c79d54; outline-offset: -3px; }
.market-row .favorite-button, .market-result .favorite-button { position: relative; z-index: 2; }
.market-row:hover, .market-result:hover { background: var(--brand-soft); }
.market-row.is-selected, .market-result.is-selected { box-shadow: inset 2px 0 0 var(--brand); }
.market-list-head { letter-spacing: .08em; }
.market-strip { overflow: hidden; }
.price, .metric strong, .portfolio-metrics strong, .transaction-summary strong { font-variant-numeric: tabular-nums; }
.view, .portfolio-space, .portfolio-space > *, .table-wrap { min-width: 0; }
.portfolio-space, #userView { width: 100%; max-width: 100%; }
.table-wrap { max-width: 100%; }

@media (max-width: 980px) {
  .master-shell { grid-template-columns: 1fr; }
  .master-sidebar { display: flex; overflow-x: auto; gap: 6px; border-radius: 12px; }
  .master-menu-item { flex: 0 0 auto; white-space: nowrap; }
}

/* Touch layout starts where the split sign-in loses useful breathing room. */
@media (max-width: 840px) {
  .portal-mode .portal-view {
    min-height: 100svh;
    padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
    place-items: center;
  }
  .auth-layout {
    display: block;
    width: min(500px, 100%);
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 20px 48px rgba(14, 38, 43, .11);
  }
  .auth-story { display: none; }
  .portal-panel {
    min-height: 0;
    padding: clamp(28px, 6vw, 44px);
    border-radius: 18px;
  }
  .auth-form-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 32px;
    color: var(--text-strong);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -.02em;
  }
  .auth-form-brand img { width: 35px; height: 35px; object-fit: contain; }
  .portal-panel .panel-heading { margin-bottom: 24px; }
  .portal-panel h2 { font-size: clamp(28px, 6vw, 34px); }
  .portal-form input, .portal-form .captcha-box,
  .portal-form .captcha-row button { min-height: 48px; }
  .portal-form { gap: 15px; }
}

@media (max-width: 640px) {
  .portal-mode .portal-view {
    display: block;
    padding: 0;
  }
  .auth-layout {
    width: 100%;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .portal-panel {
    min-height: 100svh;
    padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
    border-radius: 0;
  }
  .auth-form-brand { margin-bottom: clamp(28px, 6vh, 48px); }
  .portal-panel .panel-heading { gap: 16px; }
  .portal-panel h2 { font-size: 30px; }
  .auth-description { font-size: 14px; }
  .portal-form { gap: 13px; }
  .portal-form input { font-size: 16px; }
  .topbar,
  .app-shell {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding-right: 14px;
    padding-left: 14px;
  }
  .topbar {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: 10px;
  }
  .brand-lockup { flex: 1 1 auto; }
  .topbar { gap: 12px; }
  .brand-mark { width: 39px; height: 39px; }
  .topbar h1 { font-size: 18px; }
  .header-copy { display: none; }
  .topbar-actions {
    width: auto;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .status-pill {
    order: 3;
    width: 100%;
    max-width: 100%;
    justify-content: center;
  }
  #exitPortalBtn {
    width: 42px;
    min-width: 42px;
    padding: 0;
    font-size: 0;
  }
  #exitPortalBtn svg { width: 18px; height: 18px; }
  .app-shell { margin-bottom: 24px; }
  .metrics-grid { gap: 10px; }
  .metric { min-height: 104px; padding: 15px; }
  .master-sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    margin-right: -14px;
    margin-left: -14px;
    padding-right: 14px;
    padding-left: 14px;
    border-radius: 0;
    scrollbar-width: none;
  }
  .master-sidebar::-webkit-scrollbar { display: none; }
  .master-menu-item {
    min-height: 44px;
    padding: 0 12px;
  }
  .panel-heading {
    align-items: flex-start;
    gap: 10px;
  }
  .table-wrap,
  .graph-table-wrap,
  .transactions-table-wrap {
    margin-right: -14px;
    margin-left: -14px;
    padding-right: 14px;
    padding-left: 14px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }
  .modal-overlay {
    align-items: end;
    padding: 0;
  }
  .modal-card {
    width: 100%;
    max-height: min(88svh, 760px);
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
  }
}

@media (max-width: 430px) {
  .portal-panel { padding-right: 18px; padding-left: 18px; }
  .portal-theme-toggle { width: 44px; min-width: 44px; }
  .portal-form .captcha-row { grid-template-columns: minmax(0, 1fr) 48px; }
  .portfolio-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portfolio-metrics .metric { min-height: 110px; }
}

@media (max-width: 370px) {
  .portfolio-metrics { grid-template-columns: 1fr; }
  .portal-panel h2 { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .master-menu-item, .market-row, .market-result, .primary-button { transition: none; }
}
