﻿@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --bg: #f7f5f0;
  --bg-2: #f0efe9;
  --ink: #14120f;
  --muted: #6d675f;
  --accent: #1f7a55;
  --accent-2: #f9b24e;
  --card: #ffffff;
  /* Higher contrast borders / separators. */
  --stroke: #d8cfbf;
  --stroke-strong: #b9ad97;
  /* Slightly crisper shadow so cards/controls read better on beige background. */
  --shadow: 0 26px 60px rgba(24, 20, 14, 0.10), 0 1px 0 rgba(255, 255, 255, 0.75) inset;
  --shadow-soft: 0 14px 34px rgba(24, 20, 14, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 0%, #f9efe2, var(--bg) 55%) fixed;
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  z-index: -1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 40px;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(31, 122, 85, 0.15);
}

.brand-title {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.nav a {
  margin-right: 16px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
}

.nav a.active {
  color: var(--ink);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
}

@media (max-width: 680px) {
  .topbar {
    padding: 14px 16px;
    gap: 12px;
  }

  .brand {
    min-width: 0;
  }

  .brand-title {
    max-width: 60vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-sub {
    display: none;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .user-chip {
    font-size: 12px;
    padding: 6px 10px;
  }

  .logout {
    font-size: 12px;
  }

  .nav {
    order: 3;
    width: 100%;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-bottom: 4px;
  }

  .nav a {
    flex: 0 0 auto;
    margin-right: 0;
    padding: 8px 10px;
    border: 1px solid var(--stroke);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.6);
  }

  .nav a.active {
    border-bottom: none;
    padding-bottom: 8px;
    background: rgba(31, 122, 85, 0.12);
    border-color: rgba(31, 122, 85, 0.28);
  }

  .content {
    padding: 0 16px 28px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 16px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .pill {
    align-self: flex-start;
    max-width: 100%;
    word-break: break-word;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
  }

  .actions {
    flex-wrap: wrap;
  }

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

  .hide-sm {
    display: none !important;
  }

  .card {
    padding: 16px;
    border-radius: 16px;
  }

  .table {
    font-size: 13px;
  }

  .table th,
  .table td {
    padding: 8px 10px;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sound-toggle {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.sound-test {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.sound-toggle.on {
  border-color: rgba(249, 178, 78, 0.55);
  background: rgba(249, 178, 78, 0.16);
  color: #7a4a00;
}

.sound-toggle.off {
  background: rgba(120, 120, 120, 0.12);
  color: #4b4b4b;
  border: 1px solid rgba(120, 120, 120, 0.28);
}

.user-chip {
  background: #fff6e5;
  color: #8a5b11;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.logout {
  text-decoration: none;
  color: var(--accent);
}

.content {
  padding: 0 40px 40px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.hero h1 {
  margin: 0 0 6px 0;
  font-size: 32px;
}

.pill {
  padding: 6px 14px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  font-size: 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.overview-top {
  /* Two primary cards on the dashboard (balance + profit). */
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}

@media (max-width: 980px) {
  .overview-top {
    grid-template-columns: 1fr;
  }
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}

@media (max-width: 520px) {
  .split {
    grid-template-columns: 1fr;
  }
}

.triple {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-top: 10px;
}

@media (max-width: 768px) {
  .triple {
    grid-template-columns: 1fr;
  }
}

.mini-card {
  background: var(--bg);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset;
}

.mini-card .big {
  font-size: 28px;
  line-height: 1.1;
}

.profit-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 10px;
  align-items: start;
}

.profit-right {
  border-left: 1px dashed var(--stroke);
  padding-left: 14px;
}

.profit-list {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.profit-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.profit-item .val {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.profit-item .val.neg {
  color: #b02020;
}

.profit-item .val.pos {
  color: var(--accent);
}

@media (max-width: 768px) {
  .profit-panel {
    grid-template-columns: 1fr;
  }
  .profit-right {
    border-left: none;
    padding-left: 0;
    border-top: 1px dashed var(--stroke);
    padding-top: 12px;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--stroke-strong);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.card > h3 {
  margin: 0 0 10px 0;
}

.card-header h3 {
  margin: 0;
}

.card.compact {
  padding: 16px;
}

.card.compact .triple,
.card.compact .profit-panel {
  margin-top: 8px;
}

.balance-card,
.profit-card {
  min-height: 210px;
}

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

.balance-card .triple {
  /* Make the inner mini-cards stretch to fill the card height (no big empty bottom). */
  flex: 1;
  align-items: stretch;
}

.balance-card .mini-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
}

.balance-card .mini-card .muted {
  font-size: 12px;
  line-height: 1.35;
}

.balance-card .mini-card .total {
  margin-top: 10px;
}

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

.profit-card .profit-panel {
  flex: 1;
  align-items: stretch;
}

.profit-card .profit-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.profit-card .profit-right {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.actions {
  display: flex;
  gap: 10px;
}

.btn {
  background: var(--accent);
  color: white;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(10, 10, 10, 0.10);
  box-shadow: none; /* no glow/shadow behind buttons */
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, border-color 120ms ease;
}

.btn:hover {
  filter: brightness(1.05);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 3px solid rgba(33, 150, 83, 0.25);
  outline-offset: 2px;
}

.btn-primary {
  box-shadow: none;
}

.btn-login {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
}

.btn.tiny {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.btn.danger {
  background: #b02020;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--stroke-strong);
  color: var(--ink);
  box-shadow: none;
}

.btn.ghost:hover {
  background: rgba(20, 18, 15, 0.04);
  border-color: rgba(20, 18, 15, 0.28);
}

.btn.ghost:active {
  transform: translateY(1px);
}

.btn.ghost.danger {
  border-color: rgba(176, 32, 32, 0.35);
  background: rgba(176, 32, 32, 0.06);
  color: #7f1212;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--stroke);
  text-align: left;
}

.table th {
  font-weight: 700;
  color: #2f2821;
  background: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid var(--stroke-strong);
}

.table tr:hover td {
  background: rgba(249, 178, 78, 0.06);
}

.table th.col-actions,
.table td.col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.ads-table th.col-actions,
.ads-table td.col-actions {
  /* Keep a stable width so action buttons don't reflow on status changes. */
  width: 280px;
  /* Allow the action buttons to wrap inside the cell (no horizontal scrolling). */
  white-space: normal;
}

.ads-table {
  table-layout: fixed; /* prevents long IDs from stretching columns */
}

.ads-table th.col-methods,
.ads-table td.col-methods {
  width: 180px;
  max-width: 180px;
}

.ads-table .methods-clip {
  /* Show all payment methods (wrap; no truncation). */
  white-space: normal;
  overflow: visible;
  line-height: 1.25;
  word-break: break-word;
}

.ads-table .col-order-num .ads-id-btn {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.cell-actions {
  display: inline-flex;
  gap: 8px;
  justify-content: flex-end;
}

.ads-actions {
  gap: 10px;
}

/* Ads page: pack action buttons into a compact, non-scrolling grid. */
.ads-table .cell-actions.ads-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  justify-content: end;
  align-items: center;
}

.ads-table .cell-actions.ads-actions .btn {
  width: 100%;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ads-table .cell-actions.ads-actions .ads-btn-price,
.ads-table .cell-actions.ads-actions .ads-btn-toggle,
.ads-table .cell-actions.ads-actions .ads-btn-dup,
.ads-table .cell-actions.ads-actions .ads-btn-auto {
  min-width: 0; /* override fixed min-widths used elsewhere */
}

.ads-actions .ads-btn-price {
  min-width: 56px;
  text-align: center;
}

.ads-actions .ads-btn-toggle {
  min-width: 104px; /* keeps rows stable */
  text-align: center;
}

.ads-actions .ads-btn-dup {
  min-width: 72px;
  text-align: center;
}

.ads-actions .ads-btn-auto {
  min-width: 104px; /* keep rows stable */
  text-align: center;
}

.ads-actions .ads-btn-auto-settings {
  min-width: 44px;
  text-align: center;
  font-weight: 700;
}

.ads-actions .ads-btn-auto.ads-auto-on {
  background: rgba(27, 138, 74, 0.14);
  color: #145a34;
  border: 1px solid rgba(27, 138, 74, 0.28);
}

.ads-actions .ads-btn-auto.ads-auto-off {
  background: rgba(120, 120, 120, 0.12);
  color: #4b4b4b;
  border: 1px solid rgba(120, 120, 120, 0.28);
}

.ads-actions .ads-btn-auto.ads-auto-paused {
  background: rgba(249, 178, 78, 0.20);
  color: #6a3f00;
  border: 1px solid rgba(249, 178, 78, 0.45);
}

.auto-modal {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auto-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}

.auto-row.auto-row-actions {
  grid-template-columns: auto auto;
  justify-content: start;
  align-items: center;
}

.auto-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.auto-check {
  width: 18px;
  height: 18px;
  margin-top: 8px;
}

.auto-info {
  font-size: 12px;
  line-height: 1.35;
  padding-top: 2px;
}

@media (max-width: 720px) {
  .auto-row {
    grid-template-columns: 1fr;
  }
  .auto-row.auto-row-actions {
    grid-template-columns: 1fr;
  }
}

.ads-actions .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.ads-actions .ads-btn-toggle.ads-toggle-on {
  /* Ad is online now (button says "Р’С‹РєР»СЋС‡РёС‚СЊ") */
  background: rgba(249, 178, 78, 0.25);
  color: #6a3f00;
  border: 1px solid rgba(249, 178, 78, 0.55);
}

.ads-actions .ads-btn-toggle.ads-toggle-off {
  /* Ad is offline now (button says "Р’РєР»СЋС‡РёС‚СЊ") */
  background: rgba(120, 120, 120, 0.12);
  color: #4b4b4b;
  border: 1px solid rgba(120, 120, 120, 0.28);
}

.ads-actions .ads-btn-toggle.ads-toggle-on:hover,
.ads-actions .ads-btn-toggle.ads-toggle-off:hover {
  filter: brightness(1.03);
}

.center-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.parser-preset {
  display: flex;
  flex-direction: column;
}

.parser-preset-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.parser-preset-actions .btn {
  padding: 7px 12px;
}

.multi-select {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.multi-select-top {
  display: flex;
  gap: 8px;
  align-items: center;
}

.multi-select-top input {
  flex: 1 1 auto;
}

.multi-select-top .btn.tiny {
  padding: 8px 10px;
  border-radius: 10px;
}

.multi-select-list {
  display: none;
  border: 1px solid var(--stroke);
  background: #fff;
  border-radius: 10px;
  padding: 6px;
  max-height: 170px;
  overflow: auto;
}

.multi-select.open .multi-select-list {
  display: block;
}

.multi-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}

.multi-select-item:hover {
  background: rgba(31, 122, 85, 0.06);
}

.multi-select-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.filter-order-number input {
  width: 100%;
}

.col-order-num {
  width: 110px;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--ink);
  white-space: nowrap;
}

.badge.appeal {
  border-color: rgba(176, 32, 32, 0.35);
  background: rgba(176, 32, 32, 0.08);
  color: #7f1212;
}

.badge.pending {
  border-color: rgba(249, 178, 78, 0.55);
  background: rgba(249, 178, 78, 0.16);
  color: #7a4a00;
}

.badge.trading {
  border-color: rgba(31, 122, 85, 0.45);
  background: rgba(31, 122, 85, 0.10);
  color: #0f5a3c;
}

@media (max-width: 768px) {
  .col-order-num {
    width: 90px;
    max-width: 90px;
  }
}

.filters label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

input,
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--stroke-strong);
  border-radius: 8px;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(31, 122, 85, 0.55);
  box-shadow: 0 0 0 4px rgba(31, 122, 85, 0.14), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

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

.notice {
  border: 1px solid var(--stroke-strong);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-soft);
  margin: 0 0 14px 0;
}

.notice-title {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.notice-body {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.notice-link {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(20, 18, 15, 0.25);
  padding-bottom: 1px;
  margin-left: 8px;
  white-space: nowrap;
}

.notice-link:hover {
  border-bottom-color: rgba(20, 18, 15, 0.5);
}

.notice-warn {
  border-color: rgba(249, 178, 78, 0.55);
  background: radial-gradient(circle at 30% 0%, rgba(249, 178, 78, 0.20), rgba(255, 255, 255, 0.78) 55%);
}

.notice-warn .notice-title {
  color: #7a4a00;
}

.big {
  font-size: 32px;
  font-weight: 600;
}

.total {
  margin-top: 10px;
  font-weight: 600;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 32px;
  width: min(420px, 90vw);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin-top: 16px;
}

.login-card form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.login-card button {
  margin-top: 6px;
}

.btn:disabled,
button.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.error {
  background: #ffe5e5;
  color: #b02020;
  padding: 8px 10px;
  border-radius: 8px;
  margin-top: 10px;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.35);
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--card);
  padding: 20px;
  border-radius: 16px;
  width: min(420px, 90vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-body {
  overflow-y: auto;
  overflow-x: hidden; /* prevent horizontal scrolling inside modals */
  padding-right: 4px; /* keep scrollbar from overlapping content */
}

.modal-body .table-wrap {
  max-height: 60vh;
  overflow: auto;
}

.modal-body .table {
  table-layout: fixed;
}

.modal-body .table th,
.modal-body .table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-body .table td input,
.modal-body .table td select {
  min-width: 0;
}

.merge-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
  margin-top: 10px;
  max-width: 100%;
  min-width: 0;
}

.merge-row > div {
  min-width: 0;
}

.merge-row select {
  width: 100%;
  min-width: 0;
}

.merge-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
  max-width: 100%;
}

.merge-confirm {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  margin-top: 10px;
  flex-wrap: wrap;
}

.merge-confirm .muted {
  margin-right: 6px;
}

/* Orders -> Chat modal */
.chat-modal-content {
  max-width: 720px;
}

.chat-messages {
  height: 340px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
}

.chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 10px;
  align-items: center;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  max-width: 90%;
}

.chat-msg .meta {
  font-size: 11px;
  color: var(--muted);
}

.chat-msg .bubble {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: #fff;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg.self {
  margin-left: auto;
  align-items: flex-end;
}

.chat-msg.self .bubble {
  background: rgba(31, 122, 85, 0.08);
  border-color: rgba(31, 122, 85, 0.30);
}

.chat-msg.sys .bubble {
  background: rgba(249, 178, 78, 0.10);
  border-color: rgba(249, 178, 78, 0.35);
}

@media (max-width: 768px) {
  .chat-modal-content {
    max-width: 96vw;
  }
  .chat-messages {
    height: 52vh;
  }
}

@media (max-width: 520px) {
  .merge-row {
    grid-template-columns: 1fr;
  }
  .merge-actions {
    justify-content: stretch;
  }
  .merge-actions button {
    width: 100%;
  }
  .merge-confirm {
    justify-content: stretch;
  }
  .merge-confirm button {
    width: 100%;
  }
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .content {
    padding: 0 20px 40px;
  }
}



