:root {
  --bg: #06100d;
  --bg2: #091713;
  --panel: rgba(13, 29, 24, 0.88);
  --panel2: #10271f;
  --line: rgba(151, 255, 213, 0.12);
  --line-strong: rgba(84, 255, 182, 0.3);
  --text: #eefbf5;
  --muted: #8ca99d;
  --green: #46e7a5;
  --green-deep: #0ca76d;
  --yellow: #f2c35b;
  --red: #ff7272;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(24, 135, 92, .17), transparent 28rem),
    radial-gradient(circle at 86% 20%, rgba(0, 72, 51, .24), transparent 32rem),
    linear-gradient(180deg, #07130f, #040a08 70%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(105,255,196,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(105,255,196,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}
button, input, select { font: inherit; }
button { color: inherit; }
p { color: var(--muted); line-height: 1.55; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(21px, 3vw, 30px); letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 21px; letter-spacing: -.025em; }
.eyebrow { margin: 0 0 5px; color: var(--green); font-size: 10px; font-weight: 850; letter-spacing: .18em; }
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  padding: 12px max(22px, calc((100vw - 1280px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(4, 12, 9, .78);
  backdrop-filter: blur(20px);
}
.brand, .top-actions, .panel-head, .brand-row { display: flex; align-items: center; }
.brand { gap: 13px; }
.top-actions { gap: 12px; }
.brand-mark {
  position: relative;
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(66,231,165,.23), rgba(4,19,14,.2));
  box-shadow: inset 0 0 26px rgba(70,231,165,.1), 0 14px 40px rgba(0,0,0,.3);
}
.brand-mark::before { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(70,231,165,.22); border-radius: 13px; transform: rotate(45deg); }
.brand-mark span { position: relative; font-size: 27px; font-weight: 950; color: var(--green); }
.brand-mark.small { width: 46px; height: 46px; border-radius: 14px; }
.brand-mark.small::before { inset: 7px; border-radius: 9px; }
.brand-mark.small span { font-size: 19px; }
.page { position: relative; width: min(1280px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 60px; }
.mode-pill, .tag, .status-label, .side {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 29px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .06em;
}
.mode-pill > span { width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 12px var(--yellow); }
.mode-pill.live { border-color: rgba(255,114,114,.4); color: #ffb4b4; }
.mode-pill.live > span { background: var(--red); box-shadow: 0 0 12px var(--red); }
.mode-pill.test { color: #f6d891; }
.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(52, 149, 109, .1);
  color: var(--text);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  transition: .16s ease;
}
.button:hover { transform: translateY(-1px); border-color: var(--green); background: rgba(52, 149, 109, .2); }
.button.primary { background: linear-gradient(135deg, #63f0b7, #31c88c); color: #032217; border-color: transparent; box-shadow: 0 12px 30px rgba(42,200,138,.17); }
.button.quiet { min-height: 36px; color: var(--muted); border-color: var(--line); background: transparent; }
.button.wide { width: 100%; }
.notice { margin: 0 0 18px; padding: 14px 16px; border: 1px solid rgba(70,231,165,.32); border-radius: 12px; background: rgba(36,151,105,.12); color: #caffe8; }
.notice.error { border-color: rgba(255,114,114,.35); background: rgba(255,85,85,.1); color: #ffc0c0; }
.safety-banner {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid rgba(242,195,91,.3);
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(242,195,91,.11), rgba(242,195,91,.035));
}
.safety-banner p { margin: 2px 0 0; font-size: 13px; }
.safety-icon { display: grid; flex: 0 0 36px; height: 36px; place-items: center; border-radius: 50%; background: rgba(242,195,91,.15); color: var(--yellow); font-weight: 900; }
.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.metric-card, .panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(16,37,30,.91), rgba(8,22,17,.91));
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.metric-card { min-height: 126px; padding: 19px; }
.metric-card.accent { border-color: rgba(70,231,165,.26); background: linear-gradient(145deg, rgba(20,66,49,.9), rgba(8,26,19,.92)); }
.metric-card p { margin-bottom: 11px; font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.metric-card strong { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; font-size: 24px; letter-spacing: -.04em; }
.metric-card small, .panel-head small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status-dot.ok { background: var(--green); box-shadow: 0 0 13px rgba(70,231,165,.7); }
.status-dot.bad { background: var(--red); box-shadow: 0 0 13px rgba(255,114,114,.55); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(310px, .75fr); gap: 12px; }
.panel { padding: 22px; }
.panel-head { justify-content: space-between; gap: 16px; margin-bottom: 21px; }
.tag { color: var(--green); background: rgba(70,231,165,.07); }
.settings-form { display: grid; gap: 20px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.compact-fields { grid-template-columns: repeat(3, minmax(0,1fr)); }
label { display: grid; gap: 7px; color: #d5eee4; font-size: 12px; font-weight: 700; }
label small { color: var(--muted); font-weight: 450; line-height: 1.35; }
input, select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(151,255,213,.13);
  border-radius: 10px;
  outline: none;
  background: rgba(1,12,8,.56);
  color: var(--text);
}
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(70,231,165,.09); }
.input-unit { display: flex; align-items: center; border: 1px solid rgba(151,255,213,.13); border-radius: 10px; background: rgba(1,12,8,.56); overflow: hidden; }
.input-unit:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(70,231,165,.09); }
.input-unit input { border: 0; background: transparent; box-shadow: none; }
.input-unit b { padding: 0 12px; color: var(--green); font-size: 13px; }
.section-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 10px; letter-spacing: .15em; font-weight: 850; }
.section-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sync-note { margin: -4px 0 0; padding: 12px 14px; border-left: 2px solid var(--yellow); background: rgba(242,195,91,.05); font-size: 12px; }
.sync-note b { color: #f4d991; }
.live-box { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(0,0,0,.13); }
.live-box p { margin: 3px 0 0; font-size: 12px; }
.live-box.locked { opacity: .78; }
.live-confirm { grid-column: 1/-1; }
.switch { display: inline-block; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.switch span { position: relative; display: block; width: 48px; height: 26px; border: 1px solid var(--line); border-radius: 999px; background: #17241f; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; background: #74887f; transition: .2s; }
.switch input:checked + span { background: rgba(255,70,70,.28); border-color: rgba(255,114,114,.65); }
.switch input:checked + span::after { transform: translateX(22px); background: var(--red); }
.side-stack { display: grid; align-content: start; gap: 12px; }
.account-list { display: grid; gap: 0; margin: 0 0 16px; }
.account-list div { display: flex; justify-content: space-between; gap: 15px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.account-list dt { color: var(--muted); font-size: 12px; }
.account-list dd { margin: 0; font-size: 12px; font-weight: 750; text-align: right; }
details { margin-top: 14px; border-top: 1px solid var(--line); }
summary { padding-top: 14px; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 750; }
.stack { display: grid; gap: 13px; }
.credential-form { margin-top: 14px; }
.strategy-route { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin: 18px 0; }
.strategy-route span { padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0,0,0,.14); color: #cfe7dd; font-size: 10px; font-weight: 750; }
.strategy-route i { color: var(--green); font-style: normal; }
.strategy-card ul { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.strategy-card li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 12px; }
.strategy-card li span { color: var(--muted); }
.positions-panel, .signals-panel, .audit-panel { margin-top: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted); text-align: left; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
td { max-width: 340px; padding: 13px 12px; border-bottom: 1px solid rgba(151,255,213,.07); vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-label { min-height: 25px; padding: 0 9px; }
.status-label.executed { color: var(--green); background: rgba(70,231,165,.07); }
.status-label.failed { color: #ffaaaa; background: rgba(255,114,114,.08); border-color: rgba(255,114,114,.2); }
.side.buy, .side.long { color: var(--green); }
.side.sell, .side.short { color: #ff9e9e; border-color: rgba(255,114,114,.22); }
.error-text { color: #ffabab; }
.mono { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; }
.mini-stats { display: flex; gap: 8px; }
.mini-stats span { padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 10px; }
.empty-state { display: grid; min-height: 160px; place-items: center; align-content: center; text-align: center; }
.empty-state > div { margin-bottom: 8px; color: var(--green); font-size: 28px; }
.empty-state p { margin: 5px 0 0; }
.empty-state.compact { min-height: 100px; }
.audit-list { display: grid; gap: 0; }
.audit-list div { display: grid; grid-template-columns: 160px 210px 1fr; gap: 15px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 11px; }
.audit-list time, .audit-list span { color: var(--muted); }
footer { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.login-body { display: grid; place-items: center; }
.login-shell { position: relative; width: min(430px, calc(100% - 32px)); padding: 50px 0; }
.login-card { padding: 36px; border: 1px solid var(--line-strong); border-radius: 22px; background: linear-gradient(145deg, rgba(15,39,30,.95), rgba(5,18,13,.95)); box-shadow: 0 35px 100px rgba(0,0,0,.5); text-align: center; }
.login-card .brand-mark { margin: 0 auto 22px; }
.login-card h1 { margin-bottom: 13px; font-size: 37px; }
.login-card .lead { margin-bottom: 26px; }
.login-card label { text-align: left; }
.login-foot { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 22px 0 0; font-size: 11px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(70,231,165,.8); }

@media (max-width: 980px) {
  .status-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 660px) {
  .topbar { position: relative; padding: 14px 16px; }
  .topbar .brand .eyebrow { display: none; }
  .topbar h1 { font-size: 18px; }
  .button.quiet { padding: 0 10px; }
  .mode-pill { font-size: 9px; padding: 0 8px; }
  .page { width: min(100% - 20px, 1280px); padding-top: 12px; }
  .status-grid, .field-grid, .compact-fields, .side-stack { grid-template-columns: 1fr; }
  .metric-card { min-height: 105px; }
  .panel { padding: 17px; border-radius: 13px; }
  .audit-list div { grid-template-columns: 1fr; gap: 4px; }
  .login-card { padding: 28px 22px; }
  .top-actions { gap: 7px; }
}
