/* Final UI layer for dynamic Mini App views. Kept last to make the legacy
 * presentation enhancements harmless on Telegram Desktop's narrow webview. */
html[data-layout-repair="v2"] :where(.flow-tabs, .flow-lot, .subscription-card, .profile-overview) {
  min-width: 0;
}

html[data-layout-repair="v2"] .lots-luxury-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(198, 158, 70, 0.42);
  border-radius: 14px;
  color: #e8dcc2;
  background: linear-gradient(110deg, rgba(35, 27, 13, 0.88), rgba(10, 28, 37, 0.9));
  font-size: 12px;
}
html[data-layout-repair="v2"] .lots-luxury-status > span { color: #e7b75a; font-size: 18px; }
html[data-layout-repair="v2"] .lots-luxury-status strong { color: #fff1cc; white-space: nowrap; }
html[data-layout-repair="v2"] .lots-luxury-status em { color: #aeb9b7; font-style: normal; }
html[data-layout-repair="v2"] .lots-luxury-status.is-active { border-color: rgba(221, 182, 83, 0.8); }

html[data-layout-repair="v2"] .flow-lot.has-ui-thumb {
  grid-template-columns: minmax(86px, 104px) minmax(0, 1fr) !important;
  gap: 12px !important;
  padding: 12px !important;
  border-color: rgba(201, 166, 89, 0.47);
}
html[data-layout-repair="v2"] .flow-lot .ui-lot-thumb {
  max-width: 104px !important;
  border-radius: 11px;
  border: 1px solid rgba(205, 170, 83, 0.6);
  background: radial-gradient(circle at 30% 20%, #294153, #0b202c 74%);
}
html[data-layout-repair="v2"] .flow-lot .ui-lot-thumb > span:first-child,
html[data-layout-repair="v2"] .subscription-card-thumb > span:first-child {
  display: grid;
  place-items: center;
  height: 100%;
  color: #e2b95f;
  font-family: Georgia, serif;
  font-size: 24px;
}
html[data-layout-repair="v2"] .flow-lot .ui-lot-thumb img,
html[data-layout-repair="v2"] .subscription-card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
html[data-layout-repair="v2"] .flow-lot .layout-lot-title { font-size: clamp(18px, 5vw, 23px) !important; line-height: 1.05 !important; }
html[data-layout-repair="v2"] .flow-lot .flow-actions { gap: 8px; }
html[data-layout-repair="v2"] .flow-lot .flow-actions > button { flex: 1 1 135px; }

html[data-layout-repair="v2"] .subscription-decks { gap: 14px; }
html[data-layout-repair="v2"] .subscription-deck {
  overflow: hidden;
  border: 1px solid rgba(202, 168, 91, 0.38);
  border-radius: 14px;
  background: rgba(5, 22, 31, 0.56);
}
html[data-layout-repair="v2"] .subscription-deck-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: #e8d3a2;
  background: linear-gradient(90deg, rgba(113, 76, 24, 0.34), transparent);
}
html[data-layout-repair="v2"] .subscription-deck-heading > span { color: #bca577; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
html[data-layout-repair="v2"] .subscription-deck-heading strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-layout-repair="v2"] .subscription-deck-heading em { display: grid; place-items: center; min-width: 23px; height: 23px; border-radius: 999px; color: #f5e9cf; background: rgba(183, 32, 42, .7); font-style: normal; font-size: 12px; }
html[data-layout-repair="v2"] .subscription-card-grid { display: grid; gap: 0; }
html[data-layout-repair="v2"] .subscription-card {
  display: grid !important;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0 !important;
  padding: 10px 12px !important;
  border: 0 !important;
  border-radius: 0 !important;
  border-top: 1px solid rgba(201, 170, 103, 0.18) !important;
  background: transparent !important;
}
html[data-layout-repair="v2"] .subscription-card-thumb { width: 52px; height: 66px; overflow: hidden; border: 1px solid rgba(205, 170, 83, 0.5); border-radius: 8px; background: #102937; }
html[data-layout-repair="v2"] .subscription-card-copy { display: grid; gap: 4px; min-width: 0; }
html[data-layout-repair="v2"] .subscription-card-copy strong { color: #fbf1dd; line-height: 1.12; }
html[data-layout-repair="v2"] .subscription-card-copy span { color: #a9b1ab; font-size: 11px; line-height: 1.25; }
html[data-layout-repair="v2"] .subscription-card .flow-danger-compact { padding: 7px 9px; font-size: 11px; }

html[data-layout-repair="v2"] .profile-card { align-items: center; padding: 18px !important; }
html[data-layout-repair="v2"] .profile-card .profile-copy { min-width: 0; }
html[data-layout-repair="v2"] .profile-overview { display: grid; gap: 14px; padding: 16px !important; }
html[data-layout-repair="v2"] .profile-overview-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
html[data-layout-repair="v2"] .profile-overview-head h2 { margin: 2px 0 0; color: #fff0d1; }
html[data-layout-repair="v2"] .profile-luxury-chip { padding: 6px 9px; border: 1px solid rgba(192, 154, 72, .45); border-radius: 999px; color: #b8c4bd; font-size: 11px; white-space: nowrap; }
html[data-layout-repair="v2"] .profile-luxury-chip.is-active { color: #ffe4a1; background: rgba(156, 104, 24, .22); border-color: rgba(232, 185, 86, .75); }
html[data-layout-repair="v2"] .profile-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid rgba(205, 173, 104, .28); border-bottom: 1px solid rgba(205, 173, 104, .28); }
html[data-layout-repair="v2"] .profile-stat-grid > div { display: grid; gap: 4px; min-width: 0; padding: 11px 9px; }
html[data-layout-repair="v2"] .profile-stat-grid > div + div { border-left: 1px solid rgba(205, 173, 104, .2); }
html[data-layout-repair="v2"] .profile-stat-grid span, html[data-layout-repair="v2"] .profile-stat-grid em { color: #9eaaa4; font-size: 10px; font-style: normal; line-height: 1.2; }
html[data-layout-repair="v2"] .profile-stat-grid strong { overflow: hidden; color: #f8e8c4; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
html[data-layout-repair="v2"] .profile-quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
html[data-layout-repair="v2"] .profile-quick-actions button { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; text-align: left; padding: 11px; border: 1px solid rgba(205, 169, 92, .36); border-radius: 12px; color: #f4e7cf; background: rgba(11, 33, 43, .72); }
html[data-layout-repair="v2"] .profile-quick-actions button > span { grid-row: span 2; color: #e0b45a; font-size: 19px; }
html[data-layout-repair="v2"] .profile-quick-actions button > strong { font-size: 13px; }
html[data-layout-repair="v2"] .profile-quick-actions button > em { color: #aeb8b1; font-size: 10px; font-style: normal; line-height: 1.2; }

@media (max-width: 420px) {
  html[data-layout-repair="v2"] .flow-tabs { gap: 3px; padding: 3px; overflow-x: auto; scrollbar-width: none; }
  html[data-layout-repair="v2"] .flow-tab { flex: 0 0 auto; padding-inline: 11px; font-size: 11px; }
  html[data-layout-repair="v2"] .lots-luxury-status em { display: none; }
  html[data-layout-repair="v2"] .flow-lot.has-ui-thumb { grid-template-columns: 82px minmax(0, 1fr) !important; padding: 10px !important; gap: 10px !important; }
  html[data-layout-repair="v2"] .flow-lot .ui-lot-thumb { max-width: 82px !important; }
  html[data-layout-repair="v2"] .profile-stat-grid { grid-template-columns: 1fr; }
  html[data-layout-repair="v2"] .profile-stat-grid > div + div { border-left: 0; border-top: 1px solid rgba(205, 173, 104, .2); }
}

@media (max-width: 350px) {
  html[data-layout-repair="v2"] .subscription-card { grid-template-columns: 44px minmax(0, 1fr) !important; }
  html[data-layout-repair="v2"] .subscription-card-thumb { width: 44px; height: 56px; }
  html[data-layout-repair="v2"] .subscription-card .flow-danger-compact { grid-column: 2; justify-self: start; }
}
