/* ============================================================
   Olympus — терминал воркера. Специфика поверх /shared.css
   (токены, база и общие компоненты — в shared.css).
   Все селекторы app.js сохранены.
   ============================================================ */

/* ---------- Экран входа ---------- */

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.12fr 1fr;
}

.login-left {
  position: relative;
  overflow: hidden;
  background: var(--sidebg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px;
  background-image: repeating-linear-gradient(90deg, transparent 0 52px, var(--line2) 52px 53px);
}

.login-watermark {
  position: absolute;
  left: -130px;
  bottom: -170px;
  width: 640px;
  height: 640px;
  object-fit: contain;
  opacity: .07;
  pointer-events: none;
}

.login-left-inner { position: relative; max-width: 440px; }

.login-mark { position: relative; width: 134px; height: 134px; }

.login-mark-halo {
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 68%);
}

.login-mark img {
  position: relative;
  width: 134px;
  height: 134px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 6px 18px var(--glow));
}

.login-wordmark {
  font-family: var(--brandfont);
  font-size: 46px;
  letter-spacing: .26em;
  line-height: 1.15;
  margin-top: 18px;
}

.login-greek {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: .52em;
  text-transform: uppercase;
  margin-top: 6px;
}

.login-tagline {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.28;
  margin-top: 30px;
}

.login-desc {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 12px;
  line-height: 1.65;
}

.login-stat { margin-top: 32px; }
.login-stat-v { font-family: var(--mono); font-size: 20px; font-weight: 600; color: var(--accent); }
.login-stat-l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; margin-top: 2px; }

.login-left .meander {
  margin-top: 40px;
  max-width: 430px;
  height: 7px;
  background-image:
    linear-gradient(var(--gold), var(--gold)),
    linear-gradient(var(--gold), var(--gold)),
    repeating-linear-gradient(90deg, var(--gold) 0 1px, transparent 1px 9px);
  opacity: .45;
}

.login-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-card {
  width: 100%;
  max-width: 368px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: modalIn .4s ease;
}

.login-logo { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.login-sub { color: var(--muted); font-size: 13.5px; margin-top: -12px; }

.login-error {
  color: var(--bad);
  background: var(--bad-soft);
  border: 1px solid var(--bad-border);
  border-radius: var(--radius-m);
  padding: 8px 12px;
  font-size: 13px;
  text-align: center;
}

.login-alt { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

.login-divider { display: flex; align-items: center; gap: 10px; }
.login-divider i { flex: 1; height: 1px; background: var(--line); }
.login-divider b { width: 6px; height: 6px; background: var(--gold); transform: rotate(45deg); opacity: .65; }

/* ---------- Сайдбар: автолов ---------- */

.hunt-card {
  margin: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card), var(--card2));
  padding: 14px;
}

.hunt-card:has(#autotake-toggle:checked) {
  border-color: var(--acc-border);
  animation: huntBreathe 2.4s ease-in-out infinite;
}

@keyframes huntBreathe {
  0%, 100% { box-shadow: 0 0 10px var(--glow); }
  50% { box-shadow: 0 0 20px var(--glow); }
}

.hunt-sep { height: 1px; background: var(--line2); margin: 12px 0 10px; }

.chip-tokens { width: 100%; justify-content: center; }

.autotake {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.autotake-label { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.autotake-label b { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; }
.autotake-label small {
  color: var(--muted);
  font-size: 11.5px;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.autotake-label small.hunting { color: var(--good); }
.autotake-label small.held { color: var(--warn); }

.card-turbo-block { border-color: var(--turbo-border); }
.card-turbo-block h2 .ico { color: var(--turbo); }
.card-turbo-block .autotake-label b { font-size: 13.5px; letter-spacing: .02em; text-transform: none; }
.card-turbo-block .autotake-label small {
  font-family: var(--sans);
  line-height: 1.5;
  margin-top: 3px;
  white-space: normal;
}
.card-turbo-block .switch input:checked + i { background: var(--turbo-soft); border-color: var(--turbo); box-shadow: 0 0 12px rgba(179, 85, 47, .3); }
.card-turbo-block .switch input:checked + i::after { background: var(--turbo); }

/* ---------- Шапка: статус-центр и профиль ---------- */

.sc-wrap { position: relative; display: inline-flex; }
.sc-btn-label { font-family: var(--sans); font-weight: 600; }

.btn-profile { max-width: 220px; }
.btn-profile #profile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Полоса ключей ---------- */

.keys-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 22px 0;
}

.keys-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  flex: none;
}

.keys-tabs { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }

.key-tab {
  appearance: none;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  max-width: 300px;
  transition: border-color var(--dur-1), background var(--dur-1), color var(--dur-1), box-shadow var(--dur-2);
}

.key-tab:hover { border-color: var(--acc-border); color: var(--ink); }
.key-tab.active {
  border-color: var(--acc-border);
  background: var(--acc-soft);
  color: var(--ink);
  box-shadow: 0 0 10px var(--glow);
}
.key-tab.disabled-key { border-style: dashed; opacity: .65; }

.key-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.key-dot.on { background: var(--good); box-shadow: 0 0 7px var(--good); }
.key-dot.off { background: var(--knob); }

.key-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.key-env {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid var(--neutral-border);
  color: var(--muted);
  flex: none;
}
.key-env.env-mainnet { color: var(--accent); border-color: var(--acc-border); background: var(--acc-soft); }
.key-env.env-testnet { color: var(--warn); border-color: var(--warn-border); background: var(--warn-soft); }

/* ---------- Пустое состояние (нет ключей) ---------- */

.nokeys {
  max-width: 640px;
  margin: 0 auto;
  padding: 26px 8px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.nokeys-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--acc-soft);
  border: 1px solid var(--acc-border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nokeys-icon .ico { width: 26px; height: 26px; color: var(--accent); }

.nokeys h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 24px; }
.nokeys p { margin: 0; max-width: 520px; }

.nokeys-steps {
  text-align: left;
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0 10px;
}

/* ---------- Onboarding-чеклист выбранного ключа ---------- */

#onboarding .card { border-color: var(--acc-border); }
.onb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.onb-head h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 19px; }
.onb-count { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

/* ---------- Статистика ---------- */

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.stat-card h3 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--muted);
  font-family: var(--sans);
}

/* ---------- Очередь ---------- */

/* полоса «подходит под фильтры» */
.table tr.match td:first-child { position: relative; }
.table tr.match td:first-child::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--glow);
}

@keyframes ttlPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}
.c-ttl.ttl-low { color: var(--bad); font-weight: 700; animation: ttlPulse 1s infinite; }

.btn-take {
  padding: 4px 13px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  background: transparent;
  border-color: var(--acc-border);
  border-radius: var(--radius-s);
  min-height: 30px;
}
.btn-take:hover:not(:disabled) {
  background: var(--acc-soft);
  border-color: var(--acc-border);
  box-shadow: 0 0 10px var(--glow);
  color: var(--accent);
}

/* ---------- График ---------- */

.chart-wrap { height: 200px; }
#chart-canvas { width: 100%; height: 100%; }
.chart-table { max-height: 300px; overflow-y: auto; }

/* ---------- Активный платёж ---------- */

.active-card {
  border-color: var(--acc-border);
  box-shadow: 0 0 0 1px var(--acc-soft), 0 8px 30px var(--glow);
}

.active-head {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.active-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
}
.active-head h2 .mono { font-family: var(--mono); font-size: 14px; color: var(--muted); }

.active-grid {
  display: grid;
  grid-template-columns: 224px 1fr;
  gap: 18px;
  align-items: start;
}

.qr-wrap { display: flex; flex-direction: column; gap: 8px; }

.qr-box {
  background: #fff;
  border-radius: 11px;
  padding: 9px;
  line-height: 0;
  box-shadow: 0 4px 22px var(--glow);
}
.qr-box svg, .qr-box img { width: 100%; height: auto; display: block; image-rendering: pixelated; }

.qr-link { display: flex; gap: 6px; }
.qr-link input { flex: 1; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

.active-details dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 18px;
  margin: 0 0 14px;
}
.active-details dt { color: var(--muted); font-size: 13px; }
.active-details dd {
  margin: 0;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
}
.active-details dd.reward { color: var(--good); font-weight: 700; }

.active-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.active-lock {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-m);
  color: var(--warn);
  font-size: 13px;
  line-height: 1.5;
  padding: 9px 12px;
  margin-top: 10px;
}
.active-lock .ico { margin-top: 2px; }

.timer {
  color: var(--accent);
  font-weight: 700;
  border-color: var(--acc-border) !important;
  background: var(--acc-soft) !important;
}

/* ---------- Платежи: pending и итоги ---------- */

.pending-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-m);
  padding: 10px 13px;
  margin-bottom: 12px;
}

.pending-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13.5px;
}
.pending-item .spacer { flex: 1; }

.total-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

#pay-presets .row-inline { gap: 6px; }

/* ---------- Споры ---------- */

.disputes { display: flex; flex-direction: column; gap: 14px; }

.dispute-card { border-color: var(--warn-border); }

.dispute-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.dispute-head h3 { margin: 0; font-size: 15px; font-weight: 700; }

.dispute-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 16px;
  margin-bottom: 10px;
}
.dispute-grid .kv .k { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; }
.dispute-grid .kv .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13.5px; margin-top: 1px; }

.proofs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 12.5px;
  color: var(--info);
  background: var(--info-soft);
  border: 1px solid var(--info-border);
  border-radius: 999px;
  padding: 4px 12px;
  min-height: 30px;
  cursor: pointer;
  transition: border-color var(--dur-1), background var(--dur-1);
}
.file-chip:hover { border-color: var(--info); }
.file-chip .ico { width: 13px; height: 13px; }

.dispute-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Журнал ---------- */

.log-box {
  height: 60vh;
  min-height: 300px;
  overflow-y: auto;
  background: var(--input);
  border: 1px solid var(--line2);
  border-radius: var(--radius-m);
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
}

.log-line { display: flex; gap: 10px; white-space: pre-wrap; word-break: break-word; }
.log-line .lt { color: var(--dim); flex: none; }
.log-line .ll { flex: none; width: 48px; font-weight: 700; }
.log-line.lv-info .ll { color: var(--info); }
.log-line.lv-warn .ll { color: var(--warn); }
.log-line.lv-error .ll { color: var(--bad); }
.log-line.lv-error .lm { color: var(--bad); }

/* ---------- Чат поддержки ---------- */

.chat-card { display: flex; flex-direction: column; }

.chat-box {
  height: 56vh;
  min-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 2px;
}

.chat-empty { margin: auto; color: var(--muted); text-align: center; font-size: 13.5px; max-width: 340px; }

.msg { display: flex; flex-direction: column; max-width: 72%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }

.msg-who {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gold);
  margin: 0 4px 3px;
}

.msg-bubble {
  padding: 8px 12px;
  border-radius: 13px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.mine .msg-bubble { background: var(--acc-soft); border: 1px solid var(--acc-border); border-bottom-right-radius: 4px; }
.msg.theirs .msg-bubble { background: var(--input); border: 1px solid var(--line); border-bottom-left-radius: 4px; }

.msg-time { color: var(--dim); font-size: 10.5px; font-family: var(--mono); margin: 3px 4px 0; }

.chat-input-row { display: flex; gap: 8px; align-items: flex-end; padding-top: 10px; border-top: 1px solid var(--line2); margin-top: 10px; }
.chat-input-row textarea { flex: 1; }

/* ---------- Настройки ---------- */

.key-mask {
  background: var(--card2);
  border: 1px dashed var(--line);
  border-radius: var(--radius-s);
  padding: 7px 10px;
  font-size: 12.5px;
  letter-spacing: .04em;
}

.accounts-table input { width: 100%; }
.accounts-table td { white-space: normal; }

#settings-form { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Адаптив терминала ---------- */

@media (max-width: 1000px) {
  .hunt-card {
    margin: 8px 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 14px;
  }
  .hunt-sep { display: none; }
  .chip-tokens { width: auto; }
  .keys-bar { padding: 10px 14px 0; }
  .stats { grid-template-columns: 1fr; }
  .active-grid { grid-template-columns: 200px 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-left { display: none; }
}

@media (max-width: 900px) {
  /* второстепенные чипы уходят в статус-центр */
  #merchant-chip, #ping-chip, #turbo-chip { display: none; }
  .btn-profile { max-width: 140px; }
}

@media (max-width: 768px) {
  .sidebar { padding-bottom: 4px; }
  .brand-block { padding: 10px 12px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-name { font-size: 13.5px; }
  .hunt-card { margin: 8px 12px 8px auto; padding: 7px 12px; gap: 10px; }
  .autotake-label b { font-size: 10.5px; }
  /* ключи — одна строка с горизонтальной прокруткой, а не столбик */
  .keys-bar { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .keys-tabs { flex-wrap: nowrap; flex: none; }
  .keys-bar .btn { flex: none; }
  .key-tab { max-width: 230px; flex: none; }
}

@media (max-width: 720px) {
  .active-grid { grid-template-columns: 1fr; }
  .qr-wrap { max-width: 280px; }
  .filters-row .field { flex: 1 1 140px; }
  .msg { max-width: 88%; }
  .chat-box { height: 48vh; }
  .active-actions .btn { flex: 1 1 auto; }
  .dispute-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 420px) {
  .keys-label { display: none; }
  .login-right { padding: 24px 16px; }
}
