/* Палитра: оливковая ветвь и латунь. Латунь — только для суммы, которую получит адресат. */
:root {
  --paper: #f5f6f1;
  --surface: #ffffff;
  --ink: #16261e;
  --muted: #5b685f;
  --olive: #3d6a4e;
  --olive-ink: #ffffff;
  --olive-soft: #e3eadf;
  --brass: #8f6c1f;
  --line: #d5dbd0;
  --danger: #a3243a;
  --danger-soft: #f6e3e6;
  --ok-soft: #e1eee3;
  --radius-s: 6px;
  --radius-l: 14px;
  --font: "Golos Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101813;
    --surface: #17221b;
    --ink: #e6ece5;
    --muted: #9aa79f;
    --olive: #8db89a;
    --olive-ink: #0e1711;
    --olive-soft: #1f2e25;
    --brass: #d6b25f;
    --line: #2b3a31;
    --danger: #e57385;
    --danger-soft: #3a1d23;
    --ok-soft: #1e3326;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--font);
}
a { color: var(--olive); }
:focus-visible { outline: 3px solid var(--olive); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; max-width: 68ch; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ---------- каркас ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .875rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 1.05rem; }
.brand svg { vertical-align: -4px; margin-right: .4rem; }
.wrap { padding: clamp(1rem, 4vw, 2.5rem); max-width: 1180px; margin: 0 auto; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; align-items: center; }
.nav a, .nav button {
  color: var(--muted); text-decoration: none; padding: .4rem .7rem; border-radius: var(--radius-s);
  font: inherit; font-size: .95rem; background: none; border: 0; cursor: pointer;
}
.nav a[aria-current="page"] { color: var(--ink); background: var(--olive-soft); }
.nav a:hover, .nav button:hover { color: var(--ink); }
.nav form { margin: 0; }

.flash { padding: .75rem 1rem; border-radius: var(--radius-s); margin: 0 0 1.25rem; }
.flash.ok { background: var(--ok-soft); }
.flash.err { background: var(--danger-soft); color: var(--ink); border-left: 4px solid var(--danger); }

/* ---------- формы ---------- */
label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .3rem; }
input[type=text], input[type=tel], input[type=number], input[type=file], input:not([type]), textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: .6rem .75rem;
}
textarea { min-height: 4.5rem; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--olive); box-shadow: 0 0 0 3px var(--olive-soft); }
.field { margin-bottom: 1rem; }
.row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.check { display: flex; gap: .6rem; align-items: flex-start; color: var(--ink); font-size: .95rem; }
.check input { margin-top: .3rem; accent-color: var(--olive); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  padding: .65rem 1.1rem; border-radius: var(--radius-s);
  border: 1px solid var(--olive); background: var(--olive); color: var(--olive-ink);
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--olive); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.wide { width: 100%; padding: .85rem; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.actions form { margin: 0; }

/* сегментированный выбор (валюта, способ оплаты) */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; background: var(--surface); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { margin: 0; padding: .5rem .9rem; cursor: pointer; color: var(--muted); font-size: .95rem; }
.seg input:checked + label { background: var(--olive); color: var(--olive-ink); }
.seg input:focus-visible + label { outline: 3px solid var(--olive); outline-offset: -3px; }

/* ---------- клиентская главная ---------- */
.public { display: grid; gap: clamp(1.5rem, 4vw, 3.5rem); grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); align-items: start; }
@media (max-width: 860px) { .public { grid-template-columns: 1fr; } }

.calc { padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 2rem; }
.calc .lead { color: var(--muted); margin-bottom: 1.5rem; }
.amount-line { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.calc input.amount-input {
  font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink);
  background: transparent; border: 0; border-bottom: 2px solid var(--line); border-radius: 0;
  padding: .1rem 0; width: 100%; max-width: 12ch;
}
.calc input.amount-input:focus { outline: none; border-bottom-color: var(--olive); box-shadow: none; }
.send input.amount-input { font-size: clamp(1.75rem, 4.5vw, 2.5rem); }
.send .unit { font-size: 1.5rem; color: var(--muted); }
/* Главный элемент страницы: сколько получит адресат */
.receive { margin-top: 1.75rem; }
.receive input.amount-input {
  font-size: clamp(2.75rem, 9vw, 5.25rem); line-height: 1.05; color: var(--brass);
  max-width: 11ch; letter-spacing: -.02em; border-bottom-color: transparent;
}
.receive input.amount-input:hover, .receive input.amount-input:focus { border-bottom-color: var(--brass); }
.rate-line { margin-top: 1rem; color: var(--muted); font-size: .95rem; min-height: 1.5em; }
.rate-line.err { color: var(--danger); }

.order-form fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; }
.order-form legend { font-weight: 600; font-size: 1.05rem; margin-bottom: .75rem; padding: 0; }

.how ol { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.how li { counter-increment: s; position: relative; padding: 0 0 1.25rem 2.75rem; }
.how li::before {
  content: counter(s); position: absolute; left: 0; top: -.1rem;
  width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--olive); color: var(--olive); font-weight: 600; font-size: .9rem;
}
.how li:not(:last-child)::after {
  content: ""; position: absolute; left: .93rem; top: 1.95rem; bottom: .25rem; width: 1px; background: var(--line);
}
.how b { display: block; }
.how .note { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: .5rem; font-size: .9rem; color: var(--muted); }

/* ---------- статус для клиента ---------- */
.status-head { margin-bottom: 1.5rem; }
.status-head .big { font-size: clamp(2rem, 6vw, 3.25rem); color: var(--brass); font-weight: 600; line-height: 1.1; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; list-style: none; padding: 0; margin: 0 0 2rem; }
.steps li { border-top: 4px solid var(--line); padding-top: .5rem; font-size: .875rem; color: var(--muted); }
.steps li.done { border-color: var(--olive); color: var(--ink); }
.steps li.now { border-color: var(--olive); color: var(--ink); font-weight: 600; }
.steps li.now::after { content: " · сейчас"; font-weight: 400; color: var(--muted); }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr 1fr; } }

.pay-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 1.25rem; margin-bottom: 1.5rem; }
.pay-box .req { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; word-break: break-all; }
.copy { font: inherit; font-size: .85rem; border: 1px solid var(--line); background: transparent; color: var(--olive); border-radius: var(--radius-s); padding: .2rem .55rem; cursor: pointer; margin-left: .5rem; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0 0 1.5rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

/* ---------- панель ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; margin-bottom: 2rem; }
.kpis > div { background: var(--surface); padding: 1rem 1.1rem; }
.kpis .v { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpis .l { color: var(--muted); font-size: .875rem; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
@media (max-width: 960px) { .grid2 { grid-template-columns: 1fr; } }
.grid2.dash { grid-template-columns: minmax(0, 1fr) 300px; }
@media (max-width: 1080px) { .grid2.dash { grid-template-columns: 1fr; } }
dl.kv.tight { grid-template-columns: 1fr auto; }
dl.kv.tight dd { text-align: right; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 1.25rem; margin-bottom: 1.5rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); margin-bottom: 1.5rem; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: .85rem; background: var(--paper); }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--olive-soft); }
.neg { color: var(--danger); }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; background: var(--olive-soft); color: var(--ink); white-space: nowrap; }
.badge.DISPUTE { background: var(--danger-soft); color: var(--danger); }
.badge.DONE { background: var(--ok-soft); }
.badge.CANCELLED { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.badge.attn { background: var(--brass); color: var(--paper); }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filters a { text-decoration: none; color: var(--muted); padding: .3rem .65rem; border-radius: 999px; border: 1px solid var(--line); font-size: .875rem; }
.filters a[aria-current="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.filters form { margin-left: auto; display: flex; gap: .5rem; }
.filters input { width: 16rem; max-width: 60vw; }

.timeline { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.timeline li { padding: .4rem 0 .4rem 1rem; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: .85rem; width: 8px; height: 8px; border-radius: 50%; background: var(--olive); }

.sy-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 1.25rem; margin-bottom: 1rem; }
.sy-card .pay { font-size: 1.75rem; font-weight: 600; color: var(--brass); font-variant-numeric: tabular-nums; }
.sy-card details { margin-top: .75rem; }
.sy-card summary { cursor: pointer; color: var(--muted); }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.center-box { max-width: 30rem; margin: 10vh auto; text-align: center; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; word-break: break-all; }

@media (prefers-reduced-motion: no-preference) {
  .receive input.amount-input.changed { animation: settle .35s ease-out; }
  @keyframes settle { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
