.ag-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--ui-font);
    color: var(--ui-text);
    animation: ag-fade-in 0.22s ease-out;
}
@keyframes ag-fade-in { from { opacity: 0; } to { opacity: 1; } }
.ag-overlay.ag-fading { opacity: 0; transition: opacity 0.18s ease-out; pointer-events: none; }

.ag-card {
    position: relative;
    width: min(380px, 92vw);
    background: var(--ui-bg);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    padding: 28px 30px 24px;
    animation: ag-pop-in 0.28s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}
@keyframes ag-pop-in { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.ag-langs { position: absolute; top: 12px; right: 12px; display: flex; gap: 4px; }
.ag-lang {
    background: transparent; border: 1px solid transparent; color: var(--ui-text-muted);
    font-family: var(--ui-font); font-size: 11px; font-weight: 600; letter-spacing: 0.6px;
    padding: 3px 8px; border-radius: 99px; cursor: pointer;
}
.ag-lang:hover { color: var(--ui-text); border-color: var(--ui-border); }
.ag-lang.on { color: var(--ui-text); border-color: var(--ui-border); background: var(--ui-bg-deep); }

.ag-brand { display: flex; justify-content: center; color: var(--ui-brand-mark); margin: 4px 0 12px; }
.ag-title {
    margin: 0 0 4px; text-align: center;
    font-family: var(--ui-font); font-size: 16px; font-weight: 600;
    letter-spacing: 1.4px; text-transform: uppercase; color: #fff;
}
.ag-sub { margin: 0 0 20px; text-align: center; font-size: 12px; color: var(--ui-text-dim); }
.ag-tag { margin: 0 0 14px; text-align: center; font-size: 12px; line-height: 1.45; color: var(--ui-text-dim); opacity: .85; }

.ag-tabs { display: flex; border-bottom: 1px solid var(--ui-border); margin-bottom: 18px; }
.ag-tab {
    flex: 1; padding: 9px 4px; background: none; border: none; border-bottom: 2px solid transparent;
    margin-bottom: -1px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ui-text-dim);
    font-family: var(--ui-font); transition: color .15s, border-color .15s;
}
.ag-tab:hover { color: var(--ui-text); }
.ag-tab.on { color: var(--ui-text); border-bottom-color: var(--ui-accent); }

.ag-label {
    display: block; margin: 0 0 6px; font-size: 11px; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase; color: var(--ui-text-dim);
}
.ag-card input[type="text"], .ag-card input[type="password"] {
    width: 100%; box-sizing: border-box; margin: 0 0 14px;
    background: var(--ui-bg-input); border: 1px solid var(--ui-border); color: var(--ui-text);
    padding: 11px 13px; border-radius: var(--ui-radius-sm); font-size: 14px; font-family: var(--ui-font);
    outline: none; transition: border-color .15s;
}
.ag-card input:focus { border-color: var(--ui-border-focus); }
.ag-card input.ag-mono { font-family: var(--ui-font-code); letter-spacing: .1em; }
.ag-user-box.ag-prefixed {
    display: flex; align-items: center; margin: 0 0 14px;
    background: var(--ui-bg-input); border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm);
    transition: border-color .15s;
}
.ag-user-box.ag-prefixed:focus-within { border-color: var(--ui-border-focus); }
.ag-prefix { padding-left: 13px; font-family: var(--ui-font); font-variant-numeric: tabular-nums; font-size: 14px; color: var(--ui-text-dim); white-space: nowrap; user-select: none; }
.ag-card .ag-user-box.ag-prefixed input { margin: 0; border: none; background: transparent; padding-left: 1px; font-family: var(--ui-font); font-variant-numeric: tabular-nums; }
.ag-team-note { margin: 0 0 14px; font-size: 12px; text-align: center; color: var(--ui-accent-hover); }
.ag-login-preview { margin: -8px 0 14px; font-size: 12px; color: var(--ui-text-dim); }
.ag-team-hint { margin: -6px 0 14px; font-size: 11px; line-height: 1.45; text-align: center; color: var(--ui-text-muted); }
.ag-login-preview b { font-family: var(--ui-font); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ui-text); }
.ag-pwd { position: relative; }
.ag-pwd input { padding-right: 40px; }
.ag-eye {
    position: absolute; top: 0; right: 4px; height: 42px; width: 32px;
    background: none; border: none; color: var(--ui-text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.ag-eye:hover { color: var(--ui-text); }

.ag-forgot { margin: -6px 0 14px; text-align: right; font-size: 11px; }
.ag-card a { color: var(--ui-text-dim); text-decoration: none; }
.ag-card a:hover { color: var(--ui-accent-hover); }
.ag-foot { margin: 14px 0 0; text-align: center; font-size: 12px; color: var(--ui-text-dim); }
.ag-foot a { color: var(--ui-accent-hover); }

.ag-submit {
    width: 100%; padding: 12px; border: 1px solid var(--ui-accent); border-radius: var(--ui-radius-sm);
    background: var(--ui-accent); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
    font-family: var(--ui-font); transition: background .15s, opacity .15s;
}
.ag-submit:hover { background: var(--ui-accent-hover); }
.ag-submit:disabled { opacity: .5; cursor: not-allowed; }
.ag-submit.busy { opacity: .7; cursor: progress; }

.ag-hint { margin: 0 0 16px; font-size: 12px; line-height: 1.5; text-align: center; color: var(--ui-text-dim); }
.ag-agree { display: flex; align-items: flex-start; gap: 9px; margin: 4px 0 16px; font-size: 12px; line-height: 1.5; color: var(--ui-text-dim); cursor: pointer; text-align: left; }
.ag-agree input { flex: 0 0 auto; width: 15px; height: 15px; margin: 2px 0 0; accent-color: var(--ui-accent); cursor: pointer; }
.ag-agree a { color: var(--ui-accent-hover); }
.ag-ts { display: flex; justify-content: center; margin: 0 0 12px; }
.ag-ts:empty { margin: 0; }
.ag-agree a:hover { color: var(--ui-live); }
.ag-hint-accent { color: var(--ui-accent-hover); }
.ag-banner, .ag-error, .ag-success {
    font-size: 12px; line-height: 1.45; text-align: center;
    border-radius: var(--ui-radius-sm); padding: 9px 12px; margin: 0 0 14px;
}
.ag-banner  { color: #e0b15a; background: rgba(224, 177, 90, .08); border: 1px solid rgba(224, 177, 90, .3); }
.ag-error   { color: #ff8a86; background: rgba(224, 90, 90, .08);  border: 1px solid rgba(224, 90, 90, .3); }
.ag-success { color: var(--ui-accent-hover); background: var(--ui-accent-glow); border: 1px solid var(--ui-accent); }

.pw-meter { display: none; margin: -8px 0 12px; }
.pw-meter.on { display: block; }
.pw-bar { display: flex; gap: 4px; height: 4px; }
.pw-bar i { flex: 1; border-radius: 2px; background: var(--ui-bg-input); transition: background .2s; }
.pw-bar.pw-s1 i:nth-child(-n+1), .pw-bar.pw-s0 i:nth-child(-n+1) { background: #e05a5a; }
.pw-bar.pw-s2 i:nth-child(-n+2) { background: #e0b15a; }
.pw-bar.pw-s3 i:nth-child(-n+3) { background: var(--ui-accent); }
.pw-bar.pw-s4 i { background: #5ac48a; }
.pw-label { margin-top: 5px; font-size: 11px; line-height: 1.4; color: var(--ui-text-muted); }
.pw-label.pw-weak { color: #ff8a86; }
.pw-label.pw-medium { color: #e0b15a; }
.pw-label.pw-good { color: var(--ui-accent-hover); }
.pw-label.pw-strong { color: #5ac48a; }
.acc-form .pw-meter { margin: -4px 0 0; }

@media (max-width: 560px) {
    .ag-overlay { align-items: stretch; justify-content: stretch; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--ui-bg-deep, #181818); }
    .ag-card {
        width: 100%; max-width: none; min-height: 100%; box-sizing: border-box;
        border: 0; border-radius: 0; box-shadow: none; animation: none;
        display: flex; flex-direction: column; justify-content: center;
        padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    }
    .ag-card input[type="text"], .ag-card input[type="password"] { font-size: 16px; padding: 13px 14px; }
    .ag-submit { padding: 14px; font-size: 15px; }
    .ag-tabs { margin-bottom: 22px; }
}
