:root {
  --bg: #07100d;
  --panel: #0e1a16;
  --panel2: #13231d;
  --line: #244034;
  --text: #f3f8f5;
  --muted: #94aa9f;
  --brand: #6ee7a8;
  --brand2: #27c879;
  --amber: #f5bf62;
  --red: #ff7b7b;
  --blue: #68a9ff;
  --shadow: 0 24px 70px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); font-family: Inter, system-ui, -apple-system, sans-serif; }
body { margin: 0; background: radial-gradient(circle at 85% -10%, rgba(39,200,121,.16), transparent 32%), var(--bg); min-height: 100vh; overflow-x: hidden; }
a { color: inherit; }

/* LAYOUT SHELL */
.qr-shell { display: grid; grid-template-columns: 245px minmax(0, 1fr); min-height: 100vh; }
.qr-side { padding: 24px 18px; border-right: 1px solid var(--line); background: rgba(9,20,16,.92); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.qr-brand { font-size: 20px; font-weight: 900; letter-spacing: -.5px; padding: 4px 10px 24px; display: flex; justify-content: space-between; align-items: center; }
.qr-brand span { color: var(--brand); }
.qr-side-close { display: none; }
.qr-nav-label { color: #668074; text-transform: uppercase; letter-spacing: 1.5px; font-size: 10px; font-weight: 800; margin: 18px 10px 8px; }
.qr-nav a { display: block; padding: 11px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 650; margin: 3px 0; transition: background 0.15s, color 0.15s; }
.qr-nav a:hover, .qr-nav a.active { background: rgba(110,231,168,.09); color: var(--brand); }
.qr-main { min-width: 0; display: flex; flex-direction: column; }

/* HEADER */
.qr-top { height: 64px; min-height: 64px; padding: 0 28px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: rgba(7,16,13,.88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 50; gap: 12px; }
.qr-top h1 { font-size: 18px; margin: 0; font-weight: 800; }
.qr-top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.qr-top-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* MAIN CONTENT */
.qr-content { max-width: 1280px; width: 100%; margin: 0 auto; padding: 32px 28px 60px; box-sizing: border-box; }
.eyebrow { color: var(--brand); text-transform: uppercase; letter-spacing: 2px; font-size: 11px; font-weight: 900; }
.hero h2 { font-size: clamp(28px, 4.5vw, 54px); line-height: 1.08; letter-spacing: -1.5px; margin: 10px 0 14px; max-width: 820px; }
.hero p { max-width: 710px; color: var(--muted); line-height: 1.65; font-size: 15px; margin: 0; }
.notice { margin: 20px 0; padding: 14px 18px; border: 1px solid rgba(245,191,98,.32); background: rgba(245,191,98,.07); border-radius: 12px; color: #e8d3aa; font-size: 13px; line-height: 1.55; }

/* CARDS GRID */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 28px; }
.portfolio-card { display: flex; flex-direction: column; padding: 22px; background: linear-gradient(145deg, var(--panel), #0a1511); border: 1px solid var(--line); border-radius: 18px; text-decoration: none; transition: .2s; min-height: 280px; }
.portfolio-card:hover { transform: translateY(-3px); border-color: #3c755d; box-shadow: var(--shadow); }
.card-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.category, .status-pill, .risk { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.category { background: rgba(104,169,255,.1); color: #9bc5ff; }
.risk { background: rgba(245,191,98,.1); color: #f7ce86; }
.status-pill { background: rgba(110,231,168,.1); color: var(--brand); }
.portfolio-card h3 { font-size: 21px; letter-spacing: -.5px; margin: 16px 0 6px; }
.portfolio-card p { color: var(--muted); font-size: 13.5px; line-height: 1.55; margin: 0; }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); color: var(--brand); font-size: 13px; font-weight: 800; }

/* 5-COLUMN RETURNS STRIP */
.returns-strip-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 16px 0 16px; text-align: center; }
.returns-strip-5 > div { background: rgba(110,231,168,.04); border: 1px solid var(--line); border-radius: 8px; padding: 8px 3px; min-width: 0; overflow: hidden; }
.returns-strip-5 span { display: block; font-size: 9.5px; color: var(--muted); text-transform: uppercase; font-weight: 800; }
.returns-strip-5 strong { display: block; margin-top: 3px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.positive { color: var(--brand) !important; }
.negative { color: var(--red) !important; }

/* PANELS & DETAILS */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.panel + .panel { margin-top: 16px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, .8fr); gap: 20px; align-items: start; }
.detail-title { font-size: 36px; line-height: 1.1; letter-spacing: -1.2px; margin: 12px 0 8px; }
.detail-copy { color: var(--muted); line-height: 1.65; font-size: 14px; }
.metric-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 20px 0; }
.metric-box { background: var(--panel2); border: 1px solid var(--line); padding: 12px; border-radius: 10px; min-width: 0; overflow: hidden; }
.metric-box small { display: block; color: var(--muted); font-size: 9.5px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-box b { display: block; margin-top: 4px; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.constituent { display: grid; grid-template-columns: 120px 1fr 50px; gap: 10px; align-items: center; margin: 12px 0; }
.constituent b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 7px; background: #1a3027; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand2), var(--brand)); border-radius: 999px; }
.constituent span { text-align: right; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.sticky { position: sticky; top: 80px; }

/* BUTTONS & INPUTS */
.btn { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 800; font-size: 13px; cursor: pointer; text-decoration: none; transition: 0.15s; }
.btn-primary { background: var(--brand); color: #052012; }
.btn-primary:hover { opacity: 0.92; }
.btn-secondary { background: var(--panel2); border: 1px solid var(--line); color: var(--text); }
.btn-secondary:hover { background: rgba(255,255,255,0.06); }
.btn-danger { background: rgba(255,123,123,.12); color: var(--red); border: 1px solid rgba(255,123,123,.25); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.input { width: 100%; padding: 10px 12px; background: #07100d; border: 1px solid var(--line); border-radius: 9px; color: var(--text); font: inherit; outline: none; }
.input:focus { border-color: var(--brand2); }
.fine { color: var(--muted); font-size: 11px; line-height: 1.5; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.summary-card { padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.summary-card span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.summary-card strong { display: block; margin-top: 6px; font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.good { color: var(--brand); }
.bad { color: var(--red); }
.allocation-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.allocation-table th, .allocation-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.allocation-table th:first-child, .allocation-table td:first-child { text-align: left; }
.allocation-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: 360px; padding: 12px 16px; border-radius: 10px; background: #18382b; color: #eafff4; border: 1px solid #347559; box-shadow: var(--shadow); display: none; z-index: 100; font-size: 13px; }
.toast.show { display: block; }
.back { color: var(--muted); text-decoration: none; font-weight: 750; font-size: 13px; }
.legal { font-size: 11.5px; line-height: 1.6; color: var(--muted); border-top: 1px solid var(--line); margin-top: 24px; padding-top: 16px; }

/* MODAL DIALOG (OVERVIEW) */
.qr-modal-backdrop { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); z-index: 10000; align-items: center; justify-content: center; padding: 14px; box-sizing: border-box; }
.qr-modal-backdrop.show { display: flex; }
.qr-modal-dialog { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; width: 100%; max-width: 640px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 25px 80px rgba(0, 0, 0, 0.9); overflow: hidden; animation: qrModalPop 0.2s ease-out; margin: auto; }
@keyframes qrModalPop { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.qr-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); background: rgba(9, 20, 15, 0.95); gap: 10px; }
.qr-modal-head h3 { margin: 0; font-size: 18px; letter-spacing: -0.3px; }
.qr-modal-close { background: rgba(255,255,255,0.06); border: 1px solid var(--line); color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; transition: 0.15s; flex-shrink: 0; }
.qr-modal-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.12); }
.qr-modal-body { padding: 18px 20px; overflow-y: auto; flex: 1 1 auto; }
.qr-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: rgba(9, 20, 15, 0.95); }
.modal-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }

/* MOBILE HAMBURGER & OVERLAY */
.mobile-menu-btn { display: none; width: 36px; height: 36px; align-items: center; justify-content: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-size: 1.2rem; cursor: pointer; padding: 0; flex-shrink: 0; }
.mobile-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); z-index: 10000; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.mobile-overlay.show { display: block; }

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 900px) {
  .qr-shell { display: block; }
  .qr-side {
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    max-width: 86vw !important;
    height: 100vh !important;
    z-index: 10001 !important;
    background: #091511 !important;
    box-shadow: 4px 0 35px rgba(0,0,0,0.95) !important;
    transform: translateX(-100%) !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
    padding: 18px 14px !important;
    overflow-y: auto !important;
  }
  .qr-side.show { transform: translateX(0) !important; }
  .qr-side-close { display: inline-flex !important; }
  .mobile-menu-btn { display: inline-flex !important; }
  .grid, .detail-grid { grid-template-columns: 1fr; }
  .sticky { position: static; }
}

@media (max-width: 768px) {
  .qr-top { padding: 0 16px !important; height: 58px !important; min-height: 58px !important; }
  .qr-content { padding: 20px 14px 50px !important; }
  .hero h2 { font-size: 26px !important; letter-spacing: -0.8px !important; margin: 8px 0 10px !important; line-height: 1.15 !important; }
  .hero p { font-size: 13.5px !important; }
  .grid { gap: 14px !important; margin-top: 20px !important; }
  .summary-grid { grid-template-columns: 1fr !important; gap: 8px !important; }
  .metric-row { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 6px !important; }
  .allocation-table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 520px) {
  .qr-top { padding: 0 12px !important; height: 54px !important; min-height: 54px !important; }
  .qr-top h1 { font-size: 15px !important; max-width: 155px; }
  .qr-top-calc-btn { display: none !important; }
  .portfolio-card { padding: 16px 14px !important; border-radius: 14px !important; min-height: auto !important; }
  .portfolio-card h3 { font-size: 18px !important; margin: 10px 0 4px !important; }
  .returns-strip-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 4px !important;
    margin: 12px 0 14px !important;
  }
  .returns-strip-5 > div {
    padding: 6px 2px !important;
    border-radius: 6px !important;
  }
  .returns-strip-5 span {
    font-size: 8.5px !important;
  }
  .returns-strip-5 strong {
    font-size: 11px !important;
    margin-top: 2px !important;
  }
  .panel { padding: 16px 14px !important; border-radius: 14px !important; }
  .qr-modal-dialog { width: 95vw !important; max-height: 90vh !important; }
  .qr-modal-head { padding: 12px 14px !important; }
  .qr-modal-body { padding: 14px 14px !important; }
  .qr-modal-foot { padding: 12px 14px !important; flex-direction: column-reverse !important; gap: 8px !important; }
  .qr-modal-foot .btn { width: 100% !important; text-align: center !important; padding: 11px !important; }
  .modal-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 6px !important; }
  .constituent { grid-template-columns: 90px 1fr 40px !important; gap: 8px !important; }
}