/* =========================================================
   IWishlist — design tokens
   Display: Unbounded / Body: Inter / Data: JetBrains Mono
   ========================================================= */

   :root {
    --bg: #FAF7FF;
    --surface: #FFFFFF;
    --surface-alt: #F1ECFB;
    --primary: #5B21B6;
    --primary-dark: #3D1477;
    --primary-soft: #EDE3FB;
    --accent: #E8368F;
    --accent-soft: #FCE3EE;
    --gold: #F5A623;
    --success: #2BB673;
    --danger: #E5484D;
    --text: #241934;
    --text-muted: #8C7FA3;
    --border: #E4DBF5;
    --shadow: 0 8px 24px rgba(91, 33, 182, 0.10);
    --shadow-lg: 0 20px 48px rgba(36, 25, 52, 0.22);
    --radius-lg: 22px;
    --radius-md: 14px;
    --radius-sm: 10px;
  }
  
  * { box-sizing: border-box; }
  
  html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    -webkit-tap-highlight-color: transparent;
  }
  
  body {
    min-height: 100vh;
    background-image:
      radial-gradient(circle at 100% 0%, rgba(232,54,143,0.08), transparent 40%),
      radial-gradient(circle at 0% 20%, rgba(91,33,182,0.08), transparent 45%);
    background-attachment: fixed;
  }
  
  h1, h2, h3 { font-family: 'Unbounded', 'Inter', sans-serif; margin: 0; }
  
  .muted { color: var(--text-muted); margin: 4px 0 0; font-size: 14px; }
  .optional { font-weight: 400; color: var(--text-muted); font-size: 12px; }
  
  /* ---------- layout shell ---------- */
  
  .page {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 16px 100px;
    min-height: 100vh;
  }
  
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 2px 18px;
  }
  
  .brand { display: flex; align-items: center; gap: 8px; }
  .brand-mark { font-size: 22px; }
  .brand-name {
    font-family: 'Unbounded', sans-serif;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.02em;
    color: var(--primary-dark);
  }
  
  .user-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 12px 6px 8px;
    font-size: 12px;
    color: var(--text-muted);
    box-shadow: var(--shadow);
  }
  .user-pill-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(43,182,115,0.18);
  }
  
  .section-head { padding: 4px 4px 18px; }
  .section-head h1 { font-size: 22px; letter-spacing: -0.01em; }
  
  /* ---------- empty / skeleton states ---------- */
  
  .empty-state {
    text-align: center;
    padding: 48px 20px;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
  }
  .empty-state .glyph { font-size: 36px; display: block; margin-bottom: 10px; }
  .empty-state h3 { font-size: 16px; margin-bottom: 6px; }
  .empty-state p { color: var(--text-muted); font-size: 13px; margin: 0; }
  
  .skeleton-card {
    height: 108px;
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
    background: linear-gradient(100deg, var(--surface-alt) 30%, #fff 50%, var(--surface-alt) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.3s infinite;
  }
  @keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
  
  /* ---------- wishlist "gift tag" card ---------- */
  
  .wishlists-stack { display: flex; flex-direction: column; gap: 18px; }
  
  .tag-card {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px 18px 16px;
    box-shadow: var(--shadow);
    margin-top: 12px;
  }
  
  /* scalloped stamp-edge signature */
  .tag-card::before {
    content: "";
    position: absolute;
    top: -9px; left: 14px; right: 14px;
    height: 18px;
    background-image: radial-gradient(circle, var(--surface) 9px, transparent 9.5px);
    background-size: 20px 18px;
    background-position: 0 -9px;
    background-repeat: repeat-x;
  }
  .tag-card::after {
    content: "";
    position: absolute;
    top: 5px; left: 18px; right: 18px;
    border-top: 2px dashed var(--border);
  }
  
  .tag-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-top: 6px;
  }
  
  .tag-card-title { font-size: 17px; font-weight: 700; line-height: 1.3; }
  
  .tag-date {
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 999px;
    padding: 5px 10px;
    white-space: nowrap;
  }
  .tag-date.no-date { color: var(--text-muted); background: var(--surface-alt); }
  
  .tag-card-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 14px;
  }
  
  .chip-btn {
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
    padding: 9px 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
  }
  .chip-btn:active { transform: scale(0.96); }
  
  .chip-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    grid-column: 1 / -1; /* "Подарки" — на всю ширину сверху, главное действие */
    box-shadow: 0 4px 12px rgba(91, 33, 182, 0.25);
  }
  
  .chip-btn.danger {
    color: var(--danger);
    border-color: #F7D7D8;
  }
  .chip-btn.danger:active { background: #FDEDED; }
  
  .gifts-panel { display: none; margin-top: 16px; }
  .gifts-panel.open { display: block; }
  
  /* ---------- gift grid (product-card echo) ---------- */
  
  .gifts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 4px;
  }
  
  .gift-card {
    position: relative;
    background: var(--surface-alt);
    border-radius: var(--radius-md);
    padding: 8px;
    overflow: visible;
  }
  
  .gift-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
  }
  .gift-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
  
  .gift-remove {
    position: absolute;
    top: -6px; right: -6px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--text);
    color: #fff;
    border: 2px solid var(--bg);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .price-tag {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--gold);
    color: #2A1B00;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 11px;
    padding: 3px 8px 3px 12px;
    border-radius: 0 6px 6px 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    mask-image: radial-gradient(circle 3px at 5px 50%, transparent 3px, black 3.4px);
    -webkit-mask-image: radial-gradient(circle 3px at 5px 50%, transparent 3px, black 3.4px);
  }
  
  .gift-name {
    font-size: 12.5px;
    font-weight: 600;
    margin: 8px 2px 2px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  .gift-link-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin: 4px 2px 2px;
  }
  
  .gifts-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 18px 8px;
    color: var(--text-muted);
    font-size: 13px;
  }
  
  /* ---------- gift add form (inline, inside panel) ---------- */
  
  .add-gift-trigger {
    width: 100%;
    border: 1.5px dashed var(--border);
    background: transparent;
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
  }
  .add-gift-trigger:active { background: var(--primary-soft); }
  
  /* ---------- gift actions (edit / reserve) ---------- */
  
  .gift-actions-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
  }
  
  .gift-edit {
    width: 100%;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 11px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
  }
  .gift-reserve {
    width: 100%;
    border: 1.5px solid transparent;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 8px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
  }
  .gift-reserve:active { transform: scale(0.97); }

  /* уже забронировано мной — кнопка "Отменить бронь", менее навязчивая */
  .gift-reserve[data-reserved="true"] {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--accent);
  }

  /* владелец списка снимает чужую бронь — предупреждающий цвет */
  .gift-reserve.owner-cancel {
    background: var(--danger);
    color: #fff;
  }
  
  .gift-reserved-badge {
    width: 100%;
    text-align: center;
    background: var(--surface-alt);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
  }
  
  .shared-banner .gift-reserve {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.4);
    color: #fff;
  }
  .shared-banner .gift-reserved-badge {
    background: rgba(255,255,255,0.16);
    color: #fff;
  }
  
  
  /* ---------- shared wishlist banner ---------- */
  
  .shared-banner {
    position: relative;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 18px 18px 20px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-lg);
  }
  .shared-banner .eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.85;
    font-weight: 600;
  }
  .shared-banner h3 { font-size: 18px; margin: 6px 0 2px; }
  .shared-banner .date-line { font-family: 'JetBrains Mono', monospace; font-size: 12px; opacity: 0.9; }
  .shared-banner .gifts-grid { margin-top: 14px; }
  .shared-banner .gift-card { background: rgba(255,255,255,0.16); }
  .shared-banner .gift-thumb-wrap { background: rgba(255,255,255,0.9); }
  .shared-banner .gift-name { color: #fff; }
  .shared-banner .gift-link-chip { color: #fff; text-decoration: underline; }
  
  /* ---------- floating action button ---------- */
  
  .fab {
    position: fixed;
    right: 20px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    box-shadow: 0 10px 26px rgba(232,54,143,0.35);
    cursor: pointer;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .fab:active { transform: scale(0.94); }
  
  /* ---------- bottom sheet ---------- */
  
  .sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(36, 25, 52, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    z-index: 50;
  }
  .sheet-overlay.visible { opacity: 1; pointer-events: auto; }
  
  .sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    max-width: 480px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 22px 22px 0 0;
    padding: 10px 20px 28px;
    box-shadow: var(--shadow-lg);
    transform: translateY(105%);
    transition: transform 0.28s cubic-bezier(.2,.8,.25,1);
    z-index: 60;
    max-height: 86vh;
    overflow-y: auto;
  }
  .sheet.open { transform: translateY(0); }
  
  .sheet-handle {
    width: 40px; height: 4px;
    background: var(--border);
    border-radius: 999px;
    margin: 6px auto 14px;
  }
  
  .sheet h2 { font-size: 18px; margin-bottom: 16px; }
  
  .sheet label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 14px 0 6px;
  }
  .sheet label:first-of-type { margin-top: 0; }
  
  /* ---------- inputs & buttons ---------- */
  
  input[type="text"], input[type="date"], input:not([type]), input[type="tel"] {
    width: 100%;
  }
  
  .sheet input, input#title, input#date {
    width: 100%;
    border: 1.5px solid var(--border);
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    outline: none;
  }
  .sheet input:focus {
    border-color: var(--primary);
    background: #fff;
  }
  
  .file-drop { display: flex; align-items: center; gap: 12px; }
  .file-btn {
    display: inline-block;
    border: 1.5px solid var(--border);
    background: var(--surface-alt);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
  }
  .pic-preview {
    width: 48px; height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm);
  }

  /* ---------- input with suffix (ДОБАВЛЕНО: значок ₽ справа внутри поля) ---------- */

  .input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
  }

  .input-with-suffix input {
    width: 100%;
    padding-right: 34px; /* чтобы текст не наезжал на значок */
  }

  .input-suffix {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 600;
    pointer-events: none;
  }
  
  .btn {
    width: 100%;
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    margin-top: 22px;
    cursor: pointer;
  }
  .btn-primary { background: var(--primary); color: #fff; }
  .btn-accent { background: var(--accent); color: #fff; }
  .btn:active { transform: scale(0.98); }
  
  .form-status {
    min-height: 18px;
    font-size: 13px;
    margin: 10px 0 0;
    font-weight: 600;
  }
  .form-status.error { color: var(--danger); }
  .form-status.success { color: var(--success); }

  /* ---------- not telegram screen ---------- */

.not-telegram-screen {
  text-align: center;
  padding: 60px 24px;
  max-width: 480px;
  margin: 0 auto;
}
.not-telegram-screen .glyph {
  font-size: 44px;
  display: block;
  margin-bottom: 16px;
}
.not-telegram-screen h2 {
  font-size: 19px;
  margin-bottom: 10px;
  color: var(--text);
}
.not-telegram-screen p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}


.follow-btn {
  width: 100%;
  margin-top: 12px;
  border: 1.5px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.16);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.follow-btn:active { transform: scale(0.98); }
  /* ---------- focus visibility ---------- */
  button:focus-visible, input:focus-visible, a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }
  
  @media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  }