:root {
  --ink: #102f43;
  --ink-soft: #4e6475;
  --paper: #f4f7f8;
  --panel: #ffffff;
  --line: #e3eaee;
  --primary: #126a86;
  --primary-deep: #0a3d56;
  --teal: #2a9d8f;
  --gold: #cf9b17;
  --danger: #dc5b4b;
  --warning: #d88b17;
  --shadow: 0 16px 40px rgba(16, 47, 67, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar { color: #e8f3f5; background: linear-gradient(180deg, #102f43 0%, #0b2635 100%); padding: 28px 18px 20px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 10px 28px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, #2a9d8f, #126a86); color: white; font-weight: 800; font-size: 19px; box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.brand strong { display: block; color: white; letter-spacing: -.2px; }
.brand span { display: block; font-size: 12px; color: #a8c1c8; margin-top: 2px; }
.nav { display: grid; gap: 6px; }
.nav-link { border: 0; background: transparent; color: #b6cbd0; text-align: left; border-radius: 10px; padding: 12px 13px; display: flex; gap: 12px; align-items: center; font-size: 14px; transition: .18s ease; }
.nav-link span { width: 20px; text-align: center; font-size: 14px; color: #86a9b1; font-weight: 700; }
.nav-link:hover, .nav-link.active { color: white; background: rgba(255,255,255,.1); }
.nav-link.active { box-shadow: inset 3px 0 0 #2a9d8f; }
.nav-link.active span { color: #72d2c6; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 7px; font-size: 12px; color: #a8c1c8; padding: 12px 10px 0; flex-wrap: wrap; }
.sidebar-foot a { color: #e8f3f5; margin-left: auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2a9d8f; }
.dot-warning { background: #d88b17; }

.main-content { padding: 30px clamp(22px, 4vw, 58px) 52px; max-width: 1650px; width: 100%; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; gap: 22px; align-items: flex-start; padding-bottom: 25px; }
.eyebrow { margin: 0 0 7px; font-size: 11px; letter-spacing: .12em; color: #66808f; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(25px, 3vw, 36px); letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -.025em; }
h3 { margin: 0; font-size: 15px; letter-spacing: -.015em; }
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.button { border: 1px solid var(--primary); color: white; background: var(--primary); border-radius: 9px; padding: 10px 14px; font-weight: 750; font-size: 13px; transition: .18s; text-decoration: none; }
.button:hover { background: var(--primary-deep); border-color: var(--primary-deep); }
.button-secondary { color: var(--primary); border-color: #b7d4de; background: #edf7f8; }
.button-secondary:hover { background: #dbeff1; border-color: #9cc9d2; }
.button-muted { color: #516875; border-color: #d4dfe3; background: white; }
.button-muted:hover { background: #f4f8f9; border-color: #b7c8ce; }
.button.is-attention { color: white; background: #d88b17; border-color: #d88b17; }
.text-button { color: var(--primary); background: transparent; border: 0; padding: 0; font-weight: 750; font-size: 13px; text-decoration: none; }

.notice { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 15px; margin-bottom: 22px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.notice-info { background: #e8f4f7; color: #22566a; border: 1px solid #cae6eb; }
.notice-danger { background: #fff0ed; color: #973d31; border: 1px solid #ffd7cf; }
.notice-success { background: #e9f7f1; color: #1d705e; border: 1px solid #ccebdd; }
.notice a { font-weight: 800; text-decoration: none; white-space: nowrap; }
.is-hidden { display: none; }

.view { display: none; }
.view.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 18px; }
.metric-card { min-height: 142px; padding: 20px; border: 1px solid var(--line); background: var(--panel); border-radius: 14px; box-shadow: 0 8px 24px rgba(16,47,67,.03); display: flex; flex-direction: column; }
.metric-card span { color: #6a7f8b; font-size: 13px; font-weight: 700; }
.metric-card strong { color: var(--ink); font-size: clamp(22px, 2.2vw, 31px); letter-spacing: -.045em; padding-top: 13px; }
.metric-card small { color: #80919b; margin-top: auto; line-height: 1.35; font-size: 11px; }
.metric-card-primary { color: white; background: linear-gradient(135deg, #126a86, #174b63); border-color: #126a86; box-shadow: 0 14px 30px rgba(18,106,134,.22); }
.metric-card-primary span, .metric-card-primary strong, .metric-card-primary small { color: white; }
.metric-card-primary small { color: #bfdae1; }

.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.content-grid-dashboard { grid-template-columns: minmax(0, 1.5fr) minmax(320px, .8fr); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: clamp(18px, 2vw, 24px); overflow: hidden; }
.panel-heading { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.panel-heading .eyebrow { margin-bottom: 5px; }
.panel-note { color: #718995; font-size: 12px; white-space: nowrap; }
.panel-footer { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding-top: 16px; color: #70828d; font-size: 11px; }

.allocation-layout { display: grid; grid-template-columns: 155px minmax(0,1fr); align-items: center; gap: 26px; }
.donut-wrap { display: grid; place-items: center; }
.donut { width: 145px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; position: relative; }
.donut::after { content: ""; position: absolute; width: 102px; aspect-ratio: 1; background: white; border-radius: 50%; box-shadow: inset 0 0 0 1px #eff4f5; }
.donut span { z-index: 1; display: grid; text-align: center; gap: 1px; }
.donut strong { font-size: 20px; letter-spacing: -.04em; }
.donut small { color: #6d8590; font-size: 10px; }
.allocation-list { display: grid; gap: 9px; }
.allocation-item { display: grid; grid-template-columns: 9px minmax(0,1fr) auto; gap: 9px; align-items: center; font-size: 12px; }
.legend { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.allocation-item strong { display: block; font-size: 12px; }
.allocation-item small { color: #7a8d96; display: block; margin-top: 2px; }
.allocation-numbers { text-align: right; }

.decision-panel { background: linear-gradient(155deg, #f9fcfc 0%, #eaf6f5 100%); border-color: #cfe9e4; display: flex; flex-direction: column; align-items: flex-start; }
.decision-copy { color: #45636d; font-size: 14px; line-height: 1.55; margin-bottom: 20px; }
.decision-amount { font-size: 24px; color: #176e68; font-weight: 800; letter-spacing: -.045em; margin-bottom: 23px; }
.decision-panel .button { margin-top: auto; }

.status-list { display: grid; gap: 15px; }
.status-row { display: flex; gap: 10px; align-items: flex-start; }
.status-row strong { display: block; font-size: 13px; }
.status-row strong em { font-style: normal; color: #53707d; margin-left: 5px; }
.status-row small { display: block; color: #71848f; line-height: 1.4; margin-top: 3px; font-size: 12px; }
.status-icon { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; box-shadow: 0 0 0 4px rgba(42,157,143,.10); }
.status-good { background: #2a9d8f; }
.status-watch { background: #d88b17; box-shadow: 0 0 0 4px rgba(216,139,23,.10); }
.status-danger { background: #dc5b4b; box-shadow: 0 0 0 4px rgba(220,91,75,.10); }

.crypto-balance { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.crypto-balance > div { background: #f5f8f9; border-radius: 10px; padding: 13px; }
.crypto-balance span, .crypto-balance small { display: block; color: #70848e; font-size: 10px; }
.crypto-balance strong { display: block; padding: 4px 0; font-size: 18px; letter-spacing: -.035em; }
.crypto-progress { height: 9px; background: #f9e3df; border-radius: 99px; overflow: hidden; margin: 17px 0 13px; }
.crypto-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #e76f51, #dc5b4b); }
.crypto-note { font-size: 12px; color: #59707b; line-height: 1.5; margin-bottom: 0; }

.section-intro { display: flex; gap: 22px; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; }
.section-intro h2 { font-size: 25px; }
.section-intro p:not(.eyebrow) { margin: 8px 0 0; color: #667f8b; max-width: 690px; line-height: 1.55; font-size: 14px; }
.inline-input { background: white; border: 1px solid var(--line); padding: 9px 12px; border-radius: 10px; min-width: 230px; box-shadow: 0 4px 15px rgba(16,47,67,.03); }
.inline-input span { display: block; color: #738793; font-weight: 750; font-size: 11px; margin-bottom: 4px; }
.inline-input input { border: 0; outline: 0; width: 100%; color: var(--ink); font-size: 21px; font-weight: 780; letter-spacing: -.04em; background: transparent; }

.table-scroll { overflow-x: auto; }
.data-table { border-collapse: collapse; width: 100%; min-width: 630px; }
.data-table th { text-align: left; color: #768994; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; padding: 0 10px 11px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 14px 10px; border-bottom: 1px solid #edf1f3; color: #3e5663; font-size: 13px; vertical-align: middle; }
.data-table td strong { color: var(--ink); display: block; }
.data-table td small { display: block; color: #80919a; margin-top: 3px; font-size: 11px; max-width: 350px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .legend { margin-right: 8px; vertical-align: 1px; }
.delta { padding: 4px 7px; border-radius: 99px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.delta-good { color: #187166; background: #e5f5f1; }
.delta-watch { color: #a56507; background: #fff3dc; }
.delta-attention { color: #a43f32; background: #ffebe7; }
.table-input { border: 1px solid #b6ced5; border-radius: 7px; padding: 7px; width: 125px; color: var(--ink); font-weight: 700; }
.total-row td { color: var(--primary) !important; font-weight: 800; background: #f2f9fa; }
.ticker { padding: 3px 6px; border-radius: 5px; color: #325a6b; font-size: 11px; font-weight: 800; background: #edf4f5; }

.platform-list, .component-list { display: grid; gap: 2px; }
.platform-row { display: grid; grid-template-columns: 10px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid #edf1f3; }
.platform-row:last-child, .component-row:last-child { border-bottom: 0; }
.platform-symbol { width: 9px; height: 29px; border-radius: 7px; }
.platform-row strong, .component-row strong { font-size: 13px; }
.platform-row small, .component-row small { display: block; color: #788c96; margin-top: 3px; font-size: 11px; }
.platform-row > strong { text-align: right; }
.component-row { padding: 10px 0; border-bottom: 1px solid #edf1f3; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.component-row span { display: block; color: #647a85; max-width: 330px; font-size: 11px; line-height: 1.35; margin-top: 2px; }
.component-row > div:last-child { text-align: right; white-space: nowrap; }

.positions-table { min-width: 1160px; }
.positions-table td { padding: 8px 6px; }
.position-input, .position-select, .position-textarea {
  width: 100%;
  min-width: 84px;
  border: 1px solid #cbdce1;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  padding: 7px 8px;
  font-size: 12px;
}
.position-input:focus, .position-select:focus, .position-textarea:focus {
  outline: 3px solid #d8eff1;
  border-color: #60a8b7;
}
.position-textarea { min-width: 150px; min-height: 34px; resize: vertical; }
.position-small { min-width: 66px; }
.row-delete {
  border: 0;
  background: #fff0ed;
  color: #a9473a;
  border-radius: 7px;
  width: 29px;
  height: 29px;
  font-weight: 900;
}
.row-delete:hover { background: #ffdeda; }

.settings-form { display: grid; gap: 12px; }
.settings-form label { display: grid; gap: 6px; color: #4f6975; font-weight: 750; font-size: 12px; }
.settings-form input, .settings-form select {
  border: 1px solid #cbdce1;
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: white;
}
.settings-form input:focus, .settings-form select:focus { outline: 3px solid #d8eff1; border-color: #60a8b7; }
.settings-form .button { justify-self: start; }
.settings-status { display: flex; gap: 10px; align-items: center; padding: 11px; border-radius: 9px; background: #f5f8f9; color: #536c77; font-size: 13px; margin: 12px 0; }
.twofa-secret { display: grid; gap: 5px; padding: 12px; border: 1px dashed #a8c9d1; border-radius: 9px; background: #f7fbfb; margin: 12px 0; }
.twofa-secret code { font-size: 15px; color: var(--primary-deep); word-break: break-all; font-weight: 800; letter-spacing: .07em; }
.twofa-secret small { color: #64808b; line-height: 1.45; }
.twofa-setup-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 16px; margin: 14px 0; }
.twofa-setup-grid .twofa-secret { margin: 0; }
.totp-qr { min-width: 176px; min-height: 176px; display: grid; place-items: center; padding: 8px; border: 1px solid #d9e6e9; border-radius: 10px; background: white; color: #66808c; text-align: center; font-size: 12px; }
.totp-qr-canvas { display: block; width: min(250px, 100%); height: auto; image-rendering: pixelated; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 14px; margin: 13px 0; border: 1px dashed #cfb39a; border-radius: 9px; background: #fffaf2; }
.recovery-codes code { display: block; padding: 9px 10px; border-radius: 7px; background: white; color: #704a14; text-align: center; font-weight: 850; letter-spacing: .08em; box-shadow: 0 2px 7px rgba(112,74,20,.08); }
.form-inline { display: flex; gap: 9px; align-items: flex-end; flex-wrap: wrap; }
.form-inline label { flex: 1 1 160px; }
.users-panel { margin-top: 18px; }
.users-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.users-panel .data-table { min-width: 760px; }
.user-active { color: #1c7567; font-weight: 800; font-size: 11px; }
.user-off { color: #a9473a; font-weight: 800; font-size: 11px; }
.user-actions { display: flex; gap: 6px; align-items: center; }
.user-actions .button { padding: 7px 9px; font-size: 11px; }

.allocation-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; }
.allocation-card { position: relative; overflow: hidden; min-height: 142px; background: #f8fbfb; border: 1px solid #e0eaec; border-radius: 11px; padding: 17px 16px 15px 18px; display: flex; flex-direction: column; }
.allocation-card.is-zero { opacity: .52; }
.allocation-strip { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; }
.card-meta { color: #6a8390; text-transform: uppercase; letter-spacing: .08em; font-size: 9px; font-weight: 800; }
.allocation-card h3 { margin-top: 7px; color: var(--ink); line-height: 1.3; }
.allocation-card p { color: #70848e; font-size: 12px; margin: 6px 0 0; }
.allocation-card > strong { margin-top: auto; color: var(--ink); letter-spacing: -.035em; font-size: 22px; }
.tranche-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; margin-bottom: 22px; }
.tranche-card { background: #eef8f7; border: 1px solid #d4ece8; border-radius: 11px; padding: 16px; }
.tranche-card span { display: block; color: #57747a; font-size: 12px; }
.tranche-card strong { display: block; color: #176e68; letter-spacing: -.04em; font-size: 27px; padding: 7px 0 2px; }
.tranche-card small { color: #71878b; font-size: 11px; }

.rule-flow { padding: 0; margin: 0; list-style: none; counter-reset: flow; display: grid; gap: 13px; }
.rule-flow li { counter-increment: flow; display: grid; grid-template-columns: 25px minmax(0,1fr); gap: 10px; color: #536b76; font-size: 14px; line-height: 1.5; }
.rule-flow li::before { content: counter(flow); display: grid; place-items: center; color: var(--primary); width: 24px; height: 24px; background: #e9f5f6; border-radius: 50%; font-weight: 800; font-size: 11px; }
.pill { display: inline-flex; align-items: center; border-radius: 99px; padding: 7px 10px; font-weight: 800; font-size: 12px; white-space: nowrap; }
.pill-core { color: #1a736c; background: #e7f7f3; }

.rules-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.rule-card { position: relative; min-height: 184px; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 8px 22px rgba(16,47,67,.035); }
.rule-card h3 { margin: 12px 0 8px; }
.rule-card p { margin: 0; color: #617984; font-size: 13px; line-height: 1.55; }
.rule-number { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--primary); font-size: 10px; font-weight: 900; background: #e8f4f6; }
.rule-warning { border-color: #f2debe; }.rule-warning .rule-number { background: #fff1d8; color: #a56507; }
.security-card { margin-top: 18px; background: linear-gradient(125deg,#102f43,#19556b); border-color: transparent; color: white; }
.security-card .eyebrow { color: #9fd0d7; }.security-card h2 { margin-bottom: 11px; }.security-card p { color: #d2e7ea; max-width: 700px; font-size: 14px; line-height: 1.6; }.security-card .text-button { color: #86dcd2; }

.toast { position: fixed; z-index: 20; right: 22px; bottom: 22px; max-width: min(420px, calc(100vw - 44px)); border-radius: 10px; color: white; background: #2e5261; padding: 13px 16px; box-shadow: 0 16px 42px rgba(0,0,0,.2); font-size: 13px; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .22s; }
.toast.show { transform: translateY(0); opacity: 1; }.toast-success { background: #1c7668; }.toast-danger { background: #a84537; }

.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 0%, #d9efef 0, #f4f7f8 45%, #edf4f6 100%); }
.auth-card { width: min(460px,100%); background: white; padding: 36px; border-radius: 16px; box-shadow: 0 22px 60px rgba(16,47,67,.13); border: 1px solid #e0e9ec; }
.auth-card .brand-mark { margin-bottom: 23px; }.auth-card h1 { font-size: 29px; margin-bottom: 10px; }.auth-card > p:not(.eyebrow) { color: #66808c; line-height: 1.55; font-size: 14px; }
.auth-form { display: grid; gap: 14px; margin: 24px 0; }.auth-form label { color: #4f6975; display: grid; gap: 6px; font-weight: 750; font-size: 12px; }.auth-form input { border: 1px solid #cfdde1; border-radius: 8px; padding: 11px; color: var(--ink); background: white; }.auth-form input:focus { outline: 3px solid #d7eff0; border-color: #65a9b9; }.auth-form .button { margin-top: 3px; }.setup-card { width: min(570px,100%); }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; z-index: 10; top: 0; height: auto; padding: 12px 16px; flex-direction: row; align-items: center; gap: 16px; }
  .brand { padding: 0; flex: 0 0 auto; }.brand span { display: none; }
  .nav { display: flex; overflow-x: auto; flex: 1; gap: 4px; }.nav-link { white-space: nowrap; padding: 9px 10px; }.nav-link.active { box-shadow: inset 0 -3px 0 #2a9d8f; }.sidebar-foot { display: none; }
  .main-content { padding-top: 24px; }.metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }.content-grid-dashboard { grid-template-columns: 1fr; }.rules-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 680px) {
  .sidebar { align-items: flex-start; }.brand strong { display: none; }.brand-mark { width: 31px; height: 31px; border-radius: 9px; font-size: 15px; }.nav-link span { display: none; }
  .main-content { padding: 21px 14px 34px; }.topbar, .section-intro { display: grid; gap: 16px; }.topbar-actions { width: 100%; }.topbar-actions .button { flex: 1; text-align: center; }
  .metric-grid, .content-grid, .rules-grid { grid-template-columns: 1fr; gap: 12px; }.metric-card { min-height: 116px; }.allocation-layout { grid-template-columns: 1fr; }.donut-wrap { margin-bottom: 3px; }.allocation-cards, .tranche-cards { grid-template-columns: 1fr; }.inline-input { width: 100%; }.panel { padding: 17px; }.panel-footer { align-items: flex-start; flex-direction: column; }.section-intro h2 { font-size: 22px; }.crypto-balance { grid-template-columns: 1fr; }
  .twofa-setup-grid { grid-template-columns: 1fr; }.totp-qr { width: min(100%, 250px); margin: 0 auto; }
  .recovery-codes { grid-template-columns: 1fr; }
}
