/* MercadilloGeek 3.8 · Telegram + sesión móvil/PWA */
.mg-header-actions .mg-account > .mg-avatar {
  align-items: center !important;
  background: linear-gradient(135deg, #5b70f5, #121827) !important;
  color: #fff !important;
  display: inline-flex !important;
  flex: 0 0 var(--mg-avatar-size, 35px) !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  height: var(--mg-avatar-size, 35px) !important;
  justify-content: center !important;
  opacity: 1 !important;
  overflow: hidden !important;
  visibility: visible !important;
  width: var(--mg-avatar-size, 35px) !important;
}
.mg-header-actions .mg-account > .mg-avatar img {
  display: block !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover !important;
  opacity: 1 !important;
  visibility: visible !important;
  width: 100% !important;
}
.mg-header-actions .mg-account > .mg-account-label { display: inline !important; }

.mg-telegram-panel { background: #fff; border: 1px solid #dce4ef; border-radius: 24px; box-shadow: 0 22px 55px #17243f12; margin: 42px 0; overflow: hidden; }
.mg-telegram-head { align-items: center; background: linear-gradient(135deg, #eff9ff, #fff 58%, #f1f4ff); border-bottom: 1px solid #dce9f3; display: grid; gap: 18px; grid-template-columns: auto 1fr auto; padding: 26px 30px; }
.mg-telegram-head h2 { font-size: 29px; letter-spacing: -1px; margin: 4px 0; }
.mg-telegram-head p { color: #526176; font-size: 15px; margin: 0; max-width: 720px; }
.mg-telegram-head > strong { background: #e8edf4; border-radius: 999px; color: #506177; font-size: 11px; letter-spacing: .8px; padding: 8px 12px; }
.mg-telegram-panel.is-connected .mg-telegram-head > strong { background: #dafbea; color: #087b49; }
.mg-telegram-plane { align-items: center; background: linear-gradient(145deg, #36b8f2, #1887ce); border-radius: 18px; box-shadow: 0 12px 24px #229ed955; color: #fff; display: flex; font-size: 31px; height: 62px; justify-content: center; position: relative; transform: rotate(-8deg); width: 62px; }
.mg-telegram-plane i { align-items: center; background: #fff; border: 2px solid #229ed9; border-radius: 50%; color: #0d8bcc; display: flex; font-size: 10px; font-style: normal; height: 21px; justify-content: center; position: absolute; right: -5px; top: -6px; width: 21px; }
.mg-telegram-unavailable { background: #fff8e9; border: 1px solid #ffe1a1; border-radius: 14px; margin: 25px 30px 30px; padding: 18px 20px; }
.mg-telegram-unavailable b { color: #8a4f00; font-size: 16px; }
.mg-telegram-unavailable p { color: #6c5c43; margin: 4px 0 0; }
.mg-telegram-connect { align-items: center; display: grid; gap: 28px; grid-template-columns: 1fr auto; padding: 28px 30px 32px; }
.mg-telegram-connect b { font-size: 18px; }
.mg-telegram-connect ol { color: #445165; margin: 12px 0; padding-left: 22px; }
.mg-telegram-connect li { margin: 7px 0; }
.mg-telegram-connect small { color: #6c7788; font-size: 13px; }
.mg-telegram-connect-button { align-items: center; background: linear-gradient(135deg, #229ed9, #167db9); border-radius: 13px; box-shadow: 0 12px 26px #229ed940; color: #fff !important; display: flex; font-size: 16px; font-weight: 850; gap: 9px; padding: 15px 20px; }
.mg-telegram-connect-button span { font-size: 21px; }
.mg-telegram-identity { align-items: center; background: #f5fbff; border: 1px solid #d4ecf8; border-radius: 15px; display: flex; gap: 14px; margin: 25px 30px 0; padding: 15px 17px; }
.mg-telegram-identity > span { align-items: center; background: #229ed9; border-radius: 12px; color: #fff; display: flex; font-size: 20px; height: 43px; justify-content: center; width: 43px; }
.mg-telegram-identity > div { display: grid; flex: 1; }
.mg-telegram-identity small { color: #688096; font-size: 10px; font-weight: 850; letter-spacing: .9px; }
.mg-telegram-identity b { font-size: 17px; }
.mg-telegram-identity em { color: #68768a; font-size: 12px; font-style: normal; }
.mg-telegram-identity button { background: #fff; border: 1px solid #b9ddef; border-radius: 9px; color: #0b6fa7; cursor: pointer; font-size: 13px; font-weight: 800; padding: 10px 13px; }
.mg-telegram-preferences { padding: 24px 30px 10px; }
.mg-telegram-options { display: grid; gap: 11px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mg-telegram-options > label { align-items: center; background: #f8fafc; border: 1px solid #e0e6ee; border-radius: 14px; cursor: pointer; display: grid; gap: 12px; grid-template-columns: auto 1fr auto; min-height: 82px; padding: 14px; transition: border-color .2s, box-shadow .2s, transform .2s; }
.mg-telegram-options > label:hover { border-color: #92cdeb; box-shadow: 0 8px 22px #1b91ca14; transform: translateY(-1px); }
.mg-telegram-options input { height: 1px; opacity: 0; position: absolute; width: 1px; }
.mg-telegram-option-icon { align-items: center; background: #e8f6fd; border-radius: 11px; color: #147dae; display: flex; font-size: 18px; height: 42px; justify-content: center; width: 42px; }
.mg-telegram-options label > span:nth-of-type(2) { display: grid; gap: 3px; }
.mg-telegram-options label b { color: #111827; font-size: 15px; }
.mg-telegram-options label small { color: #68768a; font-size: 12px; line-height: 1.35; }
.mg-telegram-options label > i { background: #c6ced8; border-radius: 999px; height: 24px; position: relative; transition: background .2s; width: 43px; }
.mg-telegram-options label > i::after { background: #fff; border-radius: 50%; box-shadow: 0 2px 6px #0003; content: ""; height: 18px; left: 3px; position: absolute; top: 3px; transition: transform .2s; width: 18px; }
.mg-telegram-options input:checked ~ i { background: #229ed9; }
.mg-telegram-options input:checked ~ i::after { transform: translateX(19px); }
.mg-telegram-options label:has(input:checked) { background: #f4fbff; border-color: #9ed8f3; }
.mg-telegram-actions { display: flex; justify-content: flex-end; padding-top: 18px; }
.mg-telegram-disconnect { border-top: 1px solid #edf0f4; margin: 14px 30px 0; padding: 17px 0 23px; text-align: right; }
.mg-telegram-disconnect button { background: none; border: 0; color: #8a5360; cursor: pointer; font-size: 12px; font-weight: 750; text-decoration: underline; }

.mg-telegram-admin { padding-bottom: 70px; }
.mg-telegram-admin-hero { align-items: center; background: linear-gradient(135deg, #091b2b, #102b42 55%, #133f59); border-radius: 24px; color: #fff; display: grid; gap: 25px; grid-template-columns: auto 1fr auto; margin: 25px 0; overflow: hidden; padding: 31px; position: relative; }
.mg-telegram-admin-hero::after { background: #229ed929; border-radius: 50%; content: ""; height: 230px; position: absolute; right: -70px; top: -100px; width: 230px; }
.mg-telegram-admin-hero h1 { color: #fff; font-size: 36px; margin: 7px 0; }
.mg-telegram-admin-hero p { color: #c8dfed; font-size: 15px; margin: 0; max-width: 720px; }
.mg-telegram-admin-hero > strong { background: #ffffff12; border: 1px solid #ffffff25; border-radius: 999px; color: #71e4ab; font-size: 12px; padding: 9px 13px; position: relative; z-index: 1; }
.mg-telegram-bot { align-items: center; background: #229ed9; border-radius: 20px; box-shadow: 0 15px 30px #0005; display: flex; font-size: 35px; height: 72px; justify-content: center; position: relative; transform: rotate(-6deg); width: 72px; }
.mg-telegram-bot i { background: #bff35c; border-radius: 5px; bottom: -7px; color: #152009; font-size: 9px; font-style: normal; font-weight: 900; padding: 4px 6px; position: absolute; right: -8px; }
.mg-telegram-admin-stats { display: grid; gap: 13px; grid-template-columns: repeat(3, 1fr); margin-bottom: 20px; }
.mg-telegram-admin-stats > div { background: #fff; border: 1px solid #e0e5eb; border-radius: 15px; display: grid; gap: 6px; padding: 18px 20px; }
.mg-telegram-admin-stats small { color: #738094; font-size: 10px; font-weight: 850; letter-spacing: 1px; }
.mg-telegram-admin-stats b { font-size: 20px; }
.mg-telegram-admin-error { background: #fff1f1; border: 1px solid #ffc8c8; border-radius: 13px; color: #761d25; margin: 18px 0; padding: 15px 18px; }
.mg-telegram-admin-error p { margin: 3px 0 0; }
.mg-telegram-admin-grid { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; }
.mg-telegram-admin-grid > article { background: #fff; border: 1px solid #dde3ea; border-radius: 19px; padding: 25px; }
.mg-telegram-admin-grid h2 { font-size: 24px; margin: 7px 0 20px; }
.mg-telegram-admin-grid form > label:not(.mg-telegram-master) { display: grid; font-size: 13px; font-weight: 800; gap: 7px; }
.mg-telegram-admin-grid input[type="password"] { background: #f8fafc; border: 1px solid #d7dee7; border-radius: 10px; font-size: 15px; min-height: 48px; padding: 11px 13px; width: 100%; }
.mg-telegram-admin-grid form label small { color: #6d7888; font-size: 11px; font-weight: 500; }
.mg-telegram-master { align-items: center; background: #f2f9fd; border: 1px solid #d4eaf5; border-radius: 12px; cursor: pointer; display: grid; gap: 12px; grid-template-columns: 1fr auto; margin: 17px 0; padding: 14px; }
.mg-telegram-master input { height: 1px; opacity: 0; position: absolute; width: 1px; }
.mg-telegram-master span { display: grid; gap: 2px; }
.mg-telegram-master i { background: #bdc7d1; border-radius: 999px; height: 27px; position: relative; width: 47px; }
.mg-telegram-master i::after { background: #fff; border-radius: 50%; box-shadow: 0 2px 7px #0003; content: ""; height: 21px; left: 3px; position: absolute; top: 3px; transition: transform .2s; width: 21px; }
.mg-telegram-master input:checked ~ i { background: #229ed9; }
.mg-telegram-master input:checked ~ i::after { transform: translateX(20px); }
.mg-telegram-steps ol { display: grid; gap: 14px; list-style: none; margin: 0; padding: 0; }
.mg-telegram-steps li { align-items: flex-start; display: grid; gap: 12px; grid-template-columns: auto 1fr; }
.mg-telegram-steps li > b { align-items: center; background: #e8f6fd; border-radius: 10px; color: #147cae; display: flex; height: 34px; justify-content: center; width: 34px; }
.mg-telegram-steps li span { color: #4e5c70; font-size: 14px; line-height: 1.5; }
.mg-telegram-webhook { background: #111827; border-radius: 11px; display: grid; gap: 6px; margin-top: 20px; padding: 14px; }
.mg-telegram-webhook small { color: #83d6f8; font-size: 9px; font-weight: 900; letter-spacing: 1px; }
.mg-telegram-webhook code { color: #ecf8ff; font-size: 11px; overflow-wrap: anywhere; }
.mg-telegram-security { background: #f5f7fa; border-radius: 15px; display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 18px; padding: 18px 20px; }
.mg-telegram-security b { flex-basis: 100%; }
.mg-telegram-security span { color: #586679; font-size: 12px; }
.mg-telegram-security span::before { color: #1592ca; content: "✓ "; font-weight: 900; }

@media (max-width: 760px) {
  .mg-header-actions .mg-account { display: inline-flex !important; flex-basis: 40px !important; height: 40px !important; justify-content: center !important; min-width: 40px !important; padding: 2px !important; width: 40px !important; }
  .mg-header-actions .mg-account > .mg-account-label { display: none !important; }
  .mg-header-actions .mg-account > .mg-avatar { --mg-avatar-size: 34px !important; border: 2px solid #fff !important; box-shadow: 0 0 0 1px #cdd5df !important; }
  .mg-telegram-head { align-items: start; grid-template-columns: auto 1fr; padding: 21px 18px; }
  .mg-telegram-head > strong { grid-column: 1 / -1; justify-self: start; }
  .mg-telegram-plane { font-size: 24px; height: 50px; width: 50px; }
  .mg-telegram-head h2 { font-size: 25px; }
  .mg-telegram-connect { grid-template-columns: 1fr; padding: 22px 18px 26px; }
  .mg-telegram-connect-button { justify-content: center; text-align: center; }
  .mg-telegram-identity { align-items: flex-start; flex-wrap: wrap; margin: 20px 18px 0; }
  .mg-telegram-identity form { flex-basis: 100%; }
  .mg-telegram-identity button { width: 100%; }
  .mg-telegram-preferences { padding: 20px 18px 8px; }
  .mg-telegram-options { grid-template-columns: 1fr; }
  .mg-telegram-disconnect { margin-inline: 18px; }
  .mg-telegram-admin-hero { grid-template-columns: auto 1fr; padding: 23px 18px; }
  .mg-telegram-admin-hero > strong { grid-column: 1 / -1; justify-self: start; }
  .mg-telegram-admin-hero h1 { font-size: 29px; }
  .mg-telegram-bot { font-size: 27px; height: 57px; width: 57px; }
  .mg-telegram-admin-stats, .mg-telegram-admin-grid { grid-template-columns: 1fr; }
  .mg-telegram-admin-grid > article { padding: 20px 17px; }
}

@media (display-mode: standalone) {
  .mg-header-actions .mg-account > .mg-avatar { display: inline-flex !important; opacity: 1 !important; visibility: visible !important; }
}
