:root {
  --bg: #121212;
  --bg-row: #1e1e1e;
  --bg-row-hover: #252525;
  --bg-header: #181818;
  --text: #ececec;
  --muted: #9a9a9a;
  --border: #2e2e2e;
  --buy: #e53935;
  --buy-hover: #ff5252;
  --oos: #3a3a3a;
  --oos-text: #888;
  --green: #4caf50;
  --red: #ff5252;
  --yellow: #ffc107;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

a { color: inherit; text-decoration: none; }

.container {
  width: min(1200px, calc(100% - 24px));
  margin: 0 auto;
}

/* ── Header ── */
.site-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  flex-wrap: wrap;
  padding: 8px 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
}

.logo-icon { font-size: 1.3rem; }

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.store-notice {
  color: var(--muted);
  font-size: 0.85rem;
}

.lang-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.lang-switch a {
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.lang-switch a.active {
  background: #2a2a2a;
  color: var(--text);
}

.btn-bot {
  background: var(--buy);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
}

.btn-bot:hover { background: var(--buy-hover); }

/* ── Store ── */
.store-main {
  padding: 20px 0 48px;
}

.breadcrumb {
  margin: 0 0 16px;
  font-size: 0.9rem;
}

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

.breadcrumb a:hover { color: var(--text); }

.category-block {
  margin-bottom: 36px;
}

.category-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.category-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.category-head h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.product-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Product row (reference layout) ── */
.product-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-row);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  transition: background 0.12s;
}

.product-row:hover {
  background: var(--bg-row-hover);
}

.product-row.is-oos {
  opacity: 0.72;
}

.product-flag {
  flex: 0 0 36px;
  font-size: 1.5rem;
  line-height: 1;
  text-align: center;
}

.product-spec {
  flex: 1 1 200px;
  font-size: 0.92rem;
  font-weight: 500;
  min-width: 0;
  word-break: break-word;
}

.spec-sep {
  color: #555;
  margin: 0 2px;
}

.spec-default { color: var(--text); }
.spec-green { color: var(--green); }
.spec-red { color: var(--red); }
.spec-yellow { color: var(--yellow); }

.product-stock {
  flex: 0 0 auto;
  text-align: right;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.88rem;
}

.stock-num {
  color: var(--text);
  font-weight: 600;
}

.product-price {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  min-width: 72px;
  text-align: right;
}

.product-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-buy {
  background: var(--buy);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s;
}

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

.btn-oos {
  background: var(--oos);
  color: var(--oos-text);
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: 0.82rem;
  white-space: nowrap;
}

.btn-cart {
  font-size: 1.15rem;
  opacity: 0.55;
  padding: 4px;
  line-height: 1;
}

.btn-cart:hover { opacity: 1; }

.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--muted);
  background: var(--bg-row);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 28px;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-inner a {
  color: var(--buy);
  font-weight: 600;
}

.footer-inner a:hover { color: var(--buy-hover); }

.header-link {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.header-link:hover { color: var(--text); }

/* ── Auth ── */
.auth-page {
  display: flex;
  justify-content: center;
  padding: 32px 0 48px;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--bg-row);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.auth-hint {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-error {
  background: rgba(229, 57, 53, 0.15);
  border: 1px solid rgba(229, 57, 53, 0.4);
  color: #ff8a80;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}

.telegram-widget-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.auth-divider {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 16px 0;
}

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

.auth-form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

.auth-submit {
  width: 100%;
  margin-top: 8px;
  border: none;
  cursor: pointer;
}

.auth-switch {
  margin: 18px 0 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.auth-switch a {
  color: var(--buy);
  font-weight: 600;
}

/* ── Account ── */
.account-page { padding: 8px 0 48px; }

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

.account-head h1 {
  margin: 0;
  font-size: 1.6rem;
}

.logout-form { margin: 0; }

.card-panel {
  background: var(--bg-row);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 24px;
}

.account-info .info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.account-info .info-row:last-of-type { border-bottom: none; }

.info-label { color: var(--muted); }
.info-value { font-weight: 600; }
.info-value.accent { color: #4caf50; }

.link-telegram {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.link-telegram p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.account-info .btn-buy {
  display: inline-block;
  margin-top: 16px;
  text-align: center;
}

.section-title {
  margin: 0 0 14px;
  font-size: 1.2rem;
}

.orders-table-wrap { overflow-x: auto; padding: 0; }

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

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

.orders-table th {
  color: var(--muted);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.2);
}

.order-detail-row td {
  background: rgba(0, 0, 0, 0.15);
  font-size: 0.82rem;
}

.detail-label { color: var(--muted); margin-right: 8px; }

.order-content {
  display: inline-block;
  word-break: break-all;
  white-space: pre-wrap;
  color: #ccc;
}

.status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-delivered { background: rgba(76, 175, 80, 0.15); color: #81c784; }
.status-pending { background: rgba(255, 193, 7, 0.12); color: #ffd54f; }
.status-paid { background: rgba(33, 150, 243, 0.12); color: #64b5f6; }
.status-failed,
.status-cancelled { background: rgba(229, 57, 53, 0.12); color: #e57373; }

@media (max-width: 768px) {
  .orders-table th:nth-child(5),
  .orders-table td:nth-child(5) { display: none; }
}

@media (max-width: 768px) {
  .product-row {
    flex-wrap: wrap;
    padding: 12px;
  }

  .product-spec {
    flex: 1 1 calc(100% - 50px);
  }

  .product-stock,
  .product-price {
    font-size: 0.82rem;
  }

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

  .store-notice { display: none; }
}
