:root {
  color-scheme: dark;
  --bg: #0b0e13;
  --panel: #12171f;
  --border: #262d38;
  --text: #f3f5f8;
  --muted: #9ba6b6;
  --faint: #788598;
  --accent: #d8fa69;
  --up: #46d9a4;
  --down: #ff7e86;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-width: 320px; }
button, input, select { font: inherit; }
button, a, input, select, canvas { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button, a { color: inherit; }
button[hidden], [hidden] { display: none !important; }
h1, h2, p { margin: 0; }
svg { width: 1.16em; height: 1.16em; display: block; flex: none; }
.header { height: 68px; border-bottom: 1px solid var(--border); background: #0e1218; }
.header-inner, .workspace { width: min(1520px, 100% - 72px); margin: 0 auto; }
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.brand, .header-actions, .connection { display: flex; align-items: center; }
.brand { gap: 12px; text-decoration: none; font-size: 1.13rem; font-weight: 700; }
.brand small { display: inline-block; margin-left: 5px; padding: 3px 6px; border: 1px solid #394336; border-radius: 5px; color: var(--accent); font-size: .65rem; letter-spacing: .08em; vertical-align: 2px; }
.header-actions { gap: 15px; }
.connection { gap: 8px; min-height: 33px; padding: 0 12px; border: 1px solid var(--border); border-radius: 20px; color: var(--muted); font-size: .875rem; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #a2adbd; }
.connection[data-state="online"] .status-dot { background: var(--up); box-shadow: 0 0 8px #46d9a45a; }
.connection[data-state="demo"] .status-dot, .connection[data-state="stale"] .status-dot { background: #f3b96b; }
.connection[data-state="error"] .status-dot { background: var(--down); }
.workspace { padding-top: 32px; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 23px; }
h1 { font-size: clamp(1.7rem, 3vw, 2.2rem); letter-spacing: -.035em; line-height: 1.2; }
.button { border-radius: 8px; padding: 0 13px; height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; font-size: .875rem; font-weight: 650; white-space: nowrap; }
.accent { background: var(--accent); color: #1b260c; }
.accent:hover { background: #ebffa0; }
.button { text-decoration: none; }
.secondary { background: #1a202a; border-color: #303746; color: #dbe0e8; }
.secondary:hover, .icon-button:hover { border-color: #4a5667; background: #222b37; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: #181e27; color: #c6ced8; }
.dashboard { display: grid; grid-template-columns: minmax(0,1fr) minmax(310px, 342px); gap: 19px; align-items: start; }
.panel { min-width: 0; border: 1px solid var(--border); border-radius: 13px; background: var(--panel); }
.notice { padding: 10px 14px; margin-bottom: 13px; background: #2a2218; border: 1px solid #4b3721; color: #f7ce8d; border-radius: 8px; font-size: .875rem; }
.market-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 19px 20px 16px; }
.market-identity { display: flex; align-items: center; min-width: 0; gap: 10px; }
.market-identity h2 { font-size: 1.18rem; letter-spacing: -.03em; white-space: nowrap; }
.market-detail { font-size: .81rem; color: var(--muted); margin-top: 4px; }
.coin { width: 32px; height: 32px; flex: none; display: inline-grid; place-items: center; border-radius: 50%; color: var(--coin-color, #d2def6); background: var(--coin-bg, #26354b); font-size: 1rem; font-weight: 750; }
.coin-large { width: 43px; height: 43px; font-size: 1.4rem; }
.coin[data-coin="BTC"] { --coin-color: #16130f; --coin-bg: #f8ae56; }
.coin[data-coin="ETH"] { --coin-color: #dce3ff; --coin-bg: #3a436b; }
.coin[data-coin="SOL"] { --coin-color: #c2f7e6; --coin-bg: #205d53; }
.coin[data-coin="BNB"] { --coin-color: #ffe392; --coin-bg: #54411b; }
.coin[data-coin="XRP"] { --coin-color: #e8edf5; --coin-bg: #384354; }
.coin[data-coin="DOGE"] { --coin-color: #ffe5a5; --coin-bg: #544632; }
.tag { border: 1px solid #303947; color: #a5b0c1; border-radius: 5px; font-size: .72rem; padding: 4px 7px; margin-left: 4px; white-space: nowrap; }
.ticker-grid { display: grid; grid-template-columns: minmax(225px, 1.7fr) repeat(3, minmax(0,1fr)); gap: 14px; align-items: center; padding: 0 20px 19px; }
.quote-label, .metric span { color: var(--muted); font-size: .875rem; }
.quote-label span { color: var(--faint); font-size: .75rem; padding-left: 4px; }
.price-line { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 4px; }
.price-line strong { font-size: clamp(1.7rem, 3.2vw, 2.7rem); font-weight: 720; line-height: 1.12; letter-spacing: -.07em; font-variant-numeric: tabular-nums; }
.change-pill { padding: 4px 7px; border-radius: 5px; background: #242d37; color: var(--muted); font-size: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.change-pill.positive { background: #1a352d; }
.change-pill.negative { background: #3b262c; }
.positive { color: var(--up); }
.negative { color: var(--down); }
.metric { display: grid; gap: 6px; align-content: center; border-left: 1px solid var(--border); padding-left: 12px; }
.metric strong { font-size: .94rem; font-variant-numeric: tabular-nums; }
.chart-toolbar, .chart-footer { display: flex; gap: 12px; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding: 9px 14px; }
.intervals, .ranges, .chart-actions, .watch-filters { display: flex; gap: 3px; align-items: center; }
.toolbar-button { background: transparent; border: 1px solid transparent; color: var(--muted); border-radius: 6px; padding: 6px 8px; white-space: nowrap; font-size: .875rem; font-weight: 560; }
.toolbar-button:hover { color: var(--text); background: #1e2631; }
.toolbar-button.selected, .view-option.selected { color: var(--accent); border-color: #46513a; background: #242f22; }
.chart-actions .icon-button { width: 31px; height: 30px; font-size: .9rem; }
.chart-actions { gap: 5px; }
.axis-zoom { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px 11px; border-top: 1px solid var(--border); background: #12171f; }
.axis-zoom .toolbar-button { font-size: .79rem; padding: 5px 7px; }
.chart-card-heading .card-alert { height: 29px; padding-inline: 8px; font-size: .79rem; }
.plot-wrap { position: relative; background: #10151d; }
canvas { display: block; width: 100%; height: clamp(355px, 49vh, 520px); cursor: crosshair; touch-action: pan-y; }
.ohlc { position: absolute; pointer-events: none; top: 11px; left: 16px; right: 72px; display: flex; gap: 10px; overflow: hidden; white-space: nowrap; color: var(--muted); font: .73rem ui-monospace, SFMono-Regular, Consolas, monospace; }
.ohlc b { color: #d2d9e3; font-weight: 550; }
.chart-message { position: absolute; display: grid; place-content: center; text-align: center; pointer-events: none; inset: 32px 66px 34px 12px; color: var(--muted); padding: 21px; }
.chart-footer { padding: 7px 14px; min-height: 47px; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.chart-footer .toolbar-button { font-size: .78rem; }
.chart-status { min-width: 0; text-align: center; }
#clock { white-space: nowrap; }
.watch-heading { padding: 15px 14px 8px; display: flex; align-items: center; justify-content: space-between; }
.watch-heading h2 { font-size: 1.05rem; }
.watch-heading .icon-button { height: 31px; width: 31px; }
.watch-filters { padding: 0 12px 13px; gap: 5px; }
.watch-filters .toolbar-button { padding: 5px 9px; font-size: .81rem; }
.watch-columns { display: grid; grid-template-columns: minmax(0,1fr) 77px 65px; gap: 6px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 10px 13px; color: var(--muted); font-size: .78rem; }
.watch-columns :not(:first-child) { text-align: right; }
#watch-items { list-style: none; padding: 0; margin: 0; max-height: 500px; overflow-y: auto; }
.watch-row { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) 77px 65px; gap: 6px; align-items: center; padding: 10px 13px; width: 100%; min-height: 62px; border: 0; border-bottom: 1px solid #222936; background: transparent; text-align: left; }
.watch-row:hover { background: #1d2531; }
.watch-row.selected { background: #202a26; box-shadow: inset 3px 0 var(--accent); }
.watch-row.selected .watch-name strong { color: #eef9cf; }
.watch-pair { min-width: 0; display: flex; align-items: center; gap: 8px; }
.watch-name { min-width: 0; }
.watch-name strong, .watch-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-name strong { font-size: .85rem; letter-spacing: -.02em; }
.watch-name small { color: var(--muted); font-size: .73rem; margin-top: 4px; }
.watch-price, .watch-change { text-align: right; font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.watch-price { font-weight: 650; }
.watch-footer, .workspace-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }
.watch-footer { min-height: 48px; padding: 0 14px; }
.text-button { border: 0; background: transparent; color: #d0dcf0; padding: 6px 0; font-size: .81rem; }
.text-button:hover { color: var(--accent); }
.workspace-footer { padding: 16px 0 18px; }
.workspace-navigation { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--border); margin: -6px 0 18px; }
.workspace-tabs { display: flex; gap: 22px; }
.workspace-tabs a { padding: 8px 2px 10px; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: .9rem; }
.workspace-tabs a[aria-current] { color: var(--accent); border-color: var(--accent); }
.workspace-tabs a:hover { color: var(--text); }
.refresh-setting { display: flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--muted); font-size: .84rem; }
.refresh-setting select { appearance: none; padding: 4px 22px 4px 7px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: #161d27; font-size: inherit; background-image: linear-gradient(45deg, transparent 50%, #a5afbd 50%), linear-gradient(135deg, #a5afbd 50%, transparent 50%); background-position: calc(100% - 12px) center, calc(100% - 8px) center; background-size: 4px 4px; background-repeat: no-repeat; }
.board-heading { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.board-status:empty { display: none; }
.board-status { margin-bottom: 10px; }
.board-heading h2, .admin-heading h2 { font-size: 1.15rem; }
.board-cards { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 14px; align-items: start; }
.chart-card { grid-column: span 3; overflow: hidden; }
.chart-card[data-size="small"] { grid-column: span 2; }
.chart-card[data-size="large"] { grid-column: 1 / -1; }
.chart-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 7px; }
.chart-card-heading h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.chart-card-heading .form-actions { flex-shrink: 0; }
.card-remove:hover { color: var(--down); }
.chart-card-price { display: flex; align-items: center; gap: 8px; padding: 0 14px 11px; }
.chart-card-price strong { font-size: 1.45rem; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.chart-card .card-canvas { height: 310px; }
.chart-card[data-size="small"] .card-canvas { height: 226px; }
.chart-card[data-size="large"] .card-canvas { height: min(50vh,460px); min-height: 335px; }
.card-footer { display: flex; flex-wrap: wrap; min-height: 38px; align-items: center; justify-content: space-between; padding: 8px 12px; gap: 5px 10px; color: var(--muted); font-size: .76rem; }
.card-status { color: #e4c781; }
.admin-link { margin-top: 14px; }
.admin-workspace { max-width: 1100px; padding-bottom: 28px; }
.admin-login { width: min(440px,100%); margin: clamp(14px,7vh,76px) auto 0; padding: 24px; }
.admin-heading { margin-bottom: 17px; }
.admin-heading p { color: var(--muted); font-size: .9rem; margin-top: 7px; line-height: 1.5; }
.field-help { color: var(--muted); font-size: .82rem; line-height: 1.45; margin-bottom: 10px; }
.admin-grid, .admin-settings { display: grid; gap: 14px; }
.admin-grid { grid-template-columns: minmax(0,1fr); }
.admin-settings { grid-template-columns: repeat(2,minmax(0,1fr)); grid-auto-rows: 1fr; }
.admin-card { padding: 18px; }
.position-fields { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.form-actions, .toggle-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toggle-row { margin: 7px 0 12px; color: var(--muted); font-size: .86rem; gap: 14px; }
.toggle-row input { accent-color: var(--accent); }
.form-status { color: var(--muted); min-height: 1.15em; margin-top: 9px; font-size: .86rem; overflow-wrap: anywhere; }
.form-status.negative { color: var(--down); }
.empty { color: var(--muted); font-size: .87rem; padding: 16px; }
dialog { width: min(510px, calc(100% - 24px)); max-height: calc(100dvh - 30px); padding: 20px; color: var(--text); background: #171d27; border: 1px solid #394355; border-radius: 14px; overflow-y: auto; box-shadow: 0 20px 80px #000b; }
dialog::backdrop { background: #060910bb; }
.dialog-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.dialog-heading h2 { font-size: 1.22rem; }
.dialog-heading p { margin-top: 7px; color: var(--muted); font-size: .875rem; }
.dialog-fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.field { display: grid; gap: 5px; color: var(--muted); margin-bottom: 10px; font-size: .875rem; }
.field input, .field select { min-width: 0; width: 100%; height: 41px; padding: 0 10px; border: 1px solid #394355; border-radius: 7px; background: #10151d; color: var(--text); font-size: .94rem; }
.field select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, #a5afbd 50%), linear-gradient(135deg,#a5afbd 50%,transparent 50%); background-position: calc(100% - 15px) center, calc(100% - 10px) center; background-size: 5px 5px; background-repeat: no-repeat; }
.result-list { margin-top: 12px; border-top: 1px solid var(--border); max-height: 320px; overflow: auto; }
.result-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 1px; border-bottom: 1px solid var(--border); }
.result-row small { color: var(--muted); display: block; margin-top: 4px; }
.result-row .button { height: 32px; }
#toast { position: fixed; z-index: 10; bottom: 18px; right: 18px; max-width: min(420px, 100% - 36px); background: #243026; border: 1px solid #506643; border-radius: 9px; padding: 12px 15px; box-shadow: 0 8px 30px #0008; }
@media (min-width: 1600px) { .dashboard { grid-template-columns: minmax(0,1fr) 370px; } }
@media (max-width: 1050px) {
  .header-inner, .workspace { width: calc(100% - 40px); }
  .dashboard { grid-template-columns: minmax(0,1fr) 304px; gap: 13px; }
  .ticker-grid { grid-template-columns: minmax(0,1fr) repeat(3,minmax(0,1fr)); }
  .ticker-grid .headline { grid-column: 1 / -1; }
  .metric:nth-child(2) { padding-left: 0; border: 0; }
  .ticker-grid .metric:last-child { grid-column: span 2; }
}
@media (max-width: 820px) {
  .dashboard { grid-template-columns: minmax(0,1fr); }
  .ticker-grid { grid-template-columns: minmax(210px,1.65fr) repeat(3,minmax(0,1fr)); }
  .ticker-grid .headline, .ticker-grid .metric:last-child { grid-column: auto; }
  .metric:nth-child(2) { padding-left: 12px; border-left: 1px solid var(--border); }
  #watch-items { max-height: none; }
  .chart-card[data-size="small"] { grid-column: span 3; }
}
@media (max-width: 580px) {
  .header { height: 58px; }
  .header-inner, .workspace { width: calc(100% - 24px); }
  .workspace { padding-top: 21px; }
  .page-title { align-items: flex-start; margin-bottom: 15px; }
  .brand img { width: 33px; height: 33px; }
  .header-actions { gap: 8px; }
  .header-actions .connection { padding: 0 7px; font-size: .76rem; gap: 5px; }
  .market-header { padding: 12px 11px; gap: 8px; }
  .tag { display: none; }
  .market-identity { gap: 8px; }
  .market-identity h2 { font-size: 1.02rem; }
  .coin-large { width: 36px; height: 36px; }
  .ticker-grid { grid-template-columns: repeat(3,minmax(0,1fr)); padding: 0 11px 12px; gap: 9px; }
  .ticker-grid .headline { grid-column: 1 / -1; }
  .metric { padding-left: 8px; }
  .metric:nth-child(2) { padding-left: 0; border: 0; }
  .metric strong { font-size: .85rem; }
  .chart-toolbar, .chart-footer { padding-left: 7px; padding-right: 7px; gap: 5px; }
  .intervals { overflow-x: auto; min-width: 0; scrollbar-width: thin; }
  .toolbar-button { padding-inline: 5px; }
  .chart-actions { flex: none; }
  .chart-footer .toolbar-button, #clock { font-size: .72rem; }
  .chart-footer { flex-wrap: wrap; }
  .chart-status:not(:empty) { order: 3; flex-basis: 100%; text-align: left; padding: 1px 4px 3px; }
  .ohlc { flex-wrap: wrap; row-gap: 4px; }
  canvas { height: 360px; }
  .board-cards, .admin-settings { grid-template-columns: minmax(0,1fr); }
  .chart-card, .chart-card[data-size="small"] { grid-column: 1 / -1; }
  .position-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 360px) {
  .header-actions .connection { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color 120ms, color 120ms; }
}
