:root {
  color-scheme: dark;
  --bg: #1c1c1e;
  --surface: #2c2c2e;
  --surface-elevated: #3a3a3c;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --danger: #ff453a;
  --success: #30d158;
  --warning: #ffd60a;
  --border: #48484a;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --transition: 0.22s ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

.app-shell {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 16px 32px;
}

.top-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.brand {
  text-align: center;
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.12em;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.tag {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--muted);
}

.hamburger {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 0;
  transition: background var(--transition);
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.hamburger:hover {
  background: var(--surface-elevated);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 90;
  backdrop-filter: blur(2px);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: min(300px, 86vw);
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 100;
  transform: translateX(-105%);
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

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

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-title {
  font-weight: 600;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 6px;
}

.nav-item {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition);
}

.nav-item:hover,
.nav-item.active {
  background: var(--surface-elevated);
}

.screen {
  display: none;
  animation: fadeIn 0.2s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

h2,
h3 {
  margin-top: 0;
}

.section-subtitle {
  margin: 20px 0 10px;
  font-size: 0.95rem;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.card-soft {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.form-card .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field span {
  font-size: 0.9rem;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.status-line {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-line.error {
  color: var(--danger);
}

.hero-auth h2 {
  margin: 8px 0 12px;
  font-size: 1.6rem;
}

.hero-kicker {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.btn-lg {
  width: 100%;
  padding: 14px 18px;
  font-size: 1rem;
}

.auction-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.auction-hero h2 {
  margin: 0 0 4px;
}

.state-msg {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px;
}

.state-msg.error {
  color: var(--danger);
}

.lots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.lot-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.lot-card:hover {
  border-color: rgba(10, 132, 255, 0.55);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.lot-card-media {
  position: relative;
}

.lot-bids-pill {
  position: absolute;
  left: 10px;
  top: 10px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  color: var(--text);
}

.lot-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--bg);
}

.lot-gallery {
  position: relative;
}

.gallery-viewport {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg);
}

.gallery-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.gallery-slide.active {
  opacity: 1;
  pointer-events: auto;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.gallery-prev {
  left: 8px;
}

.gallery-next {
  right: 8px;
}

.gallery-dots {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  z-index: 2;
}

.gallery-dot {
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
}

.gallery-dot.active {
  background: var(--accent);
}

.gallery-count {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem;
  z-index: 2;
}

.modal-gallery .modal-image {
  margin-bottom: 0;
}

.lot-mod-actions {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tx-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tx-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg);
}

.tx-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.tx-type {
  font-weight: 600;
  text-transform: capitalize;
}

.tx-amount {
  font-weight: 700;
}

.tx-credit .tx-amount {
  color: var(--success);
}

.tx-debit .tx-amount {
  color: var(--danger);
}

.tx-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.tx-pending {
  border-color: rgba(255, 214, 10, 0.45);
}

.tx-rejected {
  border-color: rgba(255, 69, 58, 0.45);
  opacity: 0.85;
}

.mod-amount {
  font-weight: 700;
  margin: 6px 0;
}

.mod-lot-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.mod-lot-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border);
}

.mod-lot-body {
  flex: 1;
  min-width: 0;
}

.lot-content {
  padding: 12px;
}

.lot-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.lot-title {
  margin: 0 0 8px;
  font-size: 1rem;
}

.lot-desc-preview {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.lot-price-block {
  margin-bottom: 10px;
}

.lot-price-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 2px;
}

.lot-price {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--success);
}

.lot-step-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.lot-timer-wrap {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.lot-timer-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.lot-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.lot-timer.timer-urgent {
  color: var(--warning);
}

.lot-timer.timer-ended,
.lot-timer.lot-timer-open {
  color: var(--muted);
  font-weight: 600;
}

.lot-card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: auto;
}

.btn-bid-card {
  width: 100%;
}

.lot-meta {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.modal-stat {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.modal-stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.modal-stat-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--success);
}

.modal-timer {
  font-size: 0.95rem;
}

.bid-form {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.my-lot-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 600;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-pending {
  background: rgba(255, 214, 10, 0.18);
  color: var(--warning);
}

.status-active,
.status-completed {
  background: rgba(48, 209, 88, 0.18);
  color: var(--success);
}

.status-rejected {
  background: rgba(255, 69, 58, 0.18);
  color: var(--danger);
}

.status-won,
.status-shipping {
  background: rgba(10, 132, 255, 0.18);
  color: var(--accent);
}

.profile-top {
  display: flex;
  gap: 14px;
  align-items: center;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg);
}

.profile-label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.profile-value {
  margin: 0 0 10px;
  font-weight: 600;
}

.balance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.balance-card {
  text-align: center;
}

.balance-label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.balance-value {
  font-size: 1.35rem;
  font-weight: 700;
}

.muted-value {
  color: var(--muted);
}

.wallet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.panel {
  margin-top: 12px;
}

.qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 12px 0;
}

.qr-mock {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  border: 2px dashed var(--border);
  background: repeating-linear-gradient(
    45deg,
    var(--bg),
    var(--bg) 8px,
    var(--surface-elevated) 8px,
    var(--surface-elevated) 16px
  );
}

.qr-caption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.requisites {
  font-size: 0.9rem;
  line-height: 1.5;
}

.moderator-panel h3 {
  margin-bottom: 12px;
}

.accordion {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--bg);
}

.accordion summary {
  cursor: pointer;
  font-weight: 600;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.mod-item .mod-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.inline-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.my-lot-item .lot-card {
  border: 0;
  background: transparent;
}

.deal-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 8px;
}

.delivery-form,
.track-form {
  display: grid;
  gap: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.modal-content {
  position: relative;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
  margin: 0;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.modal-image {
  width: 100%;
  border-radius: 12px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  margin-bottom: 12px;
  background: var(--bg);
}

@media (max-width: 640px) {
  .balance-grid,
  .wallet-actions {
    grid-template-columns: 1fr;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }

  .screen-head {
    flex-direction: column;
    align-items: stretch;
  }
}
