:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #657084;
  --line: #d9e0ea;
  --paper: #f6f8fb;
  --panel: #ffffff;
  --blue: #246bfe;
  --green: #087f5b;
  --red: #c92a2a;
  --amber: #b7791f;
  --cyan: #0b7285;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.language-toggle {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.lang-option {
  width: auto;
  min-width: 54px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.lang-option.active {
  background: var(--blue);
  color: #ffffff;
}

.market-clock {
  display: grid;
  gap: 4px;
  min-width: 170px;
  text-align: right;
}

#clock {
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 800;
}

#freshness {
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
}

.control-panel,
.scanner {
  min-width: 0;
}

.control-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.field,
.control-row {
  display: grid;
  gap: 8px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

textarea {
  min-height: 190px;
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, 48px);
  gap: 10px;
}

button {
  width: 48px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
}

button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.wide-button {
  width: 100%;
  font-size: 13px;
  font-weight: 800;
}

.alert-panel,
.glossary-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.glossary-panel {
  background: #f8fbff;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-title strong {
  font-size: 14px;
}

.panel-title button {
  width: 38px;
  height: 34px;
  font-size: 16px;
}

.alert-grid {
  display: grid;
  grid-template-columns: 1fr 82px;
  gap: 8px;
}

.alert-grid input,
.alert-grid select {
  height: 38px;
  padding: 0 10px;
  font-size: 13px;
}

.alerts-list {
  display: grid;
  gap: 8px;
}

.term-list {
  display: grid;
  gap: 9px;
}

.term-list div {
  display: grid;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e6edf6;
}

.term-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.term-list strong {
  color: var(--ink);
  font-size: 12px;
}

.term-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.alert-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.alert-item.triggered {
  border-color: #ffc9c9;
  background: #fff5f5;
}

.alert-item strong,
.alert-item span,
.alert-item small {
  display: block;
}

.alert-item strong {
  font-size: 13px;
}

.alert-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.alert-item small {
  margin-top: 2px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.alert-item.triggered span {
  color: var(--red);
  font-weight: 800;
}

.alert-item.triggered small {
  color: var(--red);
}

.alert-actions {
  display: flex;
  gap: 6px;
}

.alert-actions button {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  font-size: 14px;
}

.empty-alert {
  color: var(--muted);
  font-size: 13px;
}

.provider-list {
  display: grid;
  gap: 8px;
}

.provider {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  font-size: 13px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
}

.dot.ok {
  background: var(--green);
}

.dot.off {
  background: var(--muted);
}

.dot.fail {
  background: var(--red);
}

.provider small {
  color: var(--muted);
}

.notice {
  padding: 12px;
  border-left: 3px solid var(--amber);
  background: #fffaf0;
  color: #49320d;
  font-size: 13px;
}

.notice p {
  margin: 6px 0 0;
  line-height: 1.45;
}

.scanner {
  display: grid;
  gap: 16px;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.summary-band > div {
  display: grid;
  gap: 4px;
  padding: 16px;
  background: #ffffff;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-band strong {
  overflow: hidden;
  font-size: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

table {
  width: 100%;
  min-width: 1840px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

.symbol {
  font-weight: 850;
}

.positive {
  color: var(--green);
  font-weight: 800;
}

.negative {
  color: var(--red);
  font-weight: 800;
}

.pill {
  display: inline-flex;
  min-width: 94px;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf2ff;
  color: #1c4ed8;
  font-size: 12px;
  font-weight: 800;
}

.pill.strong {
  background: #e6fcf5;
  color: var(--green);
}

.pill.weak {
  background: #fff5f5;
  color: var(--red);
}

.reasons {
  max-width: 330px;
  color: var(--muted);
  line-height: 1.35;
}

.entry {
  min-width: 210px;
  max-width: 280px;
}

.buy-zone {
  min-width: 180px;
  max-width: 250px;
}

.sell-zone {
  min-width: 180px;
  max-width: 250px;
}

.news-cell {
  min-width: 240px;
  max-width: 320px;
  line-height: 1.35;
}

.news-carousel {
  display: grid;
  gap: 6px;
}

.news-controls {
  display: inline-grid;
  grid-template-columns: 28px auto 28px;
  align-items: center;
  gap: 6px;
  width: max-content;
}

.news-controls button {
  width: 28px;
  height: 26px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.news-controls span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.macro-cell {
  min-width: 210px;
  max-width: 280px;
  color: #354052;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.context-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.context-item {
  display: grid;
  gap: 6px;
  min-height: 88px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.context-item span {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 850;
}

.context-item a,
.context-item strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  text-decoration: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.context-item a:hover {
  color: var(--blue);
  text-decoration: underline;
}

.news-cell a,
.news-cell strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.news-cell a:hover {
  color: var(--blue);
  text-decoration: underline;
}

.news-cell small,
.muted {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.entry strong,
.entry span,
.entry small,
.entry em,
.buy-zone strong,
.buy-zone span,
.buy-zone small,
.buy-zone em,
.sell-zone strong,
.sell-zone span,
.sell-zone small,
.sell-zone em {
  display: block;
}

.entry strong,
.buy-zone strong,
.sell-zone strong {
  color: var(--ink);
  font-size: 13px;
}

.entry span,
.buy-zone span,
.sell-zone span {
  margin-top: 3px;
  color: var(--blue);
  font-weight: 800;
  line-height: 1.3;
}

.entry small,
.buy-zone small,
.sell-zone small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.entry em,
.buy-zone em,
.sell-zone em {
  margin-top: 5px;
  color: #4b5565;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.sell-zone span {
  color: var(--red);
}

.spark {
  width: 108px;
  height: 34px;
}

.empty {
  height: 160px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .market-clock {
    text-align: left;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .summary-band {
    grid-template-columns: 1fr;
  }

  .context-strip {
    grid-template-columns: 1fr;
  }
}
