:root {
  --canvas: #eeede6;
  --canvas-deep: #e5e3da;
  --surface: #faf9f4;
  --surface-raised: #fffef9;
  --surface-muted: #f0eee6;
  --ink: #17201e;
  --ink-soft: #3f4945;
  --muted: #707873;
  --muted-soft: #939a95;
  --line: #dcddd5;
  --line-strong: #c9cbc1;
  --nav: #17201e;
  --nav-soft: #24302c;
  --nav-text: #f4f0e6;
  --nav-muted: #8f9d98;
  --accent: #d65d43;
  --accent-dark: #b94731;
  --accent-soft: #f3ddd5;
  --positive: #ca513d;
  --positive-soft: #f5e3dd;
  --negative: #2f7d6d;
  --negative-soft: #e0eeea;
  --warning: #b97e26;
  --warning-soft: #f3ead6;
  --blue: #587a96;
  --green: #4f8074;
  --gold: #c99b42;
  --shadow: 0 18px 48px rgba(27, 37, 33, 0.07);
  --shadow-small: 0 8px 24px rgba(27, 37, 33, 0.06);
  --radius: 18px;
  --radius-small: 12px;
  --sidebar-width: 248px;
  --font-sans: "Aptos", "SF Pro Text", "PingFang SC", "Microsoft YaHei",
    sans-serif;
  --font-display: "Aptos Display", "SF Pro Display", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono",
    monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(
      circle at 86% -15%,
      rgba(214, 93, 67, 0.08),
      transparent 30%
    ),
    linear-gradient(145deg, rgba(255, 255, 255, 0.45), transparent 45%),
    var(--canvas);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(214, 93, 67, 0.34);
  outline-offset: 3px;
}

.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;
}

.eyebrow {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tone-up {
  color: var(--positive) !important;
}

.tone-down {
  color: var(--negative) !important;
}

.tone-flat {
  color: var(--muted) !important;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #76ac92;
  box-shadow: 0 0 0 4px rgba(118, 172, 146, 0.1);
}

.status-dot.is-stale {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(185, 126, 38, 0.12);
}

.boot-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 20px;
  color: var(--nav-text);
  background: var(--nav);
}

.boot-screen p {
  color: var(--nav-muted);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.boot-mark {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 46px;
}

.boot-mark span {
  width: 8px;
  border-radius: 2px;
  animation: boot-bars 1.2s ease-in-out infinite alternate;
}

.boot-mark span:nth-child(1) {
  height: 24px;
  background: var(--accent);
  animation-delay: -0.2s;
}

.boot-mark span:nth-child(2) {
  height: 38px;
  background: #f4f0e7;
  animation-delay: -0.5s;
}

.boot-mark span:nth-child(3) {
  height: 30px;
  background: var(--green);
  animation-delay: -0.8s;
}

.boot-mark span:nth-child(4) {
  height: 46px;
  background: var(--gold);
  animation-delay: -0.35s;
}

@keyframes boot-bars {
  to {
    transform: scaleY(0.55);
    opacity: 0.45;
  }
}

/* Login */

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, 0.8fr);
  background: var(--canvas);
}

.login-visual {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 42px 54px;
  color: var(--nav-text);
  background:
    radial-gradient(
      circle at 80% 85%,
      rgba(214, 93, 67, 0.24),
      transparent 26%
    ),
    radial-gradient(
      circle at 20% 20%,
      rgba(79, 128, 116, 0.15),
      transparent 32%
    ),
    var(--nav);
}

.login-grid {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(135deg, black, transparent 72%);
}

.login-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.15em;
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 33px;
  height: 33px;
  padding: 8px 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.brand-mark span {
  width: 3px;
  border-radius: 1px;
}

.brand-mark span:nth-child(1) {
  height: 8px;
  background: var(--accent);
}

.brand-mark span:nth-child(2) {
  height: 15px;
  background: #f4f0e7;
}

.brand-mark span:nth-child(3) {
  height: 11px;
  background: var(--green);
}

.brand-mark span:nth-child(4) {
  height: 18px;
  background: var(--gold);
}

.brand-mark-large {
  width: 43px;
  height: 43px;
  padding: 10px 9px;
  border-radius: 10px;
}

.brand-mark-large span {
  width: 4px;
}

.brand-mark-large span:nth-child(1) {
  height: 11px;
}

.brand-mark-large span:nth-child(2) {
  height: 21px;
}

.brand-mark-large span:nth-child(3) {
  height: 15px;
}

.brand-mark-large span:nth-child(4) {
  height: 24px;
}

.brand-mark-small {
  width: 27px;
  height: 27px;
  padding: 6px;
  border-color: var(--line);
  background: var(--surface);
}

.brand-mark-small span {
  width: 3px;
}

.login-statement {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: auto 0;
  padding: 80px 0;
}

.login-statement .eyebrow {
  color: #99aaa4;
}

.login-statement h1 {
  margin-top: 24px;
  font-family: var(--font-display);
  font-size: clamp(52px, 7vw, 98px);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.96;
}

.login-statement h1 em {
  color: var(--accent);
  font-style: normal;
}

.login-copy {
  max-width: 460px;
  margin-top: 30px;
  color: #a7b3ae;
  font-size: 16px;
  line-height: 1.75;
}

.login-metric {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--nav-muted);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.1em;
}

.login-metric strong {
  color: #d7d9d2;
  font-weight: 500;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 40px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.38), transparent),
    var(--canvas);
}

.login-form {
  width: min(100%, 390px);
}

.login-form h2 {
  margin-top: 12px;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.login-form > p:not(.eyebrow, .form-error) {
  margin-top: 10px;
  color: var(--muted);
}

.login-form .field {
  margin-top: 34px;
}

.login-form .button {
  margin-top: 18px;
}

.input-with-icon {
  position: relative;
}

.input-with-icon svg {
  position: absolute;
  top: 50%;
  left: 15px;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.input-with-icon input {
  padding-left: 44px;
}

.login-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 15px;
}

/* Application shell */

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 30px 20px 22px;
  overflow: hidden;
  color: var(--nav-text);
  background:
    radial-gradient(
      circle at 20% 95%,
      rgba(79, 128, 116, 0.14),
      transparent 35%
    ),
    linear-gradient(160deg, rgba(255, 255, 255, 0.03), transparent 45%),
    var(--nav);
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, transparent 40%, black 100%);
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand > div:last-child {
  display: flex;
  flex-direction: column;
}

.brand strong {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.13em;
}

.brand small {
  margin-top: 1px;
  color: var(--nav-muted);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.14em;
}

.workspace-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 43px 11px 13px;
  color: #687771;
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.14em;
}

.workspace-index {
  color: #9ba59d;
}

.main-nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  position: relative;
  min-height: 48px;
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #9daba5;
  font-size: 15px;
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.nav-item:hover {
  color: #eef0ea;
  background: rgba(255, 255, 255, 0.045);
}

.nav-item.is-active {
  color: #fffdf7;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: -21px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}

.nav-kicker {
  color: #65736d;
  font-family: var(--font-mono);
  font-size: 15px;
}

.nav-item.has-alert .nav-kicker {
  color: var(--accent);
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-status {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.sidebar-status-head {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #93a099;
  font-size: 15px;
}

.sidebar-status strong {
  display: block;
  margin-top: 12px;
  color: #e2e5de;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.sidebar-status > span {
  display: block;
  margin-top: 3px;
  color: #65736d;
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.08em;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 0 4px;
  color: #65736d;
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.1em;
}

.text-button {
  padding: 4px;
  border: 0;
  color: #8b9892;
  background: transparent;
  cursor: pointer;
}

.text-button:hover {
  color: #f3f1e9;
}

.main-shell {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 15;
  top: 0;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  border-bottom: 1px solid rgba(201, 203, 193, 0.72);
  background: rgba(238, 237, 230, 0.86);
  backdrop-filter: blur(18px);
}

.mobile-brand {
  display: none;
  align-items: center;
  gap: 9px;
}

.mobile-brand strong {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.12em;
}

.topbar-context {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.05em;
}

.topbar-context > span:first-child {
  color: var(--ink);
  font-weight: 600;
}

.topbar-divider {
  width: 1px;
  height: 13px;
  background: var(--line-strong);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.data-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 7px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(250, 249, 244, 0.72);
  font-size: 15px;
  white-space: nowrap;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  background: rgba(250, 249, 244, 0.78);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  transform: translateY(-1px);
}

.icon-button:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.icon-button.is-spinning svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.profile-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: 4px;
  padding-left: 11px;
  border-left: 1px solid var(--line);
}

.profile-pill > span {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #f4efe5;
  background: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
}

.profile-pill > div {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.profile-pill strong {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.08em;
}

.profile-pill small {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.08em;
}

.page-root {
  min-height: calc(100vh - 76px);
  padding: 36px 34px 58px;
}

.page {
  width: min(100%, 1480px);
  margin: 0 auto;
  animation: page-enter 320ms ease both;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.page-header h1 {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 1.05;
}

.page-header .page-subtitle {
  max-width: 680px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 15px;
}

.page-stamp {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(250, 249, 244, 0.62);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.04em;
}

.page-stamp strong {
  color: var(--ink);
  font-weight: 500;
}

.mobile-nav {
  display: none;
}

/* Shared surfaces and controls */

.card {
  position: relative;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(250, 249, 244, 0.9);
  box-shadow: var(--shadow-small);
}

.card-dark {
  border-color: rgba(255, 255, 255, 0.07);
  color: var(--nav-text);
  background:
    radial-gradient(
      circle at 84% 10%,
      rgba(214, 93, 67, 0.2),
      transparent 28%
    ),
    linear-gradient(145deg, #1c2925, #131b19);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-subtitle {
  margin-top: 5px;
  color: var(--muted);
  font-size: 15px;
}

.card-dark .card-subtitle {
  color: var(--nav-muted);
}

.card-kicker {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.card-dark .card-kicker {
  color: #70817a;
}

.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface-raised);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.button:hover {
  border-color: #a9ada2;
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.button-primary {
  border-color: var(--ink);
  color: #faf8f0;
  background: var(--ink);
}

.button-primary:hover {
  border-color: #27332f;
  background: #27332f;
}

.button-accent {
  border-color: var(--accent);
  color: #fff9f3;
  background: var(--accent);
}

.button-accent:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.button-ghost {
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.button-danger {
  border-color: #e9c1b7;
  color: var(--accent-dark);
  background: #fbf0ed;
}

.button-small {
  min-height: 32px;
  padding: 0 11px;
  font-size: 15px;
}

.button-full {
  width: 100%;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span,
.field > label {
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 600;
}

.field small {
  color: var(--muted);
  font-size: 15px;
}

.field input,
.field select,
.field textarea,
.threshold-input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface-raised);
  outline: 0;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.field textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.65;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.threshold-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(214, 93, 67, 0.1);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a0a69f;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.form-grid .field-full {
  grid-column: 1 / -1;
}

.form-error {
  padding: 10px 12px;
  border: 1px solid #efc7be;
  border-radius: 8px;
  color: #a23d2b;
  background: #fff0ec;
  font-size: 15px;
}

.form-hint {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

/* Overview */

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(250, 249, 244, 0.84);
  box-shadow: var(--shadow-small);
}

.metric-item {
  min-width: 0;
  padding: 20px 22px;
  border-right: 1px solid var(--line);
}

.metric-item:last-child {
  border-right: 0;
}

.metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 15px;
}

.metric-label span:last-child {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.08em;
}

.metric-value {
  margin-top: 9px;
  font-family: var(--font-mono);
  font-size: clamp(21px, 2.2vw, 29px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.05em;
  line-height: 1;
}

.metric-value small {
  margin-left: 3px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
}

.metric-foot {
  margin-top: 9px;
  color: var(--muted);
  font-size: 15px;
}

.overview-main {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.8fr);
  gap: 18px;
  margin-bottom: 18px;
}

.portfolio-hero {
  min-height: 430px;
  overflow: hidden;
  padding: 25px 26px 20px;
}

.portfolio-hero::before {
  content: "";
  position: absolute;
  inset: auto -8% -45% 35%;
  height: 78%;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  transform: rotate(-9deg);
  pointer-events: none;
}

.hero-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.hero-index {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-top: 12px;
}

.hero-index strong {
  font-family: var(--font-mono);
  font-size: clamp(38px, 5vw, 64px);
  font-weight: 500;
  letter-spacing: -0.07em;
  line-height: 0.95;
}

.hero-daily {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 5px;
  font-family: var(--font-mono);
  font-size: 15px;
}

.hero-daily span {
  color: #778782;
  font-family: var(--font-sans);
  font-size: 15px;
}

.hero-insight {
  max-width: 520px;
  margin-top: 12px;
  color: #9ba9a4;
  font-size: 15px;
}

.range-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.range-tab {
  min-width: 38px;
  min-height: 27px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  color: #7f8f89;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 15px;
  cursor: pointer;
}

.range-tab.is-active {
  color: #1c2421;
  background: #f4f0e7;
}

.chart-host {
  position: relative;
  width: 100%;
  min-width: 0;
}

.hero-chart {
  height: 292px;
  margin-top: 13px;
}

.portfolio-chart {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.portfolio-chart text {
  fill: #7d8e88;
  font-family: var(--font-mono);
  font-size: 15px;
}

.chart-grid-line {
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 1;
}

.chart-axis-line {
  stroke: rgba(255, 255, 255, 0.11);
  stroke-width: 1;
}

.chart-area {
  fill: url("#areaGradient");
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.chart-marker {
  fill: var(--accent);
  stroke: #1b2522;
  stroke-width: 3;
}

.chart-crosshair {
  stroke: rgba(255, 255, 255, 0.3);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.chart-tooltip {
  position: absolute;
  z-index: 4;
  min-width: 116px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #f4f1e8;
  background: #25322e;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  font-size: 15px;
  pointer-events: none;
  transform: translate(-50%, -110%);
}

.chart-tooltip strong {
  display: block;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.chart-tooltip small {
  color: #96a39f;
}

.return-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 15px;
  margin-top: 2px;
}

.return-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #91a09b;
  font-size: 15px;
}

.return-legend i {
  width: 15px;
  height: 2px;
  flex: 0 0 15px;
  border-radius: 1px;
  background: var(--legend-color);
}

.return-tooltip {
  width: 230px;
  padding: 10px 11px;
  transform: translate(-50%, 0);
}

.return-tooltip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.return-tooltip-head small {
  color: #d7ddd8;
  font-family: var(--font-mono);
  font-size: 15px;
}

.return-tooltip-head span {
  color: #7f9089;
  font-size: 15px;
  white-space: nowrap;
}

.return-tooltip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px 54px;
  align-items: center;
  gap: 5px;
  padding: 3px 0;
}

.return-tooltip-row > span {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: #a5b2ad;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.return-tooltip-row i {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
}

.return-tooltip-row strong,
.return-tooltip-row em {
  font-family: var(--font-mono);
  font-size: 15px;
  font-style: normal;
  font-weight: 500;
  text-align: right;
}

.return-tooltip-row em {
  color: #a2aea9;
}

.hero-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 7px;
  padding-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #71827c;
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.05em;
}

.hero-footer span:last-child {
  text-align: right;
}

.allocation-card {
  min-height: 430px;
}

.donut-wrap {
  position: relative;
  width: 178px;
  height: 178px;
  margin: 2px auto 8px;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.donut-center strong {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.05em;
}

.donut-center span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 15px;
}

.allocation-list {
  display: grid;
  gap: 1px;
}

.allocation-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.allocation-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}

.allocation-name {
  min-width: 0;
}

.allocation-name strong {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
}

.allocation-name span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.allocation-weight {
  text-align: right;
}

.allocation-weight strong {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.allocation-weight span {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 15px;
}

.overview-lower {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.contribution-list {
  display: grid;
  gap: 16px;
}

.contribution-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 62px;
  align-items: center;
  gap: 12px;
}

.contribution-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 15px;
}

.contribution-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--bar-color, var(--accent));
}

.contribution-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--surface-muted);
}

.contribution-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 2px;
  border-radius: 2px;
  background: var(--bar-color, var(--accent));
}

.contribution-value {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 15px;
}

.segment-tabs {
  display: flex;
  gap: 4px;
}

.segment-tab {
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 15px;
  cursor: pointer;
}

.segment-tab.is-active {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface-muted);
}

.compact-select select {
  min-width: 94px;
  min-height: 31px;
  padding: 4px 28px 4px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  font-size: 15px;
  cursor: pointer;
}

.contribution-period-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 2px 12px;
  margin-bottom: 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.contribution-period-summary > span {
  color: var(--muted);
  font-size: 15px;
}

.contribution-period-summary > strong {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.04em;
  text-align: right;
}

.contribution-period-summary > small {
  grid-column: 1 / -1;
  color: var(--muted-soft);
  font-size: 15px;
}

.insight-list {
  display: grid;
  gap: 10px;
}

.insight-item {
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-muted);
}

.insight-icon {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--warning);
  background: var(--warning-soft);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
}

.insight-item[data-severity="critical"] .insight-icon {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.insight-item[data-severity="notice"] .insight-icon {
  color: var(--blue);
  background: #e4ebf0;
}

.insight-content strong {
  font-size: 15px;
  font-weight: 600;
}

.insight-content p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.insight-content a,
.insight-content button {
  display: inline-flex;
  margin-top: 5px;
  padding: 0;
  border: 0;
  color: var(--accent-dark);
  background: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.alert-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.alert-summary strong {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.alert-summary span {
  color: var(--muted);
  font-size: 15px;
}

.asset-table-card {
  overflow: hidden;
  padding: 0;
}

.asset-table-card .card-head {
  margin: 0;
  padding: 21px 22px 16px;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.data-table th {
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table th:not(:first-child),
.data-table td:not(:first-child) {
  text-align: right;
}

.asset-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.asset-symbol {
  width: 38px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--symbol-color, var(--ink));
  background: color-mix(
    in srgb,
    var(--symbol-color, var(--ink)) 10%,
    transparent
  );
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
}

.asset-cell strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
}

.asset-cell small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 15px;
}

.proxy-badge,
.status-badge,
.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 15px;
  line-height: 1.4;
}

.proxy-badge {
  color: #866321;
  background: var(--warning-soft);
}

.macro-section {
  margin-top: 18px;
}

.macro-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.macro-item {
  min-width: 0;
  padding: 18px;
  background: rgba(250, 249, 244, 0.92);
}

.macro-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 15px;
}

.macro-item header span:last-child {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 15px;
}

.macro-value {
  margin-top: 11px;
  font-family: var(--font-mono);
  font-size: 21px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.macro-value small {
  margin-left: 2px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 15px;
}

.macro-changes {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  margin-top: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
}

.data-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.data-note::before {
  content: "i";
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 15px;
}

/* Risk */

.wide-warning {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 17px 18px;
  border: 1px solid #e8c7be;
  border-radius: 14px;
  background: linear-gradient(90deg, #f9e9e3, #fbf1ed);
}

.wide-warning-mark {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff8f2;
  background: var(--accent);
  font-family: var(--font-mono);
  font-size: 15px;
}

.wide-warning strong {
  font-size: 15px;
}

.wide-warning p {
  margin-top: 3px;
  color: #6f5a53;
  font-size: 15px;
}

.wide-warning .button {
  white-space: nowrap;
}

.risk-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.risk-metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(250, 249, 244, 0.82);
}

.risk-metric span {
  color: var(--muted);
  font-size: 15px;
}

.risk-metric strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.05em;
}

.risk-metric small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 15px;
}

.risk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 18px;
  margin-bottom: 18px;
}

.corr-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  table-layout: fixed;
}

.corr-table th {
  padding: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.corr-table th:first-child {
  width: 46px;
  text-align: left;
}

.corr-table td {
  aspect-ratio: 1.3;
  padding: 5px;
  border-radius: 7px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  text-align: center;
}

.corr-table td[data-strong="true"] {
  color: #fffdf7;
}

.corr-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
  color: var(--muted);
  font-size: 15px;
}

.corr-scale-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    rgba(79, 128, 116, 0.72),
    var(--surface-muted),
    rgba(214, 93, 67, 0.72)
  );
}

.risk-bars {
  display: grid;
  gap: 18px;
}

.risk-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.risk-bar-head strong {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.risk-bar-head strong::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--risk-color);
}

.risk-bar-head span {
  font-family: var(--font-mono);
  font-size: 15px;
}

.risk-track {
  height: 8px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--surface-muted);
}

.risk-fill {
  height: 100%;
  min-width: 2px;
  border-radius: 2px;
  background: var(--risk-color);
  transform-origin: left;
  animation: grow-bar 600ms ease both;
}

@keyframes grow-bar {
  from {
    transform: scaleX(0);
  }
}

.risk-caption {
  margin-top: 16px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.rolling-card {
  margin-bottom: 18px;
}

.rolling-chart {
  height: 260px;
}

.light-chart .portfolio-chart text {
  fill: var(--muted);
}

.light-chart .chart-grid-line {
  stroke: var(--line);
}

.light-chart .chart-axis-line {
  stroke: var(--line-strong);
}

.light-chart .chart-crosshair {
  stroke: var(--line-strong);
}

.light-chart .chart-tooltip {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface-raised);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 4px;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 15px;
}

.chart-legend i {
  width: 14px;
  height: 2px;
  border-radius: 1px;
  background: var(--legend-color);
}

.exposure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.exposure-block {
  padding: 14px;
  border-radius: 11px;
  background: var(--surface-muted);
}

.exposure-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.exposure-head strong {
  font-size: 15px;
}

.exposure-head span {
  color: var(--muted);
  font-size: 15px;
}

.exposure-bar {
  height: 13px;
  display: flex;
  overflow: hidden;
  border-radius: 3px;
  background: var(--line);
}

.exposure-segment {
  height: 100%;
  min-width: 1px;
}

.exposure-legend {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.exposure-legend div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  color: var(--muted);
  font-size: 15px;
}

.exposure-legend span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
}

.exposure-legend i {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--legend-color);
}

.exposure-legend strong {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.fund-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.fund-check {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-raised);
}

.fund-check-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fund-check-top code {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
}

.fund-check strong {
  display: block;
  margin-top: 9px;
  font-size: 15px;
  line-height: 1.45;
}

.fund-check p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 15px;
}

.status-badge.is-critical {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

/* Scenario */

.scenario-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(0, 1.12fr);
  gap: 18px;
}

.scenario-controls {
  align-self: start;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 24px;
}

.preset-button {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  text-align: left;
  background: var(--surface-raised);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.preset-button:hover {
  border-color: var(--line-strong);
}

.preset-button.is-active {
  border-color: rgba(214, 93, 67, 0.45);
  background: var(--accent-soft);
}

.preset-button strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.preset-button span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 15px;
}

.scenario-parameters {
  display: grid;
  gap: 17px;
}

.range-control {
  display: grid;
  gap: 7px;
}

.range-control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.range-control-head label {
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 600;
}

.range-value {
  min-width: 50px;
  padding: 3px 7px;
  border-radius: 5px;
  color: var(--ink);
  background: var(--surface-muted);
  font-family: var(--font-mono);
  font-size: 15px;
  text-align: right;
}

.range-control input[type="range"] {
  width: 100%;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.range-control footer {
  display: flex;
  justify-content: space-between;
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 15px;
}

.scenario-result {
  min-height: 540px;
  overflow: hidden;
  padding: 26px;
}

.scenario-result h2 {
  margin-top: 12px;
  font-family: var(--font-display);
  font-size: clamp(46px, 6.5vw, 82px);
  font-weight: 500;
  letter-spacing: -0.07em;
  line-height: 0.95;
}

.scenario-result h2.is-negative {
  color: #f27b61;
}

.scenario-result h2.is-positive {
  color: #84b6a3;
}

.scenario-result-summary {
  margin-top: 12px;
  color: #98a7a1;
  font-size: 15px;
}

.scenario-breakdown {
  display: grid;
  gap: 12px;
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.scenario-asset-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 68px;
  align-items: center;
  gap: 12px;
}

.scenario-asset-label {
  color: #b6c0bc;
  font-family: var(--font-mono);
  font-size: 15px;
}

.scenario-asset-track {
  position: relative;
  height: 8px;
  background:
    linear-gradient(
      90deg,
      transparent 0,
      transparent calc(50% - 0.5px),
      rgba(255, 255, 255, 0.16) calc(50% - 0.5px),
      rgba(255, 255, 255, 0.16) calc(50% + 0.5px),
      transparent calc(50% + 0.5px)
    ),
    rgba(255, 255, 255, 0.06);
}

.scenario-asset-bar {
  position: absolute;
  top: 0;
  height: 100%;
  min-width: 1px;
  background: var(--bar-color);
}

.scenario-asset-value {
  color: #c4ceca;
  font-family: var(--font-mono);
  font-size: 15px;
  text-align: right;
}

.scenario-assumptions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 28px;
}

.scenario-assumptions span {
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 5px;
  color: #84958e;
  font-family: var(--font-mono);
  font-size: 15px;
}

.scenario-save {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.scenario-save .button {
  border-color: rgba(255, 255, 255, 0.16);
  color: #f0eee6;
  background: rgba(255, 255, 255, 0.06);
}

.scenario-save .button:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Journal */

.journal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 18px;
}

.journal-main {
  min-width: 0;
}

.journal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.filter-tabs {
  display: flex;
  gap: 5px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(250, 249, 244, 0.7);
}

.filter-tab {
  min-height: 29px;
  padding: 0 11px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 15px;
  cursor: pointer;
}

.filter-tab.is-active {
  color: var(--ink);
  background: var(--surface-raised);
  box-shadow: 0 1px 4px rgba(20, 30, 27, 0.08);
}

.journal-list {
  display: grid;
  gap: 12px;
}

.journal-entry {
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(250, 249, 244, 0.85);
  box-shadow: var(--shadow-small);
}

.journal-entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.journal-entry-title {
  min-width: 0;
}

.journal-entry-title h3 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.journal-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
}

.type-badge {
  color: var(--blue);
  background: #e3ebf0;
  font-family: var(--font-sans);
}

.type-badge[data-type="allocate"] {
  color: #9b532f;
  background: #f5e8dc;
}

.type-badge[data-type="hold"] {
  color: var(--negative);
  background: var(--negative-soft);
}

.type-badge[data-type="review"] {
  color: var(--warning);
  background: var(--warning-soft);
}

.journal-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 15px;
}

.journal-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
}

.journal-status.is-reviewed::before {
  background: var(--green);
}

.journal-thesis {
  margin-top: 15px;
  padding: 13px 14px;
  border-left: 2px solid var(--line-strong);
  color: var(--ink-soft);
  background: var(--surface-muted);
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.journal-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 13px;
}

.journal-detail div {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.journal-detail span {
  display: block;
  color: var(--muted);
  font-size: 15px;
}

.journal-detail strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
}

.journal-entry-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.confidence-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 15px;
}

.confidence-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
}

.confidence-dots i.is-filled {
  background: var(--accent);
}

.journal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.journal-side {
  align-self: start;
  display: grid;
  gap: 14px;
}

.journal-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
}

.journal-stat {
  padding: 17px;
  background: rgba(250, 249, 244, 0.9);
}

.journal-stat span {
  color: var(--muted);
  font-size: 15px;
}

.journal-stat strong {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
}

.journal-guide {
  padding: 19px;
  border-radius: 14px;
  color: #cfd5d1;
  background: var(--nav);
}

.journal-guide h3 {
  color: #f2f0e8;
  font-size: 15px;
}

.journal-guide ol {
  display: grid;
  gap: 12px;
  margin: 15px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: journal-guide;
}

.journal-guide li {
  position: relative;
  padding-left: 25px;
  color: #96a39e;
  font-size: 15px;
  line-height: 1.6;
  counter-increment: journal-guide;
}

.journal-guide li::before {
  content: counter(journal-guide, decimal-leading-zero);
  position: absolute;
  top: 0;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 15px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 40px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  text-align: center;
}

.empty-state-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
}

.empty-state-mark svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.empty-state h3 {
  margin-top: 15px;
  font-size: 15px;
}

.empty-state p {
  max-width: 370px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 15px;
}

.empty-state .button {
  margin-top: 17px;
}

/* Alerts */

.alert-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(270px, 0.75fr);
  gap: 18px;
  margin-bottom: 18px;
}

.alert-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.alert-hero-number {
  min-width: 88px;
}

.alert-hero-number strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 52px;
  font-weight: 500;
  letter-spacing: -0.08em;
  line-height: 1;
}

.alert-hero-number span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
}

.alert-hero-copy {
  flex: 1;
}

.alert-hero-copy h3 {
  font-size: 15px;
}

.alert-hero-copy p {
  max-width: 600px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
}

.connection-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 15px;
}

.connection-card strong {
  font-size: 15px;
}

.connection-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
}

.connection-row span:last-child {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 15px;
  text-align: right;
}

.rules-card {
  padding: 0;
  overflow: hidden;
}

.rules-card .card-head {
  margin: 0;
  padding: 22px 22px 17px;
}

.rules-list {
  display: grid;
}

.alert-rule {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 112px;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border-top: 1px solid var(--line);
  transition: background 150ms ease;
}

.alert-rule.is-active {
  background: rgba(214, 93, 67, 0.045);
}

.rule-main {
  min-width: 0;
}

.rule-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.rule-title strong {
  font-size: 15px;
}

.rule-state {
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 15px;
}

.rule-state.is-active {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.rule-main p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
}

.rule-observed {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
  white-space: nowrap;
}

.rule-threshold {
  display: flex;
  align-items: center;
  gap: 6px;
}

.threshold-input {
  min-height: 34px;
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 15px;
  text-align: right;
}

.rule-unit {
  min-width: 17px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
}

.switch {
  position: relative;
  width: 36px;
  height: 21px;
  display: inline-flex;
  flex: 0 0 36px;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch span {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: var(--line-strong);
  cursor: pointer;
  transition: background 160ms ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface-raised);
  box-shadow: 0 1px 4px rgba(20, 30, 27, 0.18);
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(15px);
}

.switch input:focus-visible + span {
  outline: 3px solid rgba(214, 93, 67, 0.28);
  outline-offset: 2px;
}

.rules-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 17px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
}

.rules-footer p {
  color: var(--muted);
  font-size: 15px;
}

/* AI and intelligence */

.intel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.intel-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(250, 249, 244, 0.82);
}

.intel-tabs button {
  min-height: 35px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 15px;
  cursor: pointer;
}

.intel-tabs button.is-active {
  color: #f8f4eb;
  background: var(--ink);
}

.intel-disclaimer {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.04em;
  text-align: right;
}

.intel-content {
  display: grid;
  gap: 15px;
}

.intel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  box-shadow: none;
}

.intel-toolbar-main,
.intel-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.intel-toolbar-main .segment-tabs {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  background: var(--surface-muted);
}

.intel-toolbar-main .segment-tab {
  min-height: 29px;
  padding-inline: 12px;
}

.ai-runtime,
.source-health {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 15px;
}

.usage-note {
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 15px;
  white-space: nowrap;
}

.review-report {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(250, 249, 244, 0.92);
  box-shadow: var(--shadow-small);
}

.review-report-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 27px 28px 23px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(
      circle at 90% -20%,
      rgba(214, 93, 67, 0.13),
      transparent 35%
    ),
    rgba(255, 254, 249, 0.65);
}

.review-report-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
}

.review-report h2 {
  max-width: 850px;
  margin-top: 15px;
  font-family: var(--font-display);
  font-size: clamp(25px, 3vw, 38px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.18;
}

.review-report-head > div:first-child > p {
  max-width: 900px;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.review-actions {
  flex: 0 0 auto;
}

.ai-mode {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.07em;
}

.ai-mode.is-ai {
  color: #296c5c;
  background: var(--negative-soft);
}

.ai-mode.is-rules {
  color: #8a6424;
  background: var(--warning-soft);
}

.ai-warning {
  margin: 18px 28px 0;
  padding: 11px 13px;
  border-radius: 8px;
  color: #775438;
  background: var(--warning-soft);
  font-size: 15px;
  line-height: 1.6;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  padding: 23px 28px;
  border-bottom: 1px solid var(--line);
}

.report-grid:last-of-type {
  border-bottom: 0;
}

.analysis-section h3 {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.analysis-section ul {
  display: grid;
  gap: 8px;
  margin: 13px 0 0;
  padding: 0;
  list-style: none;
}

.analysis-section li {
  position: relative;
  padding-left: 13px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.65;
}

.analysis-section li::before {
  content: "";
  position: absolute;
  top: 0.72em;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.analysis-lead {
  margin-top: 11px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.analysis-muted {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.driver-list {
  display: grid;
  gap: 10px;
  margin-top: 13px;
}

.driver-row {
  display: grid;
  grid-template-columns: 75px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.driver-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.driver-row strong {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.driver-row p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.impact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.impact-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
}

.impact-card.impact-bullish {
  border-color: #e8c8bf;
  background: #fbf0ec;
}

.impact-card.impact-bearish {
  border-color: #c5ddd5;
  background: #edf5f2;
}

.impact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.impact-head strong {
  font-family: var(--font-mono);
  font-size: 15px;
}

.impact-head span {
  font-size: 15px;
  font-weight: 600;
}

.impact-bullish .impact-head span {
  color: var(--accent-dark);
}

.impact-bearish .impact-head span {
  color: var(--negative);
}

.impact-neutral .impact-head span {
  color: var(--muted);
}

.impact-card > p {
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
}

.impact-card > small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.impact-meta {
  display: flex;
  gap: 9px;
  margin-top: 7px;
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 15px;
}

.evidence-links {
  display: grid;
  gap: 4px;
  margin-top: 9px;
}

.evidence-links a {
  color: var(--accent-dark);
  font-size: 15px;
  line-height: 1.5;
  text-decoration: underline;
  text-decoration-color: rgba(185, 71, 49, 0.25);
  text-underline-offset: 2px;
}

.review-report-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 15px;
}

.report-history-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(250, 249, 244, 0.8);
}

.report-history-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
}

.report-history-row:last-child {
  border-bottom: 0;
}

.report-history-row strong {
  overflow: hidden;
  color: var(--ink-soft);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-filters {
  background: transparent;
}

.news-toolbar-note {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 15px;
}

.news-list {
  display: grid;
  gap: 10px;
}

.news-card {
  padding: 18px 19px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(250, 249, 244, 0.88);
  box-shadow: var(--shadow-small);
}

.news-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.source-line {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
}

.source-line span + span {
  padding-left: 7px;
  border-left: 1px solid var(--line-strong);
}

.source-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.relevance-badge {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
  white-space: nowrap;
}

.news-card h3 {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
}

.news-card h3 a:hover {
  color: var(--accent-dark);
}

.news-summary {
  margin-top: 7px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.news-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 11px;
}

.news-tags span {
  padding: 3px 7px;
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 15px;
}

.news-tags .asset-tag {
  color: #536d61;
  background: var(--negative-soft);
  font-family: var(--font-mono);
}

.news-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.news-source-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 15px;
}

.news-source-link:hover {
  color: var(--ink);
}

.source-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.source-status {
  min-width: 0;
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr);
  gap: 4px 8px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(250, 249, 244, 0.7);
  font-size: 15px;
}

.source-status strong {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-status > span:last-child {
  grid-column: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anomaly-list {
  display: grid;
  gap: 10px;
}

.anomaly-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(250, 249, 244, 0.88);
  box-shadow: var(--shadow-small);
}

.anomaly-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 18px;
}

.anomaly-head h3 {
  margin-top: 7px;
  font-size: 15px;
  font-weight: 600;
}

.anomaly-z {
  min-width: 68px;
  text-align: right;
}

.anomaly-z strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
}

.anomaly-z span {
  color: var(--muted);
  font-size: 15px;
}

.anomaly-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
}

.anomaly-body > div {
  min-width: 0;
}

.anomaly-context {
  color: var(--muted);
  font-size: 15px;
}

.anomaly-evidence-list {
  display: grid;
  gap: 5px;
  margin-top: 9px;
}

.anomaly-evidence-list a {
  display: grid;
  gap: 2px;
  color: var(--ink-soft);
}

.anomaly-evidence-list span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
}

.anomaly-evidence-list strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cached-analysis {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
}

.cached-analysis p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.ai-analysis-modal {
  display: grid;
  gap: 20px;
}

.ai-result-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 15px;
}

.analysis-callout {
  padding: 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}

.analysis-callout span {
  color: var(--accent-dark);
  font-family: var(--font-mono);
  font-size: 15px;
}

.analysis-callout p {
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.75;
}

.ai-thinking {
  display: grid;
  place-items: center;
  min-height: 280px;
  text-align: center;
}

.ai-thinking-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
}

.ai-thinking > strong {
  margin-top: 15px;
  font-size: 15px;
}

.ai-thinking > p {
  max-width: 390px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 15px;
}

.thinking-track {
  position: relative;
  width: 180px;
  height: 3px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}

.thinking-track span {
  position: absolute;
  top: 0;
  left: 0;
  width: 44%;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  animation: thinking 1.25s ease-in-out infinite;
}

@keyframes thinking {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(240%);
  }
}

/* Modal */

.modal-backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 22, 20, 0.58);
  backdrop-filter: blur(6px);
  animation: modal-fade 160ms ease both;
}

@keyframes modal-fade {
  from {
    opacity: 0;
  }
}

.modal {
  width: min(100%, 650px);
  max-height: min(90vh, 900px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-raised);
  box-shadow: 0 28px 80px rgba(12, 19, 17, 0.24);
  animation: modal-rise 200ms ease both;
}

.modal.is-wide {
  width: min(100%, 780px);
}

@keyframes modal-rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}

.modal-head {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 23px 17px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 249, 0.96);
  backdrop-filter: blur(10px);
}

.modal-head h2 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.modal-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
}

.modal-close {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
}

.modal-close svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.modal-body {
  padding: 21px 23px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 16px 23px 21px;
}

.weight-table {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.weight-group-title {
  margin-top: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.09em;
}

.weight-group-title:first-child {
  margin-top: 0;
}

.weight-head,
.weight-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px 86px;
  align-items: center;
  gap: 10px;
}

.weight-head {
  padding: 0 4px;
  color: var(--muted);
  font-size: 15px;
}

.weight-head span:not(:first-child) {
  text-align: center;
}

.weight-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.weight-asset {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.weight-asset i {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 2px;
}

.weight-asset strong {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.weight-asset span {
  color: var(--muted);
  font-size: 15px;
}

.weight-row input {
  width: 100%;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 15px;
  text-align: right;
}

.weight-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
}

.weight-total strong {
  min-width: 55px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  text-align: right;
}

.weight-total strong.is-invalid {
  color: var(--accent-dark);
}

.modal-note {
  margin-top: 17px;
  padding: 12px;
  border-radius: 9px;
  color: #775438;
  background: var(--warning-soft);
  font-size: 15px;
  line-height: 1.6;
}

/* Toasts */

.toast-stack {
  position: fixed;
  z-index: 80;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 9px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 11px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #f1f0e9;
  background: #202b27;
  box-shadow: 0 14px 36px rgba(17, 25, 22, 0.24);
  font-size: 15px;
  pointer-events: auto;
  animation: toast-in 180ms ease both;
}

.toast::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: 5px;
  border-radius: 50%;
  background: #82b39d;
}

.toast.is-error::before {
  background: #ec7459;
}

.toast strong {
  display: block;
  margin-bottom: 2px;
  font-size: 15px;
}

.toast span {
  color: #a6b1ac;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* Loading skeleton and errors */

.page-loading {
  width: min(100%, 1480px);
  margin: 0 auto;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #e2e1d9;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.45),
    transparent
  );
  transform: translateX(-100%);
  animation: skeleton 1.4s ease-in-out infinite;
}

@keyframes skeleton {
  to {
    transform: translateX(100%);
  }
}

.skeleton-title {
  width: 260px;
  height: 44px;
  margin-bottom: 28px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.skeleton-card {
  height: 250px;
}

.load-error {
  display: grid;
  place-items: center;
  min-height: 55vh;
  text-align: center;
}

.load-error strong {
  display: block;
  font-size: 20px;
}

.load-error p {
  max-width: 460px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 15px;
}

.load-error .button {
  margin-top: 18px;
}

/* Responsive */

@media (max-width: 1280px) {
  :root {
    --sidebar-width: 225px;
  }

  .page-root {
    padding-inline: 26px;
  }

  .topbar {
    padding-inline: 26px;
  }

  .overview-main {
    grid-template-columns: minmax(0, 1.45fr) minmax(286px, 0.78fr);
  }

  .macro-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .metric-strip,
  .risk-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-item:nth-child(2),
  .risk-metric:nth-child(2) {
    border-right: 0;
  }

  .metric-item:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .overview-main,
  .overview-lower,
  .risk-grid,
  .scenario-layout,
  .journal-layout,
  .alert-overview {
    grid-template-columns: 1fr;
  }

  .portfolio-hero {
    min-height: 400px;
  }

  .allocation-card {
    min-height: auto;
  }

  .allocation-card .donut-wrap {
    float: left;
    margin: 0 26px 8px 0;
  }

  .allocation-card .allocation-list {
    min-height: 178px;
  }

  .scenario-result {
    min-height: auto;
  }

  .journal-side {
    grid-template-columns: 1fr 1fr;
  }

  .intel-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .intel-toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 860px) {
  .sidebar {
    display: none;
  }

  .main-shell {
    margin-left: 0;
  }

  .topbar {
    height: 68px;
    padding: 0 20px;
  }

  .mobile-brand,
  .mobile-nav {
    display: flex;
  }

  .topbar-context {
    display: none;
  }

  .profile-pill {
    display: none;
  }

  .page-root {
    min-height: calc(100vh - 68px);
    padding: 26px 20px 100px;
  }

  .mobile-nav {
    position: fixed;
    z-index: 30;
    right: 14px;
    bottom: 12px;
    left: 14px;
    height: 66px;
    align-items: center;
    justify-content: space-around;
    padding: 5px 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: rgba(23, 32, 30, 0.96);
    box-shadow: 0 16px 40px rgba(12, 19, 17, 0.25);
    backdrop-filter: blur(16px);
  }

  .mobile-nav a {
    min-width: 55px;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 10px;
    color: #7f8e88;
    font-size: 15px;
  }

  .mobile-nav a.is-active {
    color: #f7f3ea;
    background: rgba(255, 255, 255, 0.07);
  }

  .mobile-nav svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
  }

  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 310px;
    padding: 28px;
  }

  .login-statement {
    margin: 45px 0 20px;
    padding: 0;
  }

  .login-statement h1 {
    font-size: clamp(42px, 10vw, 64px);
  }

  .login-copy,
  .login-metric {
    display: none;
  }

  .login-panel {
    padding: 45px 25px 65px;
  }

  .exposure-grid {
    grid-template-columns: 1fr;
  }

  .toast-stack {
    right: 16px;
    bottom: 90px;
  }

  .report-grid {
    grid-template-columns: 1fr;
  }

  .review-report-head {
    flex-direction: column;
  }

  .review-actions {
    align-self: flex-end;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding-inline: 15px;
  }

  .data-chip {
    display: none;
  }

  .page-root {
    padding: 22px 15px 96px;
  }

  .page-header {
    align-items: flex-start;
    margin-bottom: 21px;
  }

  .page-header h1 {
    font-size: 32px;
  }

  .page-stamp {
    display: none;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-item {
    padding: 16px;
  }

  .metric-item:nth-child(odd) {
    border-right: 1px solid var(--line);
  }

  .metric-item:nth-child(even) {
    border-right: 0;
  }

  .metric-item:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .metric-value {
    font-size: 23px;
  }

  .portfolio-hero {
    min-height: 370px;
    padding: 20px 17px 15px;
  }

  .hero-head {
    flex-direction: column;
    gap: 15px;
  }

  .hero-index strong {
    font-size: 43px;
  }

  .hero-chart {
    height: 225px;
    margin-top: 18px;
  }

  .hero-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-footer span:last-child {
    text-align: left;
  }

  .allocation-card .donut-wrap {
    float: none;
    margin-inline: auto;
  }

  .allocation-card .allocation-list {
    min-height: 0;
  }

  .card {
    padding: 18px;
  }

  .overview-lower {
    gap: 13px;
  }

  .contribution-row {
    grid-template-columns: 47px minmax(0, 1fr) 52px;
    gap: 8px;
  }

  .macro-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .risk-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .risk-metric {
    padding: 15px;
  }

  .wide-warning {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .wide-warning .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .fund-check-grid {
    grid-template-columns: 1fr;
  }

  .preset-grid {
    grid-template-columns: 1fr;
  }

  .scenario-result {
    padding: 20px 17px;
  }

  .scenario-result h2 {
    font-size: 52px;
  }

  .scenario-asset-row {
    grid-template-columns: 63px minmax(0, 1fr) 55px;
    gap: 8px;
  }

  .journal-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .journal-toolbar .button {
    width: 100%;
  }

  .journal-detail,
  .journal-side {
    grid-template-columns: 1fr;
  }

  .journal-entry-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .journal-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .intel-top {
    align-items: stretch;
    flex-direction: column;
  }

  .intel-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .intel-tabs button {
    flex: 1 0 auto;
  }

  .intel-disclaimer {
    text-align: left;
  }

  .intel-toolbar-main,
  .intel-toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .news-filters {
    flex-wrap: wrap;
  }

  .review-report-head,
  .report-grid {
    padding-inline: 17px;
  }

  .review-report h2 {
    font-size: 25px;
  }

  .impact-grid {
    grid-template-columns: 1fr;
  }

  .review-report-foot,
  .news-toolbar-note,
  .anomaly-body {
    align-items: flex-start;
    flex-direction: column;
  }

  .anomaly-body .button {
    width: 100%;
  }

  .report-history-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .source-line {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .alert-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .alert-rule {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 16px;
  }

  .rule-observed {
    grid-column: 1;
    grid-row: 2;
  }

  .rule-threshold {
    grid-column: 2;
    grid-row: 2;
  }

  .rules-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .rules-footer .button {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .field-full {
    grid-column: auto;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 94vh;
    border-radius: 18px 18px 0 0;
  }

  .modal-head {
    padding: 18px;
  }

  .modal-body {
    padding: 18px;
  }

  .modal-footer {
    padding: 0 18px 20px;
  }

  .weight-head,
  .weight-row {
    grid-template-columns: minmax(0, 1fr) 72px 72px;
    gap: 7px;
  }
}

@media (max-width: 420px) {
  .topbar-actions {
    gap: 6px;
  }

  .icon-button {
    width: 35px;
    height: 35px;
  }

  .metric-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .macro-grid {
    grid-template-columns: 1fr;
  }

  .risk-metrics {
    grid-template-columns: 1fr;
  }

  .risk-metric:nth-child(2) {
    border-right: 0;
  }

  .weight-asset span {
    display: none;
  }

  .weight-head,
  .weight-row {
    grid-template-columns: minmax(0, 1fr) 62px 62px;
  }

  .login-visual {
    min-height: 280px;
    padding: 24px 20px;
  }

  .login-panel {
    padding-inline: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
