:root {
  --bg: #0b0f14;
  --bg-soft: #111720;
  --card: #161d27;
  --card-2: #1c2530;
  --border: #232e3b;
  --text: #e8eef5;
  --muted: #8a97a6;
  --accent: #5b8cff;
  --accent-2: #7c5bff;
  --ok: #3fb96b;
  --warn: #e0a526;
  --err: #e0525f;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 20% -10%, #142033 0%, var(--bg) 55%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1080px; margin: 0 auto; padding: 24px 20px 80px; }

/* Header */
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 0 28px;
}
.brand .logo {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
}
.brand h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -0.3px; }
.brand .sub { color: var(--muted); font-size: 13px; margin: 0; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card .hint { color: var(--muted); font-size: 13px; margin: 0 0 20px; }

/* Forms */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; color: var(--muted);
  margin-bottom: 6px; font-weight: 500;
}
input, select {
  width: 100%; padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text); font-size: 15px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.18);
}
select { appearance: none; cursor: pointer; }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform .1s, opacity .15s; width: 100%;
}
.btn:hover { opacity: .92; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--card-2); color: var(--text); border: 1px solid var(--border); }
.btn.small { width: auto; padding: 8px 12px; font-size: 13px; border-radius: 8px; }

/* Status pills */
.pill {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; text-transform: capitalize;
  background: var(--card-2); border: 1px solid var(--border); color: var(--muted);
}
.pill.created, .pill.awaiting_payment { color: var(--warn); border-color: rgba(224,165,38,.4); }
.pill.partially_paid { color: var(--warn); }
.pill.paid_pending_confirmations, .pill.awaiting { color: var(--accent); border-color: rgba(91,140,255,.4); }
.pill.confirmed { color: var(--accent); }
.pill.fulfilled { color: var(--ok); border-color: rgba(63,185,107,.4); }
.pill.expired, .pill.cancelled { color: var(--err); border-color: rgba(224,82,95,.4); }

/* Status page */
.status-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .status-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1020px) { .status-grid { grid-template-columns: 1fr 1fr 1fr; } }
.kv { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; word-break: break-all; }
.mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

/* Inline star icon (Telegram style) */
.star-icon { display: inline-block; width: 14px; height: 14px; vertical-align: -1px; margin: 0 1px; }

.qr { background: #fff; border-radius: 12px; padding: 12px; display: inline-flex; }
.qr img, .qr svg { width: 180px; height: 180px; }

/* Confirmations bar */
.confirm { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.confirm .dot.done { background: var(--ok); }

/* Tables (admin) */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tr:hover td { background: rgba(255,255,255,.012); }

/* Utilities */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.flex { display: flex; gap: 8px; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; }
.mt { margin-top: 16px; } .mt-lg { margin-top: 28px; }
.section-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 24px 0 10px; }

/* Lang switch */
.lang {
  position: absolute; top: 20px; right: 24px;
  display: flex; gap: 6px;
}
.lang button {
  background: var(--card-2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 6px 10px; font-size: 12.5px; cursor: pointer;
}
.lang button.active { color: var(--text); border-color: var(--accent); }

/* Toast */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--card-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 18px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .25s;
  box-shadow: var(--shadow); max-width: 90vw; z-index: 60;
}
#toast.show { opacity: 1; }

.hidden { display: none !important; }

/* Footer / contact */
.footer {
  text-align: center;
  margin-top: 36px;
  padding: 16px 0 4px;
  color: var(--muted);
  font-size: 13px;
}
.footer a { color: var(--accent); }

/* Centered single-column layout for client pages */
.brand.center { justify-content: center; }
.card.center { margin-left: auto; margin-right: auto; }

/* Gift store */
.gift-nav { text-align: center; margin: 0 0 8px; }
.gift-nav a { color: var(--muted); font-size: 13px; }
.gift-nav a:hover { color: var(--text); }
.gift-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px; margin-top: 10px;
}
.gift-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: border-color .15s, transform .15s;
}
.gift-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.gift-media {
  position: relative; width: 100%; aspect-ratio: 1 / 1; background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.gift-media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.gift-media img.anim-hint { cursor: zoom-in; }
.gift-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.gift-name { font-size: 13.5px; font-weight: 600; }
.gift-num { font-size: 11.5px; color: var(--muted); }
.gift-price { font-size: 15px; font-weight: 700; color: var(--accent); }
.gift-action { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.gift-action .btn { flex: 1; }
.gift-action .added-note { font-size: 12.5px; font-weight: 600; color: var(--ok); }
.gift-action .added-note + .btn { flex: 0 0 auto; }
.gift-collection-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; margin-top: 26px;
}
.gift-collection-title .emoji { font-size: 18px; }
.gift-collection-title .count { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.cart-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--card); border-top: 1px solid var(--border);
  padding: 14px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.cart-bar .tot { font-weight: 700; color: var(--accent); }
.cart-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.cart-item img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.cart-item .rm { margin-left: auto; cursor: pointer; color: var(--err); font-weight: 700; }

/* Collections overview */
.collections-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px; margin-top: 8px;
}
.collection-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; transition: border-color .15s, transform .15s;
}
.collection-card:hover, .collection-card:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.collection-card .cover {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: var(--bg-soft);
}
.collection-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.collection-name { font-size: 14.5px; font-weight: 700; }
.collection-meta { color: var(--muted); }
.collection-from { color: var(--accent); font-weight: 700; font-size: 14px; }

/* Collection detail */
.collection-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; }
.collection-head .emoji { font-size: 26px; }
.collection-head h2 { font-size: 18px; margin: 0; }

.filters {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
  min-width: 0;
}
.filters select, .filters input {
  padding: 9px 10px; font-size: 13px; border-radius: 8px;
  min-width: 0;
}
.filters .f-sort { flex: 1 1 160px; width: auto; }
.filters .f-num { flex: 0 1 100px; width: 100px; }
.filters .f-search { flex: 1 1 160px; width: auto; min-width: 120px; }
.filters.attr-filters { margin-top: -6px; }
.filters .f-attr { flex: 1 1 150px; width: auto; min-width: 130px; }

.sentinel { text-align: center; padding: 20px 0 40px; min-height: 40px; }

/* Mobile: denser grids + smaller preview tiles so gift icons match phone viewports. */
@media (max-width: 640px) {
  .gift-grid {
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 10px;
  }
  .collections-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .gift-body { padding: 8px 10px 10px; gap: 4px; }
  .gift-name { font-size: 12.5px; }
  .gift-price { font-size: 13px; }
  .collection-body { padding: 10px 12px; }
  .collection-name { font-size: 13px; }
  .cart-bar { padding: 12px 14px; gap: 10px; }
}

/* Checkout modal */
.backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40;
}
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(520px, 92vw); max-height: 88vh; overflow-y: auto; z-index: 41;
}
