/* Панель оператора EuroXchange. Те же цвета, что у сайта, но плотнее: рабочий экран
   на компьютере, много данных сразу. Светлая и тёмная тема — по настройке системы. */

:root {
  --green: #9fe870;
  --green-active: #cdffad;
  --forest: #163300;
  --bg: #eef0ec;
  --surface: #ffffff;
  --ink: #0e0f0c;
  --body: #454745;
  --muted: #7a7d78;
  --line: #dfe2db;
  --link: #163300;
  --danger: #c4262c;
  --ok-bg: #e2f6d5;
  --err-bg: #fbe3e3;
  --warn-bg: #fff1cc;
  --warn-ink: #5a4100;
  --soft: #e2f6d5;
  --r: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f0c;
    --surface: #1a1c18;
    --ink: #e8ebe6;
    --body: #c4c7c1;
    --muted: #8f928c;
    --line: #2c2f29;
    --link: #9fe870;
    --danger: #f0686d;
    --ok-bg: #1f3312;
    --err-bg: #3a0c0c;
    --warn-bg: #3a2c05;
    --warn-ink: #ffe08a;
    --soft: #23361a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--link); text-underline-offset: 2px; }
code, .mono, .cardnum { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 18px 0 8px; }
p { margin: 0 0 8px; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }

/* шапка */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-weight: 800; font-size: 16px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand span { font-weight: 600; color: var(--forest); background: var(--green); border-radius: 999px; padding: 1px 8px; font-size: 12px; margin-left: 4px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--body); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 600; }
.nav a:hover { background: var(--soft); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--surface); }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.who form { margin: 0; }

.main { max-width: 1280px; margin: 0 auto; padding: 20px; }
.main.wide { max-width: 1680px; }
.narrow { max-width: 440px; margin: 10vh auto 0; padding: 20px; }
.foot { text-align: center; padding: 20px; font-size: 12px; }

/* кнопки */
.btn, .btn-small, .ghost {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn { background: var(--green); color: var(--forest); padding: 10px 20px; min-height: 40px; }
.btn:hover, .btn-small:hover { background: var(--green-active); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a01d22; }
.btn-small { background: var(--soft); color: var(--ink); padding: 5px 12px; font-size: 13px; }
.btn-small[disabled] { opacity: .45; cursor: not-allowed; }
.btn-small.danger { background: var(--err-bg); color: var(--danger); }
.ghost { background: transparent; color: var(--body); padding: 5px 10px; border: 1px solid var(--line); }
.ghost:hover { background: var(--soft); }
.copy {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  background: var(--soft);
  color: var(--ink);
  border: 0;
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.copy.done { background: var(--green); color: var(--forest); }

/* формы */
input:not([type]), input[type="text"], select {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
}
.w-num { width: 130px; }
.w-search { width: 280px; }
.big-input { font-size: 20px; width: 140px; font-weight: 700; }
.code-input { font-size: 28px; letter-spacing: .3em; text-align: center; width: 100%; padding: 10px; }
label { display: block; font-weight: 600; color: var(--body); }
label input, label select { display: block; margin-top: 4px; font-weight: 400; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
label.check input { display: inline; margin: 0; width: 18px; height: 18px; accent-color: var(--forest); }
.stack { display: grid; gap: 12px; }
.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 2px 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; align-items: end; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span2 input { width: 100%; }
.form-grid .btn { justify-self: start; }

/* сообщения */
.flash { border-radius: var(--r); padding: 10px 14px; margin-bottom: 16px; }
.flash-ok { background: var(--ok-bg); }
.flash-error { background: var(--err-bg); }
.warn-link { color: var(--warn-ink); background: var(--warn-bg); padding: 0 6px; border-radius: 6px; }

/* блоки */
.box, .card { background: var(--surface); border-radius: var(--r); padding: 16px 18px; }
.box h1 { margin-bottom: 8px; }
.box .btn { margin-top: 8px; }
.card + .card, .grid2 + .card, .card + .grid2, .grid2 + .grid2 { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid2 > .card { margin-top: 0; }
.stack label input:not([type]) { width: 100%; }
.head-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.crumbs { margin-bottom: 6px; color: var(--muted); }
.big-num { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 12px 0 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
pre { background: var(--bg); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.danger-zone { border: 1px solid var(--err-bg); }
.tg-login { margin: 18px 0 8px; min-height: 48px; }

/* статусы и банки */
.status { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--soft); color: var(--ink); white-space: nowrap; }
.st-new { background: var(--warn-bg); color: var(--warn-ink); }
.st-in_work { background: #dbe8ff; color: #0b2f6b; }
.st-partial { background: var(--soft); }
.st-done { background: var(--green); color: var(--forest); }
.st-cancelled { background: var(--line); color: var(--body); }
@media (prefers-color-scheme: dark) { .st-in_work { background: #16284a; color: #b9d0ff; } }
.bank { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--line); color: var(--ink); white-space: nowrap; }
.bank-mono { background: #1b1b1d; color: #fff; }
.bank-privat { background: #1d6b37; color: #fff; }
.bank-pumb { background: #c8102e; color: #fff; }
.bank-abank { background: #3d8b3d; color: #fff; }
.bank-oschad { background: #0f6e4f; color: #fff; }
@media (prefers-color-scheme: dark) { .bank-mono { background: #f2f3f1; color: #111; } }

.bar { appearance: none; -webkit-appearance: none; width: 100%; height: 6px; border: 0; border-radius: 999px; background: var(--soft); overflow: hidden; display: block; margin: 6px 0; }
.bar::-webkit-progress-bar { background: var(--soft); }
.bar::-webkit-progress-value { background: var(--forest); }
.bar::-moz-progress-bar { background: var(--forest); }
@media (prefers-color-scheme: dark) {
  .bar::-webkit-progress-value { background: var(--green); }
  .bar::-moz-progress-bar { background: var(--green); }
}

/* рабочее место */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border-radius: var(--r); padding: 12px 16px; display: grid; }
.tile-label { color: var(--muted); font-size: 12.5px; }
.tile-value { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.tile-sub { color: var(--body); font-size: 12.5px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.col > h2 { margin: 0 0 8px; }
.col .card { margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { font: inherit; font-size: 12.5px; font-weight: 600; background: var(--surface); color: var(--body); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.card-id { font-weight: 800; text-decoration: none; color: var(--ink); }
.age { margin-left: auto; font-size: 12.5px; }
.free { font-size: 15px; margin: 0; }
.free b { font-size: 20px; }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; background: var(--bg); border-radius: 8px; margin-top: 6px; }
.copy-row .cardnum { font-size: 16px; font-weight: 600; letter-spacing: .03em; }
.copy-row .holder { font-weight: 600; }
.copy-row.big .cardnum { font-size: 20px; }
.copy-row.big .holder { font-size: 16px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.quick form { margin: 0; }
.qcard[hidden] { display: none; }
.empty { color: var(--muted); padding: 12px 0; }
.events { list-style: none; padding: 0; margin: 0; background: var(--surface); border-radius: var(--r); }
.ev { display: grid; grid-template-columns: 82px 1fr; gap: 8px; padding: 7px 12px; border-top: 1px solid var(--line); font-size: 13px; }
.ev:first-child { border-top: 0; }
.ev a { color: var(--ink); text-decoration: none; }
.ev a:hover { text-decoration: underline; }
.ev-time { color: var(--muted); font-size: 12px; }
.ev-order a, .ev-warn a { font-weight: 700; }
.ev-warn { background: var(--warn-bg); }
.ev-deposit a::before { content: "↓ "; color: var(--muted); }
.ev-paid a::before { content: "✓ "; color: var(--muted); }
.live-note { margin-top: 12px; }
.live-note.stale { color: var(--danger); }
.fresh { animation: fresh 2.5s ease-out; }
@keyframes fresh { from { box-shadow: 0 0 0 3px var(--green); } to { box-shadow: 0 0 0 3px transparent; } }

/* очередь — таблица */
.cols2 { display: grid; grid-template-columns: minmax(0, 2.6fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.queue { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.queue th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 0 10px 2px; }
.queue th.r, .queue td.r { text-align: right; }
.queue tbody > tr > td { background: var(--surface); padding: 10px; vertical-align: middle; }
.queue tbody > tr.order-row > td:first-child { border-radius: var(--r) 0 0 var(--r); }
.queue tbody > tr.order-row > td:last-child { border-radius: 0 var(--r) var(--r) 0; }
.queue tbody > tr.order-row:only-child > td:first-child { border-radius: var(--r) 0 0 var(--r); }
.queue tr.order-row + tr.parts-row > td { padding-top: 0; }
.queue tbody:has(.parts-row) tr.order-row > td:first-child { border-bottom-left-radius: 0; }
.queue tbody:has(.parts-row) tr.order-row > td:last-child { border-bottom-right-radius: 0; }
.queue tr.parts-row > td:first-child { border-radius: 0 0 0 var(--r); }
.queue tr.parts-row > td:last-child { border-radius: 0 0 var(--r) 0; }
.queue .qrow[hidden] { display: none; }
.queue .cardnum { font-size: 15px; font-weight: 600; letter-spacing: .03em; }
.queue .holder { font-weight: 600; }
.queue .left { font-size: 18px; }
.queue .copy { padding: 2px 7px; margin-left: 4px; }
.nowrap { white-space: nowrap; }
.btn-amount {
  font: inherit; font-weight: 800; font-size: 15px; min-width: 44px; height: 36px;
  border: 0; border-radius: 10px; background: var(--green); color: var(--forest); cursor: pointer;
}
.btn-amount:hover { background: var(--green-active); }
.btn-amount[disabled] { background: var(--line); color: var(--muted); cursor: not-allowed; }
.queue .quick { display: table-cell; }
.queue .quick form { display: inline-block; margin: 0 2px; }

.part { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 12px; padding: 6px 0; border-top: 1px dashed var(--line); }
.part:first-child { border-top: 0; }
.part-main { padding-top: 4px; }
.part-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.part-actions > form { margin: 0; }
.part-reserved .part-main b { color: var(--ink); }
.ok-text { color: var(--forest); }
@media (prefers-color-scheme: dark) { .ok-text { color: var(--green); } }
.got > summary { list-style: none; cursor: pointer; }
.got > summary::-webkit-details-marker { display: none; }
.got[open] > summary { background: var(--ink); color: var(--surface); }
.got-form { display: grid; gap: 8px; background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 6px; min-width: 320px; }
.got-form label { font-weight: 600; font-size: 13px; }
.got-form input:not([type]) { width: 100%; }
.got-form input[type="file"] { display: block; margin-top: 4px; font: inherit; font-size: 13px; }
.tokens > summary { cursor: pointer; }
.tokens .inline { margin-top: 6px; }

/* сделки Binance */
.deals { margin-bottom: 16px; }
.dcard { margin-bottom: 8px; }
.dcard p { margin: 4px 0 0; }
.dcard form { margin-top: 6px; }
.dcard-unlinked { box-shadow: inset 3px 0 0 var(--danger); }
.dcard-appeal { box-shadow: inset 3px 0 0 var(--warn-ink); }

/* таблицы и вкладки */
.table { width: 100%; border-collapse: collapse; }
.table.card { padding: 0; overflow: hidden; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table td.num { white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.row-cancelled td { color: var(--muted); }
.neg { color: var(--danger); }
.pos { color: var(--forest); }
@media (prefers-color-scheme: dark) { .pos { color: var(--green); } }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 5px 12px; border-radius: 999px; text-decoration: none; color: var(--body); font-weight: 600; background: var(--surface); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--surface); }

@media (max-width: 1100px) {
  .cols2 { grid-template-columns: 1fr; }
  .cols { grid-template-columns: 1fr 1fr; }
  .cols .col:last-child { grid-column: span 2; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .who { margin-left: 0; }
  .cols, .grid2 { grid-template-columns: 1fr; }
  .cols .col:last-child { grid-column: auto; }
  .table { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { .fresh { animation: none; } }
