/* Telegram uses the homepage sign-in surface and motion, in a native modal. */
.telegram-auth-dialog {
    position: fixed; inset: 0; margin: 0; width: 100%; height: 100%;
    max-width: none; max-height: none; border: 0; background: transparent; padding: clamp(12px,4vw,24px);
    color: var(--text-primary); overflow: hidden;
}
.telegram-auth-dialog[open] { display: flex; align-items: center; justify-content: center; }
.telegram-auth-dialog::backdrop { background: rgba(4,5,6,.55); backdrop-filter: blur(18px); opacity: 0; transition: opacity 600ms cubic-bezier(.4,0,.2,1); }
.telegram-auth-dialog.active::backdrop { opacity: 1; }
.telegram-auth-dialog.closing::backdrop { opacity: 0; }
.telegram-auth-dialog .auth-box {
    position: relative; box-sizing: border-box; width: 100%; max-width: 440px;
    max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain;
    padding: clamp(20px,5vw,48px); border: 1px solid rgba(255,255,255,.106) !important;
    border-radius: 26px; background: linear-gradient(180deg,var(--exchange-panel-2),var(--exchange-panel)) !important;
    box-shadow: 0 8px 22px rgba(0,0,0,.22); color: var(--text-primary);
    opacity: 0; transform: scale(.88) translateY(32px);
    transition: opacity 600ms cubic-bezier(.4,0,.2,1), transform 600ms cubic-bezier(.4,0,.2,1);
}
.telegram-auth-dialog.active .auth-box { opacity: 1; transform: scale(1) translateY(0); }
.telegram-auth-dialog.closing .auth-box { opacity: 0; transform: scale(.88) translateY(32px); }
body[data-theme="light"] .telegram-auth-dialog .auth-box { background: #fff !important; border-color: rgba(20,24,31,.11) !important; box-shadow: 0 18px 54px rgba(35,45,65,.12); }
.telegram-auth-dialog .auth-close { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text-secondary); font-size: 24px; cursor: pointer; }
.telegram-auth-dialog .auth-title { padding-inline: 24px; font-size: clamp(20px,5vw,28px); line-height: 1.3; font-weight: 700; text-align: center; margin: 12px 0; }
.telegram-auth-dialog .auth-subtitle { font-size: 14px; line-height: 1.8; color: var(--text-secondary); text-align: center; margin: 0 0 24px; }
.telegram-auth-symbol { display: flex; justify-content: center; margin: 8px 0 20px; color: var(--accent); }
.telegram-auth-symbol svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 1.75; }
.telegram-auth-dialog .auth-btn { display: block; box-sizing: border-box; width: 100%; min-height: 48px; text-align: center; padding: 14px 20px; border-radius: 999px; border: 1px solid var(--accent-border); background: var(--accent); color: var(--on-accent,#fff); font: 600 14px/1.5 'Inter',sans-serif; cursor: pointer; text-decoration: none; }
.telegram-auth-status { font-size: 13px; line-height: 1.8; color: var(--text-secondary); text-align: center; margin: 20px 0 0; overflow-wrap: anywhere; }
.telegram-auth-dialog .auth-input { box-sizing: border-box; display: block; width: 100%; min-height: 48px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text-primary); padding: 12px 16px; font: 16px 'Inter',sans-serif; margin: 10px 0 16px; }
.telegram-auth-dialog label { display: block; font-size: 13px; color: var(--text-secondary); margin-top: 20px; }
@media(max-width:900px){.telegram-auth-dialog .auth-box{padding:clamp(16px,4vw,20px);}.telegram-auth-dialog .auth-title{font-size:20px;margin-top:24px;}}
@media(prefers-reduced-motion:reduce){.telegram-auth-dialog::backdrop,.telegram-auth-dialog .auth-box{transition:none !important;}}
body.telegram-auth-open { overflow: hidden; }
.telegram-auth-dialog .auth-btn, .telegram-auth-dialog .auth-btn:hover { background:linear-gradient(135deg,#b72f28 0%,#30100e 100%) !important; color:#fff !important; border-color:rgba(255,107,95,.46) !important; }
/* The cabinet's generic dialog surface must not paint the full-screen host. */
dialog.telegram-auth-dialog { background:transparent !important; border:0 !important; border-radius:0 !important; box-shadow:none !important; }
.telegram-auth-dialog .auth-close { border-radius:50% !important; }
.telegram-auth-dialog .auth-btn { border-radius:999px !important; }
.telegram-auth-dialog .auth-title:focus{outline:none;}
.telegram-auth-dialog .auth-close:focus:not(:focus-visible){outline:none;}
.telegram-auth-dialog .auth-subtitle{margin-bottom:28px;}
.telegram-auth-dialog .telegram-auth-status{padding-top:18px;border-top:1px solid var(--border);margin-top:22px;}
.telegram-auth-dialog .auth-box { padding: 32px; max-width: 460px; scrollbar-width: thin; }
.telegram-auth-dialog .auth-subtitle { line-height: 1.7; }
.telegram-auth-retry { display: block; margin: 14px auto 0; padding: 10px 16px; min-height: 44px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-primary); font: 500 13px/1.5 'Inter', sans-serif; cursor: pointer; }
.telegram-auth-retry:hover { border-color: var(--accent); }
.telegram-auth-reset label { margin-top: 0; color: var(--text-primary); font-size: 14px; font-weight: 500; }
.telegram-auth-password { position: relative; margin: 8px 0 18px; }
.telegram-auth-dialog .telegram-auth-password .auth-input { margin: 0; padding-right: 94px; }
.telegram-auth-dialog .telegram-auth-password-toggle { position: absolute; top: 2px; bottom: 2px; right: 4px; min-width: 80px; min-height: 44px; border: 0 !important; border-radius: 8px !important; background: transparent !important; color: var(--text-secondary) !important; font: 500 12px/1.5 'Inter',sans-serif; cursor: pointer; }
.telegram-auth-dialog .telegram-auth-password-toggle:hover { color: var(--text-primary) !important; background: var(--surface-hover) !important; }
.telegram-auth-password-toggle:focus-visible { outline: 3px solid var(--accent); outline-offset: -2px; }
.telegram-auth-dialog .auth-btn:disabled { opacity: .65; cursor: wait; }
.telegram-auth-dialog .auth-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-muted); }
.telegram-auth-dialog :is(button, a):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.telegram-auth-dialog .telegram-auth-password-toggle:focus-visible { outline-offset: -2px; }
@media(max-width:520px){.telegram-auth-dialog .auth-box{padding:28px 20px;}.telegram-auth-dialog .auth-title{padding-inline:16px;font-size:24px;}}
