/* Pro dark UI inspired by XCharts.live */
:root {
  --bg: #070b10;
  --panel: #0b1118;
  --panel2: #0d1620;
  --panel3: #0a0f15;
  --border: rgba(255, 255, 255, .10);
  --text: #e6edf3;
  --muted: rgba(230, 237, 243, .65);
  --green: #2bff9b;
  --red: #ff4d4d;
  --btn: #111b26;
  --btn2: #0f1923;
  --shadow: 0 16px 60px rgba(0, 0, 0, .60);
  --radius: 14px;
  --radius2: 18px;
  --sbw: 56px;
  --top: 60px;
}

[data-theme="light"] {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel2: #f3f5f7;
  --panel3: #ffffff;
  --border: rgba(0, 0, 0, .10);
  --text: #0b1220;
  --muted: rgba(11, 18, 32, .60);
  --btn: #eef2f6;
  --btn2: #e7edf5;
  --shadow: 0 16px 60px rgba(0, 0, 0, .18);
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(43, 255, 155, .08), transparent 50%),
    radial-gradient(900px 500px at 10% 0%, rgba(56, 189, 248, .06), transparent 45%),
    var(--bg);
  color: var(--text);
}

.shell {
  height: 100%;
  display: flex;
}

/* Sidebar */
.sidebar {
  width: var(--sbw);
  background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, 0));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px;
  gap: 8px;
}

.sb-top {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.sb-sep {
  width: 100%;
  height: 1px;
  background: var(--border);
  opacity: .6;
}

.sb-grow {
  flex: 1
}

.sb-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sb-btn:hover {
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  border-color: rgba(255, 255, 255, .08);
}

.sb-btn.active {
  background: rgba(43, 255, 155, .10);
  color: var(--text);
  border-color: rgba(43, 255, 155, .25);
}

.sb-btn .material-icons {
  font-size: 22px
}

/* App */
.app {
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, 0));
  backdrop-filter: saturate(140%) blur(8px);
}

.tb-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.tb-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pair {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pair-title {
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pair-sub {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
}

.pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
}

.pill.status {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.pill.status.ok {
  border-color: rgba(43, 255, 155, .35);
  color: rgba(43, 255, 155, .95);
}

.pill.status.err {
  border-color: rgba(255, 77, 77, .45);
  color: rgba(255, 77, 77, .95);
}

.pill.price {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .25);
}

.dot.live {
  background: rgba(43, 255, 155, .95);
}

.dot.err {
  background: rgba(255, 77, 77, .95);
}

.pill.timer {
  font-size: 13px;
  gap: 6px;
}

.pill.timer .material-icons {
  font-size: 18px;
  color: var(--muted);
}

.acct {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
  color: var(--muted);
}

.acct .material-icons {
  font-size: 18px
}

.acct-text {
  font-size: 12px;
  white-space: nowrap;
}

/* Search bar button in header */
.searchbar {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
  color: var(--muted);
  cursor: pointer;
  min-width: 220px;
}

.searchbar:hover {
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  border-color: rgba(255, 255, 255, .14);
}

.searchbar .material-icons {
  font-size: 18px;
}

.searchbar-text {
  flex: 1;
  text-align: left;
}

.kbd {
  display: flex;
  gap: 6px;
  align-items: center;
}

.kbd kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .03);
}

/* Segmented controls */
.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, .02);
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
  min-width: 48px;
}

.seg-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .04);
}

.seg-btn.active {
  color: var(--text);
  background: rgba(43, 255, 155, .10);
}

.iconbtn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .02);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.iconbtn:hover {
  background: rgba(255, 255, 255, .05);
  color: var(--text);
}

.iconbtn .material-icons {
  font-size: 20px
}

/* Content */
.content {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 12px;
}

.chart {
  width: 100%;
  height: 100%;
  border-radius: var(--radius2);
  border: 1px solid var(--border);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, 0));
}

.watermark {
  position: absolute;
  left: 28px;
  bottom: 18px;
  font-size: 12px;
  letter-spacing: .25px;
  color: rgba(230, 237, 243, .45);
  user-select: none;
  pointer-events: none;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  display: block;
  z-index: 40;
}

.modal[aria-hidden="true"] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  width: min(520px, calc(100% - 24px));
  margin: 70px auto;
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-card-wide {
  width: min(760px, calc(100% - 24px));
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-weight: 700;
}

.modal-body {
  padding: 14px;
}

.search-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search {
  flex: 1;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, .15);
  color: var(--text);
  outline: none;
}

[data-theme="light"] .search {
  background: rgba(0, 0, 0, .03);
}

.search::placeholder {
  color: rgba(230, 237, 243, .45);
}

[data-theme="light"] .search::placeholder {
  color: rgba(11, 18, 32, .45);
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .02);
  color: var(--muted);
  cursor: pointer;
}

.chip .material-icons {
  font-size: 18px;
}

.chip:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .05);
}

.chip.active {
  color: var(--text);
  border-color: rgba(43, 255, 155, .30);
  background: rgba(43, 255, 155, .10);
}

.list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(420px, calc(100vh - 260px));
  overflow: auto;
  padding-right: 4px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .02);
}

.row:hover {
  background: rgba(255, 255, 255, .04);
}

.leftcol {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sym {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.starbtn {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .02);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.starbtn:hover {
  background: rgba(255, 255, 255, .05);
  color: var(--text);
}

.starbtn.on {
  border-color: rgba(43, 255, 155, .30);
  color: rgba(43, 255, 155, .95);
  background: rgba(43, 255, 155, .10);
}

.starbtn .material-icons {
  font-size: 20px
}

.openbtn,
.btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 12px;
  cursor: pointer;
}

.openbtn:hover,
.btn:hover {
  background: rgba(255, 255, 255, .06);
}

.btn.small {
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 10px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
  line-height: 1.5;
}

.ind-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.ind-name {
  font-weight: 600
}

.select {
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 10px;
}

/* Mobile */
@media (max-width: 900px) {
  .searchbar {
    display: none;
  }

  .tb-right {
    gap: 8px;
  }

  .acct-text {
    display: none;
  }
}

@media (max-width: 620px) {
  .seg[aria-label="Interval"] {
    display: none;
  }

  .sidebar {
    display: none;
  }

  .shell {
    display: block;
  }

  .content {
    padding: 10px;
  }
}

/* Status Icon Styling */
.iconbtn.status-icon {
  transition: all 0.2s;
}

.iconbtn.status-icon.ok {
  color: var(--green);
  border-color: rgba(43, 255, 155, 0.3);
  background: rgba(43, 255, 155, 0.1);
}

.iconbtn.status-icon.err {
  color: var(--red);
  border-color: rgba(255, 77, 77, 0.3);
  background: rgba(255, 77, 77, 0.1);
}

/* Spinner Animation */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.spin .material-icons {
  animation: spin 1s linear infinite;
}

/* Minimal Mode for Screenshots */
body.minimal .sidebar,
body.minimal .header,
body.minimal .shell>.sidebar,
body.minimal #btnShowFavs,
body.minimal .seg,
body.minimal #statusPill {
  display: none !important;
}

body.minimal .shell {
  flex-direction: column;
}

body.minimal #chart-container {
  width: 1832px !important;
  height: 830px !important;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 9999;
}

body.minimal .brand-overlay {
  font-size: 120px !important;
  /* Make it huge for the screenshot */
}