* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; background: #0b0e11; color: #eaecef; font-family: Arial, Helvetica, sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; border: 0; }
button:disabled { cursor: not-allowed; opacity: .5; }
.topbar { position: sticky; top: 0; z-index: 10; height: 56px; display: flex; align-items: center; gap: 24px; padding: 0 16px; border-bottom: 1px solid #242a32; background: rgba(11,14,17,.96); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 260px; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 4px; background: #f0b90b; color: #111; font-weight: 900; }
.brand em { border: 1px solid #3a414d; border-radius: 4px; padding: 4px 7px; color: #b7bdc6; font-size: 12px; font-style: normal; }
nav { display: flex; gap: 20px; color: #b7bdc6; font-size: 14px; }
nav a:first-child { color: #fff; }
.search { border: 1px solid #2b3139; border-radius: 4px; background: #151a21; color: #eaecef; outline: 0; }
.panel-head button { border-radius: 4px; background: #f0b90b; color: #111; padding: 9px 14px; font-weight: 700; }
.auth-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.auth-actions a { border: 1px solid #f0b90b; border-radius: 4px; background: #f0b90b; color: #111; padding: 9px 14px; text-decoration: none; font-weight: 800; }
.auth-actions a:hover { background: #ffd24a; border-color: #ffd24a; }
.auth-actions a.primary { border-color: #f0b90b; background: #f0b90b; color: #111; }
.auth-user { align-items: center; color: #b7bdc6; }
.auth-user span { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-strip { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; border-bottom: 1px solid #242a32; background: #11161d; }
.register-form { display: flex; align-items: center; gap: 8px; min-width: 0; }
.register-form strong { flex: 0 0 auto; font-size: 14px; }
.register-form input { width: 160px; min-width: 0; border: 1px solid #2b3139; border-radius: 4px; background: #151a21; color: #eaecef; outline: 0; padding: 9px 10px; }
.register-form button { border-radius: 4px; background: #0ecb81; color: #06140f; padding: 9px 14px; font-weight: 800; }
.auth-strip span { color: #848e9c; font-size: 12px; }
.auth-message { padding: 9px 16px; border-bottom: 1px solid #242a32; font-size: 13px; }
.auth-message.error { color: #f6465d; background: rgba(246, 70, 93, .08); }
.auth-message.success { color: #0ecb81; background: rgba(14, 203, 129, .08); }
.auth-page { min-height: 100vh; background: #0b0e11; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.auth-card { width: min(440px, calc(100vw - 32px)); border: 1px solid #242a32; border-radius: 8px; background: #0f141b; padding: 24px; box-shadow: 0 22px 80px rgba(0,0,0,.34); }
.admin-like-card { margin-top: -4vh; }
.auth-back, .auth-footer a { color: #f0b90b; text-decoration: none; font-weight: 700; }
.auth-brand { min-width: auto; margin-bottom: 22px; }
.auth-card h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.15; }
.auth-card p { margin: 0; color: #848e9c; line-height: 1.45; }
.auth-form { display: grid; gap: 14px; margin-top: 18px; }
.auth-form label { display: grid; gap: 7px; color: #848e9c; font-size: 13px; }
.auth-form input { width: 100%; border: 1px solid #2b3139; border-radius: 6px; background: #151a21; color: #eaecef; outline: 0; padding: 12px; }
.auth-form input:focus { border-color: #f0b90b; box-shadow: 0 0 0 2px rgba(240,185,11,.12); }
.auth-form button { border-radius: 6px; background: #f0b90b; color: #111; padding: 13px; font-weight: 800; }
.auth-form button:hover { background: #ffd24a; }
.auth-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; color: #848e9c; font-size: 13px; }
.auth-footer span { text-align: right; }
.cabinet-page { min-height: 100vh; background: #0b0e11; }
.cabinet-shell { padding: 18px; display: grid; gap: 18px; }
.cabinet-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid #242a32; border-radius: 8px; background: #0f141b; padding: 18px; }
.cabinet-hero h1 { margin: 6px 0; font-size: 28px; }
.cabinet-hero p { margin: 0; color: #848e9c; }
.cabinet-status { text-align: right; }
.cabinet-status b, .cabinet-status span { display: block; }
.cabinet-status span { margin-top: 6px; color: #848e9c; font-size: 13px; }
.cabinet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.cabinet-panel { border: 1px solid #242a32; border-radius: 8px; background: #0f141b; overflow: hidden; }
.balance-row { display: grid; grid-template-columns: 90px 1fr 90px; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid #242a32; }
.balance-row span, .balance-row em { color: #848e9c; font-style: normal; }
.balance-row strong { font-size: 22px; }
.security-list { padding: 10px 16px 16px; }
.security-list p { display: flex; align-items: center; justify-content: space-between; margin: 0; padding: 12px 0; border-bottom: 1px solid #242a32; }
.security-list p:last-child { border-bottom: 0; }
.ticker { display: flex; align-items: center; gap: 32px; min-height: 64px; padding: 10px 16px; border-bottom: 1px solid #242a32; background: #11161d; overflow-x: auto; }
.ticker div { flex: 0 0 auto; }
.ticker strong { display: block; font-size: 22px; }
.ticker span { display: block; color: #848e9c; font-size: 12px; }
.ticker b { font-size: 14px; }
.terminal { display: grid; grid-template-columns: 360px minmax(0, 1fr) 360px; gap: 1px; height: calc(100vh - 120px); min-height: 760px; overflow: hidden; background: #242a32; }
.panel { background: #0f141b; min-width: 0; }
.panel-head { height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px; border-bottom: 1px solid #242a32; }
.panel-head h2 { margin: 0; font-size: 14px; }
.panel-head button { background: #151a21; color: #b7bdc6; padding: 6px 8px; font-size: 12px; }
.compact { padding: 0; margin-top: 18px; border-top: 1px solid #242a32; }
.search { width: calc(100% - 24px); margin: 12px; padding: 9px 10px; }
.markets { display: flex; min-height: 0; flex-direction: column; overflow: hidden; }
#marketRows { min-height: 0; overflow-y: auto; }
.market-head, .market-row { display: grid; grid-template-columns: minmax(0, 1fr) 86px 62px; gap: 8px; align-items: center; padding: 8px 12px; }
.market-head { color: #848e9c; font-size: 12px; border-bottom: 1px solid #242a32; }
.market-row { position: relative; width: 100%; background: transparent; color: #eaecef; text-align: left; border-bottom: 1px solid #151a21; }
.market-row:hover, .market-row.active { background: #151a21; }
.market-row b, .market-row small { display: block; }
.market-row small, .market-row i { color: #848e9c; font-size: 11px; font-style: normal; }
.market-row i { grid-column: 1 / -1; margin-top: -5px; }
.up { color: #0ecb81 !important; }
.down { color: #f6465d !important; }
.warn { color: #f0b90b !important; }
.muted { color: #848e9c; }
.center-grid { display: grid; grid-template-rows: minmax(0, 1fr) 300px 168px; min-width: 0; min-height: 0; gap: 1px; overflow: hidden; background: #242a32; }
.right-rail { display: grid; grid-template-rows: minmax(280px, .92fr) minmax(260px, .72fr) auto; min-width: 0; min-height: 0; gap: 1px; overflow: hidden; background: #242a32; }
.chart { min-height: 0; overflow: hidden; }
.chart-head { height: 74px; align-items: stretch; flex-wrap: wrap; padding: 0; }
.chart-tabs, .tabs, .view-tabs, .spot-tabs, .margin-tabs { display: flex; align-items: center; gap: 6px; }
.chart-tabs { width: 100%; height: 36px; padding: 0 14px; border-bottom: 1px solid #242a32; }
.tabs { padding-left: 14px; }
.view-tabs { margin-left: auto; padding-right: 14px; }
.chart-tabs button, .tabs button, .view-tabs button, .spot-tabs button, .margin-tabs button { position: relative; border-radius: 3px; background: transparent; color: #848e9c; padding: 6px 8px; font-weight: 700; }
.chart-tabs button.selected, .tabs button.selected, .view-tabs button.selected, .spot-tabs button.selected, .margin-tabs button.selected { color: #fff; }
.chart-tabs button.selected:after, .spot-tabs button.selected:after, .margin-tabs button.selected:after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: #f0b90b; }
.tabs button.selected { color: #f0b90b; background: #1e2329; }
.view-tabs button.selected { color: #fff; background: #151a21; }
.chart-area { position: relative; margin: 0; height: calc(100% - 74px); min-height: 420px; overflow: hidden; border: 0; border-radius: 0; background-color: #141922; cursor: grab; }
.chart-area.dragging { cursor: grabbing; }
#chartCanvas { display: block; width: 100%; height: 100%; }
.ohlc { position: absolute; z-index: 2; top: 12px; left: 12px; right: 12px; display: flex; flex-wrap: wrap; gap: 8px 14px; color: #8b96a8; font-size: 12px; pointer-events: none; }
.ohlc .break { flex-basis: 100%; height: 0; }
.ma-yellow { color: #f0b90b; }
.ma-pink { color: #e044b5; }
.ma-purple { color: #9b7bff; }
.chart-info { position: absolute; inset: 46px 16px 16px; display: none; overflow: auto; border: 1px solid #2b3139; border-radius: 6px; background: rgba(15, 20, 27, .94); padding: 16px; color: #b7bdc6; }
.chart-info.active { display: block; }
.book-head, .book-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 6px 10px; font-size: 12px; text-align: right; }
.book-head { color: #848e9c; }
.book-head span:first-child, .book-row span:first-child { text-align: left; }
.book-row { position: relative; overflow: hidden; }
.book-row:before { content: ""; position: absolute; inset: 0 0 0 auto; width: var(--w); opacity: .4; }
.book-row.ask:before { background: #3a1f2a; }
.book-row.bid:before { background: #11362d; }
.book-row span { position: relative; }
.book-row.ask span:first-child { color: #f6465d; }
.book-row.bid span:first-child { color: #0ecb81; }
.mid-price { display: flex; align-items: center; justify-content: space-between; padding: 11px 10px; border-block: 1px solid #242a32; }
.mid-price strong { color: #0ecb81; font-size: 24px; }
.mid-price span { color: #848e9c; font-size: 12px; }
.orders { min-width: 0; overflow: hidden; }
.bottom { min-width: 0; overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; font-size: 13px; }
th, td { padding: 12px; border-bottom: 1px solid #242a32; text-align: left; }
th { color: #848e9c; font-size: 12px; font-weight: 500; }
#tradeRows { padding: 8px 10px; }
.trade-row { display: grid; grid-template-columns: 70px 1fr 1fr 50px; gap: 8px; padding: 6px 0; font-size: 12px; }
.trade-row span:first-child { color: #848e9c; }
.trade-row span:last-child { text-align: right; }
.spot-panel { min-height: 240px; overflow: hidden; }
.margin-tabs { padding: 10px 14px 0; }
.spot-tabs { padding: 10px 14px; border-bottom: 1px solid #242a32; }
.spot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 14px; }
.order-card label { display: block; margin-top: 10px; color: #848e9c; font-size: 12px; }
.order-card label div { display: flex; align-items: center; margin-top: 6px; border: 1px solid #2b3139; border-radius: 6px; background: #151a21; }
.order-card input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: #eaecef; padding: 12px; }
.order-card input:disabled { color: #6b7280; }
.order-card label span { padding: 0 10px; color: #b7bdc6; font-size: 12px; }
.order-card p { display: flex; align-items: center; justify-content: space-between; color: #848e9c; font-size: 13px; }
.range-line { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 18px 4px 14px; border-top: 1px solid #3a414d; }
.range-line span { width: 10px; height: 10px; margin-top: -6px; border: 1px solid #848e9c; background: #141922; transform: rotate(45deg); }
.percents { margin-top: 10px; display: grid; grid-template-columns: repeat(4, 1fr); }
.percents button, .wallet-actions button, .wallet-actions a { border: 1px solid #2b3139; background: #151a21; color: #b7bdc6; padding: 9px 0; border-radius: 4px; text-align: center; text-decoration: none; }
.submit { display: block; width: calc(100% - 24px); margin-top: 14px; border-radius: 4px; padding: 13px; font-weight: 800; }
.submit.buy { background: #0ecb81; color: #06140f; }
.submit.sell { background: #f6465d; color: #fff; }
.trade-notice { min-height: 0; padding: 0 12px; color: #848e9c; font-size: 12px; transition: min-height .15s, padding .15s; }
.trade-notice:not(:empty) { min-height: 36px; padding: 10px 12px; border-bottom: 1px solid #242a32; }
.trade-notice.success { color: #0ecb81; background: rgba(14, 203, 129, .06); }
.trade-notice.error { color: #f6465d; background: rgba(246, 70, 93, .06); }
.cancel-order { padding: 5px 8px; border: 1px solid #3a4350; color: #eaecef; background: #171d26; font-size: 11px; }
.cancel-order:hover { border-color: #f0b90b; color: #f0b90b; }
.asset { margin-top: 10px; border: 1px solid #242a32; border-radius: 4px; background: #151a21; padding: 10px; }
.asset b, .asset span { display: block; }
.asset span { margin-top: 6px; color: #848e9c; font-size: 12px; }
.wallet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.cabinet-panel > .wallet-actions { padding: 0 16px 16px; }
.deposit-section { scroll-margin-top: 74px; }
.deposit-locked { padding: 24px; color: #b7bdc6; }
.deposit-locked strong { display: block; margin-bottom: 8px; color: #f0b90b; font-size: 18px; }
.deposit-locked p { margin: 0; max-width: 760px; color: #848e9c; line-height: 1.55; }
.deposit-warning { display: flex; align-items: flex-start; gap: 16px; padding: 14px 16px; border-bottom: 1px solid #342f1e; background: rgba(240,185,11,.07); }
.deposit-warning strong { flex: 0 0 auto; color: #f0b90b; }
.deposit-warning span { color: #b7bdc6; line-height: 1.45; }
.deposit-networks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: #242a32; }
.deposit-network { min-width: 0; background: #0f141b; padding: 16px; }
.network-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.network-title strong, .network-title span { display: block; }
.network-title strong { font-size: 16px; }
.network-title span, .deposit-network label, .deposit-network small { margin-top: 5px; color: #848e9c; font-size: 12px; }
.network-title em { flex: 0 0 auto; font-size: 11px; font-style: normal; }
.deposit-network label { display: block; margin-top: 18px; }
.address-copy { display: flex; align-items: stretch; gap: 8px; margin: 7px 0 10px; }
.address-copy code { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid #2b3139; border-radius: 5px; background: #151a21; color: #eaecef; padding: 11px; }
.address-copy button { border-radius: 5px; background: #f0b90b; color: #111; padding: 0 12px; font-weight: 800; }
.sync-status { min-height: 42px; padding: 12px 16px; border-top: 1px solid #242a32; color: #848e9c; font-size: 13px; }
.mono { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: Consolas, monospace; }
.data-table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 12px; }
.data-table th, .data-table td { padding: 9px 10px; border-bottom: 1px solid #2b3139; }
.data-table th { color: #8b96a8; }
@media (max-width: 1180px) {
  .terminal { grid-template-columns: 1fr; }
  .center-grid { grid-template-rows: auto; }
  .right-rail { min-height: 640px; }
}
@media (max-width: 720px) {
  .topbar { height: auto; flex-wrap: wrap; padding-block: 10px; }
  nav { order: 3; width: 100%; overflow-x: auto; }
  .auth-actions { width: 100%; margin-left: 0; justify-content: flex-end; }
  .auth-strip, .register-form { align-items: stretch; flex-direction: column; }
  .register-form input, .register-form button { width: 100%; }
  .cabinet-hero { align-items: flex-start; flex-direction: column; }
  .cabinet-status { text-align: left; }
  .cabinet-grid { grid-template-columns: 1fr; }
  .balance-row { grid-template-columns: 1fr; }
  .deposit-networks { grid-template-columns: 1fr; }
  .deposit-warning { flex-direction: column; }
}
