:root {
  --bg: #0b0b12;
  --panel: #14141f;
  --field: #0f0f18;
  --line: #24243a;
  --text: #e6e6f0;
  --muted: #8b8ba3;
  --accent: #7c6cff;
  --accent-soft: rgba(124, 108, 255, .18);
  --up: #39d145;
  --down: #ff4d6d;
  --radius: 10px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

/* Светлая тема хоста: hostContext.theme = 'light' */
:root[data-theme="light"] {
  --bg: #ffffff;
  --panel: #f5f5fa;
  --field: #ffffff;
  --line: #d8d8e4;
  --text: #16162a;
  --muted: #6a6a85;
  --accent: #5b4bff;
  --accent-soft: rgba(91, 75, 255, .14);
  --up: #1f9d3a;
  --down: #d93655;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

body { display: flex; flex-direction: column; }

h1 { font-size: 20px; margin: 0 0 8px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

/* --- экран токена --- */
.panel {
  max-width: 420px;
  margin: 48px auto;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.panel label { font-size: 13px; color: var(--muted); }

input[type="text"], input[type="password"], select {
  width: 100%;
  padding: 9px 11px;
  background: var(--field);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  outline: none;
}

input:focus, select:focus { border-color: var(--accent); }

button {
  padding: 9px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent, #fff);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

button:disabled { opacity: .6; cursor: default; }
button.ghost { background: transparent; color: var(--muted); border-color: var(--line); }

.check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.check input { margin: 0; }

.error {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 77, 109, .12);
  color: var(--down);
  font-size: 13px;
}

/* --- экран графика --- */
#app { display: flex; flex-direction: column; height: 100%; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.toolbar select { width: auto; min-width: 150px; }
.toolbar button { padding: 7px 10px; }
.search { position: relative; flex: 1; min-width: 160px; }

.suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  z-index: 10;
}

.suggest li { display: flex; gap: 8px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.suggest li:hover, .suggest li.active { background: var(--accent-soft); }
.suggest .tk { min-width: 70px; font-weight: 600; }
.suggest .nm { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .mic { color: var(--muted); font-family: ui-monospace, monospace; font-size: 11px; }

.quote {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
}

.quote .symbol { font-weight: 700; font-size: 16px; }
.quote .last { font-size: 18px; font-weight: 600; }
.change.up { color: var(--up); }
.change.down { color: var(--down); }

#chart { flex: 1; min-height: 240px; }

.status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

@media (max-width: 520px) {
  .toolbar { flex-wrap: wrap; }
  .search { flex-basis: 100%; }
  .panel { margin: 16px; }
}
