/* Meridian Group investor portal */

:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --surface: #fcfcfb;
  --surface-2: #f0ede6;
  --border: #e3dfd5;
  --border-strong: #cfc9bb;
  --ink: #14181f;
  --ink-2: #52514e;
  --ink-3: #7a776f;
  --brand: #141a24;
  --brass: #a07a2c;
  --brass-soft: #f3ead6;
  --up: #0f7b45;
  --down: #c2362f;
  --grid: #ebe7de;
  --focus: #2a78d6;

  /* asset-class identity colours, fixed order */
  --c-crypto: #2a78d6;
  --c-real-estate: #eb6834;
  --c-stocks-bonds: #1baf7a;
  --c-private-equity: #eda100;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 24, 31, .04), 0 4px 16px rgba(20, 24, 31, .04);
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111317;
    --surface: #1a1a19;
    --surface-2: #22221f;
    --border: #2e2e2a;
    --border-strong: #3d3c37;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --ink-3: #8f8d84;
    --brass: #d1ab5f;
    --brass-soft: #2c2618;
    --up: #3fbf7f;
    --down: #ef6b63;
    --grid: #282825;
    --c-crypto: #3987e5;
    --c-real-estate: #d95926;
    --c-stocks-bonds: #199e70;
    --c-private-equity: #c98500;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--ink-3); }
.muted { color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ login */

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}
.login-brand {
  position: relative;
  overflow: hidden;
  background: var(--brand);
  color: #f0ece2;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-brand svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; }
.login-brand > * { position: relative; }
.wordmark { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.wordmark img { width: 32px; height: 32px; }
.wordmark span { font-family: var(--serif); font-size: 21px; letter-spacing: .01em; }
.wordmark small { display: block; font: 500 10.5px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; opacity: .6; margin-top: 4px; }
.login-brand h1 { font: 400 clamp(32px, 4vw, 48px)/1.1 var(--serif); margin: 0 0 16px; max-width: 14ch; }
.login-brand p { margin: 0; max-width: 40ch; color: #b9b4a6; }

.login-form-wrap { display: grid; place-items: center; padding: 48px 24px; background: var(--surface); }
.login-form { width: 100%; max-width: 360px; }
.login-form h2 { font: 400 28px/1.2 var(--serif); margin: 0 0 6px; }
.login-form > p { margin: 0 0 28px; color: var(--ink-2); }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--ink-2); }
.field input {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit;
}
.field input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }
.btn-primary {
  width: 100%; height: 46px; margin-top: 8px;
  border: 0; border-radius: 8px; cursor: pointer;
  background: var(--ink); color: var(--surface); font-weight: 500;
}
.btn-primary:disabled { opacity: .6; cursor: wait; }
.form-error { min-height: 22px; margin: 12px 0 0; color: var(--down); font-size: 14px; }
.login-foot { margin-top: 40px; font-size: 12.5px; color: var(--ink-3); }

@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 28px 20px 36px; min-height: 260px; }
  .login-brand h1 { font-size: 30px; margin-top: 40px; }
}

/* ------------------------------------------------------------ app shell */

.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--brand) 240px, transparent 240px); }
.tooltip.below { transform: translate(-50%, 14px); }
.sidebar {
  background: var(--brand); color: #e9e5da;
  padding: 24px 16px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.sidebar .wordmark { padding: 0 8px 28px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; text-decoration: none;
  color: #b9b4a6; font-size: 14px;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.08); color: #fff; }
.nav .dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.nav .dot.ov { background: transparent; border: 1.5px solid #c9a258; border-radius: 50%; }
.nav-label { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: #7f7a6d; padding: 18px 10px 6px; }
.sidebar-foot { margin-top: auto; padding: 0 10px; font-size: 12.5px; color: #8b8678; }
.sidebar-foot a { display: inline-block; margin-top: 10px; color: #e9e5da; text-decoration: none; border-bottom: 1px solid #5b5749; }

.main { padding: 32px 40px 64px; max-width: 1180px; width: 100%; }
.topline { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.eyebrow { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--brass); font-weight: 500; }
.page-title { font: 400 34px/1.15 var(--serif); margin: 6px 0 0; }
.asof { font-size: 13px; color: var(--ink-3); }
.view-only { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--border); padding: 3px 10px; border-radius: 999px; margin-left: 8px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 24px; }
.card h3 { font: 500 15px/1.3 var(--sans); margin: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head .sub { font-size: 13px; color: var(--ink-3); }

.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin-bottom: 20px; }
.hero-label { font-size: 13px; color: var(--ink-2); }
.hero-value { font: 400 clamp(38px, 5vw, 54px)/1.05 var(--serif); letter-spacing: -.01em; }
.hero-change { font-size: 14.5px; font-weight: 500; }
.hero-change .muted { font-weight: 400; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; }
.stack { display: grid; gap: 20px; }

/* allocation */
.alloc-bar { display: flex; gap: 2px; height: 14px; margin: 4px 0 20px; }
.alloc-bar span { display: block; height: 100%; border-radius: 3px; }
.alloc-list { list-style: none; margin: 0; padding: 0; }
.alloc-list li + li { border-top: 1px solid var(--border); }
.alloc-list a {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  padding: 12px 4px; text-decoration: none; border-radius: 6px;
}
.alloc-list a:hover { background: var(--surface-2); }
.alloc-list .swatch { width: 10px; height: 10px; border-radius: 2px; }
.alloc-list .name { font-weight: 500; }
.alloc-list .val { text-align: right; }
.alloc-list .meta { grid-column: 2 / 4; display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-3); }

/* stat row */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 20px; }
.stats > div { padding: 18px 20px; }
.stats > div + div { border-left: 1px solid var(--border); }
.stat-label { font-size: 12.5px; color: var(--ink-3); }
.stat-value { font: 400 24px/1.25 var(--serif); margin-top: 4px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 14px; text-align: left; white-space: nowrap; }
th { font-size: 12px; font-weight: 500; color: var(--ink-3); border-bottom: 1px solid var(--border); letter-spacing: .02em; }
td { border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--surface-2); }
.asset-name { font-weight: 500; }
.asset-sub { font-size: 12.5px; color: var(--ink-3); }
.spark { display: block; }

.movers { list-style: none; margin: 0; padding: 0; }
.movers li + li { border-top: 1px solid var(--border); }
.movers button {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px;
  padding: 11px 4px; background: none; border: 0; text-align: left; cursor: pointer; border-radius: 6px;
}
.movers button:hover { background: var(--surface-2); }
.movers .cls { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.movers .cls i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { font: 11.5px var(--sans); fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .crosshair { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--ink); color: var(--surface);
  padding: 8px 11px; border-radius: 8px; font-size: 12.5px; line-height: 1.4;
  white-space: nowrap; transform: translate(-50%, calc(-100% - 12px));
  opacity: 0; transition: opacity .1s;
}
.tooltip b { font-weight: 600; font-variant-numeric: tabular-nums; }

.range-note { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(10, 12, 16, .45); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%);
  background: var(--surface); border-left: 1px solid var(--border);
  transform: translateX(100%); transition: transform .25s ease; z-index: 21;
  overflow-y: auto; padding: 28px;
}
.drawer-open .scrim { opacity: 1; pointer-events: auto; }
.drawer-open .drawer { transform: none; }
.drawer-close {
  position: absolute; top: 18px; right: 18px; width: 36px; height: 36px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 18px; line-height: 1;
}
.drawer h2 { font: 400 28px/1.2 var(--serif); margin: 6px 48px 4px 0; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-top: 20px; border-top: 1px solid var(--border); }
.facts div { padding: 12px 0; border-bottom: 1px solid var(--border); }
.facts div:nth-child(odd) { padding-right: 12px; }
.facts dt { font-size: 12.5px; color: var(--ink-3); }
.facts dd { margin: 2px 0 0; font-weight: 500; }

.loading { padding: 80px 0; text-align: center; color: var(--ink-3); }

/* mobile */
@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; background: none; }
  .sidebar { position: sticky; height: auto; padding: 14px 16px 10px; z-index: 10; }
  .sidebar .wordmark { padding: 0 0 12px; }
  .sidebar .wordmark small { display: none; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .nav-label, .sidebar-foot .owner { display: none; }
  .sidebar-foot { position: absolute; top: 16px; right: 16px; margin: 0; padding: 0; }
  .sidebar-foot a { margin: 0; }
  .main { padding: 24px 16px 48px; }
  .page-title { font-size: 28px; }
  .card-pad { padding: 18px; }
  .drawer { padding: 22px 16px; }
}
