:root {
  --bg: #f5f8fb;
  --panel: #ffffff;
  --panel-soft: #f8fbfd;
  --line: #dfe8f0;
  --text: #0d2b50;
  --muted: #657992;
  --accent: #00a8b5;
  --accent-dark: #0571af;
  --success: #17a66a;
  --danger: #e85a63;
  --warning: #e7a536;
  --shadow: 0 16px 45px rgba(19, 48, 79, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

body.auth-mode {
  display: block;
}

body.auth-mode .sidebar,
body.auth-mode .topbar {
  display: none;
}

body.auth-mode .app-shell {
  min-height: 100vh;
}

body.auth-mode .view {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.sidebar {
  min-height: 100vh;
  padding: 28px 20px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
}

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

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  letter-spacing: 0;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  box-shadow: var(--shadow);
}

.brand strong {
  display: block;
  font-size: 32px;
  line-height: 1;
}

.brand span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  border: 0;
  background: transparent;
  color: var(--text);
  min-height: 50px;
  padding: 0 16px;
  border-radius: 16px;
  text-align: left;
  font-weight: 700;
}

.nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 12px 25px rgba(0, 125, 177, 0.22);
}

.is-hidden {
  display: none !important;
}

.coin-card {
  margin-top: auto;
  border-radius: 24px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  padding: 22px;
}

.coin {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  color: white;
  font-weight: 900;
  font-size: 27px;
  background: radial-gradient(circle at 35% 25%, #83edf1, #0698ad 58%, #07628e);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.12), 0 15px 25px rgba(0, 139, 168, 0.22);
}

.coin-card p,
.muted {
  color: var(--muted);
}

.app-shell {
  min-width: 0;
}

.topbar {
  min-height: 82px;
  padding: 0 30px;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
}

.menu-button,
.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  font-weight: 700;
  min-width: 0;
}

#greeting,
#topUserName {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#topBankBalance {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: var(--accent);
  font-size: 12px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(145deg, #efc394, #7e4d2f);
}

.view {
  padding: 26px 30px 42px;
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 32px;
  margin-bottom: 0;
}

h2 {
  font-size: 22px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: 1.25fr 0.75fr;
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel,
.listing-card,
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.hero-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.wallet-art {
  width: 126px;
  height: 92px;
  border-radius: 20px;
  background: linear-gradient(145deg, #86eced, #1494b3);
  position: relative;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.08);
}

.wallet-art::before {
  content: "";
  position: absolute;
  width: 92px;
  height: 44px;
  left: 20px;
  top: -16px;
  border-radius: 12px;
  background: linear-gradient(145deg, #0d94c8, #064b89);
  transform: rotate(-9deg);
  z-index: -1;
}

.big-number {
  font-size: 54px;
  font-weight: 900;
  line-height: 1;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.action-card {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 800;
  padding: 18px;
  text-align: left;
}

.action-card span {
  display: block;
  color: var(--accent-dark);
  font-size: 26px;
  margin-bottom: 8px;
}

.stat-card {
  padding: 20px;
}

.stat-card strong {
  display: block;
  font-size: 32px;
  margin-top: 8px;
}

.filters {
  display: grid;
  grid-template-columns: 1.5fr 180px 160px 150px;
  gap: 12px;
  margin-bottom: 18px;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.tab {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--text);
  padding: 10px 18px;
}

.tab.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  padding: 13px 15px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.button,
.secondary-button,
.danger-button {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  font-weight: 800;
}

.button {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 10px 20px rgba(0, 132, 176, 0.18);
}

.secondary-button {
  color: var(--accent-dark);
  background: #eefafd;
  border: 1px solid #cdeef4;
}

.danger-button {
  color: #b72d37;
  background: #fff1f2;
  border: 1px solid #ffd2d6;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.listing-card {
  overflow: hidden;
}

.listing-image {
  height: 160px;
  background: linear-gradient(145deg, #e7f1f5, #c8edf0);
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  font-weight: 900;
  position: relative;
}

.listing-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.listing-body {
  padding: 16px;
}

.listing-body h3 {
  margin-bottom: 7px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef4f8;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status-active,
.status-paid,
.status-completed {
  color: var(--success);
  background: #eaf9f2;
}

.status-sold {
  color: var(--accent-dark);
  background: #edf7ff;
}

.status-hidden,
.status-rejected,
.status-deleted,
.status-failed,
.status-rollbacked {
  color: var(--danger);
  background: #fff1f2;
}

.status-pending,
.status-new,
.status-processing,
.status-cancelled {
  color: var(--warning);
  background: #fff8e9;
}

.listing-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.price {
  color: var(--accent-dark);
  font-size: 24px;
  font-weight: 900;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

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

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

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

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.empty {
  padding: 30px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  min-width: 260px;
  max-width: 420px;
  padding: 15px 18px;
  border-radius: 16px;
  color: white;
  background: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.auth-card {
  width: min(460px, calc(100vw - 32px));
  padding: 28px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}

.auth-tabs .tab {
  text-align: center;
}

.auth-form {
  display: grid;
  gap: 14px;
}

@media (max-width: 1100px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    z-index: 20;
    transform: translateX(-100%);
    transition: 0.2s ease;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .listing-grid,
  .quick-actions,
  .filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .view,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .top-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  #topBankBalance {
    max-width: 100%;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .listing-grid,
  .quick-actions,
  .filters,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero-balance {
    align-items: flex-start;
    flex-direction: column;
  }

  .big-number {
    font-size: 42px;
  }

  .table {
    min-width: 760px;
  }

  .table-wrap {
    overflow-x: auto;
  }
}
