:root {
  --bg: #090b12;
  --panel: rgba(19, 24, 35, 0.82);
  --panel-solid: #151b29;
  --panel2: #1b2333;
  --panel3: #222c40;
  --border: rgba(139, 157, 190, .17);
  --border-strong: rgba(139, 157, 190, .28);
  --text: #edf2fb;
  --muted: #8f9bb0;
  --accent: #6d9dff;
  --accent2: #886cff;
  --green: #35c26a;
  --red: #e05555;
  --mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(850px 520px at 6% -12%, rgba(68, 119, 255, .19), transparent 62%),
    radial-gradient(760px 520px at 96% 0%, rgba(130, 86, 255, .15), transparent 60%),
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 44px 44px, 44px 44px, auto;
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  min-height: 100vh;
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; filter: brightness(1.15); }

.header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap;
  padding: 12px max(20px, calc((100vw - 1120px) / 2));
  background: rgba(9, 12, 20, .74);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(139, 157, 190, .12);
}
.header nav { display: flex; gap: 5px; padding: 4px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.06); border-radius: 13px; }
.header nav a {
  padding: 7px 14px; border-radius: 9px; font-size: 13.5px; color: var(--muted);
  transition: color .15s, background .15s;
}
.header nav a.active, .header nav a:hover { color: var(--text); background: rgba(109,157,255,.13); }
.header nav .btn { padding: 7px 12px; font-size: 13px; border-radius: 9px; box-shadow: none; }

.seller-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  color: #fff !important;
  white-space: nowrap;
  background: linear-gradient(135deg, #628fff, #8062ed);
  box-shadow: 0 7px 24px rgba(82, 112, 240, .24);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.seller-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45); text-decoration: none; }
.seller-btn .arr { font-size: 12px; opacity: .85; }

.container { max-width: 1120px; margin: 0 auto; padding: 42px 24px 76px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 25px; margin-bottom: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .18), inset 0 1px rgba(255,255,255,.025);
  backdrop-filter: blur(14px);
}
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); margin-bottom: 16px; }

h1.page-title { font-size: clamp(24px, 4vw, 32px); letter-spacing: -.7px; margin-bottom: 6px; line-height: 1.15; }
.subtitle { color: var(--muted); font-size: 14px; }
.mb-20 { margin-bottom: 20px; }

input[type=text], input[type=password], textarea, select {
  width: 100%; background: rgba(27,35,51,.86); color: var(--text);
  border: 1px solid var(--border); border-radius: 11px;
  padding: 12px 14px; font-size: 15px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(109, 157, 255, .12); }
textarea { resize: vertical; min-height: 120px; font-family: var(--mono); font-size: 13px; line-height: 1.6; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; border: none; border-radius: 11px;
  padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform .18s, box-shadow .18s, filter .18s, border-color .18s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 9px 24px rgba(99, 102, 241, .25); text-decoration: none; }
.btn.secondary {
  background: rgba(34,44,64,.72); border: 1px solid var(--border); color: var(--text);
  box-shadow: none;
}
.btn.secondary:hover { border-color: var(--accent); box-shadow: none; }
.btn.danger { background: transparent; border: 1px solid rgba(224,85,85,.5); color: var(--red); padding: 6px 11px; font-size: 13px; box-shadow: none; }
.btn.danger:hover { background: rgba(224,85,85,.12); box-shadow: none; transform: none; }
.btn.small { padding: 6px 13px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row .btn { white-space: nowrap; }
.grow { flex: 1; }

.data-row {
  display: flex; align-items: center; gap: 12px; row-gap: 8px;
  background: rgba(27,35,51,.72); border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 15px; margin-bottom: 9px; transition: border-color .15s, background .15s;
}
.data-row:hover { border-color: var(--border-strong); background: rgba(34,44,64,.85); }
.data-row .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); min-width: 95px; }
.data-row .v { font-family: var(--mono); font-size: 14px; word-break: break-all; flex: 1; }

.guard-code {
  font-family: var(--mono); font-size: 52px; letter-spacing: 12px; text-align: center;
  color: var(--green); padding: 22px 0 4px; padding-left: 12px;
  text-shadow: 0 0 28px rgba(53, 194, 106, 0.45);
}
.guard-timer { text-align: center; color: var(--muted); font-size: 13px; }
.timer-bar { height: 5px; background: var(--panel2); border-radius: 4px; margin-top: 12px; overflow: hidden; }
.timer-bar > div { height: 100%; background: linear-gradient(90deg, var(--green), #7fe0a5); transition: width 1s linear; }

.token-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel2); border: 1px solid #39415a; border-radius: 10px;
  padding: 5px 5px 5px 12px; flex-shrink: 0;
}
.token-chip .mono { font-family: var(--mono); font-size: 13px; color: var(--muted); line-height: 1; padding: 5px 0; }
.token-chip .btn { padding: 5px 11px; font-size: 12.5px; }

.data-row .btn { flex-shrink: 0; }

.chat {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 52vh; min-height: 180px; overflow-y: auto;
  padding: 16px 14px; background: rgba(9, 12, 20, .72);
  border: 1px solid var(--border); border-radius: 16px;
  scrollbar-width: thin; scrollbar-color: rgba(109,157,255,.35) transparent;
}
.chat::-webkit-scrollbar { width: 8px; }
.chat::-webkit-scrollbar-thumb { background: rgba(109,157,255,.3); border-radius: 8px; }
.chat::-webkit-scrollbar-track { background: transparent; }

.msg {
  position: relative;
  max-width: min(78%, 540px); padding: 9px 13px 7px; border-radius: 16px;
  font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}
.msg .who {
  display: block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .7px; opacity: .6; margin-bottom: 2px; font-weight: 600;
}
.msg .t { display: block; font-size: 10.5px; opacity: .55; margin-top: 3px; text-align: right; }

/* сообщения собеседника — чуть темнее */
.msg.them {
  align-self: flex-start; background: var(--panel3);
  border: 1px solid var(--border); color: var(--text);
  border-bottom-left-radius: 5px;
}
/* свои сообщения — светлее */
.msg.me {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; border-bottom-right-radius: 5px;
  box-shadow: 0 4px 14px rgba(109,157,255,.22);
}

.msg.new { animation: msgin .22s ease-out; }
@keyframes msgin {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.chat-closed {
  align-self: center; padding: 7px 16px; margin: 4px 0;
  border-radius: 20px; background: rgba(224,85,85,.1);
  border: 1px solid rgba(224,85,85,.35); color: #ffb3b3;
  font-size: 13px; text-align: center; white-space: normal;
}

.ticket-status {
  display: inline-block; padding: 6px 16px; margin-bottom: 10px;
  border-radius: 20px; font-size: 12.5px; font-weight: 600;
  border: 1px solid transparent;
}
.ticket-status.pending { background: rgba(255,193,69,.12); border-color: rgba(255,193,69,.45); color: #ffd98a; }
.ticket-status.open { background: rgba(53,194,106,.13); border-color: rgba(53,194,106,.4); color: #8fe6b0; }
.ticket-status.closed { background: rgba(224,85,85,.1); border-color: rgba(224,85,85,.35); color: #ffb3b3; }

.tstat { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; margin-right: 4px; }
.tstat.pending { background: rgba(255,193,69,.15); color: #ffd98a; }
.tstat.open { background: rgba(53,194,106,.15); color: var(--green); }
.tstat.closed { background: rgba(138,147,162,.18); color: var(--muted); }

.warn-note {
  background: rgba(255, 193, 69, .08); border: 1px solid rgba(255, 193, 69, .3);
  border-radius: 10px; padding: 10px 13px; font-size: 13px; color: #ffd98a;
}
.guarantee-box {
  display: flex; align-items: center; gap: 9px; width: fit-content;
  margin: 0 0 14px; padding: 8px 11px; border: 1px solid rgba(53,194,106,.25);
  border-radius: 10px; background: rgba(53,194,106,.08); color: #b8efca; font-size: 13px;
}
.guarantee-box b { color: var(--green); font-family: var(--mono); font-size: 12px; }
.guarantee-box .btn { margin-left: auto; padding: 5px 12px; font-size: 12.5px; flex-shrink: 0; }
.guarantee-box.cancelled {
  border-color: rgba(224,85,85,.35); background: rgba(224,85,85,.08); color: #ffb9b9;
}
.guarantee-box.cancelled .guarantee-dot { background: var(--red); box-shadow: none; animation: none; }
.guarantee-box.cancelled b { color: var(--red); font-family: inherit; font-size: 13px; }
.guarantee-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(53,194,106,.8); }
.guarantee-box.expired { border-color: rgba(224,85,85,.3); background: rgba(224,85,85,.08); color: #ffb0b0; }
.guarantee-box.expired b { color: var(--red); }
.guarantee-box.expired .guarantee-dot { background: var(--red); box-shadow: 0 0 10px rgba(224,85,85,.65); }
.profile-guarantee { margin-top: -6px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 11px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; }
tbody tr { transition: background .12s; }
tr:hover td { background: rgba(255,255,255,.03); }
td.mono, span.mono { font-family: var(--mono); word-break: break-all; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2.5px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.yes, .badge.active { background: rgba(53,194,106,.15); color: var(--green); }
.badge.no { background: rgba(138,147,162,.15); color: var(--muted); }
.badge.sold { background: rgba(224,85,85,.15); color: var(--red); }
.badge.price { background: rgba(79,140,255,.16); color: #9cc0ff; font-size: 13.5px; padding: 4px 13px; }

.tabs { display: flex; gap: 5px; margin-bottom: 24px; padding: 5px; background: rgba(19,24,35,.7); border: 1px solid var(--border); border-radius: 14px; overflow-x: auto; }
.tab {
  padding: 9px 15px; cursor: pointer; color: var(--muted); font-size: 14px; white-space: nowrap;
  border-radius: 10px; transition: color .15s, background .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); background: rgba(109,157,255,.14); box-shadow: inset 0 0 0 1px rgba(109,157,255,.16); }

.conf-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 10px;
  padding: 13px 15px; margin-bottom: 9px;
}
.conf-item .info { flex: 1; }
.conf-item .title { font-size: 14px; font-weight: 600; }
.conf-item .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.alert { padding: 12px 15px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.alert.error { background: rgba(224,85,85,.1); border: 1px solid rgba(224,85,85,.35); color: #ff9c9c; }
.alert.success { background: rgba(53,194,106,.09); border: 1px solid rgba(53,194,106,.3); color: #7fe0a5; }
.hidden { display: none !important; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
  position: relative; overflow: hidden;
  background: linear-gradient(145deg, rgba(31,42,62,.92), rgba(18,23,35,.82)); border: 1px solid var(--border); border-radius: 17px; padding: 21px;
  box-shadow: 0 14px 34px rgba(0,0,0,.2);
}
.stat::after { content: ''; position: absolute; width: 110px; height: 110px; right: -40px; top: -48px; border-radius: 50%; background: rgba(109,157,255,.11); }
.stat .num { font-size: 34px; font-weight: 750; letter-spacing: -1px; }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 2px; }

.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 18px; }
.listing-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  transition: transform .18s, border-color .18s;
}
.listing-card:hover { transform: translateY(-3px); border-color: #39456a; }
.listing-card h3 { font-size: 16.5px; }
.listing-card p { color: var(--muted); font-size: 13.5px; white-space: pre-wrap; flex: 1; }

.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 20px 10px; }
.footer a { color: var(--accent); font-weight: 600; }

.token-entry { max-width: 560px; margin: 70px auto 48px; text-align: center; padding: 42px 38px; }
.token-entry h1 { font-size: clamp(29px, 6vw, 42px); letter-spacing: -1.2px; margin-bottom: 8px; }
.token-entry > p { color: var(--muted); font-size: 14.5px; margin-bottom: 22px; }

.modal-bg {
  position: fixed; inset: 0; background: rgba(5, 7, 10, 0.72); z-index: 50;
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #151b29; border: 1px solid var(--border-strong); border-radius: 19px;
  padding: 26px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
.modal h3 { margin-bottom: 16px; font-size: 17px; }

.result-box {
  background: #12151d; border: 1px solid var(--border); border-radius: 10px;
  padding: 13px 15px; font-family: var(--mono); font-size: 13px;
  white-space: pre-wrap; word-break: break-all;
  max-height: 260px; overflow-y: auto; margin-top: 4px;
}
input[type=checkbox] { width: auto; accent-color: var(--accent); cursor: pointer; }

.toolbar { padding: 10px 12px; background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; }
.toolbar .btn { padding: 6px 13px; font-size: 13px; }
.sel-count { font-size: 13px; color: var(--muted); margin-left: auto; }

/* стилизованный выбор файла вместо нативной белой кнопки */
.file-btn { position: relative; display: inline-flex; align-items: center; cursor: pointer; overflow: hidden; }
.file-btn input[type=file] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; margin: 0; padding: 0; border: none;
}
#backups-list .data-row .v { font-size: 13px; }
#backups-list input[type=checkbox] { flex: 0 0 auto; }

/* ритм между рядами кнопок/полей внутри карточек */
.card > .row { margin-top: 12px; margin-bottom: 12px; }
.card h2 + .row, .card > .row:first-child { margin-top: 0; }
.card > .row:last-child { margin-bottom: 0; }
.row > input, .row > select { min-width: 0; }

.conf-item .btn { flex-shrink: 0; }

@media (max-width: 640px) {
  .header { padding: 10px 12px; gap: 10px; }
  .header nav { max-width: 100%; overflow-x: auto; }
  .header nav a { padding: 7px 10px; font-size: 12.5px; }
  .seller-btn { padding: 7px 10px; font-size: 12px; }
  .container { padding: 24px 12px 58px; }
  .card { padding: 18px; border-radius: 15px; }
  .token-entry { margin: 34px auto 30px; padding: 30px 19px; }
  .row > .btn, .row > a.btn { flex: 0 1 auto; min-width: 0; }
  .data-row { align-items: flex-start; flex-wrap: wrap; }
  .data-row .v { min-width: calc(100% - 100px); }
  .data-row .btn { margin-left: auto; }
  .guard-code { font-size: 38px; letter-spacing: 7px; }
  .data-row .k { min-width: 78px; }
  .news-box { left: 14px; right: 14px; max-width: none; }
  .msg { max-width: 90%; }
  .table-wrap { margin: 0 -18px; padding: 0 18px; }
}

.news-box {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  width: 340px; max-height: 70vh; overflow-y: auto;
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0,0,0,.6);
  padding: 16px;
  animation: newsIn .3s ease;
  overflow: hidden;
}
@keyframes newsIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.news-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 14px; }
.news-close {
  background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1;
}
.news-close:hover { color: var(--text); }
.news-item { padding: 10px 0; border-top: 1px solid var(--border); }
.news-item:first-child { border-top: none; padding-top: 0; }
.news-title { font-size: 14px; font-weight: 600; }
.news-text { font-size: 13px; color: var(--muted); margin-top: 3px; white-space: pre-wrap; }
.news-date { font-size: 11.5px; color: var(--muted); opacity: .7; margin-top: 4px; }
.news-progress {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 30s linear;
}

.acc-card { border-left: 3px solid var(--accent); }
