:root {
  color-scheme: dark;
  --bg: #06100e;
  --panel: rgba(13, 29, 25, 0.88);
  --panel-strong: #102720;
  --line: rgba(154, 196, 181, 0.15);
  --text: #f2f7f5;
  --muted: #96aaa4;
  --green: #45e09b;
  --green-dark: #0b8b59;
  --amber: #f8bd62;
  --red: #ff6f79;
  --blue: #5dc9ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 20% 0%, #0b261e 0, var(--bg) 42%); }
button, input, select { font: inherit; }
a { color: inherit; }
.ambient { position: fixed; border-radius: 50%; filter: blur(90px); opacity: .14; pointer-events: none; z-index: -1; }
.ambient-a { width: 420px; height: 420px; background: var(--green); top: -210px; right: -90px; }
.ambient-b { width: 360px; height: 360px; background: #1679d4; bottom: -220px; left: -140px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px max(22px, calc((100vw - 1380px)/2)); background: rgba(6,16,14,.84); border-bottom: 1px solid var(--line); backdrop-filter: blur(22px); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand > span:last-child { display: grid; }
.brand strong { letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .13em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, var(--green), #c8ff81); color: #052018; font-weight: 900; box-shadow: 0 9px 30px rgba(69,224,155,.25); }
.brand-mark.large { width: 58px; height: 58px; border-radius: 17px; font-size: 24px; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-name { font-weight: 700; }
.role-badge, .status-chip, .count-badge, .share-badge { padding: 7px 11px; border-radius: 999px; background: rgba(69,224,155,.1); color: var(--green); border: 1px solid rgba(69,224,155,.2); font-size: 12px; font-weight: 800; }
.page-shell { width: min(1380px, calc(100% - 34px)); margin: 28px auto 80px; }
.footer { width: min(1380px, calc(100% - 34px)); margin: 0 auto 32px; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.hero-panel, .panel-section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.hero-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 30px 34px; }
.hero-panel h1 { margin: 3px 0 6px; font-size: clamp(28px, 4vw, 48px); letter-spacing: -.045em; }
.hero-panel p { margin: 0; color: var(--muted); }
.eyebrow { margin: 0; color: var(--green) !important; text-transform: uppercase; letter-spacing: .16em; font-size: 11px; font-weight: 900; }
.connection-pill, .live-label { display: inline-flex; align-items: center; gap: 9px; padding: 10px 14px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.connection-pill.online { background: rgba(69,224,155,.1); color: var(--green); }
.connection-pill.offline { background: rgba(255,111,121,.1); color: var(--red); }
.pulse-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 5px rgba(69,224,155,.12); animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.82); } }
.section-tabs { position: sticky; top: 68px; z-index: 10; display: flex; gap: 7px; overflow-x: auto; padding: 10px; margin: 14px 0; border: 1px solid var(--line); border-radius: 17px; background: rgba(7,19,16,.88); backdrop-filter: blur(20px); scrollbar-width: none; }
.section-tabs a { flex: 0 0 auto; padding: 9px 13px; border-radius: 11px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 800; }
.section-tabs a:hover { color: var(--text); background: rgba(255,255,255,.06); }
.panel-section { scroll-margin-top: 130px; padding: 28px; margin-top: 14px; }
.admin-section { border-color: rgba(248,189,98,.19); }
.section-heading, .subpanel-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.section-heading h2, .subpanel-title h3 { margin: 5px 0 0; letter-spacing: -.025em; }
.section-heading h2 { font-size: clamp(22px, 3vw, 30px); }
.subpanel-title h3 { font-size: 18px; }
.subpanel-title p { margin: 5px 0 0; color: var(--muted); line-height: 1.45; font-size: 13px; }
.metric-grid { display: grid; gap: 12px; }
.metric-grid.five { grid-template-columns: repeat(5, 1fr); }
.metric-grid.four { grid-template-columns: repeat(4, 1fr); }
.metric-card { min-width: 0; padding: 19px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.025); }
.metric-card.featured { background: linear-gradient(145deg, rgba(69,224,155,.14), rgba(69,224,155,.035)); border-color: rgba(69,224,155,.26); }
.metric-card > span, .metric-card small { display: block; color: var(--muted); font-size: 12px; }
.metric-card strong { display: block; margin: 10px 0 7px; font-size: clamp(21px, 2.2vw, 31px); letter-spacing: -.04em; overflow-wrap: anywhere; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.period-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.period-grid article { display: flex; justify-content: space-between; gap: 15px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 15px; background: rgba(0,0,0,.12); }
.period-grid span { color: var(--muted); font-size: 13px; }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.portfolio-grid { grid-template-columns: 1.4fr .6fr; }
.subpanel { min-width: 0; padding: 21px; border: 1px solid var(--line); border-radius: 19px; background: rgba(0,0,0,.13); }
.narrow-panel { max-width: 620px; }
.chart-panel canvas { width: 100%; height: 260px; display: block; }
.trade-grid, .profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.trade-card { padding: 19px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.025); }
.trade-head { display: flex; align-items: center; justify-content: space-between; }
.trade-head strong { font-size: 19px; }
.side, .tag { display: inline-flex; padding: 5px 8px; border-radius: 8px; background: rgba(255,255,255,.07); color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .04em; }
.side.buy { color: var(--green); background: rgba(69,224,155,.1); }
.side.sell { color: var(--red); background: rgba(255,111,121,.1); }
.trade-profit { margin: 18px 0; font-size: 30px; font-weight: 900; letter-spacing: -.04em; }
.trade-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 15px; }
.trade-card dl div { display: grid; gap: 3px; }
.trade-card dt, .trade-card small { color: var(--muted); font-size: 11px; }
.trade-card dd { margin: 0; font-size: 13px; font-weight: 800; }
.table-wrap { overflow: auto; max-height: 420px; border: 1px solid var(--line); border-radius: 15px; }
.table-wrap.tall { max-height: 560px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { position: sticky; top: 0; z-index: 1; padding: 13px 15px; text-align: left; color: var(--muted); background: #0c211b; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
td { padding: 13px 15px; border-top: 1px solid var(--line); white-space: nowrap; }
.empty-cell { padding: 28px; text-align: center; color: var(--muted); }
.stack-form, .form-grid { display: grid; gap: 14px; }
.form-grid { grid-template-columns: 1fr 1fr; }
.form-grid .wide { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
label small { font-weight: 500; }
input, select { width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--text); background: rgba(2,10,8,.75); }
input:focus, select:focus { border-color: rgba(69,224,155,.55); box-shadow: 0 0 0 3px rgba(69,224,155,.08); }
.check-label { grid-template-columns: auto 1fr; align-items: center; }
.check-label input { width: 18px; min-height: 18px; accent-color: var(--green); }
.primary-button, .secondary-button, .danger-button, .ghost-button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 11px 17px; border: 0; border-radius: 12px; cursor: pointer; font-weight: 900; text-decoration: none; }
.primary-button { background: linear-gradient(135deg, var(--green), #b1f36a); color: #062119; }
.secondary-button { background: rgba(93,201,255,.12); color: var(--blue); border: 1px solid rgba(93,201,255,.22); }
.danger-button { background: rgba(255,111,121,.11); color: var(--red); border: 1px solid rgba(255,111,121,.2); }
.ghost-button { background: rgba(255,255,255,.05); color: var(--text); border: 1px solid var(--line); }
.compact { min-height: 36px; padding: 7px 11px; border-radius: 9px; font-size: 12px; }
.profile-card { position: relative; display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.025); text-decoration: none; }
.profile-card:hover { border-color: rgba(69,224,155,.35); transform: translateY(-1px); }
.profile-card.archived { opacity: .55; }
.avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: rgba(69,224,155,.12); color: var(--green); font-weight: 900; }
.large-avatar { width: 64px; height: 64px; border-radius: 19px; font-size: 24px; }
.profile-main, .profile-value { display: grid; gap: 4px; }
.profile-main span, .profile-value span { color: var(--muted); font-size: 11px; }
.profile-value { text-align: right; }
.chevron { color: var(--muted); font-size: 28px; }
.allocation-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.allocation-row span { color: var(--muted); }
.allocation-row.total { margin-top: 10px; font-size: 18px; border-bottom: 0; }
.allocation-progress { width: 100%; height: 10px; overflow: hidden; border: 0; border-radius: 999px; background: rgba(255,255,255,.06); }
.allocation-progress::-webkit-progress-bar { border-radius: 999px; background: rgba(255,255,255,.06); }
.allocation-progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, var(--green), var(--blue)); }
.allocation-progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, var(--green), var(--blue)); }
.notice-line { padding: 11px 13px; border: 1px solid rgba(248,189,98,.2); border-radius: 12px; color: var(--amber); background: rgba(248,189,98,.06); font-size: 12px; line-height: 1.45; }
.request-list { display: grid; gap: 10px; }
.request-card { display: grid; grid-template-columns: minmax(180px,1fr) auto auto auto auto; align-items: center; gap: 13px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.025); }
.request-card > div:first-child { display: grid; gap: 3px; }
.request-card > div:first-child span { color: var(--muted); font-size: 11px; }
.inline-actions { display: contents; }
.status-pending { color: var(--amber); background: rgba(248,189,98,.1); }
.status-paid, .status-completed { color: var(--green); background: rgba(69,224,155,.1); }
.status-rejected, .status-cancelled { color: var(--red); background: rgba(255,111,121,.1); }
.empty-state { display: grid; place-items: center; min-height: 120px; padding: 24px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 15px; }
.empty-state.wide { grid-column: 1 / -1; }
.flash-stack { position: fixed; top: 80px; left: 50%; z-index: 50; display: grid; gap: 8px; width: min(560px, calc(100% - 28px)); transform: translateX(-50%); }
.flash { padding: 13px 16px; border: 1px solid var(--line); border-radius: 13px; background: #10241f; box-shadow: var(--shadow); font-size: 13px; font-weight: 700; }
.flash.success { border-color: rgba(69,224,155,.28); color: var(--green); }
.flash.error, .form-error { border-color: rgba(255,111,121,.28); color: var(--red); }
.login-shell { display: grid; place-items: center; min-height: calc(100vh - 120px); }
.login-card { width: min(460px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 28px; background: rgba(10,25,21,.9); box-shadow: var(--shadow); backdrop-filter: blur(22px); }
.login-brand, .profile-title { display: flex; align-items: center; gap: 16px; }
.login-brand h1 { margin: 3px 0 0; letter-spacing: -.04em; }
.login-copy { margin: 22px 0; color: var(--muted); line-height: 1.6; }
.login-note { display: flex; align-items: center; gap: 10px; margin-top: 18px; color: var(--muted); font-size: 12px; }
.form-error { margin-bottom: 14px; padding: 11px 13px; border: 1px solid; border-radius: 11px; background: rgba(255,111,121,.06); }
.error-card { text-align: center; }
.error-code { display: block; color: var(--green); font-size: 64px; font-weight: 900; letter-spacing: -.08em; }
.error-card p { color: var(--muted); }
.link-button { margin-top: 12px; }
.back-link { display: inline-block; margin: 0 0 14px 5px; color: var(--muted); text-decoration: none; font-size: 13px; }
.profile-hero { margin-bottom: 14px; }

@media (max-width: 1100px) {
  .metric-grid.five { grid-template-columns: repeat(3, 1fr); }
  .metric-grid.four { grid-template-columns: repeat(2, 1fr); }
  .trade-grid, .profile-grid { grid-template-columns: repeat(2, 1fr); }
  .portfolio-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .page-shell { width: min(100% - 18px, 1380px); margin-top: 14px; }
  .topbar { padding: 11px 13px; }
  .role-badge, .user-name { display: none; }
  .hero-panel { align-items: flex-start; flex-direction: column; padding: 23px; }
  .section-tabs { top: 61px; }
  .panel-section { padding: 19px; scroll-margin-top: 120px; }
  .metric-grid.five, .metric-grid.four, .period-grid, .split-grid, .trade-grid, .profile-grid { grid-template-columns: 1fr; }
  .metric-grid.five { grid-template-columns: 1fr 1fr; }
  .metric-card:first-child { grid-column: 1 / -1; }
  .request-card { grid-template-columns: 1fr auto; }
  .request-card .tag { justify-self: start; }
  .request-card form { display: block; }
  .profile-card { grid-template-columns: auto 1fr auto; }
  .profile-value { grid-column: 2; text-align: left; }
  .chevron { grid-column: 3; grid-row: 1 / 3; }
  .footer { flex-direction: column; gap: 6px; }
}

@media (max-width: 470px) {
  .metric-grid.five { grid-template-columns: 1fr; }
  .metric-card:first-child { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .login-card { padding: 25px; }
}
